/** * @internal * @access private */ public static function _register_content_block(&$content_obj, &$contentBlock) { # do not process blocks with same id twice if (isset(self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')])) { self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')]->SetProperty('multiple', true); return; } $AC =& ac_utils::get_module('AdvancedContent'); $block_id = $contentBlock->GetProperty('id'); # this block has been added to the template after page has been created? if (!$content_obj->HasProperty($block_id)) { $contentBlock->SetProperty('new_block', true); } # ToDo: how remove the backend stuff from this class without need to loop through all content blocks again? if (!ac_utils::is_frontend_request()) { $type = $contentBlock->Type(); if (!isset(self::$_block_types[$type])) { self::$_block_types[$type] = array('content_blocks' => array(), 'header_html_called' => false, 'props' => array()); } self::$_block_types[$type]['content_blocks'][$block_id] = $block_id; acTabManager::SetTabs($content_obj, $contentBlock); if ($contentBlock->Type() != AC_INVALID_BLOCK_TYPE) { if ($contentBlock->GetProperty('smarty')) { foreach ($contentBlock->GetProperties() as $propName => $propValue) { $contentBlock->SetProperty($propName, ac_utils::DoSmarty($content_obj, $propValue)); } } $value = $contentBlock->GetContent(); if ($content_obj->Id() < 0 && $value == '' || $value == '' && !$contentBlock->GetProperty('allow_none') || $contentBlock->GetProperty('new_block')) { $value = $contentBlock->GetProperty('default'); } $content_obj->SetPropertyValueNoLoad($block_id, $value); $block_display = true; if ($contentBlock->GetProperty('collapsible')) { $block_display = ac_admin_ops::GetVisibility('block', $block_id, $content_obj->Id(), $content_obj->TemplateId(), !$contentBlock->GetProperty('collapse')); $contentBlock->SetProperty('pref_url', str_replace('&);', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_block'), array('item_type' => 'block', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $block_id, 'item_display' => !$block_display), '', true))); } $contentBlock->SetProperty('display', $block_display); } if (strtolower($contentBlock->GetProperty('label')) == 'content_en') { $contentBlock->SetProperty('label', lang('content')); } if ($contentBlock->GetProperty('translate_labels')) { $contentBlock->SetProperty('label', $AC->lang($contentBlock->GetProperty('label'))); } # deprecated (should not be needed since CMSms 1.11) if ($contentBlock->GetProperty('multiple') && ac_admin_ops::GetVisibility('message', $block_id, $content_obj->Id(), $content_obj->TemplateId())) { $hide_link = str_replace('&', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_message'), array('item_type' => 'message', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $block_id, 'item_display' => 0), '', false, '', 'onclick="jQuery.get(this.href); jQuery(\'#' . $block_id . '_message\').toggle(\'fast\',function(){jQuery(this).remove()}); return false;"')); $contentBlock->SetProperty('message', $AC->lang('notice_duplicatecontent', $contentBlock->GetProperty('name')) . ' (' . $hide_link . ')'); } #--- $contentBlock->SetBlockTypeProperties(); } if ($contentBlock->Type() != AC_INVALID_BLOCK_TYPE && ac_utils::is_frontend_request() || !ac_utils::is_frontend_request()) { $content_obj->AddExtraProperty($block_id); # backward compatibility (deprecated) self::$_content_blocks[$content_obj->Id()][$block_id] = $contentBlock; } }