/**
 * Define constants and load the plugin
 * @since 1.0
 */
function postplanner_todo_loader()
{
    if (is_admin()) {
        require 'update-notifier.php';
        if (!defined('POSTPLANNER_PLUGIN_VERSION')) {
            define('POSTPLANNER_PLUGIN_VERSION', '1.4');
        }
        if (!defined('POSTPLANNER_FILE')) {
            define('POSTPLANNER_FILE', __FILE__);
        }
        if (!defined('POSTPLANNER_BASENAME')) {
            define('POSTPLANNER_BASENAME', plugin_basename(__FILE__));
        }
        if (!defined('POSTPLANNER_PLUGIN_DIR')) {
            define('POSTPLANNER_PLUGIN_DIR', plugin_dir_path(__FILE__));
        }
        if (!defined('POSTPLANNER_PLUGIN_URL')) {
            define('POSTPLANNER_PLUGIN_URL', plugins_url('', __FILE__));
        }
        $languages_path = plugin_basename(dirname(__FILE__) . '/languages');
        load_plugin_textdomain('post-planner', '', $languages_path);
        include_once 'includes/post-planner-loader.class.php';
        PostPlanner_Loader::init();
    }
}
 function __construct()
 {
     $widget_ops = array('description' => esc_attr__('Displays Upcoming Posts', 'post-planner'));
     parent::__construct('post-planner-widget', esc_attr__('Post Planner', 'post-planner'), $widget_ops);
     include_once 'post-planner-library.class.php';
     include_once 'post-planner-loader.class.php';
     $general_options = get_option('PostPlanner_general') ? get_option('PostPlanner_general') : array();
     $advanced_options = get_option('PostPlanner_advanced') ? get_option('PostPlanner_advanced') : array();
     $this->settings = array_merge($general_options, $advanced_options);
     $this->statuses = PostPlanner_Loader::setup_statuses();
 }
 /**
  * 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());
     }
 }