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


PHP Fx::env方法代码示例

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


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

示例1: recountFiles

 public function recountFiles()
 {
     $modified_params = $this->getModifiedParams();
     $fxPath = fx::path();
     foreach ($modified_params as $field => $params) {
         $all_params = $this[$field];
         foreach ($params as $pk => $pv) {
             if (self::checkValueIsFile($pv['new'])) {
                 fx::log($pv, 'is file');
                 $ib = $this['infoblock'];
                 $site_id = $ib ? $ib['site_id'] : fx::env('site_id');
                 $file_name = $fxPath->fileName($pv['new']);
                 $new_path = $fxPath->abs('@content_files/' . $site_id . '/visual/' . $file_name);
                 $move_from = $fxPath->abs($pv['new']);
                 if (file_exists($move_from)) {
                     fx::files()->move($move_from, $new_path);
                     $all_params[$pk] = $fxPath->removeBase($fxPath->http($new_path));
                 }
             }
             if ($pv['old']) {
                 $old_path = $fxPath->abs(FX_BASE_URL . $pv['old']);
                 if (self::checkValueIsFile($old_path)) {
                     fx::files()->rm($old_path);
                 }
             }
         }
         $this[$field] = $all_params;
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:29,代码来源:Entity.php

示例2: doNeighbours

 public function doNeighbours()
 {
     $item = fx::env('page');
     $q = $this->getFinder()->order(null)->limit(1)->where('site_id', fx::env('site_id'));
     $q_next = clone $q;
     $q_prev = clone $q;
     if ($this->getParam('sorting') === 'auto' && $item['infoblock_id']) {
         $item_ib_params = fx::data('infoblock', $item['infoblock_id'])->get('params');
         $ib_sorting = $item_ib_params['sorting'];
         $this->setParam('sorting', $ib_sorting == 'manual' || $ib_sorting == 'auto' ? 'priority' : $ib_sorting);
         $this->setParam('sorting_dir', $item_ib_params['sorting_dir']);
     }
     $sort_field = $this->getParam('sorting', 'priority');
     if ($sort_field === 'auto') {
         $sort_field = 'priority';
     }
     $dir = strtolower($this->getParam('sorting_dir', 'asc'));
     $where_prev = array(array($sort_field, $item[$sort_field], $dir == 'asc' ? '<' : '>'));
     $where_next = array(array($sort_field, $item[$sort_field], $dir == 'asc' ? '>' : '<'));
     $group_by_parent = $this->getParam('group_by_parent');
     if ($group_by_parent) {
         $c_parent = fx::content($item['parent_id']);
         // todo: psr0 need verify
         $q_prev->order('parent.priority', 'desc')->where('parent.priority', $c_parent['priority'], '<=');
         $q_next->order('parent.priority', 'asc')->where('parent.priority', $c_parent['priority'], '>=');
         $where_prev[] = array('parent_id', $item['parent_id'], '!=');
         $where_next[] = array('parent_id', $item['parent_id'], '!=');
     }
     $q_prev->order($sort_field, $dir == 'asc' ? 'desc' : 'asc')->where($where_prev, null, 'or');
     $prev = $q_prev->all();
     $q_next->order($sort_field, $dir)->where($where_next, null, 'or');
     $next = $q_next->all();
     //fx::log($q_prev->showQuery(), $q_next->showQuery());
     return array('prev' => $prev, 'current' => $item, 'next' => $next);
 }
开发者ID:floxim,项目名称:module-main,代码行数:35,代码来源:Controller.php

示例3: getErrorPage

 public function getErrorPage($site_id = null)
 {
     if (is_null($site_id)) {
         $site_id = fx::env('site_id');
     }
     $error_page = fx::data('page', fx::data('site', $site_id)->get('error_page_id'));
     return $error_page;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:8,代码来源:Error.php

示例4: route

 public function route($url = null, $context = null)
 {
     if (!fx::isAdmin()) {
         return null;
     }
     if (!preg_match("~^/\\~ib/(\\d+|fake(?:\\-\\d+)?)@(\\d+)~", $url, $ib_info)) {
         return null;
     }
     $c_url = fx::input()->fetchGetPost('_ajax_base_url');
     if ($c_url) {
         $_SERVER['REQUEST_URI'] = $c_url;
         $path = fx::router()->getPath(fx::path()->removeBase($c_url));
         if ($path) {
             fx::env('page', $path->last());
         } else {
             fx::env('page', fx::router('error')->getErrorPage());
         }
         $c_url = parse_url($c_url);
         if (isset($c_url['query'])) {
             parse_str($c_url['query'], $_GET);
         }
     }
     $ib_id = $ib_info[1];
     $page_id = $ib_info[2];
     if (!fx::env('page') && $page_id) {
         $page = fx::data('floxim.main.content', $page_id);
         fx::env('page', $page);
     }
     fx::env('ajax', true);
     $page_infoblocks = fx::router('front')->getPageInfoblocks($page_id, fx::env('layout'));
     fx::page()->setInfoblocks($page_infoblocks);
     // import layout template to recreate real env
     fx::router('front')->importLayoutTemplate();
     // front end can try to reload the layout which is out of date
     // when updating from "layout settings" panel
     $infoblock = fx::data('infoblock', $ib_id);
     if (!$infoblock && isset($_POST['infoblock_is_layout']) || $infoblock->isLayout()) {
         //$infoblock = $layout_infoblock;
         $infoblock = fx::router('front')->getLayoutInfoblock(fx::env('page'));
     }
     fx::http()->status('200');
     $infoblock_overs = null;
     if (fx::isAdmin() && isset($_POST['override_infoblock'])) {
         $infoblock_overs = fx::input('post', 'override_infoblock');
         if (is_string($infoblock_overs)) {
             parse_str($infoblock_overs, $infoblock_overs);
             $infoblock_overs = fx::input()->prepareSuperglobal($infoblock_overs);
         }
         $infoblock->override($infoblock_overs);
     }
     $infoblock->overrideParam('ajax_mode', true);
     $res = $infoblock->render();
     return $res;
 }
开发者ID:floxim,项目名称:floxim,代码行数:54,代码来源:Infoblock.php

示例5: getForContent

 /**
  * Get infoblocks where content can be placed and displayed
  * 
  * @param type $content
  */
 public function getForContent($content)
 {
     if (!$content['type']) {
         return fx::collection();
     }
     $this->whereContent($content['type']);
     if (!$content['parent_id']) {
         $site_id = $content['site_id'] ? $content['site_id'] : fx::env('site_id');
         return $this->where('site_id', $site_id)->all();
     }
     return $this->getForPage($content['parent']);
 }
开发者ID:floxim,项目名称:floxim,代码行数:17,代码来源:Finder.php

示例6: postprocess

 public function postprocess($html)
 {
     if ($this->getParam('ajax_mode')) {
         $html = preg_replace("~^.+?<body[^>]*?>~is", '', $html);
         $html = preg_replace("~</body>.+?\$~is", '', $html);
     } else {
         $page = fx::env('page');
         $meta_title = empty($page['title']) ? $page['name'] : $page['title'];
         $this->showAdminPanel();
         $html = fx::page()->setMetatags('title', $meta_title)->setMetatags('description', $page['description'])->setMetatags('keywords', $page['keywords'])->postProcess($html);
     }
     return $html;
 }
开发者ID:floxim,项目名称:floxim,代码行数:13,代码来源:Layout.php

示例7: getMoreMenu

 public static function getMoreMenu()
 {
     $more_menu = array();
     $c_page = fx::env('page');
     $more_menu['edit_current_page'] = array('name' => fx::alang('Edit current page', 'system'), 'button' => array('entity' => 'content', 'action' => 'add_edit', 'content_type' => $c_page['type'], 'content_id' => $c_page['id']));
     $more_menu['layout_settings'] = array('name' => fx::alang('Layout settings', 'system'), 'button' => array('entity' => 'infoblock', 'action' => 'layout_settings', 'page_id' => fx::env('page_id')));
     $more_menu['switch_theme'] = array('name' => fx::alang('Change theme', 'system'), 'button' => array('entity' => 'layout', 'action' => 'change_theme', 'page_id' => fx::env('page_id')));
     $more_menu['page_infoblocks'] = array('name' => fx::alang('Page infoblocks', 'system'), 'button' => array('entity' => 'infoblock', 'action' => 'list_for_page', 'page_id' => fx::env('page_id')));
     $res = array('name' => fx::alang('More'), 'children' => $more_menu);
     fx::trigger('admin_more_menu_ready', array('menu' => &$res));
     $res['children'] = array_values($res['children']);
     return $res;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:13,代码来源:Adminpanel.php

示例8: execute

 public function execute($input)
 {
     if ($input['console_text']) {
         ob_start();
         $code = $input['console_text'];
         fx::env('console', true);
         fx::config('dev.on', true);
         $code = self::preProcess($code);
         eval($code);
         $res = ob_get_clean();
         return array('result' => $res);
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:13,代码来源:Console.php

示例9: getPath

 public function getPath($url, $site_id = null)
 {
     $url = preg_replace("~\\#.*\$~", '', $url);
     if (is_null($site_id)) {
         $site_id = fx::env('site_id');
     }
     // @todo check if url contains another host name
     $url = preg_replace("~^https?://.+?/~", '/', $url);
     foreach ($this->routers as $r) {
         $result = $r['router']->getPath($url, $site_id);
         if ($result) {
             return $result;
         }
     }
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:15,代码来源:Manager.php

示例10: offsetGet

 public function offsetGet($offset)
 {
     if (!$this->is_generated || !in_array($offset, self::$editable_for_generated)) {
         return parent::offsetGet($offset);
     }
     $res = null;
     $template = fx::env()->getCurrentTemplate();
     if ($template && ($context = $template->context)) {
         $res = $context->get('field_' . $this['name'] . '_' . $offset);
     }
     if ($res) {
         return $res;
     }
     return parent::offsetGet($offset);
 }
开发者ID:floxim,项目名称:module-form,代码行数:15,代码来源:Entity.php

示例11: route

 public function route($url = null, $context = null)
 {
     $adm_path = '/' . fx::config('path.admin_dir_name') . '/';
     if (trim($url, '/') === trim($adm_path, '/') && $url !== $adm_path) {
         fx::http()->redirect(fx::config('paht.admin'), 301);
     }
     if ($url !== $adm_path) {
         return null;
     }
     $input = fx::input()->makeInput();
     $entity = fx::input()->fetchPost('entity');
     $action = fx::input()->fetchPost('action');
     if (!$entity || !$action) {
         fx::page()->setBaseUrl(FX_BASE_URL . '/' . trim($adm_path, '/'));
         return new Controller\Admin();
     }
     $base_url = fx::input()->fetchPost('_base_url');
     if ($base_url) {
         $base_path = fx::router()->getPath(fx::path()->removeBase($base_url));
         if ($base_path) {
             fx::env('page', $base_path->last());
         }
     }
     fx::env('ajax', true);
     $posting = fx::input()->fetchPost('posting');
     if (!preg_match("~^module_~", $entity) || fx::input()->fetchPost('fx_admin')) {
         $entity = 'admin_' . $entity;
     }
     if ($posting && $posting !== 'false') {
         $action .= "_save";
     }
     $path = explode('_', $entity, 2);
     if ($path[0] == 'admin') {
         $classname = 'Floxim\\Floxim\\Admin\\Controller\\' . fx::util()->underscoreToCamel($path[1]);
     } else {
         // todo: psr0 what?
     }
     try {
         $controller = new $classname($input, $action);
     } catch (\Exception $e) {
         die("Error! Entity: " . htmlspecialchars($entity));
     }
     //header("Content-type: application/json; charset=utf-8");
     return $controller;
 }
开发者ID:floxim,项目名称:floxim,代码行数:45,代码来源:Admin.php

示例12: contentExists

 public function contentExists()
 {
     static $content_by_type = null;
     if (is_null($content_by_type)) {
         $res = fx::db()->getResults('select `type`, count(*) as cnt ' . 'from {{floxim_main_content}} ' . 'where site_id = "' . fx::env('site_id') . '" ' . 'group by `type`');
         $content_by_type = fx::collection($res)->getValues('cnt', 'type');
     }
     $com = $this->getComponent();
     if (isset($content_by_type[$com['keyword']])) {
         return true;
     }
     foreach ($com->getAllChildren() as $child) {
         if (isset($content_by_type[$child['keyword']])) {
             return true;
         }
     }
     return false;
 }
开发者ID:floxim,项目名称:module-main,代码行数:18,代码来源:Finder.php

示例13: getByUrl

 /**
  * get page (urlAlias) by url string
  *
  * @param string url string
  *
  * @return object page
  */
 public function getByUrl($url, $site_id = null)
 {
     $url_variants = array($url);
     if ($site_id === null) {
         $site_id = fx::env('site_id');
     }
     $url_with_no_params = preg_replace("~\\?.+\$~", '', $url);
     $url_variants[] = preg_match("~/\$~", $url_with_no_params) ? preg_replace("~/\$~", '', $url_with_no_params) : $url_with_no_params . '/';
     if ($url_with_no_params != $url) {
         $url_variants[] = $url_with_no_params;
     }
     // get alias by url
     $alias = fx::data('urlAlias')->where('url', $url_variants)->where('site_id', $site_id)->one();
     if (!$alias) {
         return null;
     }
     // get page by id
     $page = $this->getById($alias['page_id']);
     return $page;
 }
开发者ID:floxim,项目名称:module-main,代码行数:27,代码来源:Finder.php

示例14: __construct

 public function __construct()
 {
     $this->options['login'] = 'admin';
     $this->options['action_link'] = fx::config('path.admin');
     $this->addMoreMenu(Controller\Adminpanel::getMoreMenu());
     $this->addButtons(Controller\Adminpanel::getButtons());
     $main_menu = array('manage' => array('name' => fx::alang('Management', 'system'), 'key' => 'manage', 'href' => '/floxim/#admin.administrate.site.all'), 'develop' => array('name' => fx::alang('Development', 'system'), 'key' => 'develop', 'href' => '/floxim/#admin.component.all'));
     $site = fx::env('site');
     if ($site) {
         $main_menu['site'] = array('name' => fx::env('site')->getLocalDomain(), 'key' => 'site', 'href' => '/');
         $other_sites = fx::data('site')->where('id', $site['id'], '!=')->all();
         if (count($other_sites) > 0) {
             $main_menu['site']['children'] = array();
             foreach ($other_sites as $other_site) {
                 $domain = $other_site->getLocalDomain();
                 $main_menu['site']['children'][] = array('name' => $domain, 'href' => 'http://' . $domain . '/');
             }
         }
     }
     $this->addMainMenu($main_menu);
 }
开发者ID:floxim,项目名称:floxim,代码行数:21,代码来源:Configjs.php

示例15: getLayoutInfoblock

 public function getLayoutInfoblock($page)
 {
     if (!is_object($page)) {
         fx::log(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
     }
     $path = $page->getPath()->copy()->reverse();
     foreach ($path as $c_page) {
         if (method_exists($c_page, 'getLayoutInfoblock')) {
             $layout_ib = $c_page->getLayoutInfoblock();
             break;
         }
     }
     if ($layout_ib->getVisual()->get('is_stub') || !$layout_ib->getTemplate()) {
         $suitable = new Template\Suitable();
         //$infoblocks = $page->getPageInfoblocks();
         $infoblocks = fx::data('infoblock')->getForPage($page);
         // delete all parent layouts from collection
         $infoblocks->findRemove(function ($ib) use($layout_ib) {
             return $ib->isLayout() && $ib['id'] !== $layout_ib['id'];
         });
         $suitable->suit($infoblocks, fx::env('layout_id'));
         return $infoblocks->findOne(function ($ib) {
             return $ib->isLayout();
         });
     }
     return $layout_ib;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:27,代码来源:Front.php


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