Completed
Push — master ( 2e8a14...c574af )
by Andreas
14:13
created
lib/net/nehmer/blog/handler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function get_url(midcom_db_article $article, $allow_external = false) : string
17 17
     {
18
-        if (   $allow_external
18
+        if ($allow_external
19 19
             && $this->_config->get('link_to_external_url')
20 20
             && !empty($article->url)) {
21 21
             return $article->url;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         $qb->add_constraint('topic.guid', 'IN', $topic_guids);
69 69
 
70
-        if (   count($topic_guids) > 1
70
+        if (count($topic_guids) > 1
71 71
             && $list_from_folders_categories = $this->_config->get('list_from_folders_categories')) {
72 72
             $list_from_folders_categories = explode(',', $list_from_folders_categories);
73 73
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         // Hide the articles that have the publish time in the future and if
85 85
         // the user is not administrator
86
-        if (   $this->_config->get('enable_scheduled_publishing')
86
+        if ($this->_config->get('enable_scheduled_publishing')
87 87
             && !midcom::get()->auth->admin) {
88 88
             // Show the article only if the publishing time has passed or the viewer
89 89
             // is the author
Please login to merge, or discard this patch.
lib/net/nehmer/comments/comment.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         }
186 186
 
187 187
         // Set the status
188
-        if (   $this->can_do('net.nehmer.comments:moderation')
188
+        if ($this->can_do('net.nehmer.comments:moderation')
189 189
             && !$this->_sudo_requested) {
190 190
             $this->status = self::ABUSE;
191 191
         } else {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             return false;
210 210
         }
211 211
         // Set the status
212
-        if (   !$this->can_do('net.nehmer.comments:moderation')
212
+        if (!$this->can_do('net.nehmer.comments:moderation')
213 213
             || $this->_sudo_requested) {
214 214
             return false;
215 215
         }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         }
234 234
 
235 235
         // Set the status
236
-        if (   !$this->can_do('net.nehmer.comments:moderation')
236
+        if (!$this->can_do('net.nehmer.comments:moderation')
237 237
             || $this->_sudo_requested) {
238 238
             return false;
239 239
         }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public function report_not_abuse() : bool
254 254
     {
255
-        if (   !$this->can_do('net.nehmer.comments:moderation')
255
+        if (!$this->can_do('net.nehmer.comments:moderation')
256 256
             || $this->_sudo_requested) {
257 257
             return false;
258 258
         }
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
     {
352 352
         $config = midcom_baseclasses_components_configuration::get('net.nehmer.comments', 'config');
353 353
 
354
-        if (   $config->get('ratings_enable')
355
-            && (    $config->get('ratings_cache_to_object')
354
+        if ($config->get('ratings_enable')
355
+            && ($config->get('ratings_cache_to_object')
356 356
                  || $config->get('comment_count_cache_to_object'))) {
357 357
             // Handle ratings
358 358
             $comments = self::list_by_objectguid($this->objectguid);
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
             return false;
410 410
         }
411 411
 
412
-        if (   empty($this->title)
412
+        if (empty($this->title)
413 413
             && empty($this->content)) {
414 414
             // No need to send notifications about empty rating entries
415 415
             return false;
Please login to merge, or discard this patch.
lib/net/nehmer/comments/handler/view.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
         if (!$this->_schemadb) {
99 99
             $this->_schemadb = schemadb::from_path($this->_config->get('schemadb'));
100 100
 
101
-            if (   $this->_config->get('use_captcha')
102
-                || (   !midcom::get()->auth->user
101
+            if ($this->_config->get('use_captcha')
102
+                || (!midcom::get()->auth->user
103 103
                     && $this->_config->get('use_captcha_if_anonymous'))) {
104 104
                 $fields = $this->_schemadb->get('comment')->get('fields');
105 105
                 $fields['captcha'] = [
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                 $this->_schemadb->get('comment')->set('fields', $fields);
113 113
             }
114 114
 
115
-            if (   $this->_config->get('ratings_enable')
115
+            if ($this->_config->get('ratings_enable')
116 116
                 && $this->_schemadb->get('comment')->has_field('rating')) {
117 117
                 $this->_schemadb->get('comment')->get_field('rating')['hidden'] = false;
118 118
             }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             $this->_comments = $this->_comments->execute();
192 192
         }
193 193
 
194
-        if (   midcom::get()->auth->user
194
+        if (midcom::get()->auth->user
195 195
             || $this->_config->get('allow_anonymous')) {
196 196
             $this->_init_post_controller($request);
197 197
             if ($response = $this->_process_post($request)) {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     private function _process_post(Request $request)
224 224
     {
225
-        if (   !midcom::get()->auth->user
225
+        if (!midcom::get()->auth->user
226 226
             && !midcom::get()->auth->request_sudo('net.nehmer.comments')) {
227 227
             throw new midcom_error('We were anonymous but could not acquire SUDO privileges, aborting');
228 228
         }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
                 // Check against comment spam
233 233
                 $this->_new_comment->check_spam($this->_config);
234 234
                 $formdata = $this->_post_controller->get_form_values();
235
-                if (   $formdata['subscribe']
235
+                if ($formdata['subscribe']
236 236
                     && midcom::get()->auth->user) {
237 237
                     // User wants to subscribe to receive notifications about this comments thread
238 238
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      */
269 269
     private function _get_last_modified() : int
270 270
     {
271
-        return array_reduce($this->_comments, function ($carry, net_nehmer_comments_comment $item) {
271
+        return array_reduce($this->_comments, function($carry, net_nehmer_comments_comment $item) {
272 272
             return max($item->metadata->revised, $carry);
273 273
         }, 0);
274 274
     }
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
                 $data['comment_toolbar'] = $this->populate_post_toolbar($comment);
291 291
                 midcom_show_style('comments-item');
292 292
 
293
-                if (   midcom::get()->auth->admin
294
-                    || (   midcom::get()->auth->user
293
+                if (midcom::get()->auth->admin
294
+                    || (midcom::get()->auth->user
295 295
                         && $comment->can_do('midgard:delete'))) {
296 296
                     midcom_show_style('comments-admintoolbar');
297 297
                 }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             midcom_show_style('comments-nonefound');
302 302
         }
303 303
 
304
-        if (   midcom::get()->auth->user
304
+        if (midcom::get()->auth->user
305 305
             || $this->_config->get('allow_anonymous')) {
306 306
             midcom_show_style('post-comment');
307 307
         } else {
Please login to merge, or discard this patch.
lib/net/nehmer/static/handler/admin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      */
30 30
     private function load_controller() : controller
31 31
     {
32
-        if (    $this->_config->get('simple_name_handling')
32
+        if ($this->_config->get('simple_name_handling')
33 33
              && !midcom::get()->auth->admin) {
34 34
             foreach ($this->_request_data['schemadb']->all() as $schema) {
35 35
                 $schema->get_field('name')['readonly'] = true;
Please login to merge, or discard this patch.
lib/net/nemein/tag/handler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function copy_tags($from, $to) : bool
186 186
     {
187
-        if (   !is_object($from)
187
+        if (!is_object($from)
188 188
             || !is_object($to)) {
189 189
             return false;
190 190
         }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
         $strlen = strlen($tags_string);
489 489
         for ($i = 0; $i < $strlen; $i++) {
490 490
             $char = $tags_string[$i];
491
-            if (   (   $char == ' '
491
+            if (($char == ' '
492 492
                     && !$quote_open)
493 493
                 || $i == $strlen) {
494 494
                 $tags[] = $current_tag;
Please login to merge, or discard this patch.
lib/net/nemein/rss/fetch.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             $etag = trim($parser->data['headers']['etag']);
102 102
 
103 103
             $feed_etag = $this->_feed->get_parameter('net.nemein.rss', 'etag');
104
-            if (   !empty($feed_etag)
104
+            if (!empty($feed_etag)
105 105
                 && $feed_etag == $etag) {
106 106
                 // Feed hasn't changed, skip updating
107 107
                 debug_add("Feed {$this->_feed->url} has not changed since " . date('c', $this->_feed->latestfetch), MIDCOM_LOG_WARN);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         $guid = $item->get_id();
173 173
         $title = $item->get_title();
174 174
 
175
-        if (   (   empty($title)
175
+        if ((empty($title)
176 176
                 || trim($title) == '...')
177 177
             && empty($guid)) {
178 178
             // Something wrong with this entry, skip it
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                 $meta_values['published'] = $article_date;
238 238
             }
239 239
 
240
-            if (   $this->apply_values($article, $values, $meta_values)
240
+            if ($this->apply_values($article, $values, $meta_values)
241 241
                 && !$article->update()) {
242 242
                 return false;
243 243
             }
@@ -266,14 +266,14 @@  discard block
 block discarded – undo
266 266
     private function find_author(net_nemein_rss_parser_item $item) : midcom_db_person
267 267
     {
268 268
         // Try to figure out item author
269
-        if (   $this->_feed->forceauthor
269
+        if ($this->_feed->forceauthor
270 270
             && $this->_feed->defaultauthor) {
271 271
             // Feed has a "default author" set, use it
272 272
             return new midcom_db_person($this->_feed->defaultauthor);
273 273
         }
274 274
         $author = $this->match_item_author($item);
275 275
         $fallback_person_id = 1;
276
-        if (   !$author
276
+        if (!$author
277 277
             || $author->id == $fallback_person_id) {
278 278
             if ($this->_feed->defaultauthor) {
279 279
                 // Feed has a "default author" set, use it
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
             }
447 447
         }
448 448
 
449
-        if (   !empty($author_info['username'])
449
+        if (!empty($author_info['username'])
450 450
             && $person = midcom::get()->auth->get_user_by_name($author_info['username'])) {
451 451
             return $person->get_storage();
452 452
         }
Please login to merge, or discard this patch.