protected function get_job_files()
 {
     // From BackWPup_JobType_File::get_exclude_dirs
     function mainwp_backwpup_get_exclude_dirs($folder)
     {
         $folder = trailingslashit(str_replace('\\', '/', realpath($folder)));
         $exclude_dir_array = array();
         if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(ABSPATH))), $folder) && trailingslashit(str_replace('\\', '/', realpath(ABSPATH))) != $folder) {
             $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(ABSPATH)));
         }
         if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR))), $folder) && trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR))) != $folder) {
             $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR)));
         }
         if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR))), $folder) && trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR))) != $folder) {
             $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR)));
         }
         if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(get_theme_root()))), $folder) && trailingslashit(str_replace('\\', '/', realpath(get_theme_root()))) != $folder) {
             $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(get_theme_root())));
         }
         if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir()))), $folder) && trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir()))) != $folder) {
             $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir())));
         }
         return array_unique($exclude_dir_array);
     }
     $return = array();
     $folders = array('abs' => ABSPATH, 'content' => WP_CONTENT_DIR, 'plugin' => WP_PLUGIN_DIR, 'theme' => get_theme_root(), 'upload' => BackWPup_File::get_upload_dir());
     foreach ($folders as $key => $folder) {
         $return_temp = array();
         $main_folder_name = realpath($folder);
         if ($main_folder_name) {
             $main_folder_name = untrailingslashit(str_replace('\\', '/', $main_folder_name));
             $main_folder_size = '(' . size_format(BackWPup_File::get_folder_size($main_folder_name, false), 2) . ')';
             if ($dir = @opendir($main_folder_name)) {
                 while (($file = readdir($dir)) !== false) {
                     if (!in_array($file, array('.', '..')) && is_dir($main_folder_name . '/' . $file) && !in_array(trailingslashit($main_folder_name . '/' . $file), mainwp_backwpup_get_exclude_dirs($main_folder_name))) {
                         $folder_size = ' (' . size_format(BackWPup_File::get_folder_size($main_folder_name . '/' . $file), 2) . ')';
                         $return_temp[] = array('size' => $folder_size, 'name' => $file);
                     }
                 }
                 @closedir($dir);
             }
             $return[$key] = array('size' => $main_folder_size, 'name' => $folder, 'folders' => $return_temp);
         }
     }
     return array('success' => 1, 'folders' => $return);
 }
예제 #2
0
    /**
     * @param $main
     */
    public function edit_tab($main)
    {
        @set_time_limit(300);
        ?>
		<h3 class="title"><?php 
        _e('Folders to backup', 'backwpup');
        ?>
</h3>
		<p></p>
		<table class="form-table">
			<tr>
				<th scope="row"><label for="idbackuproot"><?php 
        _e('Backup root folder', 'backwpup');
        ?>
</label></th>
				<td>
					<?php 
        $folder = realpath(ABSPATH);
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
					<input class="checkbox"
						   type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backuproot'), TRUE, TRUE);
        ?>
						   name="backuproot" id="idbackuproot" value="1" /> <code title="<?php 
        echo sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), esc_attr(ABSPATH));
        ?>
"><?php 
        echo esc_attr($folder);
        ?>
</code><?php 
        echo $folder_size;
        ?>

					<fieldset id="backuprootexcludedirs" style="padding-left:15px; margin:2px;">
                        <legend><strong><?php 
        _e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = @opendir($folder))) {
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..')) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder))) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    echo '<nobr><label for="idrootexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, BackWPup_Option::get($main, 'backuprootexcludedirs')), TRUE, FALSE) . ' name="backuprootexcludedirs[]" id="idrootexcludedirs-' . sanitize_file_name($file) . '" value="' . $file . '" /> ' . esc_attr($file) . $folder_size . '</label><br /></nobr>';
                }
            }
            @closedir($dir);
        }
        ?>
                    </fieldset>
				</td>
			</tr>
            <tr>
                <th scope="row"><label for="idbackupcontent"><?php 
        _e('Backup content folder', 'backwpup');
        ?>
