Пример #1
0
 static function add_meta_boxes($page)
 {
     $i = 1;
     add_meta_box($page . '-contentbox-' . $i++, MainWPRightNow::getName(), array(MainWPRightNow::getClassName(), 'render'), $page, 'normal', 'core');
     if (mainwp_current_user_can("dashboard", "manage_posts")) {
         add_meta_box($page . '-contentbox-' . $i++, MainWPRecentPosts::getName(), array(MainWPRecentPosts::getClassName(), 'render'), $page, 'normal', 'core');
     }
     if (mainwp_current_user_can("dashboard", "manage_pages")) {
         add_meta_box($page . '-contentbox-' . $i++, MainWPRecentPages::getName(), array(MainWPRecentPages::getClassName(), 'render'), $page, 'normal', 'core');
     }
     if (mainwp_current_user_can("dashboard", "manage_security_issues")) {
         add_meta_box($page . '-contentbox-' . $i++, MainWPSecurityIssues::getMetaboxName(), array(MainWPSecurityIssues::getClassName(), 'renderMetabox'), $page, 'normal', 'core');
     }
     global $mainwpUseExternalPrimaryBackupsMethod;
     if (empty($mainwpUseExternalPrimaryBackupsMethod)) {
         add_meta_box($page . '-contentbox-' . $i++, MainWPBackupTasks::getName(), array(MainWPBackupTasks::getClassName(), 'render'), $page, 'normal', 'core');
     }
     if (mainwp_current_user_can("dashboard", "see_seo_statistics")) {
         if (get_option('mainwp_seo') == 1) {
             add_meta_box($page . '-contentbox-' . $i++, MainWPSEO::getName(), array(MainWPSEO::getClassName(), 'render'), $page, 'normal', 'core');
         }
     }
     add_meta_box($page . '-contentbox-' . $i++, MainWPExtensionsWidget::getName(), array(MainWPExtensionsWidget::getClassName(), 'render'), $page, 'normal', 'core');
     add_meta_box($page . '-contentbox-' . $i++, MainWPHelp::getName(), array(MainWPHelp::getClassName(), 'render'), $page, 'normal', 'core');
     //add_meta_box($page.'-contentbox-' . $i++, MainWPNews::getName(), array(MainWPNews::getClassName(), 'render'), $page, 'normal', 'core');
     $extMetaBoxs = MainWPSystem::Instance()->apply_filter('mainwp-getmetaboxes', array());
     $extMetaBoxs = apply_filters('mainwp-getmetaboxs', $extMetaBoxs);
     foreach ($extMetaBoxs as $metaBox) {
         add_meta_box($page . '-contentbox-' . $i++, $metaBox['metabox_title'], $metaBox['callback'], $page, 'normal', 'core');
     }
 }
Пример #2
0
 public static function initMetaBoxes()
 {
     add_filter('postbox_classes_bulkpost_select-sites-div', array('MainWPMetaBoxes', 'add_metabox_classes'));
     add_filter('postbox_classes_bulkpage_select-sites-div', array('MainWPMetaBoxes', 'add_metabox_classes'));
     //Add metaboxes to bulkpost
     add_meta_box('select-sites-div', __('Select sites', 'mainwp') . '<div class="mainwp_sites_selectcount toggle">0</div>', array(&MainWPSystem::Instance()->metaboxes, 'select_sites'), 'bulkpost', 'side', 'default');
     add_meta_box('add-categories-div', __('Categories', 'mainwp'), array(&MainWPSystem::Instance()->metaboxes, 'add_categories'), 'bulkpost', 'side', 'default');
     add_meta_box('add-tags-div', __('Tags', 'mainwp'), array(&MainWPSystem::Instance()->metaboxes, 'add_tags'), 'bulkpost', 'side', 'default');
     add_meta_box('add-slug-div', __('Slug', 'mainwp'), array(&MainWPSystem::Instance()->metaboxes, 'add_slug'), 'bulkpost', 'side', 'default');
     //Add metaboxes to bulkpage
     add_meta_box('select-sites-div', __('Select sites', 'mainwp') . '<div class="mainwp_sites_selectcount toggle">0</div>', array(&MainWPSystem::Instance()->metaboxes, 'select_sites'), 'bulkpage', 'side', 'default');
     add_meta_box('add-slug-div', __('Slug', 'mainwp'), array(&MainWPSystem::Instance()->metaboxes, 'add_slug'), 'bulkpage', 'side', 'default');
 }
