@@ -7,24 +7,24 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | class Top_Entities { |
| 9 | 9 | |
| 10 | - const CRON_ACTION = 'wl_admin_dashboard_top_entities'; |
|
| 10 | + const CRON_ACTION = 'wl_admin_dashboard_top_entities'; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Option key where the top entities data is stored. |
|
| 14 | - */ |
|
| 15 | - const OPTION_KEY = 'wl_admin_dashboard_top_entities_option'; |
|
| 12 | + /** |
|
| 13 | + * Option key where the top entities data is stored. |
|
| 14 | + */ |
|
| 15 | + const OPTION_KEY = 'wl_admin_dashboard_top_entities_option'; |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | - public function __construct() { |
|
| 19 | - add_action( self::CRON_ACTION, array( $this, 'save_top_entities' ) ); |
|
| 20 | - } |
|
| 18 | + public function __construct() { |
|
| 19 | + add_action( self::CRON_ACTION, array( $this, 'save_top_entities' ) ); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | 22 | |
| 23 | - public function save_top_entities() { |
|
| 23 | + public function save_top_entities() { |
|
| 24 | 24 | |
| 25 | - global $wpdb; |
|
| 25 | + global $wpdb; |
|
| 26 | 26 | |
| 27 | - $query = " |
|
| 27 | + $query = " |
|
| 28 | 28 | SELECT p_as_object.ID |
| 29 | 29 | , p_as_object.post_title |
| 30 | 30 | , COALESCE(SUM(CASE WHEN t_as_subject.slug IS NULL THEN 1 END), 0) entities |
@@ -50,21 +50,21 @@ discard block |
||
| 50 | 50 | LIMIT 20 |
| 51 | 51 | "; |
| 52 | 52 | |
| 53 | - $results = $wpdb->get_results( $query ); |
|
| 53 | + $results = $wpdb->get_results( $query ); |
|
| 54 | 54 | |
| 55 | - update_option( self::OPTION_KEY, $results ); |
|
| 56 | - } |
|
| 55 | + update_option( self::OPTION_KEY, $results ); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - public static function activate() { |
|
| 60 | - if ( ! wp_next_scheduled( self::CRON_ACTION ) ) { |
|
| 61 | - wp_schedule_event( time(), 'daily', self::CRON_ACTION ); |
|
| 62 | - } |
|
| 63 | - } |
|
| 59 | + public static function activate() { |
|
| 60 | + if ( ! wp_next_scheduled( self::CRON_ACTION ) ) { |
|
| 61 | + wp_schedule_event( time(), 'daily', self::CRON_ACTION ); |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public static function deactivate() { |
|
| 66 | - $timestamp = wp_next_scheduled( self::CRON_ACTION ); |
|
| 67 | - wp_unschedule_event( $timestamp, self::CRON_ACTION ); |
|
| 68 | - } |
|
| 65 | + public static function deactivate() { |
|
| 66 | + $timestamp = wp_next_scheduled( self::CRON_ACTION ); |
|
| 67 | + wp_unschedule_event( $timestamp, self::CRON_ACTION ); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | public function __construct() { |
| 19 | - add_action( self::CRON_ACTION, array( $this, 'save_top_entities' ) ); |
|
| 19 | + add_action(self::CRON_ACTION, array($this, 'save_top_entities')); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
@@ -50,21 +50,21 @@ discard block |
||
| 50 | 50 | LIMIT 20 |
| 51 | 51 | "; |
| 52 | 52 | |
| 53 | - $results = $wpdb->get_results( $query ); |
|
| 53 | + $results = $wpdb->get_results($query); |
|
| 54 | 54 | |
| 55 | - update_option( self::OPTION_KEY, $results ); |
|
| 55 | + update_option(self::OPTION_KEY, $results); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | public static function activate() { |
| 60 | - if ( ! wp_next_scheduled( self::CRON_ACTION ) ) { |
|
| 61 | - wp_schedule_event( time(), 'daily', self::CRON_ACTION ); |
|
| 60 | + if ( ! wp_next_scheduled(self::CRON_ACTION)) { |
|
| 61 | + wp_schedule_event(time(), 'daily', self::CRON_ACTION); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public static function deactivate() { |
| 66 | - $timestamp = wp_next_scheduled( self::CRON_ACTION ); |
|
| 67 | - wp_unschedule_event( $timestamp, self::CRON_ACTION ); |
|
| 66 | + $timestamp = wp_next_scheduled(self::CRON_ACTION); |
|
| 67 | + wp_unschedule_event($timestamp, self::CRON_ACTION); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file |