| Server IP : 116.202.121.150 / Your IP : 216.73.216.20 Web Server : Apache System : Linux server5.febas.net 6.1.0-51-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.177-1 (2026-07-16) x86_64 User : k9887-1 ( 1171) PHP Version : 8.2.33 Disable Function : show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen, system, shell_exec, passthru, popen, proc_open, exec MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/k9887-1/htdocs/_fisch/wp-content/plugins/the7-cli/src/Commands/The7/ |
Upload File : |
<?php
namespace The7CLI\Commands\The7;
use \WP_CLI;
defined( 'ABSPATH' ) || exit;
/**
* Manage The7 theme options.
*
* @package The7CLI\Commands\The7
*/
class Option {
const COMMAND = 'the7 option';
/**
* Update The7 theme option.
*
* ## OPTIONS
*
* <key>
* : Option to update.
*
* [<value>]
* : The new value. If omitted, the value is read from STDIN.
*
* [--format=<format>]
* : The serialization format for the value.
* ---
* default: plaintext
* options:
* - plaintext
* - json
* ---
*
* ## EXAMPLES
*
* wp the7 option update header-layout classic
*
* @when after_admin_init
*/
public function update( $args, $assoc_args ) {
if ( ! function_exists( 'optionsframework_get_options_id' ) ) {
WP_CLI::error( "Seems that you don't use The7 theme." );
}
$key = $args[0];
$value = WP_CLI::get_value_from_arg_or_stdin( $args, 1 );
$value = WP_CLI::read_value( $value, $assoc_args );
$the7_options_id = optionsframework_get_options_id();
$theme_options = get_option( $the7_options_id );
$old_value = $theme_options[ $key ];
if ( $value === $old_value ) {
WP_CLI::success( "Value passed for '$key' option is unchanged." );
} else {
$theme_options[ $key ] = $value;
$theme_options = sanitize_option( $the7_options_id, $theme_options );
if ( update_option( $the7_options_id, $theme_options ) ) {
presscore_refresh_dynamic_css();
WP_CLI::success( "Updated '$key' option." );
} else {
WP_CLI::error( "Could not update option '$key'." );
}
}
}
/**
* Get The7 theme option.
* ## OPTIONS
*
* <key>
* : Option to get.
*
* [--format=<format>]
* : Get value in a particular format.
* ---
* default: var_export
* options:
* - var_export
* - json
* - yaml
* ---
*
* ## EXAMPLES
*
* wp the7 option get header-layout
*
* @when after_admin_init
*/
public function get( $args, $assoc_args ) {
if ( ! function_exists( 'optionsframework_get_options_id' ) ) {
WP_CLI::error( "Seems that you don't use The7 theme." );
}
$the7_options_id = optionsframework_get_options_id();
$theme_options = get_option( $the7_options_id );
list( $key ) = $args;
if ( ! array_key_exists( $key, $theme_options ) ) {
return;
}
$value = $theme_options[ $key ];
WP_CLI::print_value( $value, $assoc_args );
}
/**
* Delete The7 theme option.
*
* ## OPTIONS
*
* <key>
* : Option to delete.
*
* ## EXAMPLES
*
* wp the7 option delete header-layout
*
* @when after_admin_init
*/
public function delete( $args ) {
if ( ! function_exists( 'optionsframework_get_options_id' ) ) {
WP_CLI::error( "Seems that you don't use The7 theme." );
}
$key = $args[0];
$the7_options_id = optionsframework_get_options_id();
$theme_options = get_option( $the7_options_id );
unset( $theme_options[ $key ] );
$theme_options = sanitize_option( $the7_options_id, $theme_options );
if ( update_option( $the7_options_id, $theme_options ) ) {
WP_CLI::success( "Option '$key' has been deleted." );
} else {
WP_CLI::error( "Could not delete option '$key'." );
}
}
}