</label></th>
                <td>
					<?php 
        $folder = realpath(WP_CONTENT_DIR);
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
                    <input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupcontent'), TRUE, TRUE);
        ?>
                           name="backupcontent" id="idbackupcontent" value="1" /> <code title="<?php 
        echo sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), esc_attr(WP_CONTENT_DIR));
        ?>
"><?php 
        echo esc_attr($folder);
        ?>
</code><?php 
        echo $folder_size;
        ?>

                    <fieldset id="backupcontentexcludedirs" style="padding-left:15px; margin:2px;">
						<legend><strong><?php 
        _e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = @opendir($folder))) {
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..')) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder))) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    echo '<nobr><label for="idcontentexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, BackWPup_Option::get($main, 'backupcontentexcludedirs')), TRUE, FALSE) . ' name="backupcontentexcludedirs[]" id="idcontentexcludedirs-' . sanitize_file_name($file) . '" value="' . $file . '" /> ' . esc_attr($file) . $folder_size . '</label><br /></nobr>';
                }
            }
            @closedir($dir);
        }
        ?>
                    </fieldset>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="idbackupplugins"><?php 
        _e('Backup plugins', 'backwpup');
        ?>
</label></th>
                <td>
					<?php 
        $folder = realpath(WP_PLUGIN_DIR);
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
                    <input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupplugins'), TRUE, TRUE);
        ?>
                           name="backupplugins" id="idbackupplugins" value="1" /> <code title="<?php 
        echo sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), esc_attr(WP_PLUGIN_DIR));
        ?>
"><?php 
        echo esc_attr($folder);
        ?>
</code><?php 
        echo $folder_size;
        ?>

                    <fieldset id="backuppluginsexcludedirs" style="padding-left:15px; margin:2px;">
						<legend><strong><?php 
        _e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = @opendir($folder))) {
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..')) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder))) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    echo '<nobr><label for="idpluginexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, BackWPup_Option::get($main, 'backuppluginsexcludedirs')), TRUE, FALSE) . ' name="backuppluginsexcludedirs[]" id="idpluginexcludedirs-' . sanitize_file_name($file) . '" value="' . $file . '" /> ' . esc_attr($file) . $folder_size . '</label><br /></nobr>';
                }
            }
            @closedir($dir);
        }
        ?>
                    </fieldset>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="idbackupthemes"><?php 
        _e('Backup themes', 'backwpup');
        ?>
</label></th>
                <td>
					<?php 
        $folder = realpath(get_theme_root());
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
                    <input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupthemes'), TRUE, TRUE);
        ?>
                           name="backupthemes" id="idbackupthemes" value="1" /> <code title="<?php 
        echo sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), esc_attr(get_theme_root()));
        ?>
"><?php 
        echo esc_attr($folder);
        ?>
</code><?php 
        echo $folder_size;
        ?>

                    <fieldset id="backupthemesexcludedirs" style="padding-left:15px; margin:2px;">
						<legend><strong><?php 
        _e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = @opendir($folder))) {
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..')) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder))) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    echo '<nobr><label for="idthemesexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, BackWPup_Option::get($main, 'backupthemesexcludedirs')), TRUE, FALSE) . ' name="backupthemesexcludedirs[]" id="idthemesexcludedirs-' . sanitize_file_name($file) . '" value="' . $file . '" /> ' . esc_attr($file) . $folder_size . '</label><br /></nobr>';
                }
            }
            @closedir($dir);
        }
        ?>
                    </fieldset>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="idbackupuploads"><?php 
        _e('Backup uploads folder', 'backwpup');
        ?>
</label></th>
                <td>
					<?php 
        $folder = realpath(BackWPup_File::get_upload_dir());
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
                    <input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupuploads'), TRUE, TRUE);
        ?>
                           name="backupuploads" id="idbackupuploads" value="1" /> <code title="<?php 
        echo sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), esc_attr(BackWPup_File::get_upload_dir()));
        ?>
"><?php 
        echo esc_html($folder);
        ?>
