| Server IP : 172.67.159.97 / Your IP : 216.73.217.154 Web Server : nginx/1.24.0 System : Linux wordpress-sites 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/rebeccaone.com/wp-content/plugins/soliloquy/includes/admin/ |
Upload File : |
<?php
/**
* Common serialization class. Fixes issues with broken serialized strings
* typically caused by users migrating sites + running a search/replace MySQL
* query on the post meta table (therefore breaking Soliloquy + it 'losing'
* all slides etc).
*
* @since 2.3.9.6
*
* @package Soliloquy
* @author Tim Carr
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Soliloquy_Serialization_Admin {
/**
* Holds the class object.
*
* @since 2.3.9.6
*
* @var object
*/
public static $instance;
/**
* Path to the file.
*
* @since 2.3.9.6
*
* @var string
*/
public $file = __FILE__;
/**
* Holds the base class object.
*
* @since 2.3.9.6
*
* @var object
*/
public $base;
/**
* Primary class constructor.
*
* @since 2.3.9.6
*/
public function __construct() {
}
/**
* Fix a serialized string
*
* @since 2.3.9.6
*
* @param string $string Serialized string to fix
* @return array Unserialized data
*/
public function fix_serialized_string( $string ) {
// Check string is serialised and if it already works return it
if ( ! preg_match( '/^[aOs]:/', $string ) ) {
return $string;
}
$unserialized_data = @unserialize( $string, [ 'allowed_classes' => false ] );
if ( $unserialized_data !== false ) {
return $unserialized_data;
}
// String needs fixing - fix it
$string = preg_replace_callback( '/\bs:(\d+):"(.*?)"/', array( $this, 'fix_str_length' ), $string );
// Return fixed unserialized data
return @unserialize( $string, [ 'allowed_classes' => false ] );
}
/**
* Callback function for replacing the string's length paramter on a broken
* serialized string
*
* @since 2.3.9.6
*
* @param array $matches preg_replace matches
* @return string Replacement string
*/
private function fix_str_length( $matches ) {
$string = $matches[2];
$right_length = strlen( $string );
return 's:' . $right_length . ':"' . $string . '"';
}
/**
* Returns the singleton instance of the class.
*
* @since 2.3.9.6
*
* @return object The Soliloquy_Serialization_Admin object.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Serialization_Admin ) ) {
self::$instance = new Soliloquy_Serialization_Admin();
}
return self::$instance;
}
}
// Load the serialization admin class.
$soliloquy_serialization_admin = Soliloquy_Serialization_Admin::get_instance();