2Checkout Donate Options

'; wp_nonce_field('update-options'); echo ''; $settings = twoco_settings_list(); foreach ($settings as $setting) { echo ''; } echo '
'.$setting['display'].''; if ($setting['type']=='radio') { echo $setting['yes'].' '; } else { echo ' />'; } echo $setting['no'].' '; } else { echo ' />'; } } else { echo ''; } echo ' ('.$setting['hint'].')

'; echo ''; } function twoco_settings_list() { $settings = array( array( 'display' => '2CO Seller ID', 'name' => 'twoco_sid', 'value' => '', 'type' => 'textbox', 'hint' => 'your 2CO account number / seller id' ), array( 'display' => 'Default Donation Amount', 'name' => 'twoco_amount', 'value' => '', 'type' => 'textbox', 'hint' => 'the default donation amount, WITHOUT currency signs -- ie. 5.00' ), array( 'display' => 'Force Demo Mode', 'name' => 'twoco_demo', 'value' => 0, 'type' => 'radio', 'yes' => 'On', 'no' => 'Off', 'hint' => 'force all links/buttons to use demo mode' ), ); return $settings; } function twoco_register_settings() { $settings = twoco_settings_list(); foreach ($settings as $setting) { register_setting($setting['name'], $setting['value']); } } function twoco_activation() { $settings = twoco_settings_list(); foreach ($settings as $setting) { add_option($setting['name'], $setting['value']); } } function twoco_deactivation() { $settings = twoco_settings_list(); foreach ($settings as $setting) { delete_option($setting['name']); } } function twoco_settings_link($links) { $settings_link = 'Settings'; array_unshift($links, $settings_link); $support_link = 'Plugin Support'; array_unshift($links, $support_link); return $links; } $plugin = plugin_basename(__FILE__); add_filter("plugin_action_links_$plugin", 'twoco_settings_link' ); // [2checkout] function twoco_donate_button( $atts, $content = 'Donate' ) { extract( shortcode_atts( array( 'type' => 'button', 'sid' => get_option('twoco_sid'), 'amount' => get_option('twoco_amount'), 'noval' => 0, ), $atts ) ); if ($noval==1) { $content .= ' $'.number_format($amount, 2, '.', ','); } if ($type=='button') { $html='

'; } else { $html=''.$content.''; } return $html; } add_shortcode( '2checkout', 'twoco_donate_button' ); // [/2checkout]