@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $this->object = $this->load_object($guid); |
| 48 | 48 | |
| 49 | - if ( !midcom::get()->config->get('midcom_services_rcs_enable') |
|
| 49 | + if (!midcom::get()->config->get('midcom_services_rcs_enable') |
|
| 50 | 50 | || !$this->object->_use_rcs) { |
| 51 | 51 | throw new midcom_error_notfound("Revision control not supported for " . $this->object::class . "."); |
| 52 | 52 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | throw new midcom_error_notfound("Revision {$args[1]} does not exist."); |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - $data['preview'] = array_filter($this->backend->get_revision($revision), function ($value, $key) { |
|
| 260 | + $data['preview'] = array_filter($this->backend->get_revision($revision), function($value, $key) { |
|
| 261 | 261 | return !is_array($value) |
| 262 | 262 | && !in_array($value, ['', '0000-00-00']) |
| 263 | 263 | && midcom_services_rcs::is_field_showable($key); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $this->object->require_do('midgard:update'); |
| 286 | 286 | // TODO: set another privilege for restoring? |
| 287 | 287 | |
| 288 | - if ( $this->backend->get_history()->version_exists($args[1]) |
|
| 288 | + if ($this->backend->get_history()->version_exists($args[1]) |
|
| 289 | 289 | && $this->backend->restore_to_revision($args[1])) { |
| 290 | 290 | midcom::get()->uimessages->add($this->_l10n->get('midcom.admin.rcs'), sprintf($this->_l10n->get('restore to version %s successful'), $args[1])); |
| 291 | 291 | return new midcom_response_relocate($this->get_object_url()); |
@@ -185,10 +185,10 @@ |
||
| 185 | 185 | * |
| 186 | 186 | * @param array $link The necessary link information |
| 187 | 187 | */ |
| 188 | - private function _render_line(array $link, midcom_core_dbaobject &$other_obj) |
|
| 188 | + private function _render_line(array $link, midcom_core_dbaobject & $other_obj) |
|
| 189 | 189 | { |
| 190 | 190 | $this->_request_data['link'] = $link; |
| 191 | - $this->_request_data['other_obj'] =& $other_obj; |
|
| 191 | + $this->_request_data['other_obj'] = & $other_obj; |
|
| 192 | 192 | $this->_request_data['icon'] = midcom_helper_reflector::get_object_icon($other_obj); |
| 193 | 193 | |
| 194 | 194 | if ($other_obj::class != $link['class']) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if ( empty($link->toComponent) |
|
| 55 | + if (empty($link->toComponent) |
|
| 56 | 56 | && !empty($link->fromComponent)) { |
| 57 | 57 | debug_add("Setting property 'toComponent' to '{$component}'"); |
| 58 | 58 | $link->toComponent = $component; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $link->fromComponent = $component; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if ( empty($link->toGuid) |
|
| 64 | + if (empty($link->toGuid) |
|
| 65 | 65 | && !empty($link->fromGuid)) { |
| 66 | 66 | $link->toClass = $obj::class; |
| 67 | 67 | $link->toGuid = $obj->guid; |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | // Get the calendar root event |
| 26 | 26 | if (class_exists('org_openpsa_calendar_interface')) { |
| 27 | - $field =& $schemadb->get('default')->get_field('calendar'); |
|
| 27 | + $field = & $schemadb->get('default')->get_field('calendar'); |
|
| 28 | 28 | $field['type_config']['privilege_object'] = org_openpsa_calendar_interface::find_root_event(); |
| 29 | 29 | $field['type_config']['assignee'] = 'user:' . $person->guid; |
| 30 | 30 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | // Get the calendar root event |
| 26 | 26 | if (class_exists('org_openpsa_calendar_interface')) { |
| 27 | - $field =& $schemadb->get('default')->get_field('calendar'); |
|
| 27 | + $field = & $schemadb->get('default')->get_field('calendar'); |
|
| 28 | 28 | $field['type_config']['privilege_object'] = org_openpsa_calendar_interface::find_root_event(); |
| 29 | 29 | $field['type_config']['assignee'] = 'group:' . $group->guid; |
| 30 | 30 | } |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | $year_data = []; |
| 106 | 106 | $first_post = $this->_compute_welcome_first_post(); |
| 107 | 107 | $this->_request_data['first_post'] = $first_post; |
| 108 | - $this->_request_data['total_count'] =& $total_count; |
|
| 109 | - $this->_request_data['year_data'] =& $year_data; |
|
| 108 | + $this->_request_data['total_count'] = & $total_count; |
|
| 109 | + $this->_request_data['year_data'] = & $year_data; |
|
| 110 | 110 | if (!$first_post) { |
| 111 | 111 | return; |
| 112 | 112 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | if ($category) { |
| 243 | 243 | $category = trim(strip_tags($category)); |
| 244 | - if ( $data['datamanager']->get_schema('default')->has_field('categories') |
|
| 244 | + if ($data['datamanager']->get_schema('default')->has_field('categories') |
|
| 245 | 245 | && !$data['datamanager']->get_schema('default')->get_field('categories')['type_config']['allow_multiple']) { |
| 246 | 246 | $qb->add_constraint('extra1', '=', $category); |
| 247 | 247 | } else { |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | private function _set_startend_from_month(int $year, int $month) |
| 308 | 308 | { |
| 309 | - if ( $month < 1 |
|
| 309 | + if ($month < 1 |
|
| 310 | 310 | || $month > 12) { |
| 311 | 311 | throw new midcom_error_notfound("The month {$month} is not valid."); |
| 312 | 312 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $this->language = $language; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function number(int|float $value, int $precision = 2) |
|
| 26 | + public function number(int | float $value, int $precision = 2) |
|
| 27 | 27 | { |
| 28 | 28 | // The fallback implementation in Intl only supports DECIMAL, so we hardcode the style here.. |
| 29 | 29 | $formatter = new NumberFormatter($this->get_locale(), NumberFormatter::DECIMAL); |
@@ -31,24 +31,24 @@ discard block |
||
| 31 | 31 | return $formatter->format($value); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function date(int|string|null|DateTimeInterface $value = null, int|string $dateformat = 'medium') |
|
| 34 | + public function date(int | string | null | DateTimeInterface $value = null, int | string $dateformat = 'medium') |
|
| 35 | 35 | { |
| 36 | 36 | return $this->datetime($value, $dateformat, IntlDateFormatter::NONE); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function time(int|string|null|DateTimeInterface $value = null, int|string $timeformat = 'short') |
|
| 39 | + public function time(int | string | null | DateTimeInterface $value = null, int | string $timeformat = 'short') |
|
| 40 | 40 | { |
| 41 | 41 | return $this->datetime($value, IntlDateFormatter::NONE, $timeformat); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function datetime(int|string|null|DateTimeInterface $value = null, int|string $dateformat = 'medium', int|string $timeformat = 'short') |
|
| 44 | + public function datetime(int | string | null | DateTimeInterface $value = null, int | string $dateformat = 'medium', int | string $timeformat = 'short') |
|
| 45 | 45 | { |
| 46 | 46 | $value ??= time(); |
| 47 | 47 | $formatter = new IntlDateFormatter($this->get_locale(), $this->constant($dateformat), $this->constant($timeformat)); |
| 48 | 48 | return $formatter->format($value); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function customdate(int|string|DateTimeInterface $value, string $pattern) |
|
| 51 | + public function customdate(int | string | DateTimeInterface $value, string $pattern) |
|
| 52 | 52 | { |
| 53 | 53 | $formatter = new IntlDateFormatter($this->get_locale(), IntlDateFormatter::FULL, IntlDateFormatter::FULL); |
| 54 | 54 | $formatter->setPattern($pattern); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return $ranger->format($start, $end); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - private function constant(int|string $input) : int |
|
| 73 | + private function constant(int | string $input) : int |
|
| 74 | 74 | { |
| 75 | 75 | if (is_int($input)) { |
| 76 | 76 | return $input; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * The Default constructor creates an empty privilege, if you specify |
| 76 | 76 | * another privilege object in the constructor, a copy is constructed. |
| 77 | 77 | */ |
| 78 | - public function __construct(midcom_core_privilege_db|array|string|null $src = null) |
|
| 78 | + public function __construct(midcom_core_privilege_db | array | string | null $src = null) |
|
| 79 | 79 | { |
| 80 | 80 | if (is_array($src)) { |
| 81 | 81 | // Store given values to our privilege array |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * - Any midcom_core_user or midcom_core_group object or subtype thereof. |
| 211 | 211 | * - Any string identifier which can be resolved using midcom_services_auth::get_assignee(). |
| 212 | 212 | */ |
| 213 | - public function set_assignee(midcom_core_group|midcom_core_user|string $assignee) : bool |
|
| 213 | + public function set_assignee(midcom_core_group | midcom_core_user | string $assignee) : bool |
|
| 214 | 214 | { |
| 215 | 215 | if (is_string($assignee)) { |
| 216 | 216 | if ($this->is_magic_assignee($assignee)) { |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - if ( !$this->is_magic_assignee() |
|
| 269 | + if (!$this->is_magic_assignee() |
|
| 270 | 270 | && !$this->get_assignee()) { |
| 271 | 271 | debug_add("The assignee identifier '{$this->assignee}' is invalid.", MIDCOM_LOG_INFO); |
| 272 | 272 | return false; |
| 273 | 273 | } |
| 274 | - if ( $this->assignee == 'OWNER' |
|
| 274 | + if ($this->assignee == 'OWNER' |
|
| 275 | 275 | && $this->privilegename == 'midgard:owner') { |
| 276 | 276 | debug_add("Tried to assign midgard:owner to the OWNER magic assignee, this is invalid.", MIDCOM_LOG_INFO); |
| 277 | 277 | return false; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | MIDCOM_LOG_INFO); |
| 284 | 284 | return false; |
| 285 | 285 | } |
| 286 | - if ( !$object->can_do('midgard:update') |
|
| 286 | + if (!$object->can_do('midgard:update') |
|
| 287 | 287 | || !$object->can_do('midgard:privileges')) { |
| 288 | 288 | debug_add("Insufficient privileges on the content object with the GUID '{$this->__guid}', midgard:update and midgard:privileges required.", |
| 289 | 289 | MIDCOM_LOG_INFO); |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | return new midcom_core_privilege($result[0]); |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - private function _load(midcom_core_privilege_db|string|null $src = null) |
|
| 447 | + private function _load(midcom_core_privilege_db | string | null $src = null) |
|
| 448 | 448 | { |
| 449 | 449 | if ($src instanceof midcom_core_privilege_db) { |
| 450 | 450 | // Got a privilege object as argument, use that |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | $this->_uncached = $config->get('cache_module_content_uncached'); |
| 143 | 143 | $this->_headers_strategy = $this->get_strategy('cache_module_content_headers_strategy'); |
| 144 | 144 | $this->_headers_strategy_authenticated = $this->get_strategy('cache_module_content_headers_strategy_authenticated'); |
| 145 | - $this->_default_lifetime = (int)$config->get('cache_module_content_default_lifetime'); |
|
| 146 | - $this->_default_lifetime_authenticated = (int)$config->get('cache_module_content_default_lifetime_authenticated'); |
|
| 145 | + $this->_default_lifetime = (int) $config->get('cache_module_content_default_lifetime'); |
|
| 146 | + $this->_default_lifetime_authenticated = (int) $config->get('cache_module_content_default_lifetime_authenticated'); |
|
| 147 | 147 | |
| 148 | 148 | if ($this->_headers_strategy == 'no-cache') { |
| 149 | 149 | // we can't call no_cache() here, because it would try to call back to this class via the global getter |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | */ |
| 509 | 509 | private function write_meta_cache(string $content_id, Request $request, Response $response) |
| 510 | 510 | { |
| 511 | - if ( $this->_uncached |
|
| 511 | + if ($this->_uncached |
|
| 512 | 512 | || $this->_no_cache) { |
| 513 | 513 | return; |
| 514 | 514 | } |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | |
| 574 | 574 | private function store_dl_content(Request $request, Response $response) |
| 575 | 575 | { |
| 576 | - if ( $this->_no_cache |
|
| 576 | + if ($this->_no_cache |
|
| 577 | 577 | || $this->_uncached) { |
| 578 | 578 | return; |
| 579 | 579 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | |
| 616 | 616 | /* TODO: Doublecheck the way this is handled, now we just don't send it |
| 617 | 617 | * if headers_strategy implies caching */ |
| 618 | - if ( !$response->headers->has('Content-Length') |
|
| 618 | + if (!$response->headers->has('Content-Length') |
|
| 619 | 619 | && !in_array($this->_headers_strategy, ['public', 'private'])) { |
| 620 | 620 | $response->headers->set("Content-Length", strlen($response->getContent())); |
| 621 | 621 | } |