updated plugin W3 Total Cache version 2.5.0

This commit is contained in:
2023-10-22 22:21:26 +00:00
committed by Gitium
parent 2f6b5b6047
commit 9e3fa792d7
255 changed files with 10113 additions and 23010 deletions

View File

@ -173,8 +173,13 @@ class Util_Environment {
*
* @return bool
*/
public static function is_dbcluster() {
if ( ! defined( 'W3TC_PRO' ) || ! W3TC_PRO ) {
public static function is_dbcluster( $config = null ) {
if ( is_null( $config ) ) {
// fallback for compatibility with older wp-content/db.php
$config = \W3TC\Dispatcher::config();
}
if ( !self::is_w3tc_pro( $config ) ) {
return false;
}
@ -1555,4 +1560,56 @@ class Util_Environment {
self::$is_using_master_config = null;
}
/**
* Removes blank lines, trim values, removes duplicates, and sorts array.
*
* @since 2.4.3
*
* @param array $values Array of values.
*
* @return array
*/
public static function clean_array( $values ) {
if ( ! empty( $values ) && is_array( $values ) ) {
$values = array_unique(
array_filter(
array_map(
'trim',
$values
),
'strlen'
)
);
sort( $values );
}
return $values;
}
/**
* Parses textarea setting value from string to array.
*
* @since 2.4.3
*
* @param string $value Value.
*
* @return array
*/
public static function textarea_to_array( $value ) {
$values_array = array();
if ( ! empty( $value ) ) {
$values_array = self::clean_array(
preg_split(
'/\R/',
$value,
0,
PREG_SPLIT_NO_EMPTY
)
);
}
return $values_array;
}
}