/** * Load the plugin CSS, JS and Help tab * @static * @since 1.0 */ public static function enqueue_scripts_styles() { $screen = get_current_screen(); if (isset(PostPlanner_Loader::$settings['post_types'])) { $planner_post_types = explode(',', PostPlanner_Loader::$settings['post_types']); } else { $planner_post_types = array(); } // if on the dashboard if ($screen->id == 'dashboard') { wp_enqueue_style('post_planner_dashboard_css', POSTPLANNER_PLUGIN_URL . '/css/post-planner-dashboard-widget.css', false, POSTPLANNER_PLUGIN_VERSION); wp_register_script('post_planner_dashboard_js', POSTPLANNER_PLUGIN_URL . '/js/post-planner-dashboard-widget.js', array('jquery'), POSTPLANNER_PLUGIN_VERSION); wp_register_script('post_planner_tablesorter_js', POSTPLANNER_PLUGIN_URL . '/js/jquery.tablesorter.min.js', array('jquery'), POSTPLANNER_PLUGIN_VERSION); wp_register_script('post_planner_metadata_js', POSTPLANNER_PLUGIN_URL . '/js/jquery.metadata.js', array('jquery'), POSTPLANNER_PLUGIN_VERSION); wp_enqueue_script('post_planner_dashboard_js'); wp_enqueue_script('post_planner_tablesorter_js'); wp_enqueue_script('post_planner_metadata_js'); wp_localize_script('post_planner_dashboard_js', 'plannerdash', PostPlanner_Loader::get_js_vars()); } // if on a Planner custom post type page or on the Post Planner settings page if ($screen->post_type == 'planner' || $screen->id == 'settings_page_post-planner-settings') { wp_enqueue_style('post-planner_css', POSTPLANNER_PLUGIN_URL . '/css/post-planner-admin.css', false, POSTPLANNER_PLUGIN_VERSION); wp_enqueue_style('jquery.ui.theme', POSTPLANNER_PLUGIN_URL . '/css/post-planner-jquery-ui-1.8.21.custom.css', false, POSTPLANNER_PLUGIN_VERSION); wp_enqueue_style('farbtastic'); wp_register_script('post-planner_js', POSTPLANNER_PLUGIN_URL . '/js/post-planner-admin.js', array('jquery'), POSTPLANNER_PLUGIN_VERSION); wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_script('farbtastic'); wp_enqueue_script('json2'); wp_enqueue_script('post-planner_js'); wp_localize_script('post-planner_js', 'postplanner', PostPlanner_Loader::get_js_vars()); PostPlanner_Help::help_tab(); } // if on the Planner custom post type listings page if ($screen->id == 'edit-planner') { wp_register_script('post-planner-quickedit_js', POSTPLANNER_PLUGIN_URL . '/js/post-planner-quickedit.js', false, POSTPLANNER_PLUGIN_VERSION); wp_enqueue_script('post-planner-quickedit_js'); } // if on an allowed post type editing page if (in_array($screen->post_type, $planner_post_types) && in_array($screen->id, $planner_post_types)) { wp_enqueue_style('jquery.ui.theme', POSTPLANNER_PLUGIN_URL . '/css/post-planner-jquery-ui-1.8.21.custom.css', false, POSTPLANNER_PLUGIN_VERSION); wp_enqueue_style('post-planner-post_css', POSTPLANNER_PLUGIN_URL . '/css/post-planner-post.css', false, POSTPLANNER_PLUGIN_VERSION); wp_register_script('post-planner-post_js', POSTPLANNER_PLUGIN_URL . '/js/post-planner-post.js', false, POSTPLANNER_PLUGIN_VERSION); wp_register_script('jquery-insertatcaret', POSTPLANNER_PLUGIN_URL . '/js/jquery.insertatcaret.min.js', false, POSTPLANNER_PLUGIN_VERSION); wp_enqueue_script('post-planner-post_js'); wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_script('jquery-insertatcaret'); wp_localize_script('post-planner-post_js', 'planner', PostPlanner_Loader::get_post_js_vars()); } }