</code><?php 
        echo $folder_size;
        ?>

                    <fieldset id="backupuploadsexcludedirs" style="padding-left:15px; margin:2px;">
						<legend><strong><?php 
        _e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = @opendir($folder))) {
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..')) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder))) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    echo '<nobr><label for="iduploadexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, BackWPup_Option::get($main, 'backupuploadsexcludedirs')), TRUE, FALSE) . ' name="backupuploadsexcludedirs[]" id="iduploadexcludedirs-' . sanitize_file_name($file) . '" value="' . $file . '" /> ' . esc_attr($file) . $folder_size . '</label><br /></nobr>';
                }
            }
            @closedir($dir);
        }
        ?>
                    </fieldset>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="dirinclude"><?php 
        _e('Extra folders to backup', 'backwpup');
        ?>
</label></th>
                <td>
					<textarea name="dirinclude" id="dirinclude" class="text code help-tip" rows="7" cols="50" title="<?php 
        esc_attr_e('Separate folder names with a line-break or a comma. Folders must be set with their absolute path!', 'backwpup');
        ?>
"><?php 
        echo BackWPup_Option::get($main, 'dirinclude');
        ?>
</textarea>
                </td>
            </tr>
		</table>

		<h3 class="title"><?php 
        _e('Exclude from backup', 'backwpup');
        ?>
</h3>
		<p></p>
		<table class="form-table">
            <tr>
                <th scope="row"><?php 
        _e('Thumbnails in uploads', 'backwpup');
        ?>
</th>
                <td>
                    <label for="idbackupexcludethumbs"><input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupexcludethumbs'), TRUE, TRUE);
        ?>
                           name="backupexcludethumbs" id="idbackupexcludethumbs" value="1" /> <?php 
        _e('Don\'t backup thumbnails from the site\'s uploads folder.', 'backwpup');
        BackWPup_Help::add_tab(__('All images with -???x???. will be excluded. Use a plugin like Regenerate Thumbnails to rebuild them after a restore.', 'backwpup'));
        ?>
</label>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="idfileexclude"><?php 
        _e('Exclude files/folders from backup', 'backwpup');
        ?>
</label></th>
                <td>
                    <textarea name="fileexclude" id="idfileexclude" class="text code help-tip" rows="7" cols="50" title="<?php 
        esc_attr_e('Separate file / folder name parts with a line-break or a comma. For example /logs/,.log,.tmp', 'backwpup');
        ?>
"><?php 
        echo BackWPup_Option::get($main, 'fileexclude');
        ?>
</textarea>
                </td>
            </tr>
        </table>

		<h3 class="title"><?php 
        _e('Special option', 'backwpup');
        ?>
</h3>
		<p></p>
		<table class="form-table">
			<tr>
				<th scope="row"><?php 
        _e('Include special files', 'backwpup');
        ?>
</th>
				<td>
					<label for="idbackupspecialfiles"><input class="checkbox" id="idbackupspecialfiles"
						   type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupspecialfiles'), TRUE, TRUE);
        ?>
						   name="backupspecialfiles" value="1" /> <?php 
        _e('Backup wp-config.php, robots.txt, .htaccess, .htpasswd and favicon.ico from root.', 'backwpup');
        BackWPup_Help::add_tab(__('If the WordPress root folder is not included in this backup job, check this option to additionally include wp-config.php, robots.txt, .htaccess, .htpasswd and favicon.ico into the backup. Your wp-config.php will be included even if you placed it in the parent directory of your root folder.', 'backwpup'));
        ?>
</label>
				</td>
			</tr>
		</table>
	<?php 
    }
예제 #3
0
    /**
     * @param $main
     */
    public function edit_tab($main)
    {
        @set_time_limit(300);
        $abs_folder_up = BackWPup_Option::get($main, 'backupabsfolderup');
        $abs_path = realpath(ABSPATH);
        if ($abs_folder_up) {
            $abs_path = dirname($abs_path);
        }
        ?>
		<h3 class="title"><?php 
        esc_html_e('Folders to backup', 'backwpup');
        ?>
</h3>
		<p></p>
		<table class="form-table">
			<tr>
				<th scope="row"><label for="idbackuproot"><?php 
        esc_html_e('Backup WordPress install folder', 'backwpup');
        ?>
</label></th>
				<td>
					<?php 
        $folder = $abs_path;
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
					<input class="checkbox"
						   type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backuproot'), TRUE, TRUE);
        ?>
						   name="backuproot" id="idbackuproot" value="1" /> <code title="<?php 
        echo esc_attr(sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), $abs_path));
        ?>
