Changeset 3450706
- Timestamp:
- 01/30/2026 08:47:51 PM (6 weeks ago)
- Location:
- vectoron
- Files:
-
- 4 edited
- 16 copied
-
tags/2.10.0 (copied) (copied from vectoron/trunk)
-
tags/2.10.0/LICENSE (copied) (copied from vectoron/trunk/LICENSE)
-
tags/2.10.0/css (copied) (copied from vectoron/trunk/css)
-
tags/2.10.0/images (copied) (copied from vectoron/trunk/images)
-
tags/2.10.0/includes (copied) (copied from vectoron/trunk/includes)
-
tags/2.10.0/includes/settings-page.php (copied) (copied from vectoron/trunk/includes/settings-page.php)
-
tags/2.10.0/integrations (copied) (copied from vectoron/trunk/integrations)
-
tags/2.10.0/integrations/beaver-builder.php (copied) (copied from vectoron/trunk/integrations/beaver-builder.php)
-
tags/2.10.0/integrations/divi.php (copied) (copied from vectoron/trunk/integrations/divi.php)
-
tags/2.10.0/integrations/elementor.php (copied) (copied from vectoron/trunk/integrations/elementor.php) (4 diffs)
-
tags/2.10.0/integrations/wp-bakery.php (copied) (copied from vectoron/trunk/integrations/wp-bakery.php)
-
tags/2.10.0/js (copied) (copied from vectoron/trunk/js)
-
tags/2.10.0/languages (copied) (copied from vectoron/trunk/languages)
-
tags/2.10.0/readme.txt (copied) (copied from vectoron/trunk/readme.txt) (2 diffs)
-
tags/2.10.0/vectoron-api.php (copied) (copied from vectoron/trunk/vectoron-api.php) (2 diffs)
-
tags/2.10.0/vectoron.php (copied) (copied from vectoron/trunk/vectoron.php) (1 diff)
-
trunk/integrations/elementor.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vectoron-api.php (modified) (2 diffs)
-
trunk/vectoron.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vectoron/tags/2.10.0/integrations/elementor.php
r3448969 r3450706 56 56 57 57 /** 58 * Check if Elementor containers feature is enabled. 59 * 60 * Containers (introduced in Elementor 3.6) use flexbox-based layout instead of 61 * the legacy section/column structure. This function checks the experiments 62 * system to determine if containers are actually enabled on the site. 63 * 64 * @return bool True if containers are enabled, false otherwise. 65 */ 66 function vectoron_is_elementor_containers_enabled() { 67 if ( ! class_exists( '\Elementor\Plugin' ) ) { 68 return false; 69 } 70 71 if ( ! isset( \Elementor\Plugin::$instance->experiments ) ) { 72 return false; 73 } 74 75 if ( ! method_exists( \Elementor\Plugin::$instance->experiments, 'is_feature_active' ) ) { 76 return false; 77 } 78 79 return \Elementor\Plugin::$instance->experiments->is_feature_active( 'container' ); 80 } 81 82 /** 58 83 * Convert HTML content to Elementor JSON data structure. 59 84 * 60 85 * Elementor stores page content as a nested JSON array in _elementor_data. 61 * Structure: Section -> Column -> Widget (text-editor) 86 * Uses modern container structure (Elementor 3.6+) when enabled, or legacy 87 * section/column structure as fallback. 62 88 * 63 89 * @param string $html_content HTML content to convert. … … 65 91 */ 66 92 function vectoron_html_to_elementor_data( $html_content ) { 93 // Check if containers are enabled on this site using centralized helper. 94 $use_containers = vectoron_is_elementor_containers_enabled(); 95 96 if ( $use_containers ) { 97 // Modern container-based structure (Elementor 3.6+ with containers enabled). 98 // Containers use flexbox and don't need the column wrapper. 99 return array( 100 array( 101 'id' => vectoron_generate_elementor_id(), 102 'elType' => 'container', 103 'isInner' => false, 104 'settings' => array( 105 'content_width' => 'boxed', 106 'boxed_width' => array( 107 'size' => 1140, 108 'unit' => 'px', 109 ), 110 ), 111 'elements' => array( 112 array( 113 'id' => vectoron_generate_elementor_id(), 114 'elType' => 'widget', 115 'widgetType' => 'text-editor', 116 'isInner' => false, 117 'settings' => array( 118 // Wrap content in .vectoron-content div so CSS styles (FAQ accordions, headings, etc.) work. 119 'editor' => '<div class="vectoron-content">' . $html_content . '</div>', 120 ), 121 'elements' => array(), 122 ), 123 ), 124 ), 125 ); 126 } 127 128 // Fallback: Legacy section/column structure for Elementor < 3.6 or containers disabled. 67 129 return array( 68 130 array( … … 214 276 update_post_meta( $post_id, '_elementor_version', ELEMENTOR_VERSION ); 215 277 278 // Set correct template type based on post_type (REQUIRED for proper Elementor rendering). 279 // 'wp-page' for pages, 'wp-post' for posts - validated against Elementor source code. 280 $template_type = ( 'page' === $post->post_type ) ? 'wp-page' : 'wp-post'; 281 update_post_meta( $post_id, '_elementor_template_type', $template_type ); 282 283 // Set WordPress page template for pages (required for Elementor pages). 284 if ( 'page' === $post->post_type ) { 285 update_post_meta( $post_id, '_wp_page_template', 'default' ); 286 } 287 288 // Add Elementor Pro version if installed (some themes/features check this). 289 if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) { 290 update_post_meta( $post_id, '_elementor_pro_version', ELEMENTOR_PRO_VERSION ); 291 } 292 293 // NOTE: We intentionally do NOT set _elementor_page_settings. 294 // This allows each site's default settings (like hide_title) to apply, 295 // respecting the site's existing configuration. 296 216 297 // Clear Elementor CSS cache for this post. 217 298 vectoron_clear_elementor_cache( $post_id ); 218 299 219 vectoron_debug( "[Elementor] Successfully synced post {$post_id}" ); 220 221 } catch ( Exception $e ) { 300 // Determine which layout structure was used for logging (using centralized helper). 301 $layout_type = vectoron_is_elementor_containers_enabled() ? 'container' : 'section/column'; 302 303 vectoron_debug( "[Elementor] Successfully synced post {$post_id} (type: {$template_type}, layout: {$layout_type})" ); 304 305 } catch ( Throwable $e ) { 306 // Use Throwable to catch both Exception and Error (PHP 7+ fatal errors like TypeError). 222 307 vectoron_debug( '[Elementor] Error: ' . $e->getMessage() ); 223 308 } finally { … … 257 342 */ 258 343 function vectoron_add_elementor_to_status( $response ) { 344 $installed = defined( 'ELEMENTOR_VERSION' ) && class_exists( '\Elementor\Plugin' ); 345 $containers_enabled = vectoron_is_elementor_containers_enabled(); 346 259 347 $response['elementor'] = array( 260 'installed' => defined( 'ELEMENTOR_VERSION' ) && class_exists( '\Elementor\Plugin' ), 261 'version' => defined( 'ELEMENTOR_VERSION' ) ? sanitize_text_field( ELEMENTOR_VERSION ) : null, 262 'sync_mode' => get_option( 'vectoron_elementor_sync_mode', 'always' ), 348 'installed' => $installed, 349 'version' => defined( 'ELEMENTOR_VERSION' ) ? sanitize_text_field( ELEMENTOR_VERSION ) : null, 350 'pro_version' => defined( 'ELEMENTOR_PRO_VERSION' ) ? sanitize_text_field( ELEMENTOR_PRO_VERSION ) : null, 351 'containers_enabled' => $containers_enabled, 352 'layout_mode' => $containers_enabled ? 'container' : 'section/column', 353 'sync_mode' => get_option( 'vectoron_elementor_sync_mode', 'always' ), 263 354 ); 264 355 return $response; -
vectoron/tags/2.10.0/readme.txt
r3448969 r3450706 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 2. 9.97 Stable tag: 2.10.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 135 135 136 136 == Changelog == 137 138 = 2.10.0 = 139 * Enhanced Elementor integration with proper metadata and modern container support 140 * Added `_elementor_template_type` meta field (wp-page for pages, wp-post for posts) 141 * Added `_wp_page_template` meta field for pages (required by Elementor) 142 * Added `_elementor_pro_version` meta field when Elementor Pro is installed 143 * Smart container detection: uses modern flexbox containers (Elementor 3.6+) when enabled 144 * Fallback to legacy section/column structure for older Elementor or when containers are disabled 145 * Status endpoint now reports `containers_enabled` and `layout_mode` for debugging 146 * Improved code quality: centralized container detection helper function 137 147 138 148 = 2.9.9 = -
vectoron/tags/2.10.0/vectoron-api.php
r3448212 r3450706 504 504 } 505 505 506 // Set Rank Math SEO metadata if Rank Math is installed 507 if (function_exists('vectoron_set_rankmath_metadata')) { 508 vectoron_set_rankmath_metadata($post_id, array( 509 'meta_description' => $meta_description, 510 'seo_title' => $seo_title, 511 'focus_keyword' => $focus_keyword, 512 )); 513 } 514 506 515 // Add tags if provided 507 516 if ($tags = $request->get_param('tags')) { … … 649 658 if (function_exists('vectoron_set_seopress_metadata')) { 650 659 vectoron_set_seopress_metadata($post_id, array( 660 'meta_description' => $meta_description, 661 'seo_title' => $seo_title, 662 'focus_keyword' => $focus_keyword, 663 )); 664 } 665 666 // Set Rank Math SEO metadata if Rank Math is installed 667 if (function_exists('vectoron_set_rankmath_metadata')) { 668 vectoron_set_rankmath_metadata($post_id, array( 651 669 'meta_description' => $meta_description, 652 670 'seo_title' => $seo_title, -
vectoron/tags/2.10.0/vectoron.php
r3448969 r3450706 3 3 * Plugin Name: Vectoron 4 4 * Description: Provides the [vectoron_article] shortcode to disable wpautop and load assets for custom content like the FAQ accordion and GA4 tracking. Includes REST API endpoints for external content management and ACF integration. 5 * Version: 2. 9.95 * Version: 2.10.0 6 6 * Author: Vectoron 7 7 * Author URI: https://vectoron.ai -
vectoron/trunk/integrations/elementor.php
r3448969 r3450706 56 56 57 57 /** 58 * Check if Elementor containers feature is enabled. 59 * 60 * Containers (introduced in Elementor 3.6) use flexbox-based layout instead of 61 * the legacy section/column structure. This function checks the experiments 62 * system to determine if containers are actually enabled on the site. 63 * 64 * @return bool True if containers are enabled, false otherwise. 65 */ 66 function vectoron_is_elementor_containers_enabled() { 67 if ( ! class_exists( '\Elementor\Plugin' ) ) { 68 return false; 69 } 70 71 if ( ! isset( \Elementor\Plugin::$instance->experiments ) ) { 72 return false; 73 } 74 75 if ( ! method_exists( \Elementor\Plugin::$instance->experiments, 'is_feature_active' ) ) { 76 return false; 77 } 78 79 return \Elementor\Plugin::$instance->experiments->is_feature_active( 'container' ); 80 } 81 82 /** 58 83 * Convert HTML content to Elementor JSON data structure. 59 84 * 60 85 * Elementor stores page content as a nested JSON array in _elementor_data. 61 * Structure: Section -> Column -> Widget (text-editor) 86 * Uses modern container structure (Elementor 3.6+) when enabled, or legacy 87 * section/column structure as fallback. 62 88 * 63 89 * @param string $html_content HTML content to convert. … … 65 91 */ 66 92 function vectoron_html_to_elementor_data( $html_content ) { 93 // Check if containers are enabled on this site using centralized helper. 94 $use_containers = vectoron_is_elementor_containers_enabled(); 95 96 if ( $use_containers ) { 97 // Modern container-based structure (Elementor 3.6+ with containers enabled). 98 // Containers use flexbox and don't need the column wrapper. 99 return array( 100 array( 101 'id' => vectoron_generate_elementor_id(), 102 'elType' => 'container', 103 'isInner' => false, 104 'settings' => array( 105 'content_width' => 'boxed', 106 'boxed_width' => array( 107 'size' => 1140, 108 'unit' => 'px', 109 ), 110 ), 111 'elements' => array( 112 array( 113 'id' => vectoron_generate_elementor_id(), 114 'elType' => 'widget', 115 'widgetType' => 'text-editor', 116 'isInner' => false, 117 'settings' => array( 118 // Wrap content in .vectoron-content div so CSS styles (FAQ accordions, headings, etc.) work. 119 'editor' => '<div class="vectoron-content">' . $html_content . '</div>', 120 ), 121 'elements' => array(), 122 ), 123 ), 124 ), 125 ); 126 } 127 128 // Fallback: Legacy section/column structure for Elementor < 3.6 or containers disabled. 67 129 return array( 68 130 array( … … 214 276 update_post_meta( $post_id, '_elementor_version', ELEMENTOR_VERSION ); 215 277 278 // Set correct template type based on post_type (REQUIRED for proper Elementor rendering). 279 // 'wp-page' for pages, 'wp-post' for posts - validated against Elementor source code. 280 $template_type = ( 'page' === $post->post_type ) ? 'wp-page' : 'wp-post'; 281 update_post_meta( $post_id, '_elementor_template_type', $template_type ); 282 283 // Set WordPress page template for pages (required for Elementor pages). 284 if ( 'page' === $post->post_type ) { 285 update_post_meta( $post_id, '_wp_page_template', 'default' ); 286 } 287 288 // Add Elementor Pro version if installed (some themes/features check this). 289 if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) { 290 update_post_meta( $post_id, '_elementor_pro_version', ELEMENTOR_PRO_VERSION ); 291 } 292 293 // NOTE: We intentionally do NOT set _elementor_page_settings. 294 // This allows each site's default settings (like hide_title) to apply, 295 // respecting the site's existing configuration. 296 216 297 // Clear Elementor CSS cache for this post. 217 298 vectoron_clear_elementor_cache( $post_id ); 218 299 219 vectoron_debug( "[Elementor] Successfully synced post {$post_id}" ); 220 221 } catch ( Exception $e ) { 300 // Determine which layout structure was used for logging (using centralized helper). 301 $layout_type = vectoron_is_elementor_containers_enabled() ? 'container' : 'section/column'; 302 303 vectoron_debug( "[Elementor] Successfully synced post {$post_id} (type: {$template_type}, layout: {$layout_type})" ); 304 305 } catch ( Throwable $e ) { 306 // Use Throwable to catch both Exception and Error (PHP 7+ fatal errors like TypeError). 222 307 vectoron_debug( '[Elementor] Error: ' . $e->getMessage() ); 223 308 } finally { … … 257 342 */ 258 343 function vectoron_add_elementor_to_status( $response ) { 344 $installed = defined( 'ELEMENTOR_VERSION' ) && class_exists( '\Elementor\Plugin' ); 345 $containers_enabled = vectoron_is_elementor_containers_enabled(); 346 259 347 $response['elementor'] = array( 260 'installed' => defined( 'ELEMENTOR_VERSION' ) && class_exists( '\Elementor\Plugin' ), 261 'version' => defined( 'ELEMENTOR_VERSION' ) ? sanitize_text_field( ELEMENTOR_VERSION ) : null, 262 'sync_mode' => get_option( 'vectoron_elementor_sync_mode', 'always' ), 348 'installed' => $installed, 349 'version' => defined( 'ELEMENTOR_VERSION' ) ? sanitize_text_field( ELEMENTOR_VERSION ) : null, 350 'pro_version' => defined( 'ELEMENTOR_PRO_VERSION' ) ? sanitize_text_field( ELEMENTOR_PRO_VERSION ) : null, 351 'containers_enabled' => $containers_enabled, 352 'layout_mode' => $containers_enabled ? 'container' : 'section/column', 353 'sync_mode' => get_option( 'vectoron_elementor_sync_mode', 'always' ), 263 354 ); 264 355 return $response; -
vectoron/trunk/readme.txt
r3448969 r3450706 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 2. 9.97 Stable tag: 2.10.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 135 135 136 136 == Changelog == 137 138 = 2.10.0 = 139 * Enhanced Elementor integration with proper metadata and modern container support 140 * Added `_elementor_template_type` meta field (wp-page for pages, wp-post for posts) 141 * Added `_wp_page_template` meta field for pages (required by Elementor) 142 * Added `_elementor_pro_version` meta field when Elementor Pro is installed 143 * Smart container detection: uses modern flexbox containers (Elementor 3.6+) when enabled 144 * Fallback to legacy section/column structure for older Elementor or when containers are disabled 145 * Status endpoint now reports `containers_enabled` and `layout_mode` for debugging 146 * Improved code quality: centralized container detection helper function 137 147 138 148 = 2.9.9 = -
vectoron/trunk/vectoron-api.php
r3448212 r3450706 504 504 } 505 505 506 // Set Rank Math SEO metadata if Rank Math is installed 507 if (function_exists('vectoron_set_rankmath_metadata')) { 508 vectoron_set_rankmath_metadata($post_id, array( 509 'meta_description' => $meta_description, 510 'seo_title' => $seo_title, 511 'focus_keyword' => $focus_keyword, 512 )); 513 } 514 506 515 // Add tags if provided 507 516 if ($tags = $request->get_param('tags')) { … … 649 658 if (function_exists('vectoron_set_seopress_metadata')) { 650 659 vectoron_set_seopress_metadata($post_id, array( 660 'meta_description' => $meta_description, 661 'seo_title' => $seo_title, 662 'focus_keyword' => $focus_keyword, 663 )); 664 } 665 666 // Set Rank Math SEO metadata if Rank Math is installed 667 if (function_exists('vectoron_set_rankmath_metadata')) { 668 vectoron_set_rankmath_metadata($post_id, array( 651 669 'meta_description' => $meta_description, 652 670 'seo_title' => $seo_title, -
vectoron/trunk/vectoron.php
r3448969 r3450706 3 3 * Plugin Name: Vectoron 4 4 * Description: Provides the [vectoron_article] shortcode to disable wpautop and load assets for custom content like the FAQ accordion and GA4 tracking. Includes REST API endpoints for external content management and ACF integration. 5 * Version: 2. 9.95 * Version: 2.10.0 6 6 * Author: Vectoron 7 7 * Author URI: https://vectoron.ai
Note: See TracChangeset
for help on using the changeset viewer.