PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.4.6
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.4.6
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / inc / common / cron.php

cron.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 1.4.6, at inc/common/cron.php

40 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
4 /**
5 * Planning cron
6 * If the task is not programmed, it is automatically triggered
7 *
8 * @since 1.4.2
9 */
10 add_action( 'init', '_imagify_rating_scheduled' );
11 function _imagify_rating_scheduled() {
12 if ( ! wp_next_scheduled( 'imagify_rating_event' ) && ! get_site_transient( 'do_imagify_rating_cron' ) ) {
13 wp_schedule_event( time(), 'daily', 'imagify_rating_event' );
14 }
15 }
16
17 /*
18 * Saved the user images count to display it later
19 * in a notice message to ask him to rate Imagify on WordPress.org
20 *
21 * @since 1.4.2
22 */
23 add_action( 'imagify_rating_event', '_do_imagify_rating_cron' );
24 function _do_imagify_rating_cron() {
25 // Stop the process if the plugin isn't installed since 3 days
26 if ( get_site_transient( 'imagify_seen_rating_notice' ) ) {
27 return;
28 }
29
30 // Check if the Imagify servers & the API are accessible
31 if ( ! is_imagify_servers_up() ) {
32 return;
33 }
34
35 $user = get_imagify_user();
36
37 if ( isset( $user ) && (int) $user->image_count > 100 ) {
38 set_site_transient( 'imagify_user_images_count', $user->image_count );
39 }
40 }