Changeset 891793
- Timestamp:
- 04/12/2014 09:53:40 AM (12 years ago)
- Location:
- crafty-social-buttons/trunk
- Files:
-
- 1 added
- 28 edited
-
README.txt (modified) (3 diffs)
-
class-SH-Crafty-Social-Buttons-Admin.php (modified) (7 diffs)
-
class-SH-Crafty-Social-Buttons-Plugin.php (modified) (5 diffs)
-
class-SH-Crafty-Social-Buttons-Shortcode.php (modified) (7 diffs)
-
crafty-social-buttons.php (modified) (1 diff)
-
css/admin.min.css (modified) (1 diff)
-
css/public.min.css (modified) (1 diff)
-
help/adding-icons-tab.php (modified) (1 diff)
-
js/admin.min.js (modified) (1 diff)
-
js/public.min.js (added)
-
services/class-SH_Craftsy.php (modified) (1 diff)
-
services/class-SH_Digg.php (modified) (3 diffs)
-
services/class-SH_Email.php (modified) (1 diff)
-
services/class-SH_Etsy.php (modified) (1 diff)
-
services/class-SH_Facebook.php (modified) (3 diffs)
-
services/class-SH_Flickr.php (modified) (1 diff)
-
services/class-SH_Google.php (modified) (3 diffs)
-
services/class-SH_Instagram.php (modified) (1 diff)
-
services/class-SH_LinkedIn.php (modified) (3 diffs)
-
services/class-SH_Pinterest.php (modified) (3 diffs)
-
services/class-SH_RSS.php (modified) (1 diff)
-
services/class-SH_Ravelry.php (modified) (1 diff)
-
services/class-SH_Reddit.php (modified) (4 diffs)
-
services/class-SH_Social_Service.php (modified) (3 diffs)
-
services/class-SH_StumbleUpon.php (modified) (2 diffs)
-
services/class-SH_Tumblr.php (modified) (1 diff)
-
services/class-SH_Twitter.php (modified) (2 diffs)
-
services/class-SH_YouTube.php (modified) (1 diff)
-
views/admin.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
crafty-social-buttons/trunk/README.txt
r890035 r891793 92 92 == Changelog == 93 93 94 = 1.2.0 = 95 * Share counts are now loaded via Ajax (so don't slow down the page loading) 96 * Custom icons can be placed under wp-content (so aren't deleted when the plugin is updated) 97 * Fixed issues with share counts not being retrieved because of API changes 98 * Improved layout of share count bubbles 99 100 = 1.1.1 = 101 * Including page/post title in default tweet text is optional 102 94 103 = 1.1.0 = 95 104 * Allows you to choose the size of share and link buttons … … 139 148 == Upgrade Notice == 140 149 150 = 1.2.0 = 151 * Share counts load faster and look better 152 153 = 1.1.1 = 154 * Including page/post title in default tweet text is optional 155 141 156 = 1.1.0 = 142 157 * Allows you to choose the size of share and link buttons … … 174 189 These are the things currently in the pipeline: 175 190 176 * Changing the post count feature to request data only after the page is loaded so it doesn't slow things down so much.177 191 * Choosing which post types the share buttons are added to 178 192 * Adding more services (ebay, Xing, Vimeo) 179 * Adding your own icons (in a way that they don't disappear after you update the plugin) 180 * Option to diplays in archives and category listings (?) 193 * Option to display in archives and category listings (?) 181 194 * (Anything else? You tell me!) -
crafty-social-buttons/trunk/class-SH-Crafty-Social-Buttons-Admin.php
r890035 r891793 2 2 /** 3 3 * SH_Crafty_Social_Buttons_Admin Class 4 * @author Sarah Henderson5 * @date 2013-10-124 * @author Sarah Henderson 5 * @date 2013-10-12 6 6 */ 7 8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 7 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; 10 } // Exit if accessed directly 9 11 10 12 class SH_Crafty_Social_Buttons_Admin { … … 33 35 * Initialize the plugin by setting localization, filters, and administration functions. 34 36 */ 35 private function __construct() { 37 private function __construct() { 36 38 37 39 // register settings 38 add_action( 'admin_init', array( $this, 'register_settings' ));40 add_action( 'admin_init', array( $this, 'register_settings' ) ); 39 41 40 42 $this->load_all_services(); … … 50 52 self::$instance = new self; 51 53 } 54 52 55 return self::$instance; 53 56 } … … 58 61 public function display_plugin_admin_page() { 59 62 60 if ( !is_admin()) {61 wp_die( __('You cannot access this page'));62 } 63 63 if ( ! is_admin() ) { 64 wp_die( __( 'You cannot access this page' ) ); 65 } 66 64 67 // make sure they have the rights to manage options 65 if (!current_user_can( 'manage_options' ) ) { 66 wp_die( __('You do not have sufficient permissions to access this page.')); 67 } 68 $settings = $this->getSettings(); 69 70 include_once( plugin_dir_path(__FILE__) . 'views/admin.php' ); 71 } 72 73 74 /** 75 * Checks which classes are available in the services folder and registers them 76 */ 77 function load_all_services() { 78 79 include_once('services/class-SH_Social_Service.php'); 80 $this->all_services = array(); 81 82 $directory = plugin_dir_path(__FILE__) . 'services'; 83 foreach (scandir($directory) as $file) { 84 if ('.' === $file) continue; 85 if ('..' === $file) continue; 86 if ("class-SH_Social_Service.php" === $file) { continue; } 87 88 $matches = array(); 89 if (preg_match("/^class-SH_(.+)\.php$/", $file, $matches)) { 90 $this->all_services[] = $matches[1]; 91 include_once('services/' . $file); 68 if ( ! current_user_can( 'manage_options' ) ) { 69 wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 70 } 71 $settings = $this->getSettings(); 72 73 include_once( plugin_dir_path( __FILE__ ) . 'views/admin.php' ); 74 } 75 76 77 /** 78 * Checks which classes are available in the services folder and registers them 79 */ 80 function load_all_services() { 81 82 include_once( 'services/class-SH_Social_Service.php' ); 83 $this->all_services = array(); 84 85 $directory = plugin_dir_path( __FILE__ ) . 'services'; 86 foreach ( scandir( $directory ) as $file ) { 87 if ( '.' === $file ) { 88 continue; 89 } 90 if ( '..' === $file ) { 91 continue; 92 } 93 if ( "class-SH_Social_Service.php" === $file ) { 94 continue; 95 } 96 97 $matches = array(); 98 if ( preg_match( "/^class-SH_(.+)\.php$/", $file, $matches ) ) { 99 $this->all_services[] = $matches[1]; 100 include_once( 'services/' . $file ); 101 } 102 } 103 } 104 105 /** 106 * Checks which folders are available in the button directory and registers them 107 */ 108 function load_all_image_sets() { 109 $this->all_image_sets = array(); 110 111 $directory = plugin_dir_path( __FILE__ ) . 'buttons'; // included image sets 112 foreach ( scandir( $directory ) as $folder ) { 113 if ( '.' === $folder ) { 114 continue; 115 } 116 if ( '..' === $folder ) { 117 continue; 118 } 119 120 if ( ! preg_match( "/\./", $folder ) ) { // no dots allowed, only folders 121 $this->all_image_sets[] = $folder; 122 } 123 } 124 125 $directory = wp_upload_dir()['basedir'] . '/crafty-social-buttons/buttons'; // custom image sets 126 if (is_dir($directory)) { 127 foreach ( scandir( $directory ) as $folder ) { 128 if ( '.' === $folder ) { 129 continue; 92 130 } 93 } 94 } 95 96 /** 97 * Checks which folders are available in the button directory and registers them 98 */ 99 function load_all_image_sets() { 100 $this->all_image_sets = array(); 101 102 $directory = plugin_dir_path(__FILE__) . 'buttons'; 103 foreach (scandir($directory) as $folder) { 104 if ('.' === $folder) continue; 105 if ('..' === $folder) continue; 106 107 if (!preg_match("/\./", $folder)) { // no dots allowed, only folders 131 if ( '..' === $folder ) { 132 continue; 133 } 134 135 if ( ! preg_match( "/\./", $folder ) ) { // no dots allowed, only folders 108 136 $this->all_image_sets[] = $folder; 109 137 } 110 } 111 } 112 138 } 139 } 140 141 } 142 113 143 /** 114 144 * Show admin notifications … … 117 147 118 148 $settings = $this->getSettings(); 119 149 120 150 // check if any buttons have been configured 121 if ( !$settings['configured']) {122 151 if ( ! $settings['configured'] ) { 152 123 153 // output a warning that buttons need configuring and provide a link to settings 124 echo '<div class="updated fade"><p>Thanks for installing <strong>Crafty Social Buttons!</strong>. ' .125 ' Your buttons need <a href="admin.php?page=' . $this->plugin_slug .126 '"><strong>configuration</strong></a> before they will appear.</p></div>';154 echo '<div class="updated fade"><p>Thanks for installing <strong>Crafty Social Buttons!</strong>. ' . 155 ' Your buttons need <a href="admin.php?page=' . $this->plugin_slug . 156 '"><strong>configuration</strong></a> before they will appear.</p></div>'; 127 157 } 128 158 } … … 132 162 */ 133 163 public function register_settings() { 134 135 $section = 'cbs_basic_share_settings'; 136 $page = $this->plugin_slug.'-share'; 137 138 add_settings_section( $section, 'Display Options', 139 array($this, 'displayShareBasicSettingsText'), $page); 140 141 add_settings_field( 'share_image_set', 'Image Set', 142 array($this, 'renderImageSetSelect'), $page, $section, array('share_image_set') ); 143 144 add_settings_field( 'share_image_size', 'Image Size', 145 array($this, 'renderNumericTextbox'), $page, $section, 146 array('share_image_size', 'Size in pixels, between 24 and 64') ); 147 148 add_settings_field( 'share_caption', 'Caption', 149 array($this, 'renderTextbox'), $page, $section, 150 array('share_caption', 'Displays before the set of share buttons') ); 151 152 add_settings_field( 'share_services', 'Show these services', 153 array($this, 'render_service_select'), $page, $section, array('share_services') ); 154 155 156 add_settings_field( 'position', 'Above or below content', 157 array($this, 'renderPositionSelect'), $page, $section, array('position') ); 158 159 add_settings_field( 'show_on_posts', 'Show on Posts', 160 array($this, 'renderCheckbox'), $page, $section, 161 array('show_on_posts', 'Shows on post single individual pages') ); 162 163 add_settings_field( 'show_on_pages', 'Show on Pages', 164 array($this, 'renderCheckbox'), $page, $section, array('show_on_pages') ); 165 166 add_settings_field( 'show_on_home', 'Show on Home Page', 167 array($this, 'renderCheckbox'), $page, $section, array('show_on_home') ); 168 169 170 171 172 164 165 $section = 'cbs_basic_share_settings'; 166 $page = $this->plugin_slug . '-share'; 167 168 add_settings_section( $section, __( 'Display Options', $this->plugin_slug ), 169 array( $this, 'displayShareBasicSettingsText' ), $page ); 170 171 add_settings_field( 'share_image_set', __( 'Image Set', $this->plugin_slug ), 172 array( $this, 'renderImageSetSelect' ), $page, $section, array( 'share_image_set' ) ); 173 174 add_settings_field( 'share_image_size', __( 'Image Size', $this->plugin_slug ), 175 array( $this, 'renderNumericTextbox' ), $page, $section, 176 array( 'share_image_size', __( 'Size in pixels, between 24 and 64', $this->plugin_slug ) ) ); 177 178 add_settings_field( 'share_caption', __( 'Caption', $this->plugin_slug ), 179 array( $this, 'renderTextbox' ), $page, $section, 180 array( 'share_caption', __( 'Displays before the set of share buttons', $this->plugin_slug ) ) ); 181 182 add_settings_field( 'share_services', __( 'Show these services', $this->plugin_slug ), 183 array( $this, 'render_service_select' ), $page, $section, array( 'share_services' ) ); 184 185 186 add_settings_field( 'position', __( 'Above or below content', $this->plugin_slug ), 187 array( $this, 'renderPositionSelect' ), $page, $section, array( 'position' ) ); 188 189 add_settings_field( 'show_on_posts', __( 'Show on Posts', $this->plugin_slug ), 190 array( $this, 'renderCheckbox' ), $page, $section, 191 array( 'show_on_posts', __( 'Shows on post single individual pages', $this->plugin_slug ) ) ); 192 193 add_settings_field( 'show_on_pages', __( 'Show on Pages', $this->plugin_slug ), 194 array( $this, 'renderCheckbox' ), $page, $section, array( 'show_on_pages' ) ); 195 196 add_settings_field( 'show_on_home', __( 'Show on Home Page', $this->plugin_slug ), 197 array( $this, 'renderCheckbox' ), $page, $section, array( 'show_on_home' ) ); 198 199 173 200 $section = 'cbs_advanced_share_settings'; 174 add_settings_section( $section, 'Advanced Options', null, $page); 175 176 add_settings_field( 'new_window', 'Open in new window', 177 array($this, 'renderCheckbox'), $page, $section, array('new_window') ); 178 179 add_settings_field( 'show_count', 'Show post counts', 180 array($this, 'renderCheckbox'), $page, $section, 181 array('show_count', 'Only done if service supports it. Calling out to the 182 services to obtain the counts can slow down the loading of the page significantly') ); 183 184 add_settings_field( 'email_body', 'Email text', 185 array($this, 'renderTextbox'), $page, $section, array('email_body') ); 186 187 add_settings_field( 'twitter_body', 'Twitter text', 188 array($this, 'renderTextbox'), $page, $section, array('twitter_body') ); 189 190 191 192 201 add_settings_section( $section, __( 'Advanced Options', $this->plugin_slug ), null, $page ); 202 203 add_settings_field( 'new_window', __( 'Open in new window', $this->plugin_slug ), 204 array( $this, 'renderCheckbox' ), $page, $section, array( 'new_window' ) ); 205 206 add_settings_field( 'show_count', __( 'Show post counts', $this->plugin_slug ), 207 array( $this, 'renderCheckbox' ), $page, $section, 208 array( 'show_count', __( 'Only done if service supports it.', $this->plugin_slug ) ) ); 209 210 add_settings_field( 'email_body', __( 'Email text', $this->plugin_slug ), 211 array( $this, 'renderTextbox' ), $page, $section, array( 'email_body' ) ); 212 213 add_settings_field( 'twitter_body', __( 'Tweet text', $this->plugin_slug ), 214 array( $this, 'renderTextbox' ), $page, $section, 215 array( 'twitter_body', __( 'Default Tweet text (user can override this)', $this->plugin_slug ) ) ); 216 217 add_settings_field( 'twitter_show_title', __( 'Title in Tweet text', $this->plugin_slug ), 218 array( $this, 'renderCheckbox' ), $page, $section, 219 array( 220 'twitter_show_title', 221 __( 'Include the post/page title in the default Tweet text', $this->plugin_slug ) 222 ) ); 223 224 193 225 $section = 'cbs_link_button_settings'; 194 $page = $this->plugin_slug.'-link'; 195 add_settings_section( $section, 'Display Options', array($this, 'displayLinkSettingsText'), $page); 196 197 add_settings_field( 'link_image_set', 'Image Set', 198 array($this, 'renderImageSetSelect'), $page, $section, array('link_image_set') ); 199 add_settings_field( 'link_image_size', 'Image Size', 200 array($this, 'renderNumericTextbox'), $page, $section, 201 array('link_image_size', 'Size in pixels, between 24 and 64') ); 202 203 add_settings_field( 'link_caption', 'Caption', 204 array($this, 'renderTextbox'), $page, $section, 205 array('link_caption', 'Displays before the set of link buttons') ); 206 207 add_settings_field( 'link_services', 'Show these services', 208 array($this, 'render_service_select'), $page, $section, array('link_services') ); 209 210 226 $page = $this->plugin_slug . '-link'; 227 add_settings_section( $section, __( 'Display Options', $this->plugin_slug ), 228 array( $this, 'displayLinkSettingsText' ), $page ); 229 230 add_settings_field( 'link_image_set', __( 'Image Set', $this->plugin_slug ), 231 array( $this, 'renderImageSetSelect' ), $page, $section, array( 'link_image_set' ) ); 232 add_settings_field( 'link_image_size', __( 'Image Size', $this->plugin_slug ), 233 array( $this, 'renderNumericTextbox' ), $page, $section, 234 array( 'link_image_size', __( 'Size in pixels, between 24 and 64', $this->plugin_slug ) ) ); 235 236 add_settings_field( 'link_caption', __( 'Caption', $this->plugin_slug ), 237 array( $this, 'renderTextbox' ), $page, $section, 238 array( 'link_caption', __( 'Displays before the set of link buttons', $this->plugin_slug ) ) ); 239 240 add_settings_field( 'link_services', __( 'Show these services', $this->plugin_slug ), 241 array( $this, 'render_service_select' ), $page, $section, array( 'link_services' ) ); 242 243 211 244 $section = 'cbs_link_service_settings'; 212 add_settings_section( $section, 'User IDs', array($this, 'displayLinkServiceText'), $page); 213 214 foreach($this->all_services as $service) { 245 add_settings_section( $section, __( 'User IDs', $this->plugin_slug ), array( 246 $this, 247 'displayLinkServiceText' 248 ), $page ); 249 250 foreach ( $this->all_services as $service ) { 215 251 // we want to add a custom description for some of the fields 216 $caption = $service;252 $caption = $service; 217 253 $description = ""; 218 $description = $this->call_service_method( $service, 'description');219 220 add_settings_field( 221 $service, 222 $caption, 223 array( $this, 'renderTextbox'),224 $page, 225 $section, 226 array( $service, $description) );227 } 228 229 register_setting( $this->plugin_slug, $this->plugin_slug, array( $this, 'validate_settings' ));230 } 231 254 $description = $this->call_service_method( $service, 'description' ); 255 256 add_settings_field( 257 $service, 258 $caption, 259 array( $this, 'renderTextbox' ), 260 $page, 261 $section, 262 array( $service, $description ) ); 263 } 264 265 register_setting( $this->plugin_slug, $this->plugin_slug, array( $this, 'validate_settings' ) ); 266 } 267 232 268 /** 233 269 * Display share basic settings section text 234 270 */ 235 public function add_contextual_help( $hook) {271 public function add_contextual_help( $hook ) { 236 272 $screen = get_current_screen(); 237 238 if ( $screen->id != 'settings_page_' . $this->plugin_slug ) { 239 return; 240 } 241 242 $screen->add_help_tab( array( 243 'id' => 'csb-help-intro', 244 'title' => __('Welcome'), 245 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/intro-tab.php' ) ) ); 246 247 $screen->add_help_tab( array( 248 'id' => 'csb-share-help', 249 'title' => __('Share Buttons'), 250 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/share-tab.php' ) ) ); 251 252 $screen->add_help_tab( array( 253 'id' => 'csb-link-help', 254 'title' => __('Link Buttons'), 255 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/link-tab.php' ) ) ); 256 257 $screen->add_help_tab( array( 258 'id' => 'csb-widget', 259 'title' => __('Widget'), 260 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/widget-tab.php' ) ) ); 261 262 $screen->add_help_tab( array( 263 'id' => 'csb-shortcode', 264 'title' => __('Shortcodes'), 265 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/shortcode-tab.php' ) ) ); 266 267 $screen->add_help_tab( array( 268 'id' => 'csb-action-hooks', 269 'title' => __('Action Hooks'), 270 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/action-hook-tab.php' ) ) ); 271 272 $screen->add_help_tab( array( 273 'id' => 'csb-icons', 274 'title' => __('Adding Icons'), 275 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/adding-icons-tab.php' ) ) ); 276 277 $screen->add_help_tab( array( 278 'id' => 'csb-credits', 279 'title' => __('Credits'), 280 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/credits-tab.php' ) ) ); 281 282 $screen->add_help_tab( array( 283 'id' => 'csb-about', 284 'title' => __('About Me'), 285 'content' => file_get_contents( plugin_dir_path(__FILE__). '/help/about-me-tab.php' ) ) ); 286 } 287 273 274 if ( $screen->id != 'settings_page_' . $this->plugin_slug ) { 275 return; 276 } 277 278 $screen->add_help_tab( array( 279 'id' => 'csb-help-intro', 280 'title' => __( 'Welcome', $this->plugin_slug ), 281 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/intro-tab.php' ) 282 ) ); 283 284 $screen->add_help_tab( array( 285 'id' => 'csb-share-help', 286 'title' => __( 'Share Buttons', $this->plugin_slug ), 287 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/share-tab.php' ) 288 ) ); 289 290 $screen->add_help_tab( array( 291 'id' => 'csb-link-help', 292 'title' => __( 'Link Buttons', $this->plugin_slug ), 293 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/link-tab.php' ) 294 ) ); 295 296 $screen->add_help_tab( array( 297 'id' => 'csb-widget', 298 'title' => __( 'Widget', $this->plugin_slug ), 299 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/widget-tab.php' ) 300 ) ); 301 302 $screen->add_help_tab( array( 303 'id' => 'csb-shortcode', 304 'title' => __( 'Shortcodes', $this->plugin_slug ), 305 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/shortcode-tab.php' ) 306 ) ); 307 308 $screen->add_help_tab( array( 309 'id' => 'csb-action-hooks', 310 'title' => __( 'Action Hooks', $this->plugin_slug ), 311 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/action-hook-tab.php' ) 312 ) ); 313 314 $screen->add_help_tab( array( 315 'id' => 'csb-icons', 316 'title' => __( 'Adding Icons', $this->plugin_slug ), 317 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/adding-icons-tab.php' ) 318 ) ); 319 320 $screen->add_help_tab( array( 321 'id' => 'csb-credits', 322 'title' => __( 'Credits', $this->plugin_slug ), 323 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/credits-tab.php' ) 324 ) ); 325 326 $screen->add_help_tab( array( 327 'id' => 'csb-about', 328 'title' => __( 'About Me', $this->plugin_slug ), 329 'content' => file_get_contents( plugin_dir_path( __FILE__ ) . '/help/about-me-tab.php' ) 330 ) ); 331 } 332 288 333 /** 289 334 * Display share basic settings section text 290 335 */ 291 public function displayShareBasicSettingsText() { ?> 292 <p>Share Buttons will prompt the user to share the current post or page URL.</p> 293 <?php 294 } 295 336 public function displayShareBasicSettingsText() { 337 echo '<p>'; 338 _e( 'Share Buttons will prompt the user to share the current post or page URL.', $this->plugin_slug ); 339 echo '</p>'; 340 341 } 342 296 343 /** 297 344 * Display link settings section text 298 345 */ 299 public function displayLinkSettingsText() {?> 300 <p>Link Buttons will link to your user profile on each site. 301 Enter your <strong>user id</strong> for each service you choose below to make the button link directly to your profile.</p> 302 <?php 303 } 304 346 public function displayLinkSettingsText() { 347 echo '<p>'; 348 _e( 'Link Buttons will link to your user profile on each site.', $this->plugin_slug ); 349 echo '</p><p>'; 350 _e( 'Enter your <strong>user id</strong> for each service you choose below to make the button link directly to your profile.', $this->plugin_slug ); 351 echo '</p>'; 352 } 353 305 354 /** 306 355 * Display link settings section text 307 356 */ 308 public function displayLinkServiceText() {?> 309 <p>Enter just your <strong>user id</strong> for each service, not the full URL. The bit in bold that says <strong>user-id</strong> in the hint is the part you should enter.</p> 310 <?php 311 } 312 357 public function displayLinkServiceText() { 358 echo '<p>'; 359 _e( 'Enter just your <strong>user id</strong> for each service, not the full URL. The bit in bold that says <strong>user-id</strong> in the hint is the part you should enter.', $this->plugin_slug ); 360 echo '</p>'; 361 } 362 313 363 /** 314 364 * Display a settings checkbox 315 365 */ 316 public function renderCheckbox($args) { 317 $id = $args[0]; 318 $name = $this->plugin_slug . '[' . $args[0] . ']'; 319 $description = isset($args[1]) ? $args[1] : ''; 366 public function renderCheckbox( $args ) { 367 $id = $args[0]; 368 $name = $this->plugin_slug . '[' . $args[0] . ']'; 369 $description = isset( $args[1] ) ? $args[1] : ''; 370 $settings = $this->getSettings(); 371 $value = $settings[ $id ]; 372 ?> 373 374 <input type="checkbox" id="<?= $id ?>" name="<?= $name ?>" <?php echo checked( 1, $value ) ?> value="0"/> 375 <span class="description" for="<?= $id ?>"> 376 <?= $description ?> 377 </span> 378 379 <?php 380 } 381 382 /** 383 * Display a settings textbox 384 */ 385 public function renderTextbox( $args ) { 386 $id = $args[0]; 387 $settings = $this->getSettings(); 388 $value = isset( $settings[ $id ] ) ? $settings[ $id ] : ' '; 389 $name = $this->plugin_slug . '[' . $args[0] . ']'; 390 $description = isset( $args[1] ) ? $args[1] : ''; 391 392 ?> 393 394 <input type="text" id="<?= $id ?>" name="<?= $name ?>" value="<?= $value ?>"/> 395 <span class="description"> 396 <?= $description ?> 397 </span> 398 399 <?php 400 } 401 402 /** 403 * Display a settings textbox 404 */ 405 public function renderNumericTextbox( $args ) { 406 $id = $args[0]; 407 $settings = $this->getSettings(); 408 $value = isset( $settings[ $id ] ) ? $settings[ $id ] : ' '; 409 $name = $this->plugin_slug . '[' . $args[0] . ']'; 410 $description = isset( $args[1] ) ? $args[1] : ''; 411 $min = isset( $args[2] ) ? $args[2] : 24; 412 $max = isset( $args[3] ) ? $args[3] : 64; 413 414 ?> 415 416 <input type="number" id="<?= $id ?>" name="<?= $name ?>" value="<?= $value ?>" min="<?= $min ?>" 417 max="<?= $max ?>"/> 418 <span class="description"> 419 <?= $description ?> 420 </span> 421 422 <?php 423 } 424 425 /** 426 * Display share settings section 427 */ 428 public function renderImageSetSelect( $args ) { 429 $id = $args[0]; 430 $name = $this->plugin_slug . '[' . $args[0] . ']'; 320 431 $settings = $this->getSettings(); 321 $value = $settings[$id]; 432 $value = $settings[ $id ]; 433 $base = plugin_dir_url( __FILE__ ) . "buttons/"; 322 434 ?> 323 435 324 <input type="checkbox" id="<?=$id?>" name="<?=$name?>" <?php echo checked(1, $value) ?> value="0" /> 325 <span class="description" for="<?=$id?>"> 326 <?=$description?> 327 </span> 328 329 <?php 330 } 331 332 /** 333 * Display a settings textbox 334 */ 335 public function renderTextbox($args) { 336 $id = $args[0]; 436 <select id="<?= $id ?>" class="csb-image-set" name="<?= $name ?>"> 437 438 <?php foreach ( $this->all_image_sets as $set ) { ?> 439 <option value="<?= $set ?>" <?php echo selected( $set, $value );?>"> 440 <?=$set?> 441 </option> 442 <?php } ?> 443 444 </select> 445 446 <?php 447 } 448 449 /** 450 * Display share settings section 451 */ 452 public function render_service_select( $args ) { 453 $id = $args[0]; 454 $name = $this->plugin_slug . '[' . $args[0] . ']'; 455 $settings = $this->getSettings(); 456 $image_set = ( $id == 'link_services' ) ? $settings['link_image_set'] : $settings['share_image_set']; 457 $image_size = ( $id == 'link_services' ) ? $settings['link_image_size'] : $settings['share_image_size']; 458 $shareOrLink = ( $id == 'link_services' ) ? 'Link' : 'Share'; 459 $value = $settings[ $id ]; 460 ?> 461 462 <div class="csb-services"> 463 464 <div class="csb-include-list chosen"> 465 <div><span class="include-heading">Selected</span> (these will be displayed)</div> 466 <ul id="csbsort2" class="connectedSortable data-base="<?= $image_set ?>""> 467 <?php echo $this->get_selected_services_html( $value, $image_set, $image_size ); ?> 468 </ul> 469 <input type="hidden" name="<?= $name ?>" id="<?= $id ?>" class="csb-services"/> 470 </div> 471 472 <div class="csb-include-list available"> 473 <div><span class="include-heading"><?php _e( 'Available', $this->plugin_slug ) ?></span> 474 (<?php _e( 'these will <strong>not</strong> be displayed', $this->plugin_slug ) ?>) 475 </div> 476 <ul id="csbsort1" class="connectedSortable"> 477 <?php echo $this->get_available_services_html( $value, $image_set, $image_size, $shareOrLink ); ?> 478 </ul> 479 </center> 480 </div> 481 </div> 482 <?php 483 } 484 485 /** 486 * Display share settings section 487 */ 488 public function renderPositionSelect( $args ) { 489 $id = $args[0]; 490 $name = $this->plugin_slug . '[' . $args[0] . ']'; 337 491 $settings = $this->getSettings(); 338 $value = isset($settings[$id]) ? $settings[$id] : ' '; 339 $name = $this->plugin_slug . '[' . $args[0] . ']'; 340 $description = isset($args[1]) ? $args[1] : ''; 341 492 $value = $settings[ $id ]; 342 493 ?> 343 494 344 <input type="text" id="<?=$id?>" name="<?=$name?>" value="<?=$value?>" /> 345 <span class="description"> 346 <?=$description?> 347 </span> 348 349 <?php 350 } 351 352 /** 353 * Display a settings textbox 354 */ 355 public function renderNumericTextbox($args) { 356 $id = $args[0]; 357 $settings = $this->getSettings(); 358 $value = isset($settings[$id]) ? $settings[$id] : ' '; 359 $name = $this->plugin_slug . '[' . $args[0] . ']'; 360 $description = isset($args[1]) ? $args[1] : ''; 361 $min = isset($args[2]) ? $args[2] : 24; 362 $max = isset($args[3]) ? $args[3] : 64; 363 364 ?> 365 366 <input type="number" id="<?=$id?>" name="<?=$name?>" value="<?=$value?>" min="<?=$min?>" max="<?=$max?>" /> 367 <span class="description"> 368 <?=$description?> 369 </span> 370 371 <?php 372 } 373 374 /** 375 * Display share settings section 376 */ 377 public function renderImageSetSelect($args) { 378 $id = $args[0]; 379 $name = $this->plugin_slug . '[' . $args[0] . ']'; 380 $settings = $this->getSettings(); 381 $value = $settings[$id]; 382 $base = plugin_dir_url(__FILE__) . "buttons/"; 383 $path = $base . $value . "/"; 384 ?> 385 386 <select id="<?=$id?>" class="csb-image-set" name="<?=$name?>"> 387 388 <?php foreach ($this->all_image_sets as $set) { ?> 389 <option value="<?=$set?>" <?php echo selected($set, $value);?>"> 390 <?=$set?> 391 </option> 392 393 <?php } ?> 394 395 </select> 396 397 <?php 398 } 399 400 /** 401 * Display share settings section 402 */ 403 public function render_service_select($args) { 404 $id = $args[0]; 405 $name = $this->plugin_slug . '[' . $args[0] . ']'; 406 $settings = $this->getSettings(); 407 $image_set = ($id == 'link_services') ? $settings['link_image_set'] : $settings['share_image_set']; 408 $image_size = ($id == 'link_services') ? $settings['link_image_size'] : $settings['share_image_size']; 409 $shareOrLink = ($id == 'link_services') ? 'Link' : 'Share'; 410 $value = $settings[$id]; 411 ?> 412 413 <div class="csb-services"> 414 415 <div class="csb-include-list chosen"> 416 <div><span class="include-heading">Selected</span> (these will be displayed)</div> 417 <ul id="csbsort2" class="connectedSortable data-base="<?=$image_set?>""> 418 <?php echo $this->get_selected_services_html($value, $image_set, $image_size); ?> 419 </ul> 420 <input type="hidden" name="<?=$name?>" id="<?=$id?>" class="csb-services" /> 421 </div> 422 423 <div class="csb-include-list available"> 424 <div><span class="include-heading">Available</span> (these will <strong>not</strong> be displayed)</div> 425 <ul id="csbsort1" class="connectedSortable"> 426 <?php echo $this->get_available_services_html($value, $image_set, $image_size, $shareOrLink); ?> 427 </ul> 428 </center> 429 </div> 430 </div> 431 <?php 432 } 433 434 /** 435 * Display share settings section 436 */ 437 public function renderPositionSelect($args) { 438 $id = $args[0]; 439 $name = $this->plugin_slug . '[' . $args[0] . ']'; 440 $settings = $this->getSettings(); 441 $value = $settings[$id]; 442 ?> 443 444 <select id="<?=$id?>" name="<?=$name?>"> 445 <option value="above" <?php echo selected('above',$value);?> >Above</option> 446 <option value="below" <?php echo selected('below',$value);?> >Below</option> 447 <option value="both" <?php echo selected('both',$value);?> >Both</option> 448 </select> 449 450 <?php 451 } 452 495 <select id="<?= $id ?>" name="<?= $name ?>"> 496 <option 497 value="above" <?php echo selected( 'above', $value ); ?> ><?php _e( 'Above', $this->plugin_slug ) ?></option> 498 <option 499 value="below" <?php echo selected( 'below', $value ); ?> ><?php _e( 'Below', $this->plugin_slug ) ?></option> 500 <option 501 value="both" <?php echo selected( 'both', $value ); ?> ><?php _e( 'Both', $this->plugin_slug ) ?></option> 502 </select> 503 504 <?php 505 } 506 453 507 /** 454 508 * Validate our saved settings 455 509 */ 456 public function validate_settings( $input) {510 public function validate_settings( $input ) { 457 511 $settings = $this->getSettings(); 458 512 … … 463 517 // the other data will be fine, but any checkboxes will be unset 464 518 $tab = $input['tab']; 465 466 if ( 'share_options' == $tab) {519 520 if ( 'share_options' == $tab ) { 467 521 // first, all the checkboxes need to be set if present 468 $settings['show_on_posts'] = isset($input['show_on_posts']); 469 $settings['show_on_pages'] = isset($input['show_on_pages']); 470 $settings['show_on_home'] = isset($input['show_on_home']); 471 $settings['show_count'] = isset($input['show_count']); 472 $settings['new_window'] = isset($input['new_window']); 473 522 $settings['show_on_posts'] = isset( $input['show_on_posts'] ); 523 $settings['show_on_pages'] = isset( $input['show_on_pages'] ); 524 $settings['show_on_home'] = isset( $input['show_on_home'] ); 525 $settings['show_count'] = isset( $input['show_count'] ); 526 $settings['new_window'] = isset( $input['new_window'] ); 527 $settings['twitter_show_title'] = isset( $input['twitter_show_title'] ); 528 474 529 // our select boxes have constrained UI, so just update them 475 $settings['share_image_set'] = isset( $input['share_image_set']) ? $input['share_image_set'] : 'simple';476 $settings['share_services'] = isset($input['share_services']) ? $input['share_services'] : '';477 $settings['position'] = isset($input['position']) ? $input['position'] : 'below';478 530 $settings['share_image_set'] = isset( $input['share_image_set'] ) ? $input['share_image_set'] : 'simple'; 531 $settings['share_services'] = isset( $input['share_services'] ) ? $input['share_services'] : ''; 532 $settings['position'] = isset( $input['position'] ) ? $input['position'] : 'below'; 533 479 534 // and finally, validate our text boxes 480 $settings['share_caption'] = sanitize_text_field ($input['share_caption']);481 $settings['email_body'] = sanitize_text_field ($input['email_body']);482 $settings['twitter_body'] = sanitize_text_field ($input['twitter_body']);483 535 $settings['share_caption'] = sanitize_text_field( $input['share_caption'] ); 536 $settings['email_body'] = sanitize_text_field( $input['email_body'] ); 537 $settings['twitter_body'] = sanitize_text_field( $input['twitter_body'] ); 538 484 539 // including numeric ones 485 $settings['share_image_size'] = sanitize_text_field ($input['share_image_size']); 486 487 488 489 } else if ('link_options' == $tab) { 540 $settings['share_image_size'] = $this->sanitize_image_size( $input['share_image_size'] ); 541 542 543 } else if ( 'link_options' == $tab ) { 490 544 491 545 // our select boxes have constrained UI, so just update them 492 546 $settings['link_image_set'] = $input['link_image_set']; 493 $settings['link_services'] = $input['link_services'];494 547 $settings['link_services'] = $input['link_services']; 548 495 549 // and finally, validate our text boxes 496 $settings['link_caption'] = sanitize_text_field ($input['link_caption']);497 550 $settings['link_caption'] = sanitize_text_field( $input['link_caption'] ); 551 498 552 // including numeric ones 499 $settings['link_image_size'] = sanitize_text_field ($input['link_image_size']);500 553 $settings['link_image_size'] = $this->sanitize_image_size( $input['link_image_size'] ); 554 501 555 // and the textboxes for all our services 502 foreach($this->all_services as $service) { 503 $settings[$service] = sanitize_text_field (stripslashes_deep($input[$service])); 504 } 505 506 } 507 return $settings; 508 } 509 556 foreach ( $this->all_services as $service ) { 557 $settings[ $service ] = sanitize_text_field( stripslashes_deep( $input[ $service ] ) ); 558 } 559 560 } 561 562 return $settings; 563 } 564 565 function sanitize_image_size( $image_size_string ) { 566 $size = sanitize_text_field( $image_size_string ); 567 if ( ! is_numeric( $size ) ) { 568 return 48; 569 } 570 if ( $size < 24 ) { 571 return 24; 572 } 573 if ( $size > 64 ) { 574 return 64; 575 } 576 577 return $size; 578 } 579 510 580 /** 511 581 * Get list item HTML for selected services from our text list 512 582 */ 513 function get_selected_services_html( $selectedServicesString, $image_set, $image_size) {514 515 $htmlListItems = ''; 516 if ( $selectedServicesString != '') {517 518 $selectedServices = explode( ',', $selectedServicesString); // explode string to array519 foreach ( $selectedServices as $service) {520 $ url = plugin_dir_url(__FILE__) . "buttons/" . $image_set . "/" . $service . ".png";521 $htmlListItems .= $this->get_service_icon_html($url, $service, $image_set, $image_size);522 }523 } 583 function get_selected_services_html( $selectedServicesString, $image_set, $image_size ) { 584 585 $htmlListItems = ''; 586 if ( $selectedServicesString != '' ) { 587 588 $selectedServices = explode( ',', $selectedServicesString ); // explode string to array 589 foreach ( $selectedServices as $service ) { 590 $htmlListItems .= $this->get_service_icon_html( $service, $image_set, $image_size ); 591 } 592 } 593 524 594 return $htmlListItems; 525 595 } 526 596 527 597 /** 528 598 * Get list item HTML for all services EXCEPT those already selected 529 599 */ 530 function get_available_services_html( $selectedServicesString, $image_set, $image_size, $shareOrLink = 'Share') {531 532 $htmlListItems = '';600 function get_available_services_html( $selectedServicesString, $image_set, $image_size, $shareOrLink = 'Share' ) { 601 602 $htmlListItems = ''; 533 603 $selectedServices = array(); 534 if ($selectedServicesString != '') { 535 $selectedServices = explode(',', $selectedServicesString); // explode string to array 536 } 537 538 foreach ($this->all_services as $service) { 539 if (!$this->call_service_method($service, 'can'.$shareOrLink)) continue; 540 if (in_array($service, $selectedServices)) continue; 541 542 $url = plugin_dir_url(__FILE__) . "buttons/" . $image_set . "/" . $service . ".png"; 543 $htmlListItems .= $this->get_service_icon_html($url, $service, $image_set, $image_size); 544 545 } 546 604 if ( $selectedServicesString != '' ) { 605 $selectedServices = explode( ',', $selectedServicesString ); // explode string to array 606 } 607 608 foreach ( $this->all_services as $service ) { 609 if ( ! $this->call_service_method( $service, 'can' . $shareOrLink ) ) { 610 continue; 611 } 612 if ( in_array( $service, $selectedServices ) ) { 613 continue; 614 } 615 616 $htmlListItems .= $this->get_service_icon_html( $service, $image_set, $image_size ); 617 618 } 619 547 620 return $htmlListItems; 548 621 } 549 622 623 /** 624 * Get html for a single service icon for selection on the admin page 625 */ 626 function get_service_icon_html( $service, $image_set, $image_size ) { 627 $filename = strtolower($service) . ".png"; 628 $base_url = plugin_dir_url( __FILE__ ) . "buttons/"; 629 $alt_url = wp_upload_dir()['baseurl'] . '/' . $this->plugin_slug . "/buttons/"; 630 631 $url = $base_url . $image_set . "/" . $filename; 632 $path = plugin_dir_path( __FILE__ ) . "buttons/" . $image_set . "/" . $filename; 633 if (!file_exists($path)) { 634 $url = $alt_url . $image_set . "/" . $filename; 635 } 636 return '<li id="' . $service 637 . '"><img src="' . strtolower( $url ) 638 . '" data-filename="' . $filename 639 . '" data-image-set="' . strtolower( $image_set ) 640 . '" data-alt-url="' . $alt_url 641 . '" data-url="' . $base_url 642 . '" alt="' . $service . '" width="' . $image_size . '" height="' . $image_size . '" /></li>'; 643 644 } 645 646 550 647 /** 551 648 * Calls a static method on the given service and returns the result 552 649 */ 553 function call_service_method($service, $method) { 554 return call_user_func(array('SH_' . $service, $method)); 555 } 556 557 558 /** 559 * Get html for a single service icon for selection on the admin page 560 */ 561 function get_service_icon_html($url, $service, $image_set, $image_size) { 562 return '<li id="' . $service 563 .'"><img src="' . strtolower($url) 564 . '" data-image-set="' . strtolower($image_set) 565 . '" alt="' . $service . '" width="'.$image_size.'" height="'.$image_size.'" /></li>'; 566 567 } 568 650 function call_service_method( $service, $method ) { 651 return call_user_func( array( 'SH_' . $service, $method ) ); 652 } 653 569 654 /** 570 655 * Loads all the settings from the database 571 */ 656 */ 572 657 function getSettings() { 573 $settings = get_option( $this->plugin_slug);658 $settings = get_option( $this->plugin_slug ); 574 659 $defaults = SH_Crafty_Social_Buttons_Plugin::get_default_settings(); 575 return wp_parse_args($settings, $defaults); 576 } 660 661 return wp_parse_args( $settings, $defaults ); 662 } 577 663 578 664 } 665 579 666 ?> -
crafty-social-buttons/trunk/class-SH-Crafty-Social-Buttons-Plugin.php
r890035 r891793 13 13 * Plugin version, used for cache-busting of style and script file references. 14 14 */ 15 protected $version = '1. 1.0';15 protected $version = '1.2.0'; 16 16 17 17 /** … … 60 60 // Load public-facing style sheet and JavaScript. 61 61 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); 62 //add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 62 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 63 64 // Set up ajax callbacks for client-side loading of share counts 65 add_action( 'wp_ajax_share_count', array($this, 'get_share_count') ); 66 add_action( 'wp_ajax_nopriv_share_count', array( $this, 'get_share_count') ); 63 67 64 68 } … … 176 180 */ 177 181 public function enqueue_scripts() { 178 wp_enqueue_script( $this->plugin_slug . '-scripts', 179 plugins_url( 'js/public.min.js', __FILE__ ), array( 'jquery' ), $this->version ); 182 183 $settings = get_option($this->plugin_slug); 184 185 // only add javascript if post counts are to be shown 186 if ($settings['show_count']) { 187 188 wp_enqueue_script( $this->plugin_slug . '-scripts', 189 plugins_url( 'js/public.min.js', __FILE__ ), array( 'jquery' ), $this->version, true ); 190 } 180 191 } 181 192 … … 215 226 } 216 227 } 217 218 228 229 /** 230 * Ajax callback method for those services that don't support directly getting share counts on client 231 */ 232 function get_share_count() { 233 $settings = get_option($this->plugin_slug); 234 $result = new stdClass(); 235 try { 236 237 $nonce = isset($_GET['_wpnonce']) ? $_GET['_wpnonce'] : ''; 238 239 if ( !wp_verify_nonce($nonce)) { 240 $result->error = true; 241 $result->message = __( 'You have taken too long. Please go back and retry.', $this->plugin_slug ); 242 wp_die(json_encode($result)); 243 } 244 // get service 245 $service = isset($_GET['service']) ? $_GET['service'] : ''; 246 if (empty($service) || strpos($settings['share_services'], $service) === false) { 247 $result->error = true; 248 $result->message = __( 'Service not specified.', $this->plugin_slug ); 249 wp_die(json_encode($result)); 250 } 251 252 // get url 253 $url = isset($_GET['url']) ? $_GET['url'] : ''; 254 if (empty($url)) { 255 $result->error = true; 256 $result->message = __( 'Url not specified.', $this->plugin_slug ); 257 wp_die(json_encode($result)); 258 } 259 260 include_once(plugin_dir_path(__FILE__) . "services/class-SH_Social_Service.php"); 261 $class = "SH_$service"; 262 263 if (file_exists(plugin_dir_path(__FILE__) . "services/class-$class.php")) { 264 $file = include_once(plugin_dir_path(__FILE__) . "services/class-$class.php"); 265 266 $service = new $class('share', $settings, ''); 267 $count = $service->shareCount($url); 268 $result->count = $count; 269 wp_die(json_encode($result)); 270 } 271 exit; 272 } catch (Exception $ex) { 273 $result->error = true; 274 $result->exception = $ex; 275 $result->message = $ex.getMessage(); 276 wp_die(json_encode($result)); 277 } 278 } 279 280 219 281 /** 220 282 * Get default settings (as an array) … … 237 299 'email_body' => 'I thought you might like this: ', 238 300 'twitter_body' => '', 301 'twitter_show_title' => true, 239 302 240 303 'link_image_set' => 'simple', -
crafty-social-buttons/trunk/class-SH-Crafty-Social-Buttons-Shortcode.php
r890035 r891793 111 111 return $content; 112 112 } 113 113 114 114 } 115 115 return $content; … … 168 168 $title = get_the_title($post->ID); 169 169 170 if ($showCount && $type == 'share') { // add url and title to JS for our scripts to access 171 $data = array( 'url' => $url, 172 'callbackUrl' => wp_nonce_url(admin_url( 'admin-ajax.php' ) . '?action=share_count'), 173 'title' => $title, 174 'services' => $selectedServices, 175 'key' => $post->ID); 176 wp_localize_script( $this->plugin_slug . '-scripts', 'crafty_social_buttons_data_'.$post->ID, $data ); 177 } 178 170 179 $buttonHtml = '<div id="crafty-social-buttons" class="crafty-social-'.$type.'-buttons">'; 171 180 if ($text != '') { … … 177 186 foreach ($selectedServices as $serviceName) { 178 187 179 $button = $this->get_individual_button_html($type, $serviceName, $url, $title, $showCount, $settings );188 $button = $this->get_individual_button_html($type, $serviceName, $url, $title, $showCount, $settings, $post->ID); 180 189 if (!empty($button)) { 181 190 $buttonHtml .= '<li>' . $button . '</li>'; … … 190 199 * Generates the markup for an individual share button 191 200 */ 192 function get_individual_button_html($type, $serviceName, $url, $title, $showCount, $settings ) {201 function get_individual_button_html($type, $serviceName, $url, $title, $showCount, $settings, $key) { 193 202 194 203 include_once(plugin_dir_path(__FILE__) . "services/class-SH_Social_Service.php"); … … 199 208 $file = include_once(plugin_dir_path(__FILE__) . "services/class-$class.php"); 200 209 201 $service = new $class($type, $settings );210 $service = new $class($type, $settings, $key); 202 211 203 212 $username = isset($settings[$serviceName]) ? $settings[$serviceName] : ''; … … 215 224 * Generates the markup for an individual link button 216 225 */ 217 function get_individual_link_button_html($serviceName, $settings ) {226 function get_individual_link_button_html($serviceName, $settings, $key = '') { 218 227 219 228 include_once(plugin_dir_path(__FILE__) ."services/class-SH_Social_Service.php"); … … 223 232 224 233 $file = include_once(plugin_dir_path(__FILE__) ."services/class-$class.php"); 225 $service = new $class($settings['new_window'], $settings['link_image_set'], $settings );234 $service = new $class($settings['new_window'], $settings['link_image_set'], $settings, $key); 226 235 227 236 return $service->linkButton(); -
crafty-social-buttons/trunk/crafty-social-buttons.php
r890035 r891793 16 16 * Plugin URI: http://github.com/sarahhenderson/crafty-social-buttons 17 17 * Description: Adds social sharing buttons and links to your site, including Ravelry, Etsy, Craftsy and Pinterest 18 * Version: 1. 1.018 * Version: 1.2.0 19 19 * Author: Sarah Henderson 20 20 * Author URI: http://sarahhenderson.info -
crafty-social-buttons/trunk/css/admin.min.css
r890035 r891793 1 1 /*! crafty-social-buttons (c) Sarah Henderson 2014 2 * Version 1. 1.0 (09-04-2014) */2 * Version 1.2.0 (12-04-2014) */ 3 3 4 4 .crafty-social-buttons .csb-include-list{border:1px solid #ddd;background:#f1f1f1;margin-right:.5em;vertical-align:top;padding:.4em}.crafty-social-buttons .include-heading{text-align:left;font-weight:700}.crafty-social-buttons .csb-include-list ul{border:1px solid #ddd;background:#fff;padding:.5em;margin:0;min-height:60px}.crafty-social-buttons .csb-include-list ul li{display:inline-block;padding:0;margin:.3em;text-align:center;font-size:1.2em;cursor:move}.crafty-social-buttons .csb-image-preview{margin-top:.5em}.crafty-social-buttons select{width:200px}.crafty-social-buttons input[type=text]{width:350px}.crafty-social-buttons span.description{font-style:normal}.crafty-social-buttons span.description strong{font-style:italic} -
crafty-social-buttons/trunk/css/public.min.css
r890035 r891793 1 1 /*! crafty-social-buttons (c) Sarah Henderson 2014 2 * Version 1. 1.0 (09-04-2014) */2 * Version 1.2.0 (12-04-2014) */ 3 3 4 #crafty-social-buttons{margin:.3em 0}#crafty-social-buttons .crafty-social-caption{display:inline-block;padding-right:1em;vertical-align:top;font-size:1.2em}#crafty-social-buttons ul{display:inline-block;list-style-type:none;margin:0;padding:0}#crafty-social-buttons ul li{display:inline-block;margin:0 .2em;padding:0}#crafty-social-buttons .crafty-social-share-count:after,#crafty-social-buttons .crafty-social-share-count:before{right:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}#crafty-social-buttons .crafty-social-share-count:after{border-color:rgba(224,221,221,0);border-right-color:#f5f5f5;border-width:5px;top:50%;margin-top:-5px}#crafty-social-buttons .crafty-social-share-count:before{border-color:rgba(85,94,88,0);border-right-color:#e0dddd;border-width:6px;top:50%;margin-top:-6px}#crafty-social-buttons .crafty-social-share-count{font:1 1px Arial,Helvetica,sans-serif;color:#555e58;padding:5px;-khtml-border-radius:6px;-o-border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;position:relative;background:#f5f5f5;border:1px solid #e0dddd}4 #crafty-social-buttons{margin:.3em 0}#crafty-social-buttons .crafty-social-caption{display:inline-block;padding-right:1em;vertical-align:top;font-size:1.2em}#crafty-social-buttons ul{display:inline-block;list-style-type:none;margin:0;padding:0}#crafty-social-buttons ul li{display:inline-block;margin:0 .2em;padding:0}#crafty-social-buttons .crafty-social-share-count:after,#crafty-social-buttons .crafty-social-share-count:before{right:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}#crafty-social-buttons .crafty-social-share-count:after{border-color:rgba(224,221,221,0);border-right-color:#f5f5f5;border-width:5px;top:50%;margin-top:-5px}#crafty-social-buttons .crafty-social-share-count:before{border-color:rgba(85,94,88,0);border-right-color:#e0dddd;border-width:6px;top:50%;margin-top:-6px}#crafty-social-buttons .crafty-social-share-count{font:18px Arial,Helvetica,sans-serif;color:#555e58;padding:5px;-khtml-border-radius:6px;-o-border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;position:relative;background:#f5f5f5;border:1px solid #e0dddd;display:inline-block;vertical-align:top;margin-left:2px;min-width:24px;text-align:center} -
crafty-social-buttons/trunk/help/adding-icons-tab.php
r801913 r891793 4 4 <ol> 5 5 <li>Your images are <strong>.png</strong> files</li> 6 <li>You use the same filenames as the existing image sets (which are pretty straighforward - e.g. facebook is facebook.png, ravelry is ravelry.png)</li> 7 <li>Your images are either 48x48px or 64x64px in size. (This isn't strictly necessary, but will give you the best results. By default, the images are displayed at 48x48px.</li> 6 <li>You use the same filenames as the existing image sets 7 (which are pretty straighforward - e.g. facebook is facebook.png, ravelry is ravelry.png)</li> 8 <li>Your images are between 24x24px or 64x64px in size. You can set the size in the options page.</li> 8 9 </ol> 9 10 10 <p>If you've got all that sorted, you just need to create a new folder inside the <code>wp-plugins/crafty-social-buttons/buttons</code> folder. You'll see the folders for the existing icon sets - just add your new folder beside them. It is best if you don't have any spaces or punctuation in the folder name.</p> 11 <p>If you've got all that sorted, you just need to create a new folder to store your icons.</p> 12 13 <p>The plugin will look for your custom icon folders in <code>wp-content/uploads/crafty-social-buttons/buttons</code>.</p> 14 <p>For instance, if your custom icons are in a folder called <code>MyAwesomeIcons</code>, the plugin will look for the 15 Facebook icon at <code>wp-content/uploads/crafty-social-buttons/buttons/MyAwesomeIcons/facebook.png</code>.</p> 16 <p>It is best if you don't have any spaces or punctuation in the folder name.</p> 11 17 12 18 <p>Now if you refresh this options page, you will see your folder name as one of the options to choose from!</p> -
crafty-social-buttons/trunk/js/admin.min.js
r890035 r891793 1 1 /*! crafty-social-buttons (c) Sarah Henderson 2014 2 * Version 1. 1.0 (09-04-2014) */3 jQuery(document).ready(function(a){a("#csbsort1, #csbsort2").sortable({connectWith:".connectedSortable",update:function(){var b =a("#csbsort2 li").map(function(){return a(this).attr("id")}).get();a(".csb-services").val(b)}}).disableSelection(),a(".csb-services").val(a("#csbsort2 li").map(function(){return a(this).attr("id")}).get()),a(".csb-image-set").change(function(){var b=a(this).val();a(".csb-image-preview").attr("data-base"),a.each(a(".csb-services img"),function(c,d){var e=a(d).attr("src"),f=a(d).attr("data-image-set"),g=e.replace(f,b);a(d).attr("src",g),a(d).attr("data-image-set",b)})}),a("#share_image_size").bind("input",function(){var b=a(this).val();a.each(a(".csb-services img"),function(c,d){a(d).attr("width",b),a(d).attr("height",b)})}),a("#link_image_size").bind("input",function(){var b=a(this).val();a.each(a(".csb-services img"),function(c,d){a(d).attr("width",b),a(d).attr("height",b)})})});2 * Version 1.2.0 (12-04-2014) */ 3 jQuery(document).ready(function(a){a("#csbsort1, #csbsort2").sortable({connectWith:".connectedSortable",update:function(){var b;b=a("#csbsort2 li").map(function(){return a(this).attr("id")}).get(),a(".csb-services").val(b)}}).disableSelection(),a(".csb-services").val(a("#csbsort2 li").map(function(){return a(this).attr("id")}).get()),a(".csb-image-set").change(function(){var b=a(this).val();a.each(a(".csb-services img"),function(c,d){var e=a(d).attr("data-url"),f=a(d).attr("data-alt-url"),g=a(d).attr("data-filename"),h=e+b+"/"+g,i=f+b+"/"+g;a(d).attr("src",h),a(d).attr("data-image-set",b),a.ajax(h,{method:"get",error:function(){a(d).attr("src",i)}})})}),a("#share_image_size").bind("input",function(){var b=a(this).val();a.each(a(".csb-services img"),function(c,d){a(d).attr("width",b),a(d).attr("height",b)})}),a("#link_image_size").bind("input",function(){var b=a(this).val();a.each(a(".csb-services img"),function(c,d){a(d).attr("width",b),a(d).attr("height",b)})})}); -
crafty-social-buttons/trunk/services/class-SH_Craftsy.php
r890035 r891793 11 11 class SH_Craftsy extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Craftsy"; 16 16 } -
crafty-social-buttons/trunk/services/class-SH_Digg.php
r890035 r891793 11 11 class SH_Digg extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Digg"; 16 16 } … … 22 22 . ($this->newWindow ? 'target="_blank"' : '') . '>'; 23 23 24 $html .= $this->buttonImage(); 25 24 $html .= $this->buttonImage(); 25 26 26 $html .= '</a>'; 27 27 … … 45 45 return $html; 46 46 } 47 47 48 48 public static function description() { 49 49 return "Hint: www.digg.com/<strong>user-id</strong>"; -
crafty-social-buttons/trunk/services/class-SH_Email.php
r890035 r891793 11 11 class SH_Email extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Email"; 16 16 $this->imageUrl = $this->imagePath . "email.png"; -
crafty-social-buttons/trunk/services/class-SH_Etsy.php
r890035 r891793 11 11 class SH_Etsy extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Etsy"; 16 16 $this->imageUrl = $this->imagePath . "etsy.png"; -
crafty-social-buttons/trunk/services/class-SH_Facebook.php
r890035 r891793 11 11 class SH_Facebook extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Facebook"; 16 16 $this->imageUrl = $this->imagePath . "facebook.png"; … … 23 23 . ($this->newWindow ? 'target="_blank"' : '') . '>'; 24 24 25 $html .= $this->buttonImage(); 26 27 if ($showCount) { 28 $html .= '<span class="crafty-social-share-count">' . $this->shareCount($url) . '</span>'; 29 } 25 $html .= $this->buttonImage(); 26 27 $html .= $this->shareCountHtml($showCount); 30 28 31 29 $html .= '</a>'; … … 60 58 if (isset($json['shares'])) { 61 59 return $json['shares']; 60 } elseif (isset($json['likes'])) { 61 return $json['likes']; 62 62 } else { 63 63 return '0'; -
crafty-social-buttons/trunk/services/class-SH_Flickr.php
r890035 r891793 11 11 class SH_Flickr extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Flickr"; 16 16 } -
crafty-social-buttons/trunk/services/class-SH_Google.php
r890035 r891793 11 11 class SH_Google extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Google"; 16 16 $this->imageUrl = $this->imagePath . "google.png"; … … 24 24 . ($this->newWindow ? 'target="_blank"' : '') . '>'; 25 25 26 $html .= $this->buttonImage(); 27 28 if ($showCount) { 29 $html .= '<span class="crafty-social-share-count">' . $this->shareCount($url) . '</span>'; 30 } 26 $html .= $this->buttonImage(); 27 28 $html .= $this->shareCountHtml($showCount); 31 29 32 30 $html .= '</a>'; … … 64 62 'method' => 'pos.plusones.get', 65 63 'id' => 'p', 66 'method' => 'pos.plusones.get',67 64 'jsonrpc' => '2.0', 68 65 'key' => 'p', -
crafty-social-buttons/trunk/services/class-SH_Instagram.php
r890035 r891793 11 11 class SH_Instagram extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Instagram"; 16 16 } -
crafty-social-buttons/trunk/services/class-SH_LinkedIn.php
r890035 r891793 11 11 class SH_LinkedIn extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "LinkedIn"; 16 16 $this->imageUrl = $this->imagePath . "linkedin.png"; … … 24 24 . ($this->newWindow ? 'target="_blank"' : '') . '>'; 25 25 26 $html .= $this->buttonImage(); 27 28 if ($showCount) { 29 $html .= '<span class="crafty-social-share-count">' . $this->shareCount($url) . '</span>'; 30 } 26 $html .= $this->buttonImage(); 27 28 $html .= $this->shareCountHtml($showCount); 31 29 32 30 $html .= '</a>'; … … 57 55 public function shareCount($url) { 58 56 59 $response = wp_remote_get('http://www.linkedin.com/countserv/count/share? url=' . $url);57 $response = wp_remote_get('http://www.linkedin.com/countserv/count/share?format=json&url=' . $url); 60 58 if (is_wp_error($response)){ 61 59 // return zero if response is error 62 60 return "0"; 63 61 } else { 64 65 $responseBody = str_replace('IN.Tags.Share.handleCount(', '', $response['body']);66 $responseBody = str_replace(');', '', $responseBody);67 68 62 $json = json_decode($response['body'], true); 69 63 if (isset($json['count'])) { -
crafty-social-buttons/trunk/services/class-SH_Pinterest.php
r890035 r891793 11 11 class SH_Pinterest extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Pinterest"; 16 16 $this->imageUrl = $this->imagePath . "pinterest.png"; … … 21 21 $html = "<a class=\"" . $this->cssClass() . "\" href='javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());'>"; 22 22 23 $html .= $this->buttonImage(); 24 25 if ($showCount) { 26 $html .= '<span class="crafty-social-share-count">' . $this->shareCount($url) . '</span>'; 27 } 23 $html .= $this->buttonImage(); 24 25 $html .= $this->shareCountHtml($showCount); 28 26 29 27 $html .= '</a>'; … … 50 48 51 49 public function shareCount($url) { 52 $response = wp_remote_get('http://api.pinterest.com/v1/urls/count.json?callback= &url=' . $url);50 $response = wp_remote_get('http://api.pinterest.com/v1/urls/count.json?callback=receiveCount&url=' . $url); 53 51 if (is_wp_error($response)){ 54 52 // return zero if response is error 55 53 return "0"; 56 54 } else { 57 $responseBody = str_replace(' (', '', $response['body']); // strip random extra parens in json55 $responseBody = str_replace('receiveCount(', '', $response['body']); // strip callback info from jsonp 58 56 $responseBody = str_replace(')', '', $responseBody); 59 57 $json = json_decode($responseBody, true); -
crafty-social-buttons/trunk/services/class-SH_RSS.php
r890035 r891793 11 11 class SH_RSS extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "RSS"; 16 16 } -
crafty-social-buttons/trunk/services/class-SH_Ravelry.php
r890035 r891793 11 11 class SH_Ravelry extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Ravelry"; 16 16 $this->imageUrl = $this->imagePath . "ravelry.png"; -
crafty-social-buttons/trunk/services/class-SH_Reddit.php
r890035 r891793 11 11 class SH_Reddit extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Reddit"; 16 16 $this->imageUrl = $this->imagePath . "reddit.png"; … … 24 24 . ($this->newWindow ? 'target="_blank"' : '') . '>'; 25 25 26 $html .= $this->buttonImage(); 27 28 if ($showCount) { 29 $html .= '<span class="crafty-social-share-count">' . $this->shareCount($url) . '</span>'; 30 } 26 $html .= $this->buttonImage(); 27 28 $html .= $this->shareCountHtml($showCount); 31 29 32 30 $html .= '</a>'; … … 53 51 54 52 public function shareCount($url) { 55 $response = wp_remote_get(' www.reddit.com/api/info.json?url=' . $url);53 $response = wp_remote_get('http://www.reddit.com/api/info.json?url=' . $url); 56 54 if (is_wp_error($response)){ 57 55 // return zero if response is error … … 66 64 } 67 65 } 66 68 67 public static function description() { 69 68 return "Hint: www.reddit.com/user/<strong>user-id</strong>"; -
crafty-social-buttons/trunk/services/class-SH_Social_Service.php
r890035 r891793 12 12 13 13 // construct the class 14 public function __construct($type, $settings ) {14 public function __construct($type, $settings, $key) { 15 15 $this->service = "Default"; // must be set correctly in the subclass constructors 16 16 $this->settings = $settings; 17 $this->key = $key; 17 18 18 19 $imageSet = $settings[$type.'_image_set']; 19 $this->imagePath = plugins_url() . "/crafty-social-buttons/buttons/$imageSet/";20 $this->imagePath = $this->getImageUrlPath($imageSet); 20 21 21 22 $this->imageExtension = ".png"; … … 27 28 protected function cssClass() { 28 29 return "crafty-social-button csb-" . trim(strtolower($this->service)); 30 } 31 32 protected function getImageUrlPath($imageSet) { 33 $plugin_url = plugins_url() . "/crafty-social-buttons/buttons/$imageSet/"; 34 $plugin_file_path = plugin_dir_path(__FILE__) . "../buttons/$imageSet"; 35 36 if (is_dir($plugin_file_path)) { 37 return $plugin_url; 38 } else { 39 $custom_url = wp_upload_dir()['baseurl'] . "/crafty-social-buttons/buttons/$imageSet/"; 40 return $custom_url; 41 } 29 42 } 30 43 … … 61 74 .'src="' . $imageUrl .'" />'; 62 75 } 76 77 protected function shareCountHtml($display) { 78 if ($display) { 79 $slug = trim(strtolower($this->service)); 80 $key = $this->key; 81 return '<span id="crafty-social-share-count-'.$slug.'-'.$key.'" class="crafty-social-share-count">0</span>'; 82 } else { 83 return ''; 84 } 85 86 } 63 87 64 88 } -
crafty-social-buttons/trunk/services/class-SH_StumbleUpon.php
r890035 r891793 11 11 class SH_StumbleUpon extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "StumbleUpon"; 16 16 $this->imageUrl = $this->imagePath . "stumbleupon.png"; … … 24 24 . ($this->newWindow ? 'target="_blank"' : '') . '>'; 25 25 26 $html .= $this->buttonImage(); 27 28 if ($showCount) { 29 $html .= '<span class="crafty-social-share-count">' . $this->shareCount($url) . '</span>'; 30 } 26 $html .= $this->buttonImage(); 27 28 $html .= $this->shareCountHtml($showCount); 31 29 32 30 $html .= '</a>'; -
crafty-social-buttons/trunk/services/class-SH_Tumblr.php
r890035 r891793 11 11 class SH_Tumblr extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Tumblr"; 16 16 $this->imageUrl = $this->imagePath . "tumblr.png"; -
crafty-social-buttons/trunk/services/class-SH_Twitter.php
r890035 r891793 11 11 class SH_Twitter extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "Twitter"; 16 $this->text = isset($settings['twitter_body']) ? $settings['twitter_body'] : ''; 16 $this->text = isset($settings['twitter_body']) ? $settings['twitter_body'] : ''; 17 $this->show_title = isset($settings['twitter_show_title']) && $settings['twitter_show_title']; 17 18 } 18 19 … … 20 21 public function shareButton($url, $title = '', $showCount = false) { 21 22 23 if ($this->show_title) { 24 $this->text .= ' '.$title; 25 } 26 22 27 $html = '<a class="' . $this->cssClass() . '" href="http://twitter.com/share?' 23 28 . 'url=' . $url 24 . '&text=' . htmlspecialchars(urlencode(html_entity_decode(trim($this->text . ' ' . $title), ENT_COMPAT, 'UTF-8')), ENT_COMPAT, 'UTF-8')29 . '&text=' . htmlspecialchars(urlencode(html_entity_decode(trim($this->text), ENT_COMPAT, 'UTF-8')), ENT_COMPAT, 'UTF-8') 25 30 . '" ' 26 31 . ($this->newWindow ? 'target="_blank"' : '') . '>'; 27 32 28 33 $html .= $this->buttonImage(); 29 30 if ($showCount) { 31 $html .= '<span class="crafty-social-share-count">' . $this->shareCount($url) . '</span>'; 32 } 33 34 35 $html .= $this->shareCountHtml($showCount); 36 34 37 $html .= '</a>'; 35 38 -
crafty-social-buttons/trunk/services/class-SH_YouTube.php
r890035 r891793 11 11 class SH_YouTube extends SH_Social_Service { 12 12 13 public function __construct($type, $settings ) {14 parent::__construct($type, $settings );13 public function __construct($type, $settings, $key) { 14 parent::__construct($type, $settings, $key); 15 15 $this->service = "YouTube"; 16 16 } -
crafty-social-buttons/trunk/views/admin.php
r801913 r891793 1 1 <div class="wrap <?php echo $this->plugin_slug; ?>"> 2 <?php screen_icon(); ?>3 2 <h2>Crafty Social Buttons</h2> 4 3 … … 12 11 Link Button Options</a> 13 12 </h2> 14 15 <? settings_errors(); ?> 16 13 17 14 <form method="post" action="options.php"> 18 15 <?php
Note: See TracChangeset
for help on using the changeset viewer.