PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.7.1
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.7.1
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 2.6.1 2.7.0 All 28 releases
← All changes | includes/class.execute.snippet.php +9 -20 trunk2.7.1 View file →
@@ -785,22 +785,17 @@
785 785 if ( empty( $snippet ) || $snippet->post_type !== WINP_SNIPPETS_POST_TYPE ) {
786 786 return false;
787 787 }
788 788
789 - $snippet_type = WINP_Helper::getMetaOption( $id, 'snippet_type', true );
790 - $is_executable = in_array( $snippet_type, [ WINP_SNIPPET_TYPE_PHP, WINP_SNIPPET_TYPE_UNIVERSAL ], true );
789 + $snippet_type = WINP_Helper::getMetaOption( $id, 'snippet_type', true );
791 790
792 - if ( $is_executable ) {
793 - // Preserve the active snippet context if execution terminates the request.
794 - self::$current_snippet_id = $id;
795 - WINP_Error_Handler::init();
796 - WINP_Error_Handler::set_current_snippet( $id, $snippet->post_title );
791 + // Set current snippet ID for error handling.
792 + self::$current_snippet_id = $id;
797 793
798 - // Register shutdown function once to catch fatal errors.
799 - if ( ! self::$shutdown_registered ) {
800 - register_shutdown_function( [ $this, 'handle_snippet_shutdown' ] );
801 - self::$shutdown_registered = true;
802 - }
794 + // Register shutdown function once to catch fatal errors.
795 + if ( ! self::$shutdown_registered ) {
796 + register_shutdown_function( [ $this, 'handle_snippet_shutdown' ] );
797 + self::$shutdown_registered = true;
803 798 }
804 799
805 800 if ( $snippet_type == WINP_SNIPPET_TYPE_UNIVERSAL ) {
806 801 $result = eval( '?>' . $code . '<?php ' );
@@ -809,13 +804,8 @@
809 804 } else {
810 805 $result = ! empty( $code );
811 806 }
812 807
813 - if ( $is_executable ) {
814 - self::$current_snippet_id = 0;
815 - WINP_Error_Handler::clear_current_snippet();
816 - }
817 -
818 808 if ( $catch_output ) {
819 809 ob_end_clean();
820 810 }
821 811
@@ -995,9 +985,9 @@
995 985 'Content-Type: text/html; charset=UTF-8',
996 986 ];
997 987
998 988 // Send email.
999 - $sent = wp_mail( $email_address, $subject, $email_body, $headers );
989 + $sent = wp_mail( $email_address, $subject, $email_body, $headers ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_wp_mail
1000 990
1001 991 // If email sent successfully, mark this error as emailed.
1002 992 if ( $sent ) {
1003 993 $emailed_errors[ $error_signature ] = time();
@@ -1431,10 +1421,9 @@
1431 1421 if ( is_object( $value ) ) {
1432 1422 if ( ! isset( $value->units ) || ! isset( $value->unitsCount ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
1433 1423 return 0;
1434 1424 }
1435 - $current_timestamp = current_datetime()->getTimestamp();
1436 - return ( $current_timestamp - $this->get_timestamp( $value->units, $value->unitsCount ) ) * 1000; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
1425 + return ( current_time( 'timestamp' ) - $this->get_timestamp( $value->units, $value->unitsCount ) ) * 1000; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase, WordPress.DateTime.CurrentTimeTimestamp.Requested
1437 1426 } else {
1438 1427 return $value;
1439 1428 }
1440 1429 }