@@ -282,7 +282,7 @@ |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | // Sanity check expires |
285 | - if ( !is_int($expires) |
|
285 | + if (!is_int($expires) |
|
286 | 286 | || $expires < -1) { |
287 | 287 | throw new midcom_error("\$expires has to be a positive integer or zero or -1, is now {$expires}."); |
288 | 288 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - if ( php_sapi_name() != 'cli' |
|
24 | + if (php_sapi_name() != 'cli' |
|
25 | 25 | || !empty($_SERVER['REMOTE_ADDR'])) { |
26 | 26 | $this->_httpd_setup(); |
27 | 27 | } |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | * |
48 | 48 | * 2008-09-26: Now also rewrites urls ending in .html to end with trailing slash. |
49 | 49 | */ |
50 | - $redirect_test_uri = (string)$_SERVER['REQUEST_URI']; |
|
51 | - if ( !isset($_SERVER['MIDCOM_COMPAT_REDIR']) |
|
52 | - || (bool)$_SERVER['MIDCOM_COMPAT_REDIR'] !== false) { |
|
50 | + $redirect_test_uri = (string) $_SERVER['REQUEST_URI']; |
|
51 | + if (!isset($_SERVER['MIDCOM_COMPAT_REDIR']) |
|
52 | + || (bool) $_SERVER['MIDCOM_COMPAT_REDIR'] !== false) { |
|
53 | 53 | $redirect_test_uri = preg_replace('/\.html$/', '', $redirect_test_uri); |
54 | 54 | } |
55 | - if ( !preg_match('%\?|/$|midcom-.+-|/.*\.[^/]+$%', $redirect_test_uri) |
|
55 | + if (!preg_match('%\?|/$|midcom-.+-|/.*\.[^/]+$%', $redirect_test_uri) |
|
56 | 56 | && (empty($_POST))) { |
57 | 57 | $response = new RedirectResponse($redirect_test_uri . '/', 301); |
58 | 58 | $response->send(); |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | - if ( !empty($item[MIDCOM_TOOLBAR_ACCESSKEY]) |
|
365 | + if (!empty($item[MIDCOM_TOOLBAR_ACCESSKEY]) |
|
366 | 366 | && !array_key_exists($item[MIDCOM_TOOLBAR_ACCESSKEY], $used_access_keys)) { |
367 | 367 | // We have valid access key, add it to help text |
368 | 368 | $prefix = 'Alt-'; |
369 | - if ( isset($_SERVER['HTTP_USER_AGENT']) |
|
369 | + if (isset($_SERVER['HTTP_USER_AGENT']) |
|
370 | 370 | && strstr($_SERVER['HTTP_USER_AGENT'], 'Macintosh')) { |
371 | 371 | // Mac users |
372 | 372 | $prefix = 'Ctrl-Alt-'; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | private function set_url(array &$item, $url) |
389 | 389 | { |
390 | 390 | $item[MIDCOM_TOOLBAR__ORIGINAL_URL] = $url; |
391 | - if ( ( empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"]) |
|
391 | + if ((empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"]) |
|
392 | 392 | // Some items may want to keep their links unmutilated |
393 | 393 | || $item[MIDCOM_TOOLBAR_OPTIONS]["rel"] != "directlink") |
394 | 394 | && substr($url, 0, 1) != '/' |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | if ($index == 0) { |
415 | 415 | array_shift($this->items); |
416 | - } elseif ($index == count($this->items) -1) { |
|
416 | + } elseif ($index == count($this->items) - 1) { |
|
417 | 417 | array_pop($this->items); |
418 | 418 | } else { |
419 | 419 | $this->items = array_merge(array_slice($this->items, 0, $index - 1), |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | */ |
544 | 544 | public function render() |
545 | 545 | { |
546 | - $visible_items = array_filter($this->items, function ($item) { |
|
546 | + $visible_items = array_filter($this->items, function($item) { |
|
547 | 547 | return !$item[MIDCOM_TOOLBAR_HIDDEN]; |
548 | 548 | }); |
549 | 549 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | foreach ($visible_items as $i => $item) { |
569 | 569 | $output .= '<li class="'; |
570 | 570 | if ($i == 0) { |
571 | - $output .= $first_class . ' '; |
|
571 | + $output .= $first_class . ' '; |
|
572 | 572 | } elseif ($i == $last) { |
573 | 573 | $output .= 'last_item '; |
574 | 574 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | // Try finding uppercase version of the accesskey first |
609 | 609 | $accesskey = strtoupper($item[MIDCOM_TOOLBAR_ACCESSKEY]); |
610 | 610 | $position = strpos($label, $accesskey); |
611 | - if ( $position === false |
|
611 | + if ($position === false |
|
612 | 612 | && midcom::get()->i18n->get_current_language() == 'en') { |
613 | 613 | // Try lowercase, too |
614 | 614 | $accesskey = strtolower($accesskey); |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | $attributes['title'] = $item[MIDCOM_TOOLBAR_HELPTEXT]; |
670 | 670 | } |
671 | 671 | |
672 | - if ( $item[MIDCOM_TOOLBAR_ENABLED] |
|
672 | + if ($item[MIDCOM_TOOLBAR_ENABLED] |
|
673 | 673 | && !is_null($item[MIDCOM_TOOLBAR_ACCESSKEY])) { |
674 | 674 | $attributes['class'] = 'accesskey'; |
675 | 675 | $attributes['accesskey'] = $item[MIDCOM_TOOLBAR_ACCESSKEY]; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | public function get_index_from_url($url) |
736 | 736 | { |
737 | 737 | foreach ($this->items as $i => $item) { |
738 | - if ( $item[MIDCOM_TOOLBAR_URL] == $url |
|
738 | + if ($item[MIDCOM_TOOLBAR_URL] == $url |
|
739 | 739 | || $item[MIDCOM_TOOLBAR__ORIGINAL_URL] == $url) { |
740 | 740 | return $i; |
741 | 741 | } |
@@ -123,7 +123,8 @@ |
||
123 | 123 | try { |
124 | 124 | $object = call_user_func([$options['widget_config']['class'], 'get_cached'], $identifier); |
125 | 125 | $preset[$identifier] = autocomplete_helper::create_item_label($object, $options['widget_config']['result_headers'], $options['widget_config']['get_label_for']); |
126 | - } catch (midcom_error $e) { |
|
126 | + } |
|
127 | + catch (midcom_error $e) { |
|
127 | 128 | $e->log(); |
128 | 129 | } |
129 | 130 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function configureOptions(OptionsResolver $resolver) |
35 | 35 | { |
36 | 36 | $resolver->setDefault('error_bubbling', false); |
37 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
37 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
38 | 38 | $widget_defaults = [ |
39 | 39 | 'creation_mode_enabled' => false, |
40 | 40 | 'class' => null, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | return helper::resolve_options($widget_defaults, $value); |
68 | 68 | }); |
69 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
69 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
70 | 70 | $type_defaults = [ |
71 | 71 | 'options' => [], |
72 | 72 | 'constraints' => [], |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | private function _update_cache() |
145 | 145 | { |
146 | 146 | $this->_merged = $this->_global; |
147 | - if ( !empty($this->_local) |
|
147 | + if (!empty($this->_local) |
|
148 | 148 | && is_array($this->_local)) { |
149 | 149 | $this->_merged = array_merge($this->_merged, $this->_local); |
150 | 150 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function store(array $params, $reset = true) |
187 | 187 | { |
188 | - if ( !$this->_object_stored |
|
188 | + if (!$this->_object_stored |
|
189 | 189 | && $this->_object) { |
190 | 190 | $this->_store_from_object(); |
191 | 191 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function get_all() |
271 | 271 | { |
272 | - if ( !$this->_object_stored |
|
272 | + if (!$this->_object_stored |
|
273 | 273 | && $this->_object) { |
274 | 274 | $this->_store_from_object(); |
275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function exists($key) |
287 | 287 | { |
288 | - if ( !$this->_object_stored |
|
288 | + if (!$this->_object_stored |
|
289 | 289 | && $this->_object) { |
290 | 290 | $this->_store_from_object(); |
291 | 291 | } |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | $resolver->setDefaults([ |
32 | 32 | 'error_bubbling' => false |
33 | 33 | ]); |
34 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
34 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
35 | 35 | $widget_defaults = [ |
36 | 36 | 'map_action_elements' => false, |
37 | 37 | 'show_title' => true |
38 | 38 | ]; |
39 | 39 | return helper::resolve_options($widget_defaults, $value); |
40 | 40 | }); |
41 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
41 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
42 | 42 | $type_defaults = [ |
43 | 43 | 'derived_images' => [], |
44 | 44 | 'filter_chain' => null |
45 | 45 | ]; |
46 | 46 | return helper::resolve_options($type_defaults, $value); |
47 | 47 | }); |
48 | - $resolver->setNormalizer('constraints', function (Options $options, $value) { |
|
48 | + $resolver->setNormalizer('constraints', function(Options $options, $value) { |
|
49 | 49 | if ($options['required']) { |
50 | 50 | return [new constraint()]; |
51 | 51 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | $builder->add('delete', CheckboxType::class, ['attr' => [ |
67 | 67 | "class" => "midcom_datamanager_photo_checkbox" |
68 | - ], "required" => false ]); |
|
68 | + ], "required" => false]); |
|
69 | 69 | $builder->add('identifier', HiddenType::class, ['data' => 'file']); |
70 | 70 | |
71 | 71 | $head = midcom::get()->head; |
@@ -28,7 +28,8 @@ |
||
28 | 28 | foreach ($qb->execute() as $feed) { |
29 | 29 | try { |
30 | 30 | midcom_db_topic::get_cached($feed->node); |
31 | - } catch (midcom_error $e) { |
|
31 | + } |
|
32 | + catch (midcom_error $e) { |
|
32 | 33 | debug_add("Node #{$feed->node} does not exist, skipping feed #{$feed->id}", MIDCOM_LOG_ERROR); |
33 | 34 | continue; |
34 | 35 | } |
@@ -32,7 +32,8 @@ |
||
32 | 32 | foreach ($qb->execute() as $article) { |
33 | 33 | try { |
34 | 34 | $dm->set_storage($article); |
35 | - } catch (midcom_error $e) { |
|
35 | + } |
|
36 | + catch (midcom_error $e) { |
|
36 | 37 | $e->log(MIDCOM_LOG_WARN); |
37 | 38 | continue; |
38 | 39 | } |
@@ -112,7 +112,8 @@ |
||
112 | 112 | foreach ($qb->execute() as $article) { |
113 | 113 | try { |
114 | 114 | $datamanager->set_storage($article); |
115 | - } catch (midcom_error $e) { |
|
115 | + } |
|
116 | + catch (midcom_error $e) { |
|
116 | 117 | $e->log(); |
117 | 118 | continue; |
118 | 119 | } |