' . __( 'This screen allows you to see all the crons on your WordPress site.', '0-day-analytics' ) . '
';
$help_text .= '' . __( 'You set which columns to see or filter and search for given cron(s).', '0-day-analytics' ) . '
';
$help_text .= '' . __( 'You can delete, run or edit crons - keep in mind that you may end up editing cron that is no longer available (if the time passes).', '0-day-analytics' ) . '
';
$help_text .= '' . __( 'Bulk operations are supported and you can even add new cron directly from here.', '0-day-analytics' ) . '
';
return $help_text;
}
/**
* Displays the cron page.
*
* @return void
*
* @since 1.1.0
*/
public static function analytics_cron_page() {
// Capability guard: only allow administrators (or users with equivalent capability).
if ( ! \current_user_can( 'manage_options' ) ) {
\wp_die( \esc_html__( 'You do not have permission to manage cron jobs.', '0-day-analytics' ) );
}
\add_thickbox();
\wp_enqueue_script( 'wp-api-fetch' );
// \wp_enqueue_script( 'plugin-install' );
?>
',
\esc_attr( isset( $_REQUEST['event_type'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['event_type'] ) ) : '' )
);
printf(
' ',
\esc_attr( isset( $_REQUEST['plugin'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['plugin'] ) ) : '' )
);
?>
prepare_items();
?>
' . \esc_html__( 'Add New Cron', '0-day-analytics' ) . ''; ?>
views(); ?>
get_error_code() ) {
?>
get_error_message(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
%1$s',
sprintf(
/* translators: %s: Error message text. */
esc_html__( 'There was a problem spawning a call to the WP-Cron system on your site. This means WP-Cron events on your site may not work. The problem was: %s', '0-day-analytics' ),
'
' . \esc_html( $status->get_error_message() ) . ' '
)
);
?>
', \esc_attr( $page ) );
// printf( ' ', \esc_attr( $paged ) );
printf(
' ',
\esc_attr( isset( $_REQUEST['event_type'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['event_type'] ) ) : '' )
);
printf(
' ',
\esc_attr( isset( $_REQUEST['plugin'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['plugin'] ) ) : '' )
);
printf(
' ',
\esc_attr( isset( $_REQUEST['site'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['site'] ) ) : '' )
);
printf(
' ',
\esc_attr( isset( $_REQUEST['site'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['site'] ) ) : '' )
);
?>
search_box(
__( 'Search', '0-day-analytics' ),
strtolower( $events_list::get_table_name() ) . '-find'
);
$events_list->display();
?>
Crons_List::CRON_MENU_SLUG,
Crons_List::SEARCH_INPUT => Crons_List::escaped_search_input(),
'updated' => true,
'event_type' => ( isset( $_REQUEST['event_type'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['event_type'] ) ) : '' ),
),
\admin_url( 'admin.php' )
)
)
);
exit;
}
/**
* Collects all the data from the form and adds the transient.
*
* @return void
*
* @since 1.9.8.1
*/
public static function new_cron() {
// Capability guard: only allow administrators (or users with equivalent capability).
if ( ! \current_user_can( 'manage_options' ) ) {
\wp_die( \esc_html__( 'You do not have permission to manage crons.', '0-day-analytics' ) );
}
// Bail if nonce fails.
if ( empty( $_REQUEST['_wpnonce'] ) || ! WP_Helper::verify_admin_nonce( Crons_List::NONCE_NAME ) ) {
return;
}
Crons_Helper::add_cron();
\wp_safe_redirect(
\remove_query_arg(
array( 'deleted' ),
\add_query_arg(
array(
'page' => Crons_List::CRON_MENU_SLUG,
Crons_List::SEARCH_INPUT => Crons_List::escaped_search_input(),
'inserted' => true,
),
\admin_url( 'admin.php' )
)
)
);
exit;
}
/**
* Handles plugin dropdown filter submission for cron list.
*
* @return void
*/
public static function plugin_filter_action() {
if ( isset( $_REQUEST['plugin_top'] ) || isset( $_REQUEST['plugin_bottom'] ) ) {
if ( \check_admin_referer( Crons_List::PLUGIN_FILTER_ACTION, Crons_List::PLUGIN_FILTER_ACTION . 'nonce' ) ) {
$plugin = isset( $_REQUEST['plugin_top'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['plugin_top'] ) ) : \sanitize_text_field( \wp_unslash( $_REQUEST['plugin_bottom'] ) );
\wp_safe_redirect(
\remove_query_arg(
array( 'deleted' ),
\add_query_arg(
array(
'page' => Crons_List::CRON_MENU_SLUG,
Crons_List::SEARCH_INPUT => Crons_List::escaped_search_input(),
'plugin' => rawurlencode( $plugin ),
'site' => ( isset( $_REQUEST['site'] ) ? rawurlencode( sanitize_text_field( wp_unslash( $_REQUEST['site'] ) ) ) : '' ),
'event_type' => ( isset( $_REQUEST['event_type'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['event_type'] ) ) : '' ),
'schedules_filter' => ( isset( $_REQUEST['schedules_filter'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['schedules_filter'] ) ) : '' ),
),
\admin_url( 'admin.php' )
)
)
);
exit;
}
}
}
/**
* Handles site filter submission for cron list.
*
* @return void
*/
public static function site_filter_action() {
// Only network admins can filter by site.
if ( ! ( function_exists( 'is_multisite' ) && is_multisite() && current_user_can( 'manage_network' ) ) ) {
return;
}
if ( isset( $_REQUEST['site_top'] ) || isset( $_REQUEST['site_bottom'] ) ) {
if ( \check_admin_referer( Crons_List::SITE_FILTER_ACTION, Crons_List::SITE_FILTER_ACTION . 'nonce' ) ) {
$site = isset( $_REQUEST['site_top'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['site_top'] ) ) : \sanitize_text_field( \wp_unslash( $_REQUEST['site_bottom'] ) );
\wp_safe_redirect(
\remove_query_arg(
array( 'deleted' ),
\add_query_arg(
array(
'page' => Crons_List::CRON_MENU_SLUG,
Crons_List::SEARCH_INPUT => Crons_List::escaped_search_input(),
'site' => rawurlencode( $site ),
'plugin' => ( isset( $_REQUEST['plugin'] ) ? rawurlencode( sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) ) : '' ),
'event_type' => ( isset( $_REQUEST['event_type'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['event_type'] ) ) : '' ),
'schedules_filter' => ( isset( $_REQUEST['schedules_filter'] ) ? \sanitize_text_field( \wp_unslash( $_REQUEST['schedules_filter'] ) ) : '' ),
),
\admin_url( 'admin.php' )
)
)
);
exit;
}
}
}
}
}