PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.7.8
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.7.8
2.7.9 2.7.8 2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 All 30 releases
← All changes | admin/metaboxes/snippet-metabox.php +13 -0 2.7.4 → 2.7.8 View file →
@@ -1242,8 +1242,21 @@
1242 1242 if ( empty( $snippet_code ) ) {
1243 1243 return true;
1244 1244 }
1245 1245
1246 + $redeclaration = WINP_Code_Validator::find_function_redeclaration( $snippet_code, $snippet_type );
1247 + if ( null !== $redeclaration ) {
1248 + $this->display_validation_error(
1249 + $redeclaration['line'],
1250 + sprintf(
1251 + // translators: %s is the fully qualified function name.
1252 + __( 'Cannot redeclare function %s(). Rename the function or guard its declaration with function_exists().', 'insert-php' ),
1253 + $redeclaration['name']
1254 + )
1255 + );
1256 + return false;
1257 + }
1258 +
1246 1259 // Set custom error handler to catch warnings and notices.
1247 1260 set_error_handler( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler
1248 1261 function ( $errno, $errstr, $errfile, $errline ) {
1249 1262 $error_file = $errfile;