示例#1
0
 /**
  *
  * @global array $submenu
  * @param string $tmpl
  * @param mvb_Model_Manager $parent
  * @return string
  */
 public static function render($tmpl, $parent)
 {
     global $wp_post_types;
     self::$parent = $parent;
     //get cache. Compatible with version previouse versions
     $cache = mvb_Model_API::getBlogOption(WPACCESS_PREFIX . 'cache', NULL);
     if (!is_array($cache)) {
         //yeap this is new version
         $cache = mvb_Model_API::getBlogOption(WPACCESS_PREFIX . 'options', array());
         $cache = isset($cache['settings']) ? $cache['settings'] : array();
         mvb_Model_API::updateBlogOption(WPACCESS_PREFIX . 'cache', $cache);
     }
     $row_tmpl = mvb_Model_Template::retrieveSub('METABOX_LIST_ITEM', $tmpl);
     $list = '';
     if (isset($cache['metaboxes']) && is_array($cache['metaboxes'])) {
         $list_tmpl = mvb_Model_Template::retrieveSub('POST_METABOXES_LIST', $row_tmpl);
         $item_tmpl = mvb_Model_Template::retrieveSub('POST_METABOXES_ITEM', $list_tmpl);
         $widget_tmpl = mvb_Model_Template::retrieveSub('WIDGET_ITEM', $list_tmpl);
         foreach ($cache['metaboxes'] as $type => $metaboxes) {
             $render = TRUE;
             switch ($type) {
                 case 'widgets':
                     $temp = self::renderWidget($widget_tmpl, $metaboxes);
                     $label = mvb_Model_Label::get('LABEL_79');
                     break;
                 case 'dashboard':
                     $temp = self::renderMetabox($item_tmpl, $metaboxes, $type);
                     $label = mvb_Model_Label::get('LABEL_116');
                     break;
                 default:
                     if (isset($wp_post_types[$type])) {
                         $temp = self::renderMetabox($item_tmpl, $metaboxes, $type);
                         $label = $wp_post_types[$type]->labels->name;
                     } else {
                         $render = FALSE;
                     }
                     break;
             }
             if ($render) {
                 $temp = mvb_Model_Template::replaceSub('POST_METABOXES_LIST', $temp, $row_tmpl);
                 $list .= mvb_Model_Template::updateMarkers(array('###post_type_label###' => $label), $temp);
             }
         }
         $content = mvb_Model_Template::replaceSub('METABOX_LIST_ITEM', $list, $tmpl);
         $content = mvb_Model_Template::replaceSub('METABOX_LIST_EMPTY', '', $content);
     } else {
         $empty_tmpl = mvb_Model_Template::retrieveSub('METABOX_LIST_EMPTY', $tmpl);
         $content = mvb_Model_Template::replaceSub('METABOX_LIST_ITEM', '', $tmpl);
         $content = mvb_Model_Template::replaceSub('METABOX_LIST_EMPTY', $empty_tmpl, $content);
     }
     return $content;
 }
 /**
  * Redirect
  * 
  * @param string $area
  */
 public function doRedirect()
 {
     if (is_admin()) {
         if (isset($this->config->backend->access->deny->redirect)) {
             $redirect = $this->config->backend->access->deny->redirect;
             $this->parseRedirect($redirect);
         }
     } else {
         if (isset($this->config->frontend->access->deny->redirect)) {
             $redirect = $this->config->frontend->access->deny->redirect;
             $this->parseRedirect($redirect);
         }
     }
     mvb_Model_Label::initLabels();
     wp_die(mvb_Model_Label::get('LABEL_127'));
 }