"><?php 
        echo esc_attr($folder);
        ?>
</code><?php 
        echo esc_html($folder_size);
        ?>

					<fieldset id="backuprootexcludedirs" style="padding-left:15px; margin:2px;">
                        <legend><strong><?php 
        esc_html_e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = opendir($folder))) {
            while (($file = readdir($dir)) !== FALSE) {
                $excludes = BackWPup_Option::get($main, 'backuprootexcludedirs');
                if (!in_array($file, array('.', '..'), true) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder), true)) {
                    $donotbackup = file_exists($folder . '/' . $file . '/.donotbackup');
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    $title = '';
                    if ($donotbackup) {
                        $excludes[] = $file;
                        $title = ' title="' . esc_attr__('Excluded by .donotbackup file!', 'backwpup') . '"';
                    }
                    echo '<nobr><label for="idrootexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, $excludes, true), TRUE, FALSE) . ' name="backuprootexcludedirs[]" id="idrootexcludedirs-' . sanitize_file_name($file) . '" value="' . esc_attr($file) . '"' . disabled($donotbackup, TRUE, FALSE) . $title . ' /> ' . esc_html($file) . esc_html($folder_size) . '</label><br /></nobr>';
                }
            }
            closedir($dir);
        }
        ?>
                    </fieldset>
				</td>
			</tr>
            <tr>
                <th scope="row"><label for="idbackupcontent"><?php 
        esc_html_e('Backup content folder', 'backwpup');
        ?>
</label></th>
                <td>
					<?php 
        $folder = realpath(WP_CONTENT_DIR);
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
                    <input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupcontent'), TRUE, TRUE);
        ?>
                           name="backupcontent" id="idbackupcontent" value="1" /> <code title="<?php 
        echo esc_attr(sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), WP_CONTENT_DIR));
        ?>
"><?php 
        echo esc_html($folder);
        ?>
</code><?php 
        echo esc_html($folder_size);
        ?>

                    <fieldset id="backupcontentexcludedirs" style="padding-left:15px; margin:2px;">
						<legend><strong><?php 
        esc_html_e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = opendir($folder))) {
            $excludes = BackWPup_Option::get($main, 'backupcontentexcludedirs');
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..'), true) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder), true)) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    $donotbackup = file_exists($folder . '/' . $file . '/.donotbackup');
                    $title = '';
                    if ($donotbackup) {
                        $excludes[] = $file;
                        $title = ' title="' . esc_attr__('Excluded by .donotbackup file!', 'backwpup') . '"';
                    }
                    echo '<nobr><label for="idcontentexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, $excludes, true), TRUE, FALSE) . ' name="backupcontentexcludedirs[]" id="idcontentexcludedirs-' . sanitize_file_name($file) . '" value="' . esc_attr($file) . '"' . disabled($donotbackup, TRUE, FALSE) . $title . ' /> ' . esc_html($file) . esc_html($folder_size) . '</label><br /></nobr>';
                }
            }
            closedir($dir);
        }
        ?>
                    </fieldset>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="idbackupplugins"><?php 
        _e('Backup plugins', 'backwpup');
        ?>
</label></th>
                <td>
					<?php 
        $folder = realpath(WP_PLUGIN_DIR);
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
                    <input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupplugins'), TRUE, TRUE);
        ?>
                           name="backupplugins" id="idbackupplugins" value="1" /> <code title="<?php 
        echo sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), esc_attr(WP_PLUGIN_DIR));
        ?>
"><?php 
        echo esc_attr($folder);
        ?>
