Beispiel #1
0
 function print_scripts()
 {
     if ($this->print_scripts_initialized == true) {
         return false;
     }
     $this->print_scripts_initialized = true;
     // Register & enqueue scripts
     op_enqueue_base_scripts();
     op_enqueue_backend_scripts();
     op_enqueue_fancybox_images();
     // Styles
     wp_enqueue_style(OP_SN . '-admin-assets', OP_CSS . 'assets' . OP_SCRIPT_DEBUG . '.css', array(OP_SN . '-admin-common'), OP_VERSION);
     wp_register_style(OP_SN . '-admin-common', OP_CSS . 'common' . OP_SCRIPT_DEBUG . '.css', array('farbtastic', 'thickbox'), OP_VERSION);
 }
Beispiel #2
0
 function print_scripts()
 {
     wp_enqueue_style(OP_SN . '-admin-assets', OP_CSS . 'assets' . OP_SCRIPT_DEBUG . '.css', array(OP_SN . '-admin-common'), OP_VERSION);
     op_enqueue_backend_scripts();
     op_enqueue_fancybox_images();
 }
Beispiel #3
0
function op_register_scripts()
{
    op_enqueue_base_scripts();
    // AKISMET 3.0 and higher fix... we are deregistering their comment_form
    // script in framework, and returning it here under a different handle
    // AKISMET removed constant AKISMET__PLUGIN_URL in v3.1.8
    if (defined('AKISMET_VERSION') && version_compare(AKISMET_VERSION, '3.0.0') >= 0) {
        if (defined('AKISMET__PLUGIN_URL')) {
            wp_register_script('akismet-form-2', AKISMET__PLUGIN_URL . '_inc/form.js', array(OP_SCRIPT_BASE), AKISMET_VERSION);
            wp_enqueue_script('akismet-form-2');
        } else {
            if (class_exists('Akismet')) {
                Akismet::load_form_js();
                wp_enqueue_script('akismet-form');
            }
        }
    }
    op_enqueue_fancybox_images();
    // if (OP_SCRIPT_DEBUG === '') {
    // If jQuery version is higher than 1.9 we require jQuery migrate plugin
    // (which is by default registered in WP versions that come with jQuery 1.9 or higher)
    // if (wp_script_is('jquery-migrate', 'registered')) {
    //     wp_enqueue_script(OP_SN.'-noconflict-js', OP_JS.'jquery/jquery.noconflict'.OP_SCRIPT_DEBUG.'.js', array('jquery', 'jquery-migrate'), OP_VERSION);
    // } else {
    //     wp_enqueue_script(OP_SN.'-noconflict-js', OP_JS.'jquery/jquery.noconflict'.OP_SCRIPT_DEBUG.'.js', array('jquery'), OP_VERSION);
    // }
    // wp_enqueue_script(OP_SN.'-loadScript', OP_JS.'jquery/jquery.loadScript'.OP_SCRIPT_DEBUG.'.js', array(OP_SN.'-noconflict-js'), OP_VERSION);
    // wp_enqueue_script(OP_SN.'-placeholder', OP_JS.'jquery/jquery.placeholder.min.js', array(OP_SN.'-noconflict-js'), OP_VERSION, true);
    // wp_enqueue_script(OP_SN.'-fancybox', OP_JS.'fancybox/jquery.fancybox'.OP_SCRIPT_DEBUG.'.js', array(OP_SN.'-noconflict-js'), OP_VERSION, true);
    // wp_register_script( OP_SN.'-fancybox-op', OP_JS.'fancybox/helpers/jquery.fancybox-op'.OP_SCRIPT_DEBUG.'.js', array(OP_SN.'-noconflict-js', OP_SN.'-fancybox'), OP_VERSION);
    // Fancybox for images
    // $fancybox_images = op_default_option('fancybox_images');
    // if (is_array($fancybox_images) && $fancybox_images['enabled'] === 'Y') {
    //     wp_enqueue_script(OP_SN.'-fancybox-images', OP_JS.'fancybox_images'.OP_SCRIPT_DEBUG.'.js', array(OP_SN.'-noconflict-js', OP_SN.'-fancybox'), OP_VERSION, true);
    // }
    // } else {
    //If jQuery version is higher than 1.9 we require jQuery migrate plugin (which is by default registered in WP versions that come with jQuery 1.9 or higher)
    // if (wp_script_is('jquery-migrate', 'registered')) {
    //     wp_enqueue_script(OP_SN.'-op-jquery-base-all', OP_JS.'op-jquery-base-all.min.js', array('jquery', 'jquery-migrate'), OP_VERSION);
    // } else {
    //     wp_enqueue_script(OP_SN.'-op-jquery-base-all', OP_JS.'op-jquery-base-all.min.js', array('jquery'), OP_VERSION);
    // }
    // AKISMET 3.0 and higher fix... we are deregistering their comment_form
    // script in framework, and returning it here under a different handle
    // if (defined('AKISMET_VERSION') && version_compare(AKISMET_VERSION, '3.0.0') >= 0) {
    //     wp_register_script('akismet-form-2', AKISMET__PLUGIN_URL . '_inc/form.js', array(OP_SN.'-op-jquery-base-all'), AKISMET_VERSION);
    //     wp_enqueue_script('akismet-form-2');
    // }
    // Fancybox for images
    // $fancybox_images = op_default_option('fancybox_images');
    // if (is_array($fancybox_images) && $fancybox_images['enabled'] === 'Y') {
    //     wp_enqueue_script(OP_SN.'-fancybox-images', OP_JS.'fancybox_images'.OP_SCRIPT_DEBUG.'.js', array(OP_SN.'-op-jquery-base-all'), OP_VERSION, true);
    // }
    // }
    add_action('admin_print_scripts', 'op_localize_script', 5, 'front');
}