Changeset 3733014
- Timestamp:
- 10/07/2026 04:46:55 PM (3 weeks ago)
- Location:
- sharethis-share-buttons
- Files:
-
- 4 added
- 10 edited
- 1 copied
-
assets/blueprints (added)
-
assets/blueprints/blueprint.json (added)
-
tags/2.3.13 (copied) (copied from sharethis-share-buttons/trunk )
-
tags/2.3.13/js/admin.js (modified) (6 diffs)
-
tags/2.3.13/js/demo-mode.js (added)
-
tags/2.3.13/php/class-plugin.php (modified) (4 diffs)
-
tags/2.3.13/php/class-share-buttons.php (modified) (1 diff)
-
tags/2.3.13/readme.txt (modified) (2 diffs)
-
tags/2.3.13/sharethis-share-buttons.php (modified) (2 diffs)
-
trunk/js/admin.js (modified) (6 diffs)
-
trunk/js/demo-mode.js (added)
-
trunk/php/class-plugin.php (modified) (4 diffs)
-
trunk/php/class-share-buttons.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/sharethis-share-buttons.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sharethis-share-buttons/tags/2.3.13/js/admin.js
r2981272 r3733014 523 523 nonce: self.data.nonce 524 524 } ).always( function(response) { 525 self.loadPreview( 'submit', 'inline' ); 526 self.loadPreview( 'submit', 'sticky' ); 527 self.loadPreview( 'submit', 'gdpr' ); 528 529 window.location.reload(); 525 var save = function( buttonCode ) { 526 var done = $.Deferred(); 527 528 $.when( self.loadPreview( 'submit', buttonCode ) ).always( done.resolve ); 529 530 return done.promise(); 531 }; 532 533 save( 'inline' ).then( function() { 534 return save( 'sticky' ); 535 } ).then( function() { 536 return save( 'gdpr' ); 537 } ).then( function() { 538 window.location.reload(); 539 } ); 530 540 } ); 531 541 … … 659 669 getConfig: function() { 660 670 var result = null, 661 callExtra = 'secret=' + this.data.secret; 671 callExtra = 'secret=' + this.data.secret, 672 local; 673 674 if ( this.data.demo ) { 675 local = this.data.buttonConfig || {}; 676 677 return { 678 'inline-share-buttons': local.inline, 679 'sticky-share-buttons': local.sticky, 680 'gdpr-compliance-tool-v2': local.gdpr, 681 }; 682 } 662 683 663 684 if ( 'undefined' === this.data.secret || undefined === this.data.secret ) { … … 754 775 upConfig, 755 776 theData, 777 saved, 756 778 enabled = false, 757 779 buttonCode = button.toLowerCase(); … … 981 1003 }.bind( this ) ); 982 1004 } else { 983 wp.ajax.post( 'set_button_config', {1005 saved = wp.ajax.post( 'set_button_config', { 984 1006 button: buttonCode, 985 1007 config: config, … … 1028 1050 theData = JSON.stringify( theData ); 1029 1051 1030 // Send new button status value. 1031 $.ajax( { 1032 url: 'https://platform-api.sharethis.com/v1.0/property/product', 1033 method: 'POST', 1034 async: false, 1035 contentType: 'application/json; charset=utf-8', 1036 data: theData, 1037 success: function () { 1038 if ( 'turnon' === type || 'turnoff' === type ) { 1052 // Demo sites share one property, so changes are only saved to this site. 1053 if ( this.data.demo ) { 1054 if ( 'turnon' === type || 'turnoff' === type ) { 1055 saved.always( function() { 1039 1056 location.reload(); 1057 } ); 1058 } 1059 } else { 1060 // Send new button status value. 1061 $.ajax( { 1062 url: 'https://platform-api.sharethis.com/v1.0/property/product', 1063 method: 'POST', 1064 async: false, 1065 contentType: 'application/json; charset=utf-8', 1066 data: theData, 1067 success: function () { 1068 if ( 'turnon' === type || 'turnoff' === type ) { 1069 location.reload(); 1070 } 1040 1071 } 1041 } 1042 } );1072 } ); 1073 } 1043 1074 } 1044 1075 } … … 1085 1116 } 1086 1117 } ); 1118 1119 return saved; 1087 1120 }, 1088 1121 -
sharethis-share-buttons/tags/2.3.13/php/class-plugin.php
r3656993 r3733014 46 46 $first_prod = false !== $first_prod && null !== $first_prod ? $first_prod : ''; 47 47 48 if ( is_array( $propertyid ) && array() !== $propertyid ) { 48 if ( self::isDemoMode() ) { 49 $this->register_demo_assets(); 50 } elseif ( is_array( $propertyid ) && array() !== $propertyid ) { 49 51 wp_register_script( 50 52 ASSET_PREFIX . '-mu', … … 66 68 67 69 /** 70 * Register the demo mode front end script. 71 * 72 * Demo sites share one property, so the buttons are drawn from this site's 73 * saved config instead of the config stored on the property. 74 */ 75 private function register_demo_assets() { 76 $config = get_option( 'sharethis_button_config', array() ); 77 $config = is_array( $config ) ? $config : array(); 78 79 wp_register_script( 80 ASSET_PREFIX . '-mu-src', 81 self::getPlatformApiUrl() . '/js/sharethis.js?product=inline-share-buttons', 82 array(), 83 SHARETHIS_SHARE_BUTTONS_VERSION, 84 false 85 ); 86 wp_register_script( 87 ASSET_PREFIX . '-mu', 88 DIR_URL . 'js/demo-mode.js', 89 array( ASSET_PREFIX . '-mu-src' ), 90 filemtime( DIR_PATH . 'js/demo-mode.js' ), 91 false 92 ); 93 wp_add_inline_script( 94 ASSET_PREFIX . '-mu', 95 sprintf( 96 'DemoMode.boot( %s );', 97 wp_json_encode( 98 array( 99 'inline' => 'true' === get_option( 'sharethis_inline' ) && isset( $config['inline'] ) ? $config['inline'] : null, 100 'sticky' => 'true' === get_option( 'sharethis_sticky' ) && isset( $config['sticky'] ) ? $config['sticky'] : null, 101 'gdpr' => 'true' === get_option( 'sharethis_gdpr' ) && isset( $config['gdpr'] ) ? $config['gdpr'] : null, 102 ) 103 ) 104 ) 105 ); 106 } 107 108 /** 68 109 * Register admin scripts/styles. 69 110 * … … 73 114 wp_register_script( 74 115 ASSET_PREFIX . '-mua', 75 '//platform-api.sharethis.com/js/sharethis.js?product=inline-share-buttons',116 self::getPlatformApiUrl() . '/js/sharethis.js?product=inline-share-buttons', 76 117 array(), 77 118 SHARETHIS_SHARE_BUTTONS_VERSION, … … 125 166 126 167 /** 168 * Helper to get the host serving sharethis.js. 169 * 170 * Defaults to production. Define SHARETHIS_PLATFORM_API_URL in wp-config.php, 171 * or filter it, to point the buttons at a local platform-api during development. 172 * 173 * @return string 174 */ 175 public static function getPlatformApiUrl() { 176 $url = defined( 'SHARETHIS_PLATFORM_API_URL' ) 177 ? SHARETHIS_PLATFORM_API_URL 178 : 'https://platform-api.sharethis.com'; 179 180 return untrailingslashit( apply_filters( 'sharethis_platform_api_url', $url ) ); 181 } 182 183 /** 184 * Helper to check if the plugin is running as a shared demo, such as the 185 * WordPress.org Live Preview. 186 * 187 * Demo sites all point at one property, so config changes stay in the site 188 * and are never written to the property. 189 * 190 * @return bool 191 */ 192 public static function isDemoMode() { 193 $demo = defined( 'SHARETHIS_DEMO_MODE' ) && SHARETHIS_DEMO_MODE; 194 195 return (bool) apply_filters( 'sharethis_demo_mode', $demo ); 196 } 197 198 /** 127 199 * Helper to get the AI assistant networks. 128 200 * 129 * These open a chat prefilled with a prompt about the page in a new tab, 130 * rather than a share dialog in a popup window. 201 * These open a chat about the page in a new tab rather than a share dialog 202 * in a popup window. Most take the prompt in the URL; Copilot and Gemini 203 * accept none, so sharethis.js copies it to the clipboard for those two. 131 204 * 132 205 * @return array -
sharethis-share-buttons/tags/2.3.13/php/class-share-buttons.php
r3656993 r3733014 464 464 'fresh' => get_option( 'sharethis_fract' ), 465 465 'first' => get_option( 'sharethis_first_product', false ), 466 'demo' => Plugin::isDemoMode(), 466 467 ) 467 468 ) -
sharethis-share-buttons/tags/2.3.13/readme.txt
r3657326 r3733014 7 7 Requires at least: 5.5 8 8 Tested up to: 7.1 9 Stable tag: 2.3.1 210 Version: 2.3.1 29 Stable tag: 2.3.13 10 Version: 2.3.13 11 11 License: GPLv2 or later 12 12 … … 188 188 == Changelog == 189 189 190 = 2.3.13 = 191 * Add a Live Preview on WordPress.org so you can try the plugin in WordPress Playground before installing. 192 190 193 = 2.3.12 = 191 194 * Tested wp 7.1 -
sharethis-share-buttons/tags/2.3.13/sharethis-share-buttons.php
r3657326 r3733014 8 8 * Plugin URI: https://sharethis.com/ 9 9 * Description: Grow your website traffic with share buttons for 40+ social channels including Facebook, LinkedIn, Twitter, WhatsApp, and more. 10 * Version: 2.3.1 210 * Version: 2.3.13 11 11 * Author: ShareThis 12 12 * Author URI: https://sharethis.com/ … … 33 33 * Plugin version constant. 34 34 */ 35 const SHARETHIS_SHARE_BUTTONS_VERSION = '2.3.1 2';35 const SHARETHIS_SHARE_BUTTONS_VERSION = '2.3.13'; 36 36 37 37 if ( version_compare( phpversion(), '5.3', '>=' ) ) { -
sharethis-share-buttons/trunk/js/admin.js
r2981272 r3733014 523 523 nonce: self.data.nonce 524 524 } ).always( function(response) { 525 self.loadPreview( 'submit', 'inline' ); 526 self.loadPreview( 'submit', 'sticky' ); 527 self.loadPreview( 'submit', 'gdpr' ); 528 529 window.location.reload(); 525 var save = function( buttonCode ) { 526 var done = $.Deferred(); 527 528 $.when( self.loadPreview( 'submit', buttonCode ) ).always( done.resolve ); 529 530 return done.promise(); 531 }; 532 533 save( 'inline' ).then( function() { 534 return save( 'sticky' ); 535 } ).then( function() { 536 return save( 'gdpr' ); 537 } ).then( function() { 538 window.location.reload(); 539 } ); 530 540 } ); 531 541 … … 659 669 getConfig: function() { 660 670 var result = null, 661 callExtra = 'secret=' + this.data.secret; 671 callExtra = 'secret=' + this.data.secret, 672 local; 673 674 if ( this.data.demo ) { 675 local = this.data.buttonConfig || {}; 676 677 return { 678 'inline-share-buttons': local.inline, 679 'sticky-share-buttons': local.sticky, 680 'gdpr-compliance-tool-v2': local.gdpr, 681 }; 682 } 662 683 663 684 if ( 'undefined' === this.data.secret || undefined === this.data.secret ) { … … 754 775 upConfig, 755 776 theData, 777 saved, 756 778 enabled = false, 757 779 buttonCode = button.toLowerCase(); … … 981 1003 }.bind( this ) ); 982 1004 } else { 983 wp.ajax.post( 'set_button_config', {1005 saved = wp.ajax.post( 'set_button_config', { 984 1006 button: buttonCode, 985 1007 config: config, … … 1028 1050 theData = JSON.stringify( theData ); 1029 1051 1030 // Send new button status value. 1031 $.ajax( { 1032 url: 'https://platform-api.sharethis.com/v1.0/property/product', 1033 method: 'POST', 1034 async: false, 1035 contentType: 'application/json; charset=utf-8', 1036 data: theData, 1037 success: function () { 1038 if ( 'turnon' === type || 'turnoff' === type ) { 1052 // Demo sites share one property, so changes are only saved to this site. 1053 if ( this.data.demo ) { 1054 if ( 'turnon' === type || 'turnoff' === type ) { 1055 saved.always( function() { 1039 1056 location.reload(); 1057 } ); 1058 } 1059 } else { 1060 // Send new button status value. 1061 $.ajax( { 1062 url: 'https://platform-api.sharethis.com/v1.0/property/product', 1063 method: 'POST', 1064 async: false, 1065 contentType: 'application/json; charset=utf-8', 1066 data: theData, 1067 success: function () { 1068 if ( 'turnon' === type || 'turnoff' === type ) { 1069 location.reload(); 1070 } 1040 1071 } 1041 } 1042 } );1072 } ); 1073 } 1043 1074 } 1044 1075 } … … 1085 1116 } 1086 1117 } ); 1118 1119 return saved; 1087 1120 }, 1088 1121 -
sharethis-share-buttons/trunk/php/class-plugin.php
r3656993 r3733014 46 46 $first_prod = false !== $first_prod && null !== $first_prod ? $first_prod : ''; 47 47 48 if ( is_array( $propertyid ) && array() !== $propertyid ) { 48 if ( self::isDemoMode() ) { 49 $this->register_demo_assets(); 50 } elseif ( is_array( $propertyid ) && array() !== $propertyid ) { 49 51 wp_register_script( 50 52 ASSET_PREFIX . '-mu', … … 66 68 67 69 /** 70 * Register the demo mode front end script. 71 * 72 * Demo sites share one property, so the buttons are drawn from this site's 73 * saved config instead of the config stored on the property. 74 */ 75 private function register_demo_assets() { 76 $config = get_option( 'sharethis_button_config', array() ); 77 $config = is_array( $config ) ? $config : array(); 78 79 wp_register_script( 80 ASSET_PREFIX . '-mu-src', 81 self::getPlatformApiUrl() . '/js/sharethis.js?product=inline-share-buttons', 82 array(), 83 SHARETHIS_SHARE_BUTTONS_VERSION, 84 false 85 ); 86 wp_register_script( 87 ASSET_PREFIX . '-mu', 88 DIR_URL . 'js/demo-mode.js', 89 array( ASSET_PREFIX . '-mu-src' ), 90 filemtime( DIR_PATH . 'js/demo-mode.js' ), 91 false 92 ); 93 wp_add_inline_script( 94 ASSET_PREFIX . '-mu', 95 sprintf( 96 'DemoMode.boot( %s );', 97 wp_json_encode( 98 array( 99 'inline' => 'true' === get_option( 'sharethis_inline' ) && isset( $config['inline'] ) ? $config['inline'] : null, 100 'sticky' => 'true' === get_option( 'sharethis_sticky' ) && isset( $config['sticky'] ) ? $config['sticky'] : null, 101 'gdpr' => 'true' === get_option( 'sharethis_gdpr' ) && isset( $config['gdpr'] ) ? $config['gdpr'] : null, 102 ) 103 ) 104 ) 105 ); 106 } 107 108 /** 68 109 * Register admin scripts/styles. 69 110 * … … 73 114 wp_register_script( 74 115 ASSET_PREFIX . '-mua', 75 '//platform-api.sharethis.com/js/sharethis.js?product=inline-share-buttons',116 self::getPlatformApiUrl() . '/js/sharethis.js?product=inline-share-buttons', 76 117 array(), 77 118 SHARETHIS_SHARE_BUTTONS_VERSION, … … 125 166 126 167 /** 168 * Helper to get the host serving sharethis.js. 169 * 170 * Defaults to production. Define SHARETHIS_PLATFORM_API_URL in wp-config.php, 171 * or filter it, to point the buttons at a local platform-api during development. 172 * 173 * @return string 174 */ 175 public static function getPlatformApiUrl() { 176 $url = defined( 'SHARETHIS_PLATFORM_API_URL' ) 177 ? SHARETHIS_PLATFORM_API_URL 178 : 'https://platform-api.sharethis.com'; 179 180 return untrailingslashit( apply_filters( 'sharethis_platform_api_url', $url ) ); 181 } 182 183 /** 184 * Helper to check if the plugin is running as a shared demo, such as the 185 * WordPress.org Live Preview. 186 * 187 * Demo sites all point at one property, so config changes stay in the site 188 * and are never written to the property. 189 * 190 * @return bool 191 */ 192 public static function isDemoMode() { 193 $demo = defined( 'SHARETHIS_DEMO_MODE' ) && SHARETHIS_DEMO_MODE; 194 195 return (bool) apply_filters( 'sharethis_demo_mode', $demo ); 196 } 197 198 /** 127 199 * Helper to get the AI assistant networks. 128 200 * 129 * These open a chat prefilled with a prompt about the page in a new tab, 130 * rather than a share dialog in a popup window. 201 * These open a chat about the page in a new tab rather than a share dialog 202 * in a popup window. Most take the prompt in the URL; Copilot and Gemini 203 * accept none, so sharethis.js copies it to the clipboard for those two. 131 204 * 132 205 * @return array -
sharethis-share-buttons/trunk/php/class-share-buttons.php
r3656993 r3733014 464 464 'fresh' => get_option( 'sharethis_fract' ), 465 465 'first' => get_option( 'sharethis_first_product', false ), 466 'demo' => Plugin::isDemoMode(), 466 467 ) 467 468 ) -
sharethis-share-buttons/trunk/readme.txt
r3657326 r3733014 7 7 Requires at least: 5.5 8 8 Tested up to: 7.1 9 Stable tag: 2.3.1 210 Version: 2.3.1 29 Stable tag: 2.3.13 10 Version: 2.3.13 11 11 License: GPLv2 or later 12 12 … … 188 188 == Changelog == 189 189 190 = 2.3.13 = 191 * Add a Live Preview on WordPress.org so you can try the plugin in WordPress Playground before installing. 192 190 193 = 2.3.12 = 191 194 * Tested wp 7.1 -
sharethis-share-buttons/trunk/sharethis-share-buttons.php
r3657326 r3733014 8 8 * Plugin URI: https://sharethis.com/ 9 9 * Description: Grow your website traffic with share buttons for 40+ social channels including Facebook, LinkedIn, Twitter, WhatsApp, and more. 10 * Version: 2.3.1 210 * Version: 2.3.13 11 11 * Author: ShareThis 12 12 * Author URI: https://sharethis.com/ … … 33 33 * Plugin version constant. 34 34 */ 35 const SHARETHIS_SHARE_BUTTONS_VERSION = '2.3.1 2';35 const SHARETHIS_SHARE_BUTTONS_VERSION = '2.3.13'; 36 36 37 37 if ( version_compare( phpversion(), '5.3', '>=' ) ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)