Completed
Push — develop ( 1d4633...83eb6a )
by David
02:35 queued 10s
created
src/wordlift/api/class-default-api-service.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -54,6 +54,9 @@
 block discarded – undo
54 54
 
55 55
 	}
56 56
 
57
+	/**
58
+	 * @param string $method
59
+	 */
57 60
 	public function request( $method, $url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ) {
58 61
 
59 62
 		// Get the timeout for this request.
Please login to merge, or discard this patch.
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -8,87 +8,87 @@
 block discarded – undo
8 8
 
9 9
 class Default_Api_Service implements Api_Service {
10 10
 
11
-	/**
12
-	 * @var string
13
-	 */
14
-	private $wordlift_key;
15
-	/**
16
-	 * @var int
17
-	 */
18
-	private $timeout;
19
-
20
-	/**
21
-	 * @var string
22
-	 */
23
-	private $user_agent;
24
-
25
-	/**
26
-	 * @var array
27
-	 */
28
-	private $headers;
29
-	/**
30
-	 * @var string
31
-	 */
32
-	private $base_url;
33
-
34
-	/**
35
-	 * Default_Api_Service constructor.
36
-	 *
37
-	 * @param string $base_url
38
-	 * @param int $timeout
39
-	 * @param string $user_agent
40
-	 * @param string $wordlift_key
41
-	 */
42
-	public function __construct( $base_url, $timeout, $user_agent, $wordlift_key ) {
43
-
44
-		$this->base_url     = $base_url;
45
-		$this->timeout      = $timeout;
46
-		$this->user_agent   = $user_agent;
47
-		$this->wordlift_key = $wordlift_key;
48
-
49
-		$this->headers = array(
50
-			'Content-Type'  => 'application/json',
51
-			'Authorization' => "Key $wordlift_key",
52
-			'Expect'        => '',
53
-		);
54
-
55
-	}
56
-
57
-	public function request( $method, $url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ) {
58
-
59
-		// Get the timeout for this request.
60
-		$request_timeout = isset( $timeout ) ? $timeout : $this->timeout;
61
-
62
-		// Set the time limit if lesser than our request timeout.
63
-		$max_execution_time = ini_get( 'max_execution_time' );
64
-		if ( $max_execution_time < $request_timeout ) {
65
-			@set_time_limit( $request_timeout );
66
-		}
67
-
68
-		$request_url = $this->base_url . $url;
69
-
70
-		// Create the request args in the following order:
71
-		//  1. use `$args` as base if provided.
72
-		//  2. set the custom timeout if provided.
73
-		//  3. set the custom user-agent if provided.
74
-		//  4. merge the API headers to the provided headers.
75
-		//  5. add the body.
76
-		//
77
-		// In this way the user can fully control the request if wanted (using `$args`) and we can add our defaults.
78
-		$request_args = $args + array(
79
-				'method'     => $method,
80
-				'timeout'    => $request_timeout,
81
-				'user-agent' => isset( $user_agent ) ? $user_agent : $this->user_agent,
82
-				'headers'    => $headers + $this->headers,
83
-				'body'       => $body,
84
-			);
85
-
86
-		return new Response( wp_remote_request( $request_url, $request_args ) );
87
-	}
88
-
89
-	public function get( $url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ) {
90
-
91
-		return $this->request( 'GET', $url, $headers, $body, $timeout, $user_agent, $args );
92
-	}
11
+    /**
12
+     * @var string
13
+     */
14
+    private $wordlift_key;
15
+    /**
16
+     * @var int
17
+     */
18
+    private $timeout;
19
+
20
+    /**
21
+     * @var string
22
+     */
23
+    private $user_agent;
24
+
25
+    /**
26
+     * @var array
27
+     */
28
+    private $headers;
29
+    /**
30
+     * @var string
31
+     */
32
+    private $base_url;
33
+
34
+    /**
35
+     * Default_Api_Service constructor.
36
+     *
37
+     * @param string $base_url
38
+     * @param int $timeout
39
+     * @param string $user_agent
40
+     * @param string $wordlift_key
41
+     */
42
+    public function __construct( $base_url, $timeout, $user_agent, $wordlift_key ) {
43
+
44
+        $this->base_url     = $base_url;
45
+        $this->timeout      = $timeout;
46
+        $this->user_agent   = $user_agent;
47
+        $this->wordlift_key = $wordlift_key;
48
+
49
+        $this->headers = array(
50
+            'Content-Type'  => 'application/json',
51
+            'Authorization' => "Key $wordlift_key",
52
+            'Expect'        => '',
53
+        );
54
+
55
+    }
56
+
57
+    public function request( $method, $url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ) {
58
+
59
+        // Get the timeout for this request.
60
+        $request_timeout = isset( $timeout ) ? $timeout : $this->timeout;
61
+
62
+        // Set the time limit if lesser than our request timeout.
63
+        $max_execution_time = ini_get( 'max_execution_time' );
64
+        if ( $max_execution_time < $request_timeout ) {
65
+            @set_time_limit( $request_timeout );
66
+        }
67
+
68
+        $request_url = $this->base_url . $url;
69
+
70
+        // Create the request args in the following order:
71
+        //  1. use `$args` as base if provided.
72
+        //  2. set the custom timeout if provided.
73
+        //  3. set the custom user-agent if provided.
74
+        //  4. merge the API headers to the provided headers.
75
+        //  5. add the body.
76
+        //
77
+        // In this way the user can fully control the request if wanted (using `$args`) and we can add our defaults.
78
+        $request_args = $args + array(
79
+                'method'     => $method,
80
+                'timeout'    => $request_timeout,
81
+                'user-agent' => isset( $user_agent ) ? $user_agent : $this->user_agent,
82
+                'headers'    => $headers + $this->headers,
83
+                'body'       => $body,
84
+            );
85
+
86
+        return new Response( wp_remote_request( $request_url, $request_args ) );
87
+    }
88
+
89
+    public function get( $url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ) {
90
+
91
+        return $this->request( 'GET', $url, $headers, $body, $timeout, $user_agent, $args );
92
+    }
93 93
 
94 94
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param string $user_agent
40 40
 	 * @param string $wordlift_key
41 41
 	 */
42
-	public function __construct( $base_url, $timeout, $user_agent, $wordlift_key ) {
42
+	public function __construct($base_url, $timeout, $user_agent, $wordlift_key) {
43 43
 
44 44
 		$this->base_url     = $base_url;
45 45
 		$this->timeout      = $timeout;
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
 
55 55
 	}
56 56
 
57
-	public function request( $method, $url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ) {
57
+	public function request($method, $url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array()) {
58 58
 
59 59
 		// Get the timeout for this request.
60
-		$request_timeout = isset( $timeout ) ? $timeout : $this->timeout;
60
+		$request_timeout = isset($timeout) ? $timeout : $this->timeout;
61 61
 
62 62
 		// Set the time limit if lesser than our request timeout.
63
-		$max_execution_time = ini_get( 'max_execution_time' );
64
-		if ( $max_execution_time < $request_timeout ) {
65
-			@set_time_limit( $request_timeout );
63
+		$max_execution_time = ini_get('max_execution_time');
64
+		if ($max_execution_time < $request_timeout) {
65
+			@set_time_limit($request_timeout);
66 66
 		}
67 67
 
68
-		$request_url = $this->base_url . $url;
68
+		$request_url = $this->base_url.$url;
69 69
 
70 70
 		// Create the request args in the following order:
71 71
 		//  1. use `$args` as base if provided.
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 		$request_args = $args + array(
79 79
 				'method'     => $method,
80 80
 				'timeout'    => $request_timeout,
81
-				'user-agent' => isset( $user_agent ) ? $user_agent : $this->user_agent,
81
+				'user-agent' => isset($user_agent) ? $user_agent : $this->user_agent,
82 82
 				'headers'    => $headers + $this->headers,
83 83
 				'body'       => $body,
84 84
 			);
85 85
 
86
-		return new Response( wp_remote_request( $request_url, $request_args ) );
86
+		return new Response(wp_remote_request($request_url, $request_args));
87 87
 	}
88 88
 
89
-	public function get( $url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ) {
89
+	public function get($url, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array()) {
90 90
 
91
-		return $this->request( 'GET', $url, $headers, $body, $timeout, $user_agent, $args );
91
+		return $this->request('GET', $url, $headers, $body, $timeout, $user_agent, $args);
92 92
 	}
93 93
 
94 94
 }
Please login to merge, or discard this patch.
src/wordlift/images-licenses/admin/class-image-license-page.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -87,6 +87,7 @@
 block discarded – undo
87 87
 
88 88
 	/**
89 89
 	 * @param array $image
90
+	 * @param integer $idx
90 91
 	 */
91 92
 	private function render_image( $image, $idx ) {
92 93
 
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -9,41 +9,41 @@  discard block
 block discarded – undo
9 9
 
10 10
 class Image_License_Page extends Submenu_Page_Base {
11 11
 
12
-	/**
13
-	 * @var array
14
-	 */
15
-	private $data;
16
-
17
-	/**
18
-	 * @var string
19
-	 */
20
-	private $version;
21
-
22
-	/**
23
-	 * Image_License_Page constructor.
24
-	 *
25
-	 * @param array $data
26
-	 * @param string $version
27
-	 */
28
-	public function __construct( $data, $version ) {
29
-		$count = count( $data );
30
-
31
-		// Display the page in the menu only if there's something to do.
32
-		if ( 0 === $count ) {
33
-			return;
34
-		}
35
-		$menu_title = __( 'License Compliance', 'wordlift' ) .
36
-		              sprintf( '<span class="update-plugins count-%1$d"><span class="license-compliance-count">%1$d</span></span>', $count );
37
-
38
-		parent::__construct( 'wl_image_license_page', __( 'License Compliance', 'wordlift' ), 'manage_options', 'wl_admin_menu', $menu_title );
39
-
40
-		$this->data    = $data;
41
-		$this->version = $version;
42
-
43
-	}
44
-
45
-	public function render() {
46
-		?>
12
+    /**
13
+     * @var array
14
+     */
15
+    private $data;
16
+
17
+    /**
18
+     * @var string
19
+     */
20
+    private $version;
21
+
22
+    /**
23
+     * Image_License_Page constructor.
24
+     *
25
+     * @param array $data
26
+     * @param string $version
27
+     */
28
+    public function __construct( $data, $version ) {
29
+        $count = count( $data );
30
+
31
+        // Display the page in the menu only if there's something to do.
32
+        if ( 0 === $count ) {
33
+            return;
34
+        }
35
+        $menu_title = __( 'License Compliance', 'wordlift' ) .
36
+                        sprintf( '<span class="update-plugins count-%1$d"><span class="license-compliance-count">%1$d</span></span>', $count );
37
+
38
+        parent::__construct( 'wl_image_license_page', __( 'License Compliance', 'wordlift' ), 'manage_options', 'wl_admin_menu', $menu_title );
39
+
40
+        $this->data    = $data;
41
+        $this->version = $version;
42
+
43
+    }
44
+
45
+    public function render() {
46
+        ?>
47 47
         <h1><?php esc_html_e( 'License Compliance', 'wordlift' ); ?></h1>
48 48
 
49 49
         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus laudantium nam nihil provident sequi?
@@ -75,40 +75,40 @@  discard block
 block discarded – undo
75 75
             </tr>
76 76
             </thead>
77 77
 			<?php
78
-			$images = $this->data;
78
+            $images = $this->data;
79 79
 
80
-			for ( $i = 0; $i < count( $images ); $i ++ ) {
81
-				$this->render_image( $images[ $i ], $i );
82
-			}
83
-			?>
80
+            for ( $i = 0; $i < count( $images ); $i ++ ) {
81
+                $this->render_image( $images[ $i ], $i );
82
+            }
83
+            ?>
84 84
         </table>
85 85
 		<?php
86
-	}
86
+    }
87 87
 
88
-	/**
89
-	 * @param array $image
90
-	 */
91
-	private function render_image( $image, $idx ) {
88
+    /**
89
+     * @param array $image
90
+     */
91
+    private function render_image( $image, $idx ) {
92 92
 
93
-		$attachment_id = $image['attachment_id'];
93
+        $attachment_id = $image['attachment_id'];
94 94
 
95
-		// Skip if the post doesn't exist anymore or has been fixed.
96
-		if ( ! $this->exists( $attachment_id ) ) {
97
-			return;
98
-		}
95
+        // Skip if the post doesn't exist anymore or has been fixed.
96
+        if ( ! $this->exists( $attachment_id ) ) {
97
+            return;
98
+        }
99 99
 
100
-		$author = html_entity_decode( $image['author'] );
100
+        $author = html_entity_decode( $image['author'] );
101 101
 
102
-		$more_info_link_esc = esc_url( $image['more_info_link'] );
102
+        $more_info_link_esc = esc_url( $image['more_info_link'] );
103 103
 
104
-		$is_unknown_license = '#N/A' === $image['license'];
104
+        $is_unknown_license = '#N/A' === $image['license'];
105 105
 
106
-		$caption_builder  = new Caption_Builder( $image );
107
-		$proposed_caption = $caption_builder->build();
106
+        $caption_builder  = new Caption_Builder( $image );
107
+        $proposed_caption = $caption_builder->build();
108 108
 
109
-		$script_id = "wl-image-$idx";
110
-		$row_id    = "wl-row-$idx";
111
-		?>
109
+        $script_id = "wl-image-$idx";
110
+        $row_id    = "wl-row-$idx";
111
+        ?>
112 112
         <tr id="<?php echo $row_id; ?>">
113 113
             <td><?php echo wp_get_attachment_image( $attachment_id, array( 100, ) ); ?></td>
114 114
             <td><?php echo esc_html( $image['filename'] ); ?></td>
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
             </td>
122 122
             <td>
123 123
 				<?php
124
-				$this->partial_used_in_posts( $image['posts_ids_as_featured_image'], __( 'Used as featured image in %d post(s):', 'wordlift' ) );
125
-				$this->partial_used_in_posts( $image['posts_ids_as_embed'], __( 'Embedded in %d post(s):', 'wordlift' ) );
126
-				?>
124
+                $this->partial_used_in_posts( $image['posts_ids_as_featured_image'], __( 'Used as featured image in %d post(s):', 'wordlift' ) );
125
+                $this->partial_used_in_posts( $image['posts_ids_as_embed'], __( 'Embedded in %d post(s):', 'wordlift' ) );
126
+                ?>
127 127
             </td>
128 128
             <td>
129 129
                 <script type="application/json"
@@ -145,44 +145,44 @@  discard block
 block discarded – undo
145 145
             </td>
146 146
         </tr>
147 147
 		<?php
148
-	}
148
+    }
149 149
 
150
-	private function partial_used_in_posts( $data, $label ) {
150
+    private function partial_used_in_posts( $data, $label ) {
151 151
 
152
-		// Bail out if there's not data.
153
-		$count = count( $data );
154
-		if ( 0 === $count ) {
155
-			return;
156
-		}
152
+        // Bail out if there's not data.
153
+        $count = count( $data );
154
+        if ( 0 === $count ) {
155
+            return;
156
+        }
157 157
 
158
-		echo esc_html( sprintf( $label, $count ) );
159
-		foreach ( $data as $post_id ) {
160
-			$post = get_post( $post_id ); ?>
158
+        echo esc_html( sprintf( $label, $count ) );
159
+        foreach ( $data as $post_id ) {
160
+            $post = get_post( $post_id ); ?>
161 161
             <a href="<?php echo get_permalink( $post_id ); ?>"><?php echo esc_html( $post->post_title ); ?></a>
162 162
 			<?php
163
-		}
164
-	}
165
-
166
-	function enqueue_scripts() {
167
-
168
-		wp_enqueue_script( $this->get_menu_slug(), plugin_dir_url( __FILE__ ) . 'assets/image-license.js', array( 'wp-util' ), $this->version, true );
169
-		wp_localize_script( $this->get_menu_slug(), '_wlImageLicensePageSettings', array(
170
-			'_ajax_nonce' => array(
171
-				Add_License_Caption_Or_Remove_Task::MENU_SLUG => wp_create_nonce( Add_License_Caption_Or_Remove_Task::MENU_SLUG ),
172
-				Remove_All_Images_Task::MENU_SLUG             => wp_create_nonce( Remove_All_Images_Task::MENU_SLUG ),
173
-			),
174
-			'l10n'        => array(
175
-				'Done'              => __( 'Done', 'wordlift' ),
176
-				'An error occurred' => __( 'An error occurred', 'wordlift' ),
177
-			)
178
-		) );
179
-	}
180
-
181
-	private function exists( $attachment_id ) {
182
-		global $wpdb;
183
-
184
-		$sql =
185
-			"
163
+        }
164
+    }
165
+
166
+    function enqueue_scripts() {
167
+
168
+        wp_enqueue_script( $this->get_menu_slug(), plugin_dir_url( __FILE__ ) . 'assets/image-license.js', array( 'wp-util' ), $this->version, true );
169
+        wp_localize_script( $this->get_menu_slug(), '_wlImageLicensePageSettings', array(
170
+            '_ajax_nonce' => array(
171
+                Add_License_Caption_Or_Remove_Task::MENU_SLUG => wp_create_nonce( Add_License_Caption_Or_Remove_Task::MENU_SLUG ),
172
+                Remove_All_Images_Task::MENU_SLUG             => wp_create_nonce( Remove_All_Images_Task::MENU_SLUG ),
173
+            ),
174
+            'l10n'        => array(
175
+                'Done'              => __( 'Done', 'wordlift' ),
176
+                'An error occurred' => __( 'An error occurred', 'wordlift' ),
177
+            )
178
+        ) );
179
+    }
180
+
181
+    private function exists( $attachment_id ) {
182
+        global $wpdb;
183
+
184
+        $sql =
185
+            "
186 186
             SELECT COUNT( 1 )
187 187
             FROM {$wpdb->postmeta} pm1
188 188
             LEFT OUTER JOIN {$wpdb->postmeta} pm2
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
               AND pm2.meta_value IS NULL
194 194
             ";
195 195
 
196
-		return $wpdb->get_var( $wpdb->prepare(
197
-			$sql,
198
-			'_wl_image_license_fixed',
199
-			$attachment_id,
200
-			'_wp_attached_file'
201
-		) );
202
-	}
196
+        return $wpdb->get_var( $wpdb->prepare(
197
+            $sql,
198
+            '_wl_image_license_fixed',
199
+            $attachment_id,
200
+            '_wp_attached_file'
201
+        ) );
202
+    }
203 203
 
204 204
 }
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
 	 * @param array $data
26 26
 	 * @param string $version
27 27
 	 */
28
-	public function __construct( $data, $version ) {
29
-		$count = count( $data );
28
+	public function __construct($data, $version) {
29
+		$count = count($data);
30 30
 
31 31
 		// Display the page in the menu only if there's something to do.
32
-		if ( 0 === $count ) {
32
+		if (0 === $count) {
33 33
 			return;
34 34
 		}
35
-		$menu_title = __( 'License Compliance', 'wordlift' ) .
36
-		              sprintf( '<span class="update-plugins count-%1$d"><span class="license-compliance-count">%1$d</span></span>', $count );
35
+		$menu_title = __('License Compliance', 'wordlift').
36
+		              sprintf('<span class="update-plugins count-%1$d"><span class="license-compliance-count">%1$d</span></span>', $count);
37 37
 
38
-		parent::__construct( 'wl_image_license_page', __( 'License Compliance', 'wordlift' ), 'manage_options', 'wl_admin_menu', $menu_title );
38
+		parent::__construct('wl_image_license_page', __('License Compliance', 'wordlift'), 'manage_options', 'wl_admin_menu', $menu_title);
39 39
 
40 40
 		$this->data    = $data;
41 41
 		$this->version = $version;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 	public function render() {
46 46
 		?>
47
-        <h1><?php esc_html_e( 'License Compliance', 'wordlift' ); ?></h1>
47
+        <h1><?php esc_html_e('License Compliance', 'wordlift'); ?></h1>
48 48
 
49 49
         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus laudantium nam nihil provident sequi?
50 50
             Alias aliquam, animi debitis distinctio dolores laboriosam modi optio possimus qui, quis suscipit, unde
@@ -52,33 +52,33 @@  discard block
 block discarded – undo
52 52
 
53 53
         <div class="tablenav top">
54 54
             <a class="button"
55
-               href="<?php echo admin_url( 'admin.php?page=wl_images_licenses__reload_data' ); ?>"><?php esc_html_e( 'Reload data', 'wordlift' ); ?></a>
55
+               href="<?php echo admin_url('admin.php?page=wl_images_licenses__reload_data'); ?>"><?php esc_html_e('Reload data', 'wordlift'); ?></a>
56 56
             <a class="button"
57
-               href="<?php echo admin_url( 'admin.php?page=wl_images_licenses__remove_all_images' ); ?>"><?php esc_html_e( 'Remove all images', 'wordlift' ); ?></a>
57
+               href="<?php echo admin_url('admin.php?page=wl_images_licenses__remove_all_images'); ?>"><?php esc_html_e('Remove all images', 'wordlift'); ?></a>
58 58
             <a class="button"
59
-               href="<?php echo admin_url( 'admin.php?page=wl_images_licenses__add_license_caption_or_remove' ); ?>"><?php esc_html_e( 'Add license caption to images and remove those with unknown license', 'wordlift' ); ?></a>
59
+               href="<?php echo admin_url('admin.php?page=wl_images_licenses__add_license_caption_or_remove'); ?>"><?php esc_html_e('Add license caption to images and remove those with unknown license', 'wordlift'); ?></a>
60 60
         </div>
61 61
 
62
-        <h2 class="screen-reader-text"><?php esc_html_e( 'Images', 'wordlift' ); ?></h2>
62
+        <h2 class="screen-reader-text"><?php esc_html_e('Images', 'wordlift'); ?></h2>
63 63
 
64 64
         <table class="wp-list-table widefat fixed striped">
65 65
             <thead>
66 66
             <tr>
67
-                <th><?php esc_html_e( 'Thumbnail', 'wordlift' ); ?></th>
68
-                <th><?php esc_html_e( 'Filename', 'wordlift' ); ?></th>
69
-                <th><?php esc_html_e( 'License', 'wordlift' ); ?></th>
70
-                <th><?php esc_html_e( 'Author', 'wordlift' ); ?></th>
71
-                <th><?php esc_html_e( 'Proposed Caption', 'wordlift' ); ?></th>
72
-                <th><?php esc_html_e( 'More Info', 'wordlift' ); ?></th>
73
-                <th><?php esc_html_e( 'Posts', 'wordlift' ); ?></th>
74
-                <th><?php esc_html_e( 'Actions', 'wordlift' ); ?></th>
67
+                <th><?php esc_html_e('Thumbnail', 'wordlift'); ?></th>
68
+                <th><?php esc_html_e('Filename', 'wordlift'); ?></th>
69
+                <th><?php esc_html_e('License', 'wordlift'); ?></th>
70
+                <th><?php esc_html_e('Author', 'wordlift'); ?></th>
71
+                <th><?php esc_html_e('Proposed Caption', 'wordlift'); ?></th>
72
+                <th><?php esc_html_e('More Info', 'wordlift'); ?></th>
73
+                <th><?php esc_html_e('Posts', 'wordlift'); ?></th>
74
+                <th><?php esc_html_e('Actions', 'wordlift'); ?></th>
75 75
             </tr>
76 76
             </thead>
77 77
 			<?php
78 78
 			$images = $this->data;
79 79
 
80
-			for ( $i = 0; $i < count( $images ); $i ++ ) {
81
-				$this->render_image( $images[ $i ], $i );
80
+			for ($i = 0; $i < count($images); $i++) {
81
+				$this->render_image($images[$i], $i);
82 82
 			}
83 83
 			?>
84 84
         </table>
@@ -88,97 +88,97 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * @param array $image
90 90
 	 */
91
-	private function render_image( $image, $idx ) {
91
+	private function render_image($image, $idx) {
92 92
 
93 93
 		$attachment_id = $image['attachment_id'];
94 94
 
95 95
 		// Skip if the post doesn't exist anymore or has been fixed.
96
-		if ( ! $this->exists( $attachment_id ) ) {
96
+		if ( ! $this->exists($attachment_id)) {
97 97
 			return;
98 98
 		}
99 99
 
100
-		$author = html_entity_decode( $image['author'] );
100
+		$author = html_entity_decode($image['author']);
101 101
 
102
-		$more_info_link_esc = esc_url( $image['more_info_link'] );
102
+		$more_info_link_esc = esc_url($image['more_info_link']);
103 103
 
104 104
 		$is_unknown_license = '#N/A' === $image['license'];
105 105
 
106
-		$caption_builder  = new Caption_Builder( $image );
106
+		$caption_builder  = new Caption_Builder($image);
107 107
 		$proposed_caption = $caption_builder->build();
108 108
 
109 109
 		$script_id = "wl-image-$idx";
110 110
 		$row_id    = "wl-row-$idx";
111 111
 		?>
112 112
         <tr id="<?php echo $row_id; ?>">
113
-            <td><?php echo wp_get_attachment_image( $attachment_id, array( 100, ) ); ?></td>
114
-            <td><?php echo esc_html( $image['filename'] ); ?></td>
115
-            <td><?php echo esc_html( $image['license'] ); ?></td>
113
+            <td><?php echo wp_get_attachment_image($attachment_id, array(100,)); ?></td>
114
+            <td><?php echo esc_html($image['filename']); ?></td>
115
+            <td><?php echo esc_html($image['license']); ?></td>
116 116
             <td><?php echo $author; ?></td>
117 117
             <td><?php echo $proposed_caption; ?></td>
118 118
             <td>
119 119
                 <a href="<?php echo $more_info_link_esc; ?>"
120
-                   target="_blank"><?php esc_html_e( 'More information', 'wordlift' ); ?></a>
120
+                   target="_blank"><?php esc_html_e('More information', 'wordlift'); ?></a>
121 121
             </td>
122 122
             <td>
123 123
 				<?php
124
-				$this->partial_used_in_posts( $image['posts_ids_as_featured_image'], __( 'Used as featured image in %d post(s):', 'wordlift' ) );
125
-				$this->partial_used_in_posts( $image['posts_ids_as_embed'], __( 'Embedded in %d post(s):', 'wordlift' ) );
124
+				$this->partial_used_in_posts($image['posts_ids_as_featured_image'], __('Used as featured image in %d post(s):', 'wordlift'));
125
+				$this->partial_used_in_posts($image['posts_ids_as_embed'], __('Embedded in %d post(s):', 'wordlift'));
126 126
 				?>
127 127
             </td>
128 128
             <td>
129 129
                 <script type="application/json"
130
-                        id="<?php echo $script_id; ?>"><?php echo json_encode( $image ); ?></script>
130
+                        id="<?php echo $script_id; ?>"><?php echo json_encode($image); ?></script>
131 131
                 <button data-id="<?php echo $script_id; ?>"
132 132
                         data-row-id="<?php echo $row_id; ?>"
133 133
                         data-action="wl_remove_all_images_task"
134
-                        class="button wl-action-btn"><?php esc_html_e( 'Remove image', 'wordlift' ); ?></button>
135
-				<?php if ( ! $is_unknown_license ) { ?>
134
+                        class="button wl-action-btn"><?php esc_html_e('Remove image', 'wordlift'); ?></button>
135
+				<?php if ( ! $is_unknown_license) { ?>
136 136
                     <button data-id="<?php echo $script_id; ?>"
137 137
                             data-row-id="<?php echo $row_id; ?>"
138 138
                             data-action="wl_add_license_caption_or_remove"
139
-                            class="button wl-action-btn"><?php esc_html_e( 'Add license caption', 'wordlift' ); ?></button>
139
+                            class="button wl-action-btn"><?php esc_html_e('Add license caption', 'wordlift'); ?></button>
140 140
 				<?php } ?>
141 141
                 <a class="button"
142
-                   href=" <?php echo get_edit_post_link( $attachment_id ); ?>"
143
-                   target="_blank"><?php esc_html_e( 'Edit image', 'wordlift' ); ?> <span
142
+                   href=" <?php echo get_edit_post_link($attachment_id); ?>"
143
+                   target="_blank"><?php esc_html_e('Edit image', 'wordlift'); ?> <span
144 144
                             class="dashicons dashicons-external"></span></a>
145 145
             </td>
146 146
         </tr>
147 147
 		<?php
148 148
 	}
149 149
 
150
-	private function partial_used_in_posts( $data, $label ) {
150
+	private function partial_used_in_posts($data, $label) {
151 151
 
152 152
 		// Bail out if there's not data.
153
-		$count = count( $data );
154
-		if ( 0 === $count ) {
153
+		$count = count($data);
154
+		if (0 === $count) {
155 155
 			return;
156 156
 		}
157 157
 
158
-		echo esc_html( sprintf( $label, $count ) );
159
-		foreach ( $data as $post_id ) {
160
-			$post = get_post( $post_id ); ?>
161
-            <a href="<?php echo get_permalink( $post_id ); ?>"><?php echo esc_html( $post->post_title ); ?></a>
158
+		echo esc_html(sprintf($label, $count));
159
+		foreach ($data as $post_id) {
160
+			$post = get_post($post_id); ?>
161
+            <a href="<?php echo get_permalink($post_id); ?>"><?php echo esc_html($post->post_title); ?></a>
162 162
 			<?php
163 163
 		}
164 164
 	}
165 165
 
166 166
 	function enqueue_scripts() {
167 167
 
168
-		wp_enqueue_script( $this->get_menu_slug(), plugin_dir_url( __FILE__ ) . 'assets/image-license.js', array( 'wp-util' ), $this->version, true );
169
-		wp_localize_script( $this->get_menu_slug(), '_wlImageLicensePageSettings', array(
168
+		wp_enqueue_script($this->get_menu_slug(), plugin_dir_url(__FILE__).'assets/image-license.js', array('wp-util'), $this->version, true);
169
+		wp_localize_script($this->get_menu_slug(), '_wlImageLicensePageSettings', array(
170 170
 			'_ajax_nonce' => array(
171
-				Add_License_Caption_Or_Remove_Task::MENU_SLUG => wp_create_nonce( Add_License_Caption_Or_Remove_Task::MENU_SLUG ),
172
-				Remove_All_Images_Task::MENU_SLUG             => wp_create_nonce( Remove_All_Images_Task::MENU_SLUG ),
171
+				Add_License_Caption_Or_Remove_Task::MENU_SLUG => wp_create_nonce(Add_License_Caption_Or_Remove_Task::MENU_SLUG),
172
+				Remove_All_Images_Task::MENU_SLUG             => wp_create_nonce(Remove_All_Images_Task::MENU_SLUG),
173 173
 			),
174 174
 			'l10n'        => array(
175
-				'Done'              => __( 'Done', 'wordlift' ),
176
-				'An error occurred' => __( 'An error occurred', 'wordlift' ),
175
+				'Done'              => __('Done', 'wordlift'),
176
+				'An error occurred' => __('An error occurred', 'wordlift'),
177 177
 			)
178
-		) );
178
+		));
179 179
 	}
180 180
 
181
-	private function exists( $attachment_id ) {
181
+	private function exists($attachment_id) {
182 182
 		global $wpdb;
183 183
 
184 184
 		$sql =
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
               AND pm2.meta_value IS NULL
194 194
             ";
195 195
 
196
-		return $wpdb->get_var( $wpdb->prepare(
196
+		return $wpdb->get_var($wpdb->prepare(
197 197
 			$sql,
198 198
 			'_wl_image_license_fixed',
199 199
 			$attachment_id,
200 200
 			'_wp_attached_file'
201
-		) );
201
+		));
202 202
 	}
203 203
 
204 204
 }
Please login to merge, or discard this patch.
src/wordlift/images-licenses/class-cached-image-license-service.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 
6 6
 namespace Wordlift\Images_Licenses;
7 7
 
8
-use Wordlift\Api\Api_Service;
9 8
 use Wordlift\Cache\Ttl_Cache;
10 9
 
11 10
 class Cached_Image_License_Service extends Image_License_Service {
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -10,53 +10,53 @@
 block discarded – undo
10 10
 
11 11
 class Cached_Image_License_Service extends Image_License_Service {
12 12
 
13
-	const GET_NON_PUBLIC_DOMAIN_IMAGES = 'get_non_public_domain_images';
14
-
15
-	/**
16
-	 * @var Ttl_Cache
17
-	 */
18
-	private $cache_service;
19
-
20
-	/**
21
-	 * @var Image_License_Service
22
-	 */
23
-	private $image_license_service;
24
-
25
-	/**
26
-	 * Images_Licenses_Service constructor.
27
-	 *
28
-	 * @param Image_License_Service $image_license_service
29
-	 * @param Ttl_Cache $cache_service
30
-	 */
31
-	public function __construct( $image_license_service, $cache_service ) {
32
-
33
-		$this->image_license_service = $image_license_service;
34
-		$this->cache_service         = $cache_service;
35
-
36
-		$that = $this;
37
-		add_action( 'wp_ajax_wl_cached_image_license_service__get_non_public_domain_images', function () use ( $that ) {
38
-			wp_send_json_success( $that->get_non_public_domain_images() );
39
-		} );
40
-
41
-	}
42
-
43
-	/**
44
-	 * @return array
45
-	 */
46
-	public function get_non_public_domain_images() {
47
-
48
-		// Return the cached data if available.
49
-		$cache = $this->cache_service->get( self::GET_NON_PUBLIC_DOMAIN_IMAGES );
50
-		if ( ! is_null( $cache ) ) {
51
-			return $cache;
52
-		}
53
-
54
-		$data = $this->image_license_service->get_non_public_domain_images();
55
-
56
-		// Store the cached data.
57
-		$this->cache_service->put( self::GET_NON_PUBLIC_DOMAIN_IMAGES, $data );
58
-
59
-		return $data;
60
-	}
13
+    const GET_NON_PUBLIC_DOMAIN_IMAGES = 'get_non_public_domain_images';
14
+
15
+    /**
16
+     * @var Ttl_Cache
17
+     */
18
+    private $cache_service;
19
+
20
+    /**
21
+     * @var Image_License_Service
22
+     */
23
+    private $image_license_service;
24
+
25
+    /**
26
+     * Images_Licenses_Service constructor.
27
+     *
28
+     * @param Image_License_Service $image_license_service
29
+     * @param Ttl_Cache $cache_service
30
+     */
31
+    public function __construct( $image_license_service, $cache_service ) {
32
+
33
+        $this->image_license_service = $image_license_service;
34
+        $this->cache_service         = $cache_service;
35
+
36
+        $that = $this;
37
+        add_action( 'wp_ajax_wl_cached_image_license_service__get_non_public_domain_images', function () use ( $that ) {
38
+            wp_send_json_success( $that->get_non_public_domain_images() );
39
+        } );
40
+
41
+    }
42
+
43
+    /**
44
+     * @return array
45
+     */
46
+    public function get_non_public_domain_images() {
47
+
48
+        // Return the cached data if available.
49
+        $cache = $this->cache_service->get( self::GET_NON_PUBLIC_DOMAIN_IMAGES );
50
+        if ( ! is_null( $cache ) ) {
51
+            return $cache;
52
+        }
53
+
54
+        $data = $this->image_license_service->get_non_public_domain_images();
55
+
56
+        // Store the cached data.
57
+        $this->cache_service->put( self::GET_NON_PUBLIC_DOMAIN_IMAGES, $data );
58
+
59
+        return $data;
60
+    }
61 61
 
62 62
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 	 * @param Image_License_Service $image_license_service
29 29
 	 * @param Ttl_Cache $cache_service
30 30
 	 */
31
-	public function __construct( $image_license_service, $cache_service ) {
31
+	public function __construct($image_license_service, $cache_service) {
32 32
 
33 33
 		$this->image_license_service = $image_license_service;
34 34
 		$this->cache_service         = $cache_service;
35 35
 
36 36
 		$that = $this;
37
-		add_action( 'wp_ajax_wl_cached_image_license_service__get_non_public_domain_images', function () use ( $that ) {
38
-			wp_send_json_success( $that->get_non_public_domain_images() );
37
+		add_action('wp_ajax_wl_cached_image_license_service__get_non_public_domain_images', function() use ($that) {
38
+			wp_send_json_success($that->get_non_public_domain_images());
39 39
 		} );
40 40
 
41 41
 	}
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 	public function get_non_public_domain_images() {
47 47
 
48 48
 		// Return the cached data if available.
49
-		$cache = $this->cache_service->get( self::GET_NON_PUBLIC_DOMAIN_IMAGES );
50
-		if ( ! is_null( $cache ) ) {
49
+		$cache = $this->cache_service->get(self::GET_NON_PUBLIC_DOMAIN_IMAGES);
50
+		if ( ! is_null($cache)) {
51 51
 			return $cache;
52 52
 		}
53 53
 
54 54
 		$data = $this->image_license_service->get_non_public_domain_images();
55 55
 
56 56
 		// Store the cached data.
57
-		$this->cache_service->put( self::GET_NON_PUBLIC_DOMAIN_IMAGES, $data );
57
+		$this->cache_service->put(self::GET_NON_PUBLIC_DOMAIN_IMAGES, $data);
58 58
 
59 59
 		return $data;
60 60
 	}
Please login to merge, or discard this patch.
src/wordlift/tasks/admin/class-tasks-page-base.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 
15 15
 use Wordlift\Tasks\Task_Ajax_Adapters_Registry;
16 16
 use Wordlift\Wordpress\Submenu_Page_Base;
17
-use Wordlift\Wordpress\Page;
18 17
 
19 18
 abstract class Tasks_Page_Base extends Submenu_Page_Base {
20 19
 
Please login to merge, or discard this patch.
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -18,71 +18,71 @@
 block discarded – undo
18 18
 
19 19
 abstract class Tasks_Page_Base extends Submenu_Page_Base {
20 20
 
21
-	/**
22
-	 * The ID of this admin page.
23
-	 *
24
-	 * @since    1.0.0
25
-	 * @access   private
26
-	 * @var      string $menu_slug The ID of this page.
27
-	 */
28
-	private $menu_slug;
21
+    /**
22
+     * The ID of this admin page.
23
+     *
24
+     * @since    1.0.0
25
+     * @access   private
26
+     * @var      string $menu_slug The ID of this page.
27
+     */
28
+    private $menu_slug;
29 29
 
30
-	/**
31
-	 * @var Task_Ajax_Adapters_Registry
32
-	 */
33
-	private $task_ajax_adapters_registry;
30
+    /**
31
+     * @var Task_Ajax_Adapters_Registry
32
+     */
33
+    private $task_ajax_adapters_registry;
34 34
 
35
-	/**
36
-	 * @var string
37
-	 */
38
-	private $version;
35
+    /**
36
+     * @var string
37
+     */
38
+    private $version;
39 39
 
40
-	/**
41
-	 * Define the {@link Wordlift_Admin_Page} constructor.
42
-	 *
43
-	 * @param Task_Ajax_Adapters_Registry $task_ajax_adapters_registry
44
-	 *
45
-	 * @param string $version
46
-	 * @param string $menu_slug
47
-	 * @param string $page_title
48
-	 * @param string $capability
49
-	 * @param string|null $parent_slug
50
-	 * @param string|null $menu_title
51
-	 *
52
-	 * @since 1.0.0
53
-	 */
54
-	public function __construct( $task_ajax_adapters_registry, $version, $menu_slug, $page_title, $capability = 'manage_options', $parent_slug = null, $menu_title = null ) {
55
-		parent::__construct( $menu_slug, $page_title, $capability, $parent_slug, $menu_title );
40
+    /**
41
+     * Define the {@link Wordlift_Admin_Page} constructor.
42
+     *
43
+     * @param Task_Ajax_Adapters_Registry $task_ajax_adapters_registry
44
+     *
45
+     * @param string $version
46
+     * @param string $menu_slug
47
+     * @param string $page_title
48
+     * @param string $capability
49
+     * @param string|null $parent_slug
50
+     * @param string|null $menu_title
51
+     *
52
+     * @since 1.0.0
53
+     */
54
+    public function __construct( $task_ajax_adapters_registry, $version, $menu_slug, $page_title, $capability = 'manage_options', $parent_slug = null, $menu_title = null ) {
55
+        parent::__construct( $menu_slug, $page_title, $capability, $parent_slug, $menu_title );
56 56
 
57
-		$this->task_ajax_adapters_registry = $task_ajax_adapters_registry;
58
-		$this->version                     = $version;
59
-		$this->menu_slug                   = $menu_slug;
57
+        $this->task_ajax_adapters_registry = $task_ajax_adapters_registry;
58
+        $this->version                     = $version;
59
+        $this->menu_slug                   = $menu_slug;
60 60
 
61
-	}
61
+    }
62 62
 
63
-	/**
64
-	 * Register the stylesheets and scripts for the admin area.
65
-	 *
66
-	 * @since    1.0.0
67
-	 */
68
-	public function enqueue_scripts() {
69
-		wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->version, 'all' );
70
-		wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array(
71
-			'jquery',
72
-			'wp-util'
73
-		), $this->version, true );
74
-	}
63
+    /**
64
+     * Register the stylesheets and scripts for the admin area.
65
+     *
66
+     * @since    1.0.0
67
+     */
68
+    public function enqueue_scripts() {
69
+        wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->version, 'all' );
70
+        wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array(
71
+            'jquery',
72
+            'wp-util'
73
+        ), $this->version, true );
74
+    }
75 75
 
76
-	/**
77
-	 * Render the page.
78
-	 *
79
-	 * @since 1.0.0
80
-	 */
81
-	public function render() {
76
+    /**
77
+     * Render the page.
78
+     *
79
+     * @since 1.0.0
80
+     */
81
+    public function render() {
82 82
 
83
-		// Include the partial.
84
-		include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' );
83
+        // Include the partial.
84
+        include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' );
85 85
 
86
-	}
86
+    }
87 87
 
88 88
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @since 1.0.0
53 53
 	 */
54
-	public function __construct( $task_ajax_adapters_registry, $version, $menu_slug, $page_title, $capability = 'manage_options', $parent_slug = null, $menu_title = null ) {
55
-		parent::__construct( $menu_slug, $page_title, $capability, $parent_slug, $menu_title );
54
+	public function __construct($task_ajax_adapters_registry, $version, $menu_slug, $page_title, $capability = 'manage_options', $parent_slug = null, $menu_title = null) {
55
+		parent::__construct($menu_slug, $page_title, $capability, $parent_slug, $menu_title);
56 56
 
57 57
 		$this->task_ajax_adapters_registry = $task_ajax_adapters_registry;
58 58
 		$this->version                     = $version;
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	 * @since    1.0.0
67 67
 	 */
68 68
 	public function enqueue_scripts() {
69
-		wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->version, 'all' );
70
-		wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array(
69
+		wp_enqueue_style($this->menu_slug, plugin_dir_url(__FILE__).'assets/tasks-page.css', array(), $this->version, 'all');
70
+		wp_enqueue_script($this->menu_slug, plugin_dir_url(__FILE__).'assets/tasks-page.js', array(
71 71
 			'jquery',
72 72
 			'wp-util'
73
-		), $this->version, true );
73
+		), $this->version, true);
74 74
 	}
75 75
 
76 76
 	/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	public function render() {
82 82
 
83 83
 		// Include the partial.
84
-		include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' );
84
+		include(plugin_dir_path(__FILE__).'assets/tasks-page.php');
85 85
 
86 86
 	}
87 87
 
Please login to merge, or discard this patch.
src/wordlift/tasks/admin/class-tasks-page.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 
15 15
 use Wordlift\Tasks\Task_Ajax_Adapters_Registry;
16 16
 use Wordlift\Wordpress\Submenu_Page_Base;
17
-use Wordlift\Wordpress\Page;
18 17
 
19 18
 class Tasks_Page extends Submenu_Page_Base {
20 19
 
Please login to merge, or discard this patch.
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -18,66 +18,66 @@
 block discarded – undo
18 18
 
19 19
 class Tasks_Page extends Submenu_Page_Base {
20 20
 
21
-	/**
22
-	 * The ID of this admin page.
23
-	 *
24
-	 * @since    1.0.0
25
-	 * @access   private
26
-	 * @var      string $menu_slug The ID of this page.
27
-	 */
28
-	private $menu_slug = 'wl_tasks_page';
21
+    /**
22
+     * The ID of this admin page.
23
+     *
24
+     * @since    1.0.0
25
+     * @access   private
26
+     * @var      string $menu_slug The ID of this page.
27
+     */
28
+    private $menu_slug = 'wl_tasks_page';
29 29
 
30
-	/**
31
-	 * Used when enqueueing styles or scripts as the version string.
32
-	 *
33
-	 * @since  1.0.0
34
-	 * @access private
35
-	 * @var    string
36
-	 */
37
-	private $asset_version = '1.0.0';
30
+    /**
31
+     * Used when enqueueing styles or scripts as the version string.
32
+     *
33
+     * @since  1.0.0
34
+     * @access private
35
+     * @var    string
36
+     */
37
+    private $asset_version = '1.0.0';
38 38
 
39
-	/**
40
-	 * @var Task_Ajax_Adapters_Registry
41
-	 */
42
-	private $task_ajax_adapters_registry;
39
+    /**
40
+     * @var Task_Ajax_Adapters_Registry
41
+     */
42
+    private $task_ajax_adapters_registry;
43 43
 
44
-	/**
45
-	 * Define the {@link Wordlift_Admin_Page} constructor.
46
-	 *
47
-	 * @param Task_Ajax_Adapters_Registry $task_ajax_adapters_registry
48
-	 *
49
-	 * @since 1.0.0
50
-	 */
51
-	public function __construct( $task_ajax_adapters_registry ) {
52
-		parent::__construct( $this->menu_slug, __( 'Tasks', 'wordlift-framework' ), 'manage_options', 'wl_admin_menu', __( 'Tasks', 'wordlift-framework' ) );
44
+    /**
45
+     * Define the {@link Wordlift_Admin_Page} constructor.
46
+     *
47
+     * @param Task_Ajax_Adapters_Registry $task_ajax_adapters_registry
48
+     *
49
+     * @since 1.0.0
50
+     */
51
+    public function __construct( $task_ajax_adapters_registry ) {
52
+        parent::__construct( $this->menu_slug, __( 'Tasks', 'wordlift-framework' ), 'manage_options', 'wl_admin_menu', __( 'Tasks', 'wordlift-framework' ) );
53 53
 
54
-		$this->task_ajax_adapters_registry = $task_ajax_adapters_registry;
54
+        $this->task_ajax_adapters_registry = $task_ajax_adapters_registry;
55 55
 
56
-	}
56
+    }
57 57
 
58
-	/**
59
-	 * Register the stylesheets and scripts for the admin area.
60
-	 *
61
-	 * @since    1.0.0
62
-	 */
63
-	public function enqueue_scripts() {
64
-		wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->asset_version, 'all' );
65
-		wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array(
66
-			'jquery',
67
-			'wp-util'
68
-		), $this->asset_version, true );
69
-	}
58
+    /**
59
+     * Register the stylesheets and scripts for the admin area.
60
+     *
61
+     * @since    1.0.0
62
+     */
63
+    public function enqueue_scripts() {
64
+        wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->asset_version, 'all' );
65
+        wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array(
66
+            'jquery',
67
+            'wp-util'
68
+        ), $this->asset_version, true );
69
+    }
70 70
 
71
-	/**
72
-	 * Render the page.
73
-	 *
74
-	 * @since 1.0.0
75
-	 */
76
-	public function render() {
71
+    /**
72
+     * Render the page.
73
+     *
74
+     * @since 1.0.0
75
+     */
76
+    public function render() {
77 77
 
78
-		// Include the partial.
79
-		include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' );
78
+        // Include the partial.
79
+        include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' );
80 80
 
81
-	}
81
+    }
82 82
 
83 83
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @since 1.0.0
50 50
 	 */
51
-	public function __construct( $task_ajax_adapters_registry ) {
52
-		parent::__construct( $this->menu_slug, __( 'Tasks', 'wordlift-framework' ), 'manage_options', 'wl_admin_menu', __( 'Tasks', 'wordlift-framework' ) );
51
+	public function __construct($task_ajax_adapters_registry) {
52
+		parent::__construct($this->menu_slug, __('Tasks', 'wordlift-framework'), 'manage_options', 'wl_admin_menu', __('Tasks', 'wordlift-framework'));
53 53
 
54 54
 		$this->task_ajax_adapters_registry = $task_ajax_adapters_registry;
55 55
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	 * @since    1.0.0
62 62
 	 */
63 63
 	public function enqueue_scripts() {
64
-		wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->asset_version, 'all' );
65
-		wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array(
64
+		wp_enqueue_style($this->menu_slug, plugin_dir_url(__FILE__).'assets/tasks-page.css', array(), $this->asset_version, 'all');
65
+		wp_enqueue_script($this->menu_slug, plugin_dir_url(__FILE__).'assets/tasks-page.js', array(
66 66
 			'jquery',
67 67
 			'wp-util'
68
-		), $this->asset_version, true );
68
+		), $this->asset_version, true);
69 69
 	}
70 70
 
71 71
 	/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	public function render() {
77 77
 
78 78
 		// Include the partial.
79
-		include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' );
79
+		include(plugin_dir_path(__FILE__).'assets/tasks-page.php');
80 80
 
81 81
 	}
82 82
 
Please login to merge, or discard this patch.
src/wordlift/tasks/class-task-single-instance-task-runner.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	 *
73 73
 	 * @param Task $task The {@link Task} instance.
74 74
 	 * @param bool $force Whether to force starting a task even if another instance of the task is already running, default `false`.
75
-	 * @param array $callbacks An array of {@link Wordlift_For_Bungalowparkoverzicht_Progress}.
75
+	 * @param Task_Ajax_Progress[] $callbacks An array of {@link Wordlift_For_Bungalowparkoverzicht_Progress}.
76 76
 	 *
77 77
 	 * @since 1.0.0
78 78
 	 */
Please login to merge, or discard this patch.
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -24,195 +24,195 @@
 block discarded – undo
24 24
  */
25 25
 class Task_Single_Instance_Task_Runner {
26 26
 
27
-	/**
28
-	 * Define the transient prefix.
29
-	 *
30
-	 * @since 1.0.0
31
-	 */
32
-	const IS_RUNNING_PREFIX = '_wf_task_runner__';
33
-
34
-	/**
35
-	 * A {@link Wordlift_Log_Service} instance.
36
-	 *
37
-	 * @since 1.0.0
38
-	 * @var Wordlift_Log_Service A {@link Wordlift_Log_Service} instance.
39
-	 * @access private
40
-	 */
41
-	private $log;
42
-
43
-	/**
44
-	 * The {@link Task} to execute.
45
-	 *
46
-	 * @since 1.0.0
47
-	 * @var Task $task The {@link Task} to execute.
48
-	 * @access private
49
-	 */
50
-	private $task;
51
-
52
-	/**
53
-	 * One or more callbacks to call to update about the task progress.
54
-	 *
55
-	 * @since 1.0.0
56
-	 * @var Task_Progress[] $callbacks An array of {@link Wordlift_For_Bungalowparkoverzicht_Progress}.
57
-	 * @access private
58
-	 */
59
-	private $callbacks;
60
-
61
-	/**
62
-	 * Whether to force starting a task even if another instance of the task is already running.
63
-	 *
64
-	 * @since 1.0.0
65
-	 * @var bool $force Whether to force starting a task even if another instance of the task is already running.
66
-	 * @access private
67
-	 */
68
-	private $force;
69
-
70
-	/**
71
-	 * Create a {@link Task_Single_Instance_Task_Runner} instance.
72
-	 *
73
-	 * @param Task $task The {@link Task} instance.
74
-	 * @param bool $force Whether to force starting a task even if another instance of the task is already running, default `false`.
75
-	 * @param array $callbacks An array of {@link Wordlift_For_Bungalowparkoverzicht_Progress}.
76
-	 *
77
-	 * @since 1.0.0
78
-	 */
79
-	public function __construct( $task, $force = false, $callbacks = array() ) {
80
-
81
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
82
-
83
-		$this->task      = $task;
84
-		$this->force     = $force;
85
-		$this->callbacks = $callbacks;
86
-
87
-	}
88
-
89
-	/**
90
-	 * Get the transient name for running flag.
91
-	 *
92
-	 * @return string The transient name.
93
-	 * @since 1.0.0
94
-	 */
95
-	private function get_running_transient() {
96
-
97
-		return self::IS_RUNNING_PREFIX . $this->task->get_id();
98
-	}
99
-
100
-	/**
101
-	 * Check whether a task is running.
102
-	 *
103
-	 * @return bool
104
-	 * @since 1.0.0
105
-	 */
106
-	public function is_running() {
107
-		return 'yes' === get_transient( $this->get_running_transient() );
108
-	}
109
-
110
-	/**
111
-	 * Set whether the task is running or not.
112
-	 *
113
-	 * @param bool $value Whether the task is running or not.
114
-	 *
115
-	 * @since 1.0.0
116
-	 */
117
-	public function set_running( $value ) {
118
-		set_transient( $this->get_running_transient(), $value ? 'yes' : 'no' );
119
-	}
120
-
121
-	/**
122
-	 * Start the task.
123
-	 *
124
-	 * @param int $limit The maximum number of items to process.
125
-	 * @param int $offset The starting offset.
126
-	 *
127
-	 * @throws Task_Another_Instance_Is_Running_Exception if the task is already running.
128
-	 * @since 1.0.0
129
-	 */
130
-	public function start( $limit = 0, $offset = 0 ) {
131
-
132
-		// Bail out if the task is already running.
133
-		if ( ! $this->force && $this->is_running() ) {
134
-			throw new Task_Another_Instance_Is_Running_Exception();
135
-		}
136
-
137
-		// Set the task as running.
138
-		$this->set_running( true );
139
-
140
-		// List the chunk of elements to process.
141
-		$items = $this->task->list_items( $limit, $offset );
142
-
143
-		for ( $i = 0; $i < count( $items ); $i ++ ) {
144
-			// Process the item.
145
-			$this->task->process_item( $items[ $i ] );
146
-
147
-			// Update the progress.
148
-			$this->set_progress( $offset + $i, $items[ $i ] );
149
-		}
150
-
151
-		// Set the total number of elements to process.
152
-		$this->set_count( $this->task->count_items() );
153
-
154
-		// Unset the running flag.
155
-		$this->set_running( false );
156
-
157
-		// Set the task to complete.
158
-		$this->finish();
159
-
160
-	}
161
-
162
-	/**
163
-	 * Set the total number of items to process.
164
-	 *
165
-	 * @param int $value The total number of items to process.
166
-	 *
167
-	 * @since 1.0.0
168
-	 */
169
-	private function set_count( $value ) {
170
-
171
-		if ( empty( $this->callbacks ) ) {
172
-			return;
173
-		}
174
-
175
-		foreach ( $this->callbacks as $callback ) {
176
-			call_user_func( array( $callback, 'set_count' ), $value );
177
-		}
178
-
179
-	}
180
-
181
-	/**
182
-	 * Set the task progress.
183
-	 *
184
-	 * @param int $index The current item index.
185
-	 * @param mixed $item The current item.
186
-	 *
187
-	 * @since 1.0.0
188
-	 */
189
-	private function set_progress( $index, $item ) {
190
-
191
-		if ( empty( $this->callbacks ) ) {
192
-			return;
193
-		}
194
-
195
-		foreach ( $this->callbacks as $callback ) {
196
-			call_user_func( array( $callback, 'set_progress' ), $index, $item );
197
-		}
198
-
199
-	}
200
-
201
-	/**
202
-	 * Inform the callbacks that the task completed.
203
-	 *
204
-	 * @since 1.0.0
205
-	 */
206
-	private function finish() {
207
-
208
-		if ( empty( $this->callbacks ) ) {
209
-			return;
210
-		}
211
-
212
-		foreach ( $this->callbacks as $callback ) {
213
-			call_user_func( array( $callback, 'finish' ) );
214
-		}
215
-
216
-	}
27
+    /**
28
+     * Define the transient prefix.
29
+     *
30
+     * @since 1.0.0
31
+     */
32
+    const IS_RUNNING_PREFIX = '_wf_task_runner__';
33
+
34
+    /**
35
+     * A {@link Wordlift_Log_Service} instance.
36
+     *
37
+     * @since 1.0.0
38
+     * @var Wordlift_Log_Service A {@link Wordlift_Log_Service} instance.
39
+     * @access private
40
+     */
41
+    private $log;
42
+
43
+    /**
44
+     * The {@link Task} to execute.
45
+     *
46
+     * @since 1.0.0
47
+     * @var Task $task The {@link Task} to execute.
48
+     * @access private
49
+     */
50
+    private $task;
51
+
52
+    /**
53
+     * One or more callbacks to call to update about the task progress.
54
+     *
55
+     * @since 1.0.0
56
+     * @var Task_Progress[] $callbacks An array of {@link Wordlift_For_Bungalowparkoverzicht_Progress}.
57
+     * @access private
58
+     */
59
+    private $callbacks;
60
+
61
+    /**
62
+     * Whether to force starting a task even if another instance of the task is already running.
63
+     *
64
+     * @since 1.0.0
65
+     * @var bool $force Whether to force starting a task even if another instance of the task is already running.
66
+     * @access private
67
+     */
68
+    private $force;
69
+
70
+    /**
71
+     * Create a {@link Task_Single_Instance_Task_Runner} instance.
72
+     *
73
+     * @param Task $task The {@link Task} instance.
74
+     * @param bool $force Whether to force starting a task even if another instance of the task is already running, default `false`.
75
+     * @param array $callbacks An array of {@link Wordlift_For_Bungalowparkoverzicht_Progress}.
76
+     *
77
+     * @since 1.0.0
78
+     */
79
+    public function __construct( $task, $force = false, $callbacks = array() ) {
80
+
81
+        $this->log = Wordlift_Log_Service::get_logger( get_class() );
82
+
83
+        $this->task      = $task;
84
+        $this->force     = $force;
85
+        $this->callbacks = $callbacks;
86
+
87
+    }
88
+
89
+    /**
90
+     * Get the transient name for running flag.
91
+     *
92
+     * @return string The transient name.
93
+     * @since 1.0.0
94
+     */
95
+    private function get_running_transient() {
96
+
97
+        return self::IS_RUNNING_PREFIX . $this->task->get_id();
98
+    }
99
+
100
+    /**
101
+     * Check whether a task is running.
102
+     *
103
+     * @return bool
104
+     * @since 1.0.0
105
+     */
106
+    public function is_running() {
107
+        return 'yes' === get_transient( $this->get_running_transient() );
108
+    }
109
+
110
+    /**
111
+     * Set whether the task is running or not.
112
+     *
113
+     * @param bool $value Whether the task is running or not.
114
+     *
115
+     * @since 1.0.0
116
+     */
117
+    public function set_running( $value ) {
118
+        set_transient( $this->get_running_transient(), $value ? 'yes' : 'no' );
119
+    }
120
+
121
+    /**
122
+     * Start the task.
123
+     *
124
+     * @param int $limit The maximum number of items to process.
125
+     * @param int $offset The starting offset.
126
+     *
127
+     * @throws Task_Another_Instance_Is_Running_Exception if the task is already running.
128
+     * @since 1.0.0
129
+     */
130
+    public function start( $limit = 0, $offset = 0 ) {
131
+
132
+        // Bail out if the task is already running.
133
+        if ( ! $this->force && $this->is_running() ) {
134
+            throw new Task_Another_Instance_Is_Running_Exception();
135
+        }
136
+
137
+        // Set the task as running.
138
+        $this->set_running( true );
139
+
140
+        // List the chunk of elements to process.
141
+        $items = $this->task->list_items( $limit, $offset );
142
+
143
+        for ( $i = 0; $i < count( $items ); $i ++ ) {
144
+            // Process the item.
145
+            $this->task->process_item( $items[ $i ] );
146
+
147
+            // Update the progress.
148
+            $this->set_progress( $offset + $i, $items[ $i ] );
149
+        }
150
+
151
+        // Set the total number of elements to process.
152
+        $this->set_count( $this->task->count_items() );
153
+
154
+        // Unset the running flag.
155
+        $this->set_running( false );
156
+
157
+        // Set the task to complete.
158
+        $this->finish();
159
+
160
+    }
161
+
162
+    /**
163
+     * Set the total number of items to process.
164
+     *
165
+     * @param int $value The total number of items to process.
166
+     *
167
+     * @since 1.0.0
168
+     */
169
+    private function set_count( $value ) {
170
+
171
+        if ( empty( $this->callbacks ) ) {
172
+            return;
173
+        }
174
+
175
+        foreach ( $this->callbacks as $callback ) {
176
+            call_user_func( array( $callback, 'set_count' ), $value );
177
+        }
178
+
179
+    }
180
+
181
+    /**
182
+     * Set the task progress.
183
+     *
184
+     * @param int $index The current item index.
185
+     * @param mixed $item The current item.
186
+     *
187
+     * @since 1.0.0
188
+     */
189
+    private function set_progress( $index, $item ) {
190
+
191
+        if ( empty( $this->callbacks ) ) {
192
+            return;
193
+        }
194
+
195
+        foreach ( $this->callbacks as $callback ) {
196
+            call_user_func( array( $callback, 'set_progress' ), $index, $item );
197
+        }
198
+
199
+    }
200
+
201
+    /**
202
+     * Inform the callbacks that the task completed.
203
+     *
204
+     * @since 1.0.0
205
+     */
206
+    private function finish() {
207
+
208
+        if ( empty( $this->callbacks ) ) {
209
+            return;
210
+        }
211
+
212
+        foreach ( $this->callbacks as $callback ) {
213
+            call_user_func( array( $callback, 'finish' ) );
214
+        }
215
+
216
+    }
217 217
 
218 218
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @since 1.0.0
78 78
 	 */
79
-	public function __construct( $task, $force = false, $callbacks = array() ) {
79
+	public function __construct($task, $force = false, $callbacks = array()) {
80 80
 
81
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
81
+		$this->log = Wordlift_Log_Service::get_logger(get_class());
82 82
 
83 83
 		$this->task      = $task;
84 84
 		$this->force     = $force;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	private function get_running_transient() {
96 96
 
97
-		return self::IS_RUNNING_PREFIX . $this->task->get_id();
97
+		return self::IS_RUNNING_PREFIX.$this->task->get_id();
98 98
 	}
99 99
 
100 100
 	/**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @since 1.0.0
105 105
 	 */
106 106
 	public function is_running() {
107
-		return 'yes' === get_transient( $this->get_running_transient() );
107
+		return 'yes' === get_transient($this->get_running_transient());
108 108
 	}
109 109
 
110 110
 	/**
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @since 1.0.0
116 116
 	 */
117
-	public function set_running( $value ) {
118
-		set_transient( $this->get_running_transient(), $value ? 'yes' : 'no' );
117
+	public function set_running($value) {
118
+		set_transient($this->get_running_transient(), $value ? 'yes' : 'no');
119 119
 	}
120 120
 
121 121
 	/**
@@ -127,32 +127,32 @@  discard block
 block discarded – undo
127 127
 	 * @throws Task_Another_Instance_Is_Running_Exception if the task is already running.
128 128
 	 * @since 1.0.0
129 129
 	 */
130
-	public function start( $limit = 0, $offset = 0 ) {
130
+	public function start($limit = 0, $offset = 0) {
131 131
 
132 132
 		// Bail out if the task is already running.
133
-		if ( ! $this->force && $this->is_running() ) {
133
+		if ( ! $this->force && $this->is_running()) {
134 134
 			throw new Task_Another_Instance_Is_Running_Exception();
135 135
 		}
136 136
 
137 137
 		// Set the task as running.
138
-		$this->set_running( true );
138
+		$this->set_running(true);
139 139
 
140 140
 		// List the chunk of elements to process.
141
-		$items = $this->task->list_items( $limit, $offset );
141
+		$items = $this->task->list_items($limit, $offset);
142 142
 
143
-		for ( $i = 0; $i < count( $items ); $i ++ ) {
143
+		for ($i = 0; $i < count($items); $i++) {
144 144
 			// Process the item.
145
-			$this->task->process_item( $items[ $i ] );
145
+			$this->task->process_item($items[$i]);
146 146
 
147 147
 			// Update the progress.
148
-			$this->set_progress( $offset + $i, $items[ $i ] );
148
+			$this->set_progress($offset + $i, $items[$i]);
149 149
 		}
150 150
 
151 151
 		// Set the total number of elements to process.
152
-		$this->set_count( $this->task->count_items() );
152
+		$this->set_count($this->task->count_items());
153 153
 
154 154
 		// Unset the running flag.
155
-		$this->set_running( false );
155
+		$this->set_running(false);
156 156
 
157 157
 		// Set the task to complete.
158 158
 		$this->finish();
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @since 1.0.0
168 168
 	 */
169
-	private function set_count( $value ) {
169
+	private function set_count($value) {
170 170
 
171
-		if ( empty( $this->callbacks ) ) {
171
+		if (empty($this->callbacks)) {
172 172
 			return;
173 173
 		}
174 174
 
175
-		foreach ( $this->callbacks as $callback ) {
176
-			call_user_func( array( $callback, 'set_count' ), $value );
175
+		foreach ($this->callbacks as $callback) {
176
+			call_user_func(array($callback, 'set_count'), $value);
177 177
 		}
178 178
 
179 179
 	}
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @since 1.0.0
188 188
 	 */
189
-	private function set_progress( $index, $item ) {
189
+	private function set_progress($index, $item) {
190 190
 
191
-		if ( empty( $this->callbacks ) ) {
191
+		if (empty($this->callbacks)) {
192 192
 			return;
193 193
 		}
194 194
 
195
-		foreach ( $this->callbacks as $callback ) {
196
-			call_user_func( array( $callback, 'set_progress' ), $index, $item );
195
+		foreach ($this->callbacks as $callback) {
196
+			call_user_func(array($callback, 'set_progress'), $index, $item);
197 197
 		}
198 198
 
199 199
 	}
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	private function finish() {
207 207
 
208
-		if ( empty( $this->callbacks ) ) {
208
+		if (empty($this->callbacks)) {
209 209
 			return;
210 210
 		}
211 211
 
212
-		foreach ( $this->callbacks as $callback ) {
213
-			call_user_func( array( $callback, 'finish' ) );
212
+		foreach ($this->callbacks as $callback) {
213
+			call_user_func(array($callback, 'finish'));
214 214
 		}
215 215
 
216 216
 	}
Please login to merge, or discard this patch.
src/wordlift/tasks/admin/assets/tasks-page.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 	<h1><?php esc_html_e( 'Tasks', 'wordlift-framework' ); ?></h1>
14 14
 
15 15
 	<?php
16
-	foreach ( $this->task_ajax_adapters_registry->get_task_ajax_adapters() as $task_ajax_adapter ) {
17
-		$task = $task_ajax_adapter->get_task();
18
-		?>
16
+    foreach ( $this->task_ajax_adapters_registry->get_task_ajax_adapters() as $task_ajax_adapter ) {
17
+        $task = $task_ajax_adapter->get_task();
18
+        ?>
19 19
 		<div class="wl-task">
20 20
 			<h2><?php esc_html_e( $task->get_label() ); ?></h2>
21 21
 			<div class="wl-task__progress" style="border: 1px solid #23282D; height: 20px; margin: 8px 0;">
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 		</div>
34 34
 		<?php
35
-	}
36
-	?>
35
+    }
36
+    ?>
37 37
 
38 38
 </div>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
 
11 11
 ?>
12 12
 <div class="wrap">
13
-	<h1><?php esc_html_e( 'Tasks', 'wordlift-framework' ); ?></h1>
13
+	<h1><?php esc_html_e('Tasks', 'wordlift-framework'); ?></h1>
14 14
 
15 15
 	<?php
16
-	foreach ( $this->task_ajax_adapters_registry->get_task_ajax_adapters() as $task_ajax_adapter ) {
16
+	foreach ($this->task_ajax_adapters_registry->get_task_ajax_adapters() as $task_ajax_adapter) {
17 17
 		$task = $task_ajax_adapter->get_task();
18 18
 		?>
19 19
 		<div class="wl-task">
20
-			<h2><?php esc_html_e( $task->get_label() ); ?></h2>
20
+			<h2><?php esc_html_e($task->get_label()); ?></h2>
21 21
 			<div class="wl-task__progress" style="border: 1px solid #23282D; height: 20px; margin: 8px 0;">
22 22
 				<div class="wl-task__progress__bar"
23 23
 				     style="width:0;background: #0073AA; text-align: center; height: 100%; color: #fff;"></div>
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 			<button
27 27
 				type="button"
28 28
 				class="button button-large button-primary"
29
-				data-action="<?php echo esc_attr( $task->get_id() ); ?>"
30
-				data-nonce="<?php echo esc_attr( wp_create_nonce( $task->get_id() ) ); ?>"
31
-			><?php esc_html_e( 'Start', 'wordlift-framework' ); ?></button>
29
+				data-action="<?php echo esc_attr($task->get_id()); ?>"
30
+				data-nonce="<?php echo esc_attr(wp_create_nonce($task->get_id())); ?>"
31
+			><?php esc_html_e('Start', 'wordlift-framework'); ?></button>
32 32
 
33 33
 		</div>
34 34
 		<?php
Please login to merge, or discard this patch.
src/wordlift/tasks/class-task-progress.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,30 +16,30 @@
 block discarded – undo
16 16
  */
17 17
 interface Task_Progress {
18 18
 
19
-	/**
20
-	 * The total number of elements to process.
21
-	 *
22
-	 * @param int $value The total number of elements to process.
23
-	 *
24
-	 * @since 1.0.0
25
-	 */
26
-	function set_count( $value );
19
+    /**
20
+     * The total number of elements to process.
21
+     *
22
+     * @param int $value The total number of elements to process.
23
+     *
24
+     * @since 1.0.0
25
+     */
26
+    function set_count( $value );
27 27
 
28
-	/**
29
-	 * Set the current processed item.
30
-	 *
31
-	 * @param int $counter The current item.
32
-	 * @param mixed $item The current item.
33
-	 *
34
-	 * @since 1.0.0
35
-	 */
36
-	function set_progress( $counter, $item );
28
+    /**
29
+     * Set the current processed item.
30
+     *
31
+     * @param int $counter The current item.
32
+     * @param mixed $item The current item.
33
+     *
34
+     * @since 1.0.0
35
+     */
36
+    function set_progress( $counter, $item );
37 37
 
38
-	/**
39
-	 * Set the operation as complete.
40
-	 *
41
-	 * @since 1.0.0
42
-	 */
43
-	function finish();
38
+    /**
39
+     * Set the operation as complete.
40
+     *
41
+     * @since 1.0.0
42
+     */
43
+    function finish();
44 44
 
45 45
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @since 1.0.0
25 25
 	 */
26
-	function set_count( $value );
26
+	function set_count($value);
27 27
 
28 28
 	/**
29 29
 	 * Set the current processed item.
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @since 1.0.0
35 35
 	 */
36
-	function set_progress( $counter, $item );
36
+	function set_progress($counter, $item);
37 37
 
38 38
 	/**
39 39
 	 * Set the operation as complete.
Please login to merge, or discard this patch.
src/wordlift/tasks/class-task-ajax-adapters-registry.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,29 +4,29 @@
 block discarded – undo
4 4
 
5 5
 class Task_Ajax_Adapters_Registry {
6 6
 
7
-	private $task_ajax_adapters = array();
7
+    private $task_ajax_adapters = array();
8 8
 
9
-	public function __construct( $adapters = array() ) {
9
+    public function __construct( $adapters = array() ) {
10 10
 
11
-		$this->task_ajax_adapters = is_array( $adapters ) ? $adapters : array( $adapters );
11
+        $this->task_ajax_adapters = is_array( $adapters ) ? $adapters : array( $adapters );
12 12
 
13
-	}
13
+    }
14 14
 
15
-	/**
16
-	 * @param Task_Ajax_Adapter $task_ajax_adapter
17
-	 */
18
-	public function register( $task_ajax_adapter ) {
15
+    /**
16
+     * @param Task_Ajax_Adapter $task_ajax_adapter
17
+     */
18
+    public function register( $task_ajax_adapter ) {
19 19
 
20
-		$this->task_ajax_adapters[] = $task_ajax_adapter;
20
+        $this->task_ajax_adapters[] = $task_ajax_adapter;
21 21
 
22
-	}
22
+    }
23 23
 
24
-	/**
25
-	 * @return Task_Ajax_Adapter[]
26
-	 */
27
-	public function get_task_ajax_adapters() {
24
+    /**
25
+     * @return Task_Ajax_Adapter[]
26
+     */
27
+    public function get_task_ajax_adapters() {
28 28
 
29
-		return $this->task_ajax_adapters;
30
-	}
29
+        return $this->task_ajax_adapters;
30
+    }
31 31
 
32 32
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@
 block discarded – undo
6 6
 
7 7
 	private $task_ajax_adapters = array();
8 8
 
9
-	public function __construct( $adapters = array() ) {
9
+	public function __construct($adapters = array()) {
10 10
 
11
-		$this->task_ajax_adapters = is_array( $adapters ) ? $adapters : array( $adapters );
11
+		$this->task_ajax_adapters = is_array($adapters) ? $adapters : array($adapters);
12 12
 
13 13
 	}
14 14
 
15 15
 	/**
16 16
 	 * @param Task_Ajax_Adapter $task_ajax_adapter
17 17
 	 */
18
-	public function register( $task_ajax_adapter ) {
18
+	public function register($task_ajax_adapter) {
19 19
 
20 20
 		$this->task_ajax_adapters[] = $task_ajax_adapter;
21 21
 
Please login to merge, or discard this patch.