Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../clone/wp-conte.../plugins/themify-.../themify
File: themify-database.php
<?php
[0] Fix | Delete
/***************************************************************************
[1] Fix | Delete
*
[2] Fix | Delete
* ----------------------------------------------------------------------
[3] Fix | Delete
* DO NOT EDIT THIS FILE
[4] Fix | Delete
* ----------------------------------------------------------------------
[5] Fix | Delete
*
[6] Fix | Delete
* Copyright (C) Themify
[7] Fix | Delete
*
[8] Fix | Delete
* ----------------------------------------------------------------------
[9] Fix | Delete
*
[10] Fix | Delete
***************************************************************************/
[11] Fix | Delete
[12] Fix | Delete
/* Database Functions
[13] Fix | Delete
/***************************************************************************/
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Save Data
[17] Fix | Delete
* @since 1.0.0
[18] Fix | Delete
* @package themify
[19] Fix | Delete
*/
[20] Fix | Delete
function themify_set_data(?array $data ):bool {
[21] Fix | Delete
if ( empty( $data )) {
[22] Fix | Delete
$data = array();
[23] Fix | Delete
}
[24] Fix | Delete
else{
[25] Fix | Delete
unset($data['save'],$data['page']);
[26] Fix | Delete
foreach ( $data as $name => $value ) {
[27] Fix | Delete
if ($value==='' || $value==='default' || $value==='[]') {
[28] Fix | Delete
unset( $data[$name] );
[29] Fix | Delete
}
[30] Fix | Delete
}
[31] Fix | Delete
}
[32] Fix | Delete
if(update_option( 'themify_data', $data,false )){
[33] Fix | Delete
themify_get_data(true);
[34] Fix | Delete
return true;
[35] Fix | Delete
}
[36] Fix | Delete
//check if it's error, because wp returns false on errors and when old value and new are the same
[37] Fix | Delete
$old=themify_get_data();
[38] Fix | Delete
return $old===$data || maybe_serialize( $old ) === maybe_serialize( $data );
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
/**
[42] Fix | Delete
* Return cached data
[43] Fix | Delete
*/
[44] Fix | Delete
function themify_get_data($reinit=false,$from=false):array {
[45] Fix | Delete
static $data=null;
[46] Fix | Delete
if ($data===null || $reinit!==false) {
[47] Fix | Delete
$skip_cache = defined( 'THEMIFY_SKIP_DATA_CACHE' ) && true === THEMIFY_SKIP_DATA_CACHE;
[48] Fix | Delete
if ( $skip_cache===false ) {
[49] Fix | Delete
if(defined('THEMIFY_SETTING_CACHE_DIR')){
[50] Fix | Delete
$dir=trailingslashit(THEMIFY_SETTING_CACHE_DIR);
[51] Fix | Delete
}
[52] Fix | Delete
else{
[53] Fix | Delete
$dir=__DIR__.DIRECTORY_SEPARATOR.'.data'.DIRECTORY_SEPARATOR;
[54] Fix | Delete
}
[55] Fix | Delete
if(is_multisite()){
[56] Fix | Delete
$dir.=get_current_blog_id().DIRECTORY_SEPARATOR;
[57] Fix | Delete
}
[58] Fix | Delete
$prefix='themify_settings_';
[59] Fix | Delete
$fname=$prefix.basename(dirname(__DIR__)).'_'.THEMIFY_VERSION.'_'.Themify_Enqueue_Assets::$themeVersion;
[60] Fix | Delete
$orig=$fname.'.php';
[61] Fix | Delete
if($reinit!==true && $from!=='db' && is_file($dir.$orig)){
[62] Fix | Delete
include $dir.$orig;
[63] Fix | Delete
if(isset($_arr)){
[64] Fix | Delete
$data =$_arr;
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
}
[68] Fix | Delete
if($data===null || $reinit===true){
[69] Fix | Delete
$data=get_option( 'themify_data', array() );
[70] Fix | Delete
if(empty($data)){
[71] Fix | Delete
$data=array();
[72] Fix | Delete
}
[73] Fix | Delete
themify_sanitize_data($data);
[74] Fix | Delete
if($reinit===false){
[75] Fix | Delete
$data = apply_filters( 'themify_get_data', $data );
[76] Fix | Delete
}
[77] Fix | Delete
if ( $skip_cache===false ) {
[78] Fix | Delete
$tmpName=$dir.uniqid($prefix,true).'.php';
[79] Fix | Delete
if(is_file($dir.$orig) && !Themify_Filesystem::rename($dir.$orig,$tmpName)){
[80] Fix | Delete
Themify_Filesystem::delete($dir.$orig);
[81] Fix | Delete
}
[82] Fix | Delete
clearstatcache();
[83] Fix | Delete
if(Themify_Filesystem::mkdir($dir,true,0755) && is_writable($dir)){
[84] Fix | Delete
$str="<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly";
[85] Fix | Delete
$str.=PHP_EOL.'$_arr='.var_export ($data,true).';';
[86] Fix | Delete
//create a tmp file than rename, because the rename is atomic
[87] Fix | Delete
if (file_put_contents($tmpName, $str) && Themify_Filesystem::rename($tmpName,$dir.$orig) && ($handle = opendir($dir))) {//remove old caches
[88] Fix | Delete
while (false !== ($f = readdir($handle))) {
[89] Fix | Delete
if ($f !== '.' && $f !== '..' && $f!==$orig && strpos($f, $prefix) === 0 && pathinfo($f,PATHINFO_EXTENSION)=== 'php') {
[90] Fix | Delete
Themify_Filesystem::delete($dir . $f);
[91] Fix | Delete
}
[92] Fix | Delete
}
[93] Fix | Delete
closedir($handle);
[94] Fix | Delete
clearstatcache();
[95] Fix | Delete
}else{
[96] Fix | Delete
Themify_Filesystem::delete($tmpName);
[97] Fix | Delete
}
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
}
[101] Fix | Delete
}
[102] Fix | Delete
return $data;
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
/**
[106] Fix | Delete
* Abstract away normalizing the data
[107] Fix | Delete
*/
[108] Fix | Delete
function themify_sanitize_data(array &$data ){
[109] Fix | Delete
if ( !empty( $data )) {
[110] Fix | Delete
$html=array( 'setting-custom_css', 'setting-header_html', 'setting-footer_html', 'setting-footer_text_left', 'setting-footer_text_right', 'setting-homepage_welcome', 'setting-store_info_address' );
[111] Fix | Delete
foreach( $data as $name => &$value ){
[112] Fix | Delete
if ( in_array( $name,$html ,true )
[113] Fix | Delete
|| ( false !== stripos( $name, 'setting-hooks' ) )
[114] Fix | Delete
) {
[115] Fix | Delete
$value = str_replace( "\'", "'", $value );
[116] Fix | Delete
} else {
[117] Fix | Delete
$value = stripslashes( $value );
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
}
[121] Fix | Delete
}
[122] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function