Changeset 1043827
- Timestamp:
- 12/13/2014 02:20:34 AM (11 years ago)
- Location:
- wp-ya-share/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
wp-ya-share.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-ya-share/trunk/readme.txt
r851335 r1043827 2 2 3 3 Plugin page: http://andrey.eto-ya.com/wordpress/my-plugins/wp-ya-share 4 Tags: social, share, bookmarks, twitter, facebook, livejournal, vkontakte, widget, post, smo, smm, social media, yandex 4 Tags: social, share, bookmarks, twitter, facebook, livejournal, vkontakte, widget, post, smo, smm, social media, yandex, pinterest 5 5 Requires at least: 2.8.6 6 Tested up to: 3.8.17 Stable tag: 1. 56 Tested up to: 4.0.1 7 Stable tag: 1.6 8 8 Contributors: andreyk 9 9 … … 51 51 == Changelog == 52 52 53 = 1.6 = 54 * API domain changed from unreliable yandex.st to yastatic.net. 55 * Added: sharing to Pinterest. 56 * Removed: sharing to Ya.ru. 57 53 58 = 1.5 = 54 59 * New setting: button style (theme). -
wp-ya-share/trunk/wp-ya-share.php
r851335 r1043827 2 2 /* 3 3 Plugin Name: WP Ya.Share 4 Version: 1. 54 Version: 1.6 5 5 Description: Adds the Yandex 'Share in social networks' block into posts or widget to simplify saving URLs of your blog pages into social networks. 6 6 Requires at least: 2.8.6 7 Tested up to: 3.8.17 Tested up to: 4.0.1 8 8 Plugin URI: http://andrey.eto-ya.com/wordpress/my-plugins/wp-ya-share 9 9 Author: Andrey K. 10 10 Author URI: http://andrey.eto-ya.com/ 11 Stable tag: 1. 511 Stable tag: 1.6 12 12 License: GPL2 13 13 */ … … 46 46 } 47 47 48 $ya_share_default = array(48 $ya_share_default = array( 49 49 'where' => 'content', 50 'list' => array('vkontakte', 'lj', 'facebook', 'twitter', 'odnoklassniki', 'gplus', 'yaru'),50 'list' => array('vkontakte', 'lj', 'facebook', 'twitter', 'odnoklassniki', 'gplus',), 51 51 'popup_list' => array('blogger', 'digg', 'evernote', 'delicious', 'diary', 'friendfeed', 52 'juick', 'liveinternet', 'linkedin', ' moikrug', 'moimir', 'myspace', 'tutby', 'yazakladki', 'surfingbird',),52 'juick', 'liveinternet', 'linkedin', 'pinterest', 'moikrug', 'moimir', 'myspace', 'tutby', 'yazakladki', 'surfingbird'), 53 53 'type' => 'button', 54 54 'align' => 'left', … … 61 61 ); 62 62 63 $ya_share_allowed = array(63 $ya_share_allowed = array( 64 64 'where' => array('content', 'multiple', 'widget', 'selectively'), 65 65 'type' => array('button', 'icon', 'link', 'none'), … … 71 71 ); 72 72 73 $all_services = array('none', 'blogger', 'digg', 'evernote', 'delicious', 'diary', 'facebook', 'friendfeed', 'gplus',74 'juick', 'liveinternet', 'linkedin', 'lj', 'moikrug', 'moimir', 'myspace', 'odnoklassniki', 'twitter', 'tutby',75 'vkontakte', 'ya ru', 'yazakladki', 'surfingbird',);73 $all_services = array('none', 'blogger', 'digg', 'evernote', 'delicious', 'diary', 'facebook', 'friendfeed', 'gplus', 74 'juick', 'liveinternet', 'linkedin', 'lj', 'pinterest', 'moikrug', 'moimir', 'myspace', 'odnoklassniki', 'twitter', 'tutby', 75 'vkontakte', 'yazakladki', 'surfingbird',); 76 76 77 77 foreach( array_keys($ya_share_allowed) as $key ) { … … 80 80 } 81 81 else { 82 $new_ya_share[$key] = $arr[$key];83 } 84 } 85 86 foreach( array( "list","popup_list") as $key ) {82 $new_ya_share[$key] = $arr[$key]; 83 } 84 } 85 86 foreach( array('list', 'popup_list') as $key ) { 87 87 if ( empty($arr[$key]) ) { 88 $new_ya_share[$key] = $ya_share_default[$key];88 $new_ya_share[$key] = $ya_share_default[$key]; 89 89 } 90 90 else { 91 $new_ya_share[$key] = array_intersect((array)$arr[$key], $all_services);91 $new_ya_share[$key] = array_intersect((array)$arr[$key], $all_services); 92 92 } 93 93 if ( in_array('none', $new_ya_share[$key]) ) { … … 96 96 } 97 97 98 $new_ya_share['txt'] = empty($arr['txt'])? '' : htmlspecialchars(trim($arr['txt'], ENT_QUOTES));98 $new_ya_share['txt'] = empty($arr['txt'])? '' : htmlspecialchars(trim($arr['txt'], ENT_QUOTES)); 99 99 $new_ya_share['popup_txt'] = empty($arr['popup_txt'])? '' : htmlspecialchars(trim($arr['popup_txt'], ENT_QUOTES)); 100 100 … … 104 104 function ya_share_out() { 105 105 static $div; 106 global $post; 106 107 if ( !isset($div) ) { 107 108 $div = 0; 108 109 } 109 110 $ya_share= ya_share_sanitize(get_option('ya_share')); 110 111 $link= (in_array($ya_share['where'], array('multiple', 'selectively'))?('link: "' 112 . get_permalink(). '", title: "' . get_the_title() . '",') : ''); 113 $ya_share_div= '<!--WP Ya.share--><div class="wp_ya_share" style="text-align:' . $ya_share['align']. ';"> 111 $link = ''; 112 if ( in_array($ya_share['where'], array('multiple', 'selectively')) ) { 113 $link .= 'link: "' . get_permalink() . '", title: "' . get_the_title() . '",'; 114 } 115 if ( in_array('pinterest', $ya_share['list']) || in_array('pinterest', $ya_share['popup_list']) ) { 116 if (current_theme_supports('post-thumbnails') && ($id = get_post_thumbnail_id()) && ($image = wp_get_attachment_image_src($id, 'full')) ) {} 117 elseif( $images = get_attached_media('image') ) { 118 $image = (array)array_pop($images); 119 $image[0] = $image['guid']; 120 } 121 elseif ( preg_match("/http(\S*?)\.(jpg|jpeg|png|gif)/i", $post->post_content, $image) ) {} 122 else { 123 $image[0] = ''; 124 } 125 $link .= 'serviceSpecific: {pinterest: {image: "'. $image[0] .'"}},'; 126 } 127 128 $ya_share_div = '<!--WP Ya.share--><div class="wp_ya_share" style="text-align:' . $ya_share['align']. ';"> 114 129 <div id="yashare' . (++$div) . '"></div> 115 130 <script type="text/javascript"> 116 131 <!-- 117 Ya.share({132 var yashareInstance' . $div. ' = new Ya.share({ 118 133 element: "yashare' . $div. '", 119 ' . $link. ' 120 l10n: "' . $ya_share['lang']. '", 121 theme: "' . $ya_share['theme']. '", 122 elementStyle: { 123 type: "' . $ya_share['type']. '", ' 124 . ( $ya_share['txt'] ? 'text: "' . $ya_share['txt'] . '",' : '') 125 . ' quickServices: [\'' . implode("', '", $ya_share['list']) . '\'] 126 }, 127 popupStyle: {' . (('Yes'==$ya_share['copy_paste'])?'copyPasteField:true,':'') . ' 128 blocks: {\'' . $ya_share['popup_txt'] . '\': [\'' . implode("', '", $ya_share['popup_list']). '\']} 129 } 130 }); 134 ' . $link . ' 135 l10n: "' . $ya_share['lang'] . '", 136 theme: "' . $ya_share['theme'] . '", 137 elementStyle: { 138 type: "' . $ya_share['type'] . '", ' 139 . ( $ya_share['txt'] ? 'text: "' . $ya_share['txt'] . '",' : '') 140 . ' quickServices: [\'' . implode("', '", $ya_share['list']) . '\'] 141 }, 142 popupStyle: {' . (('Yes'==$ya_share['copy_paste'])?'copyPasteField:true,':'') . ' 143 blocks: {\'' . $ya_share['popup_txt'] . '\': [\'' . implode("', '", $ya_share['popup_list']). '\']} 144 } 145 146 }); 131 147 //--> 132 148 </script></div><!--/WP Ya.share-->'; … … 135 151 136 152 function ya_share_scripts() { 137 wp_enqueue_script('ya-share', '//ya ndex.st/share/share.js');153 wp_enqueue_script('ya-share', '//yastatic.net/share/share.js'); 138 154 } 139 155 … … 190 206 'blogger' => 'Blogger', 'digg' => 'Digg', 'evernote' => 'Evernote', 'delicious' => 'Delicious', 'diary' => 'Diary', 191 207 'facebook' => 'Facebook', 'friendfeed' => 'FriendFeed', 'gplus' => 'Google+', 'juick' => 'Juick', 192 'liveinternet' => 'LiveInternet', 'linkedin' => 'LinkedIn', 'lj' => 'LiveJournal', ' moikrug' => 'MoiKrug',208 'liveinternet' => 'LiveInternet', 'linkedin' => 'LinkedIn', 'lj' => 'LiveJournal', 'pinterest' => 'Pinterest', 'moikrug' => 'MoiKrug', 193 209 'moimir' => 'MoiMir', 'myspace' => 'MySpace', 'odnoklassniki' => 'Odnoklassniki', 'twitter' => 'Twitter', 194 210 'tutby' => 'Tutby', 'vkontakte' => 'VKontakte', 'yaru' => 'Yaru', 'yazakladki' => 'YandexZakladki', … … 294 310 } ?></td> 295 311 </tr> 296 297 312 </table> 298 313
Note: See TracChangeset
for help on using the changeset viewer.