Changeset 3421155
- Timestamp:
- 12/16/2025 02:48:18 PM (4 months ago)
- Location:
- youbehero
- Files:
-
- 4 edited
-
tags/1.2.0/includes/class-you-be-hero.php (modified) (4 diffs)
-
tags/1.2.0/includes/wpbakery-donation-widget.php (modified) (2 diffs)
-
trunk/includes/class-you-be-hero.php (modified) (4 diffs)
-
trunk/includes/wpbakery-donation-widget.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
youbehero/tags/1.2.0/includes/class-you-be-hero.php
r3420113 r3421155 134 134 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-you-be-hero-shortcodes-public.php'; 135 135 136 /**137 * The class responsible for YouBeHero WpBakery Widget138 */139 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wpbakery-donation-widget.php';140 141 136 $this->loader = new You_Be_Hero_Loader(); 142 137 … … 163 158 164 159 add_action( 'plugins_loaded', array( $this, 'ybhd_elementor_compatibility' ) ); 160 add_action( 'plugins_loaded', array( $this, 'ybhd_wpbakery_compatibility' ) ); 165 161 166 162 } … … 177 173 178 174 // Check if Elementor is installed and active 179 if (!did_action('elementor/loaded') || ( isset( $youbehero_data['status'] ) && $youbehero_data['status'] != 'active' ) || !is_plugin_active('youbehero/youbehero.php')) { 175 // Also verify that we have valid data structure (not just cached invalid data) 176 if (!did_action('elementor/loaded') 177 || empty($youbehero_data) 178 || !isset($youbehero_data['status']) 179 || $youbehero_data['status'] != 'active' 180 || !is_plugin_active('youbehero/youbehero.php')) { 180 181 return; // Elementor not active, skip loading 181 182 } … … 189 190 190 191 }); 192 } 193 194 } 195 196 public function ybhd_wpbakery_compatibility() { 197 198 $ybhd_token = get_option( 'ybhd_token' ); 199 200 if ( ! empty( $ybhd_token ) ) { 201 include_once(ABSPATH . 'wp-admin/includes/plugin.php'); 202 203 $youbehero_data = json_decode(get_option('ybhd_dashboard_json'), true); 204 $youbehero_data = $youbehero_data['data'] ?? []; 205 206 // Check if WPBakery is installed and active, and plugin status is active 207 // Also verify that we have valid data structure (not just cached invalid data) 208 if (!class_exists('WPBakeryShortCode') 209 || empty($youbehero_data) 210 || !isset($youbehero_data['status']) 211 || $youbehero_data['status'] != 'active' 212 || !is_plugin_active('youbehero/youbehero.php')) { 213 return; // WPBakery not active or plugin not configured, skip loading 214 } 215 216 // Include and register widget 217 require_once plugin_dir_path(dirname(__FILE__)) . 'includes/wpbakery-donation-widget.php'; 218 add_action( 'vc_before_init', 'ybhd_register_wpbakery_element' ); 191 219 } 192 220 -
youbehero/tags/1.2.0/includes/wpbakery-donation-widget.php
r3420210 r3421155 14 14 * Register the WPBakery element 15 15 */ 16 function y oubehero_register_wpbakery_element() {16 function ybhd_register_wpbakery_element() { 17 17 18 18 vc_map( array( … … 58 58 )); 59 59 } 60 add_action( 'vc_before_init', 'youbehero_register_wpbakery_element' );60 // Registration will be called conditionally from ybhd_wpbakery_compatibility() 61 61 62 62 /** -
youbehero/trunk/includes/class-you-be-hero.php
r3420113 r3421155 134 134 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-you-be-hero-shortcodes-public.php'; 135 135 136 /**137 * The class responsible for YouBeHero WpBakery Widget138 */139 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wpbakery-donation-widget.php';140 141 136 $this->loader = new You_Be_Hero_Loader(); 142 137 … … 163 158 164 159 add_action( 'plugins_loaded', array( $this, 'ybhd_elementor_compatibility' ) ); 160 add_action( 'plugins_loaded', array( $this, 'ybhd_wpbakery_compatibility' ) ); 165 161 166 162 } … … 177 173 178 174 // Check if Elementor is installed and active 179 if (!did_action('elementor/loaded') || ( isset( $youbehero_data['status'] ) && $youbehero_data['status'] != 'active' ) || !is_plugin_active('youbehero/youbehero.php')) { 175 // Also verify that we have valid data structure (not just cached invalid data) 176 if (!did_action('elementor/loaded') 177 || empty($youbehero_data) 178 || !isset($youbehero_data['status']) 179 || $youbehero_data['status'] != 'active' 180 || !is_plugin_active('youbehero/youbehero.php')) { 180 181 return; // Elementor not active, skip loading 181 182 } … … 189 190 190 191 }); 192 } 193 194 } 195 196 public function ybhd_wpbakery_compatibility() { 197 198 $ybhd_token = get_option( 'ybhd_token' ); 199 200 if ( ! empty( $ybhd_token ) ) { 201 include_once(ABSPATH . 'wp-admin/includes/plugin.php'); 202 203 $youbehero_data = json_decode(get_option('ybhd_dashboard_json'), true); 204 $youbehero_data = $youbehero_data['data'] ?? []; 205 206 // Check if WPBakery is installed and active, and plugin status is active 207 // Also verify that we have valid data structure (not just cached invalid data) 208 if (!class_exists('WPBakeryShortCode') 209 || empty($youbehero_data) 210 || !isset($youbehero_data['status']) 211 || $youbehero_data['status'] != 'active' 212 || !is_plugin_active('youbehero/youbehero.php')) { 213 return; // WPBakery not active or plugin not configured, skip loading 214 } 215 216 // Include and register widget 217 require_once plugin_dir_path(dirname(__FILE__)) . 'includes/wpbakery-donation-widget.php'; 218 add_action( 'vc_before_init', 'ybhd_register_wpbakery_element' ); 191 219 } 192 220 -
youbehero/trunk/includes/wpbakery-donation-widget.php
r3420213 r3421155 14 14 * Register the WPBakery element 15 15 */ 16 function y oubehero_register_wpbakery_element() {16 function ybhd_register_wpbakery_element() { 17 17 18 18 vc_map( array( … … 58 58 )); 59 59 } 60 add_action( 'vc_before_init', 'youbehero_register_wpbakery_element' );60 // Registration will be called conditionally from ybhd_wpbakery_compatibility() 61 61 62 62 /**
Note: See TracChangeset
for help on using the changeset viewer.