is_serialized example

/** * Adds `rel="noopener"` to all HTML A elements that have a target. * * @since 5.1.0 * @since 5.6.0 Removed 'noreferrer' relationship. * * @param string $text Content that may contain HTML A elements. * @return string Converted content. */
function wp_targeted_link_rel( $text ) {
    // Don't run (more expensive) regex if no links with targets.     if ( stripos( $text, 'target' ) === false || stripos( $text, '<a ' ) === false || is_serialized( $text ) ) {
        return $text;
    }

    $script_and_style_regex = '/<(script|style).*?<\/\\1>/si';

    preg_match_all( $script_and_style_regex$text$matches );
    $extra_parts = $matches[0];
    $html_parts  = preg_split( $script_and_style_regex$text );

    foreach ( $html_parts as &$part ) {
        $part = preg_replace_callback( '|<a\s([^>]*target\s*=[^>]*)>|i', 'wp_targeted_link_rel_callback', $part );
    }

        $options     = $wpdb->get_results( $query );

        foreach ( $options as $option ) {
            if ( 'default_role' === $option->option_name ) {
                $editblog_default_role = $option->option_value;
            }

            $disabled = false;
            $class    = 'all-options';

            if ( is_serialized( $option->option_value ) ) {
                if ( is_serialized_string( $option->option_value ) ) {
                    $option->option_value = esc_html( maybe_unserialize( $option->option_value ) );
                } else {
                    $option->option_value = 'SERIALIZED DATA';
                    $disabled             = true;
                    $class                = 'all-options disabled';
                }
            }

            if ( str_contains( $option->option_value, "\n" ) ) {
                ?>
$this->set_post_value( $setting_id$nav_menu_term_id );
                $this->pending_starter_content_settings_ids[] = $setting_id;
            }
        }

        // Options.         foreach ( $options as $name => $value ) {

            // Serialize the value to check for post symbols.             $value = maybe_serialize( $value );

            if ( is_serialized( $value ) ) {
                if ( preg_match( '/s:\d+:"{{(?P<symbol>.+)}}"/', $value$matches ) ) {
                    if ( isset( $posts[ $matches['symbol'] ] ) ) {
                        $symbol_match = $posts[ $matches['symbol'] ]['ID'];
                    } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) {
                        $symbol_match = $attachment_ids[ $matches['symbol'] ];
                    }

                    // If we have any symbol matches, update the values.                     if ( isset( $symbol_match ) ) {
                        // Replace found string matches with post IDs.                         $value = str_replace( $matches[0], "i:{$symbol_match}", $value );
                    }
<?php $options = $wpdb->get_results( "SELECT * FROM $wpdb->options ORDER BY option_name" );

foreach ( (array) $options as $option ) :
    $disabled = false;

    if ( '' === $option->option_name ) {
        continue;
    }

    if ( is_serialized( $option->option_value ) ) {
        if ( is_serialized_string( $option->option_value ) ) {
            // This is a serialized string, so we should display it.             $value               = maybe_unserialize( $option->option_value );
            $options_to_update[] = $option->option_name;
            $class               = 'all-options';
        } else {
            $value    = 'SERIALIZED DATA';
            $disabled = true;
            $class    = 'all-options disabled';
        }
    } else {
        
if ( is_protected_meta( $entry['meta_key'], 'post' ) ) {
        return '';
    }

    if ( ! $update_nonce ) {
        $update_nonce = wp_create_nonce( 'add-meta' );
    }

    $r = '';
    ++$count;

    if ( is_serialized( $entry['meta_value'] ) ) {
        if ( is_serialized_string( $entry['meta_value'] ) ) {
            // This is a serialized string, so we should display it.             $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
        } else {
            // This is a serialized array/object so we should NOT display it.             --$count;
            return '';
        }
    }

    $entry['meta_key']   = esc_attr( $entry['meta_key'] );
    

function maybe_serialize( $data ) {
    if ( is_array( $data ) || is_object( $data ) ) {
        return serialize( $data );
    }

    /* * Double serialization is required for backward compatibility. * See https://core.trac.wordpress.org/ticket/12930 * Also the world will end. See WP 3.6.1. */
    if ( is_serialized( $data, false ) ) {
        return serialize( $data );
    }

    return $data;
}

/** * Unserializes data only if it was serialized. * * @since 2.0.0 * * @param string $data Data that might be unserialized. * @return mixed Unserialized data can be any type. */
Home | Imprint | This part of the site doesn't use cookies.