Ejemplo n.º 1
0
function hocwp_admin_enqueue_scripts()
{
    global $pagenow;
    $current_page = hocwp_get_current_admin_page();
    $use = apply_filters('hocwp_use_jquery_ui', false);
    if ($use || 'themes.php' == $pagenow && 'hocwp_theme_setting' == $current_page) {
        wp_enqueue_script('jquery-ui-core');
    }
    $use = apply_filters('hocwp_use_jquery_ui_sortable', false);
    if ($use) {
        wp_enqueue_script('jquery-ui-sortable');
    }
    $use = apply_filters('hocwp_use_color_picker', false);
    if ($use) {
        wp_enqueue_script('wp-color-picker');
        wp_enqueue_style('wp-color-picker');
    }
    $use = apply_filters('hocwp_wp_enqueue_media', false);
    if ($use || 'link.php' == $pagenow || 'link-add.php' == $pagenow) {
        wp_enqueue_media();
    }
    $datetime_picker = apply_filters('hocwp_admin_jquery_datetime_picker', false);
    if ($datetime_picker) {
        hocwp_enqueue_jquery_ui_datepicker();
    }
    hocwp_register_core_style_and_script();
    wp_register_style('hocwp-admin-style', HOCWP_URL . '/css/hocwp-admin' . HOCWP_CSS_SUFFIX, array('hocwp-style'), HOCWP_VERSION);
    wp_register_script('hocwp-admin', HOCWP_URL . '/js/hocwp-admin' . HOCWP_JS_SUFFIX, array('jquery', 'hocwp'), HOCWP_VERSION, true);
    wp_localize_script('hocwp', 'hocwp', hocwp_default_script_localize_object());
    $use = apply_filters('hocwp_use_admin_style_and_script', false);
    if ('link-manager.php' == $pagenow || 'link-add.php' == $pagenow) {
        $use = true;
    }
    if ($use || 'post-new.php' == $pagenow || 'post.php' == $pagenow || 'link.php' == $pagenow || 'link-add.php' == $pagenow) {
        wp_enqueue_style('hocwp-admin-style');
        wp_enqueue_script('hocwp-admin');
    } elseif ('wpsupercache' == $current_page) {
        wp_enqueue_style('hocwp-admin-style');
    }
}
 public function admin_enqueue_scripts()
 {
     hocwp_register_core_style_and_script();
     hocwp_admin_enqueue_scripts();
     wp_register_style('hocwp-admin-style', HOCWP_URL . '/css/hocwp-admin' . HOCWP_CSS_SUFFIX, array('hocwp-style'), $this->version);
     wp_register_script('hocwp-admin', HOCWP_URL . '/js/hocwp-admin' . HOCWP_JS_SUFFIX, array('jquery', 'hocwp'), $this->version, true);
     wp_register_style($this->textdomain . '-style', $this->url . '/css/hocwp-plugin-admin' . HOCWP_CSS_SUFFIX, array('hocwp-admin-style'), $this->version);
     wp_register_script($this->textdomain, $this->url . '/js/hocwp-plugin-admin' . HOCWP_JS_SUFFIX, array('hocwp-admin'), $this->version, true);
     wp_localize_script($this->textdomain, 'hocwp', hocwp_default_script_localize_object());
     wp_enqueue_style($this->textdomain . '-style');
     wp_enqueue_script($this->textdomain);
 }
Ejemplo n.º 3
0
function hocwp_theme_default_script_localize_object()
{
    $defaults = hocwp_default_script_localize_object();
    $args = array('home_url' => esc_url(home_url('/')), 'login_logo_url' => hocwp_get_login_logo_url(), 'login_url' => wp_login_url(), 'facebook_appid' => hocwp_get_wpseo_social_facebook_app_id(), 'mobile_menu_icon' => '<button class="menu-toggle mobile-menu-button" aria-expanded="false" aria-controls=""><i class="fa fa fa-bars"></i><span class="text">' . __('Menu', 'hocwp-theme') . '</span></button>', 'search_form' => get_search_form(false));
    $args = wp_parse_args($args, $defaults);
    return apply_filters('hocwp_theme_default_script_object', $args);
}