芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/popup-maker/classes/Utils/Options.php
$val ) { $options[ $key ] = ! empty( $val ) ? $val : false; } $did_update = update_option( self::$_prefix . 'settings', $options ); // If it updated, let's update the global variable if ( $did_update ) { self::$_data = $options; } return $did_update; } /** * Remove an option or multiple * * Removes a setting value in both the db and the global variable. * * @param string|array $keys The Key/s to delete * * @return boolean True if updated, false if not. */ public static function delete( $keys = '' ) { // Passive initialization. self::init(); // If no key, exit if ( empty( $keys ) ) { return false; } elseif ( is_string( $keys ) ) { $keys = [ $keys ]; } // First let's grab the current settings $options = get_option( self::$_prefix . 'settings' ); // Remove each key/value pair. foreach ( $keys as $key ) { if ( isset( $options[ $key ] ) ) { unset( $options[ $key ] ); } } $did_update = update_option( self::$_prefix . 'settings', $options ); // If it updated, let's update the global variable if ( $did_update ) { self::$_data = $options; } return $did_update; } /** * Remaps option keys. * * @param array $remap_array an array of $old_key => $new_key values. * * @return bool */ public static function remap_keys( $remap_array = [] ) { $options = self::get_all(); foreach ( $remap_array as $key => $new_key ) { $value = self::get( $key, false ); if ( ! empty( $value ) ) { $options[ $new_key ] = $value; } unset( $options[ $key ] ); } $did_update = update_option( self::$_prefix . 'settings', $options ); // If it updated, let's update the global variable if ( $did_update ) { self::$_data = $options; } return $did_update; } }