示例#3
0
 public static function renderRow($cap, $tmpl, $parent, $allow_delete)
 {
     $desc = str_replace("\n", '<br/>', mvb_Model_Label::get($cap));
     if (!$desc) {
         $desc = mvb_Model_Label::get('LABEL_117');
     }
     $title = mvb_Model_Helper::getHumanTitle($cap);
     $markers = array('###title###' => $cap, '###premium###' => self::isPremium($cap), '###description###' => $desc, '###checked###' => $parent->getConfig()->hasCapability($cap) ? 'checked' : '', '###cap_name###' => mvb_Model_Helper::cutStr($title, 22), '###cap_name_full###' => $title);
     $content = mvb_Model_Template::updateMarkers($markers, $tmpl);
     if ($allow_delete) {
         $del_tmpl = mvb_Model_Template::retrieveSub('CAPABILITY_DELETE', $content);
         $content = mvb_Model_Template::replaceSub('CAPABILITY_DELETE', $del_tmpl, $content);
     } else {
         $content = mvb_Model_Template::replaceSub('CAPABILITY_DELETE', '', $content);
     }
     return $content;
 }
 /**
  * 
  */
 public function manager_page()
 {
     $c_role = isset($_REQUEST['role']) ? $_REQUEST['role'] : FALSE;
     $c_user = isset($_REQUEST['user']) ? $_REQUEST['user'] : FALSE;
     if (mvb_Model_API::isNetworkPanel()) {
         //require phpQuery
         require_once WPACCESS_BASE_DIR . 'library/phpQuery/phpQuery.php';
         //TODO - I don't like site
         $blog_id = isset($_GET['site']) ? $_GET['site'] : get_current_blog_id();
         $c_blog = mvb_Model_API::getBlog($blog_id);
         $m = new mvb_Model_Manager($this, $c_role, $c_user);
         $m->do_save();
         $params = array('page' => 'wp_access', 'render_mss' => 1, 'site' => $blog_id, 'role' => $c_role, 'user' => $c_user);
         $link = get_admin_url($c_blog->getID(), 'users.php');
         $url = add_query_arg($params, $link);
         $result = mvb_Model_Helper::cURL($url, TRUE, TRUE);
         if (isset($result['content']) && $result['content']) {
             $content = phpQuery::newDocument($result['content']);
             echo $content['#aam_wrap']->htmlOuter();
             unset($content);
         } else {
             wp_die(mvb_Model_Label::get('LABEL_145'));
         }
     } else {
         $m = new mvb_Model_Manager($this, $c_role, $c_user);
         $m->do_save();
         $m->manage();
     }
 }
示例#5
0
 public static function doRedirect()
 {
     if (is_admin()) {
         $redirect = mvb_Model_ConfigPress::getOption('backend.access.deny.redirect');
         $message = mvb_Model_ConfigPress::getOption('backend.access.deny.message');
     } else {
         $redirect = mvb_Model_ConfigPress::getOption('frontend.access.deny.redirect');
         $message = mvb_Model_ConfigPress::getOption('frontend.access.deny.message');
     }
     if (filter_var($redirect, FILTER_VALIDATE_URL)) {
         wp_redirect($redirect);
         exit;
     } elseif (is_int($redirect)) {
         wp_redirect(get_post_permalink($redirect));
         exit;
     }
     if (is_null($message)) {
         mvb_Model_Label::initGUILabels();
         $message = mvb_Model_Label::get('LABEL_127');
     }
     wp_die($message);
 }
