Esempio n. 1
0
 function admin_init()
 {
     if (!MainWPUtility::isAdmin()) {
         return;
     }
     if (get_option('mainwp_activated') == 'yes') {
         delete_option('mainwp_activated');
         wp_redirect(admin_url('admin.php?page=managesites&do=new'));
         return;
     }
     global $mainwpUseExternalPrimaryBackupsMethod;
     if ($mainwpUseExternalPrimaryBackupsMethod === null) {
         $mainwpUseExternalPrimaryBackupsMethod = apply_filters("mainwp-getprimarybackup-activated", "");
     }
     add_action('admin_notices', array($this, 'mainwp_warning_notice'));
     $this->posthandler->init();
     wp_enqueue_script('jquery-ui-tooltip');
     wp_enqueue_script('jquery-ui-autocomplete');
     wp_enqueue_script('jquery-ui-progressbar');
     wp_enqueue_script('jquery-ui-datepicker');
     wp_enqueue_script('jquery-ui-dialog');
     global $wp_scripts;
     $ui = $wp_scripts->query('jquery-ui-core');
     $version = $ui->ver;
     if (MainWPUtility::startsWith($version, '1.10')) {
         wp_enqueue_style('jquery-ui-style', MAINWP_PLUGIN_URL . 'css/1.10.4/jquery-ui.min.css', array(), '1.10.4');
     } else {
         wp_enqueue_style('jquery-ui-style', MAINWP_PLUGIN_URL . 'css/1.11.1/jquery-ui.min.css', array(), '1.11.1');
     }
     wp_enqueue_script('mainwp', MAINWP_PLUGIN_URL . 'js/mainwp.js', array('jquery-ui-tooltip', 'jquery-ui-autocomplete', 'jquery-ui-progressbar', 'jquery-ui-dialog', 'jquery-ui-datepicker'), $this->current_version);
     $mainwpParams = array('image_url' => MAINWP_PLUGIN_URL . 'images/', 'backup_before_upgrade' => get_option('mainwp_backup_before_upgrade') == 1, 'admin_url' => admin_url(), 'date_format' => get_option('date_format'), 'time_format' => get_option('time_format'), 'enabledTwit' => MainWPTwitter::enabledTwitterMessages(), 'maxSecondsTwit' => MAINWP_TWITTER_MAX_SECONDS);
     wp_localize_script('mainwp', 'mainwpParams', $mainwpParams);
     wp_enqueue_script('mainwp-tristate', MAINWP_PLUGIN_URL . 'js/tristate.min.js', array('mainwp'), $this->current_version);
     $mainwpTranslations = MainWPSystemView::getMainWPTranslations();
     wp_localize_script('mainwp', 'mainwpTranslations', $mainwpTranslations);
     $security_nonces = $this->posthandler->getSecurityNonces();
     wp_localize_script('mainwp', 'security_nonces', $security_nonces);
     MainWPMetaBoxes::initMetaBoxes();
     wp_enqueue_script('thickbox');
     wp_enqueue_script('user-profile');
     wp_enqueue_style('thickbox');
     if (!current_user_can('update_core')) {
         remove_action('admin_notices', 'update_nag', 3);
     }
 }
Esempio n. 2
0
 private static function addExcludedBackups(&$files, &$arr)
 {
     $newExcludes = array();
     //Backup buddy
     $newExcludes[] = 'wp-content/uploads/backupbuddy_backups';
     $newExcludes[] = 'wp-content/uploads/backupbuddy_temp';
     $newExcludes[] = 'wp-content/uploads/pb_backupbuddy';
     //ManageWP
     $newExcludes[] = 'wp-content/managewp';
     //InfiniteWP
     $newExcludes[] = 'wp-content/infinitewp';
     //WordPress Backup to Dropbox
     $newExcludes[] = 'wp-content/backups';
     //BackWPUp
     $newExcludes[] = 'wp-content/uploads/backwpup*';
     //WP Complete Backup
     $newExcludes[] = 'wp-content/plugins/wp-complete-backup/storage';
     //Online Backup for WordPress
     $newExcludes[] = 'wp-content/backups';
     //XCloner
     $newExcludes[] = 'administrator/backups';
     foreach ($newExcludes as $newExclude) {
         $path = explode('/', $newExclude);
         $found = true;
         $newExcludeSuffix = null;
         $currentArr = null;
         foreach ($path as $pathPart) {
             if ($currentArr == null) {
                 if (isset($files[$pathPart])) {
                     $currentArr = $files[$pathPart];
                 }
             } else {
                 if (isset($currentArr[$pathPart])) {
                     $currentArr = $currentArr[$pathPart];
                 } else {
                     if (MainWPUtility::endsWith($pathPart, "*")) {
                         foreach ($currentArr as $key => $val) {
                             if (MainWPUtility::startsWith($key, substr($pathPart, 0, strlen($pathPart) - 1))) {
                                 if ($newExcludeSuffix == null) {
                                     $newExcludeSuffix = array();
                                 }
                                 $newExcludeSuffix[] = $key;
                             }
                         }
                         if ($newExcludeSuffix != null && count($newExcludeSuffix) > 0) {
                             break;
                         }
                     }
                     $currentArr = null;
                 }
             }
             if (!is_array($currentArr)) {
                 $found = false;
                 break;
             }
         }
         if ($found) {
             if ($newExcludeSuffix != null) {
                 $newExclude = substr($newExclude, 0, strrpos($newExclude, '/') + 1);
                 foreach ($newExcludeSuffix as $newExcludeSuff) {
                     $arr[] = $newExclude . $newExcludeSuff;
                 }
             } else {
                 $arr[] = $newExclude;
             }
         }
     }
 }