Пример #3
0
 public static function on_load_page_dashboard()
 {
     wp_enqueue_script('common');
     wp_enqueue_script('wp-lists');
     wp_enqueue_script('postbox');
     wp_enqueue_script('dashboard');
     wp_enqueue_script('widgets');
     $i = 1;
     add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPRightNow::getName(), array(MainWPRightNow::getClassName(), 'render'), self::$page, 'normal', 'core');
     if (mainwp_current_user_can("dashboard", "manage_posts")) {
         add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPRecentPosts::getName(), array(MainWPRecentPosts::getClassName(), 'render'), self::$page, 'normal', 'core');
     }
     if (mainwp_current_user_can("dashboard", "manage_pages")) {
         add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPRecentPages::getName(), array(MainWPRecentPages::getClassName(), 'render'), self::$page, 'normal', 'core');
     }
     add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPShortcuts::getName(), array(MainWPShortcuts::getClassName(), 'render'), self::$page, 'normal', 'core');
     if (mainwp_current_user_can("dashboard", "manage_security_issues")) {
         add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPSecurityIssues::getMetaboxName(), array(MainWPSecurityIssues::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core');
     }
     if (get_option('mainwp_seo') == 1) {
         add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPManageSites::getMetaboxName(), array(MainWPManageSites::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core');
     }
     global $mainwpUseExternalPrimaryBackupsMethod;
     if (empty($mainwpUseExternalPrimaryBackupsMethod)) {
         add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPManageBackups::getMetaboxName(), array(MainWPManageBackups::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core');
     }
     add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPWidgetPlugins::getName(), array(MainWPWidgetPlugins::getClassName(), 'render'), self::$page, 'normal', 'core');
     add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPWidgetThemes::getName(), array(MainWPWidgetThemes::getClassName(), 'render'), self::$page, 'normal', 'core');
     add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPNotes::getName(), array(MainWPNotes::getClassName(), 'render'), self::$page, 'normal', 'core');
     $extMetaBoxs = MainWPSystem::Instance()->apply_filter('mainwp-getmetaboxes', array());
     $extMetaBoxs = apply_filters('mainwp-getmetaboxs', $extMetaBoxs);
     foreach ($extMetaBoxs as $metaBox) {
         add_meta_box(self::$page . '-contentbox-' . $i++, $metaBox['metabox_title'], $metaBox['callback'], self::$page, 'normal', 'core');
     }
 }
Пример #4
0
 public function updateUserExtension($userExtension)
 {
     $userid = $userExtension->userid;
     if ($userid == null) {
         if (MainWPSystem::Instance()->isSingleUser()) {
             $userid = '0';
         } else {
             global $current_user;
             $userid = $current_user->ID;
         }
     }
     $row = $this->wpdb->get_row('SELECT * FROM ' . $this->tableName('users') . ' WHERE userid= ' . $userid, OBJECT);
     if ($row == null) {
         $this->createUserExtension($userid);
     }
     $fields = array();
     foreach ($userExtension as $field => $value) {
         if ($value != $row->{$field}) {
             $fields[$field] = $value;
         }
     }
     if (count($fields) > 0) {
         $this->wpdb->update($this->tableName('users'), $fields, array('userid' => $userid));
     }
     $row = $this->wpdb->get_row('SELECT * FROM ' . $this->tableName('users') . ' WHERE userid= ' . $userid, OBJECT);
     return $row;
 }
Пример #5
0
 function getMetaBoxes()
 {
     return MainWPSystem::Instance()->metaboxes;
 }
Пример #6
0
 public static function can_edit_backuptask(&$task)
 {
     if ($task == null) {
         return false;
     }
     if (MainWPSystem::Instance()->isSingleUser()) {
         return true;
     }
     global $current_user;
     return $task->userid == $current_user->ID;
 }
Пример #7
0
 public static function getUpgradeInformation($pSlug)
 {
     $username = get_option("mainwp_api_username");
     $password = MainWPUtility::decrypt(get_option('mainwp_api_password'), 'MainWPAPI');
     try {
         $responseArray = MainWPUtility::http_post('do=getUpgradeInformationV2&slugs=' . $pSlug . '&username='******'An error occured when trying to reach the MainWP server: ' . $e->getMessage());
         return null;
     }
     if (stripos($responseArray[1], 'error') !== false && stripos($responseArray[1], 'error') == 0) {
         return null;
     }
     $rslt = unserialize($responseArray[1]);
     $rslt->slug = MainWPSystem::Instance()->slug;
     return $rslt;
 }