@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $this->_add_visibility_checks(); |
| 107 | 107 | |
| 108 | - if ( empty($this->_limit) |
|
| 108 | + if (empty($this->_limit) |
|
| 109 | 109 | && empty($this->_offset)) { |
| 110 | 110 | // No point to do windowing |
| 111 | 111 | $newresult = $this->_execute_and_check_privileges(); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | $this->_query->set_limit($window_size); |
| 152 | 152 | |
| 153 | - while ( ($resultset = $this->_execute_and_check_privileges()) |
|
| 153 | + while (($resultset = $this->_execute_and_check_privileges()) |
|
| 154 | 154 | || $this->denied > $denied) { |
| 155 | 155 | $size = count($resultset); |
| 156 | 156 | $total_size = $size + ($this->denied - $denied); |
@@ -57,7 +57,8 @@ |
||
| 57 | 57 | $classname = $this->_real_class; |
| 58 | 58 | try { |
| 59 | 59 | $result[] = new $classname($object); |
| 60 | - } catch (midcom_error $e) { |
|
| 60 | + } |
|
| 61 | + catch (midcom_error $e) { |
|
| 61 | 62 | if ($e->getCode() == MIDCOM_ERRFORBIDDEN) { |
| 62 | 63 | $this->denied++; |
| 63 | 64 | } |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function get_effective_value(array $options, $object = null) |
| 67 | 67 | { |
| 68 | - if (!$object) |
|
| 69 | - { |
|
| 68 | + if (!$object) { |
|
| 70 | 69 | $defaults = midcom::get()->auth->acl->get_default_privileges(); |
| 71 | 70 | return $defaults[$options['privilege_name']] === MIDCOM_PRIVILEGE_ALLOW; |
| 72 | 71 | } |
@@ -99,8 +98,7 @@ discard block |
||
| 99 | 98 | |
| 100 | 99 | public function search_for_object($object) |
| 101 | 100 | { |
| 102 | - while (true) |
|
| 103 | - { |
|
| 101 | + while (true) { |
|
| 104 | 102 | if ($object instanceof dbacontainer) { |
| 105 | 103 | return $object->get_value(); |
| 106 | 104 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function configureOptions(OptionsResolver $resolver) |
| 34 | 34 | { |
| 35 | - $map_privilege = function (Options $options) { |
|
| 35 | + $map_privilege = function(Options $options) { |
|
| 36 | 36 | $return_options = $this->defaultChoices; |
| 37 | 37 | return $return_options; |
| 38 | 38 | }; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | 'expanded' => true, |
| 43 | 43 | ]); |
| 44 | 44 | |
| 45 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
| 45 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
| 46 | 46 | $type_defaults = [ |
| 47 | 47 | 'classname' => '', |
| 48 | 48 | 'assignee' => null, |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | if (is_null($name_property)) { |
| 37 | 37 | $name_property = midcom_helper_reflector::get_name_property($this->_object); |
| 38 | 38 | } |
| 39 | - if ( empty($name_property) |
|
| 39 | + if (empty($name_property) |
|
| 40 | 40 | || !midcom_helper_reflector::get($this->_object)->property_exists($name_property)) { |
| 41 | 41 | // Could not resolve valid property |
| 42 | 42 | return false; |
| 43 | 43 | } |
| 44 | 44 | // Make copy via typecast, very important or we might accidentally manipulate the given object |
| 45 | - return (string)$this->_object->{$name_property}; |
|
| 45 | + return (string) $this->_object->{$name_property}; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | public function name_is_unique_or_empty() |
| 130 | 130 | { |
| 131 | 131 | $name_copy = $this->get_object_name(); |
| 132 | - if ( empty($name_copy) |
|
| 132 | + if (empty($name_copy) |
|
| 133 | 133 | && $name_copy !== false) { |
| 134 | 134 | // Allow empty string name |
| 135 | 135 | return true; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | $qb->add_constraint($child_name_property, '=', $name_copy); |
| 212 | 212 | if ($qb->count()) { |
| 213 | - debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" ); |
|
| 213 | + debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')"); |
|
| 214 | 214 | return false; |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $qb->add_constraint($child_name_property, '=', $name_copy); |
| 243 | 243 | if ($qb->count()) { |
| 244 | - debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" ); |
|
| 244 | + debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')"); |
|
| 245 | 245 | return false; |
| 246 | 246 | } |
| 247 | 247 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $name_prop = midcom_helper_reflector::get_name_property($this->_object); |
| 275 | 275 | |
| 276 | 276 | if (!empty($original_name)) { |
| 277 | - $current_name = (string)$original_name; |
|
| 277 | + $current_name = (string) $original_name; |
|
| 278 | 278 | } else { |
| 279 | 279 | // Empty name, try to generate from title |
| 280 | 280 | $title_copy = midcom_helper_reflector::get_object_title($this->_object, $title_property); |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | } while (!$this->name_is_unique()); |
| 320 | 320 | |
| 321 | 321 | // Get a copy of the current, usable name |
| 322 | - $ret = (string)$this->_object->{$name_prop}; |
|
| 322 | + $ret = (string) $this->_object->{$name_prop}; |
|
| 323 | 323 | // Restore the original name |
| 324 | 324 | $this->_object->{$name_prop} = $original_name; |
| 325 | 325 | return $ret; |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | $label_prop = $this->get_label_property(); |
| 433 | 433 | |
| 434 | - if ( is_string($label_prop) |
|
| 434 | + if (is_string($label_prop) |
|
| 435 | 435 | && $label_prop != 'guid' |
| 436 | 436 | && $this->_mgd_reflector->property_exists($label_prop)) { |
| 437 | 437 | $search_properties[$label_prop] = true; |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | continue; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if ( !$ref->is_link($property) |
|
| 495 | + if (!$ref->is_link($property) |
|
| 496 | 496 | && $ref->get_midgard_type($property) != MGD_TYPE_GUID) { |
| 497 | 497 | continue; |
| 498 | 498 | } |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | return $schema_type; |
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | - if ( isset($extends[$schema_type]) |
|
| 559 | + if (isset($extends[$schema_type]) |
|
| 560 | 560 | && class_exists($extends[$schema_type])) { |
| 561 | 561 | return $extends[$schema_type]; |
| 562 | 562 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | { |
| 577 | 577 | $one = self::resolve_baseclass($class_one); |
| 578 | 578 | $two = self::resolve_baseclass($class_two); |
| 579 | - return ( $one == $two |
|
| 579 | + return ($one == $two |
|
| 580 | 580 | || self::class_rewrite($one) == $two |
| 581 | 581 | || $one == self::class_rewrite($two)); |
| 582 | 582 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | // Check for decorators first |
| 636 | 636 | if (!empty($class_instance->__mgdschema_class_name__)) { |
| 637 | 637 | $parent_class = $class_instance->__mgdschema_class_name__; |
| 638 | - if ( !empty($class_instance->__object) |
|
| 638 | + if (!empty($class_instance->__object) |
|
| 639 | 639 | && !$class_instance->__object instanceof $class_instance->__mgdschema_class_name__) { |
| 640 | 640 | $parent_class = get_class($class_instance->__object); |
| 641 | 641 | debug_add('mgdschema object class ' . $parent_class . ' is not an instance of ' . $class_instance->__mgdschema_class_name__, MIDCOM_LOG_INFO); |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | $name_exceptions = $this->_config->get('name_exceptions'); |
| 671 | 671 | foreach ($name_exceptions as $class => $property) { |
| 672 | 672 | if (midcom::get()->dbfactory->is_a($object, $class)) { |
| 673 | - if ( $property !== false |
|
| 673 | + if ($property !== false |
|
| 674 | 674 | && !$this->_mgd_reflector->property_exists($property)) { |
| 675 | 675 | debug_add("Matched class '{$key}' to '{$class}' via is_a but property '{$property}' does not exist", MIDCOM_LOG_ERROR); |
| 676 | 676 | self::$_cache['name'][$key] = false; |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | if (is_null($title_property)) { |
| 727 | 727 | $title_property = self::get_title_property($object); |
| 728 | 728 | } |
| 729 | - if ( empty($title_property) |
|
| 729 | + if (empty($title_property) |
|
| 730 | 730 | || !self::get($object)->property_exists($title_property)) { |
| 731 | 731 | // Could not resolve valid property |
| 732 | 732 | return false; |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | foreach ($title_exceptions as $class => $property) { |
| 775 | 775 | if (midcom::get()->dbfactory->is_a($object, $class)) { |
| 776 | - if ( $property !== false |
|
| 776 | + if ($property !== false |
|
| 777 | 777 | && !$this->_mgd_reflector->property_exists($property)) { |
| 778 | 778 | debug_add("Matched class '{$key}' to '{$class}' via is_a but property '{$property}' does not exist", MIDCOM_LOG_ERROR); |
| 779 | 779 | self::$_cache['title'][$key] = false; |
@@ -239,7 +239,8 @@ discard block |
||
| 239 | 239 | // Not a MidCOM DBA object |
| 240 | 240 | try { |
| 241 | 241 | $obj = midcom::get()->dbfactory->convert_midgard_to_midcom($object); |
| 242 | - } catch (midcom_error $e) { |
|
| 242 | + } |
|
| 243 | + catch (midcom_error $e) { |
|
| 243 | 244 | return false; |
| 244 | 245 | } |
| 245 | 246 | } else { |
@@ -702,7 +703,8 @@ discard block |
||
| 702 | 703 | if (!isset(self::$_cache['name'][$key])) { |
| 703 | 704 | try { |
| 704 | 705 | self::$_cache['name'][$key] = self::get($object)->get_name_property_nonstatic($object); |
| 705 | - } catch (midcom_error $e) { |
|
| 706 | + } |
|
| 707 | + catch (midcom_error $e) { |
|
| 706 | 708 | debug_add('Could not get reflector instance for class ' . $key . ': ' . $e->getMessage(), MIDCOM_LOG_ERROR); |
| 707 | 709 | self::$_cache['name'][$key] = null; |
| 708 | 710 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | public function number($value, $precision = 2) |
| 31 | 31 | { |
| 32 | - if ( is_float($value) |
|
| 32 | + if (is_float($value) |
|
| 33 | 33 | && version_compare(Intl::getIcuVersion(), '49', '<')) { |
| 34 | 34 | // workaround for http://bugs.icu-project.org/trac/ticket/8561 |
| 35 | 35 | if ($precision == 0) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | that is populated only once, and even then only the |
| 130 | 130 | first time we encounter a namespaced wikilink */ |
| 131 | 131 | static $folder_tree = []; |
| 132 | - if ( count($folder_tree) == 0 |
|
| 132 | + if (count($folder_tree) == 0 |
|
| 133 | 133 | || $force_resolve_folder_tree) { |
| 134 | 134 | $folder_tree = $this->_resolve_folder_tree($force_as_root); |
| 135 | 135 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $localpath = $path; |
| 160 | 160 | $matches['latest_parent'] = $folder_tree['/']; |
| 161 | 161 | $missing_levels = 0; |
| 162 | - while ( $localpath |
|
| 162 | + while ($localpath |
|
| 163 | 163 | && $localpath != '/') { |
| 164 | 164 | $localpath = dirname($localpath); |
| 165 | 165 | $missing_levels++; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | $root_folder = $folder; |
| 188 | 188 | $max = 100; |
| 189 | - while ( $folder[MIDCOM_NAV_COMPONENT] == 'net.nemein.wiki' |
|
| 189 | + while ($folder[MIDCOM_NAV_COMPONENT] == 'net.nemein.wiki' |
|
| 190 | 190 | && (($parent = $nap->get_node_uplink($folder[MIDCOM_NAV_ID])) != -1) |
| 191 | 191 | && $max > 0) { |
| 192 | 192 | $root_folder = $folder; |
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | { |
| 26 | 26 | try { |
| 27 | 27 | $viewer->register_plugin_namespace('__feeds', ['rss' => ['class' => __CLASS__]]); |
| 28 | - } catch (midcom_error $e) { |
|
| 28 | + } |
|
| 29 | + catch (midcom_error $e) { |
|
| 29 | 30 | $e->log(); |
| 30 | 31 | } |
| 31 | 32 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Hide the articles that have the publish time in the future and if |
| 43 | 43 | // the user is not administrator |
| 44 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
| 44 | + if ($this->_config->get('enable_scheduled_publishing') |
|
| 45 | 45 | && !midcom::get()->auth->admin) { |
| 46 | 46 | // Show the article only if the publishing time has passed or the viewer |
| 47 | 47 | // is the author |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | private function _add_pseudo_leaves(array &$leaves) |
| 85 | 85 | { |
| 86 | - if ( $this->_config->get('archive_enable') |
|
| 86 | + if ($this->_config->get('archive_enable') |
|
| 87 | 87 | && $this->_config->get('archive_in_navigation')) { |
| 88 | 88 | $leaves["{$this->_topic->id}_ARCHIVE"] = [ |
| 89 | 89 | MIDCOM_NAV_URL => "archive/", |
| 90 | 90 | MIDCOM_NAV_NAME => $this->_l10n->get('archive'), |
| 91 | 91 | ]; |
| 92 | 92 | } |
| 93 | - if ( $this->_config->get('rss_enable') |
|
| 93 | + if ($this->_config->get('rss_enable') |
|
| 94 | 94 | && $this->_config->get('feeds_in_navigation')) { |
| 95 | 95 | $leaves[self::LEAFID_FEEDS] = [ |
| 96 | 96 | MIDCOM_NAV_URL => "feeds/", |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ]; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( $this->_config->get('categories_in_navigation') |
|
| 101 | + if ($this->_config->get('categories_in_navigation') |
|
| 102 | 102 | && $this->_config->get('categories') != '') { |
| 103 | 103 | $categories = explode(',', $this->_config->get('categories')); |
| 104 | 104 | foreach ($categories as $category) { |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if ( $this->_config->get('archive_years_in_navigation') |
|
| 112 | + if ($this->_config->get('archive_years_in_navigation') |
|
| 113 | 113 | && $this->_config->get('archive_years_enable')) { |
| 114 | 114 | $qb = midcom_db_article::new_query_builder(); |
| 115 | 115 | $qb->add_constraint('topic', '=', $this->_topic->id); |
| 116 | 116 | |
| 117 | 117 | // Hide the articles that have the publish time in the future and if |
| 118 | 118 | // the user is not administrator |
| 119 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
| 119 | + if ($this->_config->get('enable_scheduled_publishing') |
|
| 120 | 120 | && !midcom::get()->auth->admin) { |
| 121 | 121 | // Show the article only if the publishing time has passed or the viewer |
| 122 | 122 | // is the author |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( $this->_topic->can_do('midgard:update') |
|
| 76 | + if ($this->_topic->can_do('midgard:update') |
|
| 77 | 77 | && $this->_topic->can_do('midcom:component_config')) { |
| 78 | 78 | $buttons[] = $workflow->get_button('config/', [ |
| 79 | 79 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |