Passed
Push — add/image-automation ( 57094b...b4ff43 )
by Warwick
03:09
created
classes/class-cron.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @access private
34 34
 	 */
35 35
 	public function __construct() {
36
-		add_action( 'lsx_wetu_importer_settings_before', array( $this, 'watch_for_trigger' ), 200 );
37
-		add_action( 'lsx_wetu_accommodation_images_cron', array( $this, 'process' ), 10, 1 );
36
+		add_action('lsx_wetu_importer_settings_before', array($this, 'watch_for_trigger'), 200);
37
+		add_action('lsx_wetu_accommodation_images_cron', array($this, 'process'), 10, 1);
38 38
 	}
39 39
 
40 40
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public static function get_instance() {
48 48
 		// If the single instance hasn't been set, set it now.
49
-		if ( null === self::$instance ) {
49
+		if (null === self::$instance) {
50 50
 			self::$instance = new self();
51 51
 		}
52 52
 		return self::$instance;
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function watch_for_trigger() {
61 61
 
62
-		if ( isset( $_GET['page'] ) && 'lsx-wetu-importer' === $_GET['page'] && isset( $_GET['tab'] ) && 'settings' === $_GET['tab'] ) {
62
+		if (isset($_GET['page']) && 'lsx-wetu-importer' === $_GET['page'] && isset($_GET['tab']) && 'settings' === $_GET['tab']) {
63 63
 			$options = lsx_wetu_get_options();
64 64
 
65 65
 			// Check what state the option is in.
66 66
 			$accommodation_cron = 'deactivate';
67
-			if ( isset( $options['accommodation_images_cron'] ) && '' !== $options['accommodation_images_cron'] ) {
67
+			if (isset($options['accommodation_images_cron']) && '' !== $options['accommodation_images_cron']) {
68 68
 				$accommodation_cron = 'activate';
69 69
 			}
70 70
 
71 71
 			// Check what state the cron is in.
72 72
 			$schedule = false;
73
-			if ( wp_next_scheduled( 'lsx_wetu_accommodation_images_cron' ) ) {
73
+			if (wp_next_scheduled('lsx_wetu_accommodation_images_cron')) {
74 74
 				$schedule = true;
75 75
 			}
76 76
 
77 77
 			// If activate and its not running.
78
-			if ( false === $schedule && 'activate' === $accommodation_cron ) {
78
+			if (false === $schedule && 'activate' === $accommodation_cron) {
79 79
 				$schedule = 'daily';
80
-				$this->schedule( 'lsx_wetu_accommodation_images_cron', $schedule );
81
-			} elseif ( true === $schedule && 'deactivate' === $accommodation_cron ) {
80
+				$this->schedule('lsx_wetu_accommodation_images_cron', $schedule);
81
+			} elseif (true === $schedule && 'deactivate' === $accommodation_cron) {
82 82
 				$this->deactivate();
83 83
 			}
84 84
 		}
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return void
91 91
 	 */
92
-	public function deactivate( $task = 'lsx_wetu_accommodation_images_cron' ) {
93
-		wp_clear_scheduled_hook( $task );
92
+	public function deactivate($task = 'lsx_wetu_accommodation_images_cron') {
93
+		wp_clear_scheduled_hook($task);
94 94
 	}
95 95
 
96 96
 	/**
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 * @param string $time
102 102
 	 * @return void
103 103
 	 */
104
-	public function schedule( $task = 'lsx_wetu_accommodation_images_cron', $schedule = 'daily', $time = '' ) {
105
-		if ( '' === $time ) {
104
+	public function schedule($task = 'lsx_wetu_accommodation_images_cron', $schedule = 'daily', $time = '') {
105
+		if ('' === $time) {
106 106
 			$time = time();
107 107
 		}
108
-		wp_schedule_event( $time, $schedule, $task, array( $task ) );
108
+		wp_schedule_event($time, $schedule, $task, array($task));
109 109
 	}
110 110
 
111 111
 	/**
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return void
115 115
 	 */
116
-	public function process( $task = '' ) {
117
-		switch ( $task ) {
116
+	public function process($task = '') {
117
+		switch ($task) {
118 118
 			case 'lsx_wetu_accommodation_images_cron':
119 119
 
120 120
 				break;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return void
131 131
 	 */
132 132
 	public function sync_accommodation_images() {
133
-		switch ( $task ) {
133
+		switch ($task) {
134 134
 			case 'lsx_wetu_accommodation_images_cron':
135 135
 				
136 136
 				break;
Please login to merge, or discard this patch.