示例#6
0
/*
  Copyright (C) <2011>  Vasyl Martyniuk <*****@*****.**>
 This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.
 This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once '../../../../wp-admin/admin.php';
require_once 'Zend/Markup.php';
require_once 'bbcodes.php';
wp_enqueue_style('aam-treeview', WPACCESS_CSS_URL . 'treeview/jquery.treeview.css');
wp_enqueue_style('aam-reference', WPACCESS_CSS_URL . 'reference.css');
wp_enqueue_script('jquery-treeview', WPACCESS_JS_URL . 'treeview/jquery.treeview.js', array('jquery'));
wp_enqueue_script('jquery-treeedit', WPACCESS_JS_URL . 'treeview/jquery.treeview.edit.js');
wp_enqueue_script('admin-reference', WPACCESS_JS_URL . 'admin-reference.js');
iframe_header('ConfigPress Reference');
$template = mvb_Model_Template::readTemplate(WPACCESS_TEMPLATE_DIR . 'reference.html');
mvb_Model_Label::initConfigPressGuideLabels();
$bbcode = Zend_Markup::factory('Bbcode');
foreach ($bbcode_list as $code => $config) {
    $bbcode->addMarkup($code, Zend_Markup_Renderer_RendererAbstract::TYPE_REPLACE, $config);
}
$template = mvb_Model_Label::clearLabels($template, $bbcode);
echo mvb_Model_Template::clearTemplate($template);
iframe_footer();
示例#7
0
 function do_save()
 {
     if (isset($_POST['submited'])) {
         $params = isset($_POST['wpaccess']) ? $_POST['wpaccess'] : array();
         $error_message = NULL;
         if (mvb_Model_API::isNetworkPanel() && mvb_Model_ConfigPress::getOption('aam.multisite.apply_all') == 'true') {
             $limit = apply_filters(WPACCESS_PREFIX . 'msar_restrict_limit', WPACCESS_APPLY_LIMIT);
             foreach (mvb_Model_Helper::getSiteList() as $i => $site) {
                 if ($site->blog_id == $_GET['site']) {
                     continue;
                 } elseif ($i + 1 >= WPACCESS_APPLY_LIMIT && $limit != -1) {
                     $error_message = mvb_Model_Label::get('LABEL_148');
                     break;
                 }
                 mvb_Model_API::setCurrentBlog($site->blog_id);
                 $this->initConfig();
                 $this->config->setMenu(isset($params['menu']) ? $params['menu'] : array());
                 $this->config->setMetaboxes(isset($params['metabox']) ? $params['metabox'] : array());
                 $this->config->setCapabilities(isset($params['advance']) ? $params['advance'] : array());
                 $this->config->saveConfig();
             }
         }
         //overwrite current blog
         //TODO - maybe there is better way
         if (isset($_GET['site'])) {
             mvb_Model_API::setCurrentBlog($_GET['site']);
         }
         $this->config->setMenu(isset($params['menu']) ? $params['menu'] : array());
         $this->config->setMetaboxes(isset($params['metabox']) ? $params['metabox'] : array());
         $this->config->setCapabilities(isset($params['advance']) ? $params['advance'] : array());
         $this->config->saveConfig();
         mvb_Model_ConfigPress::saveConfig(stripslashes($params['config_press']));
     } else {
         $error_message = FALSE;
     }
     return $error_message;
 }
示例#8
0
 /**
  *
  */
 public function accessManagerPage()
 {
     $c_role = mvb_Model_Helper::getParam('current_role', 'REQUEST');
     $c_user = mvb_Model_Helper::getParam('current_user', 'REQUEST');
     if (mvb_Model_API::isNetworkPanel()) {
         //TODO - I don't like site
         $blog_id = isset($_GET['site']) ? $_GET['site'] : get_current_blog_id();
         $c_blog = mvb_Model_API::getBlog($blog_id);
         $m = new mvb_Model_Manager($this, $c_role, $c_user);
         $error = $m->do_save();
         $params = array('page' => 'wp_access', 'render_mss' => 1, 'site' => $blog_id, 'show_message' => isset($_POST['submited']) && is_null($error) ? 1 : 0, 'current_role' => $c_role, 'current_user' => $c_user);
         $link = get_admin_url($c_blog->getID(), 'admin.php');
         $url = add_query_arg($params, $link);
         $result = mvb_Model_Helper::cURL($url, TRUE, TRUE);
         if (isset($result['content']) && $result['content']) {
             $content = phpQuery::newDocument($result['content']);
             if ($error) {
                 //TODO
                 $content['.plugin-notification']->append('<p>' . mvb_Model_Label::get('LABEL_167') . ' <a href="' . WPACCESS_ERROR167_URL . '" target="_blank">' . mvb_Model_Label::get('LABEL_168') . '</a></p>');
             }
             echo $content['#aam_wrap']->htmlOuter();
             unset($content);
         } else {
             wp_die(mvb_Model_Label::get('LABEL_145'));
         }
     } else {
         $m = new mvb_Model_Manager($this, $c_role, $c_user);
         $m->do_save();
         $m->manage();
     }
 }
示例#9
0
 public static function renderUserSelector($tmpl, $parent)
 {
     $tmpl = mvb_Model_Template::retrieveSub('USER_LIST', $tmpl);
     $list = '';
     $users = mvb_Model_Helper::getUserList($parent->getCurrentRole());
     $default = new stdClass();
     $default->ID = 0;
     $default->user_login = mvb_Model_Label::get('LABEL_120');
     array_unshift($users, $default);
     foreach ($users as $user) {
         $selected = $parent->getCurrentUser() == $user->ID ? 'selected' : '';
         $markers = array('###value###' => $user->ID, '###title###' => stripcslashes($user->user_login) . '&nbsp;', '###selected###' => $selected);
         $list .= mvb_Model_Template::updateMarkers($markers, $tmpl);
     }
     return $list;
 }
