$('#day').append($("<option></option>").attr("value", "").text('<?php _e('Daily', 'wpbtd'); ?> ')); $('#day option:last').attr('selected', 'selected'); $('#day').attr('disabled', 'disabled'); } else if (len == 8) { $('#day').removeAttr('disabled'); $('#day option:last').remove(); } }); //Display the file tree with a call back to update the clicked on check box and white list $('#file_tree').fileTree({ root: '<?php echo str_replace("\\", "/", get_sanitized_home_path()) . "/"; ?> ', script: ajaxurl, expandSpeed: 500, collapseSpeed: 500, multiFolder: false }); $('#togglers .button').click(function() { switch ($(this).attr('rel')) { case "all": // clicking an unchecked, expanded directory triggers a collapse which is confusing // skip expanded directories when checking everything (they'll auto-check themselves) $('#file_tree .checkbox').not('.checked, .partial, .directory.expanded>.checkbox').click(); break;
public function execute() { $manager = WP_Backup_Extension_Manager::construct(); $logger = WP_Backup_Registry::logger(); $this->config->set_time_limit(); $this->config->set_memory_limit(); try { if (!$this->dropbox->is_authorized()) { $logger->log(__('Your Dropbox account is not authorized yet.', 'wpbtd')); return; } if ($this->output->start()) { //Create the SQL backups if (!$this->db_core->exists() || !$this->db_plugins->exists()) { $logger->log(__('Creating SQL backup.', 'wpbtd')); $this->db_core->execute(); $this->db_plugins->execute(); $logger->log(__('SQL backup complete. Starting file backup.', 'wpbtd')); } //Backup the content dir first $processed_files = $this->backup_path(WP_CONTENT_DIR, dirname(WP_CONTENT_DIR), array($this->db_core->get_file(), $this->db_plugins->get_file())); //Now backup the blog root $processed_files += $this->backup_path(get_sanitized_home_path()); //End any output extensions $this->output->end(); //Record the number of files processed to make the progress meter more accurate $this->config->set_option('total_file_count', $processed_files); } $manager->complete(); //Update log file with stats $logger->log(__('Backup complete.', 'wpbtd')); $logger->log(sprintf(__('A total of %s files were processed.', 'wpbtd'), $processed_files)); $logger->log(sprintf(__('A total of %dMB of memory was used to complete this backup.', 'wpbtd'), memory_get_usage(true) / 1048576)); $this->output->clean_up(); //Process the log file using the default backup output $root = false; if (get_class($this->output) != 'WP_Backup_Output') { $this->output = new WP_Backup_Output(); $root = true; } $this->output->set_root($root)->out(get_sanitized_home_path(), $logger->get_log_file()); $this->config->complete()->log_finished_time(); } catch (Exception $e) { if ($e->getMessage() == 'Unauthorized') { $logger->log(__('The plugin is no longer authorized with Dropbox.', 'wpbtd')); } else { $logger->log(__('A fatal error occured: ', 'wpbtd') . $e->getMessage()); } $manager->failure(); $this->stop(); } $this->clean_up(); }
if ($file_list->in_ignore_list($file)) { continue; } $full_path = htmlentities($_POST['dir'] . $file); $file = htmlentities($file); $class = $file_list->get_checkbox_class($full_path); echo "<li class='directory collapsed'>"; echo "<a href='#' rel='" . str_replace('\\', '/', $full_path) . '/' . "' class='tree'>{$file}</a>"; echo "<a href='#' rel='" . str_replace('\\', '/', $full_path) . '/' . "' class='checkbox directory {$class}'></a>"; echo "</li>"; } } // All files foreach ($files as $file) { if ($file != '.' && $file != '..' && file_exists($_POST['dir'] . $file) && !is_dir($_POST['dir'] . $file)) { if ($_POST['dir'] == dirname(get_sanitized_home_path()) && !strstr($file, basename(get_sanitized_home_path()))) { continue; } if ($file_list->in_ignore_list($file)) { continue; } $full_path = htmlentities($_POST['dir'] . $file); $file = htmlentities($file); $class = $file_list->get_checkbox_class($full_path); $ext = preg_replace('/^.*\\./', '', $file); echo "<li class='file ext_{$ext}'>"; echo "<a href='#' rel='" . str_replace('\\', '/', $full_path) . "' class='tree'>{$file}</a>"; if (strstr($_POST['dir'] . $file, DB_NAME . '-backup.sql') === false) { echo "<a href='#' rel='" . str_replace('\\', '/', $full_path) . "' class='checkbox {$class}'></a>"; } echo "</li>";
private function is_excluded_dir($dir) { if (empty($this->excluded_dirs)) { return false; } if (in_array($dir, $this->excluded_dirs)) { return true; } if ($dir == get_sanitized_home_path()) { return false; } return $this->is_excluded_dir(dirname($dir)); }