Changeset 3255883
- Timestamp:
- 03/14/2025 12:11:56 PM (13 months ago)
- Location:
- share-one/trunk
- Files:
-
- 2 added
- 6 edited
-
build/index.asset.php (modified) (1 diff)
-
build/index.js (modified) (1 diff)
-
inline-catch-elementor-widget.php (added)
-
package-lock.json (added)
-
package.json (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
share-one.php (modified) (6 diffs)
-
src/index.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
share-one/trunk/build/index.asset.php
r3157916 r3255883 1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks'), 'version' => ' 6c2e18a49c2bc1d29a01');1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks'), 'version' => '1699766586bc711261c5'); -
share-one/trunk/build/index.js
r3157916 r3255883 1 (()=>{"use strict";const e=window.wp.blocks, o=window.wp.blockEditor,s=window.ReactJSXRuntime;(0,e.registerBlockType)("share-one/wall-of-love",{title:"Share.one - Wall of Love",icon:"heart",category:"widgets",edit(){const e=Math.random().toString(36).substring(7),{serverUrl:i,uuid:r}=shareOneData;return setTimeout((()=>{const o=`${i}/walloflove/${r}.js?div_id=${e}`,s=document.createElement("script");s.src=o,s.defer=!0,document.body.appendChild(s)}),1e3),(0,s.jsx)("div",{...(0,o.useBlockProps)(),children:r?(0,s.jsx)("p",{id:e}):(0,s.jsx)("p",{children:(0,s.jsx)("em",{children:"No UUID defined in Share.one settings."})})})},save:()=>(0,s.jsx)("div",{...o.useBlockProps.save(),children:(0,s.jsx)("p",{children:"[share_one_wall_of_love]"})})})})();1 (()=>{"use strict";const e=window.wp.blocks,i=window.wp.blockEditor,t=window.ReactJSXRuntime;(0,e.registerBlockType)("share-one/wall-of-love",{title:"Share.one - Wall of Love",icon:"heart",category:"widgets",edit(){const e=Math.random().toString(36).substring(7),{serverUrl:s,uuid:r}=shareOneData;return setTimeout((()=>{const i=`${s}/walloflove/${r}.js?div_id=${e}`,t=document.createElement("script");t.src=i,t.defer=!0,document.body.appendChild(t)}),1e3),(0,t.jsx)("div",{...(0,i.useBlockProps)(),children:r?(0,t.jsx)("p",{id:e}):(0,t.jsx)("p",{children:(0,t.jsx)("em",{children:"No UUID defined in Share.one settings."})})})},save:()=>(0,t.jsx)("div",{...i.useBlockProps.save(),children:(0,t.jsx)("p",{children:"[share_one_wall_of_love]"})})}),(0,e.registerBlockType)("share-one/catch-widget",{title:"Share.one - Inline Catch widget",icon:"heart",category:"widgets",edit(){const e=Math.random().toString(36).substring(7),{serverUrl:s,uuid:r}=shareOneData;return setTimeout((()=>{const i=`${s}/inline-widget/${r}.js?div_id=${e}`,t=document.createElement("script");t.src=i,t.defer=!0,document.body.appendChild(t)}),1e3),(0,t.jsx)("div",{...(0,i.useBlockProps)(),children:r?(0,t.jsx)("p",{id:e}):(0,t.jsx)("p",{children:(0,t.jsx)("em",{children:"No UUID defined in Share.one settings."})})})},save:()=>(0,t.jsx)("div",{...i.useBlockProps.save(),children:(0,t.jsx)("p",{children:"[share_one_catch_widget]"})})})})(); -
share-one/trunk/package.json
r3157916 r3255883 1 1 { 2 2 "name": "share-one", 3 "version": "1. 0.0",4 "main": " index.js",3 "version": "1.1.0", 4 "main": "build/index.js", 5 5 "scripts": { 6 6 "build": "wp-scripts build", -
share-one/trunk/readme.txt
r3157916 r3255883 3 3 Requires at least: 6.0 4 4 Tested up to: 6.6.1 5 Stable tag: 1. 0.15 Stable tag: 1.1.0 6 6 Requires PHP: 8.0 7 7 License: GPLv3 or later … … 21 21 == Changelog == 22 22 23 = 1.1.0 = 24 25 * New: Added support to render the inline Catch widget. 26 23 27 = 1.0.1 = 24 28 -
share-one/trunk/share-one.php
r3157916 r3255883 3 3 Plugin Name: Share.one 4 4 Description: Show professional video testimonials by Share.one in an easy way 5 Version: 1. 0.15 Version: 1.1.0 6 6 Author: Share.one 7 7 Author URI: https://www.share.one/ … … 13 13 } 14 14 15 const SHARE_ONE_PLUGIN_VERSION = '1. 0.1';15 const SHARE_ONE_PLUGIN_VERSION = '1.1.0'; 16 16 17 17 // Define the option name for the UUID and script toggle … … 95 95 96 96 <div class="share-one-setting"> 97 <label>Inline catch widget</label> 98 <p> 99 After saving your settings, you can use the following shortcode to render an inline catch widget in the contents of 100 any page or post in your website: 101 </p> 102 <code>[share_one_catch_widget]</code> 103 <p> 104 You can also use the Share.one Inline CATCH Gutenberg block to add the it to your 105 pages and posts. 106 </p> 107 </div> 108 109 <div class="share-one-setting"> 97 110 <label>Wall of Love</label> 98 111 <p> … … 149 162 add_shortcode( 'share_one_wall_of_love', 'share_one_render_wall_of_love_shortcode' ); 150 163 164 // Shortcode to render the Wall of Love JS snippet 165 function share_one_render_catch_widget_shortcode() { 166 $uuid = esc_attr( get_option( SHARE_ONE_OPTION_UUID ) ); 167 $catch_server = esc_attr( get_option( SHARE_ONE_OPTION_CATCH_SERVER ) ); 168 169 $div_id = uniqid('share-one-inline-catch-', true); 170 171 if ( $uuid ) { 172 wp_enqueue_script( $div_id, $catch_server . '/inline-widget/' . $uuid . '.js?div_id=' . $div_id, array(), SHARE_ONE_PLUGIN_VERSION, array( 'strategy' => 'defer' ) ); 173 return "<div id='" . $div_id . "'></div>"; 174 } 175 176 return ''; 177 } 178 179 add_shortcode( 'share_one_catch_widget', 'share_one_render_catch_widget_shortcode' ); 180 181 151 182 // Register Gutenberg block 152 function share_one_register_gutenberg_block () {183 function share_one_register_gutenberg_blocks() { 153 184 // Automatically load dependencies and version 154 185 $asset_file = include( plugin_dir_path( __FILE__ ) . 'build/index.asset.php' ); 155 186 156 187 wp_register_script( 157 'share-one- wall-of-love-block',188 'share-one-blocks', 158 189 plugins_url( 'build/index.js', __FILE__ ), 159 190 $asset_file['dependencies'], … … 167 198 168 199 // Pass the UUID to the block script 169 wp_localize_script( 'share-one- wall-of-love-block', 'shareOneData', array(200 wp_localize_script( 'share-one-blocks', 'shareOneData', array( 170 201 'serverUrl' => $server_url, 171 202 'uuid' => $uuid, … … 173 204 174 205 register_block_type( 'share-one/wall-of-love', array( 175 'editor_script' => 'share-one- wall-of-love-block',206 'editor_script' => 'share-one-blocks', 176 207 ) ); 177 } 178 179 add_action( 'init', 'share_one_register_gutenberg_block' ); 180 181 // Include the Elementor widget file 182 include_once plugin_dir_path( __FILE__ ) . 'wall-of-love-elementor-widget.php'; 208 209 register_block_type( 'share-one/catch-widget', array( 210 'editor_script' => 'share-one-blocks', 211 ) ); 212 213 } 214 add_action( 'init', 'share_one_register_gutenberg_blocks' ); 183 215 184 216 function share_one_register_elementor_widget() { 217 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Share_One_Inline_Catch_Widget() ); 185 218 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Share_One_Wall_of_Love_Widget() ); 186 219 } 187 220 188 add_action( 'elementor/widgets/widgets_registered', 'share_one_register_elementor_widget' ); 189 221 // If Elementor class exists 222 if ( class_exists( '\Elementor\Widget_Base' ) ) { 223 // Include the Elementor widget file 224 include_once plugin_dir_path( __FILE__ ) . 'inline-catch-elementor-widget.php'; 225 226 // Include the Elementor widget file 227 include_once plugin_dir_path( __FILE__ ) . 'wall-of-love-elementor-widget.php'; 228 229 add_action( 'elementor/widgets/widgets_registered', 'share_one_register_elementor_widget' ); 230 } 231 232 -
share-one/trunk/src/index.js
r3157916 r3255883 35 35 }, 36 36 }); 37 38 registerBlockType('share-one/catch-widget', { 39 title: 'Share.one - Inline Catch widget', 40 icon: 'heart', 41 category: 'widgets', 42 edit() { 43 const randomId = Math.random().toString(36).substring(7); 44 const { serverUrl, uuid } = shareOneData; 45 setTimeout(() => { 46 const widget_js_url = `${serverUrl}/inline-widget/${uuid}.js?div_id=${randomId}`; 47 const script = document.createElement('script'); 48 script.src = widget_js_url; 49 script.defer = true; 50 document.body.appendChild(script); 51 }, 1000); 52 53 return ( 54 <div {...useBlockProps()}> 55 {uuid ? ( 56 <p id={randomId}></p> 57 ) : ( 58 <p><em>No UUID defined in Share.one settings.</em></p> 59 )} 60 </div> 61 ); 62 }, 63 save() { 64 return ( 65 <div {...useBlockProps.save()}> 66 <p>[share_one_catch_widget]</p> 67 </div> 68 ); 69 }, 70 });
Note: See TracChangeset
for help on using the changeset viewer.