示例#10
0
 public function renderOptionList()
 {
     $this->template = mvb_Model_Template::retrieveSub('MAIN_OPTIONS_LIST', $this->template);
     //render Admin Menu Tab
     $tmpl = mvb_Model_Template::replaceSub('MAIN_MENU_TAB', $this->renderMenuTab(), $this->template);
     //render Metabox & Widgets Tab
     $tmpl = mvb_Model_Template::replaceSub('METABOX_TAB', $this->renderMetaboxTab(), $tmpl);
     //render Capabilities Tab
     $tmpl = mvb_Model_Template::replaceSub('CAPABILITY_TAB', $this->renderCapabilityTab(), $tmpl);
     //render Restriction Tab
     $tmpl = mvb_Model_Template::replaceSub('RESTRICTION_TAB', $this->renderRestrictionTab(), $tmpl);
     //render ConfigPress Tab
     $tmpl = mvb_Model_Template::replaceSub('CONFIG_PRESS_TAB', $this->renderConfigPressTab(), $tmpl);
     $tmpl = $this->updateMarkers($tmpl);
     $tmpl = mvb_Model_Label::clearLabels($tmpl);
     $tmpl = mvb_Model_Template::clearTemplate($tmpl);
     $result = array('html' => apply_filters(WPACCESS_PREFIX . 'option_page', $tmpl), 'status' => 'success');
     return $result;
 }
 /**
  *
  * @global type $submenu
  * @param type $template
  * @return type 
  */
 public function renderMainMenuOptions($template)
 {
     global $submenu;
     $s_menu = $this->getRoleMenu();
     /*
      * First Tab - Main Menu
      */
     $listTemplate = $this->templObj->retrieveSub('MAIN_MENU_LIST', $template);
     $itemTemplate = $this->templObj->retrieveSub('MAIN_MENU_ITEM', $listTemplate);
     $sublistTemplate = $this->templObj->retrieveSub('MAIN_MENU_SUBLIST', $itemTemplate);
     $subitemTemplate = $this->templObj->retrieveSub('MAIN_MENU_SUBITEM', $sublistTemplate);
     $list = '';
     if (is_array($s_menu)) {
         foreach ($s_menu as $menuItem) {
             if (!$menuItem[0]) {
                 //seperator
                 continue;
             }
             //render submenu
             $subList = '';
             if (isset($submenu[$menuItem[2]]) && is_array($submenu[$menuItem[2]])) {
                 foreach ($submenu[$menuItem[2]] as $submenuItem) {
                     $checked = $this->checkChecked('submenu', array($menuItem[2], $submenuItem[2]));
                     $markers = array('###submenu_name###' => $this->removeHTML($submenuItem[0]), '###value###' => $submenuItem[2], '###checked###' => $checked);
                     $subList .= $this->templObj->updateMarkers($markers, $subitemTemplate);
                 }
                 $subList = $this->templObj->replaceSub('MAIN_MENU_SUBITEM', $subList, $sublistTemplate);
             }
             $tTempl = $this->templObj->replaceSub('MAIN_MENU_SUBLIST', $subList, $itemTemplate);
             $markers = array('###name###' => $this->removeHTML($menuItem[0]), '###id###' => $menuItem[5], '###menu###' => $menuItem[2], '###whole_checked###' => $this->checkChecked('menu', array($menuItem[2])));
             $list .= $this->templObj->updateMarkers($markers, $tTempl);
         }
     }
     $listTemplate = $this->templObj->replaceSub('MAIN_MENU_ITEM', $list, $listTemplate);
     $template = $this->templObj->replaceSub('MAIN_MENU_LIST', $listTemplate, $template);
     /*
      * Second Tab - Metaboxes
      */
     $listTemplate = $this->renderMetaboxList($template);
     $template = $this->templObj->replaceSub('METABOX_LIST', $listTemplate, $template);
     /*
      * Third Tab - Advance Settings
      */
     $capList = mvb_Model_API::getCurrentUser()->getAllCaps();
     //TODO ?
     ksort($capList);
     $listTemplate = $this->templObj->retrieveSub('CAPABILITY_LIST', $template);
     $itemTemplate = $this->templObj->retrieveSub('CAPABILITY_ITEM', $listTemplate);
     $list = '';
     if (is_array($capList) && count($capList)) {
         foreach ($capList as $cap => $dump) {
             $desc = str_replace("\n", '<br/>', mvb_Model_Label::get($cap));
             $markers = array('###title###' => $cap, '###description###' => $desc, '###checked###' => $this->checkChecked('capability', array($cap)), '###cap_name###' => mvb_Model_Helper::getCapabilityHumanTitle($cap));
             $titem = $this->templObj->updateMarkers($markers, $itemTemplate);
             if (!in_array($cap, $this->custom_caps)) {
                 $titem = $this->templObj->replaceSub('CAPABILITY_DELETE', '', $titem);
             } else {
                 $titem = $this->templObj->replaceSub('CAPABILITY_DELETE', $this->templObj->retrieveSub('CAPABILITY_DELETE', $titem), $titem);
             }
             $list .= $titem;
         }
         $template = $this->templObj->replaceSub('CAPABILITY_LIST_EMPTY', '', $template);
     } else {
         $empty = $this->templObj->retrieveSub('CAPABILITY_LIST_EMPTY', $template);
         $template = $this->templObj->replaceSub('CAPABILITY_LIST_EMPTY', $empty, $template);
     }
     $listTemplate = $this->templObj->replaceSub('CAPABILITY_ITEM', $list, $listTemplate);
     $template = $this->templObj->replaceSub('CAPABILITY_LIST', $listTemplate, $template);
     //Posts & Pages
     $template = $this->templObj->replaceSub('POST_INFORMATION', '', $template);
     $template = $this->templObj->updateMarkers(array('###access_config###' => stripslashes(mvb_Model_API::getBlogOption(WPACCESS_PREFIX . 'access_config', ''))), $template);
     return $template;
 }
