コード例 #1
0
 function add_styles($current_page_hook)
 {
     $current_option = get_option('upme_options');
     /* admin panel css */
     wp_register_style('upme_admin', upme_url . 'admin/css/upme-admin.css');
     wp_enqueue_style('upme_admin');
     if (!wp_script_is('upme_admin_tipsy_js') && '0' == $current_option['disable_tipsy_script_styles']) {
         wp_register_script('upme_admin_tipsy_js', upme_url . 'js/jquery.tipsy.js', array('jquery'));
         wp_enqueue_script('upme_admin_tipsy_js');
     }
     if (!wp_script_is('upme_admin_tipsy') && '0' == $current_option['disable_tipsy_script_styles']) {
         wp_register_style('upme_admin_tipsy', upme_url . 'css/tipsy.css');
         wp_enqueue_style('upme_admin_tipsy');
     }
     wp_register_script('upme_admin', upme_url . 'admin/js/upme-admin.js');
     wp_enqueue_script('upme_admin');
     // Add scripts for various modules
     wp_register_script('upme_admin_modules', upme_url . 'admin/js/upme-admin-modules.js');
     wp_enqueue_script('upme_admin_modules');
     $admin_options_array = array('profileKey' => __('New Custom Meta Key', 'upme'), 'separatorKey' => __('Meta Key', 'upme'), 'profileLabel' => __('Label', 'upme'), 'separatorLabel' => __('Separator Text', 'upme'), 'profileHelp' => PROFILE_HELP, 'separatorHelp' => SEPARATOR_HELP, 'AdminAjax' => admin_url('admin-ajax.php'), 'savingSetting' => __('Saving...', 'upme'), 'saveSetting' => __('Save Changes', 'upme'), 'resettingSetting' => __('Resetting...', 'upme'), 'resetSetting' => __('Reset Options', 'upme'), 'adminURL' => get_admin_url('', 'admin.php?page=upme-settings'), 'fieldDeleteConfirm' => __('Are you sure you want to delete this field?', 'upme'), 'cacheCompletedUsers' => __('users Completed', 'upme'), 'fieldUpdateProcessing' => __(' Processing.....', 'upme'), 'fieldUpdateCompleted' => __(' Update Completed', 'upme'), 'customFileFieldTypes' => $this->custom_file_field_types);
     wp_localize_script('upme_admin', 'UPMEAdmin', $admin_options_array);
     $admin_modules_options_array = array('AdminAjax' => admin_url('admin-ajax.php'), 'adminURL' => get_admin_url('', 'admin.php?page=upme-modules'), 'userRoleRequired' => __('User role is required.', 'upme'), 'redirectURLRequired' => __('Redirect URL is required.', 'upme'), 'pageRequired' => __('Restricted Pages are required.', 'upme'), 'postRequired' => __('Restricted Posts are required.', 'upme'), 'categoriesRequired' => __('Restricted Categories are required.', 'upme'), 'savingResRule' => __('Adding Restriction Rule', 'upme'), 'saveResRule' => __('Add Restriction Rule', 'upme'), 'savingSetting' => __('Saving...', 'upme'), 'saveSetting' => __('Save Changes', 'upme'), 'resettingSetting' => __('Resetting...', 'upme'), 'resetSetting' => __('Reset Options', 'upme'), 'emailTitleRequired' => __('Email Template Title is required', 'upme'), 'emailSubjectRequired' => __('Email Subject is required', 'upme'), 'downloadFields' => __('Downloading Fields', 'upme'), 'downloadSettings' => __('Downloading Settings', 'upme'));
     wp_localize_script('upme_admin_modules', 'UPMEAdminModules', $admin_modules_options_array);
     wp_register_style('upme_font_awesome', upme_url . 'css/font-awesome.min.css');
     wp_enqueue_style('upme_font_awesome');
     /* google fonts */
     if ('0' == $current_option['disable_opensans_google_font']) {
         wp_register_style('upme_google_fonts', '//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700&subset=latin,latin-ext');
         wp_enqueue_style('upme_google_fonts');
     }
     /* Drag & Drop */
     //wp_register_script('upme_drag_drop', upme_url . 'admin/js/drag-drop.js');
     //wp_enqueue_script('upme_drag_drop');
     wp_enqueue_script('jquery-ui-sortable');
     /* Tabify */
     wp_register_script('upme_tabify', upme_url . 'admin/js/upme-tabify.js', array('jquery', 'upme_admin'));
     wp_enqueue_script('upme_tabify');
     if ('profile.php' == $current_page_hook || 'user-edit.php' == $current_page_hook) {
         wp_register_style('upme_date_picker', upme_url . 'css/upme-datepicker.css');
         wp_enqueue_style('upme_date_picker');
         wp_register_script('upme_date_picker_js', upme_url . 'js/upme-datepicker.js', array('jquery'));
         wp_enqueue_script('upme_date_picker_js');
         wp_localize_script('upme_date_picker_js', 'UPMEDatePicker', upme_date_picker_setting());
     }
     $lang_strings = upme_tinymce_language_setting();
     wp_register_script('upme_tmce', upme_url . 'admin/js/tinymce_language_strings.js');
     wp_enqueue_script('upme_tmce');
     wp_localize_script('upme_tmce', 'UPMETmce', $lang_strings);
     // Add scripts for chosen library
     wp_register_script('upme_chosen_js', upme_url . 'admin/js/chosen/chosen.jquery.js');
     wp_enqueue_script('upme_chosen_js');
     wp_register_style('upme_chosen_css', upme_url . 'admin/js/chosen/chosen.css');
     wp_enqueue_style('upme_chosen_css');
     do_action('upme_admin_add_styles');
 }
