Changeset 3736727
- Timestamp:
- 10/09/2026 01:20:50 PM (2 weeks ago)
- Location:
- sharethis-reaction-buttons
- Files:
-
- 4 added
- 10 edited
- 1 copied
-
assets/blueprints (added)
-
assets/blueprints/blueprint.json (added)
-
tags/1.3.8 (copied) (copied from sharethis-reaction-buttons/trunk )
-
tags/1.3.8/js/admin.js (modified) (6 diffs)
-
tags/1.3.8/js/demo-mode.js (added)
-
tags/1.3.8/php/class-plugin.php (modified) (2 diffs)
-
tags/1.3.8/php/class-reaction-buttons.php (modified) (1 diff)
-
tags/1.3.8/readme.txt (modified) (2 diffs)
-
tags/1.3.8/sharethis-reaction-buttons.php (modified) (2 diffs)
-
trunk/js/admin.js (modified) (6 diffs)
-
trunk/js/demo-mode.js (added)
-
trunk/php/class-plugin.php (modified) (2 diffs)
-
trunk/php/class-reaction-buttons.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/sharethis-reaction-buttons.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sharethis-reaction-buttons/tags/1.3.8/js/admin.js
r2826768 r3736727 188 188 getConfig: function() { 189 189 var result = null, 190 callExtra = 'secret=' + this.data.secret; 190 callExtra = 'secret=' + this.data.secret, 191 local; 192 193 // Demo sites share one property, so this site's saved config stands in for it. 194 if ( this.data.demo ) { 195 local = this.data.buttonConfig || {}; 196 197 return { 198 'inline-reaction-buttons': local['inline-reaction'], 199 }; 200 } 191 201 192 202 if ( 'undefined' === this.data.secret ) { … … 379 389 380 390 // Submit configurations. 381 $( '.sharethis-wrap form' ).submit( function() { 382 self.loadPreview( 'submit', 'inline-reaction' ); 391 $( '.sharethis-wrap form' ).submit( function( e ) { 392 var form = this, 393 saved = self.loadPreview( 'submit', 'inline-reaction' ); 394 395 // Without the blocking property call, leaving the page could cancel the save. 396 if ( self.data.demo ) { 397 e.preventDefault(); 398 399 $.when( saved ).always( function() { 400 form.submit(); 401 } ); 402 } 383 403 } ); 384 404 … … 422 442 upConfig, 423 443 theData, 444 saved, 424 445 enabled = false, 425 446 button = 'inline-reaction'; … … 532 553 }.bind( this ) ); 533 554 } else { 534 wp.ajax.post( 'set_reaction_button_config', {555 saved = wp.ajax.post( 'set_reaction_button_config', { 535 556 button: button, 536 557 config: config, … … 556 577 } ); 557 578 558 // Send new button status value. 559 $.ajax( { 560 url: 'https://platform-api.sharethis.com/v1.0/property/product', 561 method: 'POST', 562 async: false, 563 contentType: 'application/json; charset=utf-8', 564 data: theData, 565 success: function() { 566 if ( 'turnon' === type || 'turnoff' === type ) { 579 // Demo sites share one property, so changes are only saved to this site. 580 if ( this.data.demo ) { 581 if ( 'turnon' === type || 'turnoff' === type ) { 582 saved.always( function() { 567 583 location.reload(); 584 } ); 585 } 586 } else { 587 // Send new button status value. 588 $.ajax( { 589 url: 'https://platform-api.sharethis.com/v1.0/property/product', 590 method: 'POST', 591 async: false, 592 contentType: 'application/json; charset=utf-8', 593 data: theData, 594 success: function() { 595 if ( 'turnon' === type || 'turnoff' === type ) { 596 location.reload(); 597 } 568 598 } 569 } 570 } );599 } ); 600 } 571 601 } 572 602 } … … 587 617 } 588 618 } ); 619 620 return saved; 589 621 } 590 622 }; -
sharethis-reaction-buttons/tags/1.3.8/php/class-plugin.php
r2826768 r3736727 70 70 $sb_active = in_array( 'sharethis-share-buttons/sharethis-share-buttons.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ); 71 71 72 if ( false === $sb_active && true === is_array( $propertyid ) && array() !== $propertyid ) { 72 if ( self::is_demo_mode() ) { 73 $this->register_demo_assets(); 74 } elseif ( false === $sb_active && true === is_array( $propertyid ) && array() !== $propertyid ) { 73 75 wp_register_script( 74 76 "{$this->assets_prefix}-mu", … … 79 81 ); 80 82 } 83 } 84 85 /** 86 * Register the demo mode front end script. 87 * 88 * Demo sites share one property, so the buttons are drawn from this site's 89 * saved config instead of the config stored on the property. 90 */ 91 private function register_demo_assets() { 92 $config = get_option( 'sharethis_button_config' ); 93 $config = is_array( $config ) && isset( $config['inline-reaction'] ) ? $config['inline-reaction'] : null; 94 95 wp_register_script( 96 "{$this->assets_prefix}-mu-src", 97 '//platform-api.sharethis.com/js/sharethis.js?product=inline-reaction-buttons', 98 null, 99 SHARETHIS_REACTION_BUTTONS_VERSION, 100 false 101 ); 102 wp_register_script( 103 "{$this->assets_prefix}-mu", 104 "{$this->dir_url}js/demo-mode.js", 105 array( "{$this->assets_prefix}-mu-src" ), 106 filemtime( "{$this->dir_path}js/demo-mode.js" ), 107 false 108 ); 109 wp_add_inline_script( 110 "{$this->assets_prefix}-mu", 111 sprintf( 112 'ReactionDemoMode.boot( %s );', 113 wp_json_encode( 114 array( 115 'reaction' => 'true' === get_option( 'sharethis_inline-reaction' ) ? $config : null, 116 ) 117 ) 118 ) 119 ); 120 } 121 122 /** 123 * Helper to check if the plugin is running as a shared demo, such as the 124 * WordPress.org Live Preview. 125 * 126 * Demo sites all point at one property, so config changes stay in the site 127 * and are never written to the property. 128 * 129 * @return bool 130 */ 131 public static function is_demo_mode() { 132 $demo = defined( 'SHARETHIS_DEMO_MODE' ) && SHARETHIS_DEMO_MODE; 133 134 return (bool) apply_filters( 'sharethis_demo_mode', $demo ); 81 135 } 82 136 -
sharethis-reaction-buttons/tags/1.3.8/php/class-reaction-buttons.php
r3513978 r3736727 290 290 'shareButtons' => $share_buttons_exist, 291 291 'nonce' => wp_create_nonce( $this->plugin->meta_prefix ), 292 'demo' => Plugin::is_demo_mode(), 292 293 ) 293 294 ) -
sharethis-reaction-buttons/tags/1.3.8/readme.txt
r3657288 r3736727 7 7 Requires at least: 5.9 8 8 Tested up to: 7.1 9 Stable tag: 1.3. 710 Version: 1.3. 79 Stable tag: 1.3.8 10 Version: 1.3.8 11 11 License: GPLv2 or later 12 12 … … 68 68 69 69 == Changelog == 70 71 = 1.3.8 = 72 * Add a Live Preview on WordPress.org so you can try the plugin in WordPress Playground before installing. 70 73 71 74 = 1.3.7 = -
sharethis-reaction-buttons/tags/1.3.8/sharethis-reaction-buttons.php
r3657288 r3736727 4 4 * Plugin URI: https://www.sharethis.com/platform/reaction-buttons-wordpress/ 5 5 * Description: Integrates the ShareThis Reaction Buttons directly into your website. 6 * Version: 1.3. 76 * Version: 1.3.8 7 7 * Author: ShareThis 8 8 * Author URI: https://sharethis.com/ … … 32 32 if ( ! defined( 'ABSPATH' ) ) exit; 33 33 34 const SHARETHIS_REACTION_BUTTONS_VERSION = '1.3. 7';34 const SHARETHIS_REACTION_BUTTONS_VERSION = '1.3.8'; 35 35 36 36 if ( version_compare( phpversion(), '5.3', '>=' ) ) { -
sharethis-reaction-buttons/trunk/js/admin.js
r2826768 r3736727 188 188 getConfig: function() { 189 189 var result = null, 190 callExtra = 'secret=' + this.data.secret; 190 callExtra = 'secret=' + this.data.secret, 191 local; 192 193 // Demo sites share one property, so this site's saved config stands in for it. 194 if ( this.data.demo ) { 195 local = this.data.buttonConfig || {}; 196 197 return { 198 'inline-reaction-buttons': local['inline-reaction'], 199 }; 200 } 191 201 192 202 if ( 'undefined' === this.data.secret ) { … … 379 389 380 390 // Submit configurations. 381 $( '.sharethis-wrap form' ).submit( function() { 382 self.loadPreview( 'submit', 'inline-reaction' ); 391 $( '.sharethis-wrap form' ).submit( function( e ) { 392 var form = this, 393 saved = self.loadPreview( 'submit', 'inline-reaction' ); 394 395 // Without the blocking property call, leaving the page could cancel the save. 396 if ( self.data.demo ) { 397 e.preventDefault(); 398 399 $.when( saved ).always( function() { 400 form.submit(); 401 } ); 402 } 383 403 } ); 384 404 … … 422 442 upConfig, 423 443 theData, 444 saved, 424 445 enabled = false, 425 446 button = 'inline-reaction'; … … 532 553 }.bind( this ) ); 533 554 } else { 534 wp.ajax.post( 'set_reaction_button_config', {555 saved = wp.ajax.post( 'set_reaction_button_config', { 535 556 button: button, 536 557 config: config, … … 556 577 } ); 557 578 558 // Send new button status value. 559 $.ajax( { 560 url: 'https://platform-api.sharethis.com/v1.0/property/product', 561 method: 'POST', 562 async: false, 563 contentType: 'application/json; charset=utf-8', 564 data: theData, 565 success: function() { 566 if ( 'turnon' === type || 'turnoff' === type ) { 579 // Demo sites share one property, so changes are only saved to this site. 580 if ( this.data.demo ) { 581 if ( 'turnon' === type || 'turnoff' === type ) { 582 saved.always( function() { 567 583 location.reload(); 584 } ); 585 } 586 } else { 587 // Send new button status value. 588 $.ajax( { 589 url: 'https://platform-api.sharethis.com/v1.0/property/product', 590 method: 'POST', 591 async: false, 592 contentType: 'application/json; charset=utf-8', 593 data: theData, 594 success: function() { 595 if ( 'turnon' === type || 'turnoff' === type ) { 596 location.reload(); 597 } 568 598 } 569 } 570 } );599 } ); 600 } 571 601 } 572 602 } … … 587 617 } 588 618 } ); 619 620 return saved; 589 621 } 590 622 }; -
sharethis-reaction-buttons/trunk/php/class-plugin.php
r2826768 r3736727 70 70 $sb_active = in_array( 'sharethis-share-buttons/sharethis-share-buttons.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ); 71 71 72 if ( false === $sb_active && true === is_array( $propertyid ) && array() !== $propertyid ) { 72 if ( self::is_demo_mode() ) { 73 $this->register_demo_assets(); 74 } elseif ( false === $sb_active && true === is_array( $propertyid ) && array() !== $propertyid ) { 73 75 wp_register_script( 74 76 "{$this->assets_prefix}-mu", … … 79 81 ); 80 82 } 83 } 84 85 /** 86 * Register the demo mode front end script. 87 * 88 * Demo sites share one property, so the buttons are drawn from this site's 89 * saved config instead of the config stored on the property. 90 */ 91 private function register_demo_assets() { 92 $config = get_option( 'sharethis_button_config' ); 93 $config = is_array( $config ) && isset( $config['inline-reaction'] ) ? $config['inline-reaction'] : null; 94 95 wp_register_script( 96 "{$this->assets_prefix}-mu-src", 97 '//platform-api.sharethis.com/js/sharethis.js?product=inline-reaction-buttons', 98 null, 99 SHARETHIS_REACTION_BUTTONS_VERSION, 100 false 101 ); 102 wp_register_script( 103 "{$this->assets_prefix}-mu", 104 "{$this->dir_url}js/demo-mode.js", 105 array( "{$this->assets_prefix}-mu-src" ), 106 filemtime( "{$this->dir_path}js/demo-mode.js" ), 107 false 108 ); 109 wp_add_inline_script( 110 "{$this->assets_prefix}-mu", 111 sprintf( 112 'ReactionDemoMode.boot( %s );', 113 wp_json_encode( 114 array( 115 'reaction' => 'true' === get_option( 'sharethis_inline-reaction' ) ? $config : null, 116 ) 117 ) 118 ) 119 ); 120 } 121 122 /** 123 * Helper to check if the plugin is running as a shared demo, such as the 124 * WordPress.org Live Preview. 125 * 126 * Demo sites all point at one property, so config changes stay in the site 127 * and are never written to the property. 128 * 129 * @return bool 130 */ 131 public static function is_demo_mode() { 132 $demo = defined( 'SHARETHIS_DEMO_MODE' ) && SHARETHIS_DEMO_MODE; 133 134 return (bool) apply_filters( 'sharethis_demo_mode', $demo ); 81 135 } 82 136 -
sharethis-reaction-buttons/trunk/php/class-reaction-buttons.php
r3513978 r3736727 290 290 'shareButtons' => $share_buttons_exist, 291 291 'nonce' => wp_create_nonce( $this->plugin->meta_prefix ), 292 'demo' => Plugin::is_demo_mode(), 292 293 ) 293 294 ) -
sharethis-reaction-buttons/trunk/readme.txt
r3657288 r3736727 7 7 Requires at least: 5.9 8 8 Tested up to: 7.1 9 Stable tag: 1.3. 710 Version: 1.3. 79 Stable tag: 1.3.8 10 Version: 1.3.8 11 11 License: GPLv2 or later 12 12 … … 68 68 69 69 == Changelog == 70 71 = 1.3.8 = 72 * Add a Live Preview on WordPress.org so you can try the plugin in WordPress Playground before installing. 70 73 71 74 = 1.3.7 = -
sharethis-reaction-buttons/trunk/sharethis-reaction-buttons.php
r3657288 r3736727 4 4 * Plugin URI: https://www.sharethis.com/platform/reaction-buttons-wordpress/ 5 5 * Description: Integrates the ShareThis Reaction Buttons directly into your website. 6 * Version: 1.3. 76 * Version: 1.3.8 7 7 * Author: ShareThis 8 8 * Author URI: https://sharethis.com/ … … 32 32 if ( ! defined( 'ABSPATH' ) ) exit; 33 33 34 const SHARETHIS_REACTION_BUTTONS_VERSION = '1.3. 7';34 const SHARETHIS_REACTION_BUTTONS_VERSION = '1.3.8'; 35 35 36 36 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)