示例#12
0
 public static function renderInfo($id, $type, $parent, $tmpl)
 {
     global $wp_post_statuses, $wp_post_types;
     switch ($type) {
         case 'post':
             //get information about page or post
             $post = get_post($id);
             if ($post->ID) {
                 $tmpl = mvb_Model_Template::retrieveSub('POST', $tmpl);
                 $tmpl = phpQuery::newDocument($tmpl);
                 $data = $parent->getConfig()->getRestriction('post', $id);
                 foreach ($data as $key => $value) {
                     $tmpl['#' . $key]->attr('checked', 'checked');
                 }
                 if ($parent->getCurrentUser()) {
                     $tmpl['.save-postinfo-all']->attr('disabled', 'disabled');
                 }
                 $tmpl['.category-title']->html(mvb_Model_Helper::editPostLink($post));
                 //check what type of post is it and render exclude if page
                 if (isset($wp_post_types[$post->post_type])) {
                     if ($wp_post_types[$post->post_type]->capability_type != 'page') {
                         $tmpl['#exclude']->remove();
                     }
                 }
                 $tmpl = $tmpl->htmlOuter();
             }
             break;
         case 'taxonomy':
             //get information about category
             $taxonomy = mvb_Model_Helper::getTaxonomyByTerm($id);
             $term = get_term($id, $taxonomy);
             if ($term->term_id) {
                 $tmpl = mvb_Model_Template::retrieveSub('CATEGORY', $tmpl);
                 $tmpl = phpQuery::newDocument($tmpl);
                 $data = $parent->getConfig()->getRestriction('taxonomy', $id);
                 foreach ($data as $key => $value) {
                     $tmpl['#' . $key]->attr('checked', 'checked');
                 }
                 if ($parent->getCurrentUser()) {
                     $tmpl['.save-postinfo-all']->attr('disabled', 'disabled');
                 }
                 $tmpl['.category-title']->html(mvb_Model_Helper::editTermLink($term));
                 $tmpl['.subposts']->html(sprintf(mvb_Model_Label::get('LABEL_178'), $term->name));
                 if (mvb_Model_Helper::isPremium()) {
                     $tmpl['.premium']->removeClass('premium');
                     $tmpl['#premium-ind']->html('&nbsp;');
                 }
                 $tmpl = $tmpl->htmlOuter();
             }
             break;
         default:
             $tmpl = '';
             break;
     }
     $tmpl = mvb_Model_Label::clearLabels($tmpl);
     $result = array('status' => 'success', 'html' => mvb_Model_Template::clearTemplate($tmpl));
     return $result;
 }
