Changeset 618456
- Timestamp:
- 10/29/2012 01:39:48 AM (13 years ago)
- Location:
- wordpress-social-ring
- Files:
-
- 18 added
- 2 deleted
- 7 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/admin (added)
-
tags/1.2.0/admin/admin.php (added)
-
tags/1.2.0/admin/css (added)
-
tags/1.2.0/admin/css/style.css (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/library.php (added)
-
tags/1.2.0/includes/widgets.php (added)
-
tags/1.2.0/langs (added)
-
tags/1.2.0/langs/wp_social_ring-es_ES.mo (added)
-
tags/1.2.0/langs/wp_social_ring-es_ES.po (added)
-
tags/1.2.0/langs/wp_social_ring-it_IT.mo (added)
-
tags/1.2.0/langs/wp_social_ring-it_IT.po (added)
-
tags/1.2.0/readme.txt (added)
-
tags/1.2.0/screenshot-1.png (added)
-
tags/1.2.0/screenshot-2.png (added)
-
tags/1.2.0/screenshot-3.png (added)
-
tags/1.2.0/wp-social-ring.php (added)
-
trunk/admin/admin.php (modified) (6 diffs)
-
trunk/images (deleted)
-
trunk/includes/library.php (modified) (4 diffs)
-
trunk/includes/share.php (deleted)
-
trunk/includes/widgets.php (modified) (2 diffs)
-
trunk/langs/wp_social_ring-it_IT.mo (modified) (previous)
-
trunk/langs/wp_social_ring-it_IT.po (modified) (4 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/wp-social-ring.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wordpress-social-ring/trunk/admin/admin.php
r614490 r618456 1 1 <?php 2 2 3 function wp_social_ring_setting_page() { 4 3 class WordPress_Social_Ring_Admin { 4 5 private $options; 6 private $languages = array( 7 8 'Afrikaans' => array( 9 'Facebook' => 'af_ZA', 10 'Google' => 'af', 11 'Twitter' => 'af' 12 ), 13 'Arabic' => array( 14 'Facebook' => 'ar_AR', 15 'Google' => 'ar', 16 'Twitter' => 'ar' 17 ), 18 'Czech' => array( 19 'Facebook' => 'cs_CZ', 20 'Google' => 'cs', 21 'Twitter' => 'cs' 22 ), 23 'Danish' => array( 24 'Facebook' => 'da_DK', 25 'Google' => 'da', 26 'Twitter' => 'da' 27 ), 28 'Filipino' => array( 29 'Facebook' => 'en_US', 30 'Google' => 'en-US', 31 'Twitter' => 'en' 32 ), 33 'Finnish' => array( 34 'Facebook' => 'en_US', 35 'Google' => 'en-US', 36 'Twitter' => 'en' 37 ), 38 'French' => array( 39 'Facebook' => 'fr_FR', 40 'Google' => 'fr', 41 'Twitter' => 'fr' 42 ), 43 'English' => array( 44 'Facebook' => 'en_US', 45 'Google' => 'en-US', 46 'Twitter' => 'en' 47 ), 48 'German' => array( 49 'Facebook' => 'de_DE', 50 'Google' => 'de', 51 'Twitter' => 'de' 52 ), 53 'Greek' => array( 54 'Facebook' => 'el_GR', 55 'Google' => 'el', 56 'Twitter' => 'el' 57 ), 58 'Hebrew' => array( 59 'Facebook' => 'he_IL', 60 'Google' => 'he', 61 'Twitter' => 'he' 62 ), 63 'Hindi' => array( 64 'Facebook' => 'hi_IN', 65 'Google' => 'hi', 66 'Twitter' => 'hi' 67 ), 68 'Hungarian' => array( 69 'Facebook' => 'hu_HU', 70 'Google' => 'hu', 71 'Twitter' => 'hu' 72 ), 73 'Icelandic' => array( 74 'Facebook' => 'is_IS', 75 'Google' => 'is', 76 'Twitter' => 'is' 77 ), 78 'Indonesian' => array( 79 'Facebook' => 'id_ID', 80 'Google' => 'id', 81 'Twitter' => 'id' 82 ), 83 'Italian' => array( 84 'Facebook' => 'it_IT', 85 'Google' => 'it', 86 'Twitter' => 'it' 87 ), 88 'Japanese' => array( 89 'Facebook' => 'ja_JP', 90 'Google' => 'ja', 91 'Twitter' => 'ja' 92 ), 93 'Norwegian' => array( 94 'Facebook' => 'nn_NO', 95 'Google' => 'no', 96 'Twitter' => 'no' 97 ), 98 'Polish' => array( 99 'Facebook' => 'pl_PL', 100 'Google' => 'pl', 101 'Twitter' => 'pl' 102 ), 103 'Portuguese (Brazil)' => array( 104 'Facebook' => 'pt_BR', 105 'Google' => 'pt-BR', 106 'Twitter' => 'pt' 107 ), 108 'Portuguese (Portugal)' => array( 109 'Facebook' => 'pt_PT', 110 'Google' => 'pt-PT', 111 'Twitter' => 'pt' 112 ), 113 'Romanian' => array( 114 'Facebook' => 'ro_RO', 115 'Google' => 'ro', 116 'Twitter' => 'ro' 117 ), 118 'Russian' => array( 119 'Facebook' => 'ru_RU', 120 'Google' => 'ru', 121 'Twitter' => 'ru' 122 ), 123 'Serbian' => array( 124 'Facebook' => 'sr_RS', 125 'Google' => 'sr', 126 'Twitter' => 'sr' 127 ), 128 'Slovak' => array( 129 'Facebook' => 'sk_SK', 130 'Google' => 'sk', 131 'Twitter' => 'sk' 132 ), 133 'Slovenian' => array( 134 'Facebook' => 'sl_SI', 135 'Google' => 'sl', 136 'Twitter' => 'sl' 137 ), 138 'Spanish' => array( 139 'Facebook' => 'es_ES', 140 'Google' => 'es', 141 'Twitter' => 'es' 142 ), 143 144 'Swedish' => array( 145 'Facebook' => 'sv_SE', 146 'Language' => 'sv', 147 'Twitter' => 'sv' 148 ), 149 'Turkish' => array( 150 'Facebook' => 'tr_TR', 151 'Google' => 'tr', 152 'Twitter' => 'tr' 153 ), 154 'Ukrainian' => array( 155 'Facebook' => 'uk_UA', 156 'Google' => 'uk', 157 'Twitter' => 'uk' 158 ) 159 ); 160 161 function __construct() { 162 $this->options = get_option(WP_SOCIAL_RING.'_options'); 163 add_action('admin_menu', array($this, 'register_option_page')); 164 add_action('admin_init', array($this, 'register_options')); 165 } 166 167 function register_option_page() { 168 $page = add_options_page(__('Social Sharing', WP_SOCIAL_RING), __('Social Sharing', WP_SOCIAL_RING), 'manage_options', 'wp_social_ring', array($this, 'print_option_page')); 169 add_action('admin_print_styles-' . $page, array($this, 'equeue_admin_css_js')); 170 } 171 172 function print_option_page() { 5 173 ?> 6 7 174 <div class="wrap"> 8 175 <?php screen_icon('plugins'); ?> … … 11 178 <div class="postbox-container" style="width:70%;"> 12 179 <form action="options.php" method="post"> 13 14 180 <div class="postbox"> 15 181 <?php settings_fields(WP_SOCIAL_RING.'_options'); ?> … … 39 205 </div> 40 206 <input name="submit" class="button-primary" type="submit" value="<?php _e('Save Changes',WP_SOCIAL_RING); ?>" /> 41 42 207 </form> 43 208 </div> 44 45 209 <div class="postbox-container" style="margin-left:15px;"> 46 210 <div class="postbox"> … … 54 218 <h3><?php _e('News', WP_SOCIAL_RING); ?></h3> 55 219 <ul style="list-style:circle; padding:10px 0 10px 30px;"> 220 <li><a target="_blank" href="http://wordpress.altervista.org/wp-social-ring-1-2-0/">WordPress Social Ring 1.2.0</a></li> 56 221 <li><a target="_blank" href="http://wordpress.altervista.org/wordpress-social-ring-1-1-9/">WordPress Social Ring 1.1.9</a></li> 57 222 <li><a target="_blank" href="http://wordpress.altervista.org/wordpress-social-ring-1-1-2-shortcode/">WordPress Social Ring 1.1.2</a></li> … … 80 245 </div> 81 246 <?php 82 83 } 84 85 86 function add_wp_social_ring_css_js() { 87 88 wp_enqueue_style( WP_SOCIAL_RING.'-style', WP_SOCIAL_RING_URL.'admin/css/style.css'); 89 wp_enqueue_script( WP_SOCIAL_RING.'_facebook_js', 'http://connect.facebook.net/'.__('en_US', WP_SOCIAL_RING).'/all.js#xfbml=1', array(), false, true); 90 wp_enqueue_script( WP_SOCIAL_RING.'_gplus_js', 'https://apis.google.com/js/plusone.js', array(), false, true); 91 wp_enqueue_script( WP_SOCIAL_RING.'_twitter_js', 'http://platform.twitter.com/widgets.js', array(), false, true); 92 wp_enqueue_script( WP_SOCIAL_RING.'_pin_it_js', 'http://assets.pinterest.com/js/pinit.js', array(), false, true); 93 } 94 95 // Register and define the settings 96 add_action('admin_init', 'wp_social_ring_admin_init'); 97 function wp_social_ring_admin_init(){ 98 99 100 101 register_setting( 102 WP_SOCIAL_RING.'_options', 103 WP_SOCIAL_RING.'_options', 104 WP_SOCIAL_RING.'_validate_options' 105 ); 106 107 add_settings_section( 108 WP_SOCIAL_RING.'_setting_section', 109 __('General Settings',WP_SOCIAL_RING), 110 'wp_social_ring_social_share_explain', 111 WP_SOCIAL_RING 112 ); 113 add_settings_field( 114 'wp_social_ring_social_buttons', 115 __('Buttons',WP_SOCIAL_RING), 116 'print_social_ring_buttons_input', 117 WP_SOCIAL_RING, 118 WP_SOCIAL_RING.'_setting_section' 119 ); 120 add_settings_field( 121 'wp_social_ring_position', 122 __('Position',WP_SOCIAL_RING), 123 'print_social_ring_position_input', 124 WP_SOCIAL_RING, 125 WP_SOCIAL_RING.'_setting_section' 126 ); 127 add_settings_field( 128 'wp_social_ring_show_on', 129 __('Show on',WP_SOCIAL_RING), 130 'print_social_ring_show_on_input', 131 WP_SOCIAL_RING, 132 WP_SOCIAL_RING.'_setting_section' 133 ); 134 } 135 136 function wp_social_ring_social_share_explain() { 247 } 248 249 function equeue_admin_css_js() { 250 wp_enqueue_style( WP_SOCIAL_RING.'-style', WP_SOCIAL_RING_URL.'admin/css/style.css'); 251 wp_enqueue_script( WP_SOCIAL_RING.'_facebook_js', 'http://connect.facebook.net/'.$this->options['facebook_language'].'/all.js#xfbml=1', array(), false, true); 252 wp_enqueue_script( WP_SOCIAL_RING.'_gplus_js', 'https://apis.google.com/js/plusone.js', array(), false, true); 253 wp_enqueue_script( WP_SOCIAL_RING.'_twitter_js', 'http://platform.twitter.com/widgets.js', array(), false, true); 254 wp_enqueue_script( WP_SOCIAL_RING.'_pin_it_js', 'http://assets.pinterest.com/js/pinit.js', array(), false, true); 255 wp_enqueue_script( WP_SOCIAL_RING.'_linkedin_js', 'http://platform.linkedin.com/in.js', array(), false, true); 256 wp_enqueue_script( WP_SOCIAL_RING.'_stumble_js', 'http://platform.stumbleupon.com/1/widgets.js', array(), false, true); 257 } 258 259 function register_options(){ 260 register_setting( 261 WP_SOCIAL_RING.'_options', 262 WP_SOCIAL_RING.'_options', 263 array($this, 'validate_options') 264 ); 265 add_settings_section( 266 WP_SOCIAL_RING.'_setting_section', 267 __('General Settings', WP_SOCIAL_RING), 268 array($this, 'settings_description'), 269 WP_SOCIAL_RING 270 ); 271 add_settings_field( 272 'wp_social_ring_active_buttons', 273 __('Buttons', WP_SOCIAL_RING), 274 array($this, 'active_buttons_setting'), 275 WP_SOCIAL_RING, 276 WP_SOCIAL_RING.'_setting_section' 277 ); 278 add_settings_field( 279 'wp_social_ring_position', 280 __('Position',WP_SOCIAL_RING), 281 array($this, 'position_setting'), 282 WP_SOCIAL_RING, 283 WP_SOCIAL_RING.'_setting_section' 284 ); 285 add_settings_field( 286 'wp_social_ring_show_on', 287 __('Show on', WP_SOCIAL_RING), 288 array($this, 'show_on_setting'), 289 WP_SOCIAL_RING, 290 WP_SOCIAL_RING.'_setting_section' 291 ); 292 add_settings_field( 293 'wp_social_ring_counter', 294 __('Counter', WP_SOCIAL_RING), 295 array($this, 'counter_setting'), 296 WP_SOCIAL_RING, 297 WP_SOCIAL_RING.'_setting_section' 298 ); 299 add_settings_field( 300 'wp_social_ring_language', 301 __('Buttons Language',WP_SOCIAL_RING), 302 array($this, 'language_setting'), 303 WP_SOCIAL_RING, 304 WP_SOCIAL_RING.'_setting_section' 305 ); 306 } 307 308 function settings_description() { 137 309 ?> 138 <div class="explain"><?php _e('Choose Social Ring position and behavior',WP_SOCIAL_RING); ?></div>310 <div class="explain"><?php _e('Choose sharing buttons position and behavior', WP_SOCIAL_RING); ?></div> 139 311 <?php 140 } 141 142 143 function print_social_ring_position_input() { 144 145 global $wp_social_ring_options; 146 // echo the field 312 } 313 314 function counter_setting() { 147 315 ?> 148 149 <ul>150 <l i>151 <span><input id='social_before_content' name='wp_social_ring_options[social_before_content]' type='checkbox' value="1" <?php if($wp_social_ring_options['social_before_content'] == 1) echo "checked"; ?> /></span>152 <span><?php _e('Before content',WP_SOCIAL_RING) ?></span>153 < /li>154 <l i>155 <span><input id='social_after_content' name='wp_social_ring_options[social_after_content]' type='checkbox' value="1" <?php if($wp_social_ring_options['social_after_content'] == 1) echo "checked"; ?> /></span>156 <span><?php _e('After content',WP_SOCIAL_RING) ?></span>157 < /li>158 </ul>159 316 <span> 317 <input id="horizontal" type="radio" name="wp_social_ring_options[button_counter]" value="horizontal" <?php checked($this->options['button_counter'], 'horizontal') ?>/> 318 <label for="horizontal"><?php _e('Horizontal', WP_SOCIAL_RING); ?></label> 319 </span> 320 <span style="padding-left:30px;"> 321 <input id="vertical" type="radio" name="wp_social_ring_options[button_counter]" value="vertical" <?php checked($this->options['button_counter'], 'vertical') ?>/> 322 <label for="vertical"><?php _e('Vertical', WP_SOCIAL_RING); ?></label> 323 </span> 324 <span style="padding-left:30px;"> 325 <input id="none" type="radio" name="wp_social_ring_options[button_counter]" value="none" <?php checked($this->options['button_counter'], 'none') ?>/> 326 <label for="none"><?php _e('None', WP_SOCIAL_RING); ?></label> 327 </span> 160 328 <?php 161 } 162 163 function print_social_ring_buttons_input() { 164 165 global $wp_social_ring_options; 166 // echo the field 329 } 330 331 function position_setting() { 332 ?> 333 <ul> 334 <li> 335 <span><input id='social_before_content' name='wp_social_ring_options[social_before_content]' type='checkbox' value="1" <?php if($this->options['social_before_content'] == 1) echo "checked"; ?> /></span> 336 <span><?php _e('Before content',WP_SOCIAL_RING) ?></span> 337 </li> 338 <li> 339 <span><input id='social_after_content' name='wp_social_ring_options[social_after_content]' type='checkbox' value="1" <?php if($this->options['social_after_content'] == 1) echo "checked"; ?> /></span> 340 <span><?php _e('After content',WP_SOCIAL_RING) ?></span> 341 </li> 342 </ul> 343 <?php 344 } 345 346 function active_buttons_setting() { 167 347 ?> 168 348 <ul> 169 349 <li style="clear:both;"> 170 <div style="float:left;"><input id='social_facebook_like_button' name='wp_social_ring_options[social_facebook_like_button]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_facebook_like_button'], 1); ?> /></div>350 <div style="float:left;"><input id='social_facebook_like_button' name='wp_social_ring_options[social_facebook_like_button]' type='checkbox' value="1" <?php checked($this->options['social_facebook_like_button'], 1); ?> /></div> 171 351 <div style="float:left;margin-left:20px;width:150px;"><?php _e('Facebook Like',WP_SOCIAL_RING) ?></div> 172 352 <div style="float:left;margin-left:20px;"><fb:like href="http://www.facebook.com/pages/DrWordPress/166397626712895" send="false" showfaces="false" width="108" layout="button_count" action="like"/></fb:like></div> 173 353 </li> 174 354 <li style="clear:both;padding-top:10px;"> 175 <div style="float:left;"><input id='social_facebook_send_button' name='wp_social_ring_options[social_facebook_send_button]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_facebook_send_button'], 1); ?> /></div>355 <div style="float:left;"><input id='social_facebook_send_button' name='wp_social_ring_options[social_facebook_send_button]' type='checkbox' value="1" <?php checked($this->options['social_facebook_send_button'], 1); ?> /></div> 176 356 <div style="float:left;margin-left:20px;width:150px;"><?php _e('Facebook Send',WP_SOCIAL_RING) ?></div> 177 357 <div style="float:left;margin-left:20px;"><fb:like href="http://www.facebook.com/pages/DrWordPress/166397626712895" send="true" showfaces="false" width="164" layout="button_count" action="like"/></fb:like></div> … … 179 359 </li> 180 360 <li style="clear:both;padding-top:10px;"> 181 <div style="float:left;"><input id='social_facebook_share_button' name='wp_social_ring_options[social_facebook_share_button]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_facebook_share_button'], 1); ?> /></div>361 <div style="float:left;"><input id='social_facebook_share_button' name='wp_social_ring_options[social_facebook_share_button]' type='checkbox' value="1" <?php checked($this->options['social_facebook_share_button'], 1); ?> /></div> 182 362 <div style="float:left;margin-left:20px;width:150px;"><?php _e('Facebook Share',WP_SOCIAL_RING) ?></div> 183 <div style="float:left;margin-left:20px;">< iframe allowtransparency="true" frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="width: 58px; height: 21px; position: static; left: 0px; top: 0px; visibility: visible; " tabindex="-1" vspace="0" width="100%" src="<?php echo WP_SOCIAL_RING_URL; ?>includes/share.php?url=<?php echo urlencode('http://wordpress.altervista.org/'); ?>"></iframe></div>184 </li> 185 <li style="clear:both;padding-top:10px;"> 186 <div style="float:left;"><input id='social_twitter_button' name='wp_social_ring_options[social_twitter_button]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_twitter_button'], 1); ?> /></div>363 <div style="float:left;margin-left:20px;"><fb:share-button expr:href="http://wordpress.altervista.org/" width="140" type="button_count"></fb:share></div> 364 </li> 365 <li style="clear:both;padding-top:10px;"> 366 <div style="float:left;"><input id='social_twitter_button' name='wp_social_ring_options[social_twitter_button]' type='checkbox' value="1" <?php checked($this->options['social_twitter_button'], 1); ?> /></div> 187 367 <div style="float:left;margin-left:20px;width:150px;"><?php _e('Twitter',WP_SOCIAL_RING) ?></div> 188 <div style="float:left;margin-left:20px;"><a href="http://twitter.com/share" data-url="<?php echo site_url(); ?>" data-text="<?php _e('I use WordPress Social Ring on my blog', WP_SOCIAL_RING); ?>" data-via="dottorwordpress" data-count="horizontal" class="sr-twitter-button twitter-share-button"></a></div>189 </li> 190 <li style="clear:both;padding-top:10px;"> 191 <div style="float:left;"><input id='social_google_button' name='wp_social_ring_options[social_google_button]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_google_button'], 1); ?> /></div>368 <div style="float:left;margin-left:20px;"><a href="http://twitter.com/share" lang="<?php echo $this->options['twitter_language']; ?>" data-url="<?php echo site_url(); ?>" data-text="<?php _e('I use WordPress Social Ring on my blog', WP_SOCIAL_RING); ?>" data-via="dottorwordpress" data-count="horizontal" class="sr-twitter-button twitter-share-button"></a></div> 369 </li> 370 <li style="clear:both;padding-top:10px;"> 371 <div style="float:left;"><input id='social_google_button' name='wp_social_ring_options[social_google_button]' type='checkbox' value="1" <?php checked($this->options['social_google_button'], 1); ?> /></div> 192 372 <div style="float:left;margin-left:20px;width:150px;"><?php _e('Google +1',WP_SOCIAL_RING) ?></div> 193 373 <div style="float:left;margin-left:20px;"><g:plusone href="<?php _e('http://wordpress.altervista.org/', WP_SOCIAL_RING); ?>" size="medium" callback="plusone_vote"></g:plusone></div> 374 <script type="text/javascript"> 375 window.___gcfg = { 376 lang: '<?php echo $this->options['google_language']; ?>' 377 }; 378 </script> 194 379 </li> 195 380 196 381 <li style="clear:both;padding-top:10px;"> 197 <div style="float:left;"><input id='social_linkedin_button' name='wp_social_ring_options[social_linkedin_button]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_linkedin_button'], 1); ?> /></div>382 <div style="float:left;"><input id='social_linkedin_button' name='wp_social_ring_options[social_linkedin_button]' type='checkbox' value="1" <?php checked($this->options['social_linkedin_button'], 1); ?> /></div> 198 383 <div style="float:left;margin-left:20px;width:150px;"><?php _e('LinkedIn',WP_SOCIAL_RING) ?></div> 199 <div style="float:left;margin-left:20px;"><div class="social-ring-button"><script src="//platform.linkedin.com/in.js" type="text/javascript"></script><scripttype="IN/Share" data-url="http://wordpress.altervista.org/" data-counter="right"></script></div>384 <div style="float:left;margin-left:20px;"><div class="social-ring-button"><script type="IN/Share" data-url="http://wordpress.altervista.org/" data-counter="right"></script></div> 200 385 </li> 201 386 202 387 <li style="clear:both;padding-top:10px;"> 203 <div style="float:left;"><input id='social_pin_it_button' name='wp_social_ring_options[social_pin_it_button]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_pin_it_button'], 1); ?> /></div>388 <div style="float:left;"><input id='social_pin_it_button' name='wp_social_ring_options[social_pin_it_button]' type='checkbox' value="1" <?php checked($this->options['social_pin_it_button'], 1); ?> /></div> 204 389 <div style="float:left;margin-left:20px;width:150px;"><?php _e('Pin it',WP_SOCIAL_RING) ?></div> 205 390 <div style="float:left;margin-left:20px;"><a href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode(__('http://wordpress.altervista.org/', WP_SOCIAL_RING)); ?>&media=<?php echo urlencode('http://wordpress.altervista.org/logo.jpg'); ?>&description=<?php echo urlencode(__('WordPress tutorials, plugin and themes.', WP_SOCIAL_RING)." ".site_url()); ?>" class="pin-it-button" count-layout="horizontal"></a></div> 206 391 </li> 392 <li style="clear:both;padding-top:10px;"> 393 <div style="float:left;"><input id='social_stumble_button' name='wp_social_ring_options[social_stumble_button]' type='checkbox' value="1" <?php checked($this->options['social_stumble_button'], 1); ?> /></div> 394 <div style="float:left;margin-left:20px;width:150px;"><?php _e('StumbleUpon',WP_SOCIAL_RING) ?></div> 395 <div style="float:left;margin-left:20px;"><su:badge layout="1"></su:badge></div> 396 </li> 207 397 </ul> 208 398 <?php 209 } 210 211 function print_social_ring_show_on_input() { 212 213 global $wp_social_ring_options; 214 // echo the field 215 399 } 400 401 function show_on_setting() { 216 402 ?> 217 218 403 <ul> 219 404 <li> 220 <span><input id='social_on_home' name='wp_social_ring_options[social_on_home]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_on_home'], 1); ?> /></span>405 <span><input id='social_on_home' name='wp_social_ring_options[social_on_home]' type='checkbox' value="1" <?php checked($this->options['social_on_home'], 1); ?> /></span> 221 406 <span><?php _e('Home',WP_SOCIAL_RING) ?></span> 222 407 </li> 223 408 <li> 224 <span><input id='social_on_pages' name='wp_social_ring_options[social_on_pages]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_on_pages'], 1); ?> /></span>409 <span><input id='social_on_pages' name='wp_social_ring_options[social_on_pages]' type='checkbox' value="1" <?php checked($this->options['social_on_pages'], 1); ?> /></span> 225 410 <span><?php _e('Pages',WP_SOCIAL_RING) ?></span> 226 411 </li> 227 412 <li> 228 <span><input id='social_on_posts' name='wp_social_ring_options[social_on_posts]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_on_posts'], 1); ?> /></span>413 <span><input id='social_on_posts' name='wp_social_ring_options[social_on_posts]' type='checkbox' value="1" <?php checked($this->options['social_on_posts'], 1); ?> /></span> 229 414 <span><?php _e('Posts',WP_SOCIAL_RING) ?></span> 230 415 </li> 231 416 <li> 232 <span><input id='social_on_category' name='wp_social_ring_options[social_on_category]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_on_category'], 1); ?> /></span>417 <span><input id='social_on_category' name='wp_social_ring_options[social_on_category]' type='checkbox' value="1" <?php checked($this->options['social_on_category'], 1); ?> /></span> 233 418 <span><?php _e('Categories',WP_SOCIAL_RING) ?></span> 234 419 </li> 235 420 <li> 236 <span><input id='social_on_archive' name='wp_social_ring_options[social_on_archive]' type='checkbox' value="1" <?php checked($ wp_social_ring_options['social_on_archive'], 1); ?> /></span>421 <span><input id='social_on_archive' name='wp_social_ring_options[social_on_archive]' type='checkbox' value="1" <?php checked($this->options['social_on_archive'], 1); ?> /></span> 237 422 <span><?php _e('Archive',WP_SOCIAL_RING) ?></span> 238 423 </li> 239 424 </ul> 240 241 425 <?php 426 } 427 428 function language_setting() { 429 ?> 430 <select id="language" name="wp_social_ring_options[language]"> 431 <?php foreach ($this->languages as $lang => $codes) { ?> 432 <option value="<?php echo $lang; ?>" <?php selected($this->options['language'], $lang); ?>><?php echo $lang; ?></option> 433 <?php } ?> 434 </select> 435 * <?php _e('LinkedIn, Pin It and StumbleUpon don\'t support localization', WP_SOCIAL_RING); ?> 436 <?php 437 } 438 439 function validate_options( $input ) { 440 $valid['social_facebook_like_button'] = (isset( $input['social_facebook_like_button'])) ? 1 : 0; 441 $valid['social_facebook_send_button'] = (isset( $input['social_facebook_send_button'])) ? 1 : 0; 442 if($valid['social_facebook_send_button'] == 1) { 443 $valid['social_facebook_like_button'] = 1; 444 } 445 $valid['social_facebook_share_button'] = (isset( $input['social_facebook_share_button'])) ? 1 : 0; 446 $valid['social_twitter_button'] = (isset( $input['social_twitter_button'])) ? 1 : 0; 447 $valid['social_google_button'] = (isset( $input['social_google_button'])) ? 1 : 0; 448 $valid['social_pin_it_button'] = (isset( $input['social_pin_it_button'])) ? 1 : 0; 449 $valid['social_linkedin_button'] = (isset( $input['social_linkedin_button'])) ? 1 : 0; 450 $valid['social_stumble_button'] = (isset( $input['social_stumble_button'])) ? 1 : 0; 451 $valid['social_on_home'] = (isset( $input['social_on_home'])) ? 1 : 0; 452 $valid['social_on_pages'] = (isset( $input['social_on_pages'])) ? 1 : 0; 453 $valid['social_on_posts'] = (isset( $input['social_on_posts'])) ? 1 : 0; 454 $valid['social_on_category'] = (isset( $input['social_on_category'])) ? 1 : 0; 455 $valid['social_on_archive'] = (isset( $input['social_on_archive'])) ? 1 : 0; 456 $valid['social_before_content'] = (isset( $input['social_before_content'])) ? 1 : 0; 457 $valid['button_counter'] = ($input['button_counter'] == 'vertical') || ($input['button_counter'] == 'none') ? $input['button_counter'] : 'horizontal'; 458 if(isset($this->languages[$input['language']])) { 459 $valid['language'] = $input['language']; 460 $valid['facebook_language'] = $this->languages[$input['language']]['Facebook']; 461 $valid['google_language'] = $this->languages[$input['language']]['Google']; 462 $valid['twitter_language'] = $this->languages[$input['language']]['Twitter']; 463 } 464 return $valid; 465 } 466 242 467 } 243 468 244 245 // Validate user input (we want text only) 246 function wp_social_ring_validate_options( $input ) { 247 248 global $wp_social_ring_options; 249 250 //social 251 $valid['social_facebook_like_button'] = (isset( $input['social_facebook_like_button'])) ? 1 : 0; 252 $valid['social_facebook_send_button'] = (isset( $input['social_facebook_send_button'])) ? 1 : 0; 253 if($valid['social_facebook_send_button'] == 1) { 254 $valid['social_facebook_like_button'] = 1; 255 } 256 $valid['social_facebook_share_button'] = (isset( $input['social_facebook_share_button'])) ? 1 : 0; 257 $valid['social_twitter_button'] = (isset( $input['social_twitter_button'])) ? 1 : 0; 258 $valid['social_google_button'] = (isset( $input['social_google_button'])) ? 1 : 0; 259 $valid['social_pin_it_button'] = (isset( $input['social_pin_it_button'])) ? 1 : 0; 260 $valid['social_linkedin_button'] = (isset( $input['social_linkedin_button'])) ? 1 : 0; 261 $valid['social_on_home'] = (isset( $input['social_on_home'])) ? 1 : 0; 262 $valid['social_on_pages'] = (isset( $input['social_on_pages'])) ? 1 : 0; 263 $valid['social_on_posts'] = (isset( $input['social_on_posts'])) ? 1 : 0; 264 $valid['social_on_category'] = (isset( $input['social_on_category'])) ? 1 : 0; 265 $valid['social_on_archive'] = (isset( $input['social_on_archive'])) ? 1 : 0; 266 $valid['social_before_content'] = (isset( $input['social_before_content'])) ? 1 : 0; 267 $valid['social_after_content'] = (isset( $input['social_after_content'])) ? 1 : 0; 268 269 return $valid; 270 } 271 272 add_action('admin_menu', 'register_social_ring_admin_menu'); 273 function register_social_ring_admin_menu() { 274 275 $page = add_options_page(__('Social Network', WP_SOCIAL_RING), __('Social Network', WP_SOCIAL_RING), 'manage_options', 'wp_social_ring', 'wp_social_ring_setting_page'); 276 add_action('admin_print_styles-' . $page, 'add_wp_social_ring_css_js'); 277 278 } 469 new WordPress_Social_Ring_Admin(); 279 470 280 471 ?> -
wordpress-social-ring/trunk/includes/library.php
r614490 r618456 1 1 <?php 2 2 3 function social_ring_get_first_image() { 4 5 global $post, $posts; 6 7 if ( function_exists('has_post_thumbnail') && has_post_thumbnail( $post->ID ) ) { 8 9 $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ); 10 if ( $thumbnail ) 11 $image = $thumbnail[0]; 12 13 // If that's not there, grab the first attached image 14 } else { 15 16 $files = get_children( 17 array( 18 'post_parent' => $post->ID, 19 'post_type' => 'attachment', 20 'post_mime_type' => 'image', 21 ) 22 ); 23 if ( $files ) { 24 $keys = array_reverse( array_keys( $files ) ); 25 $image = image_downsize( $keys[0], 'thumbnail' ); 26 $image = $image[0]; 27 } 28 } 29 //if there's no attached image, try to grab first image in content 30 if(empty($image)) { 31 ob_start(); 32 ob_end_clean(); 33 $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', 34 $post->post_content, $matches); 35 if(!empty($matches[1][0])) { 36 $image = $matches[1][0]; 37 } 38 } 39 40 return $image; 41 } 42 43 function social_ring_add_css() { 44 45 global $wp_social_ring_options; 46 ?> 47 3 4 class WordPress_Social_Ring { 5 6 private $options; 7 private $post_url; 8 private $post_encoded_url; 9 private $post_title; 10 private $post_encoded_title; 11 12 function __construct() { 13 $this->options = get_option(WP_SOCIAL_RING.'_options'); 14 add_action('wp_head', array($this, 'frontend_css')); 15 add_filter('the_content', array($this, 'add_sharing_buttons')); 16 add_action('wp_footer', array($this, 'add_footer_js')); 17 add_shortcode('socialring', array($this, 'shortcode')); 18 } 19 20 function add_sharing_buttons($content) { 21 if($this->print_check() == 1 && ($this->options['social_before_content'] == 1 || $this->options['social_after_content'] == 1)) { 22 $html = $this->buttons_html(); 23 if($this->options['social_before_content'] == 1) { 24 $content = $html.$content; 25 } 26 if($this->options['social_after_content'] == 1) { 27 $content = $content.$html; 28 } 29 } 30 return $content; 31 } 32 33 function frontend_css() { 34 ?> 48 35 <style type="text/css"> 49 50 36 .social-ring:after { 51 37 clear: both; … … 57 43 visibility: hidden; 58 44 width: 0; 59 } 60 45 } 61 46 .social-ring { 62 47 margin: 0 !important; … … 66 51 font-size: 11px; 67 52 } 68 69 53 .social-ring-button { 70 54 float: left !important; 55 <?php if($this->options['button_counter'] == 'vertical') { ?> 56 height: 60px; 57 <?php } else { ?> 71 58 height: 30px; 59 <?php } ?> 72 60 margin: 0 5px 0 0 !important; 73 61 padding: 0 !important; 74 62 } 75 76 63 </style> 77 78 <?php 64 <?php 65 } 66 67 function buttons_html() { 68 global $post; 69 $this->post_url = (string) get_permalink($post->ID); 70 $this->post_encoded_url = (string) urlencode($this->post_url); 71 $this->post_title = (string) $post->post_title; 72 $this->post_encoded_title = (string) urlencode(esc_attr(strip_tags(stripslashes($post->post_title)))); 73 $html = '<!-- Social Ring Buttons Start --><div class="social-ring">'."\n"; 74 if($this->options['social_twitter_button'] == 1) { 75 $html .= $this->button_before(); 76 $html .= $this->twitter_html(); 77 $html .= $this->button_after(); 78 } 79 if($this->options['social_google_button'] == 1) { 80 $html .= $this->button_before(); 81 $html .= $this->google_plus_one_html(); 82 $html .= $this->button_after(); 83 } 84 if($this->options['social_facebook_share_button'] == 1) { 85 $html .= $this->button_before(); 86 $html .= $this->facebook_share_html(); 87 $html .= $this->button_after(); 88 } 89 if($this->options['social_facebook_like_button'] == 1) { 90 $html .= $this->button_before(); 91 $html .= $this->facebook_like_html(); 92 $html .= $this->button_after(); 93 } 94 if($this->options['social_pin_it_button'] == 1) { 95 $html .= $this->button_before(); 96 $html .= $this->pin_it_html(); 97 $html .= $this->button_after(); 98 } 99 if($this->options['social_linkedin_button'] == 1) { 100 $html .= $this->button_before(); 101 $html .= $this->linkedin_html(); 102 $html .= $this->button_after(); 103 } 104 if($this->options['social_stumble_button'] == 1) { 105 $html .= $this->button_before(); 106 $html .= $this->stumple_upon_html(); 107 $html .= $this->button_after(); 108 } 109 $html .= '</div>'; 110 $html .= '<div style="clear:both;"> </div><!-- Social Ring Buttons End -->'."\n"; 111 return $html; 112 113 } 114 115 function button_before() { 116 return '<div class="social-ring-button">'; 117 } 118 119 function button_after() { 120 return "</div>\n"; 121 } 122 123 function twitter_html() { 124 $twitter_html = '<a href="http://twitter.com/share" lang="'.$this->options['twitter_language'].'" data-url="'.$this->post_url.'" data-text="'.$this->post_title.'" '; 125 if($this->options['button_counter'] == "horizontal") { 126 $twitter_html .= 'data-count="horizontal"'; 127 } elseif($this->options['button_counter'] == "vertical") { 128 $twitter_html .= 'data-count="vertical"'; 129 } elseif($this->options['button_counter'] == "none") { 130 $twitter_html .= 'data-count="none"'; 131 } 132 $twitter_html .= ' class="sr-twitter-button twitter-share-button"></a>'; 133 return $twitter_html; 134 } 135 136 function google_plus_one_html() { 137 $google_html = '<div class="g-plusone" '; 138 if($this->options['button_counter'] == "horizontal") { 139 $google_html .= 'data-size="medium" '; 140 } elseif($this->options['button_counter'] == "vertical") { 141 $google_html .= 'data-size="tall" '; 142 } elseif($this->options['button_counter'] == "none") { 143 $google_html .= 'data-size="medium" data-annotation="none" '; 144 } 145 $google_html .= '></div>'; 146 return $google_html; 147 } 148 149 function facebook_share_html() { 150 $fb_share_html = '<fb:share-button expr:href="'.$this->post_url.'" width="140" '; 151 if($this->options['button_counter'] == "horizontal") { 152 $fb_share_html .= 'type="button_count"'; 153 } elseif($this->options['button_counter'] == "vertical") { 154 $fb_share_html .= 'type="box_count"'; 155 } elseif($this->options['button_counter'] == "none") { 156 $fb_share_html .= 'type="button"'; 157 } 158 $fb_share_html .= '></fb:share>'; 159 return $fb_share_html; 160 } 161 162 function facebook_like_html() { 163 if($this->options['social_facebook_send_button'] == 1) { 164 $send = 'true'; 165 $width = 180; 166 } else { 167 $send = 'false'; 168 $width = 140; 169 } 170 $fb_like_html = '<fb:like href="'.$this->post_url.'" width="'.$width.'" send="'.$send.'" showfaces="false" '; 171 if($this->options['button_counter'] == "vertical") { 172 $fb_like_html .= 'layout="box_count"'; 173 } else { 174 $fb_like_html .= 'layout="button_count"'; 175 } 176 $fb_like_html .= ' action="like"></fb:like>'; 177 return $fb_like_html; 178 } 179 180 function pin_it_html() { 181 $pin_it_html = '<a href="http://pinterest.com/pin/create/button/?url='.$this->post_encoded_url; 182 $image = $this->get_first_image(); 183 if($image > '') { 184 $pin_it_html .= '&media='.urlencode($image); 185 } 186 $pin_it_html .= '&description='.$this->post_encoded_title.'" class="pin-it-button"'; 187 if($this->options['button_counter'] == "horizontal") { 188 $pin_it_html .= 'count-layout="horizontal"'; 189 } elseif($this->options['button_counter'] == "vertical") { 190 $pin_it_html .= 'count-layout="vertical"'; 191 } elseif($this->options['button_counter'] == "none") { 192 $pin_it_html .= 'count-layout="none"'; 193 } 194 $pin_it_html .='></a>'; 195 return $pin_it_html; 196 } 197 198 function linkedin_html() { 199 $linkedin_html = '<script src="//platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/Share" data-url="'.$this->post_encoded_url.'" '; 200 if($this->options['button_counter'] == "horizontal") { 201 $linkedin_html .= 'data-counter="right" '; 202 } elseif($this->options['button_counter'] == "vertical") { 203 $linkedin_html .= 'data-counter="top" '; 204 } elseif($this->options['button_counter'] == "none") { 205 //no data-size attribute 206 } 207 $linkedin_html .= '></script>'; 208 return $linkedin_html; 209 } 210 211 function stumple_upon_html() { 212 213 $stumble_upon_html = '<su:badge '; 214 if($this->options['button_counter'] == "horizontal") { 215 $stumble_upon_html .= 'layout="1"'; 216 } elseif($this->options['button_counter'] == "vertical") { 217 $stumble_upon_html .= 'layout="5"'; 218 } elseif($this->options['button_counter'] == "none") { 219 $stumble_upon_html .= 'layout="4"'; 220 } 221 $stumble_upon_html .= '></su:badge>'; 222 return $stumble_upon_html; 223 } 224 225 function get_first_image() { 226 global $post; 227 //check if post has thumbnail 228 if ( function_exists('has_post_thumbnail') && has_post_thumbnail( $post->ID ) ) { 229 $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); 230 if ( $thumbnail ) 231 $image = $thumbnail[0]; 232 //check if pots has image attachments 233 } else { 234 $files = get_children( 235 array( 236 'post_parent' => $post->ID, 237 'post_type' => 'attachment', 238 'post_mime_type' => 'image', 239 ) 240 ); 241 if ( $files ) { 242 $keys = array_reverse( array_keys( $files ) ); 243 $image = image_downsize( $keys[0], 'thumbnail' ); 244 $image = $image[0]; 245 } 246 } 247 //if there's no attached image, try to grab first image in content 248 if(empty($image)) { 249 ob_start(); 250 ob_end_clean(); 251 $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', 252 $post->post_content, $matches); 253 if(!empty($matches[1][0])) { 254 $image = $matches[1][0]; 255 } 256 } 257 258 return $image; 259 } 260 261 /* 262 function social_ring_shortcode() returns the code for 263 [socialring] shortcode 264 */ 265 function shortcode() { 266 return $this->buttons_html(); 267 } 268 269 function add_footer_js() { 270 ?> 271 <!-- Social Ring JS Start --> 272 <div id="fb-root"></div><script src="http://connect.facebook.net/<?php echo $this->options['facebook_language']; ?>/all.js#xfbml=1"></script> 273 <script type="text/javascript"> 274 window.___gcfg = { 275 lang: '<?php echo $this->options['google_language']; ?>' 276 }; 277 (function() { 278 var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; 279 po.src = 'https://apis.google.com/js/plusone.js'; 280 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); 281 })(); 282 </script> 283 <script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script> 284 <script type='text/javascript' src='http://platform.twitter.com/widgets.js'></script> 285 <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script> 286 <script type="text/javascript"> 287 (function() { 288 var li = document.createElement('script'); li.type = 'text/javascript'; li.async = true; 289 li.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + '//platform.stumbleupon.com/1/widgets.js'; 290 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(li, s); 291 })(); 292 </script> 293 <!-- Social Ring JS End --> 294 <?php 295 } 296 297 function print_check() { 298 if(is_single() && get_post_type() == "post") { 299 return $this->options['social_on_posts']; 300 } 301 if(is_page() && get_post_type() == "page") { 302 return $this->options['social_on_pages']; 303 } 304 if(is_home()) { 305 return $this->options['social_on_home']; 306 } 307 if(is_category()) { 308 return $this->options['social_on_category']; 309 } 310 if(is_archive()) { 311 return $this->options['social_on_archive']; 312 } 313 return 0; 314 } 315 79 316 } 80 317 … … 85 322 function social_ring_show() { 86 323 87 $ html = social_ring_gen_button_code();88 echo $ html;324 $wp_social = new WordPress_Social_Ring(); 325 echo $wp_social->buttons_html(); 89 326 return; 90 327 91 328 } 92 329 93 /* 94 function social_ring_shortcode() returns the code for 95 [socialring] shortcode 96 */ 97 function social_ring_shortcode() { 98 99 return social_ring_gen_button_code(); 100 101 } 102 103 104 /* 105 function social_ring_gen_button_code() generates 106 HTML code of social buttons 107 */ 108 function social_ring_gen_button_code() { 109 110 global $wp_social_ring_options; 111 112 $url = get_permalink(get_the_ID()); 113 $title = get_the_title(get_the_ID()); 114 $html = '<!-- Social Ring Buttons Start --><div class="social-ring">'; 115 116 if($wp_social_ring_options['social_twitter_button'] == 1) { 117 $html .= '<div class="social-ring-button"><a href="http://twitter.com/share" data-url="'.$url.'" data-text="'.$title.'" data-count="horizontal" class="sr-twitter-button twitter-share-button"></a></div>'; 118 } 119 120 if($wp_social_ring_options['social_google_button'] == 1) { 121 $html .= '<div class="social-ring-button"><g:plusone size="medium" callback="plusone_vote"></g:plusone></div>'; 122 } 123 124 if($wp_social_ring_options['social_facebook_share_button'] == 1) { 125 $html .= '<div class="social-ring-button"><iframe allowtransparency="true" frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="width: 70px; height: 21px; position: static; left: 0px; top: 0px; visibility: visible; " tabindex="-1" vspace="0" width="100%" src="'.WP_SOCIAL_RING_URL.'/includes/share.php?url='.urlencode($url).'"></iframe></div>'; 126 } 127 if($wp_social_ring_options['social_facebook_like_button'] == 1) { 128 if(!preg_match("/MSIE 8.0/", $_SERVER['HTTP_USER_AGENT']) ) { 129 if($wp_social_ring_options['social_facebook_send_button'] == 1) { 130 $send = 'true'; 131 $width = 180; 132 } else { 133 $send = 'false'; 134 $width = 140; 135 } 136 $html .= '<div class="social-ring-button"><fb:like href="'.$url.'" width="'.$width.'" send="'.$send.'" showfaces="false" layout="button_count" action="like"/></fb:like></div>'; 137 } else { 138 $html .= '<div class="social-ring-button"><iframe src="http://www.facebook.com/plugins/like.php?app_id=131347983616840&href='.urlencode($url).'&send=false&layout=button_count&width=75&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe></div>'; 139 } 140 } 141 142 if($wp_social_ring_options['social_pin_it_button'] == 1) { 143 $html .= '<div class="social-ring-button"><a href="http://pinterest.com/pin/create/button/?url='.urlencode($url); 144 $image = social_ring_get_first_image(); 145 if($image > '') { 146 $html .= '&media='.urlencode($image); 147 } 148 $html .= '&description='.urlencode(esc_attr( strip_tags( stripslashes($title)))).'" class="pin-it-button" count-layout="horizontal"></a></div>'; 149 } 150 151 if($wp_social_ring_options['social_linkedin_button'] == 1) { 152 $html .= '<div class="social-ring-button"><script src="//platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/Share" data-url="'.$url.'" data-counter="right"></script></div>'; 153 } 154 155 $html .= '</div>'; 156 $html .= '<div style="clear:both;"> </div><!-- Social Ring Buttons End -->'; 157 return $html; 158 159 } 160 161 function social_ring_add_sharing($content) { 162 163 global $wp_social_ring_options; 164 165 if(social_ring_print_check() == 1 && ($wp_social_ring_options['social_before_content'] == 1 || $wp_social_ring_options['social_after_content'] == 1)) { 166 167 $html = social_ring_gen_button_code(); 168 169 if($wp_social_ring_options['social_before_content'] == 1) { 170 $content = $html.$content; 171 } 172 if($wp_social_ring_options['social_after_content'] == 1) { 173 $content = $content.$html; 174 } 175 176 } 177 178 return $content; 179 } 180 181 function social_ring_add_js() { 182 183 ?> 184 <!-- Social Ring JS Start --> 185 <div id="fb-root"></div><script src="http://connect.facebook.net/<?php _e('en_US', WP_SOCIAL_RING); ?>/all.js#xfbml=1"></script> 186 <script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script> 187 <script type='text/javascript' src='http://platform.twitter.com/widgets.js'></script> 188 <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script> 189 <!-- Social Ring JS End --> 190 <?php 191 } 192 193 function social_ring_print_check() { 194 195 global $wp_social_ring_options; 196 197 if(is_single() && get_post_type() == "post") { 198 return $wp_social_ring_options['social_on_posts']; 199 } 200 if(is_page() && get_post_type() == "page") { 201 return $wp_social_ring_options['social_on_pages']; 202 } 203 if(is_home()) { 204 return $wp_social_ring_options['social_on_home']; 205 } 206 if(is_category()) { 207 return $wp_social_ring_options['social_on_category']; 208 } 209 if(is_archive()) { 210 return $wp_social_ring_options['social_on_archive']; 211 } 212 return 0; 213 214 } 215 216 /* Code from Simple Facebook Connect by Otto (http://ottopress.com) */ 217 function social_ring_make_excerpt($post) { 218 219 if (!empty($post->post_excerpt)) $text = $post->post_excerpt; 220 else $text = $post->post_content; 221 222 $text = strip_shortcodes( $text ); 223 224 remove_filter( 'the_content', 'wptexturize' ); 225 $text = apply_filters('the_content', $text); 226 add_filter( 'the_content', 'wptexturize' ); 227 228 $text = str_replace(']]>', ']]>', $text); 229 $text = wp_strip_all_tags($text); 230 $text = str_replace(array("\r\n","\r","\n"),' ',$text); 231 232 $excerpt_more = apply_filters('excerpt_more', '[...]'); 233 $excerpt_more = html_entity_decode($excerpt_more, ENT_QUOTES, 'UTF-8'); 234 $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8'); 235 236 $max = min(1000,apply_filters('sfc_excerpt_length',1000)); 237 $max -= strlen ($excerpt_more) + 1; 238 $max -= strlen ('</fb:intl>') * 2 - 1; 239 240 if ($max<1) return ''; // nothing to send 241 242 if (strlen($text) >= $max) { 243 $text = substr($text, 0, $max); 244 $words = explode(' ', $text); 245 array_pop ($words); 246 array_push ($words, $excerpt_more); 247 $text = implode(' ', $words); 248 } 249 250 return $text; 251 } 330 new WordPress_Social_Ring(); 252 331 253 332 ?> -
wordpress-social-ring/trunk/includes/widgets.php
r476320 r618456 30 30 'tweet_text' => get_bloginfo('name').' - '.get_bloginfo('description'), 31 31 'border_color' => 'D0D0D0', 32 'box_padding' => 2 4,33 'button_margin' => 1232 'box_padding' => 20, 33 'button_margin' => 8 34 34 ); 35 35 … … 130 130 echo $before_title . $instance['widget_title'] . $after_title."\n"; 131 131 } 132 $options = get_option(WP_SOCIAL_RING.'_options'); 132 133 ?> 133 134 <div class="SocialRing_Widget_inside" style="-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;border:1px solid #<?php echo $instance['border_color']; ?>;padding:12px <?php echo $instance['box_padding']; ?>px;min-height:62px;"> 134 135 <div style="float:left;margin:0 <?php echo $instance['button_margin']; ?>px"> 135 <a href="https://twitter.com/share" class="sr-twitter-button twitter-share-button" data-text="<?php echo $instance['tweet_text']; ?>" data-url="<?php echo $instance['tweet_url']; ?>" data-count="vertical" data-via="<?php echo $instance['tweet_account']; ?>" data-related="<?php echo $instance['tweet_hint_account']; ?>:<?php echo $instance['tweet_hint_desc']; ?>"></a>136 <a href="https://twitter.com/share" lang="<?php echo $options['twitter_language']; ?>" class="sr-twitter-button twitter-share-button" data-text="<?php echo $instance['tweet_text']; ?>" data-url="<?php echo $instance['tweet_url']; ?>" data-count="vertical" data-via="<?php echo $instance['tweet_account']; ?>" data-related="<?php echo $instance['tweet_hint_account']; ?>:<?php echo $instance['tweet_hint_desc']; ?>"></a> 136 137 </div> 137 138 <div style="float:left;margin:0 <?php echo $instance['button_margin']; ?>px;padding-top:2px"> -
wordpress-social-ring/trunk/langs/wp_social_ring-it_IT.po
r584582 r618456 3 3 "Project-Id-Version: WordPress Social Ring\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2012- 08-12 17:15+0100\n"6 "PO-Revision-Date: 2012- 08-12 17:15+0100\n"5 "POT-Creation-Date: 2012-10-29 00:08+0100\n" 6 "PO-Revision-Date: 2012-10-29 00:12+0100\n" 7 7 "Last-Translator: Niccolo Tapparo\n" 8 8 "Language-Team: AlterVista\n" … … 14 14 "X-Poedit-SearchPath-0: .\n" 15 15 16 #: admin/admin.php:9 17 msgid "WordPress Social Ring Settings" 18 msgstr "Impostazioni WordPress Social Ring" 19 20 #: admin/admin.php:19 16 #: admin/admin.php:168 17 msgid "Social Sharing" 18 msgstr "Condivisione Social Network" 19 20 #: admin/admin.php:176 21 msgid "Social Network Settings" 22 msgstr "Impostazioni Condivisione Social Network" 23 24 #: admin/admin.php:185 21 25 msgid "Extra" 22 26 msgstr "Extra" 23 27 24 #: admin/admin.php: 2228 #: admin/admin.php:188 25 29 msgid "<b>Custom position</b>" 26 30 msgstr "<b>Posizione personalizzata</b>" 27 31 28 #: admin/admin.php: 2532 #: admin/admin.php:191 29 33 msgid "You can give Social buttons a custom position by calling this function in your theme." 30 34 msgstr "I bottoni social possono essere posizionati a piacere inserendo nel tema il seguente codice:" 31 35 32 #: admin/admin.php: 2936 #: admin/admin.php:195 33 37 msgid "Pay Attention: it must called <b>inside the loop</b> to work properly!" 34 38 msgstr "Attenzione: deve essere utilizzato <b>all'interno del loop</b> per funzionare correttamente." 35 39 36 #: admin/admin.php: 3240 #: admin/admin.php:198 37 41 msgid "<b>Shortcode</b>" 38 42 msgstr "<b>Shortcode</b>" 39 43 40 #: admin/admin.php: 3544 #: admin/admin.php:201 41 45 msgid "You can also place social buttons inside your posts by using the shortcode:" 42 46 msgstr "I bottoni social possono essere anche inseriti all'interno dei post utilizzando il seguente shortcode:" 43 47 44 #: admin/admin.php: 4048 #: admin/admin.php:206 45 49 msgid "Save Changes" 46 50 msgstr "Salva Impostazioni" 47 51 48 #: admin/admin.php:46 52 #: admin/admin.php:211 53 msgid "Help" 54 msgstr "Aiuto" 55 56 #: admin/admin.php:218 57 msgid "News" 58 msgstr "News" 59 60 #: admin/admin.php:236 49 61 msgid "http://en.altervista.org/create-free-blog.html?ref=socialring" 50 62 msgstr "http://it.altervista.org/crea-blog-gratis.php?ref=socialring" 51 63 52 #: admin/admin.php: 4764 #: admin/admin.php:237 53 65 msgid "Create your free blog!" 54 66 msgstr "Crea il tuo blog gratis!" 55 67 56 #: admin/admin.php:70 57 #: includes/library.php:203 58 msgid "en_US" 59 msgstr "it_IT" 60 61 #: admin/admin.php:90 68 #: admin/admin.php:266 62 69 msgid "General Settings" 63 70 msgstr "Impostazioni Generali" 64 71 65 #: admin/admin.php: 9672 #: admin/admin.php:272 66 73 msgid "Buttons" 67 74 msgstr "Pulsanti" 68 75 69 #: admin/admin.php: 10376 #: admin/admin.php:279 70 77 msgid "Position" 71 78 msgstr "Posizione" 72 79 73 #: admin/admin.php: 11080 #: admin/admin.php:286 74 81 msgid "Show on" 75 82 msgstr "Mostra su" 76 83 77 #: admin/admin.php:119 78 msgid "Choose Social Ring position and behavior" 84 #: admin/admin.php:293 85 msgid "Counter" 86 msgstr "Contatore" 87 88 #: admin/admin.php:300 89 msgid "Buttons Language" 90 msgstr "Lingua dei Bottoni" 91 92 #: admin/admin.php:309 93 msgid "Choose sharing buttons position and behavior" 79 94 msgstr "Scegli la posizione e il comportamento dei pulsanti di condivisione sui social network" 80 95 81 #: admin/admin.php:133 96 #: admin/admin.php:317 97 msgid "Horizontal" 98 msgstr "Orizzontale" 99 100 #: admin/admin.php:321 101 msgid "Vertical" 102 msgstr "Verticale" 103 104 #: admin/admin.php:325 105 msgid "None" 106 msgstr "Nessuno" 107 108 #: admin/admin.php:335 82 109 msgid "Before content" 83 110 msgstr "Prima del contenuto" 84 111 85 #: admin/admin.php: 137112 #: admin/admin.php:339 86 113 msgid "After content" 87 114 msgstr "Dopo il contenuto" 88 115 89 #: admin/admin.php: 152116 #: admin/admin.php:350 90 117 msgid "Facebook Like" 91 118 msgstr "Facebook Mi Piace" 92 119 93 #: admin/admin.php: 157120 #: admin/admin.php:355 94 121 msgid "Facebook Send" 95 122 msgstr "Facebook Invia" 96 123 97 #: admin/admin.php: 163124 #: admin/admin.php:361 98 125 msgid "Facebook Share" 99 126 msgstr "Facebook Condividi" 100 127 101 #: admin/admin.php: 168128 #: admin/admin.php:366 102 129 msgid "Twitter" 103 130 msgstr "Twitter" 104 131 105 #: admin/admin.php: 169132 #: admin/admin.php:367 106 133 msgid "I use WordPress Social Ring on my blog" 107 134 msgstr "Io uso WordPress Social Ring sul mio blog" 108 135 109 #: admin/admin.php: 173136 #: admin/admin.php:371 110 137 msgid "Google +1" 111 138 msgstr "Google +1" 112 139 113 #: admin/admin.php: 174114 #: admin/admin.php: 186140 #: admin/admin.php:372 141 #: admin/admin.php:384 115 142 msgid "http://wordpress.altervista.org/" 116 143 msgstr "http://wordpress.altervista.org/" 117 144 118 #: admin/admin.php: 179145 #: admin/admin.php:377 119 146 msgid "LinkedIn" 120 147 msgstr "LinkedIn" 121 148 122 #: admin/admin.php: 185149 #: admin/admin.php:383 123 150 msgid "Pin it" 124 151 msgstr "Pin it" 125 152 126 #: admin/admin.php: 186153 #: admin/admin.php:384 127 154 msgid "WordPress tutorials, plugin and themes." 128 155 msgstr "Tutorial WordPress, temi e plugin." 129 156 130 #: admin/admin.php:202 157 #: admin/admin.php:388 158 msgid "StumbleUpon" 159 msgstr "StumbleUpon" 160 161 #: admin/admin.php:400 131 162 msgid "Home" 132 163 msgstr "Home" 133 164 134 #: admin/admin.php: 206165 #: admin/admin.php:404 135 166 msgid "Pages" 136 167 msgstr "Pagine" 137 168 138 #: admin/admin.php: 210169 #: admin/admin.php:408 139 170 msgid "Posts" 140 171 msgstr "Post" 141 172 142 #: admin/admin.php: 214173 #: admin/admin.php:412 143 174 msgid "Categories" 144 175 msgstr "Categorie" 145 176 146 #: admin/admin.php: 218177 #: admin/admin.php:416 147 178 msgid "Archive" 148 179 msgstr "Archivi" 149 180 150 #: admin/admin.php:256 151 msgid "Social Ring settings" 152 msgstr "Impostazioni Social Ring" 153 154 #: admin/admin.php:256 155 msgid "Social Ring" 156 msgstr "Social Ring" 181 #: admin/admin.php:429 182 msgid "LinkedIn, Pin It and StumbleUpon don't support localization" 183 msgstr "LinkedIn, Pin It e StumbleUpon non supportano la traduzione" 157 184 158 185 #: includes/widgets.php:11 … … 227 254 msgstr "Colore Bordo" 228 255 256 #~ msgid "WordPress Social Ring Settings" 257 #~ msgstr "Impostazioni WordPress Social Ring" 258 259 #~ msgid "en_US" 260 #~ msgstr "it_IT" 261 229 262 #~ msgid "Your free WordPress blog, <b>without space and traffic limits</b>" 230 263 #~ msgstr "" … … 320 353 #~ "WordPress per evitare problemi grafici. Se vuoi, puoi riattivarla." 321 354 322 #~ msgid "none"323 #~ msgstr "nessuno"324 325 355 #~ msgid "AV Optimizer" 326 356 #~ msgstr "AV Optimizer" -
wordpress-social-ring/trunk/readme.txt
r614490 r618456 5 5 Requires at least: 3.3 6 6 Tested up to: 3.4.2 7 Version: 1. 1.98 Stable tag: 1. 1.97 Version: 1.2.0 8 Stable tag: 1.2.0 9 9 10 10 WordPress Social Ring adds sharing buttons for Facebook, Twitter, Google+, Pinteres and LinkedIn. -
wordpress-social-ring/trunk/wp-social-ring.php
r617279 r618456 4 4 Description: Let visitors share posts/pages on Facebook, Twitter and Google+. From admin page you can choose which button display: Facebook Like, Facebook Send, Facebook Share, Google +1 and Twitter. 5 5 Author: Niccolò Tapparo 6 Version: 1. 1.96 Version: 1.2.0 7 7 Author URI: http://wordpress.altervista.org/ 8 8 Plugin URI: http://wordpress.altervista.org/wordpress-social-ring/ … … 27 27 } 28 28 29 add_action('wp_head', 'social_ring_add_css');30 add_filter('the_content', 'social_ring_add_sharing');31 add_action('wp_footer', 'social_ring_add_js');32 add_shortcode('socialring', 'social_ring_shortcode');33 34 29 function social_ring_install() { 35 30 36 if(version_compare(get_bloginfo('version'), '3. 2', '<')) {31 if(version_compare(get_bloginfo('version'), '3.3', '<')) { 37 32 deactivate_plugins(basename(__FILE__)); 38 33 } else { 39 $wp_social_ring_options = array ( 40 'social_facebook_like_button' => 0, 41 'social_facebook_send_button' => 0, 42 'social_facebook_share_button' => 0, 43 'social_twitter_button' => 0, 44 'social_google_button' => 0, 45 'social_pin_it_button' => 0, 46 'social_on_home' => 0, 47 'social_on_pages' => 0, 48 'social_on_posts' => 0, 49 'social_on_category' => 0, 50 'social_on_archive' => 0, 51 'social_before_content' => 0, 52 'social_after_content' => 0, 53 'opengraph' => 0, 54 'social_cross_plugin_compatibility' => 0, 55 ); 34 $wp_social_ring_options = get_option(WP_SOCIAL_RING.'_options'); 35 if(empty($wp_social_ring_options)) { 36 $wp_social_ring_options = array ( 37 'social_facebook_like_button' => 1, 38 'social_facebook_send_button' => 0, 39 'social_facebook_share_button' => 1, 40 'social_twitter_button' => 1, 41 'social_google_button' => 1, 42 'social_pin_it_button' => 1, 43 'social_linkedin_button' => 1, 44 'social_stumble_button' => 0, 45 'social_on_home' => 0, 46 'social_on_pages' => 0, 47 'social_on_posts' => 1, 48 'social_on_category' => 0, 49 'social_on_archive' => 0, 50 'social_before_content' => 1, 51 'social_after_content' => 0, 52 'language' => 'Englsh', 53 'facebook_language' => 'en_US', 54 'google_language' => 'en-US', 55 'twitter_language' => 'en', 56 'button_counter' => 'horizontal' 57 ); 58 } else { 59 if(!isset($wp_social_ring_options['language'])) { 60 $wp_social_ring_options['language'] = 'English'; 61 } 62 if(!isset($wp_social_ring_options['facebook_language'])) { 63 $wp_social_ring_options['facebook_language'] = 'en_US'; 64 } 65 if(!isset($wp_social_ring_options['google_language'])) { 66 $wp_social_ring_options['google_language'] = 'en-US'; 67 } 68 if(!isset($wp_social_ring_options['twitter_language'])) { 69 $wp_social_ring_options['twitter_language'] = 'en'; 70 } 71 if(!isset($wp_social_ring_options['button_counter'])) { 72 $wp_social_ring_options['button_counter'] = 'horizontal'; 73 } 74 } 56 75 update_option(WP_SOCIAL_RING.'_options', $wp_social_ring_options); 57 76 }
Note: See TracChangeset
for help on using the changeset viewer.