@@ -29,10 +29,10 @@ |
||
29 | 29 | org_openpsa_widgets_contact::add_head_elements(); |
30 | 30 | |
31 | 31 | $head = midcom::get()->head; |
32 | - $head->add_jsfile(MIDCOM_JQUERY_UI_URL. '/widgets/draggable.min.js'); |
|
33 | - $head->add_jsfile(MIDCOM_JQUERY_UI_URL. '/widgets/droppable.min.js'); |
|
34 | - $head->add_jsfile(MIDCOM_JQUERY_UI_URL. '/widgets/selectable.min.js'); |
|
35 | - $head->add_jsfile(MIDCOM_JQUERY_UI_URL. '/widgets/tabs.min.js'); |
|
32 | + $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/widgets/draggable.min.js'); |
|
33 | + $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/widgets/droppable.min.js'); |
|
34 | + $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/widgets/selectable.min.js'); |
|
35 | + $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/widgets/tabs.min.js'); |
|
36 | 36 | $head->add_jsfile(MIDCOM_STATIC_URL . $prefix . 'js/elfinder.min.js'); |
37 | 37 | |
38 | 38 | $lang = midcom::get()->i18n->get_current_language(); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function _load_schemadb() |
31 | 31 | { |
32 | 32 | $this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb')); |
33 | - if ( $this->_mode == 'create' |
|
33 | + if ($this->_mode == 'create' |
|
34 | 34 | && count($this->_master->_handler['args']) == 1) { |
35 | 35 | // We're creating invoice for chosen customer |
36 | 36 | try { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | private function _modify_schema() |
49 | 49 | { |
50 | - $fields =& $this->_schemadb['default']->fields; |
|
50 | + $fields = & $this->_schemadb['default']->fields; |
|
51 | 51 | // Fill VAT select |
52 | 52 | $vat_array = explode(',', $this->_config->get('vat_percentages')); |
53 | 53 | if (!empty($vat_array)) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | private function _populate_schema_customers_for_contact($contact_id) |
92 | 92 | { |
93 | - $fields =& $this->_schemadb['default']->fields; |
|
93 | + $fields = & $this->_schemadb['default']->fields; |
|
94 | 94 | $organizations = array(0 => ''); |
95 | 95 | |
96 | 96 | $qb = org_openpsa_contacts_group_dba::new_query_builder(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | private function _populate_schema_contacts_for_customer($customer) |
114 | 114 | { |
115 | - $fields =& $this->_schemadb['default']->fields; |
|
115 | + $fields = & $this->_schemadb['default']->fields; |
|
116 | 116 | // We know the customer company, present contact as a select widget |
117 | 117 | $persons_array = array(); |
118 | 118 | $qb = org_openpsa_contacts_person_dba::new_query_builder(); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | // sending per email enabled in billing data? |
238 | 238 | $billing_data = org_openpsa_invoices_billing_data_dba::get_by_object($this->_object); |
239 | - if ( !$this->_object->sent |
|
239 | + if (!$this->_object->sent |
|
240 | 240 | && intval($billing_data->sendingoption) == 2) { |
241 | 241 | $buttons[] = $this->build_button('send_by_mail', 'stock-icons/16x16/stock_mail-reply.png'); |
242 | 242 | } |
@@ -35,7 +35,8 @@ discard block |
||
35 | 35 | // We're creating invoice for chosen customer |
36 | 36 | try { |
37 | 37 | $this->customer = new org_openpsa_contacts_group_dba($this->_master->_handler['args'][0]); |
38 | - } catch (midcom_error $e) { |
|
38 | + } |
|
39 | + catch (midcom_error $e) { |
|
39 | 40 | $this->contact = new org_openpsa_contacts_person_dba($this->_master->_handler['args'][0]); |
40 | 41 | } |
41 | 42 | } |
@@ -75,7 +76,8 @@ discard block |
||
75 | 76 | try { |
76 | 77 | $this->customer = org_openpsa_contacts_group_dba::get_cached($this->_object->customer); |
77 | 78 | $this->_populate_schema_contacts_for_customer($this->customer); |
78 | - } catch (midcom_error $e) { |
|
79 | + } |
|
80 | + catch (midcom_error $e) { |
|
79 | 81 | $fields['customer']['hidden'] = true; |
80 | 82 | $e->log(); |
81 | 83 | } |
@@ -193,7 +193,7 @@ |
||
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | |
196 | - if ( !empty($this->_old_username) |
|
196 | + if (!empty($this->_old_username) |
|
197 | 197 | && $this->_old_username !== $new_username) { |
198 | 198 | $user = new midcom_core_user($this->_person); |
199 | 199 | midcom::get()->auth->sessionmgr->_update_user_username($user, $new_username); |
@@ -33,18 +33,18 @@ |
||
33 | 33 | { |
34 | 34 | parent::configureOptions($resolver); |
35 | 35 | |
36 | - $map_options = function (Options $options) { |
|
36 | + $map_options = function(Options $options) { |
|
37 | 37 | $return_options = array(); |
38 | 38 | if (isset($options['type_config']['options'])) { |
39 | 39 | foreach ($options['type_config']['options'] as $key => $value) { |
40 | 40 | //symfony expects only strings |
41 | - $return_options[(string)$value] = (string)$key; |
|
41 | + $return_options[(string) $value] = (string) $key; |
|
42 | 42 | } |
43 | 43 | return $return_options; |
44 | 44 | } |
45 | 45 | }; |
46 | 46 | |
47 | - $map_multiple = function (Options $options) { |
|
47 | + $map_multiple = function(Options $options) { |
|
48 | 48 | return !empty($options['type_config']['allow_multiple']); |
49 | 49 | }; |
50 | 50 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | //workaround for weird mgd API behavior where setting falsy (i.e. deleting) a nonexistent parameter |
46 | 46 | //returns an error |
47 | - if ( !$this->value |
|
47 | + if (!$this->value |
|
48 | 48 | && $this->load() === null) { |
49 | 49 | return true; |
50 | 50 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | switch ($this->config['type_config']['multiple_storagemode']) { |
64 | 64 | case 'serialized': |
65 | 65 | case 'array': |
66 | - if ( !is_array($source) |
|
66 | + if (!is_array($source) |
|
67 | 67 | && empty($source)) { |
68 | 68 | $source = array(); |
69 | 69 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function get_url(midcom_db_article $article, $allow_external = false) |
40 | 40 | { |
41 | - if ( $allow_external |
|
41 | + if ($allow_external |
|
42 | 42 | && $this->_config->get('link_to_external_url') |
43 | 43 | && !empty($article->url)) { |
44 | 44 | return $article->url; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | net_nemein_rss_manage::add_toolbar_buttons($this->_node_toolbar, $this->_topic->can_do('midgard:create')); |
112 | 112 | } |
113 | 113 | |
114 | - if ( $this->_topic->can_do('midgard:update') |
|
114 | + if ($this->_topic->can_do('midgard:update') |
|
115 | 115 | && $this->_topic->can_do('midcom:component_config')) { |
116 | 116 | $buttons[] = $workflow->get_button('config/', array( |
117 | 117 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $this->_request_data['categories'] = explode(',', $this->_config->get('categories')); |
148 | 148 | |
149 | 149 | foreach ($this->_request_data['schemadb'] as $name => $schema) { |
150 | - if ( array_key_exists('categories', $schema->fields) |
|
150 | + if (array_key_exists('categories', $schema->fields) |
|
151 | 151 | && $schema->fields['categories']['type'] == 'select') { |
152 | 152 | // TODO: Merge schema local and component config categories? |
153 | 153 | $options = array_combine($this->_request_data['categories'], $this->_request_data['categories']); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | $qb->add_constraint('topic.guid', 'IN', $topic_guids); |
226 | 226 | |
227 | - if ( count($topic_guids) > 1 |
|
227 | + if (count($topic_guids) > 1 |
|
228 | 228 | && $list_from_folders_categories = $this->_config->get('list_from_folders_categories')) { |
229 | 229 | $list_from_folders_categories = explode(',', $list_from_folders_categories); |
230 | 230 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | // Hide the articles that have the publish time in the future and if |
242 | 242 | // the user is not administrator |
243 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
243 | + if ($this->_config->get('enable_scheduled_publishing') |
|
244 | 244 | && !midcom::get()->auth->admin) { |
245 | 245 | // Show the article only if the publishing time has passed or the viewer |
246 | 246 | // is the author |
@@ -49,9 +49,9 @@ |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | // generate next action buttons |
52 | - if ( $next !== null |
|
52 | + if ($next !== null |
|
53 | 53 | && $invoice->can_do('midgard:update')) { |
54 | - $actions .= '<button id="invoice_' . $invoice->guid . '" class="yes ' . $next. '">'; |
|
54 | + $actions .= '<button id="invoice_' . $invoice->guid . '" class="yes ' . $next . '">'; |
|
55 | 55 | $actions .= $this->_l10n->get($next); |
56 | 56 | $actions .= '</button>'; |
57 | 57 | } |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | $classes = array(); |
339 | 339 | |
340 | 340 | if ($child[MIDCOM_NAV_TYPE] === 'node') { |
341 | - if ( $item[MIDCOM_NAV_ID] === $this->_nap->get_current_node() |
|
342 | - && ( !$this->_nap->get_current_leaf() |
|
341 | + if ($item[MIDCOM_NAV_ID] === $this->_nap->get_current_node() |
|
342 | + && (!$this->_nap->get_current_leaf() |
|
343 | 343 | || !$this->_nap->get_leaf($this->_nap->get_current_leaf()))) { |
344 | 344 | $classes[] = $this->css_active; |
345 | 345 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | } |
387 | 387 | |
388 | 388 | // Add information about the object's status |
389 | - if ( $this->object_status_to_class |
|
389 | + if ($this->object_status_to_class |
|
390 | 390 | && isset($item[MIDCOM_NAV_OBJECT]) |
391 | 391 | && $css_status_class = midcom::get()->metadata->get_object_classes($item[MIDCOM_NAV_OBJECT])) { |
392 | 392 | $classes[] = $css_status_class; |
@@ -405,12 +405,12 @@ discard block |
||
405 | 405 | echo "<a href=\"{$item[MIDCOM_NAV_ABSOLUTEURL]}\"{$link_class}>{$item[MIDCOM_NAV_NAME]}</a>"; |
406 | 406 | // If either of the follow nodes switches is on, follow all the nodes |
407 | 407 | |
408 | - if ( $item[MIDCOM_NAV_TYPE] === 'node' |
|
408 | + if ($item[MIDCOM_NAV_TYPE] === 'node' |
|
409 | 409 | && !$this->show_only_current |
410 | - && ( $this->list_levels === 0 |
|
410 | + && ($this->list_levels === 0 |
|
411 | 411 | || $this->_level < $this->list_levels)) { |
412 | - if ( $this->follow_all |
|
413 | - || ( $this->follow_selected |
|
412 | + if ($this->follow_all |
|
413 | + || ($this->follow_selected |
|
414 | 414 | && in_array($item[MIDCOM_NAV_ID], $this->node_path, true))) { |
415 | 415 | $this->_level++; |
416 | 416 | $this->_list_child_elements($item[MIDCOM_NAV_ID]); |
@@ -152,20 +152,20 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | // Approval attributes |
155 | - if ( midcom::get()->config->get('metadata_approval') |
|
155 | + if (midcom::get()->config->get('metadata_approval') |
|
156 | 156 | && !$object->metadata->is_approved()) { |
157 | 157 | $css_classes[] = 'unapproved'; |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Hiding and scheduling attributes |
161 | - if ( ( !midcom::get()->config->get('show_hidden_objects') |
|
161 | + if ((!midcom::get()->config->get('show_hidden_objects') |
|
162 | 162 | || midcom::get()->config->get('metadata_scheduling')) |
163 | 163 | && !$object->metadata->is_visible()) { |
164 | 164 | $css_classes[] = 'hidden'; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Folder's class |
168 | - if ( $object instanceof midcom_db_topic |
|
168 | + if ($object instanceof midcom_db_topic |
|
169 | 169 | && $page_class = $object->get_parameter('midcom.services.metadata', 'page_class')) { |
170 | 170 | $css_classes[] = $page_class; |
171 | 171 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | private function _add_opengraph_metadata($view_metadata) |
271 | 271 | { |
272 | 272 | $opengraph_type = $view_metadata->object->get_parameter('midcom.helper.metadata', 'opengraph_type'); |
273 | - if ( $opengraph_type |
|
273 | + if ($opengraph_type |
|
274 | 274 | && $opengraph_type != 'none') { |
275 | 275 | $request_metadata = $this->get_request_metadata(); |
276 | 276 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | $component = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT); |
393 | - if ( !$component |
|
393 | + if (!$component |
|
394 | 394 | || !midcom::get()->componentloader->is_installed($component) |
395 | 395 | || !midcom::get()->componentloader->load_graceful($component)) { |
396 | 396 | return ''; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | */ |
415 | 415 | public function set_request_metadata($lastmodified, $permalinkguid) |
416 | 416 | { |
417 | - if ( is_object($lastmodified) |
|
417 | + if (is_object($lastmodified) |
|
418 | 418 | && is_a($lastmodified, 'midgard_datetime')) { |
419 | 419 | // Midgard2 compatibility |
420 | 420 | $lastmodified = $lastmodified->format('U'); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | 'permalink' => midcom::get()->permalinks->create_permalink($context->get_key(MIDCOM_CONTEXT_PERMALINKGUID)), |
446 | 446 | ); |
447 | 447 | |
448 | - if ( is_object($meta['lastmodified']) |
|
448 | + if (is_object($meta['lastmodified']) |
|
449 | 449 | && is_a($meta['lastmodified'], 'midgard_datetime')) { |
450 | 450 | // Midgard2 compatibility |
451 | 451 | $meta['lastmodified'] = $meta['lastmodified']->format('U'); |