function weaverx_admin_theme_page() { $cur_vers = weaverx_wp_version(); if (version_compare($cur_vers, WEAVERX_MIN_WPVERSION, '<')) { echo '<br><br><h2 style="padding:4px;background:pink;">' . __('ERROR: You are using WordPress Version ', 'weaver-xtreme') . $GLOBALS['wp_version'] . __(' Weaver Xtreme requires <em>WordPress Version ', 'weaver-xtreme') . WEAVERX_MIN_WPVERSION . __('</em> or above. You should always upgrade to the latest version of WordPress for maximum site performance and security.', 'weaver-xtreme') . '</h2>'; // admin message return; } require_once get_template_directory() . WEAVERX_ADMIN_DIR . '/admin-top.php'; // NOW - load the admin stuff do_action('weaverxplus_add_admin'); weaverx_do_admin(); }
/** * Register settings and controls for a section. */ function weaverx_customizer_add_section_options($section, $args, $initial_priority = 100) { global $wp_customize; $priority = new weaverx_cz_Prioritizer($initial_priority, 5); $theme_prefix = 'weaverx_'; foreach ($args as $setting_id => $option) { if (isset($option['setting'])) { $defaults = array('type' => 'option', 'capability' => 'edit_theme_options', 'theme_supports' => '', 'default' => false, 'transport' => 'refresh', 'sanitize_callback' => WEAVERX_DEFAULT_SANITIZE, 'sanitize_js_callback' => ''); $setting = wp_parse_args($option['setting'], $defaults); // Add the setting arguments in array to add_setting call so Theme Check can verify the presence of sanitize_callback // until a couple versions after the upgraded WP Customize Setting class, we will use our own sub-class to be sure // the preview doesn't take forever to render. The new version seems to fix the speed issue. $cur_vers = weaverx_wp_version(); //$class_setting = 'WeaverX_Customize_Setting'; if (version_compare($cur_vers, '4.4', '<')) { $class_setting = 'WeaverX_Customize_Setting'; } else { $class_setting = 'WP_Customize_Setting'; } $wp_customize->add_setting(new $class_setting($wp_customize, weaverx_cz_settings_name($setting_id), array('type' => $setting['type'], 'capability' => $setting['capability'], 'theme_supports' => $setting['theme_supports'], 'default' => $setting['default'], 'transport' => $setting['transport'], 'sanitize_callback' => $setting['sanitize_callback'], 'sanitize_js_callback' => $setting['sanitize_js_callback']))); //$wp_customize->add_setting( weaverx_cz_settings_name( $setting_id ), // $usesetting); } // Add control if (isset($option['control'])) { $control_id = $theme_prefix . $setting_id; $defaults = array('section' => $section, 'priority' => $priority->add(), 'settings' => weaverx_cz_settings_name($setting_id)); if (!isset($option['setting'])) { unset($defaults['settings']); } $control = wp_parse_args($option['control'], $defaults); // Check for a specialized control class - create new instance if (isset($control['control_type'])) { $class = $control['control_type']; if (class_exists($class)) { unset($control['control_type']); // Dynamically generate a new class instance $class_instance = new $class($wp_customize, $control_id, $control); $wp_customize->add_control($class_instance); } else { if (WEAVERX_DEV_MODE) { echo '<h2>MISSING CLASS DEFINITON: ' . $class . '</h2>'; } } } else { $wp_customize->add_control($control_id, $control); } } } return $priority->get(); }