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


PHP CMS::vars方法代码示例

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


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

示例1: action_prefix

 public function action_prefix($name, $data, $item = false, $fields = array())
 {
     $id = (int) WS::env()->request['id'];
     $item = CMS::vars()->db()->find($id);
     if ($item) {
         return $item->full_code . '.';
     }
     return '';
 }
开发者ID:techart,项目名称:tao,代码行数:9,代码来源:Fields.php

示例2: struct

 protected function struct()
 {
     if (is_callable(CMS::$navigation_struct)) {
         return call_user_func(CMS::$navigation_struct);
     }
     if (is_string(self::$var)) {
         return CMS::vars()->get(self::$var);
     }
     return array();
 }
开发者ID:techart,项目名称:tao,代码行数:10,代码来源:Navigation3.php

示例3: setup

 public function setup()
 {
     if (CMS::vars()->storage_type() == 'orm') {
         $this->orm_name = 'vars';
     }
     if (CMS::vars()->storage_type() == 'storage') {
         $this->storage_name = 'vars';
     }
     return parent::setup();
 }
开发者ID:techart,项目名称:tao,代码行数:10,代码来源:FieldsAdminVars.php

示例4: get_var_value

 protected function get_var_value($name)
 {
     $site = false;
     if ($m = Core_Regexps::match_with_results('{^(.+)/([^/]+)$}', $name)) {
         $name = trim($m[1]);
         $site = trim($m[2]);
         if ($site == '*') {
             $site = CMS_Admin::site();
         }
     }
     return CMS::vars()->get($name, $site);
 }
开发者ID:techart,项目名称:tao,代码行数:12,代码来源:AdminTable.php

示例5: run

 static function run()
 {
     if (!CMS::vars()->exists('admin')) {
         CMS::vars()->storage()->create_dir('admin', array('_title' => 'Настройки системы администрирования', '_access' => 'full'));
     }
     if (!CMS::vars()->exists('admin.title')) {
         $var = CMS::vars()->entity('string');
         $var['_name'] = 'admin.title';
         $var['_access'] = 'full';
         $var['_title'] = 'Заголовок';
         $var['value'] = 'Система управления сайтом';
         CMS::vars()->storage()->save($var);
     }
     if (!CMS::vars()->exists('admin.navigation')) {
         $var = CMS::vars()->entity('array');
         $var['_name'] = 'admin.navigation';
         $var['_access'] = 'full';
         $var['_title'] = 'Структура навигации';
         $var['array'] = array('Настройки' => '/admin/vars/');
         $var['array_src'] = "Настройки = /admin/vars/";
         CMS::vars()->storage()->save($var);
     }
     if (!CMS::vars()->exists('navigation')) {
         $var = CMS::vars()->entity('array');
         $var['_name'] = 'navigation';
         $var['_access'] = 'full';
         $var['_title'] = 'Структура навигации';
         $var['array'] = array();
         $var['array_src'] = '';
         CMS::vars()->storage()->save($var);
     }
     if (!CMS::vars()->exists('head')) {
         $var = CMS::vars()->entity('array');
         $var['_name'] = 'head';
         $var['_access'] = '';
         $var['_title'] = 'Мета-теги по умолчанию';
         $var['array'] = array();
         $var['array_src'] = '';
         CMS::vars()->storage()->save($var);
     }
 }
开发者ID:techart,项目名称:tao,代码行数:41,代码来源:Init.php

示例6: change

 public function change($parms)
 {
     $id = (int) $parms['id'];
     $item = CMS::vars()->db()->find($id);
     $rc = CMS::vars()->type($item->vartype)->change($id, $this->request, $item);
     Events::call('admin.change', $item);
     if (is_string($rc)) {
         $component = $parms['component'];
         $this->component = $component;
         return $this->render('index', array('title' => $this->get_title($item), 'id' => $id, 'error' => $rc, 'item' => $item, '_change' => $this->make_uri('change', $id), '_addfile' => $this->make_uri('addfile', $id), '_up' => $this->make_uri('dir', $item->parent_id)));
     } else {
         return $this->redirect_to($this->make_uri('dir', $item->parent_id));
     }
 }
开发者ID:techart,项目名称:tao,代码行数:14,代码来源:AdminVars.php

示例7: get_var_description

 public function get_var_description()
 {
     return Core::make('Text.Process')->process(CMS::vars()->type($this->vartype)->list_value($this), 'plaintext');
 }
开发者ID:techart,项目名称:tao,代码行数:4,代码来源:ORM.php

