Exemple #1
0
function synved_option_admin_enqueue_scripts()
{
    $uri = synved_option_path_uri();
    wp_register_style('synved-option-jquery-ui', $uri . '/jqueryUI/css/snvdopt/jquery-ui-1.9.2.custom.min.css', false, '1.9.2');
    wp_register_style('synved-option-admin', $uri . '/style/admin.css', array('wp-jquery-ui-dialog', 'synved-option-jquery-ui'), '1.0');
    wp_register_script('synved-option-script-custom', $uri . '/script/custom.js', array('jquery', 'suggest', 'media-upload', 'thickbox', 'jquery-ui-core', 'jquery-ui-progressbar', 'jquery-ui-dialog'), '1.0.0');
    wp_localize_script('synved-option-script-custom', 'SynvedOptionVars', array('flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'ajaxurl' => admin_url('admin-ajax.php'), 'synvedSecurity' => wp_create_nonce('synved-option-submit-nonce')));
    $page = isset($_GET['page']) ? $_GET['page'] : null;
    $enqueue = false;
    global $synved_option_list;
    if ($synved_option_list != null) {
        foreach ($synved_option_list as $id => $list) {
            if (isset($list['pages']) && $list['pages'] != null) {
                $page_list = $list['pages'];
                foreach ($page_list as $name => $page_object) {
                    if ($page == synved_option_page_slug($id, $name)) {
                        $enqueue = true;
                        break;
                    }
                }
            }
        }
    }
    if ($enqueue) {
        wp_enqueue_style('thickbox');
        wp_enqueue_style('farbtastic');
        wp_enqueue_style('wp-pointer');
        wp_enqueue_style('synved-option-jquery-ui');
        wp_enqueue_style('synved-option-admin');
        wp_enqueue_script('plupload-all');
        wp_enqueue_script('media-upload');
        wp_enqueue_script('suggest');
        wp_enqueue_script('thickbox');
        wp_enqueue_script('farbtastic');
        wp_enqueue_script('synved-option-script-custom');
    }
}
 function synved_option_enqueue_scripts_type_addon()
 {
     $uri = synved_option_path_uri('addons/' . basename(dirname(__FILE__)));
     wp_register_style('synved-option-type-addon-admin', $uri . '/style/admin.css', array('jquery-ui', 'wp-jquery-ui-dialog'), '1.0');
     wp_register_script('synved-option-type-addon-script-custom', $uri . '/script/custom.js', array('jquery', 'thickbox', 'jquery-ui-core', 'jquery-ui-progressbar', 'jquery-ui-dialog'), '1.0.0');
     //wp_enqueue_style('synved-option-type-addon-admin');
     wp_enqueue_script('plupload-all');
     wp_enqueue_script('synved-option-type-addon-script-custom');
 }