plugin updates

This commit is contained in:
Tony Volpe
2024-02-21 16:19:46 +00:00
parent c72f206574
commit 21d4c85c00
1214 changed files with 102269 additions and 179257 deletions

View File

@@ -12,7 +12,6 @@ defined( 'ABSPATH' ) || exit;
* Log levels class.
*/
abstract class WC_Log_Levels {
/**
* Log Levels
*
@@ -79,7 +78,7 @@ abstract class WC_Log_Levels {
* @return bool True if $level is a valid level.
*/
public static function is_valid_level( $level ) {
return array_key_exists( strtolower( $level ), self::$level_to_severity );
return is_string( $level ) && array_key_exists( strtolower( $level ), self::$level_to_severity );
}
/**
@@ -122,4 +121,39 @@ abstract class WC_Log_Levels {
public static function get_all_severity_levels() {
return self::$severity_to_level;
}
/**
* Get the UI label for a log level.
*
* @param string $level Log level, options: emergency|alert|critical|error|warning|notice|info|debug.
*
* @return string
*/
public static function get_level_label( $level ) {
$labels = self::get_all_level_labels();
if ( ! array_key_exists( $level, $labels ) ) {
return '';
}
return $labels[ $level ];
}
/**
* Get the UI labels for all log levels.
*
* @return string[]
*/
public static function get_all_level_labels() {
return array(
self::EMERGENCY => __( 'Emergency', 'woocommerce' ),
self::ALERT => __( 'Alert', 'woocommerce' ),
self::CRITICAL => __( 'Critical', 'woocommerce' ),
self::ERROR => __( 'Error', 'woocommerce' ),
self::WARNING => __( 'Warning', 'woocommerce' ),
self::NOTICE => __( 'Notice', 'woocommerce' ),
self::INFO => __( 'Info', 'woocommerce' ),
self::DEBUG => __( 'Debug', 'woocommerce' ),
);
}
}