public function SetBlockTypeProperties() { if (!ac_utils::is_frontend_request()) { $AC =& ac_utils::get_module('AdvancedContent'); $multi_input_ids = ac_utils::CleanArray(explode(',', $this->GetProperty('inputs'))); $blockType =& acContentBlockManager::GetBlockType('multi_input'); $multiInput_props = $blockType['props']; foreach ($multi_input_ids as $k1 => $multi_input_id) { if (!isset($multiInput_props[$multi_input_id])) { $multiInput_props = array_merge($multiInput_props, ac_admin_ops::GetMultiInputFull($multi_input_ids)); if (!isset($multiInput_props[$multi_input_id])) { continue; } $multiInput_props[$multi_input_id]['template'] = $AC->GetTemplate($multiInput_props[$multi_input_id]['tpl_name']); $matches = array(); $result = preg_match_all(AC_BLOCK_PATTERN, $multiInput_props[$multi_input_id]['input_fields'], $matches); if ($result && count($matches[1]) > 0) { foreach ($matches[1] as $k2 => $wholetag) { if (!($inputBlock = acContentBlockManager::CreateContentBlock($this->content_obj, acContentBlockManager::GetTagParams($wholetag)))) { continue; } if ($inputBlock->Type() == 'multi_input') { continue; } # ToDo: display message? $multiInput_props[$multi_input_id]['elements'][$k2] = $inputBlock; } } } } acContentBlockManager::SetBlockTypeProperties('multi_input', $multiInput_props); } }
/** * @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; } }
public function smarty_compiler_contentblock($params, &$obj) { $this->_loaded = true; foreach ($params as $k => $v) { $params[$k] = trim($v, startswith($v, "'") ? "'" : '"'); } if (isset($params['active']) && ac_utils::IsFalse($params['active'])) { return; } # don't process inactive blocks if (!($contentBlock = acContentBlockManager::CreateContentBlock($this, $params))) { return; } acContentBlockManager::_register_content_block($this, $contentBlock); if (ac_utils::is_frontend_request()) { # check block access if ($feusers =& ac_utils::get_module('FrontEndUsers')) { if ($contentBlock->GetProperty('feu_access') && !ac_utils::FeuIsMemberOf($contentBlock->GetProperty('feu_access'))) { if ($contentBlock->GetProperty('feu_action') && !$this->_feuAction) { $this->_feuAction = true; $this->SetPropertyValueNoLoad($contentBlock->GetProperty('id'), $feusers->DoAction('default', 'cntnt01', array('form' => 'login'), $this->Id())); } else { $this->SetPropertyValueNoLoad($contentBlock->GetProperty('id'), ''); } } else { if ($contentBlock->GetProperty('feu_hide') && $feusers->LoggedInId()) { $this->SetPropertyValueNoLoad($contentBlock->GetProperty('id'), ''); } } } # set default value (if neccessary) if (!$contentBlock->GetProperty('allow_none') && $this->GetPropertyValue($contentBlock->GetProperty('id')) == '') { $this->SetPropertyValueNoLoad($contentBlock->GetProperty('id'), $contentBlock->GetProperty('default')); } return $contentBlock->GetCompiledContent($obj); } }