示例8: change

 public function change($id, $data, $item)
 {
     if (is_object($item)) {
         $item->id = $id;
     }
     $file = $_FILES['value'];
     $name = trim($file['name']);
     $tmp_name = trim($file['tmp_name']);
     if ($tmp_name != '') {
         $dir = "./" . Core::option('files_name') . "/vars/{$id}";
         CMS::mkdirs($dir, 0775);
         foreach (IO_FS::Dir($dir) as $f) {
             @IO_FS::rm($f->path);
         }
         $name = CMS::translit(mb_strtolower($name));
         $name = preg_replace('{\\s+}', '_', $name);
         $name = trim(preg_replace('{[^a-z0-9_\\.\\-]}', '', $name));
         if ($name == '') {
             $name = 'noname';
         }
         if ($name[0] == '.') {
             $name = "noname.{$name}";
         }
         move_uploaded_file($tmp_name, "{$dir}/{$name}");
         chmod("{$dir}/{$name}", 0775);
         $rc = CMS::vars()->on_change_call($id, $value, $data);
         if (is_string($rc)) {
             $item->valuesrc = $data['valuesrc'];
             return $rc;
         }
         $item->value = "{$dir}/{$name}";
         $item->update_value();
     }
 }
开发者ID:techart,项目名称:tao,代码行数:34,代码来源:Types.php

示例9: MAPS

 static function MAPS($parms = false)
 {
     if (!CMS::layout_view()) {
         return '';
     }
     Core::load('Templates.HTML.Helpers.Maps');
     $parms = explode(';', $parms);
     $type = trim($parms[0]);
     $map_id = trim($parms[1]);
     $name = trim($parms[2]);
     $options = CMS::vars()->get($name);
     return CMS::layout_view()->maps->map($type, $map_id, $name, $options);
 }
开发者ID:techart,项目名称:tao,代码行数:13,代码来源:Insertions.php

示例10: info

 public function info()
 {
     $info = $this->attributes;
     $info['_type'] = $this->_type;
     $info['_name'] = $this->_name;
     foreach (CMS::vars()->config_fields() as $field => $data) {
         $info[$field] = $this->{$field};
     }
     return $info;
 }
开发者ID:techart,项目名称:tao,代码行数:10,代码来源:Vars2.php

示例11: branch

 protected function branch($dir_path, $prefix = '')
 {
     $vars = array();
     $dirs = array();
     foreach (IO_FS::Dir($dir_path) as $entry) {
         $filename = $entry->name;
         if (Core_Regexps::match('{^[a-z0-9_-]+$}i', $filename)) {
             $path = $entry->path;
             $name = $prefix . $filename;
             if (is_dir($path)) {
                 if (IO_FS::exists("{$path}/.info")) {
                     $info = $this->load_info("{$path}/.info");
                     if ($info) {
                         $var = CMS::vars()->entity('dir', $info);
                         $var->vars = $this->branch($path, "{$name}.");
                         $dirs[$name] = $var;
                     }
                 }
             } else {
                 $var = $this->load($name);
                 if ($var) {
                     $vars[$name] = $var;
                 }
             }
         }
     }
     ksort($vars);
     ksort($dirs);
     $out = array();
     $out += $vars;
     $out += $dirs;
     return $out;
 }
开发者ID:techart,项目名称:tao,代码行数:33,代码来源:FS.php

示例12: form_fields

 protected function form_fields($action)
 {
     $fields = array();
     if ($action == 'list') {
     } elseif ($action == 'add') {
         $fields = array();
         if ($this->is_admin()) {
             $fields['_name'] = array('type' => 'input', 'style' => 'width: 200px;', 'tab' => 'config', 'caption' => CMS::lang('%LANG{en}Name%LANG{ru}Мнемокод'));
             if (isset($_GET['chapter'])) {
                 $pchapter = trim($_GET['chapter']);
                 if ($pchapter != '') {
                     $pchapter .= '.';
                 }
                 $fields['_name']['obligatory_prefix'] = $pchapter;
                 $fields['_type'] = array('type' => 'select', 'items' => CMS::vars()->types_list(), 'caption' => CMS::lang('%LANG{en}Type%LANG{ru}Тип'), 'tab' => 'config');
             }
         }
     } else {
         $var = $this->edit_item;
         if (!$var->is_dir()) {
             $fields = array('vname' => array('type' => 'subheader', 'tab' => 'default', 'caption' => $var->id() . ': ' . $var->title()));
             $fields += $var->fields($var);
         }
     }
     if ($this->is_admin()) {
         $fields['_title'] = array('type' => 'input', 'style' => 'width: 100%;', 'tab' => 'config', 'caption' => CMS::lang('%LANG{en}Title%LANG{ru}Название'));
         $fields['_access'] = array('type' => 'input', 'style' => 'width: 200px;', 'tab' => 'config', 'caption' => CMS::lang('%LANG{en}Access%LANG{ru}Доступ'));
         $fields['_delsubheader'] = array('type' => 'subheader', 'style' => 'width: 200px;', 'tab' => 'config', 'caption' => CMS::lang(' '));
         static $ev = false;
         if (!$ev) {
             Events::add_listener('cms.fields.admin.mainform._delsubheader.after', function ($parms) {
                 $var = $parms['item'];
                 $url = WS::env()->urls->adminvars->delete_url($var->name());
                 if ($url == '#') {
                     return;
                 }
                 $title = 'Удалить';
                 $confirm = 'Вы уверены?';
                 print "<a href='{$url}' onClick='return confirm(\"{$confirm}\")' class='icon-button'><em style='background-image: url(/tao/images/del.png);'>{$title}</em></a>";
             });
             $ev = true;
         }
     }
     return $fields;
 }
