/**
  *
  */
 public static function load()
 {
     //add Help tab
     BackWPup_Help::add_tab(array('id' => 'overview', 'title' => __('Overview', 'backwpup'), 'content' => '<p>' . '</p>'));
 }
    /**
     * @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 
    }