@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | $profit = $value - $cost; |
| 93 | - if ( $this->value != $value |
|
| 93 | + if ($this->value != $value |
|
| 94 | 94 | || $this->profit != $profit) { |
| 95 | 95 | $this->value = $value; |
| 96 | 96 | $this->profit = $value - $cost; |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | public function _on_updating() |
| 222 | 222 | { |
| 223 | - if ( $this->state != self::STATE_ACTIVE |
|
| 223 | + if ($this->state != self::STATE_ACTIVE |
|
| 224 | 224 | && !$this->end) { |
| 225 | 225 | //Not active anymore and end not set, set it to now |
| 226 | 226 | $this->end = time(); |
| 227 | 227 | } |
| 228 | - if ( $this->end |
|
| 228 | + if ($this->end |
|
| 229 | 229 | && $this->state == self::STATE_ACTIVE) { |
| 230 | 230 | //Returned to active state, clear the end marker. |
| 231 | 231 | $this->end = 0; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | { |
| 79 | 79 | parent::__set($property, $value); |
| 80 | 80 | |
| 81 | - if ( $property == 'firstname' |
|
| 81 | + if ($property == 'firstname' |
|
| 82 | 82 | || $property == 'lastname' |
| 83 | 83 | || $property == 'homepage' |
| 84 | 84 | || $property == 'email') { |
@@ -364,10 +364,10 @@ discard block |
||
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if ( !empty($item[MIDCOM_TOOLBAR_ACCESSKEY]) |
|
| 367 | + if (!empty($item[MIDCOM_TOOLBAR_ACCESSKEY]) |
|
| 368 | 368 | && !array_key_exists($item[MIDCOM_TOOLBAR_ACCESSKEY], $used_access_keys)) { |
| 369 | 369 | // We have valid access key, add it to help text |
| 370 | - if ( isset($_SERVER['HTTP_USER_AGENT']) |
|
| 370 | + if (isset($_SERVER['HTTP_USER_AGENT']) |
|
| 371 | 371 | && strstr($_SERVER['HTTP_USER_AGENT'], 'Macintosh')) { |
| 372 | 372 | // Mac users |
| 373 | 373 | $hotkey = 'Ctrl-' . strtoupper($item[MIDCOM_TOOLBAR_ACCESSKEY]); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | private function set_url(array &$item, $url) |
| 391 | 391 | { |
| 392 | 392 | $item[MIDCOM_TOOLBAR__ORIGINAL_URL] = $url; |
| 393 | - if ( ( empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"]) |
|
| 393 | + if ((empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"]) |
|
| 394 | 394 | // Some items may want to keep their links unmutilated |
| 395 | 395 | || $item[MIDCOM_TOOLBAR_OPTIONS]["rel"] != "directlink") |
| 396 | 396 | && substr($url, 0, 1) != '/' |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | if ($index == 0) { |
| 417 | 417 | array_shift($this->items); |
| 418 | - } elseif ($index == count($this->items) -1) { |
|
| 418 | + } elseif ($index == count($this->items) - 1) { |
|
| 419 | 419 | array_pop($this->items); |
| 420 | 420 | } else { |
| 421 | 421 | $this->items = array_merge(array_slice($this->items, 0, $index - 1), |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | */ |
| 546 | 546 | public function render() |
| 547 | 547 | { |
| 548 | - $visible_items = array_filter($this->items, function ($item) { |
|
| 548 | + $visible_items = array_filter($this->items, function($item) { |
|
| 549 | 549 | return !$item[MIDCOM_TOOLBAR_HIDDEN]; |
| 550 | 550 | }); |
| 551 | 551 | |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | foreach ($visible_items as $i => $item) { |
| 571 | 571 | $output .= '<li class="'; |
| 572 | 572 | if ($i == 0) { |
| 573 | - $output .= $first_class . ' '; |
|
| 573 | + $output .= $first_class . ' '; |
|
| 574 | 574 | } elseif ($i == $last) { |
| 575 | 575 | $output .= 'last_item '; |
| 576 | 576 | } |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | // Try finding uppercase version of the accesskey first |
| 611 | 611 | $accesskey = strtoupper($item[MIDCOM_TOOLBAR_ACCESSKEY]); |
| 612 | 612 | $position = strpos($label, $accesskey); |
| 613 | - if ( $position === false |
|
| 613 | + if ($position === false |
|
| 614 | 614 | && midcom::get()->i18n->get_current_language() == 'en') { |
| 615 | 615 | // Try lowercase, too |
| 616 | 616 | $accesskey = strtolower($accesskey); |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | $attributes['title'] = $item[MIDCOM_TOOLBAR_HELPTEXT]; |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - if ( $item[MIDCOM_TOOLBAR_ENABLED] |
|
| 674 | + if ($item[MIDCOM_TOOLBAR_ENABLED] |
|
| 675 | 675 | && !is_null($item[MIDCOM_TOOLBAR_ACCESSKEY])) { |
| 676 | 676 | $attributes['class'] = 'accesskey'; |
| 677 | 677 | $attributes['accesskey'] = $item[MIDCOM_TOOLBAR_ACCESSKEY]; |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | public function get_index_from_url($url) |
| 738 | 738 | { |
| 739 | 739 | foreach ($this->items as $i => $item) { |
| 740 | - if ( $item[MIDCOM_TOOLBAR_URL] == $url |
|
| 740 | + if ($item[MIDCOM_TOOLBAR_URL] == $url |
|
| 741 | 741 | || $item[MIDCOM_TOOLBAR__ORIGINAL_URL] == $url) { |
| 742 | 742 | return $i; |
| 743 | 743 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | debug_add("The File {$filename} is not writeable.", MIDCOM_LOG_ERROR); |
| 194 | 194 | return false; |
| 195 | 195 | } |
| 196 | - if ( !empty($this->_filename) |
|
| 196 | + if (!empty($this->_filename) |
|
| 197 | 197 | && $this->_filename !== $filename) { |
| 198 | 198 | $this->_tmpfiles[] = $this->_filename; |
| 199 | 199 | } |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $tmpfile = null; |
| 419 | 419 | $imagesize = getimagesize($this->_filename); |
| 420 | 420 | |
| 421 | - if ( $imagesize[2] == IMAGETYPE_JPEG |
|
| 421 | + if ($imagesize[2] == IMAGETYPE_JPEG |
|
| 422 | 422 | && $this->_jpegtran_available()) { |
| 423 | 423 | /* jpegtran */ |
| 424 | 424 | $operations = array( |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | while ($rotate > 360) { |
| 478 | 478 | $rotate -= 360; |
| 479 | 479 | } |
| 480 | - if ( $rotate == 0 |
|
| 480 | + if ($rotate == 0 |
|
| 481 | 481 | || $rotate == 360) { |
| 482 | 482 | debug_add("Rotate is {$rotate}, we're happy as-is."); |
| 483 | 483 | return; |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $imagesize = getimagesize($this->_filename); |
| 488 | 488 | |
| 489 | 489 | // Try lossless jpegtran rotation if possible |
| 490 | - if ( $imagesize[2] == IMAGETYPE_JPEG |
|
| 490 | + if ($imagesize[2] == IMAGETYPE_JPEG |
|
| 491 | 491 | && ($rotate % 90 == 0) |
| 492 | 492 | && $this->_jpegtran_available()) { |
| 493 | 493 | $tmpfile = $this->_get_tempfile(); |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | */ |
| 617 | 617 | public function fill($x = null, $y = null, $color = null, $gravity = 'center') |
| 618 | 618 | { |
| 619 | - if ( empty($x) |
|
| 619 | + if (empty($x) |
|
| 620 | 620 | || empty($y) |
| 621 | 621 | || empty($color)) { |
| 622 | 622 | //This is a bit silly, but here for backwards compatibility... |
@@ -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': |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $this->schemadb =& $schemadb; |
|
| 123 | + $this->schemadb = & $schemadb; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | if ($storage instanceof midcom_helper_datamanager2_datamanager) { |
| 145 | 145 | $this->datamanager = $storage; |
| 146 | - } elseif ( $storage instanceof midcom_helper_datamanager2_storage |
|
| 146 | + } elseif ($storage instanceof midcom_helper_datamanager2_storage |
|
| 147 | 147 | || midcom::get()->dbclassloader->is_midcom_db_object($storage)) { |
| 148 | 148 | $this->datamanager = new midcom_helper_datamanager2_datamanager($this->schemadb); |
| 149 | 149 | if ($schema === null) { |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | function display_form() |
| 204 | 204 | { |
| 205 | 205 | // Prevent temporary objects from failing |
| 206 | - if ( $this->lock_object |
|
| 206 | + if ($this->lock_object |
|
| 207 | 207 | && !empty($this->datamanager->storage->object->guid)) { |
| 208 | 208 | // Get the metadata object |
| 209 | 209 | $metadata = $this->datamanager->storage->object->metadata; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $metadata = $this->datamanager->storage->object->metadata; |
| 82 | 82 | |
| 83 | - if ( $metadata |
|
| 83 | + if ($metadata |
|
| 84 | 84 | && array_key_exists('midcom_helper_datamanager2_unlock', $_REQUEST) |
| 85 | 85 | && isset($_REQUEST['midcom_helper_datamanager2_object'])) { |
| 86 | 86 | // Remove the lock, if permission is granted |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | if ($metadata) { |
| 104 | 104 | // Remove the lock |
| 105 | - if ( $this->lock_timeout |
|
| 106 | - && ( $result === 'save' |
|
| 105 | + if ($this->lock_timeout |
|
| 106 | + && ($result === 'save' |
|
| 107 | 107 | || $result === 'cancel')) { |
| 108 | 108 | $metadata->unlock(); |
| 109 | 109 | } |
| 110 | 110 | // or set it, if needed |
| 111 | - elseif ( $this->lock_object |
|
| 111 | + elseif ($this->lock_object |
|
| 112 | 112 | && !$metadata->is_locked() |
| 113 | 113 | && $this->lock_timeout) { |
| 114 | 114 | $metadata->lock(); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // Handle successful save explicitly. |
| 119 | - if ( $result == 'save' |
|
| 119 | + if ($result == 'save' |
|
| 120 | 120 | || $result == 'next') { |
| 121 | 121 | // Ok, we can save now. At this point we already have a content object. |
| 122 | 122 | $result = $this->_save_form($result); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | return 'edit'; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if ( $result == 'save' |
|
| 156 | + if ($result == 'save' |
|
| 157 | 157 | && !$this->datamanager->save()) { |
| 158 | 158 | if (count($this->datamanager->validation_errors) == 0) { |
| 159 | 159 | // It seems to be a critical error. |