@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class schema |
| 20 | 20 | { |
| 21 | - private $defaults = array |
|
| 22 | - ( |
|
| 21 | + private $defaults = array( |
|
| 23 | 22 | 'operations' => array('save' => '', 'cancel' => '') |
| 24 | 23 | ); |
| 25 | 24 | |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | { |
| 65 | 64 | foreach ($this->config['fields'] as $name => $config) |
| 66 | 65 | { |
| 67 | - $options = array |
|
| 68 | - ( |
|
| 66 | + $options = array( |
|
| 69 | 67 | 'label' => $config['title'], |
| 70 | 68 | 'widget_config' => $config['widget_config'], |
| 71 | 69 | 'type_config' => $config['type_config'], |
@@ -138,8 +136,7 @@ discard block |
||
| 138 | 136 | { |
| 139 | 137 | $resolver = new OptionsResolver(); |
| 140 | 138 | |
| 141 | - $resolver->setDefaults(array |
|
| 142 | - ( |
|
| 139 | + $resolver->setDefaults(array( |
|
| 143 | 140 | 'title' => '', |
| 144 | 141 | 'type' => null, |
| 145 | 142 | 'type_config' => array(), |
@@ -154,9 +151,9 @@ discard block |
||
| 154 | 151 | 'end_fieldset' => null |
| 155 | 152 | )); |
| 156 | 153 | |
| 157 | - $normalize_widget = function (Options $options, $value) use ($name) |
|
| 154 | + $normalize_widget = function(Options $options, $value) use ($name) |
|
| 158 | 155 | { |
| 159 | - if ( $value == 'images' |
|
| 156 | + if ($value == 'images' |
|
| 160 | 157 | || $value == 'downloads') |
| 161 | 158 | { |
| 162 | 159 | return 'subform'; |
@@ -164,10 +161,9 @@ discard block |
||
| 164 | 161 | return $value; |
| 165 | 162 | }; |
| 166 | 163 | |
| 167 | - $normalize_storage = function (Options $options, $value) use ($name) |
|
| 164 | + $normalize_storage = function(Options $options, $value) use ($name) |
|
| 168 | 165 | { |
| 169 | - $default = array |
|
| 170 | - ( |
|
| 166 | + $default = array( |
|
| 171 | 167 | 'location' => 'parameter', |
| 172 | 168 | 'domain' => 'midcom.helper.datamanager2', |
| 173 | 169 | 'name' => $name |
@@ -81,8 +81,7 @@ discard block |
||
| 81 | 81 | if (compat::is_legacy()) |
| 82 | 82 | { |
| 83 | 83 | $options['read_only'] = $config['readonly']; |
| 84 | - } |
|
| 85 | - else |
|
| 84 | + } else |
|
| 86 | 85 | { |
| 87 | 86 | $options['attr']['readonly'] = $config['readonly']; |
| 88 | 87 | } |
@@ -113,8 +112,7 @@ discard block |
||
| 113 | 112 | if (array_key_exists('l10n_db', $this->config)) |
| 114 | 113 | { |
| 115 | 114 | $l10n_name = $this->config['l10n_db']; |
| 116 | - } |
|
| 117 | - else |
|
| 115 | + } else |
|
| 118 | 116 | { |
| 119 | 117 | $l10n_name = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT); |
| 120 | 118 | } |
@@ -48,10 +48,10 @@ |
||
| 48 | 48 | |
| 49 | 49 | public function process() |
| 50 | 50 | { |
| 51 | - if (!$this->form->isSubmitted()) |
|
| 52 | - { |
|
| 53 | - $this->form->handleRequest(); |
|
| 54 | - } |
|
| 51 | + if (!$this->form->isSubmitted()) |
|
| 52 | + { |
|
| 53 | + $this->form->handleRequest(); |
|
| 54 | + } |
|
| 55 | 55 | // we add the stylesheet regardless of processing result, since save does not automatically mean relocate... |
| 56 | 56 | midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL . "/midcom.datamanager/default.css"); |
| 57 | 57 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | if ($this->form->isSubmitted()) |
| 59 | 59 | { |
| 60 | 60 | $button = $this->form->getClickedButton(); |
| 61 | - if ( $button |
|
| 61 | + if ($button |
|
| 62 | 62 | && $button->getConfig()->getOption('operation') == self::CANCEL) |
| 63 | 63 | { |
| 64 | 64 | return self::CANCEL; |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function validate($value, Constraint $constraint) |
| 14 | 14 | { |
| 15 | - if ( empty($value['archival']) |
|
| 15 | + if (empty($value['archival']) |
|
| 16 | 16 | && empty($value['file'])) |
| 17 | 17 | { |
| 18 | 18 | $this->context->buildViolation($constraint->message) |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | |
| 121 | 121 | if (!empty($this->config['widget_config']['sortable'])) |
| 122 | 122 | { |
| 123 | - uasort($this->map, function ($a, $b) |
|
| 123 | + uasort($this->map, function($a, $b) |
|
| 124 | 124 | { |
| 125 | 125 | if ($a->metadata->score == $b->metadata->score) |
| 126 | 126 | { |
@@ -40,8 +40,7 @@ discard block |
||
| 40 | 40 | try |
| 41 | 41 | { |
| 42 | 42 | $results[$identifier] = new midcom_db_attachment($guid); |
| 43 | - } |
|
| 44 | - catch (midcom_error $e) |
|
| 43 | + } catch (midcom_error $e) |
|
| 45 | 44 | { |
| 46 | 45 | $e->log(); |
| 47 | 46 | } |
@@ -77,8 +76,7 @@ discard block |
||
| 77 | 76 | { |
| 78 | 77 | $identifier = md5(time() . $data['file']['name'] . $data['file']['tmp_name']); |
| 79 | 78 | } |
| 80 | - } |
|
| 81 | - else |
|
| 79 | + } else |
|
| 82 | 80 | { |
| 83 | 81 | if ($attachment->name != $filename) |
| 84 | 82 | { |
@@ -92,8 +90,7 @@ discard block |
||
| 92 | 90 | { |
| 93 | 91 | throw new midcom_error('Failed to copy attachment: ' . midcom_connection::get_error_string()); |
| 94 | 92 | } |
| 95 | - } |
|
| 96 | - else if ($attachment === null) |
|
| 93 | + } else if ($attachment === null) |
|
| 97 | 94 | { |
| 98 | 95 | continue; |
| 99 | 96 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | //workaround for weird mgd API behavior where setting falsy (i.e. deleting) a nonexistent parameter |
| 27 | 27 | //returns an error |
| 28 | - if ( !$this->value |
|
| 28 | + if (!$this->value |
|
| 29 | 29 | && $this->load() === null) |
| 30 | 30 | { |
| 31 | 31 | return true; |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $this->save_attachment_list(); |
| 57 | - } |
|
| 58 | - elseif (!empty($this->value['delete'])) |
|
| 57 | + } elseif (!empty($this->value['delete'])) |
|
| 59 | 58 | { |
| 60 | 59 | $this->map = array(); |
| 61 | 60 | return $this->save_attachment_list(); |
@@ -19,11 +19,9 @@ |
||
| 19 | 19 | { |
| 20 | 20 | public function get_button_config() |
| 21 | 21 | { |
| 22 | - return array |
|
| 23 | - ( |
|
| 22 | + return array( |
|
| 24 | 23 | MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('view', 'midcom'), |
| 25 | - MIDCOM_TOOLBAR_OPTIONS => array |
|
| 26 | - ( |
|
| 24 | + MIDCOM_TOOLBAR_OPTIONS => array( |
|
| 27 | 25 | 'data-dialog' => 'dialog', |
| 28 | 26 | ) |
| 29 | 27 | ); |
@@ -80,8 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $resolver |
| 83 | - ->setDefaults(array |
|
| 84 | - ( |
|
| 83 | + ->setDefaults(array( |
|
| 85 | 84 | 'recursive' => false, |
| 86 | 85 | 'success_url' => '', |
| 87 | 86 | 'label' => null, |
@@ -113,13 +112,11 @@ discard block |
||
| 113 | 112 | $dialog_text .= '<div id="delete-child-list"></div>'; |
| 114 | 113 | } |
| 115 | 114 | |
| 116 | - return array |
|
| 117 | - ( |
|
| 115 | + return array( |
|
| 118 | 116 | MIDCOM_TOOLBAR_LABEL => $this->l10n_midcom->get('delete'), |
| 119 | 117 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', |
| 120 | 118 | MIDCOM_TOOLBAR_ACCESSKEY => 'd', |
| 121 | - MIDCOM_TOOLBAR_OPTIONS => array |
|
| 122 | - ( |
|
| 119 | + MIDCOM_TOOLBAR_OPTIONS => array( |
|
| 123 | 120 | 'data-dialog' => 'delete', |
| 124 | 121 | 'data-form-id' => $this->form_identifier, |
| 125 | 122 | 'data-dialog-heading' => $this->l10n_midcom->get('confirm delete'), |
@@ -145,8 +145,7 @@ |
||
| 145 | 145 | $this->state = static::SUCCESS; |
| 146 | 146 | $url = $this->success_url; |
| 147 | 147 | $message['body'] = sprintf($this->l10n_midcom->get("%s deleted"), $this->label); |
| 148 | - } |
|
| 149 | - else |
|
| 148 | + } else |
|
| 150 | 149 | { |
| 151 | 150 | $this->state = static::FAILURE; |
| 152 | 151 | $message['body'] = sprintf($this->l10n_midcom->get("failed to delete %s: %s"), $this->label, midcom_connection::get_error_string()); |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | //The constants are numeric, so array_merge won't work... |
| 76 | 76 | foreach ($options as $key => $value) |
| 77 | 77 | { |
| 78 | - if ( is_array($value) |
|
| 78 | + if (is_array($value) |
|
| 79 | 79 | && !empty($button_config[$key])) |
| 80 | 80 | { |
| 81 | 81 | $value = array_merge($button_config[$key], $value); |