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


PHP Response::forge方法代码示例

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


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

示例1: after

 public function after($response)
 {
     // If a response has been provided, just go with it
     if (!is_null($response)) {
         return $response;
     }
     // Populate the sidebar
     $this->sidebar = \Admin::getSidebarConfig();
     // Add assets
     $this->data['assets'] = array('js' => \Arr::get($this->assets, 'js', array()), 'css' => \Arr::get($this->assets, 'css', array()));
     // JSON encode the JS
     $this->js['settings'] = $this->getSettings();
     $this->data['js_data'] = json_encode($this->js);
     // Info about the user
     $user = \CMF\Auth::current_user();
     $this->user = array('account' => '/admin/users/' . $user->id . '/edit', 'username' => $user->username, 'super_user' => $user->super_user);
     // Some vital settings
     $this->admin_title = \Lang::get('admin.title', array(), \Config::get("cmf.admin.title", ''));
     $this->base_url = \Admin::$base;
     $this->modules = \Config::get('cmf.admin.modules', false);
     $this->current_module = \Admin::$current_module;
     $this->current_class = \Admin::$current_class;
     $this->dashboard_title = \Lang::get('admin.modules.' . \Admin::$current_module . '.title', array(), \Config::get('cmf.admin.modules.' . \Admin::$current_module . '.title', \Lang::get('admin.common.dashboard', array(), 'Dashboard')));
     $this->headers['X-XSS-Protection'] = 0;
     return \Response::forge(\View::forge($this->template, $this->data, false), $this->status, $this->headers);
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:26,代码来源:base.php

示例2: serve

 public function serve($content, $modified = false)
 {
     $cache_last_modified = $modified ? time() : filemtime($this->path);
     $header_modified_since = strtotime(\Input::server('HTTP_IF_MODIFIED_SINCE', 0));
     $status = 200;
     // Set the response headers for cache etc
     $headers = array('Cache-Control' => 'public', 'Last-Modified' => gmdate('D, d M Y H:i:s', $cache_last_modified) . ' GMT', 'Content-Type' => $this->content_type, 'X-UA-Compatible' => 'IE=edge');
     // Still call the before method on the controller... is this a good idea? Perhaps not.
     /* if (isset($this->request) && $controller = $this->request->controller_instance) {
     			if (method_exists($controller, 'before')) $controller->before($content);
     		} */
     // Return 304 not modified if the content hasn't changed, but only if the profiler isn't enabled.
     if (!\Fuel::$profiling) {
         $headers['Content-Length'] = strlen($content);
         if ($header_modified_since >= $cache_last_modified) {
             header('HTTP/1.1 304 Not Modified');
             exit;
         }
     }
     // Send the response
     \Response::forge($content, $status, $headers)->send(true);
     if (\Fuel::$profiling) {
         \Profiler::mark('CMF Cache Served');
     }
     exit;
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:26,代码来源:Simple.php

示例3: action_index

 public function action_index($view_path, $id)
 {
     $post_input = Input::post();
     // First of all turn the submitted data into a FuelPHP model representation.
     $form_data_object = new \EBS\Form_Data($post_input);
     // Now go through and save created models and run validation.
     $model_validation = new \EBS\Form_Save_Models($form_data_object->models_and_actions);
     if (!$model_validation->run()) {
         $this->response->highlight_fields = $model_validation->get_highlightfields();
         foreach ($model_validation->database_errors as $database_error) {
             // Create alerts specific to database errors for debugging purposes.
             // Perhaps this should only be shown if in DEV environment.
             $this->response->alerts[] = new \EBS\Response_Alert("There was a database error! Message: {$database_error->getMessage()}", 'danger', '', 0);
         }
     } else {
         // If that's successful, set the response success to true, as we're all done!
         $this->response->success = true;
         // Check if there was a view to generate and send back as well.
         if ($view_path !== null) {
             // Get the path for the view request.
             $view_path = str_replace('_', '/', $view_path);
             $updated_view = new \EBS\Response_View();
             $updated_view->html = Presenter::forge($view_path)->set('id', $id)->render();
             $updated_view->context = Input::post('response_target');
             $this->response->updated_views[] = $updated_view;
         }
     }
     // Encode the response object as JSON and send it back to the UI!
     return Response::forge(json_encode($this->response));
 }
开发者ID:stabernz,项目名称:wnb,代码行数:30,代码来源:submit.php

示例4: action_index

 public function action_index()
 {
     if (isset($this->field)) {
         $data = array();
         $data['pdu'] = $this->field->power;
         if ($this->tmpl) {
             $data['cables'] = array();
         } else {
             $data['cables'] = Model_Cable::find()->where('type', 2)->where('dev1', $this->field->deviceID)->or_where('dev2', $this->field->deviceID)->get();
         }
         $data['err'] = '';
         if ($this->isSuplly()) {
             $data['maxout'] = 42;
             if (!$this->tmpl) {
                 if ($this->field->device->meta_default_data > 0) {
                     $data['maxout'] = 42;
                 } else {
                     $data['maxout'] = 24;
                 }
             }
             return \Response::forge(\View::forge('power/supply', $data));
         } else {
             return \Response::forge(\View::forge('power/consumer', $data));
         }
     }
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:26,代码来源:get.php

示例5: action_login

 public function action_login()
 {
     $url_redirect = \Uri::create('system/index/index');
     if (\Auth::check()) {
         \Response::redirect($url_redirect);
     }
     if (\Input::is_ajax()) {
         $val = \Validation::forge('validate_login');
         $val->add_field('email', 'Email', 'required|valid_email');
         $val->add_field('password', 'Password', 'required');
         if ($val->run(array())) {
             if (\Auth::instance()->login(\Input::param('email'), \Input::param('password'))) {
                 if (\Input::param('remember', false)) {
                     \Auth::remember_me();
                 } else {
                     \Auth::dont_remember_me();
                 }
                 $response = array('status' => 'success', 'url' => $url_redirect);
             } else {
                 $messages = \Auth::get_error();
                 $response = array('status' => 'error', 'msg' => $messages);
             }
         } else {
             $messages = $val->error_message();
             $response = array('status' => 'error', 'msg' => $messages);
         }
         return \Response::forge(json_encode($response));
     }
     $this->theme->set_template('login');
     $this->theme->get_template()->set('content', \view::forge('default/login', $this->_arrParam));
 }
开发者ID:khoapossible,项目名称:vision_system,代码行数:31,代码来源:default.php

示例6: action_index

 public function action_index()
 {
     #$data = array();
     #$this->template->title = 'Example Page';
     #$this->template->content = View::forge('main/index', $data);
     return Response::forge(View::forge('main/index'));
 }
开发者ID:rysk92,项目名称:Pororocca,代码行数:7,代码来源:html.php

示例7: template

 public function template()
 {
     if (isset($this->view)) {
         if (isset($this->model)) {
             die('Have Model');
             //                return \Response::forge( \View::forge('frontend/post/show/image')->set($this->data, null, false) );
         } elseif (isset($this->collectionModel)) {
             //                print_r($this->collectionModel);
             //                die('Have Models and Views');
             return \Response::forge($this->view->set($this->data, null, false));
         }
     }
     if (is_array($this->data)) {
         // Do array stuff
         $name = strtolower($this->modelName);
         echo $name;
         die('Some Data');
         return \View::forge($name, $this->data);
     }
     echo '<pre>';
     print_r($this);
     die('No Data');
     //		$this->data[$this->modelName] = $this->model::find('all');
     return View::forge($this->modelName, $this->data);
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:25,代码来源:index.php

示例8: after

 public function after($response)
 {
     if (empty($response) or !$response instanceof Response) {
         $response = \Response::forge(\Theme::instance()->render());
     }
     return parent::after($response);
 }
开发者ID:ksakuntanak,项目名称:buffohero_cms,代码行数:7,代码来源:contact.php

示例9: action_banner

 public function action_banner()
 {
     $banner = Model_Asset::query()->where('id', 22)->get_one();
     $name = $banner->uri . '' . $banner->name;
     $data['image'] = $this->_base64_encode_image($name, $banner->type);
     return \Response::forge(\View::forge('image/advertisement/banner')->set_safe($data));
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:7,代码来源:advertisement.php

示例10: action_index

 public function action_index()
 {
     if ($_POST) {
         $val = \Validation::forge();
         $val->add_field('room', 'Room id', 'required|min_length[1]|max_length[20]');
         if ($val->run()) {
             \Fuel\Core\Module::load('basic');
             $room = \Basic\Model_Room::find($val->validated('room'));
             if ($room) {
                 $query = \DB::query('select distinct cables.id  from cables, rack, device where rack.room=' . $room->id . ' and device.rack=rack.id and (device.id=cables.dev1 or device.id=cables.dev2)');
                 $cables = $query->as_object()->execute();
                 $cabledata = array();
                 foreach ($cables as $c) {
                     $cab = \Basic\Model_Cable::find($c->id);
                     $dev1 = \Basic\Model_Device::find($cab->dev1);
                     $dev2 = \Basic\Model_Device::find($cab->dev2);
                     array_push($cabledata, array('id' => $cab->id, 'dev1' => $cab->dev1, 'port1' => $cab->port1, 'dev2' => $cab->dev2, 'port2' => $cab->port2, 'name1' => $cab->name1, 'name2' => $cab->name2, 'type' => $cab->type, 'hostname1' => $dev1->hostname, 'hostname2' => $dev2->hostname));
                 }
                 $data['cabledata'] = $cabledata;
                 $data['room'] = $room;
                 return \Response::forge(\View::forge('rack', $data));
             }
         }
     }
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:25,代码来源:get.php

示例11: after

 /**
  * This method gets called after the action is called
  */
 public function after($response)
 {
     // Make sure the $response is a Response object
     if (!$response instanceof Response) {
         $response = \Response::forge($response, $this->response_status);
     }
     return $response;
 }
开发者ID:takawasitobi,项目名称:pembit,代码行数:11,代码来源:controller.php

示例12: action_login

 /**
  * OpenID Connectを利用するログイン処理
  */
 public function action_login($_provider = null)
 {
     if (array_key_exists(Inflector::humanize($_provider), Arr::get($this->_config, 'Strategy'))) {
         new Opauth($this->_config, true);
     } else {
         return Response::forge('サポートされてないStrategy!');
     }
 }
开发者ID:Kim20110119,项目名称:FuelPHP_Opauth,代码行数:11,代码来源:auth.php

示例13: action_myform

 public function action_myform()
 {
     $fieldset = \fieldset::forge('form');
     $fieldset->add('title', 'title', array('maxlength' => 50), array(array('required')));
     if (\input::post()) {
         echo \input::post('title');
     }
     return \Response::forge($fieldset);
 }
开发者ID:rainyman2012,项目名称:example1,代码行数:9,代码来源:hmvc.php

示例14: before

 public function before()
 {
     parent::before();
     // Some Methods cant have a body
     $this->request->body = null;
     // Which format should the data be returned in?
     $this->request->lang = $this->_detect_lang();
     $this->response = \Response::forge();
 }
开发者ID:wushian,项目名称:MDD,代码行数:9,代码来源:rest.php

示例15: before

 /**
  * {@inheritdoc}
  */
 public function before()
 {
     $manager = $this->getAuth();
     $uri = $this->getUri();
     if (!$manager->check()) {
         return \Response::forge('redirect', $uri . 'login', 'location', 403);
     }
     \View::setGlobal('admin_uri', $uri);
 }
开发者ID:indigophp,项目名称:admin,代码行数:12,代码来源:Base.php


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