Skip to content

Commit 21e3b69

Browse files
committed
fix next run
1 parent 0230179 commit 21e3b69

File tree

4 files changed

+18
-30
lines changed

4 files changed

+18
-30
lines changed

includes/admin/feedzy-rss-feeds-import.php

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,11 @@ public function manage_feedzy_import_columns( $column, $post_id ) {
732732
$src = sprintf( '%s: %s%s%s', __( 'Feed Group', 'feedzy-rss-feeds' ), '<a href="' . admin_url( 'edit.php?post_type=feedzy_categories' ) . '" target="_blank">', $src, '</a>' );
733733
}
734734
} else {
735-
$src = sprintf( '%s: %s%s%s', __( 'Feed Group', 'feedzy-rss-feeds' ), '<a href="' . admin_url( 'edit.php?post_type=feedzy_categories' ) . '" target="_blank">', $src, '</a>' );
735+
if ( empty( $src ) ) {
736+
$src = __( 'No Source Configured', 'feedzy-rss-feeds' );
737+
} else {
738+
$src = sprintf( '%s: %s%s%s', __( 'Feed Group', 'feedzy-rss-feeds' ), '<a href="' . admin_url( 'edit.php?post_type=feedzy_categories' ) . '" target="_blank">', $src, '</a>' );
739+
}
736740
}
737741
} else {
738742
// else link it to the feed but shorten it if it is too long.
@@ -791,28 +795,7 @@ public function manage_feedzy_import_columns( $column, $post_id ) {
791795
$next = Feedzy_Rss_Feeds_Util_Scheduler::is_scheduled( 'feedzy_cron' );
792796
}
793797
if ( $next ) {
794-
$now = new DateTime();
795-
$then = new DateTime();
796-
$then = $then->setTimestamp( $next );
797-
$in = $now->diff( $then );
798-
799-
$time_string = array();
800-
// Add days if they exist.
801-
if ( $in->d > 0 ) {
802-
// translators: %1$s days.
803-
$time_string[] = sprintf( __( '%1$d days', 'feedzy-rss-feeds' ), $in->d );
804-
}
805-
// Add hours if they exist.
806-
if ( $in->h > 0 ) {
807-
// translators: %1$s hours.
808-
$time_string[] = sprintf( __( '%1$d hours', 'feedzy-rss-feeds' ), $in->h );
809-
}
810-
// Add minutes if they exist.
811-
if ( $in->i > 0 ) {
812-
// translators: %1$s minutes.
813-
$time_string[] = sprintf( __( '%1$d minutes', 'feedzy-rss-feeds' ), $in->i );
814-
}
815-
echo wp_kses_post( join( ' ', $time_string ) );
798+
echo wp_kses_post( human_time_diff( $next, time() ) );
816799
}
817800
break;
818801
default:
@@ -882,7 +865,7 @@ private function get_last_run_details( $post_id ) {
882865

883866
// popup for items found.
884867
if ( is_array( $status['items'] ) ) {
885-
$msg .= '<div class="feedzy-items-found-' . $post_id . ' feedzy-dialog" title="' . __( 'Items found', 'feedzy-rss-feeds' ) . '"><ol>';
868+
$msg .= '<div class="feedzy-items-found-' . $post_id . ' feedzy-dialog" title="' . __( 'Items found', 'feedzy-rss-feeds' ) . '"><ol>';
886869
foreach ( $status['items'] as $url => $title ) {
887870
$msg .= sprintf( '<li><p><a href="%s" target="_blank">%s</a></p></li>', esc_url( $url ), esc_html( $title ) );
888871
}
@@ -2373,7 +2356,7 @@ private function try_save_featured_image( $img_source_url, $post_id, $post_title
23732356
*/
23742357
public function add_cron() {
23752358
$time = ! empty( $this->free_settings['general']['fz_cron_execution'] ) ? $this->get_cron_execution( $this->free_settings['general']['fz_cron_execution'] ) : time();
2376-
$schedule = ! empty( $this->free_settings['general']['fz_cron_schedule'] ) ? $this->free_settings['general']['fz_cron_schedule'] : 'hourly';
2359+
$schedule = ! empty( $this->free_settings['general']['fz_cron_schedule'] ) ? $this->free_settings['general']['fz_cron_schedule'] : ( feedzy_is_legacyv5() ? 'hourly' : 'daily' );
23772360
if ( ( isset( $_POST['nonce'] ) && isset( $_POST['tab'] ) ) && ( wp_verify_nonce( filter_input( INPUT_POST, 'nonce', FILTER_UNSAFE_RAW ), filter_input( INPUT_POST, 'tab', FILTER_UNSAFE_RAW ) ) ) ) {
23782361
if ( ! empty( $_POST['fz_cron_execution'] ) && ! empty( $_POST['fz_cron_schedule'] ) && ! empty( $_POST['fz_execution_offset'] ) ) {
23792362
$execution = sanitize_text_field( wp_unslash( $_POST['fz_cron_execution'] ) );

includes/util/feedzy-rss-feeds-util-scheduler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ class Feedzy_Rss_Feeds_Util_Scheduler {
2525
* @param string $hook The hook to check.
2626
* @param array $args Optional. Arguments to pass to the hook
2727
*
28-
* @return bool
28+
* @return bool|int
2929
*/
30-
public static function is_scheduled( $hook, $args = array() ) {
30+
public static function is_scheduled( string $hook, array $args = array() ) {
3131
if ( function_exists( 'as_has_scheduled_action' ) ) {
3232
return as_has_scheduled_action( $hook, $args );
3333
}
3434

3535
if ( function_exists( 'as_next_scheduled_action' ) ) {
3636
// For older versions of AS.
37-
return as_next_scheduled_action( $hook, $args ) !== false;
37+
return as_next_scheduled_action( $hook, $args );
3838
}
3939

40-
return wp_next_scheduled( $hook, $args ) !== false;
40+
return wp_next_scheduled( $hook, $args );
4141
}
4242

4343
/**

includes/views/css/import-metabox-edit.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ input.feedzy-toggle-round:checked + label:after {
6868
input.feedzy-toggle-round:checked + label{
6969
border-color: #f6f7f7;
7070
}
71-
71+
.feedzy-dialog:not(.feedzy-dialog-content){
72+
display:none;
73+
}
7274

7375
input.feedzy-toggle-round + label:before,
7476
input.feedzy-toggle-round + label:after {

includes/views/js/import-metabox-edit.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@
672672
modal: true,
673673
autoOpen: false,
674674
height: 400,
675+
classes: {
676+
"ui-dialog-content": "feedzy-dialog-content",
677+
},
675678
width: 500,
676679
buttons: {
677680
Ok: function () {

0 commit comments

Comments
 (0)