function __construct(&$content_obj, $params = array())
 {
     $params['block_type'] = 'select_multiple';
     parent::__construct($content_obj, $params);
     $AC =& ac_utils::get_module('AdvancedContent');
     #$AC->SetAllowedParam(CLEAN_REGEXP.'/.*_AdvancedContentSortableItem_.*/',CLEAN_STRING);
     $this->SetProperty('sortable', isset($params['sortable_items']) && ac_utils::IsTrue($params['sortable_items']));
     # deprecated
     $this->SetProperty('sortable', isset($params['sortable']) && ac_utils::IsTrue($params['sortable']));
     $this->SetProperty('delimiter', isset($params['delimiter']) ? $params['delimiter'] : '|');
     $this->SetProperty('items', isset($params['items']) ? $params['items'] : '');
     $this->SetProperty('values', isset($params['values']) ? $params['values'] : '');
 }
 public static function CreateContentBlock(&$content_obj, $params)
 {
     $params['smarty'] = isset($params['smarty']) && (ac_utils::IsTrue($params['smarty']) || $params['smarty'] == 'both' || $params['smarty'] == ac_utils::cms_access());
     # block active ?
     $params['active'] = isset($params['active']) ? $params['active'] : true;
     if ($params['smarty']) {
         $params['active'] = ac_utils::DoSmarty($content_obj, $params['active']);
     }
     if (ac_utils::IsFalse($params['active'])) {
         return false;
     }
     # do not process inactive blocks
     #---
     # additional editors
     $params['editor_groups'] = isset($params['editor_groups']) ? $params['editor_groups'] : NULL;
     $params['editor_users'] = isset($params['editor_users']) ? $params['editor_users'] : NULL;
     if (!ac_utils::is_frontend_request() && ($params['editor_groups'] || $params['editor_users']) && !ac_admin_ops::CheckBlockPermission($params['editor_users'], $params['editor_groups'])) {
         return false;
         # do not process blocks without permission to edit
     }
     #---
     # valid block type?
     $params['block_type'] = isset($params['block_type']) ? strtolower($params['block_type']) : 'text';
     $classname = 'acBlockType_' . $params['block_type'];
     if (!class_exists($classname)) {
         if (!ac_utils::is_frontend_request()) {
             $classname = 'acBlockTypePlaceholder';
         } else {
             return false;
         }
     }
     #---
     # valid block id?
     $params['block_id'] = isset($params['block']) ? preg_replace('/-+/', '_', munge_string_to_url($params['block'])) : 'content_en';
     if (!$params['block_id'] || $content_obj->IsKnownProperty($params['block_id'])) {
         if (!ac_utils::is_frontend_request()) {
             $params['block_id'] = md5($params['block_id'] . '_' . @count(self::$_content_blocks[$content_obj->Id()]));
             # count shouldn't be needed since CMSms 1.11 (multiple blocks with same id are just not possible anymore)
             $classname = 'acBlockTypePlaceholder';
         } else {
             return false;
         }
     }
     #---
     return new $classname($content_obj, $params);
 }
 function __construct(&$content_obj, $params = array())
 {
     $params['block_type'] = 'image';
     parent::__construct($content_obj, $params);
     $config = cmsms()->GetConfig();
     $this->SetProperty('prefix', isset($params['prefix']) ? $params['prefix'] : 'thumb_');
     $this->SetProperty('exclude', !isset($params['exclude']) || ac_utils::IsFalse($params['exclude']));
     $this->SetProperty('dir', cms_join_path($config['uploads_path'], isset($params['dir']) ? $params['dir'] : get_site_preference('contentimage_path')));
     $this->SetProperty('inputname', isset($params['inputname']) ? $params['inputname'] : $this->GetProperty('id'));
     $this->SetProperty('urlonly', isset($params['urlonly']) && ac_utils::IsTrue($params['urlonly']));
     $this->SetProperty('class', isset($params['class']) ? $params['class'] : '');
     $this->SetProperty('alt', isset($params['alt']) ? $params['alt'] : '');
     $this->SetProperty('css_id', isset($params['id']) ? $params['id'] : '');
     $this->SetProperty('width', isset($params['width']) ? $params['width'] : '');
     $this->SetProperty('height', isset($params['height']) ? $params['height'] : '');
     $this->SetProperty('title', isset($params['title']) ? $params['title'] : '');
 }
 function __construct(&$content_obj, $params = array())
 {
     $params['block_type'] = 'text';
     parent::__construct($content_obj, $params);
     $size = isset($params['size']) ? intval($params['size']) : '';
     $maxlength = isset($params['maxlength']) ? $params['maxlength'] : '';
     $usewysiwyg = (!isset($params['usewysiwyg']) || !ac_utils::IsFalse($params['usewysiwyg'])) && (!isset($params['wysiwyg']) || !ac_utils::IsFalse($params['wysiwyg']));
     $rows = isset($params['rows']) ? $params['rows'] : '';
     $cols = isset($params['cols']) ? $params['cols'] : '';
     $auto_resize = !isset($params['auto_resize']) || !ac_utils::IsFalse($params['auto_resize']);
     $oneline = isset($params['oneline']) && ac_utils::IsTrue($params['oneline']);
     $this->SetProperty('size', $size);
     $this->SetProperty('usewysiwyg', $usewysiwyg);
     $this->SetProperty('oneline', $oneline);
     $this->SetProperty('maxlength', $maxlength);
     $this->SetProperty('rows', $rows);
     $this->SetProperty('cols', $cols);
     $this->SetProperty('auto_resize', $auto_resize);
 }
 function __construct(&$content_obj, $params = array())
 {
     $params['block_type'] = 'ui_slider';
     parent::__construct($content_obj, $params);
     $slider_params = array();
     if (isset($params['min'])) {
         $slider_params['min'] = intval($params['min']);
     }
     if (isset($params['max'])) {
         $slider_params['max'] = intval($params['max']);
     }
     if (isset($params['orientation'])) {
         $slider_params['orientation'] = $params['orientation'];
     }
     if (isset($params['range'])) {
         $slider_params['range'] = ac_utils::IsTrue($params['range']) ? true : $params['range'];
     }
     if (isset($params['step'])) {
         $slider_params['step'] = intval($params['step']);
     }
     $this->SetProperty('slider_params', $slider_params);
     $this->SetProperty('unit', isset($params['unit']) ? $params['unit'] : '');
 }
 /**
  * Constructor.<br />
  * Required for all subclasses.<br />
  * Should be called from each subclass as the very first.
  * @param object $content_obj - the contentobject this block belongs to
  * @param array $params - the parameters of that contentblock
  */
 function __construct(&$content_obj, $params = array())
 {
     $this->content_obj = $content_obj;
     $AC =& ac_utils::get_module('AdvancedContent');
     $this->_properties['smarty'] = isset($params['smarty']) ? $params['smarty'] : false;
     $this->_properties['editor_groups'] = isset($params['editor_groups']) ? $params['editor_groups'] : '';
     $this->_properties['editor_users'] = isset($params['editor_users']) ? $params['editor_users'] : '';
     #deprecated
     $this->_properties['type'] = isset($params['block_type']) ? $params['block_type'] : '';
     $this->_properties['name'] = isset($params['block']) ? $params['block'] : 'content_en';
     $this->_properties['id'] = isset($params['block_id']) ? $params['block_id'] : str_replace(array('-', '+'), '_', munge_string_to_url($this->_properties['name']));
     $this->_properties['label'] = isset($params['label']) ? $params['label'] : ucwords($this->_properties['name']);
     $this->_properties['default'] = isset($params['default']) ? $params['default'] : '';
     $this->_properties['style'] = isset($params['style']) ? $params['style'] : '';
     # deprecated
     $this->_properties['page_tab'] = isset($params['page_tab']) ? $params['page_tab'] : (isset($params['tab']) ? $params['tab'] : 'main');
     $this->_properties['block_tab'] = isset($params['block_tab']) ? $params['block_tab'] : '';
     $this->_properties['block_group'] = isset($params['block_group']) ? $params['block_group'] : '';
     $this->_properties['description'] = isset($params['description']) ? $params['description'] : '';
     $this->_properties['translate_labels'] = isset($params['translate_labels']) && ac_utils::IsTrue($params['translate_labels']);
     $this->_properties['translate_values'] = isset($params['translate_values']) && ac_utils::IsTrue($params['translate_values']);
     $this->_properties['required'] = isset($params['required']) && ac_utils::IsTrue($params['required']);
     $this->_properties['allow_none'] = !(isset($params['allow_none']) && ac_utils::IsFalse($params['allow_none']));
     $this->_properties['no_collapse'] = isset($params['no_collapse']) && ac_utils::IsTrue($params['no_collapse']);
     $this->_properties['collapsible'] = !$this->_properties['no_collapse'] && $this->_properties['type'];
     if (!$this->_properties['collapsible']) {
         $this->_properties['collapse'] = false;
     } else {
         $this->_properties['collapse'] = isset($params['collapse']) ? !ac_utils::IsFalse($params['collapse']) : $AC->GetPreference('collapse_block_default', true);
     }
     $this->_properties['feu_access'] = isset($params['feu_access']) ? $params['feu_access'] : '';
     $this->_properties['feu_action'] = isset($params['feu_action']) && ac_utils::IsTrue($params['feu_action']);
     $this->_properties['feu_hide'] = isset($params['feu_hide']) && ac_utils::IsTrue($params['feu_hide']);
     if (!empty($params['assign'])) {
         $this->_properties['assign'] = str_replace(array('-', '+'), '_', munge_string_to_url($params['assign']));
     }
 }
