@@ -37,7 +37,7 @@ |
||
| 37 | 37 | { |
| 38 | 38 | return preg_replace_callback( |
| 39 | 39 | "%(<\s*)+(/\s*)+{$element}%i", |
| 40 | - function ($matches) { |
|
| 40 | + function($matches) { |
|
| 41 | 41 | return htmlentities($matches[0]); |
| 42 | 42 | }, |
| 43 | 43 | $input |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if ($uplink == $root_id) { |
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | - if ( $uplink == false |
|
| 225 | + if ($uplink == false |
|
| 226 | 226 | || $uplink == -1) { |
| 227 | 227 | return false; |
| 228 | 228 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $entry = "<span class=\"{$current_class}\">{$entry}</span>"; |
| 447 | 447 | } |
| 448 | 448 | } else { |
| 449 | - if ( !empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
| 449 | + if (!empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
| 450 | 450 | && in_array($data['napobject'][MIDCOM_NAV_GUID], $skip_guids)) { |
| 451 | 451 | continue; |
| 452 | 452 | } |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $id = "custom-{$key}"; |
| 570 | 570 | |
| 571 | 571 | $url = "{$prefix}{$entry[MIDCOM_NAV_URL]}"; |
| 572 | - if ( substr($entry[MIDCOM_NAV_URL], 0, 1) == '/' |
|
| 572 | + if (substr($entry[MIDCOM_NAV_URL], 0, 1) == '/' |
|
| 573 | 573 | || preg_match('|^https?://|', $entry[MIDCOM_NAV_URL])) { |
| 574 | 574 | $url = $entry[MIDCOM_NAV_URL]; |
| 575 | 575 | } |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | $variable = $parts[0] . '->' . $parts[1]; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if ( isset($variable_parts[1]) |
|
| 87 | + if (isset($variable_parts[1]) |
|
| 88 | 88 | && array_key_exists($variable_parts[1], self::$_filters)) { |
| 89 | 89 | switch ($variable_parts[1]) { |
| 90 | 90 | case 's': |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | $http_client = new org_openpsa_httplib(); |
| 57 | 57 | $http_client->set_param('timeout', 300); |
| 58 | -if ( !empty($_SERVER['PHP_AUTH_USER']) |
|
| 58 | +if (!empty($_SERVER['PHP_AUTH_USER']) |
|
| 59 | 59 | && !empty($_SERVER['PHP_AUTH_PW'])) { |
| 60 | 60 | $http_client->basicauth['user'] = $_SERVER['PHP_AUTH_USER']; |
| 61 | 61 | $http_client->basicauth['password'] = $_SERVER['PHP_AUTH_PW']; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | { |
| 464 | 464 | // Complete fields |
| 465 | 465 | $this->indexed = time(); |
| 466 | - if ( $this->author == '' |
|
| 466 | + if ($this->author == '' |
|
| 467 | 467 | && isset($this->creator->name)) { |
| 468 | 468 | $this->author = $this->creator->name; |
| 469 | 469 | } |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | public function read_metadata_from_object($object) |
| 607 | 607 | { |
| 608 | 608 | // Published is set to non-empty value, use it as creation data |
| 609 | - if ( !empty($object->metadata->published) |
|
| 609 | + if (!empty($object->metadata->published) |
|
| 610 | 610 | && !preg_match('/0{1,4}-0{1,2}0{1,2}\s+0{1,2}:0{1,2}:0{1,2}/', $object->metadata->published)) { |
| 611 | 611 | $this->created = $this->read_unixtime($object->metadata->published); |
| 612 | 612 | } elseif (isset($object->metadata->created)) { |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | return @strtotime($stamp); |
| 646 | 646 | } |
| 647 | 647 | // Unix timestamp |
| 648 | - return (int)$stamp; |
|
| 648 | + return (int) $stamp; |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
@@ -101,7 +101,7 @@ discard block |
||
| 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); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $guid = $item->get_id(); |
| 188 | 188 | $title = $item->get_title(); |
| 189 | 189 | |
| 190 | - if ( ( empty($title) |
|
| 190 | + if ((empty($title) |
|
| 191 | 191 | || trim($title) == '...') |
| 192 | 192 | && empty($guid)) { |
| 193 | 193 | // Something wrong with this entry, skip it |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $meta_values['published'] = $article_date; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if ( $this->apply_values($article, $values, $meta_values) |
|
| 258 | + if ($this->apply_values($article, $values, $meta_values) |
|
| 259 | 259 | && !$article->update()) { |
| 260 | 260 | return false; |
| 261 | 261 | } |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | private function find_author(net_nemein_rss_parser_item $item) |
| 285 | 285 | { |
| 286 | 286 | // Try to figure out item author |
| 287 | - if ( $this->_feed->forceauthor |
|
| 287 | + if ($this->_feed->forceauthor |
|
| 288 | 288 | && $this->_feed->defaultauthor) { |
| 289 | 289 | // Feed has a "default author" set, use it |
| 290 | 290 | return new midcom_db_person($this->_feed->defaultauthor); |
| 291 | 291 | } |
| 292 | 292 | $author = $this->match_item_author($item); |
| 293 | 293 | $fallback_person_id = 1; |
| 294 | - if ( !$author |
|
| 294 | + if (!$author |
|
| 295 | 295 | || $author->id == $fallback_person_id) { |
| 296 | 296 | if ($this->_feed->defaultauthor) { |
| 297 | 297 | // Feed has a "default author" set, use it |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - if ( !empty($author_info['username']) |
|
| 480 | + if (!empty($author_info['username']) |
|
| 481 | 481 | && $person = midcom::get()->auth->get_user_by_name($author_info['username'])) { |
| 482 | 482 | return $person->get_storage(); |
| 483 | 483 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $qb->add_constraint('name', '<>', ''); |
| 47 | 47 | |
| 48 | 48 | // Unless in Auto-Index mode or the index article is hidden, we skip the index article. |
| 49 | - if ( !$this->_config->get('autoindex') |
|
| 49 | + if (!$this->_config->get('autoindex') |
|
| 50 | 50 | && !$this->_config->get('indexinnav')) { |
| 51 | 51 | $qb->add_constraint('name', '<>', 'index'); |
| 52 | 52 | } |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | $qb = midcom::get()->dbfactory->new_query_builder($this->config['type_config']['mapping_class_name']); |
| 100 | 100 | $qb->add_constraint($this->config['type_config']['master_fieldname'], '=', $this->get_master_foreign_key()); |
| 101 | 101 | |
| 102 | - if ( $this->config['type_config']['sortable'] |
|
| 102 | + if ($this->config['type_config']['sortable'] |
|
| 103 | 103 | && preg_match('/^(ASC|DESC)/i', $this->config['type_config']['sortable_sort_order'], $regs)) { |
| 104 | 104 | $order = strtoupper($regs[1]); |
| 105 | 105 | $qb->add_order('metadata.score', $order); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $this->content .= "{$this->abstract}\n"; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if (! $this->title) { |
|
| 140 | + if (!$this->title) { |
|
| 141 | 141 | $this->title = $this->document_url; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | if (!empty($field->vars['value'])) { |
| 179 | 179 | //only index the first attachment for now |
| 180 | 180 | $attachment = array_shift($field->vars['value']); |
| 181 | - if ( !$attachment instanceof \midcom_db_attachment |
|
| 181 | + if (!$attachment instanceof \midcom_db_attachment |
|
| 182 | 182 | && !empty($attachment['object'])) { |
| 183 | 183 | //This is the form edit case |
| 184 | 184 | //@todo: In create case, nothing is found currently |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | private function resolve_auto_method($name) |
| 264 | 264 | { |
| 265 | - if ( $name == 'abstract' |
|
| 265 | + if ($name == 'abstract' |
|
| 266 | 266 | || $name == 'title' |
| 267 | 267 | || $name == 'author') { |
| 268 | 268 | return $name; |