booked_screens = array('booked-feeds'); add_action('init', array(&$this, 'booked_ical_feed') ); add_action('admin_enqueue_scripts', array(&$this, 'admin_styles')); add_action('admin_menu', array(&$this, 'add_feeds_menu')); } public function booked_ical_feed(){ if (isset($_GET['booked_ical'])): include(BOOKEDICAL_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'calendar-feed.php'); exit; endif; } // Add a New Menu Item public function add_feeds_menu() { add_submenu_page('booked-appointments', __('Calendar Feeds','booked-calendar-feeds'), __('Calendar Feeds','booked-calendar-feeds'), 'manage_options', 'booked-feeds', array(&$this, 'plugin_feeds_page')); } // Booked Feeds Page public function plugin_feeds_page() { if(!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.', 'booked-calendar-feeds')); } include(sprintf("%s/admin/feeds.php", BOOKEDICAL_PLUGIN_DIR)); } public function admin_styles() { $current_page = (isset($_GET['page']) ? $_GET['page'] : false); $screen = get_current_screen(); if (in_array($current_page,$this->booked_screens)): wp_enqueue_style('booked-icons', BOOKED_PLUGIN_URL . '/assets/css/icons.css', array(), BOOKED_VERSION); wp_enqueue_style('booked-admin', BOOKED_PLUGIN_URL . '/assets/css/admin-styles.css', array(), BOOKED_VERSION); endif; } } } } else { // Show notice when Booked and/or WooCommerce is not active add_action('admin_notices', 'bookedical_required_plugins_notice'); } add_action('plugins_loaded','init_bookedical'); function init_bookedical(){ if(class_exists('bookedical_plugin')) { // instantiate the plugin class $bookedical_plugin = new bookedical_plugin(); } } function bookedical_required_plugins_notice() { echo '
'; echo sprintf( __('In order to use the %s plugin, you need to have %s installed and active.'), 'Booked Calendar Feed', 'Booked' ); echo '
'; }