当前位置: 首页>>代码示例>>PHP>>正文


PHP cmsController::loadOptions方法代码示例

本文整理汇总了PHP中cmsController::loadOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsController::loadOptions方法的具体用法?PHP cmsController::loadOptions怎么用?PHP cmsController::loadOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmsController的用法示例。


在下文中一共展示了cmsController::loadOptions方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $form = $this->getForm('options');
     if (!$form) {
         cmsCore::error404();
     }
     $is_submitted = $this->request->has('submit');
     $options = cmsController::loadOptions($this->name);
     $source_controllers = cmsEventsManager::hookAll('sitemap_sources');
     if (is_array($source_controllers)) {
         foreach ($source_controllers as $controller) {
             foreach ($controller['sources'] as $id => $title) {
                 $form->addField('sources', new fieldCheckbox("sources:{$controller['name']}|{$id}", array('title' => $title)));
             }
         }
     }
     if ($is_submitted) {
         $options = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $options);
         if (!$errors) {
             cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
             cmsController::saveOptions($this->name, $options);
             $this->redirectToAction('options');
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('backend/options', array('options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:pin-git,项目名称:icms2,代码行数:30,代码来源:options.php

示例2: actionOptions

 public function actionOptions()
 {
     if (empty($this->useDefaultOptionsAction)) {
         cmsCore::error404();
     }
     $form = $this->getForm('options');
     if (!$form) {
         cmsCore::error404();
     }
     $is_submitted = $this->request->has('submit');
     $options = cmsController::loadOptions($this->name);
     if ($is_submitted) {
         $options = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $options);
         if (!$errors) {
             cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
             cmsController::saveOptions($this->name, $options);
             $this->redirectToAction('options');
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('backend/options', array('options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:roman-burachenko,项目名称:icms2,代码行数:25,代码来源:backend.php

示例3: actionOptions

 public function actionOptions()
 {
     if (empty($this->useDefaultOptionsAction)) {
         cmsCore::error404();
     }
     $form = $this->getForm('options');
     if (!$form) {
         cmsCore::error404();
     }
     $form = $this->addControllerSeoOptions($form);
     $options = cmsController::loadOptions($this->name);
     if ($this->request->has('submit')) {
         $options = array_merge($options, $form->parse($this->request, true));
         $errors = $form->validate($this, $options);
         if (!$errors) {
             cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
             cmsController::saveOptions($this->name, $options);
             $this->processCallback(__FUNCTION__, array($options));
             $this->redirectToAction('options');
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     $template_params = array('toolbar' => $this->getOptionsToolbar(), 'options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false);
     // если задан шаблон опций в контроллере
     if ($this->cms_template->getTemplateFileName('controllers/' . $this->name . '/backend/options', true)) {
         return $this->cms_template->render('backend/options', $template_params);
     } else {
         $default_admin_tpl = $this->cms_template->getTemplateFileName('controllers/admin/controllers_options');
         return $this->cms_template->processRender($default_admin_tpl, $template_params);
     }
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:33,代码来源:backend.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     $this->config = cmsController::loadOptions('photos');
     if (!empty($this->config['types'])) {
         $this->config['types'] = string_explode_list($this->config['types']);
     }
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:8,代码来源:model.php

示例5: save_controller_options

function save_controller_options($controllers)
{
    foreach ($controllers as $controller) {
        $controller_root_path = cmsConfig::get('root_path') . 'system/controllers/' . $controller . '/';
        $form_file = $controller_root_path . 'backend/forms/form_options.php';
        $form_name = $controller . 'options';
        cmsCore::loadControllerLanguage($controller);
        $form = cmsForm::getForm($form_file, $form_name, false);
        if ($form) {
            $options = $form->parse(new cmsRequest(cmsController::loadOptions($controller)));
            cmsCore::getModel('content')->filterEqual('name', $controller)->updateFiltered('controllers', array('options' => $options));
        }
    }
}
开发者ID:Val-Git,项目名称:icms2,代码行数:14,代码来源:install.php

示例6: componentUpdate

 private function componentUpdate($manifest)
 {
     $model = new cmsModel();
     $controller_root_path = $this->cms_config->root_path . 'system/controllers/' . $manifest['package']['name'] . '/';
     $form_file = $controller_root_path . 'backend/forms/form_options.php';
     $form_name = $manifest['package']['name'] . 'options';
     cmsCore::loadControllerLanguage($manifest['package']['name']);
     $form = cmsForm::getForm($form_file, $form_name, false);
     if ($form) {
         $options = $form->parse(new cmsRequest(cmsController::loadOptions($manifest['package']['name'])));
     } else {
         $options = null;
     }
     $model->filterEqual('name', $manifest['package']['name'])->updateFiltered('controllers', array('title' => $manifest['info']['title'], 'options' => $options, 'author' => isset($manifest['author']['name']) ? $manifest['author']['name'] : LANG_CP_PACKAGE_NONAME, 'url' => isset($manifest['author']['url']) ? $manifest['author']['url'] : null, 'version' => $manifest['version']['major'] . '.' . $manifest['version']['minor'] . '.' . $manifest['version']['build'], 'is_backend' => file_exists($controller_root_path . 'backend.php')));
     return 'controllers';
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:16,代码来源:install_finish.php

示例7: run

 public function run()
 {
     $controller_options = cmsController::loadOptions('comments');
     if (!empty($controller_options['disable_icms_comments'])) {
         return false;
     }
     $show_avatars = $this->getOption('show_avatars', true);
     $show_text = $this->getOption('show_text', false);
     $limit = $this->getOption('limit', 10);
     $model = cmsCore::getModel('comments');
     $model->orderBy('date_pub', 'desc');
     if (!cmsUser::isAllowed('comments', 'view_all')) {
         $model->filterEqual('is_private', 0);
     }
     $items = $model->filterIsNull('is_deleted')->limit($limit)->getComments();
     if (!$items) {
         return false;
     }
     $items = cmsEventsManager::hook('comments_before_list', $items);
     return array('show_avatars' => $show_avatars, 'show_text' => $show_text, 'items' => $items);
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:21,代码来源:widget.php

示例8: run

 public function run()
 {
     $form = $this->getForm('options');
     if (!$form) {
         cmsCore::error404();
     }
     $activity_model = cmsCore::getModel('activity');
     $is_submitted = $this->request->has('submit');
     $options = cmsController::loadOptions($this->name);
     if ($is_submitted) {
         $options = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $options);
         if (!$errors) {
             cmsController::saveOptions($this->name, $options);
             $activity_model->enableTypes($options['types']);
             $this->redirectToAction('options');
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('backend/options', array('options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:23,代码来源:options.php

示例9: install_package


//.........这里部分代码省略.........
            $core->db->dropIndex($table, $index_name);
        }
    }
    // добавляем нужные
    foreach ($add_table_indexes as $table => $indexes) {
        foreach ($indexes as $index_name => $fields) {
            $core->db->addIndex($table, $fields, $index_name);
        }
    }
    //************************************************************************//
    // типы контента
    $ctypes = $content_model->getContentTypes();
    $varchar_fields = array('seo_keys', 'seo_desc', 'seo_title');
    $remove_ctype_indexes = array('_cats' => array('ns_left', 'ns_right', 'ns_differ', 'ns_ignore', 'parent_id'), '_props_bind' => array('cat_id', 'ordering'), '' => array('date_pub', 'user_id', 'parent_id', 'parent_type', 'is_comments_on', 'is_approved', 'date_approved', 'comments', 'rating', 'is_private', 'is_parent_hidden', 'photos_count', 'date_pub_end', 'date_last_modified', 'title'));
    $add_ctype_indexes = array('_cats' => array('ns_left' => array('ns_level', 'ns_right', 'ns_left'), 'parent_id' => array('parent_id', 'ns_left')), '_props_bind' => array('ordering' => array('cat_id', 'ordering')), '' => array('date_pub' => array('is_pub', 'is_parent_hidden', 'is_approved', 'date_pub'), 'parent_id' => array('parent_id', 'parent_type', 'date_pub'), 'user_id' => array('user_id', 'date_pub'), 'date_pub_end' => array('date_pub_end')));
    $add_ctype_fulltext_indexes = array('' => array('title' => array('title')));
    foreach ($ctypes as $ctype) {
        // меняем типы сео полям
        foreach ($varchar_fields as $varchar_field) {
            $core->db->query("ALTER TABLE  `{#}{$content_model->table_prefix}{$ctype['name']}` CHANGE  `{$varchar_field}`  `{$varchar_field}` VARCHAR( 256 ) NULL DEFAULT NULL;");
            $core->db->query("ALTER TABLE  `{#}{$content_model->table_prefix}{$ctype['name']}_cats` CHANGE  `{$varchar_field}`  `{$varchar_field}` VARCHAR( 256 ) NULL DEFAULT NULL;");
        }
        // комментарии по умолчанию включены
        $core->db->query("ALTER TABLE  `{#}{$content_model->table_prefix}{$ctype['name']}` CHANGE  `is_comments_on`  `is_comments_on` TINYINT( 1 ) UNSIGNED NULL DEFAULT  '1'");
        // для текущих записей включаем их
        $core->db->query("UPDATE `{#}{$content_model->table_prefix}{$ctype['name']}` SET `is_comments_on` =  '1'");
        // удаляем ненужные индексы
        foreach ($remove_ctype_indexes as $table_postfix => $rcci) {
            foreach ($rcci as $index_name) {
                $core->db->dropIndex($content_model->table_prefix . $ctype['name'] . $table_postfix, $index_name);
            }
        }
        // добавляем нужные обычные индексы
        foreach ($add_ctype_indexes as $table_postfix => $indexes) {
            foreach ($indexes as $index_name => $fields) {
                $core->db->addIndex($content_model->table_prefix . $ctype['name'] . $table_postfix, $fields, $index_name);
            }
        }
        // добавляем FULLTEXT индексы только для поля title. остальные поля включаются в индекс в настройках
        foreach ($add_ctype_fulltext_indexes as $table_postfix => $fulltext_indexes) {
            foreach ($fulltext_indexes as $index_name => $fields) {
                $core->db->addIndex($content_model->table_prefix . $ctype['name'] . $table_postfix, $fields, $index_name, 'FULLTEXT');
            }
        }
    }
    if (!$core->db->isFieldExists('content_datasets', 'index')) {
        $core->db->query("ALTER TABLE `{#}content_datasets` ADD `index` VARCHAR(40) NULL DEFAULT NULL COMMENT 'Название используемого индекса' AFTER `sorting`, ADD INDEX (`index`);");
    }
    if (!$core->db->isFieldExists('controllers', 'is_external')) {
        $core->db->query("ALTER TABLE `{#}controllers` ADD `is_external` TINYINT(1) UNSIGNED NULL DEFAULT NULL COMMENT 'Сторонний компонент' AFTER `is_backend`");
    }
    if (!$core->db->isFieldExists('rss_feeds', 'template')) {
        $core->db->query("ALTER TABLE  `{#}rss_feeds` ADD  `template` VARCHAR(30) NOT NULL DEFAULT  'feed' COMMENT  'Шаблон ленты';");
    }
    if (!$core->db->isFieldExists('images_presets', 'quality')) {
        $core->db->query("ALTER TABLE  `{#}images_presets` ADD  `quality` TINYINT(1) NOT NULL DEFAULT  '90';");
    }
    if (!$core->db->getRowsCount('perms_rules', "controller = 'content' AND name = 'disable_comments'", 1)) {
        $core->db->query("INSERT INTO `{#}perms_rules` (`controller`,`name`,`type`,`options`) VALUES ('content','disable_comments','flag', NULL)");
    }
    $core->db->query("UPDATE `{#}perms_rules` SET `options` = 'own,all,full_delete' WHERE controller = 'comments' AND name = 'delete'");
    // для всех датасетов создаем индексы, если нужно
    $datasets = $content_model->select('ct.name', 'ctype_name')->joinInner('content_types', 'ct', 'ct.id = i.ctype_id')->get('content_datasets', function ($item, $model) {
        $item['filters'] = cmsModel::yamlToArray($item['filters']);
        $item['sorting'] = cmsModel::yamlToArray($item['sorting']);
        return $item;
    });
    if ($datasets) {
        foreach ($datasets as $dataset) {
            $index = $content_model->addContentDatasetIndex($dataset, $dataset['ctype_name']);
            $content_model->update('content_datasets', $dataset['id'], array('index' => $index), true);
        }
    }
    $config = cmsConfig::getInstance();
    $values = $config->getAll();
    $values['db_engine'] = 'InnoDB';
    if (!$config->save($values)) {
        cmsUser::addSessionMessage('Не могу записать файл конфигурации сайта. Добавьте в него строку <b>"db_engine" => "InnoDB",</b>', 'info');
    }
    // если вдруг для каких то компонентов нет конфига в таблице cms_controllers
    // пропускаем компонент карты сайта, т.к. там конфиг динамический
    // будем надеяться, что опции в нем хоть раз сохранялись =)
    $controllers = $content_model->filterNotEqual('name', 'sitemap')->get('controllers', function ($item, $model) {
        $item['options'] = cmsModel::yamlToArray($item['options']);
        return $item;
    }, 'name');
    foreach ($controllers as $controller) {
        $controller_root_path = cmsConfig::get('root_path') . 'system/controllers/' . $controller['name'] . '/';
        $form_file = $controller_root_path . 'backend/forms/form_options.php';
        $form_name = $controller['name'] . 'options';
        cmsCore::loadControllerLanguage($controller['name']);
        $form = cmsForm::getForm($form_file, $form_name, false);
        if ($form) {
            $options = $form->parse(new cmsRequest(cmsController::loadOptions($controller['name'])));
        } else {
            $options = null;
        }
        $content_model->filterEqual('name', $controller['name'])->updateFiltered('controllers', array('options' => $options));
    }
}
开发者ID:pin-git,项目名称:icms2,代码行数:101,代码来源:install.php

示例10: check_image_sizes

 public function check_image_sizes($destination, $dest_name)
 {
     $cfg = cmsController::loadOptions('images');
     $image_limits = getimagesize($destination);
     if ($image_limits == true && $image_limits[0] < $cfg['image_minwidth'] || $image_limits[1] < $cfg['image_minwidth']) {
         return array('error' => sprintf(LANG_UPLOAD_ERR_IMAGELIMITS, $cfg['image_minwidth'], $cfg['image_minwidth'], $image_limits[0], $image_limits[1]), 'success' => false, 'name' => "{$dest_name}");
     } else {
         return false;
     }
 }
开发者ID:asphix,项目名称:icms2,代码行数:10,代码来源:uploader.php


注:本文中的cmsController::loadOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。