本文整理汇总了PHP中cmsConfig::get方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsConfig::get方法的具体用法?PHP cmsConfig::get怎么用?PHP cmsConfig::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsConfig
的用法示例。
在下文中一共展示了cmsConfig::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($do = false)
{
$updater = new cmsUpdater();
$update = $updater->checkUpdate();
if ($update == cmsUpdater::UPDATE_NOT_AVAILABLE) {
cmsUser::addSessionMessage(LANG_CP_UPDATE_NOT_AVAILABLE);
$this->redirectToAction('update');
}
if ($update == cmsUpdater::UPDATE_CHECK_ERROR || empty($update['version'])) {
cmsUser::addSessionMessage(LANG_CP_UPDATE_CHECK_FAIL, 'error');
$this->redirectToAction('update');
}
if (!function_exists('curl_init')) {
cmsUser::addSessionMessage(LANG_CP_UPDATE_DOWNLOAD_FAIL, 'error');
$this->redirectToAction('update');
}
$url = $update['url'];
$package_name = basename($url);
$destination = cmsConfig::get('upload_path') . 'installer/' . $package_name;
$result = file_save_from_url($url, $destination);
if ($result === false) {
cmsUser::addSessionMessage(LANG_CP_UPDATE_DOWNLOAD_FAIL, 'error');
$this->redirectToAction('update');
}
$this->redirectToAction('install', false, array('package_name' => $package_name));
}
示例2: displayEditor
public function displayEditor($field_id, $content = '')
{
$lang = cmsConfig::get('language');
$user = cmsUser::getInstance();
cmsTemplate::getInstance()->addJS('wysiwyg/tinymce/tinymce.min.js');
$dom_id = str_replace(array('[', ']'), array('_', ''), $field_id);
echo html_textarea($field_id, $content, array('id' => $dom_id));
?>
<script type="text/javascript" >
$(document).ready(function(){
tinymce.init({mode : "exact",
elements : "<?php
echo $field_id;
?>
",
language : "ru",
plugins: [
"link image lists media responsivefilemanager "
],
relative_urls: false,
filemanager_title:"Responsive Filemanager",
external_filemanager_path:"/filemanager/",
external_plugins: { "filemanager" : "/filemanager/plugin.min.js"},
image_advtab: true,
toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | styleselect",
toolbar2: "| responsivefilemanager | image | media | link unlink anchor | "
});
});
</script>
<?php
}
示例3: displayEditor
public function displayEditor($field_id, $content = '')
{
$lang = cmsConfig::get('language');
$user = cmsUser::getInstance();
cmsTemplate::getInstance()->addCSS('wysiwyg/ckeditor/samples/sample.css');
cmsTemplate::getInstance()->addJS('wysiwyg/ckeditor/ckeditor.js');
$dom_id = str_replace(array('[', ']'), array('_', ''), $field_id);
echo html_textarea($field_id, $content, array('id' => $dom_id));
?>
<script type="text/javascript" >
<?php
if ($user->is_admin) {
?>
$(document).ready(function(){
CKEDITOR.replace('<?php
echo $dom_id;
?>
',{
});
});
<?php
}
?>
</script>
<?php
}
示例4: __construct
public function __construct($name = '')
{
$this->site_config = cmsConfig::getInstance();
if ($name) {
$this->setName($name);
} else {
$device_type = cmsRequest::getDeviceType();
$template = $this->site_config->template;
// шаблон в зависимости от девайса
if ($device_type !== 'desktop') {
$device_template = cmsConfig::get('template_' . $device_type);
if ($device_template) {
$template = $device_template;
}
}
// шаблон админки, можем определить только тут
$controller = cmsCore::getInstance()->uri_controller;
if ($controller === 'admin' && $this->site_config->template_admin) {
$template = $this->site_config->template_admin;
}
$this->setName($template);
}
$this->options = $this->getOptions();
$this->setInheritNames($this->getInheritTemplates());
$this->title = $this->site_config->sitename;
$is_no_def_meta = isset($this->site_config->is_no_meta) ? $this->site_config->is_no_meta : false;
if (!$is_no_def_meta) {
$this->metakeys = $this->site_config->metakeys;
$this->metadesc = $this->site_config->metadesc;
}
}
示例5: clean
public function clean($key)
{
if (!cmsConfig::get('cache_enabled')) {
return false;
}
return $this->cacher->clean($key);
}
示例6: run
public function run()
{
if (cmsUser::isLogged()) {
$this->redirectToHome();
}
$email = $this->request->get('login_email');
$password = $this->request->get('login_password');
$remember = (bool) $this->request->get('remember');
$back_url = $this->request->has('back') ? $this->request->get('back') : false;
$is_site_offline = !cmsConfig::get('is_site_on');
if ($this->request->has('submit')) {
$is_captcha_valid = true;
if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
$is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
}
if ($is_captcha_valid) {
cmsUser::sessionUnset('is_auth_captcha');
$logged_id = cmsUser::login($email, $password, $remember);
if ($logged_id) {
if ($is_site_offline) {
$userSession = cmsUser::sessionGet('user');
if (!$userSession['is_admin']) {
cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
cmsUser::logout();
$this->redirectBack();
}
}
cmsEventsManager::hook('auth_login', $logged_id);
$is_back = $this->request->get('is_back');
if ($is_back) {
$this->redirectBack();
}
if ($back_url) {
$this->redirect($back_url);
} else {
$this->redirectToHome();
}
}
}
if ($this->options['auth_captcha'] && !$is_site_offline) {
cmsUser::sessionSet('is_auth_captcha', true);
}
if ($is_captcha_valid) {
cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
if ($is_site_offline) {
$this->redirectBack();
}
} else {
cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
}
}
if ($back_url) {
cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
}
if (cmsUser::sessionGet('is_auth_captcha')) {
$captcha_html = cmsEventsManager::hook('captcha_html');
}
return cmsTemplate::getInstance()->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
}
示例7: isAllowByIp
private function isAllowByIp()
{
$allow_ips = cmsConfig::get('allow_ips');
if (!$allow_ips) {
return true;
}
return string_in_mask_list(cmsUser::getIp(), $allow_ips);
}
示例8: getPathAndFile
public function getPathAndFile($key)
{
$path = cmsConfig::get('cache_path') . str_replace('.', '/', $key);
$file = explode('/', $path);
$path = dirname($path);
$file = $path . '/' . $file[sizeof($file) - 1] . '.dat';
return array($path, $file);
}
示例9: init
public function init($do)
{
$groups = cmsCore::getModel('users')->getGroups();
return array('basic' => array('type' => 'fieldset', 'childs' => array(new fieldString('title', array('title' => LANG_USERS_MIG_TITLE, 'rules' => array(array('required'), array('max_length', 256)))), new fieldCheckbox('is_active', array('title' => LANG_USERS_MIG_IS_ACTIVE)))), array('type' => 'fieldset', 'childs' => array(new fieldList('is_keep_group', array('title' => LANG_USERS_MIG_ACTION, 'items' => array(0 => LANG_USERS_MIG_ACTION_CHANGE, 1 => LANG_USERS_MIG_ACTION_ADD))), new fieldList('group_from_id', array('title' => LANG_USERS_MIG_FROM, 'generator' => function () use($groups) {
return array_collection_to_list($groups, 'id', 'title');
})), new fieldList('group_to_id', array('title' => LANG_USERS_MIG_TO, 'generator' => function () use($groups) {
return array_collection_to_list($groups, 'id', 'title');
})))), array('type' => 'fieldset', 'childs' => array(new fieldCheckbox('is_passed', array('title' => LANG_USERS_MIG_COND_DATE)), new fieldList('passed_from', array('title' => LANG_USERS_MIG_PASSED_FROM, 'items' => array(0 => LANG_USERS_MIG_PASSED_REG, 1 => LANG_USERS_MIG_PASSED_MIG))), new fieldNumber('passed_days', array('title' => LANG_USERS_MIG_PASSED)))), array('type' => 'fieldset', 'childs' => array(new fieldCheckbox('is_rating', array('title' => LANG_USERS_MIG_COND_RATING)), new fieldNumber('rating', array('title' => LANG_USERS_MIG_RATING)))), array('type' => 'fieldset', 'childs' => array(new fieldCheckbox('is_karma', array('title' => LANG_USERS_MIG_COND_KARMA)), new fieldNumber('karma', array('title' => LANG_USERS_MIG_KARMA)))), array('type' => 'fieldset', 'childs' => array(new fieldCheckbox('is_notify', array('title' => LANG_USERS_MIG_NOTIFY)), new fieldHtml('notify_text', array('title' => LANG_USERS_MIG_NOTIFY_TEXT, 'options' => array('editor' => cmsConfig::get('default_editor')))))));
}
示例10: run
public function run()
{
// автоматическое получение опций через $this->options здесь не
// работает, потому что форма опций не содержит полей, они заполняются
// динамически в админке
$options = $this->loadOptions($this->name);
if (!$options) {
return false;
}
$sources_list = $options['sources'];
if (!$sources_list) {
return false;
}
$config = cmsConfig::getInstance();
if (!is_writable($config->root_path . 'cache/static/sitemaps/')) {
return false;
}
$sources = array();
$sitemaps = array();
foreach ($sources_list as $item => $is_enabled) {
if (!$is_enabled) {
continue;
}
list($controller_name, $source) = explode('|', $item);
$sources[$controller_name][] = $source;
}
foreach ($sources as $controller_name => $items) {
$urls = array();
$controller = cmsCore::getController($controller_name);
foreach ($items as $item) {
$urls = $controller->runHook('sitemap_urls', array($item));
if (!$urls) {
continue;
}
if (count($urls) > $this->max_count) {
$chunk_data = array_chunk($urls, $this->max_count, true);
foreach ($chunk_data as $index => $chunk_urls) {
$index = $index ? '_' . $index : '';
$xml = cmsTemplate::getInstance()->renderInternal($this, 'sitemap', array('urls' => $chunk_urls));
$sitemap_file = "sitemap_{$controller_name}_{$item}{$index}.xml";
file_put_contents($config->root_path . "cache/static/sitemaps/{$sitemap_file}", $xml);
$sitemaps[] = $sitemap_file;
}
} else {
$xml = cmsTemplate::getInstance()->renderInternal($this, 'sitemap', array('urls' => $urls));
$sitemap_file = "sitemap_{$controller_name}_{$item}.xml";
file_put_contents($config->root_path . "cache/static/sitemaps/{$sitemap_file}", $xml);
$sitemaps[] = $sitemap_file;
}
}
}
$xml = cmsTemplate::getInstance()->renderInternal($this, 'sitemap_index', array('sitemaps' => $sitemaps, 'host' => $config->host));
file_put_contents(cmsConfig::get('root_path') . 'cache/static/sitemaps/sitemap.xml', $xml);
return true;
}
示例11: getFilterInput
public function getFilterInput($value)
{
if ($this->getOption('filter_range')) {
$from = !empty($value['from']) ? date(cmsConfig::get('date_format'), strtotime($value['from'])) : false;
$to = !empty($value['to']) ? date(cmsConfig::get('date_format'), strtotime($value['to'])) : false;
$this->title = false;
return cmsTemplate::getInstance()->renderFormField($this->class . "_range", array('field' => $this, 'from' => $from, 'to' => $to));
} else {
return parent::getFilterInput($value);
}
}
示例12: getOptions
public function getOptions()
{
return array(new fieldList('editor', array('title' => LANG_PARSER_HTML_EDITOR, 'default' => cmsConfig::get('default_editor'), 'generator' => function ($item) {
$items = array();
$editors = cmsCore::getWysiwygs();
foreach ($editors as $editor) {
$items[$editor] = $editor;
}
return $items;
})), new fieldCheckbox('is_html_filter', array('title' => LANG_PARSER_HTML_FILTERING)), new fieldCheckbox('build_redirect_link', array('title' => LANG_PARSER_BUILD_REDIRECT_LINK)), new fieldNumber('teaser_len', array('title' => LANG_PARSER_HTML_TEASER_LEN, 'hint' => LANG_PARSER_HTML_TEASER_LEN_HINT)), new fieldCheckbox('in_fulltext_search', array('title' => LANG_PARSER_IN_FULLTEXT_SEARCH, 'hint' => LANG_PARSER_IN_FULLTEXT_SEARCH_HINT, 'default' => false)));
}
示例13: run
public function run($data)
{
list($ctype, $profile) = $data;
if (!empty($ctype['options']['is_rss'])) {
$title = $profile['nickname'] . ' - ' . $ctype['title'];
$feed_title = sprintf(LANG_RSS_FEED_TITLE_FORMAT, $title, cmsConfig::get('sitename'));
$feed_url = href_to_abs($this->name, 'feed', $ctype['name']) . '?user=' . $profile['id'];
$link_tag = '<link title="' . $feed_title . '" type="application/rss+xml" rel="alternate" href="' . $feed_url . '">';
cmsTemplate::getInstance()->addHead($link_tag);
}
return array($ctype, $profile);
}
示例14: parse
public function parse($value)
{
$href = $value;
if ($this->getOption('auto_http')) {
if (!preg_match('/^([a-z]+):\\/\\/(.+)$/i', $href)) {
$href = 'http://' . $href;
}
}
if ($this->getOption('redirect')) {
$href = cmsConfig::get('root') . 'redirect?url=' . $href;
}
return '<a href="' . htmlspecialchars($href) . '">' . $value . '</a>';
}
示例15: init
public function init()
{
return array('basic' => array('type' => 'fieldset', 'title' => LANG_RSS_FEED_BASIC, 'childs' => array(new fieldCheckbox('is_enabled', array('title' => LANG_RSS_FEED_ENABLED)), new fieldString('description', array('title' => LANG_RSS_FEED_DESC)), new fieldNumber('limit', array('title' => LANG_RSS_FEED_LIMIT, 'rules' => array(array('required'), array('digits'), array('min', 1), array('max', 50)))), new fieldList('template', array('title' => LANG_RSS_FEED_TEMPLATE, 'hint' => LANG_RSS_FEED_TEMPLATE_HINT, 'generator' => function ($item) {
$tpls = cmsCore::getFilesList('templates/' . cmsConfig::get('template') . '/controllers/rss/', '*.tpl.php');
$items = array();
if ($tpls) {
foreach ($tpls as $tpl) {
$items[str_replace('.tpl.php', '', $tpl)] = $tpl;
}
}
return $items;
})))), 'image' => array('type' => 'fieldset', 'title' => LANG_RSS_FEED_IMAGE, 'childs' => array(new fieldImage('image', array()))), 'cache' => array('type' => 'fieldset', 'title' => LANG_RSS_FEED_CACHING, 'childs' => array(new fieldCheckbox('is_cache', array('title' => LANG_RSS_FEED_CACHE)), new fieldNumber('cache_interval', array('title' => LANG_RSS_FEED_CACHE_INT, 'rules' => array(array('digits'), array('min', 1)))))));
}