예제 #7
0
    $module =& ac_utils::get_module($modulename);
    if (is_object($module) && $module->IsPluginModule()) {
        @ob_start();
        $params = GetModuleParameters($id);
        $returnid = isset($params['returnid']) ? $params['returnid'] : $content_obj->Id();
        $output = $module->DoActionBase($action, $id, $params, $returnid);
        if ($output !== FALSE && (!isset($params['no_output']) || ac_utils::IsFalse($params['no_output']))) {
            echo $output;
        }
        $output = @ob_get_contents();
        @ob_end_clean();
    }
} else {
    $oldvalue = cmsms()->GetSmarty()->caching;
    cmsms()->GetSmarty()->caching = false;
    $contentId = $content_obj->Id();
    $output = cmsms()->GetSmarty()->fetch(str_replace(' ', '_', 'content:' . $block), '|' . $block, $contentId . $block);
    cmsms()->GetSmarty()->caching = $oldvalue;
    $defaultValue = isset($params['default']) ? trim($params['default']) : '';
    $doSmarty = isset($params['smarty']) && ac_utils::IsTrue($params['smarty']);
    if ($doSmarty) {
        $defaultValue = ac_utils::DoSmarty($content_obj, $defaultValue);
    }
    $allowNone = !isset($params['allow_none']) || ac_utils::IsFalse($params['allow_none']);
    if ($output == '' && !$allowNone) {
        $output = $defaultValue;
    }
}
if (!isset($params['no_output']) || ac_utils::IsFalse($params['no_output'])) {
    echo trim($output);
}