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


PHP Fx::http方法代码示例

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


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

示例1: route

 public function route($url = null, $context = null)
 {
     if ($url instanceof \Floxim\Main\Page\Entity) {
         $url = fx::collection(array($url));
     }
     if ($url instanceof \Floxim\Floxim\System\Collection) {
         $path = $url;
         $url = $path->last()->get('url');
     } else {
         $url = preg_replace("~^/~", '', $url);
         $path = $this->getPath($url, $context['site_id']);
         if (!$path) {
             return;
         }
     }
     $page = $path->last();
     if (!$page) {
         return null;
     } else {
         $url = preg_replace("~\\?.+\$~", '', $url);
         if ($url && !$page->hasVirtualPath() && urldecode($url) != $page['url'] && $page['url'] !== '404/') {
             fx::http()->redirect($page['url'], 301);
             fx::debug($url, '!=', $page['url']);
             die;
         }
     }
     fx::env('page', $page);
     fx::http()->status('200');
     $layout_ib = $this->getLayoutInfoblock($page);
     fx::trigger('before_layout_render', array('layout_infoblock' => $layout_ib));
     $res = $layout_ib->render();
     return $res;
 }
开发者ID:floxim,项目名称:floxim,代码行数:33,代码来源:Front.php

示例2: route

 public function route($url = null, $context = null)
 {
     $site_id = isset($context['site_id']) ? $context['site_id'] : fx::env('site');
     $error_page = $this->getErrorPage($site_id);
     $ctr = fx::router('front')->route($error_page['url'], $context);
     fx::http()->status('404');
     return $ctr;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:8,代码来源:Error.php

示例3: 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

示例4: uploadSave

 public function uploadSave($input)
 {
     $path = 'upload';
     $result = fx::files()->saveFile($input['file'], $path);
     if (!$result) {
         $result = array('error_message' => 'Can not load this file');
         fx::http()->status(500);
     }
     if (isset($input['format']) && !empty($input['format']) && isset($result['path'])) {
         $result['formatted_value'] = fx::image($result['path'], $input['format']);
     }
     return $result;
 }
开发者ID:floxim,项目名称:floxim,代码行数:13,代码来源:File.php

示例5: doAdd

 public function doAdd()
 {
     if (isset($_POST["addcomment"]) && isset($_POST["user_name"]) && !empty($_POST["user_name"]) && isset($_POST["comment_text"]) && !empty($_POST["comment_text"])) {
         $comments = fx::data('comment')->create(array('user_name' => $_POST["user_name"], 'comment_text' => $_POST["comment_text"], 'publish_date' => date("Y-m-d H:i:s"), 'parent_id' => $this->getParentId(), 'infoblock_id' => $this->getParam('target_infoblock_id')));
         $comments->save();
         if (!isset($_COOKIE["own_comments"])) {
             setcookie('own_comments', $comments["id"], time() + 60 * 60 * 24 * 30);
         } else {
             setcookie('own_comments', $_COOKIE["own_comments"] . ',' . $comments["id"], time() + 60 * 60 * 24 * 30);
         }
         fx::http()->refresh();
     }
 }
开发者ID:floxim,项目名称:module-blog,代码行数:13,代码来源:Controller.php

示例6: 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

示例7: route

 public function route($url = null, $context = null)
 {
     $path = fx::router()->getPath($url, $context['site_id']);
     if (!$path) {
         return;
     }
     $page = $path->last();
     if (!$page) {
         return null;
     } else {
         $url = preg_replace("~\\?.+\$~", '', $url);
         if ($url && !$page->hasVirtualPath() && urldecode($url) != $page['url'] && $page['url'] !== '/404/') {
             fx::http()->redirect($page['url'], 301);
             exit;
         }
     }
     fx::env('page', $page);
     fx::http()->status('200');
     $layout_ib = $this->getLayoutInfoblock($page);
     fx::trigger('before_layout_render', array('layout_infoblock' => $layout_ib));
     $res = $layout_ib->render();
     return $res;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:23,代码来源:Front.php

示例8: doFormCreate

 public function doFormCreate()
 {
     $user = fx::env('user');
     $item = $this->getFinder()->create();
     $form = $this->initDataForm('create');
     $target_infoblock = $this->getParam('target_infoblock');
     $item['infoblock_id'] = $target_infoblock;
     if (!$user->can('see_create_form', $item)) {
         return false;
     }
     $this->assign('form', $form);
     $this->assign('item', $item);
     $fields = $item->getFormFields();
     $form->addFields($fields);
     $this->trigger('form_ready', array('form' => $form, 'action' => 'create'));
     if ($form->isSent() && !$form->hasErrors()) {
         if ($user->can('create', $item)) {
             $this->trigger('form_sent', array('form' => $form, 'action' => 'create'));
             $item->loadFromForm($form);
             if ($item->validateWithForm()) {
                 $item->save();
                 $this->trigger('form_completed', array('form' => $form, 'action' => 'create', 'entity' => $item));
                 if (fx::env('ajax')) {
                     $form->finish();
                     return;
                 }
                 $target_type = $this->getParam('redirect_to');
                 switch ($target_type) {
                     case 'refresh':
                         fx::http()->refresh();
                         break;
                     case 'new_page':
                         fx::http()->redirect($item['url']);
                         break;
                     case 'parent_page':
                         fx::http()->redirect($item['parent']['url']);
                         break;
                 }
             } else {
                 $form->addError(fx::alang('Unable to save ', 'controller_component') . $item['component']->getItemName('add'));
             }
         } else {
             $form->addError('Permission denied');
         }
     }
 }
开发者ID:floxim,项目名称:module-main,代码行数:46,代码来源:Controller.php

示例9: doLogout

 public function doLogout()
 {
     $user = fx::user();
     $user->logout();
     $back_url = $this->getParam('back_url', '@home/');
     fx::http()->redirect($back_url, 302);
 }
开发者ID:floxim,项目名称:module-user,代码行数:7,代码来源:Controller.php


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