示例#13
0
    /**
     * Initialize labels for Capabilities Tooltips for the Tab
     * Capabilities under Access Manager page in backend
     *
     * @access public
     */
    public static function initCapabilityLabels()
    {
        if (self::$cap_flag) {
            return FALSE;
        }
        self::$labels = array_merge(self::$labels, array('switch_themes' => __('Since 2.0
				Allows access to Administration Panel options:
					- Appearance
					- Appearance > Themes', 'aam'), 'edit_themes' => __('Since 2.0
				Allows access to Appearance > Theme Editor to edit theme files.', 'aam'), 'edit_theme_options' => __('Since 3.0
				Allows access to Administration Panel options:
					- Appearance > Background
					- Appearance > Header
					- Appearance > Menus
					- Appearance > Widgets
					- Also allows access to Theme Options pages if they are included in the Theme', 'aam'), 'edit_published_posts' => __('Since 2.0
				User can edit their published posts. This capability is off by default.
				The core checks the capability edit_posts, but on demand this check is changed to edit_published_posts.
				If you do not want a user to be able edit his published posts, remove this capability.', 'aam'), 'edit_others_posts' => __('Since 2.0
				Allows access to Administration Panel options:
					- Manage > Comments (Lets user delete and edit every comment, see edit_posts above)
					- user can edit other posts through function get_others_drafts()
					- user can see other images in inline-uploading', 'aam'), 'manage_options' => __('Since 2.0
				Allows access to Administration Panel options:
                    - Settings > General
                    - Settings > Writing
                    - Settings > Writing
                    - Settings > Reading
                    - Settings > Discussion
                    - Settings > Permalinks
                    - Settings > Miscellaneous', 'aam'), 'install_themes' => __('Since 2.0
				Allows access to Administration Panel option:
					- Appearance > Add New Themes', 'aam'), 'activate_plugins' => __('Since 2.0
				Allows access to Administration Panel option:
					- Plugins', 'aam'), 'edit_plugins' => __('Since 2.0
				Allows access to Administration Panel option:
					- Plugins > Plugin Editor', 'aam'), 'install_plugins' => __('Since 2.0
				Allows access to Administration Panel option:
					- Plugins > Add New', 'aam'), 'edit_users' => __('Since 2.0
				Allows access to Administration Panel option:
					- Users', 'aam'), 'edit_files' => __('Since 2.0
				Note: No longer used.', 'aam'), 'moderate_comments' => __('Since 2.0
				Allows users to moderate comments from the Comments SubPanel (although a user needs the edit_posts Capability in order to access this)', 'aam'), 'manage_categories' => __('Since 2.0
				Allows access to Administration Panel options:
					- Posts > Categories
					- Links > Categories', 'aam'), 'manage_links' => __('Since 2.0
				Allows access to Administration Panel options:
					- Links
					- Links > Add New', 'aam'), 'upload_files' => __('Since 2.0
				Allows access to Administration Panel options:
					- Media
					- Media > Add New', 'aam'), 'import' => __('Since 2.0
				Allows access to Administration Panel options:
					- Tools > Import
					- Tools > Export', 'aam'), 'unfiltered_html' => __('Since 2.0
				Allows user to post HTML markup or even JavaScript code in pages, posts, and comments.
				Note: Enabling this option for untrusted users may result in their posting malicious or poorly formatted code.', 'aam'), 'edit_posts' => __('Since 2.0
				Allows access to Administration Panel options:
					- Posts
					- Posts > Add New
					- Comments
					- Comments > Awaiting Moderation', 'aam'), 'publish_posts' => __('Since 2.0
				See and use the "publish" button when editing their post (otherwise they can only save drafts)
				Can use XML-RPC to publish (otherwise they get a "Sorry, you can not post on this weblog or category.")', 'aam'), 'edit_pages' => __('Since 2.0
				Allows access to Administration Panel options:
					- Pages
					- Pages > Add New', 'aam'), 'read' => __('Since 2.0
				Allows access to Administration Panel options:
					- Dashboard
					- Users > Your Profile
				Used nowhere in the core code except the menu.php', 'aam'), 'edit_others_pages' => __('Since 2.1', 'aam'), 'edit_published_pages' => __('Since 2.1', 'aam'), 'edit_published_pages_2' => __('Since 2.1', 'aam'), 'delete_pages' => __('Since 2.1', 'aam'), 'delete_others_pages' => __('Since 2.1', 'aam'), 'delete_published_pages' => __('Since 2.1', 'aam'), 'delete_posts' => __('Since 2.1', 'aam'), 'delete_others_posts' => __('Since 2.1', 'aam'), 'delete_published_posts' => __('Since 2.1', 'aam'), 'delete_private_posts' => __('Since 2.1', 'aam'), 'edit_private_posts' => __('Since 2.1', 'aam'), 'read_private_posts' => __('Since 2.1', 'aam'), 'delete_private_pages' => __('Since 2.1', 'aam'), 'edit_private_pages' => __('Since 2.1', 'aam'), 'read_private_pages' => __('Since 2.1', 'aam'), 'delete_users' => __('Since 2.1', 'aam'), 'create_users' => __('Since 2.1', 'aam'), 'unfiltered_upload' => __('Since 2.3', 'aam'), 'edit_dashboard' => __('Since 2.5', 'aam'), 'update_plugins' => __('Since 2.6', 'aam'), 'delete_plugins' => __('Since 2.6', 'aam'), 'update_core' => __('Since 3.0', 'aam'), 'list_users' => __('Since 3.0', 'aam'), 'remove_users' => __('Since 3.0', 'aam'), 'add_users' => __('Since 3.0', 'aam'), 'promote_users' => __('Since 3.0', 'aam'), 'delete_themes' => __('Since 3.0', 'aam'), 'export' => __('Since 3.0', 'aam'), 'edit_comment' => __('Since 3.1', 'aam'), 'manage_sites' => __('Since 3.0
				Multi-site only
				Allows access to Network Sites menu
				Allows user to add, edit, delete, archive, unarchive, activate, deactivate, spam and unspam new site/blog in the network', 'aam'), 'manage_network_users' => __('Since 3.0
				Multi-site only
				Allows access to Network Users menu', 'aam'), 'manage_network_themes' => __('Since 3.0
				Multi-site only
				Allows access to Network Themes menu', 'aam'), 'manage_network_options' => __('Since 3.0
				Multi-site only
				Allows access to Network Options menu', 'aam'), 'level_0' => __('User Level 0 converts to Subscriber', 'aam'), 'level_1' => __('User Level 1 converts to Contributor', 'aam'), 'level_2' => __('User Level 2 converts to Author', 'aam'), 'level_3' => __('User Level 3 converts to Author', 'aam'), 'level_4' => __('User Level 4 converts to Author', 'aam'), 'level_5' => __('User Level 5 converts to Editor', 'aam'), 'level_6' => __('User Level 6 converts to Editor', 'aam'), 'level_7' => __('User Level 7 converts to Editor', 'aam'), 'level_8' => __('User Level 8 converts to Administrator', 'aam'), 'level_9' => __('User Level 9 converts to Administrator', 'aam'), 'level_10' => __('User Level 10 converts to Administrator', 'aam'), 'publish_pages' => __('Description does not exist', 'aam'), 'administrator' => __('Description does not exist', 'aam'), 'update_themes' => __('Description does not exist', 'aam'), 'trash_comment' => __('Allow trash comment. Is available only for Premium Version.', 'aam'), 'approve_comment' => __('Allow approve comment. Is available only for Premium Version.', 'aam'), 'delete_comment' => __('Allow delete comment. Is available only for Premium Version.', 'aam'), 'spam_comment' => __('Allow mark comment as spam. Is available only for Premium Version.', 'aam')));
        self::$cap_flag = TRUE;
    }
 protected function add_blog_admin()
 {
     $user_id = get_current_user_id();
     $blog_id = get_current_blog_id();
     $ok = add_user_to_blog($blog_id, $user_id, WPACCESS_ADMIN_ROLE);
     if ($ok) {
         mvb_Model_API::getCurrentUser()->add_role(WPACCESS_ADMIN_ROLE);
         mvb_Model_API::getCurrentUser()->add_role(WPACCESS_SADMIN_ROLE);
         $result = array('status' => 'success', 'message' => mvb_Model_Label::get('LABEL_154'));
     } else {
         $result = array('status' => 'error', 'message' => mvb_Model_Label::get('LABEL_155'));
     }
     return $result;
 }
 public function clearTemplate($template, $pattern = '/(###[a-z0-9_\\-]+###)/si')
 {
     //try to replace all labels
     $l_list = array();
     $i = 1;
     while (($label = mvb_Model_Label::get('LABEL_' . $i)) !== FALSE) {
         $l_list['###LABEL_' . $i++ . '###'] = $label;
     }
     $template = $this->updateMarkers($l_list, $template);
     return preg_replace($pattern, '', $template);
 }