芝麻web文件管理V1.00
编辑当前文件:/home/mybf1/www/rambut.bf1.my/wp-content/plugins/custom-css-js/includes/admin-config.php
$_value ) { if ( ! isset($settings[$_key] ) ) { $settings[$_key] = $_value; } } } $this->settings = $settings; $this->settings_default = $settings_default; //Add actions and filters add_action( 'admin_menu', array( $this, 'admin_menu' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_action( 'ccj_settings_form', array( $this, 'general_extra_form' ), 11 ); add_filter( 'ccj_settings_default', array( $this, 'general_extra_default' ) ); add_filter( 'ccj_settings_save', array( $this, 'general_extra_save' ) ); add_action( 'before_woocommerce_init', array( $this, 'before_woocommerce_init' ) ); } /** * Add submenu pages */ function admin_menu() { $menu_slug = 'edit.php?post_type=custom-css-js'; add_submenu_page( $menu_slug, __('Settings', 'custom-css-js'), __('Settings', 'custom-css-js'), 'manage_options', 'custom-css-js-config', array( $this, 'config_page' ) ); } /** * Enqueue the scripts and styles */ public function admin_enqueue_scripts( $hook ) { $screen = get_current_screen(); // Only for custom-css-js post type if ( $screen->post_type != 'custom-css-js' ) return false; if ( $hook != 'custom-css-js_page_custom-css-js-config' ) return false; // Some handy variables $a = plugins_url( '/', CCJ_PLUGIN_FILE). 'assets'; $v = CCJ_VERSION; wp_enqueue_script( 'tipsy', $a . '/jquery.tipsy.js', array('jquery'), $v, false ); wp_enqueue_style( 'tipsy', $a . '/tipsy.css', array(), $v ); } /** * Template for the config page */ function config_page() { if ( isset( $_POST['ccj_settings-nonce'] ) ) { check_admin_referer('ccj_settings', 'ccj_settings-nonce'); $data = apply_filters( 'ccj_settings_save', array() ); $settings = get_option('ccj_settings', array()); if ( !isset($settings['add_role'] ) ) $settings['add_role'] = false; if ( !isset($settings['remove_comments'] ) ) $settings['remove_comments'] = false; // If the "add role" option changed if ( $data['add_role'] !== $settings['add_role'] && current_user_can('update_plugins')) { // Add the 'css_js_designer' role if ( $data['add_role'] ) { CustomCSSandJS_Install::create_roles(); } // Remove the 'css_js_designer' role if ( !$data['add_role'] ) { remove_role('css_js_designer'); } flush_rewrite_rules(); } update_option( 'ccj_settings', $data ); } else { $data = $this->settings; } ?>
config_page_header('editor'); ?>
'', 'general' => '', 'debug' => ''); $active[$tab] = 'nav-tab-active'; ?>
false, 'ccj_htmlentities2' => false, 'ccj_autocomplete' => true, 'add_role' => false, 'remove_comments' => false, ) ); } /** * Add the `General Settings` form values to the $_POST for the Settings page */ function general_extra_save( $data = array() ) { $values = $this->general_extra_default(); foreach($values as $_key => $_value ) { $values[$_key] = isset($_POST[$_key]) ? true : false; } return array_merge( $data, $values ); } /** * Extra fields for the `General Settings` Form */ function general_extra_form() { // Get the setting $settings = get_option('ccj_settings', array()); $defaults = $this->general_extra_default(); foreach( $defaults as $_key => $_value ) { if ( !isset($settings[$_key] ) ) { $settings[$_key] = $_value; } } if ( !get_role('css_js_designer') && $settings['add_role'] ) { $settings['add_role'] = false; update_option( 'ccj_settings', $settings ); } if ( get_role('css_js_designer') && !$settings['add_role']) { $settings['add_role'] = true; update_option( 'ccj_settings', $settings ); } $ccj_htmlentities_help = __('If you want to use an HTML entity in your code (for example '. htmlentities('> or "').'), but the editor keeps on changing them to its equivalent character (> and " for the previous example), then you might want to enable this option.', 'custom-css-js'); $ccj_htmlentities2_help = __('If you use HTML tags in your code (for example '.htmlentities('
or
').') and you notice that they disappear and the editor looks weird, then you need to enable this option.', 'custom-css-js'); $remove_comments_help = __('In your page\'s HTML there is a comment added before and after the internal CSS or JS in order to help you locate your custom code. Enable this option in order to remove that comment.', 'custom-css-js'); ?>
/>
/>
/>
/>
/>