Changeset 3349074
- Timestamp:
- 08/23/2025 09:39:25 PM (7 months ago)
- Location:
- content-visibility-for-divi-builder/trunk
- Files:
-
- 2 edited
-
content-visibility-for-divi-builder.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
content-visibility-for-divi-builder/trunk/content-visibility-for-divi-builder.php
r2682153 r3349074 8 8 * Plugin Name: Content Visibility for Divi Builder 9 9 * Description: Allows Sections and Modules to be displayed/hidden based on the outcome of a PHP boolean expression. 10 * Version: 3.2 210 * Version: 3.23 11 11 * Author: AoD Technologies LLC 12 12 * Author URI: http://www.aod-tech.com/ … … 114 114 $wp_version = get_bloginfo( 'version' ); 115 115 116 $version = '3.2 2';116 $version = '3.23'; 117 117 $stored_version = get_option( 'content_visibility_for_divi_builder_version' ); 118 118 … … 176 176 177 177 $visibility = true; 178 179 eval( '$visibility = ' . str_replace( array( '%22', '%5D' ), array( '"', ']' ), $atts['cvdb_content_visibility_check'] ) . ';' ); 178 $expression = str_replace( array( '%22', '%5D' ), array( '"', ']' ), $atts['cvdb_content_visibility_check'] ); 179 180 try { 181 eval( '$visibility = ' . $expression . ';' ); 182 } catch (ParseError | Error $error) { 183 global $wp; 184 global $wp_filesystem; 185 186 $attachment_file_name = wp_tempnam(); 187 try { 188 $attachments = array(); 189 $error_message_format = "An error has been detected while evaluating a visibility expression.\nNOTE: This section/module will not be displayed until the error is corrected.\n\nPage URL:\n%1\$s\n\nVisibility expression:\n%2\$s\n\nError message:\n%3\$s"; 190 191 if ( $wp_filesystem->put_contents( $attachment_file_name, print_r( $et_pb_element, true ), FS_CHMOD_FILE ) ) { 192 $error_message_format .= "\n\nThe full Divi Section/Module shortcode is attached to this email for reference."; 193 $attachments['full-divi-shortcode.txt'] = $attachment_file_name; 194 } 195 196 wp_mail( get_bloginfo( 'admin_email' ), '[' . get_bloginfo( 'name' ) . '] Content Visibility for Divi Builder - Visibility Expression Error Detected', sprintf( $error_message_format, home_url( add_query_arg( isset( $_SERVER['QUERY_STRING'] ) ? $_SERVER['QUERY_STRING'] : array(), '', $wp->request ) ), $expression, $error->getMessage() ), array('Content-Type: text/plain; charset=UTF-8'), $attachments ); 197 } finally { 198 $wp_filesystem->delete( $attachment_file_name, false, 'f' ); 199 } 200 201 $visibility = false; 202 } 180 203 181 204 if ( !$visibility ) { -
content-visibility-for-divi-builder/trunk/readme.txt
r2876806 r3349074 3 3 Donate link: https://www.aod-tech.com/donate/ 4 4 Tags: divi, divi theme, divi builder, elegant themes, elegantthemes, page builder, pagebuilder, conditional-tags, conditional tags, conditional, tags, show, hide, show hide 5 Requires at least: 3.0 6 Tested up to: 6.1.1 7 Stable tag: 3.22 5 Requires at least: 4.7 6 Tested up to: 6.8.2 7 Requires PHP: 7.0 8 Stable tag: 3.23 8 9 License: GPLv2 or later 9 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 55 56 56 57 == Changelog == 58 = 3.23 = 59 * Catch errors in visibility expression evaluation; this allows the rest of the page to load while only hiding the module or section that triggered the error. 60 * Email site admin when errors in visibility expression evalution occur with helpful debugging information (i.e. the error that occured, the URL on which it occured, and the full shortcode contents of the relevant module or section as an attachment). 61 57 62 = 3.22 = 58 63 * Fix compatibility with Stop Spammers plugin. Thanks to @kindred for providing access to a test environment exhibiting the issue!
Note: See TracChangeset
for help on using the changeset viewer.