/** * */ public static function page() { if (!empty($_GET['jobid'])) { $jobid = (int) $_GET['jobid']; } else { //generate jobid if not exists $newjobid = BackWPup_Option::get_job_ids(); sort($newjobid); $jobid = end($newjobid) + 1; } $destinations = BackWPup::get_registered_destinations(); $job_types = BackWPup::get_job_types(); ?> <div class="wrap" id="backwpup-page"> <?php echo '<h2><span id="backwpup-page-icon"> </span>' . sprintf(__('%1$s Job: %2$s', 'backwpup'), BackWPup::get_plugin_data('name'), '<span id="h2jobtitle">' . esc_html(BackWPup_Option::get($jobid, 'name')) . '</span>') . '</h2>'; //default tabs $tabs = array('job' => array('name' => __('General', 'backwpup'), 'display' => TRUE), 'cron' => array('name' => __('Schedule', 'backwpup'), 'display' => TRUE)); //add jobtypes to tabs $job_job_types = BackWPup_Option::get($jobid, 'type'); foreach ($job_types as $typeid => $typeclass) { $tabid = 'jobtype-' . strtolower($typeid); $tabs[$tabid]['name'] = $typeclass->info['name']; $tabs[$tabid]['display'] = TRUE; if (!in_array($typeid, $job_job_types)) { $tabs[$tabid]['display'] = FALSE; } } //add destinations to tabs $jobdests = BackWPup_Option::get($jobid, 'destinations'); foreach ($destinations as $destid => $dest) { $tabid = 'dest-' . strtolower($destid); $tabs[$tabid]['name'] = sprintf(__('To: %s', 'backwpup'), $dest['info']['name']); $tabs[$tabid]['display'] = TRUE; if (!in_array($destid, $jobdests)) { $tabs[$tabid]['display'] = FALSE; } } //display tabs echo '<h2 class="nav-tab-wrapper">'; foreach ($tabs as $id => $tab) { $addclass = ''; if ($id == $_GET['tab']) { $addclass = ' nav-tab-active'; } $display = ''; if (!$tab['display']) { $display = ' style="display:none;"'; } echo '<a href="' . wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&tab=' . $id . '&jobid=' . $jobid, 'edit-job') . '" class="nav-tab' . $addclass . '" id="tab-' . $id . '" data-nexttab="' . $id . '" ' . $display . '>' . $tab['name'] . '</a>'; } echo '</h2>'; //display messages BackWPup_Admin::display_messages(); echo '<form name="editjob" id="editjob" method="post" action="' . admin_url('admin-post.php') . '">'; echo '<input type="hidden" id="jobid" name="jobid" value="' . $jobid . '" />'; echo '<input type="hidden" name="tab" value="' . $_GET['tab'] . '" />'; echo '<input type="hidden" name="nexttab" value="' . $_GET['tab'] . '" />'; echo '<input type="hidden" name="page" value="backwpupeditjob" />'; echo '<input type="hidden" name="action" value="backwpup" />'; echo '<input type="hidden" name="anchor" value="" />'; wp_nonce_field('backwpupeditjob_page'); wp_nonce_field('backwpup_ajax_nonce', 'backwpupajaxnonce', FALSE); switch ($_GET['tab']) { case 'job': echo '<div class="table" id="info-tab-job">'; ?> <h3 class="title"><?php _e('Job Name', 'backwpup'); ?> </h3> <p></p> <table class="form-table"> <tr> <th scope="row"><label for="name"><?php _e('Please name this job.', 'backwpup'); ?> </label></th> <td> <input name="name" type="text" id="name" data-empty="<?php _e('New Job', 'backwpup'); ?> " value="<?php echo BackWPup_Option::get($jobid, 'name'); ?> " class="regular-text" /> </td> </tr> </table> <h3 class="title"><?php _e('Job Tasks', 'backwpup'); ?> </h3> <p></p> <table class="form-table"> <tr> <th scope="row"><?php _e('This job is a …', 'backwpup'); ?> </th> <td> <fieldset> <legend class="screen-reader-text"><span><?php _e('Job tasks', 'backwpup'); ?> </span> </legend><?php foreach ($job_types as $id => $typeclass) { $addclass = ''; if ($typeclass->creates_file()) { $addclass .= ' filetype'; } $title = ''; if (!empty($typeclass->info['help'])) { $title = ' title="' . esc_attr($typeclass->info['help']) . '"'; $addclass .= ' help-tip'; } echo '<label for="jobtype-select-' . strtolower($id) . '"><input class="jobtype-select checkbox' . $addclass . '"' . $title . ' id="jobtype-select-' . strtolower($id) . '" type="checkbox" ' . checked(TRUE, in_array($id, BackWPup_Option::get($jobid, 'type')), FALSE) . ' name="type[]" value="' . $id . '" /> ' . $typeclass->info['description'] . '</label><br />'; } ?> </fieldset> </td> </tr> </table> <h3 class="title hasdests"><?php _e('Backup File Creation', 'backwpup'); ?> </h3> <p class="hasdests"></p> <table class="form-table hasdests"> <?php if (class_exists('BackWPup_Pro', FALSE)) { ?> <tr> <th scope="row"><?php _e('Backup type', 'backwpup'); ?> </th> <td> <fieldset> <legend class="screen-reader-text"> <span><?php _e('Backup type', 'backwpup'); ?> </span></legend> <label for="idbackuptype-sync"><input class="radio" type="radio"<?php checked('sync', BackWPup_Option::get($jobid, 'backuptype'), TRUE); ?> name="backuptype" id="idbackuptype-sync" value="sync"/> <?php _e('Synchronize file by file to destination', 'backwpup'); ?> </label><br/> <label for="idbackuptype-archive"><input class="radio" type="radio"<?php checked('archive', BackWPup_Option::get($jobid, 'backuptype'), TRUE); ?> name="backuptype" id="idbackuptype-archive" value="archive"/> <?php _e('Create a backup archive', 'backwpup'); ?> </label><br/> </fieldset> </td> </tr> <?php } ?> <tr class="nosync"> <th scope="row"><label for="archivename"><?php _e('Archive name', 'backwpup'); ?> </label></th> <td> <input name="archivename" type="text" id="archivename" value="<?php echo BackWPup_Option::get($jobid, 'archivename'); ?> " class="regular-text code help-tip" title="<?php echo "<strong>" . esc_attr__('Replacement patterns:', 'backwpup') . "</strong><br />"; echo esc_attr__('%d = Two digit day of the month, with leading zeros', 'backwpup') . '<br />'; echo esc_attr__('%j = Day of the month, without leading zeros', 'backwpup') . '<br />'; echo esc_attr__('%m = Day of the month, with leading zeros', 'backwpup') . '<br />'; echo esc_attr__('%n = Representation of the month (without leading zeros)', 'backwpup') . '<br />'; echo esc_attr__('%Y = Four digit representation for the year', 'backwpup') . '<br />'; echo esc_attr__('%y = Two digit representation of the year', 'backwpup') . '<br />'; echo esc_attr__('%a = Lowercase ante meridiem (am) and post meridiem (pm)', 'backwpup') . '<br />'; echo esc_attr__('%A = Uppercase ante meridiem (AM) and post meridiem (PM)', 'backwpup') . '<br />'; echo esc_attr__('%B = Swatch Internet Time', 'backwpup') . '<br />'; echo esc_attr__('%g = Hour in 12-hour format, without leading zeros', 'backwpup') . '<br />'; echo esc_attr__('%G = Hour in 24-hour format, without leading zeros', 'backwpup') . '<br />'; echo esc_attr__('%h = Hour in 12-hour format, with leading zeros', 'backwpup') . '<br />'; echo esc_attr__('%H = Hour in 24-hour format, with leading zeros', 'backwpup') . '<br />'; echo esc_attr__('%i = Two digit representation of the minute', 'backwpup') . '<br />'; echo esc_attr__('%s = Two digit representation of the second', 'backwpup') . '<br />'; ?> " /> <?php $current_time = current_time('timestamp'); $datevars = array('%d', '%j', '%m', '%n', '%Y', '%y', '%a', '%A', '%B', '%g', '%G', '%h', '%H', '%i', '%s'); $datevalues = array(date('d', $current_time), date('j', $current_time), date('m', $current_time), date('n', $current_time), date('Y', $current_time), date('y', $current_time), date('a', $current_time), date('A', $current_time), date('B', $current_time), date('g', $current_time), date('G', $current_time), date('h', $current_time), date('H', $current_time), date('i', $current_time), date('s', $current_time)); $archivename = str_replace($datevars, $datevalues, BackWPup_Job::sanitize_file_name(BackWPup_Option::get($jobid, 'archivename'))); echo '<p>Preview: <code><span id="archivefilename">' . $archivename . '</span><span id="archiveformat">' . BackWPup_Option::get($jobid, 'archiveformat') . '</span></code></p>'; ?> </td> </tr> <tr class="nosync"> <th scope="row"><?php _e('Archive Format', 'backwpup'); ?> </th> <td> <fieldset> <legend class="screen-reader-text"><span><?php _e('Archive Format', 'backwpup'); ?> </span></legend> <?php if (function_exists('gzopen') || class_exists('ZipArchive')) { echo '<label for="idarchiveformat-zip"><input class="radio help-tip" title="' . __('PHP Zip functions will be used if available (needs less memory). Otherwise the PCLZip class will be used.', 'backwpup') . '" type="radio"' . checked('.zip', BackWPup_Option::get($jobid, 'archiveformat'), FALSE) . ' name="archiveformat" id="idarchiveformat-zip" value=".zip" /> ' . __('Zip', 'backwpup') . '</label><br />'; } else { echo '<label for="idarchiveformat-zip"><input class="radio help-tip" title="' . __('Disabled due to missing PHP function.', 'backwpup') . '" type="radio"' . checked('.zip', BackWPup_Option::get($jobid, 'archiveformat'), FALSE) . ' name="archiveformat" id="idarchiveformat-zip" value=".zip" disabled="disabled" /> ' . __('Zip', 'backwpup') . '</label><br />'; } echo '<label for="idarchiveformat-tar"><input class="radio help-tip" title="' . __('A tarballed, not compressed archive (fast and less memory)', 'backwpup') . '" type="radio"' . checked('.tar', BackWPup_Option::get($jobid, 'archiveformat'), FALSE) . ' name="archiveformat" id="idarchiveformat-tar" value=".tar" /> ' . __('Tar', 'backwpup') . '</label><br />'; if (function_exists('gzopen')) { echo '<label for="idarchiveformat-targz"><input class="radio help-tip" title="' . __('A tarballed, GZipped archive (fast and less memory)', 'backwpup') . '" type="radio"' . checked('.tar.gz', BackWPup_Option::get($jobid, 'archiveformat'), FALSE) . ' name="archiveformat" id="idarchiveformat-targz" value=".tar.gz" /> ' . __('Tar GZip', 'backwpup') . '</label><br />'; } else { echo '<label for="idarchiveformat-targz"><input class="radio help-tip" title="' . __('Disabled due to missing PHP function.', 'backwpup') . '" type="radio"' . checked('.tar.gz', BackWPup_Option::get($jobid, 'archiveformat'), FALSE) . ' name="archiveformat" id="idarchiveformat-targz" value=".tar.gz" disabled="disabled" /> ' . __('Tar GZip', 'backwpup') . '</label><br />'; } if (function_exists('bzopen')) { echo '<label for="idarchiveformat-tarbz2"><input class="radio help-tip" title="' . __('A tarballed, BZipped archive (fast and less memory)', 'backwpup') . '" type="radio"' . checked('.tar.bz2', BackWPup_Option::get($jobid, 'archiveformat'), FALSE) . ' name="archiveformat" id="idarchiveformat-tarbz2" value=".tar.bz2" /> ' . __('Tar BZip2', 'backwpup') . '</label><br />'; } else { echo '<label for="idarchiveformat-tarbz2"><input class="radio help-tip" title="' . __('Disabled due to missing PHP function.', 'backwpup') . '" type="radio"' . checked('.tar.bz2', BackWPup_Option::get($jobid, 'archiveformat'), FALSE) . ' name="archiveformat" id="idarchiveformat-tarbz2" value=".tar.bz2" disabled="disabled" /> ' . __('Tar BZip2', 'backwpup') . '</label><br />'; } ?> </fieldset> </td> </tr> </table> <h3 class="title hasdests"><?php _e('Job Destination', 'backwpup'); ?> </h3> <p class="hasdests"></p> <table class="form-table hasdests"> <tr> <th scope="row"><?php _e('Where should your backup file be stored?', 'backwpup'); ?> </th> <td> <fieldset> <legend class="screen-reader-text"><span><?php _e('Where should your backup file be stored?', 'backwpup'); ?> </span> </legend><?php foreach ($destinations as $id => $dest) { $syncclass = ''; if (!$dest['can_sync']) { $syncclass = 'nosync'; } $title = ''; $helpclass = ''; if (!empty($dest['info']['help'])) { $title = ' title="' . esc_attr($dest['info']['help']) . '"'; $helpclass = ' help-tip'; } echo '<span class="' . $syncclass . '"><label for="dest-select-' . strtolower($id) . '"><input class="checkbox' . $helpclass . '"' . $title . ' id="dest-select-' . strtolower($id) . '" type="checkbox" ' . checked(TRUE, in_array($id, BackWPup_Option::get($jobid, 'destinations')), FALSE) . ' name="destinations[]" value="' . $id . '" ' . disabled(!empty($dest['error']), TRUE, FALSE) . ' /> ' . $dest['info']['description']; if (!empty($dest['error'])) { echo '<br /><span class="description">' . $dest['error'] . '</span>'; } echo '</label><br /></span>'; } ?> </fieldset> </td> </tr> </table> <h3 class="title"><?php _e('Log Files', 'backwpup'); ?> </h3> <p></p> <table class="form-table"> <tr> <th scope="row"><label for="mailaddresslog"><?php _e('Send log to email address', 'backwpup'); ?> </label></th> <td> <input name="mailaddresslog" type="text" id="mailaddresslog" value="<?php echo BackWPup_Option::get($jobid, 'mailaddresslog'); ?> " class="regular-text help-tip" title="<?php esc_attr_e('Leave empty to not have log sent. Or separate with , for more than one receiver.', 'backwpup'); ?> " /> </td> </tr> <tr> <th scope="row"><label for="mailaddresssenderlog"><?php _e('Email FROM field', 'backwpup'); ?> </label></th> <td> <input name="mailaddresssenderlog" type="text" id="mailaddresssenderlog" value="<?php echo BackWPup_Option::get($jobid, 'mailaddresssenderlog'); ?> " class="regular-text help-tip" title="<?php esc_attr_e('Email "From" field (Name < you@your-email-address.tld >)', 'backwpup'); ?> " /> </td> </tr> <tr> <th scope="row"><?php _e('Errors only', 'backwpup'); ?> </th> <td> <label for="idmailerroronly"> <input class="checkbox" value="1" id="idmailerroronly" type="checkbox" <?php checked(BackWPup_Option::get($jobid, 'mailerroronly'), TRUE); ?> name="mailerroronly" /> <?php _e('Send email with log only when errors occur during job execution.', 'backwpup'); ?> </label> </td> </tr> </table> <?php echo '</div>'; break; case 'cron': echo '<div class="table" id="info-tab-cron">'; ?> <h3 class="title"><?php _e('Job Schedule', 'backwpup'); ?> </h3> <p></p> <table class="form-table"> <tr> <th scope="row"><?php _e('Start job', 'backwpup'); ?> </th> <td> <fieldset> <legend class="screen-reader-text"><span><?php _e('Start job', 'backwpup'); ?> </span></legend> <label for="idactivetype"><input class="radio" type="radio"<?php checked('', BackWPup_Option::get($jobid, 'activetype'), TRUE); ?> name="activetype" id="idactivetype" value="" /> <?php _e('manually only', 'backwpup'); ?> </label><br/> <label for="idactivetype-wpcron"><input class="radio" type="radio"<?php checked('wpcron', BackWPup_Option::get($jobid, 'activetype'), TRUE); ?> name="activetype" id="idactivetype-wpcron" value="wpcron" /> <?php _e('with WordPress cron', 'backwpup'); ?> </label><br/> <?php $disabled = ''; $easycron_api = get_site_option('backwpup_cfg_easycronapikey'); if (empty($easycron_api)) { $disabled = ' disabled="disabled"'; } ?> <label for="idactivetype-easycron"><input class="radio help-tip" type="radio"<?php checked('easycron', BackWPup_Option::get($jobid, 'activetype'), TRUE); ?> name="activetype" id="idactivetype-easycron"<?php echo $disabled; ?> value="easycron" title="<?php _e('Use EasyCron.com Cron jobs.'); ?> " /> <?php _e('with <a href="https://www.easycron.com?ref=36673" class="help-tip" title="Affiliate Link!">EasyCron.com</a>', 'backwpup'); ?> <?php if (empty($easycron_api)) { echo ' <strong>' . sprintf(__('Setup <a href="https://www.easycron.com?ref=36673" class="help-tip" title="Affiliate Link!">Account</a> / <a href="%s">API Key</a> first.', 'backwpup'), network_admin_url('admin.php') . '?page=backwpupsettings#backwpup-tab-apikey') . '</strong>'; } ?> </label><br/> <?php $url = BackWPup_Job::get_jobrun_url('runext', BackWPup_Option::get($jobid, 'jobid')); ?> <label for="idactivetype-link"><input class="radio help-tip" type="radio"<?php checked('link', BackWPup_Option::get($jobid, 'activetype'), TRUE); ?> name="activetype" id="idactivetype-link" value="link" title="<?php esc_attr_e('Copy the link for an external start. This option has to be activated to make the link work.', 'backwpup'); ?> " /> <?php _e('with a link', 'backwpup'); ?> <code><a href="<?php echo $url['url']; ?> " target="_blank"><?php echo $url['url']; ?> </a></code></label> <br /> </fieldset> </td> </tr> <tr> <th scope="row"><?php _e('Start job with CLI', 'backwpup'); ?> </th> <td class="help-tip" title="<?php esc_attr_e('Use WP-CLI commands to let the job start with the server’s cron on command line interface.', 'backwpup'); ?> "> <?php _e('Use <a href="http://wp-cli.org/">WP-CLI</a> to run jobs from commandline.', 'backwpup'); ?> </td> </tr> </table> <h3 class="title wpcron"><?php _e('Schedule execution time', 'backwpup'); ?> </h3> <?php BackWPup_Page_Editjob::ajax_cron_text(array('cronstamp' => BackWPup_Option::get($jobid, 'cron'), 'crontype' => BackWPup_Option::get($jobid, 'cronselect'))); ?> <table class="form-table wpcron"> <tr> <th scope="row"><?php _e('Scheduler type', 'backwpup'); ?> </th> <td> <fieldset> <legend class="screen-reader-text"><span><?php _e('Scheduler type', 'backwpup'); ?> </span></legend> <label for="idcronselect-basic"><input class="radio" type="radio"<?php checked('basic', BackWPup_Option::get($jobid, 'cronselect'), TRUE); ?> name="cronselect" id="idcronselect-basic" value="basic" /> <?php _e('basic', 'backwpup'); ?> </label><br/> <label for="idcronselect-advanced"><input class="radio" type="radio"<?php checked('advanced', BackWPup_Option::get($jobid, 'cronselect'), TRUE); ?> name="cronselect" id="idcronselect-advanced" value="advanced" /> <?php _e('advanced', 'backwpup'); ?> </label><br/> </fieldset> </td> </tr> <?php list($cronstr['minutes'], $cronstr['hours'], $cronstr['mday'], $cronstr['mon'], $cronstr['wday']) = explode(' ', BackWPup_Option::get($jobid, 'cron'), 5); if (strstr($cronstr['minutes'], '*/')) { $minutes = explode('/', $cronstr['minutes']); } else { $minutes = explode(',', $cronstr['minutes']); } if (strstr($cronstr['hours'], '*/')) { $hours = explode('/', $cronstr['hours']); } else { $hours = explode(',', $cronstr['hours']); } if (strstr($cronstr['mday'], '*/')) { $mday = explode('/', $cronstr['mday']); } else { $mday = explode(',', $cronstr['mday']); } if (strstr($cronstr['mon'], '*/')) { $mon = explode('/', $cronstr['mon']); } else { $mon = explode(',', $cronstr['mon']); } if (strstr($cronstr['wday'], '*/')) { $wday = explode('/', $cronstr['wday']); } else { $wday = explode(',', $cronstr['wday']); } ?> <tr class="wpcronbasic"<?php if (BackWPup_Option::get($jobid, 'cronselect') != 'basic') { echo ' style="display:none;"'; } ?> > <th scope="row"><?php _e('Scheduler', 'backwpup'); ?> </th> <td> <table id="wpcronbasic"> <tr> <th> <?php _e('Type', 'backwpup'); ?> </th> <th> </th> <th> <?php _e('Hour', 'backwpup'); ?> </th> <th> <?php _e('Minute', 'backwpup'); ?> </th> </tr> <tr> <td><label for="idcronbtype-mon"><?php echo '<input class="radio" type="radio"' . checked(TRUE, is_numeric($mday[0]), FALSE) . ' name="cronbtype" id="idcronbtype-mon" value="mon" /> ' . __('monthly', 'backwpup'); ?> </label></td> <td><select name="moncronmday"><?php for ($i = 1; $i <= 31; $i++) { echo '<option ' . selected(in_array("{$i}", $mday, TRUE), TRUE, FALSE) . ' value="' . $i . '" />' . __('on', 'backwpup') . ' ' . $i . '</option>'; } ?> </select></td> <td><select name="moncronhours"><?php for ($i = 0; $i < 24; $i++) { echo '<option ' . selected(in_array("{$i}", $hours, TRUE), TRUE, FALSE) . ' value="' . $i . '" />' . $i . '</option>'; } ?> </select></td> <td><select name="moncronminutes"><?php for ($i = 0; $i < 60; $i = $i + 5) { echo '<option ' . selected(in_array("{$i}", $minutes, TRUE), TRUE, FALSE) . ' value="' . $i . '" />' . $i . '</option>'; } ?> </select></td> </tr> <tr> <td><label for="idcronbtype-week"><?php echo '<input class="radio" type="radio"' . checked(TRUE, is_numeric($wday[0]), FALSE) . ' name="cronbtype" id="idcronbtype-week" value="week" /> ' . __('weekly', 'backwpup'); ?> </label></td> <td><select name="weekcronwday"> <?php echo '<option ' . selected(in_array("0", $wday, TRUE), TRUE, FALSE) . ' value="0" />' . __('Sunday', 'backwpup') . '</option>'; echo '<option ' . selected(in_array("1", $wday, TRUE), TRUE, FALSE) . ' value="1" />' . __('Monday', 'backwpup') . '</option>'; echo '<option ' . selected(in_array("2", $wday, TRUE), TRUE, FALSE) . ' value="2" />' . __('Tuesday', 'backwpup') . '</option>'; echo '<option ' . selected(in_array("3", $wday, TRUE), TRUE, FALSE) . ' value="3" />' . __('Wednesday', 'backwpup') . '</option>'; echo '<option ' . selected(in_array("4", $wday, TRUE), TRUE, FALSE) . ' value="4" />' . __('Thursday', 'backwpup') . '</option>'; echo '<option ' . selected(in_array("5", $wday, TRUE), TRUE, FALSE) . ' value="5" />' . __('Friday', 'backwpup') . '</option>'; echo '<option ' . selected(in_array("6", $wday, TRUE), TRUE, FALSE) . ' value="6" />' . __('Saturday', 'backwpup') . '</option>'; ?> </select></td> <td><select name="weekcronhours"><?php for ($i = 0; $i < 24; $i++) { echo '<option ' . selected(in_array("{$i}", $hours, TRUE), TRUE, FALSE) . ' value="' . $i . '" />' . $i . '</option>'; } ?> </select></td> <td><select name="weekcronminutes"><?php for ($i = 0; $i < 60; $i = $i + 5) { echo '<option ' . selected(in_array("{$i}", $minutes, TRUE), TRUE, FALSE) . ' value="' . $i . '" />' . $i . '</option>'; } ?> </select></td> </tr> <tr> <td><label for="idcronbtype-day"><?php echo '<input class="radio" type="radio"' . checked("**", $mday[0] . $wday[0], FALSE) . ' name="cronbtype" id="idcronbtype-day" value="day" /> ' . __('daily', 'backwpup'); ?> </label></td> <td></td> <td><select name="daycronhours"><?php for ($i = 0; $i < 24; $i++) { echo '<option ' . selected(in_array("{$i}", $hours, TRUE), TRUE, FALSE) . ' value="' . $i . '" />' . $i . '</option>'; } ?> </select></td> <td><select name="daycronminutes"><?php for ($i = 0; $i < 60; $i = $i + 5) { echo '<option ' . selected(in_array("{$i}", $minutes, TRUE), TRUE, FALSE) . ' value="' . $i . '" />' . $i . '</option>'; } ?> </select></td> </tr> <tr> <td><label for="idcronbtype-hour"><?php echo '<input class="radio" type="radio"' . checked("*", $hours[0], FALSE, FALSE) . ' name="cronbtype" id="idcronbtype-hour" value="hour" /> ' . __('hourly', 'backwpup'); ?> </label></td> <td></td> <td></td> <td><select name="hourcronminutes"><?php for ($i = 0; $i < 60; $i = $i + 5) { echo '<option ' . selected(in_array("{$i}", $minutes, TRUE), TRUE, FALSE) . ' value="' . $i . '" />' . $i . '</option>'; } ?> </select></td> </tr> </table> </td> </tr> <tr class="wpcronadvanced"<?php if (BackWPup_Option::get($jobid, 'cronselect') != 'advanced') { echo ' style="display:none;"'; } ?> > <th scope="row"><?php _e('Scheduler', 'backwpup'); ?> </th> <td> <div id="cron-min-box"> <b><?php _e('Minutes:', 'backwpup'); ?> </b><br/> <?php echo '<label for="idcronminutes"><input class="checkbox" type="checkbox"' . checked(in_array("*", $minutes, TRUE), TRUE, FALSE) . ' name="cronminutes[]" id="idcronminutes" value="*" /> ' . __('Any (*)', 'backwpup') . '</label><br />'; ?> <div id="cron-min"><?php for ($i = 0; $i < 60; $i = $i + 5) { echo '<label for="idcronminutes-' . $i . '"><input class="checkbox" type="checkbox"' . checked(in_array("{$i}", $minutes, TRUE), TRUE, FALSE) . ' name="cronminutes[]" id="idcronminutes-' . $i . '" value="' . $i . '" /> ' . $i . '</label><br />'; } ?> </div> </div> <div id="cron-hour-box"> <b><?php _e('Hours:', 'backwpup'); ?> </b><br/> <?php echo '<label for="idcronhours"><input class="checkbox" type="checkbox"' . checked(in_array("*", $hours, TRUE), TRUE, FALSE) . ' name="cronhours[]" for="idcronhours" value="*" /> ' . __('Any (*)', 'backwpup') . '</label><br />'; ?> <div id="cron-hour"><?php for ($i = 0; $i < 24; $i++) { echo '<label for="idcronhours-' . $i . '"><input class="checkbox" type="checkbox"' . checked(in_array("{$i}", $hours, TRUE), TRUE, FALSE) . ' name="cronhours[]" id="idcronhours-' . $i . '" value="' . $i . '" /> ' . $i . '</label><br />'; } ?> </div> </div> <div id="cron-day-box"> <b><?php _e('Day of Month:', 'backwpup'); ?> </b><br/> <label for="idcronmday"><input class="checkbox" type="checkbox"<?php checked(in_array("*", $mday, TRUE), TRUE, TRUE); ?> name="cronmday[]" id="idcronmday" value="*"/> <?php _e('Any (*)', 'backwpup'); ?> </label> <br/> <div id="cron-day"> <?php for ($i = 1; $i <= 31; $i++) { echo '<label for="idcronmday-' . $i . '"><input class="checkbox" type="checkbox"' . checked(in_array("{$i}", $mday, TRUE), TRUE, FALSE) . ' name="cronmday[]" id="idcronmday-' . $i . '" value="' . $i . '" /> ' . $i . '</label><br />'; } ?> </div> </div> <div id="cron-month-box"> <b><?php _e('Month:', 'backwpup'); ?> </b><br/> <?php echo '<label for="idcronmon"><input class="checkbox" type="checkbox"' . checked(in_array("*", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon" value="*" /> ' . __('Any (*)', 'backwpup') . '</label><br />'; ?> <div id="cron-month"> <?php echo '<label for="idcronmon-1"><input class="checkbox" type="checkbox"' . checked(in_array("1", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-1" value="1" /> ' . __('January', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-2"><input class="checkbox" type="checkbox"' . checked(in_array("2", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-2" value="2" /> ' . __('February', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-3"><input class="checkbox" type="checkbox"' . checked(in_array("3", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-3" value="3" /> ' . __('March', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-4"><input class="checkbox" type="checkbox"' . checked(in_array("4", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-4" value="4" /> ' . __('April', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-5"><input class="checkbox" type="checkbox"' . checked(in_array("5", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-5" value="5" /> ' . __('May', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-6"><input class="checkbox" type="checkbox"' . checked(in_array("6", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-6" value="6" /> ' . __('June', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-7"><input class="checkbox" type="checkbox"' . checked(in_array("7", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-7" value="7" /> ' . __('July', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-8"><input class="checkbox" type="checkbox"' . checked(in_array("8", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-8" value="8" /> ' . __('August', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-9"><input class="checkbox" type="checkbox"' . checked(in_array("9", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-9" value="9" /> ' . __('September', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-10"><input class="checkbox" type="checkbox"' . checked(in_array("10", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-10" value="10" /> ' . __('October', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-11"><input class="checkbox" type="checkbox"' . checked(in_array("11", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-11" value="11" /> ' . __('November', 'backwpup') . '</label><br />'; echo '<label for="idcronmon-12"><input class="checkbox" type="checkbox"' . checked(in_array("12", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-12" value="12" /> ' . __('December', 'backwpup') . '</label><br />'; ?> </div> </div> <div id="cron-weekday-box"> <b><?php _e('Day of Week:', 'backwpup'); ?> </b><br/> <?php echo '<label for="idcronwday"><input class="checkbox" type="checkbox"' . checked(in_array("*", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday" value="*" /> ' . __('Any (*)', 'backwpup') . '</label><br />'; ?> <div id="cron-weekday"> <?php echo '<label for="idcronwday-0"><input class="checkbox" type="checkbox"' . checked(in_array("0", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-0" value="0" /> ' . __('Sunday', 'backwpup') . '</label><br />'; echo '<label for="idcronwday-1"><input class="checkbox" type="checkbox"' . checked(in_array("1", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-1" value="1" /> ' . __('Monday', 'backwpup') . '</label><br />'; echo '<label for="idcronwday-2"><input class="checkbox" type="checkbox"' . checked(in_array("2", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-2" value="2" /> ' . __('Tuesday', 'backwpup') . '</label><br />'; echo '<label for="idcronwday-3"><input class="checkbox" type="checkbox"' . checked(in_array("3", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-3" value="3" /> ' . __('Wednesday', 'backwpup') . '</label><br />'; echo '<label for="idcronwday-4"><input class="checkbox" type="checkbox"' . checked(in_array("4", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-4" value="4" /> ' . __('Thursday', 'backwpup') . '</label><br />'; echo '<label for="idcronwday-5"><input class="checkbox" type="checkbox"' . checked(in_array("5", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-5" value="5" /> ' . __('Friday', 'backwpup') . '</label><br />'; echo '<label for="idcronwday-6"><input class="checkbox" type="checkbox"' . checked(in_array("6", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-6" value="6" /> ' . __('Saturday', 'backwpup') . '</label><br />'; ?> </div> </div> <br class="clear"/> </td> </tr> </table> <?php echo '</div>'; break; default: echo '<div class="table" id="info-tab-' . $_GET['tab'] . '">'; if (strstr($_GET['tab'], 'dest-')) { $dest_object = BackWPup::get_destination(str_replace('dest-', '', $_GET['tab'])); $dest_object->edit_tab($jobid); } if (strstr($_GET['tab'], 'jobtype-')) { $id = strtoupper(str_replace('jobtype-', '', $_GET['tab'])); $job_types[$id]->edit_tab($jobid); } echo '</div>'; } echo '<p class="submit">'; submit_button(__('Save changes', 'backwpup'), 'primary', 'save', FALSE, array('tabindex' => '2', 'accesskey' => 'p')); echo '</p></form>'; ?> </div> <script type="text/javascript"> //<![CDATA[ jQuery(document).ready(function ($) { // auto post if things changed var changed = false; $( '#editjob' ).change( function () { changed = true; }); $( '.nav-tab' ).click( function () { if ( changed ) { $( 'input[name="nexttab"]' ).val( $(this).data( "nexttab" ) ); $( '#editjob' ).submit(); return false; } }); <?php //add inline js if (strstr($_GET['tab'], 'dest-')) { $dest_object = BackWPup::get_destination(str_replace('dest-', '', $_GET['tab'])); $dest_object->edit_inline_js(); } if (strstr($_GET['tab'], 'jobtype-')) { $id = strtoupper(str_replace('jobtype-', '', $_GET['tab'])); $job_types[$id]->edit_inline_js(); } ?> }); //]]> </script> <?php }
/** * @param $id */ public function edit_form_post_save($id) { global $wpdb; /* @var wpdb $wpdb */ if ($_POST['dbdumpfilecompression'] === '' || $_POST['dbdumpfilecompression'] === '.gz') { BackWPup_Option::update($id, 'dbdumpfilecompression', $_POST['dbdumpfilecompression']); } BackWPup_Option::update($id, 'dbdumpfile', BackWPup_Job::sanitize_file_name($_POST['dbdumpfile'])); //selected tables $dbdumpexclude = array(); $checked_db_tables = array(); if (isset($_POST['tabledb'])) { foreach ($_POST['tabledb'] as $dbtable) { $checked_db_tables[] = sanitize_text_field($dbtable); } } $dbtables = $wpdb->get_results('SHOW TABLES FROM `' . DB_NAME . '`', ARRAY_N); foreach ($dbtables as $dbtable) { if (!in_array($dbtable[0], $checked_db_tables, true)) { $dbdumpexclude[] = $dbtable[0]; } } BackWPup_Option::update($id, 'dbdumpexclude', $dbdumpexclude); }
/** * @param $id */ public function edit_form_post_save($id) { BackWPup_Option::update($id, 'wpexportcontent', $_POST['wpexportcontent']); BackWPup_Option::update($id, 'wpexportfile', BackWPup_Job::sanitize_file_name($_POST['wpexportfile'])); if ($_POST['wpexportfilecompression'] == '' || $_POST['wpexportfilecompression'] == '.gz' || $_POST['wpexportfilecompression'] == '.bz2') { BackWPup_Option::update($id, 'wpexportfilecompression', $_POST['wpexportfilecompression']); } }
public function edit_form_post_save($id) { BackWPup_Option::update($id, 'widgetlistfile', BackWPup_Job::sanitize_file_name($_POST['widgetlistfile'])); }