Passed
Branch master (ae447d)
by Salah
02:14
created
src/Modules/HtaccessSecurity.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function activate()
58 58
     {
59
-        $this->getPaths()->each(function ($content, $path) {
59
+        $this->getPaths()->each(function($content, $path) {
60 60
             $this->setHtaccessPath($path)->setHtaccessRule($content)->addHtaccessContent();
61 61
         });
62 62
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function deactivate()
78 78
     {
79
-        $this->getPaths()->each(function ($content, $path) {
79
+        $this->getPaths()->each(function($content, $path) {
80 80
             $this->setHtaccessPath($path)->setHtaccessRule($content)->removeHtaccessContent();
81 81
         });
82 82
     }
Please login to merge, or discard this patch.
src/Plugin.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     protected function initModules()
65 65
     {
66
-        return $this->modules = $this->getModules()->map(function ($module) {
66
+        return $this->modules = $this->getModules()->map(function($module) {
67 67
             return new $module();
68 68
         });
69 69
     }
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
     public function load()
86 86
     {
87 87
         // Load all modules that require immediate loading.
88
-        $this->getModules()->reject(function ($module) {
88
+        $this->getModules()->reject(function($module) {
89 89
             return !$module instanceof Loadable;
90
-        })->each(function ($module) {
90
+        })->each(function($module) {
91 91
             $module->load();
92 92
         });
93 93
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
     public function init()
103 103
     {
104 104
         // Initialize all modules that require initialization.
105
-        $this->getModules()->reject(function ($module) {
105
+        $this->getModules()->reject(function($module) {
106 106
             return !$module instanceof Initializable;
107
-        })->each(function ($module) {
107
+        })->each(function($module) {
108 108
             $module->init();
109 109
         });
110 110
 
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
     public function activate()
148 148
     {
149 149
         // Install every module that requires it.
150
-        $this->getModules()->reject(function ($module) {
150
+        $this->getModules()->reject(function($module) {
151 151
             return !$module instanceof Installable;
152
-        })->each(function ($module) {
152
+        })->each(function($module) {
153 153
             $module->install();
154 154
         });
155 155
 
156 156
         // Activate every module that requires it.
157
-        $this->getModules()->reject(function ($module) {
157
+        $this->getModules()->reject(function($module) {
158 158
             return !$module instanceof Activable;
159
-        })->each(function ($module) {
159
+        })->each(function($module) {
160 160
             $module->activate();
161 161
         });
162 162
     }
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
     public function deactivate()
171 171
     {
172 172
         // Activate every module that requires it.
173
-        $this->getModules()->reject(function ($module) {
173
+        $this->getModules()->reject(function($module) {
174 174
             return !$module instanceof Activable;
175
-        })->each(function ($module) {
175
+        })->each(function($module) {
176 176
             $module->deactivate();
177 177
         });
178 178
     }
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
     public function uninstall()
187 187
     {
188 188
         // Uninstall every module that requires it.
189
-        $this->getModules()->reject(function ($module) {
189
+        $this->getModules()->reject(function($module) {
190 190
             return !$module instanceof Installable;
191
-        })->each(function ($module) {
191
+        })->each(function($module) {
192 192
             $module->uninstall();
193 193
         });
194 194
     }
Please login to merge, or discard this patch.
src/Helpers/WPGitHubUpdater.php 1 patch
Braces   +65 added lines, -44 removed lines patch added patch discarded remove patch
@@ -101,8 +101,9 @@  discard block
 block discarded – undo
101 101
             'readme',
102 102
         );
103 103
         foreach ($required_config_params as $required_param) {
104
-            if (empty($this->config[$required_param]))
105
-                $this->missing_config[] = $required_param;
104
+            if (empty($this->config[$required_param])) {
105
+                            $this->missing_config[] = $required_param;
106
+            }
106 107
         }
107 108
         return (empty($this->missing_config));
108 109
     }
@@ -122,23 +123,31 @@  discard block
 block discarded – undo
122 123
             $zip_url = add_query_arg(array('access_token' => $this->config['access_token']), $zip_url);
123 124
             $this->config['zip_url'] = $zip_url;
124 125
         }
125
-        if (!isset($this->config['new_version']))
126
-            $this->config['new_version'] = $this->get_new_version();
127
-        if (!isset($this->config['last_updated']))
128
-            $this->config['last_updated'] = $this->get_date();
129
-        if (!isset($this->config['description']))
130
-            $this->config['description'] = $this->get_description();
126
+        if (!isset($this->config['new_version'])) {
127
+                    $this->config['new_version'] = $this->get_new_version();
128
+        }
129
+        if (!isset($this->config['last_updated'])) {
130
+                    $this->config['last_updated'] = $this->get_date();
131
+        }
132
+        if (!isset($this->config['description'])) {
133
+                    $this->config['description'] = $this->get_description();
134
+        }
131 135
         $plugin_data = $this->get_plugin_data();
132
-        if (!isset($this->config['plugin_name']))
133
-            $this->config['plugin_name'] = $plugin_data['Name'];
134
-        if (!isset($this->config['version']))
135
-            $this->config['version'] = $plugin_data['Version'];
136
-        if (!isset($this->config['author']))
137
-            $this->config['author'] = $plugin_data['Author'];
138
-        if (!isset($this->config['homepage']))
139
-            $this->config['homepage'] = $plugin_data['PluginURI'];
140
-        if (!isset($this->config['readme']))
141
-            $this->config['readme'] = 'README.md';
136
+        if (!isset($this->config['plugin_name'])) {
137
+                    $this->config['plugin_name'] = $plugin_data['Name'];
138
+        }
139
+        if (!isset($this->config['version'])) {
140
+                    $this->config['version'] = $plugin_data['Version'];
141
+        }
142
+        if (!isset($this->config['author'])) {
143
+                    $this->config['author'] = $plugin_data['Author'];
144
+        }
145
+        if (!isset($this->config['homepage'])) {
146
+                    $this->config['homepage'] = $plugin_data['PluginURI'];
147
+        }
148
+        if (!isset($this->config['readme'])) {
149
+                    $this->config['readme'] = 'README.md';
150
+        }
142 151
     }
143 152
 
144 153
     /**
@@ -152,32 +161,38 @@  discard block
 block discarded – undo
152 161
         $version = get_site_transient(md5($this->config['slug']) . '_new_version');
153 162
         if ($this->overrule_transients() || (!isset($version) || !$version || '' == $version)) {
154 163
             $raw_response = $this->remote_get(trailingslashit($this->config['raw_url']) . basename($this->config['slug']));
155
-            if (is_wp_error($raw_response))
156
-                $version = false;
164
+            if (is_wp_error($raw_response)) {
165
+                            $version = false;
166
+            }
157 167
             if (is_array($raw_response)) {
158
-                if (!empty($raw_response['body']))
159
-                    preg_match('/.*Version\:\s*(.*)$/mi', $raw_response['body'], $matches);
168
+                if (!empty($raw_response['body'])) {
169
+                                    preg_match('/.*Version\:\s*(.*)$/mi', $raw_response['body'], $matches);
170
+                }
171
+            }
172
+            if (empty($matches[1])) {
173
+                            $version = false;
174
+            } else {
175
+                            $version = $matches[1];
160 176
             }
161
-            if (empty($matches[1]))
162
-                $version = false;
163
-            else
164
-                $version = $matches[1];
165 177
             // back compat for older readme version handling
166 178
             // only done when there is no version found in file name
167 179
             if (false === $version) {
168 180
                 $raw_response = $this->remote_get(trailingslashit($this->config['raw_url']) . $this->config['readme']);
169
-                if (is_wp_error($raw_response))
170
-                    return $version;
181
+                if (is_wp_error($raw_response)) {
182
+                                    return $version;
183
+                }
171 184
                 preg_match('#^\s*`*~Current Version\:\s*([^~]*)~#im', $raw_response['body'], $__version);
172 185
                 if (isset($__version[1])) {
173 186
                     $version_readme = $__version[1];
174
-                    if (-1 == version_compare($version, $version_readme))
175
-                        $version = $version_readme;
187
+                    if (-1 == version_compare($version, $version_readme)) {
188
+                                            $version = $version_readme;
189
+                    }
176 190
                 }
177 191
             }
178 192
             // refresh every 6 hours
179
-            if (false !== $version)
180
-                set_site_transient(md5($this->config['slug']) . '_new_version', $version, 60 * 60 * 6);
193
+            if (false !== $version) {
194
+                            set_site_transient(md5($this->config['slug']) . '_new_version', $version, 60 * 60 * 6);
195
+            }
181 196
         }
182 197
         return $version;
183 198
     }
@@ -202,8 +217,9 @@  discard block
 block discarded – undo
202 217
      */
203 218
     public function remote_get($query)
204 219
     {
205
-        if (!empty($this->config['access_token']))
206
-            $query = add_query_arg(array('access_token' => $this->config['access_token']), $query);
220
+        if (!empty($this->config['access_token'])) {
221
+                    $query = add_query_arg(array('access_token' => $this->config['access_token']), $query);
222
+        }
207 223
         $raw_response = wp_remote_get($query, array(
208 224
             'sslverify' => $this->config['sslverify']
209 225
         ));
@@ -236,8 +252,9 @@  discard block
 block discarded – undo
236 252
             $github_data = get_site_transient(md5($this->config['slug']) . '_github_data');
237 253
             if ($this->overrule_transients() || (!isset($github_data) || !$github_data || '' == $github_data)) {
238 254
                 $github_data = $this->remote_get($this->config['api_url']);
239
-                if (is_wp_error($github_data))
240
-                    return false;
255
+                if (is_wp_error($github_data)) {
256
+                                    return false;
257
+                }
241 258
                 $github_data = json_decode($github_data['body']);
242 259
                 // refresh every 6 hours
243 260
                 set_site_transient(md5($this->config['slug']) . '_github_data', $github_data, 60 * 60 * 6);
@@ -294,8 +311,9 @@  discard block
 block discarded – undo
294 311
      */
295 312
     public function http_request_sslverify($args, $url)
296 313
     {
297
-        if ($this->config['zip_url'] == $url)
298
-            $args['sslverify'] = $this->config['sslverify'];
314
+        if ($this->config['zip_url'] == $url) {
315
+                    $args['sslverify'] = $this->config['sslverify'];
316
+        }
299 317
         return $args;
300 318
     }
301 319
 
@@ -312,8 +330,9 @@  discard block
 block discarded – undo
312 330
     {
313 331
         // Check if the transient contains the 'checked' information
314 332
         // If not, just return its value without hacking it
315
-        if (empty($transient->checked))
316
-            return $transient;
333
+        if (empty($transient->checked)) {
334
+                    return $transient;
335
+        }
317 336
         // check the version and decide if it's new
318 337
         $update = version_compare($this->config['new_version'], $this->config['version']);
319 338
         if (1 === $update) {
@@ -323,8 +342,9 @@  discard block
 block discarded – undo
323 342
             $response->url = add_query_arg(array('access_token' => $this->config['access_token']), $this->config['github_url']);
324 343
             $response->package = $this->config['zip_url'];
325 344
             // If response is false, don't alter the transient
326
-            if (false !== $response)
327
-                $transient->response[$this->config['slug']] = $response;
345
+            if (false !== $response) {
346
+                            $transient->response[$this->config['slug']] = $response;
347
+            }
328 348
         }
329 349
         return $transient;
330 350
     }
@@ -343,8 +363,9 @@  discard block
 block discarded – undo
343 363
     public function get_plugin_info($false, $action, $response)
344 364
     {
345 365
         // Check if this call API is for the right plugin
346
-        if (!isset($response->slug) || $response->slug != $this->config['slug'])
347
-            return false;
366
+        if (!isset($response->slug) || $response->slug != $this->config['slug']) {
367
+                    return false;
368
+        }
348 369
         $response->slug = $this->config['slug'];
349 370
         $response->plugin_name = $this->config['plugin_name'];
350 371
         $response->version = $this->config['new_version'];
Please login to merge, or discard this patch.