本文整理汇总了PHP中cmb_Meta_Box::is_enqueued方法的典型用法代码示例。如果您正苦于以下问题:PHP cmb_Meta_Box::is_enqueued方法的具体用法?PHP cmb_Meta_Box::is_enqueued怎么用?PHP cmb_Meta_Box::is_enqueued使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmb_Meta_Box
的用法示例。
在下文中一共展示了cmb_Meta_Box::is_enqueued方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register_scripts
/**
* Registers scripts and styles for CMB
* @since 1.0.0
*/
public function register_scripts()
{
// Should only be run once
if (self::$is_enqueued) {
return;
}
global $wp_version;
// Only use minified files if SCRIPT_DEBUG is off
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// scripts required for cmb
$scripts = array('jquery', 'jquery-ui-core', 'cmb-datepicker', 'cmb-timepicker');
// styles required for cmb
$styles = array();
// if we're 3.5 or later, user wp-color-picker
if (3.5 <= $wp_version) {
$scripts[] = 'wp-color-picker';
$styles[] = 'wp-color-picker';
if (!is_admin()) {
// we need to register colorpicker on the front-end
wp_register_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), self::CMB_VERSION);
wp_register_script('wp-color-picker', admin_url('js/color-picker.min.js'), array('iris'), self::CMB_VERSION);
wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array('clear' => __('Clear'), 'defaultString' => __('Default'), 'pick' => __('Select Color'), 'current' => __('Current Color')));
}
} else {
// otherwise use the older 'farbtastic'
$scripts[] = 'farbtastic';
$styles[] = 'farbtastic';
}
wp_register_script('cmb-datepicker', CMB_META_BOX_URL . 'js/jquery.datePicker.min.js');
wp_register_script('cmb-timepicker', CMB_META_BOX_URL . 'js/jquery.timePicker.min.js');
// themeva_mod
global $post_type;
$meta_boxes = array();
$meta_boxes = apply_filters('cmb_meta_boxes', $meta_boxes);
$count = 0;
$menu = $meta_box_ids = '';
foreach ($meta_boxes as $meta_box) {
foreach ($meta_box['pages'] as $type) {
if ($type == $post_type) {
// Heading for Navigation
$menu .= '<a id="' . $meta_box['id'] . '-tab" class="nav-tab" title="' . esc_attr($meta_box['title']) . '" href="' . esc_attr('#' . $meta_box['id']) . '">' . esc_html($meta_box['title']) . '</a>';
// Collect Metabox ID's
$meta_box_ids .= '#' . $meta_box['id'] . ',';
// Count Meta Boxes for Post Type
$count++;
}
}
}
$meta_box_ids = rtrim($meta_box_ids, ',');
global $post_type;
if ('slide-sets' == $post_type) {
wp_enqueue_style('nv_theme_settings_css', get_template_directory_uri() . '/lib/adm/css/nv-theme-settings.css');
wp_register_script('themeva-slide-manager', get_template_directory_uri() . '/lib/adm/js/slide-manager.js');
wp_enqueue_script('themeva-slide-manager');
wp_enqueue_script('jquery-ui-dialog');
wp_enqueue_style('wp-jquery-ui-dialog');
}
// themeva_mod * end
wp_register_script('cmb-scripts', CMB_META_BOX_URL . 'js/cmb' . $min . '.js', $scripts, self::CMB_VERSION);
wp_enqueue_media();
wp_localize_script('cmb-scripts', 'cmb_l10', apply_filters('cmb_localized_data', array('ajax_nonce' => wp_create_nonce('ajax_nonce'), 'script_debug' => defined('SCRIPT_DEBUG') && SCRIPT_DEBUG, 'new_admin_style' => version_compare($wp_version, '3.7', '>'), 'object_type' => self::get_object_type(), 'upload_file' => 'Use this file', 'remove_image' => 'Remove Image', 'remove_file' => 'Remove', 'file' => 'File:', 'download' => 'Download', 'ajaxurl' => admin_url('/admin-ajax.php'), 'up_arrow' => '[ ↑ ] ', 'down_arrow' => ' [ ↓ ]', 'check_toggle' => __('Select / Deselect All', 'cmb'), 'meta_box_ids' => $meta_box_ids, 'meta_box_menu' => $menu, 'meta_box_count' => $count)));
wp_register_style('cmb-styles', CMB_META_BOX_URL . 'style' . $min . '.css', $styles);
// Ok, we've enqueued our scripts/styles
self::$is_enqueued = true;
}
示例2: register_scripts
/**
* Registers scripts and styles for CMB
* @since 1.0.0
*/
public function register_scripts()
{
// Should only be run once
if (self::$is_enqueued) {
return;
}
global $wp_version;
// Only use minified files if SCRIPT_DEBUG is off
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// scripts required for cmb
$scripts = array('jquery', 'jquery-ui-core', 'cmb-datepicker', 'cmb-timepicker');
// styles required for cmb
$styles = array();
// if we're 3.5 or later, user wp-color-picker
if (3.5 <= $wp_version) {
$scripts[] = 'wp-color-picker';
$styles[] = 'wp-color-picker';
if (!is_admin()) {
// we need to register colorpicker on the front-end
wp_register_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), self::CMB_VERSION);
wp_register_script('wp-color-picker', admin_url('js/color-picker.min.js'), array('iris'), self::CMB_VERSION);
wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array('clear' => __('Clear'), 'defaultString' => __('Default'), 'pick' => __('Select Color'), 'current' => __('Current Color')));
}
} else {
// otherwise use the older 'farbtastic'
$scripts[] = 'farbtastic';
$styles[] = 'farbtastic';
}
wp_register_script('cmb-datepicker', CMB_META_BOX_URL . 'js/jquery.datePicker.min.js');
wp_register_script('cmb-timepicker', CMB_META_BOX_URL . 'js/jquery.timePicker.min.js');
wp_register_script('cmb-scripts', CMB_META_BOX_URL . 'js/cmb' . $min . '.js', $scripts, self::CMB_VERSION);
wp_enqueue_media();
wp_localize_script('cmb-scripts', 'cmb_l10', apply_filters('cmb_localized_data', array('ajax_nonce' => wp_create_nonce('ajax_nonce'), 'script_debug' => defined('SCRIPT_DEBUG') && SCRIPT_DEBUG, 'new_admin_style' => version_compare($wp_version, '3.7', '>'), 'object_type' => self::get_object_type(), 'upload_file' => 'Use this file', 'remove_image' => 'Remove Image', 'remove_file' => 'Remove', 'file' => 'File:', 'download' => 'Download', 'ajaxurl' => admin_url('/admin-ajax.php'), 'up_arrow' => '[ ↑ ] ', 'down_arrow' => ' [ ↓ ]', 'check_toggle' => __('Select / Deselect All', 'cmb'))));
wp_register_style('cmb-styles', CMB_META_BOX_URL . 'style' . $min . '.css', $styles);
// Ok, we've enqueued our scripts/styles
self::$is_enqueued = true;
}
示例3: register_scripts
/**
* Registers scripts and styles for CMB
* @since 1.0.0
*/
public function register_scripts()
{
// Should only be run once
if (self::$is_enqueued) {
return;
}
global $wp_version;
// Only use minified files if SCRIPT_DEBUG is off
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// scripts required for cmb
$scripts = array('jquery', 'jquery-ui-core', 'cmb-datepicker', 'cmb-timepicker');
// styles required for cmb
$styles = array();
wp_register_script('cmb-datepicker', CMB_META_BOX_URL . 'js/jquery.datePicker.min.js');
wp_register_script('cmb-timepicker', CMB_META_BOX_URL . 'js/jquery.timePicker.min.js');
wp_register_script('cmb-scripts', CMB_META_BOX_URL . 'js/cmb' . $min . '.js', $scripts, self::CMB_VERSION);
wp_enqueue_media();
wp_localize_script('cmb-scripts', 'cmb_l10', apply_filters('cmb_localized_data', array('ajax_nonce' => wp_create_nonce('ajax_nonce'), 'script_debug' => defined('SCRIPT_DEBUG') && SCRIPT_DEBUG, 'new_admin_style' => version_compare($wp_version, '3.7', '>'), 'object_type' => self::get_object_type(), 'upload_file' => 'Use this file', 'remove_image' => 'Remove Image', 'remove_file' => 'Remove', 'file' => 'File:', 'download' => 'Download', 'ajaxurl' => admin_url('/admin-ajax.php'), 'up_arrow' => '[ ↑ ] ', 'down_arrow' => ' [ ↓ ]', 'check_toggle' => __('Select / Deselect All', 'cmb'))));
wp_register_style('cmb-styles', CMB_META_BOX_URL . 'style' . $min . '.css', $styles);
// Ok, we've enqueued our scripts/styles
self::$is_enqueued = true;
}