@@ -87,7 +87,7 @@ |
||
87 | 87 | */ |
88 | 88 | public function _on_validate() |
89 | 89 | { |
90 | - if ( is_array($this->value) |
|
90 | + if (is_array($this->value) |
|
91 | 91 | || is_object($this->value)) { |
92 | 92 | $this->validation_error = $this->_l10n->get('type text: value may not be array or object'); |
93 | 93 | return false; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $this->purify_markdown_on_output = $this->_config->get('html_purify_markdown'); |
147 | 147 | } |
148 | 148 | |
149 | - if ( !empty($this->forbidden_patterns) |
|
149 | + if (!empty($this->forbidden_patterns) |
|
150 | 150 | && !empty($this->allowed_patterns)) { |
151 | 151 | debug_add('Both allowed and forbidden patterns are set, allowed has precedence', MIDCOM_LOG_ERROR); |
152 | 152 | $this->forbidden_patterns = null; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | function purify_string($content) |
162 | 162 | { |
163 | - if ( isset($this->purify_config['Cache']['SerializerPath']) |
|
163 | + if (isset($this->purify_config['Cache']['SerializerPath']) |
|
164 | 164 | && !file_exists($this->purify_config['Cache']['SerializerPath'])) { |
165 | 165 | mkdir($this->purify_config['Cache']['SerializerPath']); |
166 | 166 | } |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | |
185 | 185 | // Load custom element/attribute definitions |
186 | 186 | $config_defs = $this->_config->get('html_purify_HTMLDefinition'); |
187 | - if ( is_array($config_defs) |
|
187 | + if (is_array($config_defs) |
|
188 | 188 | && !empty($config_defs) |
189 | 189 | && $def = $purifier_config_object->maybeGetRawHTMLDefinition(true)) { |
190 | - if ( !empty($config_defs['addAttribute']) |
|
190 | + if (!empty($config_defs['addAttribute']) |
|
191 | 191 | && is_array($config_defs['addAttribute'])) { |
192 | 192 | foreach (array_filter($config_defs['addAttribute'], 'is_array') as $attrdef) { |
193 | 193 | call_user_func_array(array($def, 'addAttribute'), $attrdef); |
194 | 194 | } |
195 | 195 | } |
196 | - if ( !empty($config_defs['addElement']) |
|
196 | + if (!empty($config_defs['addElement']) |
|
197 | 197 | && is_array($config_defs['addElement'])) { |
198 | 198 | foreach (array_filter($config_defs['addElement'], 'is_array') as $elemdef) { |
199 | 199 | call_user_func_array(array($def, 'addElement'), $elemdef); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function _on_validate() |
249 | 249 | { |
250 | - if ( is_array($this->value) |
|
250 | + if (is_array($this->value) |
|
251 | 251 | || is_object($this->value)) { |
252 | 252 | $this->validation_error = $this->_l10n->get('type text: value may not be array or object'); |
253 | 253 | return false; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $this->purify_content(); |
260 | 260 | } |
261 | 261 | |
262 | - if ( $this->maxlength > 0 |
|
262 | + if ($this->maxlength > 0 |
|
263 | 263 | && strlen($this->value) > $this->maxlength) { |
264 | 264 | $this->validation_error = sprintf($this->_l10n->get('type text: value is longer than %d characters'), |
265 | 265 | $this->maxlength); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | public function validate_allowed_patterns($fields) |
285 | 285 | { |
286 | - if ( !empty($this->allowed_patterns) |
|
286 | + if (!empty($this->allowed_patterns) |
|
287 | 287 | && is_array($this->allowed_patterns)) { |
288 | 288 | foreach ($this->allowed_patterns as $condition) { |
289 | 289 | if (!isset($condition['explanation'])) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | return midcom_helper_formatter::format($this->value, 'F'); |
366 | 366 | |
367 | 367 | case 'markdown': |
368 | - if ( !$this->purify |
|
368 | + if (!$this->purify |
|
369 | 369 | || !$this->purify_markdown_on_output) { |
370 | 370 | // Return the Markdown straight away |
371 | 371 | return MarkdownExtra::defaultTransform($this->value); |
@@ -66,7 +66,7 @@ |
||
66 | 66 | */ |
67 | 67 | public function _on_initialize() |
68 | 68 | { |
69 | - if ( !$this->name |
|
69 | + if (!$this->name |
|
70 | 70 | || !$this->assignee) { |
71 | 71 | throw new midcom_error("The field {$this->name} had no name or assignee specified with it, cannot start up."); |
72 | 72 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | continue; |
306 | 306 | } |
307 | 307 | $images_identifier = $info[0]; |
308 | - if ( !empty($this->attachments_info[$blobs_identifier]['object']) |
|
308 | + if (!empty($this->attachments_info[$blobs_identifier]['object']) |
|
309 | 309 | && is_object($this->attachments_info[$blobs_identifier]['object'])) { |
310 | 310 | $this->titles[$images_identifier] = $this->attachments_info[$blobs_identifier]['object']->title; |
311 | 311 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | } |
364 | 364 | if (empty($main['object']->guid)) { |
365 | 365 | //Panic, broken identifier |
366 | - debug_add("Identifier '{$identifier}' does not have a valid object behind it", MIDCOM_LOG_ERROR); |
|
366 | + debug_add("Identifier '{$identifier}' does not have a valid object behind it", MIDCOM_LOG_ERROR); |
|
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | debug_print_r('$this->attachments_info', $this->attachments_info); |
466 | 466 | return; |
467 | 467 | } |
468 | - $info =& $this->attachments_info[$identifier]; |
|
468 | + $info = & $this->attachments_info[$identifier]; |
|
469 | 469 | $this->_info_heuristics($info, $identifier); |
470 | 470 | $attachment->set_parameter('midcom.helper.datamanager2.type.images', 'images_identifier', $info['images_identifier']); |
471 | 471 | // This would be the name of the 'derived_images' key. |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | $this->attachments_info[$identifier]['images_identifier'] = $images_identifier; |
509 | 509 | $this->attachments_info[$identifier]['images_name'] = $images_name; |
510 | - $this->images[$images_identifier][$images_name] =& $this->attachments_info[$identifier]; |
|
510 | + $this->images[$images_identifier][$images_name] = & $this->attachments_info[$identifier]; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -533,16 +533,16 @@ discard block |
||
533 | 533 | protected function _sort_images_callback($a, $b) |
534 | 534 | { |
535 | 535 | // safety against broken images |
536 | - if ( !empty($a['main']['object']) |
|
536 | + if (!empty($a['main']['object']) |
|
537 | 537 | && !empty($b['main']['object'])) { |
538 | 538 | $a_obj = $a['main']['object']; |
539 | 539 | $b_obj = $b['main']['object']; |
540 | 540 | } else { |
541 | 541 | // Try to read the sort values from some other key |
542 | - if ( is_array($a) |
|
542 | + if (is_array($a) |
|
543 | 543 | && is_array($b)) { |
544 | 544 | foreach ($a as $key => $data) { |
545 | - if ( !empty($data['object']) |
|
545 | + if (!empty($data['object']) |
|
546 | 546 | && !empty($b[$key]['object'])) { |
547 | 547 | $a_obj = $data['object']; |
548 | 548 | $b_obj = $b[$key]['object']; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | } |
551 | 551 | } |
552 | 552 | } |
553 | - if ( empty($a_obj) |
|
553 | + if (empty($a_obj) |
|
554 | 554 | && empty($b_obj)) { |
555 | 555 | return 0; |
556 | 556 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | private function _batch_handler_cleanup($tmp_dir, $new_name) |
654 | 654 | { |
655 | 655 | debug_add("called with: '{$tmp_dir}', '{$new_name}'"); |
656 | - if ( !empty($tmp_dir) |
|
656 | + if (!empty($tmp_dir) |
|
657 | 657 | && $tmp_dir !== '/' |
658 | 658 | /* TODO: better tmp dir matching */ |
659 | 659 | && preg_match('|^/tmp/|', $tmp_dir)) { |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | debug_add("executing '{$cmd}'"); |
662 | 662 | exec($cmd, $output, $ret); |
663 | 663 | } |
664 | - if ( empty($new_name) |
|
664 | + if (empty($new_name) |
|
665 | 665 | /* TODO: better tmp dir matching */ |
666 | 666 | || !preg_match('|^/tmp/|', $new_name)) { |
667 | 667 | return; |
@@ -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 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function store(array $params, $reset = true) |
188 | 188 | { |
189 | - if ( !$this->_object_stored |
|
189 | + if (!$this->_object_stored |
|
190 | 190 | && $this->_object) { |
191 | 191 | $this->_store_from_object(); |
192 | 192 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function get($key) |
248 | 248 | { |
249 | - if ( !$this->_object_stored |
|
249 | + if (!$this->_object_stored |
|
250 | 250 | && $this->_object) { |
251 | 251 | $this->_store_from_object(); |
252 | 252 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function get_all() |
280 | 280 | { |
281 | - if ( !$this->_object_stored |
|
281 | + if (!$this->_object_stored |
|
282 | 282 | && $this->_object) { |
283 | 283 | $this->_store_from_object(); |
284 | 284 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function exists($key) |
296 | 296 | { |
297 | - if ( !$this->_object_stored |
|
297 | + if (!$this->_object_stored |
|
298 | 298 | && $this->_object) { |
299 | 299 | $this->_store_from_object(); |
300 | 300 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function _handler_approval($handler_id, array $args, array &$data) |
25 | 25 | { |
26 | - if ( !array_key_exists('guid', $_REQUEST) |
|
26 | + if (!array_key_exists('guid', $_REQUEST) |
|
27 | 27 | || !array_key_exists('return_to', $_REQUEST)) { |
28 | 28 | throw new midcom_error('Cannot process approval request, request is incomplete.'); |
29 | 29 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | parent::__construct(); |
34 | 34 | $this->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.admin.help/style-editor.css'); |
35 | 35 | |
36 | - midcom::get()->head->add_jsfile(MIDCOM_STATIC_URL.'/midcom.admin.help/twisty.js'); |
|
36 | + midcom::get()->head->add_jsfile(MIDCOM_STATIC_URL . '/midcom.admin.help/twisty.js'); |
|
37 | 37 | if (defined('MGD_TYPE_NONE')) { |
38 | 38 | $this->mgdtypes[MGD_TYPE_NONE] = 'none'; |
39 | 39 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | static function check_component($component) |
50 | 50 | { |
51 | - if ( !midcom::get()->componentloader->is_installed($component) |
|
51 | + if (!midcom::get()->componentloader->is_installed($component) |
|
52 | 52 | && $component != 'midcom') { |
53 | 53 | throw new midcom_error("Failed to generate documentation path for component {$component} as it is not installed."); |
54 | 54 | } |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | $files = array(); |
235 | 235 | $pattern = $component_dir . '*.{' . midcom::get()->i18n->get_current_language() . ',' . midcom::get()->config->get('i18n_fallback_language') . '}.txt'; |
236 | 236 | |
237 | - foreach (glob($pattern, GLOB_NOSORT|GLOB_BRACE) as $path) { |
|
237 | + foreach (glob($pattern, GLOB_NOSORT | GLOB_BRACE) as $path) { |
|
238 | 238 | $entry = basename($path); |
239 | - if ( substr($entry, 0, 5) == 'index' |
|
239 | + if (substr($entry, 0, 5) == 'index' |
|
240 | 240 | || substr($entry, 0, 7) == 'handler' |
241 | 241 | || substr($entry, 0, 9) == 'urlmethod') { |
242 | 242 | // Ignore dotfiles, handlers & index.lang.txt |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | // TODO: We're using "private" members here, better expose them through a method |
263 | 263 | $handler = midcom::get()->componentloader->get_interface_class($component); |
264 | - $request =& $handler->_context_data[midcom_core_context::get()->id]['handler']; |
|
264 | + $request = & $handler->_context_data[midcom_core_context::get()->id]['handler']; |
|
265 | 265 | if (!isset($request->_request_switch)) { |
266 | 266 | // No request switch available, skip loading it |
267 | 267 | return $data; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $exec_path = MIDCOM_ROOT . '/' . $component_path . '/exec'; |
317 | 317 | } |
318 | 318 | |
319 | - if ( !is_dir($exec_path) |
|
319 | + if (!is_dir($exec_path) |
|
320 | 320 | || !is_readable($exec_path)) { |
321 | 321 | // Directory not accessible, skip loading it |
322 | 322 | return $data; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | { |
428 | 428 | $this->add_breadcrumb("__ais/help/", $this->_l10n->get('midcom.admin.help')); |
429 | 429 | |
430 | - if ( $handler_id == '____ais-help-help' |
|
430 | + if ($handler_id == '____ais-help-help' |
|
431 | 431 | || $handler_id == '____ais-help-component') { |
432 | 432 | $this->add_breadcrumb( |
433 | 433 | "__ais/help/{$this->_request_data['component']}/", |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | } |
437 | 437 | |
438 | 438 | if ($handler_id == '____ais-help-help') { |
439 | - if ( $this->_request_data['help_id'] == 'handlers' |
|
439 | + if ($this->_request_data['help_id'] == 'handlers' |
|
440 | 440 | || $this->_request_data['help_id'] == 'urlmethods' |
441 | 441 | || $this->_request_data['help_id'] == 'mgdschemas') { |
442 | 442 | $this->add_breadcrumb( |
@@ -30,7 +30,7 @@ |
||
30 | 30 | public function _on_loaded() |
31 | 31 | { |
32 | 32 | // if we are missing the component, use the nullcomponent. |
33 | - if ( !$this->component |
|
33 | + if (!$this->component |
|
34 | 34 | || !array_key_exists($this->component, midcom::get()->componentloader->manifests)) { |
35 | 35 | debug_add("Topic {$this->id} has no component assigned to it, using 'midcom.core.nullcomponent'.", |
36 | 36 | MIDCOM_LOG_INFO); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $this->context->set_key(MIDCOM_CONTEXT_PAGETITLE, $meta[MIDCOM_NAV_NAME]); |
50 | 50 | } |
51 | 51 | |
52 | - if ( $this->context->id == 0 |
|
52 | + if ($this->context->id == 0 |
|
53 | 53 | && !midcom::get()->skip_page_style) { |
54 | 54 | // Let metadata service add its meta tags |
55 | 55 | midcom::get()->metadata->populate_meta_head(); |