</code><?php 
        echo $folder_size;
        ?>

                    <fieldset id="backuppluginsexcludedirs" style="padding-left:15px; margin:2px;">
						<legend><strong><?php 
        _e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = opendir($folder))) {
            $excludes = BackWPup_Option::get($main, 'backuppluginsexcludedirs');
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..'), true) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder), true)) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    $donotbackup = file_exists($folder . '/' . $file . '/.donotbackup');
                    $title = '';
                    if ($donotbackup) {
                        $excludes[] = $file;
                        $title = ' title="' . esc_attr__('Excluded by .donotbackup file!', 'backwpup') . '"';
                    }
                    echo '<nobr><label for="idpluginexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, $excludes, true), TRUE, FALSE) . ' name="backuppluginsexcludedirs[]" id="idpluginexcludedirs-' . sanitize_file_name($file) . '" value="' . esc_attr($file) . '"' . disabled($donotbackup, TRUE, FALSE) . $title . ' /> ' . esc_html($file) . esc_html($folder_size) . '</label><br /></nobr>';
                }
            }
            closedir($dir);
        }
        ?>
                    </fieldset>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="idbackupthemes"><?php 
        esc_html_e('Backup themes', 'backwpup');
        ?>
</label></th>
                <td>
					<?php 
        $folder = realpath(get_theme_root());
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
                    <input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupthemes'), TRUE, TRUE);
        ?>
                           name="backupthemes" id="idbackupthemes" value="1" /> <code title="<?php 
        echo sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), esc_attr(get_theme_root()));
        ?>
"><?php 
        echo esc_attr($folder);
        ?>
</code><?php 
        echo $folder_size;
        ?>

                    <fieldset id="backupthemesexcludedirs" style="padding-left:15px; margin:2px;">
						<legend><strong><?php 
        _e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = opendir($folder))) {
            $excludes = BackWPup_Option::get($main, 'backupthemesexcludedirs');
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..'), true) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder), true)) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    $donotbackup = file_exists($folder . '/' . $file . '/.donotbackup');
                    $title = '';
                    if ($donotbackup) {
                        $excludes[] = $file;
                        $title = ' title="' . esc_attr__('Excluded by .donotbackup file!', 'backwpup') . '"';
                    }
                    echo '<nobr><label for="idthemesexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, $excludes, true), TRUE, FALSE) . ' name="backupthemesexcludedirs[]" id="idthemesexcludedirs-' . sanitize_file_name($file) . '" value="' . $file . '"' . disabled($donotbackup, TRUE, FALSE) . $title . ' /> ' . esc_attr($file) . $folder_size . '</label><br /></nobr>';
                }
            }
            closedir($dir);
        }
        ?>
                    </fieldset>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="idbackupuploads"><?php 
        esc_html_e('Backup uploads folder', 'backwpup');
        ?>
</label></th>
                <td>
					<?php 
        $folder = realpath(BackWPup_File::get_upload_dir());
        if ($folder) {
            $folder = untrailingslashit(str_replace('\\', '/', $folder));
            $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder, FALSE), 2) . ')' : '';
        }
        ?>
                    <input class="checkbox"
                           type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupuploads'), TRUE, TRUE);
        ?>
                           name="backupuploads" id="idbackupuploads" value="1" /> <code title="<?php 
        echo sprintf(__('Path as set by user (symlink?): %s', 'backwpup'), esc_attr(BackWPup_File::get_upload_dir()));
        ?>
"><?php 
        echo esc_html($folder);
        ?>
</code><?php 
        echo $folder_size;
        ?>

                    <fieldset id="backupuploadsexcludedirs" style="padding-left:15px; margin:2px;">
						<legend><strong><?php 
        esc_html_e('Exclude:', 'backwpup');
        ?>