开发者ID:techart,项目名称:tao,代码行数:45,代码来源:Controller.php

示例13: process_app

 /**
  * @param WebKit_Environment   $env
  * @param WebKit_HTTP_Response $response
  *
  * @return Iterator
  */
 public function process_app(WS_Environment $env, $response)
 {
     $uri = $env->request->urn;
     $original_uri = $uri;
     CMS::$original_uri = $uri;
     CMS::$site = CMS::$defsite;
     if (isset(CMS::$sites[CMS::$defsite]['page_main'])) {
         CMS::$page_main = CMS::$sites[CMS::$defsite]['page_main'];
     }
     $_defdata = false;
     if (isset(CMS::$sites[CMS::$defsite])) {
         $_defdata = CMS::$sites[CMS::$defsite];
     }
     if (isset(CMS::$sites)) {
         foreach (CMS::$sites as $site => $data) {
             $_host = isset($data['host']) ? trim($data['host']) : '';
             $_prefix = isset($data['prefix']) ? trim($data['prefix']) : '';
             if ($_host != '' || $_prefix != '') {
                 $_bhost = false;
                 $_bprefix = false;
                 $_uri = $uri;
                 if ($_prefix != '') {
                     if ($m = Core_Regexps::match_with_results('{^/' . $_prefix . '/(.*)$}', $uri)) {
                         $_uri = '/' . $m[1];
                         $_bprefix = true;
                     } else {
                         continue;
                     }
                 }
                 if ($_host != '') {
                     if ($env->request->host == $_host) {
                         $_bhost = true;
                     } else {
                         if ($_host[0] == '{') {
                             if (Core_Regexps::match($_host, $env->request->host)) {
                                 $_bhost = true;
                             } else {
                                 continue;
                             }
                         } else {
                             continue;
                         }
                     }
                 }
                 if ($_bprefix || $_bhost) {
                     CMS::$site = $site;
                     if ($_bprefix) {
                         CMS::$site_prefix = '/' . $_prefix;
                     }
                     $uri = $_uri;
                     $env->request->uri($uri);
                     $_defdata = $data;
                     break;
                 }
             }
         }
     }
     if ($_defdata) {
         if (isset($_defdata['page_main'])) {
             CMS::$page_main = $_defdata['page_main'];
         }
         if (isset($_defdata['page_404'])) {
             CMS::$page_404 = $_defdata['page_404'];
         }
         if (isset($_defdata['layout'])) {
             CMS::$force_layout = $_defdata['layout'];
         }
     }
     if (CMS::$db) {
         $head = CMS::vars()->get('head');
         if (isset($head['meta.title'])) {
             $env->meta->title($head['meta.title']);
         }
         if (isset($head['meta.description'])) {
             $env->meta->description($head['meta.description']);
         }
         if (isset($head['meta.keywords'])) {
             $env->meta->keywords($head['meta.keywords']);
         }
     }
     $curi = $uri;
     if ($m = Core_Regexps::match_with_results('/^([^\\?]+)\\?/', $curi)) {
         $curi = $m[1];
     }
     $use_layout = false;
     // Просмотр всех мапперов зарегистрированных в системе
     foreach (CMS::mappers() as $name => $mapper) {
         // Если срабатывает маппер
         if ($route = $mapper->route($env->request)) {
             CMS::$current_mapper = $mapper;
             CMS::$current_component_name = $name;
             CMS::$current_route = $route;
             try {
                 Core::load('Component.' . $name);
//.........这里部分代码省略.........
开发者ID:techart,项目名称:tao,代码行数:101,代码来源:Handlers.php

示例14: action_chparms

 public function action_chparms()
 {
     $id = (int) $this->args[0];
     $item = CMS::vars()->db()->find($id);
     $item->chparms($this->request);
     //CMS_Var::chparms($id,$this->request);
     $uri = $this->make_uri('dir', $item->parent_id);
     Events::call('admin.change', $item);
     return $this->redirect_to($uri);
 }
开发者ID:techart,项目名称:tao,代码行数:10,代码来源:TreeAdminVars.php


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