Changeset 1069464
- Timestamp:
- 01/16/2015 03:11:19 PM (11 years ago)
- Location:
- addthis/tags/4.0.2
- Files:
-
- 6 edited
- 2 copied
-
. (copied) (copied from addthis/trunk) (1 prop)
-
addthis-for-wordpress.php (modified) (7 diffs)
-
addthis-toolbox.php (modified) (3 diffs)
-
addthis_social_widget.php (copied) (copied from addthis/trunk/addthis_social_widget.php) (2 diffs)
-
css/style.css (modified) (2 diffs)
-
includes/addthis_addjs_new.php (modified) (3 diffs)
-
js/addthis-for-wordpress.js (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
addthis/tags/4.0.2
-
Property
svn:ignore
set to
*.mdown
-
Property
svn:ignore
set to
-
addthis/tags/4.0.2/addthis-for-wordpress.php
r1025147 r1069464 74 74 /** Addthis Profile id **/ 75 75 private $_pubid; 76 77 /** Addthis Settings **/ 78 private $_options; 76 79 77 80 /** … … 84 87 public function __construct($upgrade) 85 88 { 89 // Save async load settings via ajax request 90 add_action( 'wp_ajax_at_async_loading', array($this, 'addthisAsyncLoading')); 86 91 $this->_upgrade = $upgrade; 87 92 $this->_getVariables = $_GET; 88 93 $this->_postVariables = $_POST; 89 90 $this->_pubid = self::getPubid(); 94 $this->_options = $this->getSettings(); 95 96 $this->_pubid = (isset($this->_options) 97 && isset($this->_options['profile'])) 98 ? $this->_options['profile'] : null; 91 99 92 100 include_once 'addthis-toolbox.php'; … … 163 171 164 172 if ($this->_checkAddPubid()) { 165 $updateResult = $this->update Pubid($this->_postVariables['pubid']);173 $updateResult = $this->updateSettings($this->_postVariables); 166 174 } 167 175 wp_enqueue_script( … … 183 191 * @return string 184 192 */ 185 public function updatePubid($pubId) 186 { 187 global $addthis_addjs; 188 $addthis_addjs->setProfileId($pubId); 189 $this->_pubid = $pubId; 193 public function updateSettings($settings) 194 { 195 if(isset($settings['pubid'])){ 196 $this->_options['profile'] = $settings['pubid']; 197 } 198 if(isset($settings['async_loading'])){ 199 $this->_options['addthis_asynchronous_loading'] = $settings['async_loading']; 200 } 201 update_option('addthis_settings', $this->_options); 202 $this->_pubid = $this->_options['profile']; 190 203 return "<div class='addthis_updated wrap'>". 191 "AddThis Profile IDupdated successfully!!!".204 "AddThis Profile Settings updated successfully!!!". 192 205 "</div>"; 193 206 } … … 207 220 } 208 221 } 222 223 /** 224 * Get addthis settings array 225 * 226 * @return string 227 */ 228 public function getSettings() 229 { 230 return get_option('addthis_settings'); 231 } 209 232 210 233 /** … … 252 275 253 276 return $successReturn; 277 } 278 279 /** 280 * Check if there is request to update async loading 281 * 282 * @return boolean 283 */ 284 private function _checkAsyncLoading() 285 { 286 $successReturn = isset ($this->_postVariables['async_loading']); 287 288 return $successReturn; 289 } 290 291 public function addthisAsyncLoading() 292 { 293 if ($this->_checkAsyncLoading()) { 294 $updateResult = $this->updateSettings($this->_postVariables); 295 } 296 die; //exit from the ajax request 254 297 } 255 298 … … 466 509 "name='pubid' id='addthis-pubid'/>"; 467 510 $html .= "</div></div>"; 511 468 512 $submitButtonValue = "Confirm and Save"; 469 513 -
addthis/tags/4.0.2/addthis-toolbox.php
r1023701 r1069464 50 50 const AT_ABOVE_POST = "at-above-post"; 51 51 const AT_BELOW_POST = "at-below-post"; 52 const AT_ABOVE_POST_CAT_PAGE = "at-above-post-cat-page"; 53 const AT_BELOW_POST_CAT_PAGE = "at-below-post-cat-page"; 54 const AT_ABOVE_POST_ARCH_PAGE = "at-above-post-arch-page"; 55 const AT_BELOW_POST_ARCH_PAGE = "at-below-post-arch-page"; 52 56 const AT_CONTENT_BELOW_POST_HOME = "at-below-post-homepage-recommended"; 53 57 const AT_CONTENT_BELOW_POST_PAGE = "at-below-post-page-recommended"; 54 58 const AT_CONTENT_BELOW_POST = "at-below-post-recommended"; 59 const AT_CONTENT_BELOW_CAT_PAGE = "at-below-post-cat-page-recommended"; 60 const AT_CONTENT_BELOW_ARCH_PAGE = "at-below-post-arch-page-recommended"; 55 61 const AT_CONTENT_ABOVE_POST_HOME = "at-above-post-homepage-recommended"; 56 62 const AT_CONTENT_ABOVE_POST_PAGE = "at-above-post-page-recommended"; 57 63 const AT_CONTENT_ABOVE_POST = "at-above-post-recommended"; 64 const AT_CONTENT_ABOVE_CAT_PAGE = "at-above-post-cat-page-recommended"; 65 const AT_CONTENT_ABOVE_ARCH_PAGE = "at-above-post-arch-page-recommended"; 58 66 59 67 /** … … 79 87 public function addWidget($content) 80 88 { 81 if (Addthis_Wordpress::getPubid()) { 89 if (Addthis_Wordpress::getPubid() && !is_404()) { 90 global $post; 91 $postid = $post->ID; 92 $at_flag = get_post_meta( $postid, '_at_widget', TRUE ); 82 93 if (is_home() || is_front_page()) { 83 $content = self::_buildDiv(self::AT_ABOVE_POST_HOME) . 84 self::_buildDiv(self::AT_CONTENT_ABOVE_POST_HOME) . 85 $content; 86 $content .= self::_buildDiv(self::AT_BELOW_POST_HOME); 87 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_HOME); 94 if($at_flag == '' || $at_flag == '1'){ 95 $content = self::_buildDiv(self::AT_ABOVE_POST_HOME) . 96 self::_buildDiv(self::AT_CONTENT_ABOVE_POST_HOME) . 97 $content; 98 $content .= self::_buildDiv(self::AT_BELOW_POST_HOME); 99 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_HOME); 100 } 88 101 } else if (is_page()) { 89 $content = self::_buildDiv(self::AT_ABOVE_POST_PAGE) . 90 self::_buildDiv(self::AT_CONTENT_ABOVE_POST_PAGE) . 91 $content; 92 $content .= self::_buildDiv(self::AT_BELOW_POST_PAGE); 93 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_PAGE); 102 if($at_flag == '' || $at_flag == '1'){ 103 $content = self::_buildDiv(self::AT_ABOVE_POST_PAGE) . 104 self::_buildDiv(self::AT_CONTENT_ABOVE_POST_PAGE) . 105 $content; 106 $content .= self::_buildDiv(self::AT_BELOW_POST_PAGE); 107 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_PAGE); 108 } 94 109 } else if (is_single()) { 95 $content = self::_buildDiv(self::AT_ABOVE_POST) . 96 self::_buildDiv(self::AT_CONTENT_ABOVE_POST) . 97 $content; 98 $content .= self::_buildDiv(self::AT_BELOW_POST); 99 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST); 100 } 110 if($at_flag == '' || $at_flag == '1'){ 111 $content = self::_buildDiv(self::AT_ABOVE_POST) . 112 self::_buildDiv(self::AT_CONTENT_ABOVE_POST) . 113 $content; 114 $content .= self::_buildDiv(self::AT_BELOW_POST); 115 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST); 116 } 117 } else if (is_category()) { 118 if($at_flag == '' || $at_flag == '1'){ 119 $content = self::_buildDiv(self::AT_ABOVE_POST_CAT_PAGE) . 120 self::_buildDiv(self::AT_CONTENT_ABOVE_CAT_PAGE) . 121 $content; 122 $content .= self::_buildDiv(self::AT_BELOW_POST_CAT_PAGE); 123 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_CAT_PAGE); 124 } 125 } else if (is_archive()) { 126 if($at_flag == '' || $at_flag == '1'){ 127 $content = self::_buildDiv(self::AT_ABOVE_POST_ARCH_PAGE) . 128 self::_buildDiv(self::AT_CONTENT_ABOVE_ARCH_PAGE) . 129 $content; 130 $content .= self::_buildDiv(self::AT_BELOW_POST_ARCH_PAGE); 131 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_ARCH_PAGE); 132 } 133 } 101 134 } 102 135 … … 115 148 $title = get_the_title(); 116 149 $url = get_permalink(); 117 return "<div class='".$class." addthis-toolbox '".150 return "<div class='".$class." addthis-toolbox at-wordpress-hide'". 118 151 " data-title='".$title."' data-url='".$url."'>". 119 152 "</div>"; -
addthis/tags/4.0.2/addthis_social_widget.php
r1025150 r1069464 24 24 * Plugin URI: http://www.addthis.com 25 25 * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow. 26 * Version: 4.0. 126 * Version: 4.0.2 27 27 * 28 28 * Author: The AddThis Team … … 33 33 34 34 define( 'addthis_style_default' , 'fb_tw_p1_sc'); 35 define( 'ADDTHIS_PLUGIN_VERSION' , '4.0 ');36 define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-4.0 ');35 define( 'ADDTHIS_PLUGIN_VERSION' , '4.0.2'); 36 define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-4.0.2'); 37 37 define( 'ADDTHIS_ATVERSION', '300'); 38 38 define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1); -
addthis/tags/4.0.2/css/style.css
r1010585 r1069464 229 229 padding: 3px; 230 230 text-align: center; 231 width: 1 55px;231 width: 160px; 232 232 text-decoration: none; 233 233 font-size: inherit; … … 249 249 font-size: 12px; 250 250 } 251 252 .addthis_async { 253 border: 0px solid gray; 254 width: 180px; 255 } 256 257 .hide { 258 visibility: hidden; 259 } -
addthis/tags/4.0.2/includes/addthis_addjs_new.php
r1010585 r1069464 64 64 add_action('init', array($this, 'maybe_add_footer_comment')); 65 65 66 // for adding option for show/hide addthis sharing button in admin post add/edit page. 67 add_action('admin_init', array($this, 'register_post_at_flag')); 68 69 // for saving custom field value for show/hide addthis sharing button in admin post add/edit page. 70 add_action('save_post', array($this, 'save_at_flag')); 66 71 67 72 // Footer … … 152 157 153 158 function addWidgetToJs(){ 154 $addthis_settings_options = get_option('addthis_settings');155 $addthis_asynchronous_loading = (isset($addthis_settings_options['addthis_asynchronous_loading']))?$addthis_settings_options['addthis_asynchronous_loading']:false;156 if(isset($addthis_asynchronous_loading) && $addthis_asynchronous_loading) {157 $ this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'&async=1"></script>';158 //$this->jsToAdd .= '<script type="text/javascript" src="http://cache-dev.addthis.com/cachefly/js/300/addthis_widget.js&async=1"></script>';159 if (!is_404()) { 160 //Load addthis script only if the page is not 404 161 $addthis_settings_options = get_option('addthis_settings'); 162 $addthis_asynchronous_loading = (isset($addthis_settings_options['addthis_asynchronous_loading']))?$addthis_settings_options['addthis_asynchronous_loading']:false; 163 $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'" async="async"></script>'; 159 164 $this->jsToAdd .= '<script type="text/javascript">jQuery(document).ready(function($) { addthis.init(); }); </script>'; 160 } else {161 //$this->jsToAdd .= '<script type="text/javascript" src="http://cache-dev.addthis.com/cachefly/js/300/addthis_widget.js#pubid='. urlencode( $this->pubid ).'"></script>';162 $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'"></script>';163 165 } 164 166 } … … 193 195 return null; 194 196 } 197 198 /* 199 * Function to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page. 200 */ 201 public function register_post_at_flag() { 202 add_meta_box('at_widget', __('AddThis For Wordpress'), array($this, 'add_at_flag_meta_box'), 'post', 'advanced', 'high'); 203 add_meta_box('at_widget', __('AddThis For Wordpress'), array($this, 'add_at_flag_meta_box'), 'page', 'advanced', 'high'); 204 } 205 /* 206 * Function to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page. 207 */ 208 public function add_at_flag_meta_box($post){ 209 $at_flag = get_post_meta($post->ID, '_at_widget', true); 210 echo "<label for='_at_widget'>".__('Show AddThis Sharing buttons: ', 'foobar')."</label>"; 211 if($at_flag == '' || $at_flag == '1'){ 212 echo "<input type='checkbox' name='_at_widget' id='at_widget' value='1' checked='checked'/>"; 213 } else if($at_flag == '0'){ 214 echo "<input type='checkbox' name='_at_widget' id='at_widget' value='1'/>"; 215 } 216 } 217 /* 218 * Function to save the value of checkbox to show/hide Addthis sharing buttons in admin post add/edit page. 219 */ 220 function save_at_flag(){ 221 global $post; 222 if(isset($_POST['_at_widget'])) 223 update_post_meta($post->ID, '_at_widget', $_POST['_at_widget']); 224 else 225 update_post_meta($post->ID, '_at_widget', '0'); 226 } 195 227 } -
addthis/tags/4.0.2/js/addthis-for-wordpress.js
r1010585 r1069464 24 24 } 25 25 }); 26 27 jQuery('#async_load').change(function(){ 28 29 var syncLoad = jQuery(this).is(':checked')?1:0; 30 var data = { 31 action: "at_async_loading", 32 async_loading: syncLoad 33 }; 34 jQuery('.at-loader').css('visibility', 'visible'); 35 jQuery.post(ajaxurl, data, function(response){ 36 jQuery('.at-loader').css('visibility', 'hidden'); 37 }); 38 }); 26 39 }); -
addthis/tags/4.0.2/readme.txt
r1025147 r1069464 3 3 Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools 4 4 Requires at least: 3.0 5 Tested up to: 4. 06 Stable tag: 4.0. 15 Tested up to: 4.1 6 Stable tag: 4.0.2 7 7 8 8 AddThis provides the best sharing, social, recommended content, and conversion tools to help you make … … 82 82 83 83 == Changelog == 84 85 = 4.0.2 = 86 * Control inline share buttons for each page/post 87 * Bug fixes 84 88 85 89 = 4.0.1 = … … 276 280 277 281 == Upgrade Notice == 282 283 = 4.0.2 = 284 * Control inline share buttons for each page/post 285 * Bug fixes 286 278 287 = 4.0.1 = 279 288 * Fix for automatically converting profile types to Wordpress type.
Note: See TracChangeset
for help on using the changeset viewer.