</strong></legend>
						<?php 
        if ($folder && ($dir = opendir($folder))) {
            $excludes = BackWPup_Option::get($main, 'backupuploadsexcludedirs');
            while (($file = readdir($dir)) !== FALSE) {
                if (!in_array($file, array('.', '..'), true) && is_dir($folder . '/' . $file) && !in_array(trailingslashit($folder . '/' . $file), $this->get_exclude_dirs($folder), true)) {
                    $folder_size = get_site_option('backwpup_cfg_showfoldersize') ? ' (' . size_format(BackWPup_File::get_folder_size($folder . '/' . $file), 2) . ')' : '';
                    $donotbackup = file_exists($folder . '/' . $file . '/.donotbackup');
                    $title = '';
                    if ($donotbackup) {
                        $excludes[] = $file;
                        $title = ' title="' . esc_attr__('Excluded by .donotbackup file!', 'backwpup') . '"';
                    }
                    echo '<nobr><label for="iduploadexcludedirs-' . sanitize_file_name($file) . '"><input class="checkbox" type="checkbox"' . checked(in_array($file, $excludes, true), TRUE, FALSE) . ' name="backupuploadsexcludedirs[]" id="iduploadexcludedirs-' . sanitize_file_name($file) . '" value="' . esc_attr($file) . '"' . disabled($donotbackup, TRUE, FALSE) . $title . ' /> ' . esc_html($file) . esc_html($folder_size) . '</label><br /></nobr>';
                }
            }
            closedir($dir);
        }
        ?>
                    </fieldset>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="dirinclude"><?php 
        esc_html_e('Extra folders to backup', 'backwpup');
        ?>
</label></th>
                <td>
					<textarea name="dirinclude" id="dirinclude" class="text code" rows="7" cols="50"><?php 
        echo esc_attr(BackWPup_Option::get($main, 'dirinclude'));
        ?>
</textarea>
	                <p class="description"><?php 
        esc_attr_e('Separate folder names with a line-break or a comma. Folders must be set with their absolute path!', 'backwpup');
        ?>
</p>
                </td>
            </tr>
		</table>

		<h3 class="title"><?php 
        esc_html_e('Exclude from backup', 'backwpup');
        ?>
</h3>
		<p></p>
		<table class="form-table">
            <tr>
                <th scope="row"><?php 
        esc_html_e('Thumbnails in uploads', 'backwpup');
        ?>
</th>
                <td>
                    <label for="idbackupexcludethumbs"><input class="checkbox" type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupexcludethumbs'), TRUE, TRUE);
        ?>
 name="backupexcludethumbs" id="idbackupexcludethumbs" value="1" /> <?php 
        esc_html_e('Don\'t backup thumbnails from the site\'s uploads folder.', 'backwpup');
        ?>
</label>
                </td>
            </tr>
            <tr>
                <th scope="row"><label for="idfileexclude"><?php 
        esc_html_e('Exclude files/folders from backup', 'backwpup');
        ?>
</label></th>
                <td>
                    <textarea name="fileexclude" id="idfileexclude" class="text code" rows="7" cols="50"><?php 
        echo esc_attr(BackWPup_Option::get($main, 'fileexclude'));
        ?>
</textarea>
	                <p class="description"><?php 
        esc_attr_e('Separate file / folder name parts with a line-break or a comma. For example /logs/,.log,.tmp', 'backwpup');
        ?>
</p>
                </td>
            </tr>
        </table>

		<h3 class="title"><?php 
        esc_html_e('Special options', 'backwpup');
        ?>
</h3>
		<p></p>
		<table class="form-table">
			<tr>
				<th scope="row"><?php 
        esc_html_e('Include special files', 'backwpup');
        ?>
</th>
				<td>
					<label for="idbackupspecialfiles"><input class="checkbox" id="idbackupspecialfiles" type="checkbox"<?php 
        checked(BackWPup_Option::get($main, 'backupspecialfiles'), TRUE, TRUE);
        ?>
 name="backupspecialfiles" value="1" /> <?php 
        esc_html_e('Backup wp-config.php, robots.txt, nginx.conf, .htaccess, .htpasswd and favicon.ico from root if it is not included in backup.', 'backwpup');
        ?>
</label>
				</td>
			</tr>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Use one folder above as WP install folder', 'backwpup');
        ?>
</th>
				<td>
					<label for="idbackupabsfolderup"><input class="checkbox" id="idbackupabsfolderup" type="checkbox"<?php 
        checked($abs_folder_up, TRUE, TRUE);
        ?>
							name="backupabsfolderup" value="1" /> <?php 
        _e('Use one folder above as WordPress install folder! That can be helpful, if you would backup files and folder that are not in the WordPress installation folder. Or if you made a "<a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">Giving WordPress Its Own Directory</a>" installation. Excludes must be configured again.', 'backwpup');
        ?>
</label>
				</td>
			</tr>
		</table>
	<?php 
    }