_registry->get( 'model.settings' ); $args = array( 'title' => Ai1ec_I18n::__( 'All-in-One Event Calendar: Settings' ), 'nonce' => array( 'action' => self::NONCE_ACTION, 'name' => self::NONCE_NAME, 'referrer' => false, ), 'metabox' => array( 'screen' => $settings->get( 'settings_page' ), 'action' => 'left', 'object' => null ), 'support' => array( 'screen' => $settings->get( 'settings_page' ), 'action' => 'right', 'object' => null ), 'action' => ai1ec_admin_url( '?controller=front&action=ai1ec_save_settings&plugin=' . AI1EC_PLUGIN_NAME ), ); $loader = $this->_registry->get( 'theme.loader' ); $file = $loader->get_file( 'setting/page.twig', $args, true ); $file->render(); if ( apply_filters( 'ai1ec_robots_install', true ) ) { $this->_registry->get( 'robots.helper' )->install(); } } /* (non-PHPdoc) * @see Ai1ec_View_Admin_Abstract::add_page() */ public function add_page() { $settings_page = add_submenu_page( AI1EC_ADMIN_BASE_URL, Ai1ec_I18n::__( 'Settings' ), Ai1ec_I18n::__( 'Settings' ), 'manage_ai1ec_options', AI1EC_PLUGIN_NAME . '-settings', array( $this, 'display_page' ) ); $this->_registry->get( 'model.settings' ) ->set( 'settings_page', $settings_page ); } /** * Adds metabox to the page. * * @wp_hook admin_init * * @return void */ public function add_meta_box() { // Add the 'General Settings' meta box. add_meta_box( 'ai1ec-general-settings', Ai1ec_I18n::_x( 'General Settings', 'meta box' ), array( $this, 'display_meta_box' ), $this->_registry->get( 'model.settings' )->get( 'settings_page' ), 'left', 'default' ); // Add the 'Timely' meta box. add_meta_box( 'ai1ec-support', Ai1ec_I18n::_x( 'Timely', 'meta box', AI1EC_PLUGIN_NAME ), array( $this, 'support_meta_box' ), $this->_registry->get( 'model.settings' )->get( 'settings_page' ), 'right', 'default' ); } /** * Renders the Timely blog meta box * * @param mixed $object * @param mixed $box */ public function support_meta_box( $object, $box ) { $newsItems = $this->_registry->get( 'news.feed' )->import_feed(); $loader = $this->_registry->get( 'theme.loader' ); $file = $loader->get_file( 'box_support.php', array( 'news' => $newsItems, ), true ); $file->render(); } /* (non-PHPdoc) * @see Ai1ec_View_Admin_Abstract::handle_post() */ public function handle_post() { } /** * Displays the meta box for the settings page. * * @param mixed $object * @param mixed $box */ public function display_meta_box( $object, $box ) { $tabs = array( 'viewing-events' => array( 'name' => Ai1ec_I18n::__( 'Viewing Events' ), ), 'editing-events' => array( 'name' => Ai1ec_I18n::__( 'Adding/Editing Events' ), ), 'advanced' => array( 'name' => Ai1ec_I18n::__( 'Advanced' ), 'items' => array( 'advanced' => Ai1ec_I18n::__( 'Advanced Settings' ), 'embedded-views' => Ai1ec_I18n::__( 'Shortcodes' ), 'email' => Ai1ec_I18n::__( 'Email Templates' ), 'apis' => Ai1ec_I18n::__( 'External Services' ), 'cache' => Ai1ec_I18n::__( 'Cache Report' ), ) ), ); // let other extensions add tabs. $tabs = apply_filters( 'ai1ec_add_setting_tabs', $tabs ); $settings = $this->_registry->get( 'model.settings' ); $plugin_settings = $settings->get_options(); $tabs = $this->_get_tabs_to_show( $plugin_settings, $tabs ); $loader = $this->_registry->get( 'theme.loader' ); $args = array( 'tabs' => $tabs, 'content_class' => 'ai1ec-form-horizontal', 'submit' => array( 'id' => 'ai1ec_save_settings', 'value' => ' ' . Ai1ec_I18n::__( 'Save Settings' ), 'args' => array( 'class' => 'ai1ec-btn ai1ec-btn-primary ai1ec-btn-lg', ), ), 'pre_tabs_markup' => sprintf( '