コード例 #2
0
ファイル: class-upme.php プロジェクト: nikwin333/pcu_project
 function add_style_scripts_frontend()
 {
     $upme_settings = get_option('upme_options');
     /* Google fonts */
     if ('0' == $upme_settings['disable_opensans_google_font']) {
         wp_register_style('upme_google_fonts', '//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700&subset=latin,latin-ext');
         wp_enqueue_style('upme_google_fonts');
     }
     /* Font Awesome */
     wp_register_style('upme_font_awesome', upme_url . 'css/font-awesome.min.css');
     wp_enqueue_style('upme_font_awesome');
     /* Main css file */
     wp_register_style('upme_css', upme_url . 'css/upme.css');
     wp_enqueue_style('upme_css');
     /* Add style */
     if ($this->get_option('style')) {
         wp_register_style('upme_style', upme_url . 'styles/' . $this->get_option('style') . '.css');
         wp_enqueue_style('upme_style');
     }
     /* Responsive */
     wp_register_style('upme_responsive', upme_url . 'css/upme-responsive.css');
     wp_enqueue_style('upme_responsive');
     if ($upme_settings['disable_fitvids_script_styles']) {
         wp_register_script('upme_fitvids_js', upme_url . 'js/upme-fitvids.js', array('jquery'));
         wp_enqueue_script('upme_fitvids_js');
     }
     // Add lightbox using Thickbox
     wp_enqueue_script("thickbox");
     wp_enqueue_style("thickbox");
     // Set date format from admin settings
     $upme_date_format = (string) isset($upme_settings['date_format']) ? $upme_settings['date_format'] : 'mm/dd/yy';
     $date_picker_array = upme_date_picker_setting();
     wp_localize_script('upme_date_picker_js', 'UPMEDatePicker', $date_picker_array);
     $lang_strings = upme_tinymce_language_setting();
     wp_register_script('upme_tmce', upme_url . 'admin/js/tinymce_language_strings.js');
     wp_enqueue_script('upme_tmce');
     wp_localize_script('upme_tmce', 'UPMETmce', $lang_strings);
     do_action('upme_add_style_scripts_frontend');
 }