init(); } /** * Initialise the sitewide admin panel: register actions and filters */ function init() { if (is_null($this->settings)) $this->settings = AA_settings(); add_action('admin_menu', array(&$this, 'add_submenu')); } /** * Adds the settings page to the "Site Admin" menu */ function add_submenu() { get_currentuserinfo(); if (!is_super_admin()) return false; // only for site admins add_submenu_page('wpmu-admin.php', __('Sitewide Author Avatars Configuration', 'author-avatars'), __('Author Avatars List', 'author-avatars'), 'manage_options', 'wpmu_author_avatars', array(&$this,'config_page')); } /** * Renders the sitewide configuration page */ function config_page() { if ($_POST['action'] == 'update') $updated = $this->save_settings(); else $updated = false; $this->render_config_page($updated); } function save_settings() { check_admin_referer(); $settings = $_POST['settings_sitewide']; return $this->settings->save_sitewide($settings); } function render_config_page($updated) { require_once('FormHelper.class.php'); echo '
'; if ($updated === true) { echo '

'. __('Options saved.', 'author-avatars') .'

'; } elseif (is_array($updated)) { echo '

'. implode('
',$updated) .'

'; } echo '

'. __('Sitewide Author Avatars Options', 'author-avatars') .'

'; echo '
'; echo '

'. __('Avatar list settings', 'author-avatars') .'

'; echo ''; $this->_render_blogfilter_active_setting(); echo '
'; echo FormHelper::input('hidden', 'action', 'update'); echo '

'; echo FormHelper::input('submit', 'wpmu_author_avatars_settings_save', __('Save Changes', 'author-avatars')); echo '

'; echo '
'; echo '
'; } function _render_blogfilter_active_setting() { require_once('AuthorAvatarsForm.class.php'); echo ''; echo ''. __('Enable blog filter', 'author-avatars') . ''; echo FormHelper::choice( 'settings_sitewide[blog_filters_enabled]', AuthorAvatarsForm::_getAllBlogs(), $this->settings->get_sitewide('blog_filters_enabled'), array( 'multiple' => true, 'label' => __('Select the blogs which you would like the blog filter to be enabled. Only blogs selected here can display users from other blogs.', 'author-avatars'), ) ); echo ''; echo ''; } } ?>