Файловый менеджер - Редактировать - /home/admin/domains/octawebtools.com/public_html/wp-content/plugins/tmcaps/settings.php
�азад
<?php defined( 'ABSPATH' ) || exit; class TMcapsSettings { /* The single instance of the class */ protected static $_instance = null; /* Main Instance */ public static function instance() { if ( is_null( self::$_instance ) ) { self::$_instance = new self(); } return self::$_instance; } /* Constructor */ public function __construct() { add_action( 'cmb2_admin_init', array($this, 'register_metabox') ); add_action( 'admin_enqueue_scripts',array($this, 'colorpicker_labels'), 99 ); } /** * Hook in and register a metabox to handle a plugin options page and adds a menu item. */ public function register_metabox() { // GENERAL SETTINGS $args = array( 'id' => 'tmcaps_options', 'title' => esc_html__('TM Caps', 'tmcaps'), 'object_types' => array( 'options-page' ), 'option_key' => 'tmcaps_options', 'tab_group' => 'tmcaps_options', 'tab_title' => esc_html__('Settings', 'tmcaps') ); // 'tab_group' property is supported in > 2.4.0. if ( version_compare( CMB2_VERSION, '2.4.0' ) ) { $args['display_cb'] = array($this, 'display_with_tabs'); } $main_options = new_cmb2_box( $args ); $main_options->add_field( array( 'name' => esc_html__( 'Require Login To Download', 'tmcaps'), 'id' => 'require_login', 'type' => 'radio_inline', 'options' => array( 'enable' => esc_html__( 'Enable', 'tmcaps' ), 'disable' => esc_html__( 'Disable', 'tmcaps' ) ), 'attributes' => array( 'autocomplete' => 'off' ), 'default' => 'disable', ) ); $main_options->add_field( array( 'name' => esc_html__( 'Upload Image', 'tmcaps'), 'id' => 'upload_img', 'type' => 'radio_inline', 'options' => array( 'enable' => esc_html__( 'Enable', 'tmcaps' ), 'disable' => esc_html__( 'Disable', 'tmcaps' ) ), 'attributes' => array( 'autocomplete' => 'off' ), 'default' => 'enable', ) ); $main_options->add_field( array( 'name' => esc_html__( 'Meme Templates', 'tmcaps'), 'id' => 'meme_templates', 'type' => 'radio_inline', 'options' => array( 'enable' => esc_html__( 'Enable', 'tmcaps' ), 'disable' => esc_html__( 'Disable', 'tmcaps' ) ), 'attributes' => array( 'autocomplete' => 'off' ), 'default' => 'disable', ) ); $main_options->add_field( array( 'name' => esc_html__( 'Draw', 'tmcaps'), 'id' => 'draw', 'type' => 'radio_inline', 'options' => array( 'enable' => esc_html__( 'Enable', 'tmcaps' ), 'disable' => esc_html__( 'Disable', 'tmcaps' ) ), 'attributes' => array( 'autocomplete' => 'off' ), 'default' => 'enable', ) ); $main_options->add_field( array( 'name' => esc_html__( 'Emojis', 'tmcaps'), 'id' => 'emoji', 'type' => 'radio_inline', 'options' => array( 'enable' => esc_html__( 'Enable', 'tmcaps' ), 'disable' => esc_html__( 'Disable', 'tmcaps' ) ), 'attributes' => array( 'autocomplete' => 'off' ), 'default' => 'enable', ) ); $main_options->add_field( array( 'name' => esc_html__( 'Shapes', 'tmcaps'), 'id' => 'shapes', 'type' => 'radio_inline', 'options' => array( 'enable' => esc_html__( 'Enable', 'tmcaps' ), 'disable' => esc_html__( 'Disable', 'tmcaps' ) ), 'attributes' => array( 'autocomplete' => 'off' ), 'default' => 'enable', ) ); // MEME TEMPLATES $args = array( 'id' => 'tmcaps_options_1', 'title' => esc_html__('TM Caps', 'tmcaps'), 'menu_title' => esc_html__('Meme Templates', 'tmcaps'), 'object_types' => array( 'options-page' ), 'option_key' => 'tmcaps_options_1', 'parent_slug' => 'tmcaps_options', 'tab_group' => 'tmcaps_options', 'tab_title' => esc_html__('Meme Templates', 'tmcaps'), ); // 'tab_group' property is supported in > 2.4.0. if ( version_compare( CMB2_VERSION, '2.4.0' ) ) { $args['display_cb'] = array($this, 'display_with_tabs'); } $options_1 = new_cmb2_box( $args ); $options_1->add_field( array( 'name' => esc_html__('Meme Templates', 'tmcaps'), 'id' => 'templates', 'type' => 'file_list', 'query_args' => array( 'type' => 'image' ) ) ); // EMOJIS $args = array( 'id' => 'tmcaps_options_2', 'title' => esc_html__('TM Caps', 'tmcaps'), 'menu_title' => esc_html__('Emoji Library', 'tmcaps'), 'object_types' => array( 'options-page' ), 'option_key' => 'tmcaps_options_2', 'parent_slug' => 'tmcaps_options', 'tab_group' => 'tmcaps_options', 'tab_title' => esc_html__('Emoji Library', 'tmcaps'), ); // 'tab_group' property is supported in > 2.4.0. if ( version_compare( CMB2_VERSION, '2.4.0' ) ) { $args['display_cb'] = array($this, 'display_with_tabs'); } $options_2 = new_cmb2_box( $args ); $options_2->add_field( array( 'name' => esc_html__( 'Default emojis', 'tmcaps'), 'id' => 'default_emojis', 'type' => 'radio_inline', 'options' => array( 'enable' => esc_html__( 'Enable', 'tmcaps' ), 'disable' => esc_html__( 'Disable', 'tmcaps' ) ), 'attributes' => array( 'autocomplete' => 'off' ), 'default' => 'enable', ) ); $options_2->add_field( array( 'name' => esc_html__('Custom Emojis', 'tmcaps'), 'desc' => esc_html__( 'Only SVG files are allowed.', 'tmcaps'), 'id' => 'custom_emojis', 'type' => 'file_list', 'query_args' => array( 'type' => 'image/svg+xml' ) ) ); } /** * Gets navigation tabs array for CMB2 options pages which share the given * display_cb param. * * @param CMB2_Options_Hookup $cmb_options The CMB2_Options_Hookup object. * * @return array Array of tab information. */ public function page_tabs( $cmb_options ) { $tab_group = $cmb_options->cmb->prop( 'tab_group' ); $tabs = array(); foreach ( CMB2_Boxes::get_all() as $cmb_id => $cmb ) { if ( $tab_group === $cmb->prop( 'tab_group' ) ) { $tabs[ $cmb->options_page_keys()[0] ] = $cmb->prop( 'tab_title' ) ? $cmb->prop( 'tab_title' ) : $cmb->prop( 'title' ); } } return $tabs; } /** * A CMB2 options-page display callback override which adds tab navigation among * CMB2 options pages which share this same display callback. * * @param CMB2_Options_Hookup $cmb_options The CMB2_Options_Hookup object. */ public function display_with_tabs( $cmb_options ) { $tabs = $this->page_tabs( $cmb_options ); ?> <div class="wrap cmb2-options-page option-<?php echo esc_attr($cmb_options->option_key); ?>"> <?php if ( get_admin_page_title() ) : ?> <h2><?php echo wp_kses_post( get_admin_page_title() ); ?></h2> <?php endif; ?> <h2 class="nav-tab-wrapper"> <?php foreach ( $tabs as $option_key => $tab_title ) : ?> <a class="nav-tab<?php if ( isset( $_GET['page'] ) && $option_key === $_GET['page'] ) : ?> nav-tab-active<?php endif; ?>" href="<?php menu_page_url( $option_key ); ?>"><?php echo wp_kses_post( $tab_title ); ?></a> <?php endforeach; ?> </h2> <form class="cmb-form" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="POST" id="<?php echo esc_attr($cmb_options->cmb->cmb_id); ?>" enctype="multipart/form-data" encoding="multipart/form-data"> <input type="hidden" name="action" value="<?php echo esc_attr( $cmb_options->option_key ); ?>"> <?php $cmb_options->options_page_metabox(); ?> <?php submit_button( esc_attr( $cmb_options->cmb->prop( 'save_button' ) ), 'primary', 'submit-cmb' ); ?> </form> </div> <?php } /** * Colorpicker Labels */ function colorpicker_labels( $hook ) { global $wp_version; if( version_compare( $wp_version, '5.4.2' , '>=' ) ) { wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', array( 'clear' => esc_html__( 'Clear', 'tmcaps' ), 'clearAriaLabel' => esc_html__( 'Clear color', 'tmcaps' ), 'defaultString' => esc_html__( 'Default', 'tmcaps' ), 'defaultAriaLabel' => esc_html__( 'Select default color', 'tmcaps' ), 'pick' => esc_html__( 'Select Color', 'tmcaps' ), 'defaultLabel' => esc_html__( 'Color value', 'tmcaps' ) ) ); } } } /** * Returns the main instance of tmcaps. */ function TMcapsSettings() { return TMcapsSettings::instance(); } // Global for backwards compatibility. $GLOBALS['TMcapsSettings'] = TMcapsSettings(); /** * Custom Get option */ function tmcaps_get_option( $tab = 'tmcaps_options', $key = '', $default = false ) { if ( function_exists( 'cmb2_get_option' ) ) { return cmb2_get_option( $tab, $key, $default ); } $opts = get_option( $tab, $default ); $val = $default; if ( 'all' == $key ) { $val = $opts; } elseif ( is_array( $opts ) && array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) { $val = $opts[ $key ]; } return $val; }
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генераци� �траницы: 0 |
proxy
|
phpinfo
|
�а�тройка