function ozh_ta_do_page_scheduled() { global $ozh_ta; if (isset($_GET['action']) && $_GET['action'] == 'cancel_auto') { check_admin_referer('ozh_ta-cancel_auto'); ozh_ta_schedule_next(0); return; } ?> <fieldset class="ozh_ta_fs"> <h3>Automatic archiving</h3> <?php $next = wp_next_scheduled('ozh_ta_cron_import'); $freq = $ozh_ta['refresh_interval']; $now = time(); if ($next < $now) { $next = $now + $freq - 1; } echo '<p>Automatic archiving is scheduled every <strong>' . ozh_ta_seconds_to_words($freq) . '</strong></p>'; echo '<p>Next update in: <strong>' . ozh_ta_next_update_in() . '</strong></p>'; $url = wp_nonce_url(admin_url('options-general.php?page=ozh_ta&action=cancel_auto'), 'ozh_ta-cancel_auto'); echo '<p><a href="' . $url . '" class="button">Disable</a> (you can restart this anytime with a manual archiving)</p>'; echo '</fieldset>'; }
/** * Delay before next update * * @param bool $human_time true to get human readable interval in hours/min/sec, false to get a number of seconds * @param bool $long if $human_time is true, displays "seconds/minutes/hours" if true, "s/m/h" if false * @return mixed string or integer */ function ozh_ta_next_update_in($human_time = true, $long = true) { global $ozh_ta; $next = wp_next_scheduled('ozh_ta_cron_import'); $freq = $ozh_ta['refresh_interval']; $now = time(); if ($next < $now && $next) { $next = $now + $freq - 1; } if ($human_time) { return ozh_ta_seconds_to_words($next - $now, $long); } else { return $next - $now; } }
</span></li> </ul> <?php /**/ ?> <h2><i class="fa fa-tags"></i> #hashtags</h2> <?php wp_tag_cloud('format=list'); ?> <h2><i class="fa fa-info-circle"></i> Bleh</h2> <ul id="bleh" class="block"> <li>Tweets archive every <span class="count"><?php global $ozh_ta; echo ozh_ta_seconds_to_words($ozh_ta['refresh_interval']); ?> </span></li> <li>Next update in <span class="count"><?php echo ozh_ta_next_update_in(true, false); ?> </span></li> <li><a href="<?php bloginfo('url'); ?> /wp-admin/">Admin</a></li> <li><?php wp_loginout(); ?> </li> </ul>