| Server IP : 5.129.245.98 / Your IP : 216.73.217.19 Web Server : Apache/2.4.66 (Debian) System : Linux 1b8c17c336b9 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/content-egg/application/vendor/ |
Upload File : |
<?php
namespace ContentEgg\application\vendor;
defined( '\ABSPATH' ) || exit;
/**
* Modified version of: Yii CVarDumper
*/
/**
* CVarDumper class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2013 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/**
* Copyright (c) 2008 by Yii Software LLC (http://www.yiisoft.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* Neither the name of Yii Software LLC nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* CVarDumper is intended to replace the buggy PHP function var_dump and print_r.
* It can correctly identify the recursively referenced objects in a complex
* object structure. It also has a recursive depth control to avoid indefinite
* recursive display of some peculiar variables.
*
* CVarDumper can be used as follows,
* <pre>
* CVarDumper::dump($var);
* </pre>
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @package system.utils
* @since 1.0
*/
class CVarDumper {
private static $_objects;
private static $_output;
private static $_depth;
/**
* Displays a variable.
* This method achieves the similar functionality as var_dump and print_r
* but is more robust when handling complex objects such as Yii controllers.
*
* @param mixed $var variable to be dumped
* @param integer $depth maximum depth that the dumper should go into the variable. Defaults to 10.
* @param boolean $highlight whether the result should be syntax-highlighted
*/
public static function dump( $var, $depth = 10, $highlight = false ) {
echo self::dumpAsString( $var, $depth, $highlight ); // phpcs:ignore
}
/**
* Dumps a variable in terms of a string.
* This method achieves the similar functionality as var_dump and print_r
* but is more robust when handling complex objects such as Yii controllers.
*
* @param mixed $var variable to be dumped
* @param integer $depth maximum depth that the dumper should go into the variable. Defaults to 10.
* @param boolean $highlight whether the result should be syntax-highlighted
*
* @return string the string representation of the variable
*/
public static function dumpAsString( $var, $depth = 10, $highlight = false ) {
self::$_output = '';
self::$_objects = array();
self::$_depth = $depth;
self::dumpInternal( $var, 0 );
if ( $highlight ) {
$result = highlight_string( "<?php\n" . self::$_output, true );
self::$_output = preg_replace( '/<\\?php<br \\/>/', '', $result, 1 );
}
return self::$_output;
}
/*
* @param mixed $var variable to be dumped
* @param integer $level depth level
*/
private static function dumpInternal( $var, $level ) {
switch ( gettype( $var ) ) {
case 'boolean':
self::$_output .= $var ? 'true' : 'false';
break;
case 'integer':
self::$_output .= "$var";
break;
case 'double':
self::$_output .= "$var";
break;
case 'string':
self::$_output .= "'" . addslashes( $var ) . "'";
break;
case 'resource':
self::$_output .= '{resource}';
break;
case 'NULL':
self::$_output .= "null";
break;
case 'unknown type':
self::$_output .= '{unknown}';
break;
case 'array':
if ( self::$_depth <= $level ) {
self::$_output .= 'array(...)';
} elseif ( empty( $var ) ) {
self::$_output .= 'array()';
} else {
$keys = array_keys( $var );
$spaces = str_repeat( ' ', $level * 4 );
self::$_output .= "array\n" . $spaces . '(';
foreach ( $keys as $key ) {
self::$_output .= "\n" . $spaces . ' ';
self::dumpInternal( $key, 0 );
self::$_output .= ' => ';
self::dumpInternal( $var[ $key ], $level + 1 );
}
self::$_output .= "\n" . $spaces . ')';
}
break;
case 'object':
if ( ( $id = array_search( $var, self::$_objects, true ) ) !== false ) {
self::$_output .= get_class( $var ) . '#' . ( $id + 1 ) . '(...)';
} elseif ( self::$_depth <= $level ) {
self::$_output .= get_class( $var ) . '(...)';
} else {
$id = array_push( self::$_objects, $var );
$className = get_class( $var );
$members = (array) $var;
$spaces = str_repeat( ' ', $level * 4 );
self::$_output .= "$className#$id\n" . $spaces . '(';
foreach ( $members as $key => $value ) {
$keyDisplay = strtr( trim( $key ), array( "\0" => ':' ) );
self::$_output .= "\n" . $spaces . " [$keyDisplay] => ";
self::$_output .= self::dumpInternal( $value, $level + 1 );
}
self::$_output .= "\n" . $spaces . ')';
}
break;
}
}
}