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


PHP Kohana_Exception::error_view方法代码示例

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


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

示例1: action_index

 public function action_index()
 {
     // Set up custom error view
     Kohana_Exception::$error_view = 'error/data-provider';
     if ($this->request->method() != 'GET') {
         // Only GET is allowed as FrontlineSms does only GET request
         throw HTTP_Exception::factory(405, 'The :method method is not supported. Supported methods are :allowed_methods', array(':method' => $this->request->method(), ':allowed_methods' => Http_Request::GET))->allowed(Http_Request::GET);
     }
     $provider = DataProvider::factory('frontlinesms');
     // Authenticate the request
     $options = $provider->options();
     if (!isset($options['key']) or empty($options['key'])) {
         throw HTTP_Exception::factory(403, 'Key value has not been configured');
     }
     if (!$this->request->query('key') or $this->request->query('key') != $options['key']) {
         throw HTTP_Exception::factory(403, 'Incorrect or missing key');
     }
     if (!$this->request->query('m')) {
         throw HTTP_Exception::factory(403, 'Missing message');
     }
     // Remove Non-Numeric characters because that's what the DB has
     $from = preg_replace('/\\D+/', "", $this->request->post('from'));
     $message_text = $this->request->query('m');
     // If receiving an SMS Message
     if ($from and $message_text) {
         $provider->receive(Message_Type::SMS, $from, $message_text, $to);
     }
     $json = array('payload' => array('success' => TRUE, 'error' => NULL));
     // Set the correct content-type header
     $this->response->headers('Content-Type', 'application/json');
     $this->response->body(json_encode($json));
 }
开发者ID:nolanglee,项目名称:platform,代码行数:32,代码来源:Frontlinesms.php

示例2: action_index

 public function action_index()
 {
     // Set up custom error view
     Kohana_Exception::$error_view = 'error/data-provider';
     //Check if data provider is available
     $providers_available = Kohana::$config->load('features.data-providers');
     if (!$providers_available['smssync']) {
         throw HTTP_Exception::factory(403, 'The SMS Sync data source is not currently available. It can be accessed by upgrading to a higher Ushahidi tier.');
     }
     $methods_with_http_request = [Http_Request::POST, Http_Request::GET];
     if (!in_array($this->request->method(), $methods_with_http_request)) {
         // Only POST or GET is allowed
         throw HTTP_Exception::factory(405, 'The :method method is not supported. Supported methods are :allowed_methods', array(':method' => $this->request->method(), ':allowed_methods' => implode(',', $methods_with_http_request)))->allowed($methods_with_http_request);
     }
     $this->_provider = DataProvider::factory('smssync');
     $this->options = $this->_provider->options();
     // Ensure we're always returning a payload..
     // This will be overwritten later if incoming or task methods are run
     $this->_json['payload'] = ['success' => TRUE, 'error' => NULL];
     // Process incoming messages from SMSSync only if the request is POST
     if ($this->request->method() == 'POST') {
         $this->_incoming();
     }
     // Attempt Task if request is GET and task type is 'send'
     if ($this->request->method() == 'GET' and $this->request->query('task') == 'send') {
         $this->_task();
     }
     // Set the response
     $this->_set_response();
 }
开发者ID:tobiasziegler,项目名称:platform,代码行数:30,代码来源:Smssync.php

示例3: kandler

 /**
  * Inline exception handler.
  *
  * @param   Exception  exception object
  * @return  string
  * @uses    Arr::get
  * @uses    Kohana::find_file
  * @uses    Kohana_Exception::handler
  * @uses    Kohana_Exception::text
  */
 function kandler(Exception $e)
 {
     try {
         // Get error code
         $code = $e->getCode();
         // Retrieve Kandler's config
         $config = Kohana::$config->load('kandler');
         // Use views defined by user or use default
         $view = Arr::get($config->errors, $code, $code);
         // Create path to error view
         $path = $config->path . DIRECTORY_SEPARATOR . $view;
         if (Kohana::find_file('views', $path)) {
             // Set an exception view
             Kohana_Exception::$error_view = $path;
         }
         // Handle an exception using Kohana's handler
         Kohana_Exception::handler($e);
     } catch (Exception $e) {
         return Kohana_Exception::text($e);
     }
 }
开发者ID:hbarroso,项目名称:Goworkat,代码行数:31,代码来源:init.php

示例4: action_index

 public function action_index()
 {
     // Set up custom error view
     Kohana_Exception::$error_view = 'error/data-provider';
     $methods_with_http_request = [Http_Request::POST, Http_Request::GET];
     if (!in_array($this->request->method(), $methods_with_http_request)) {
         // Only POST or GET is allowed
         throw HTTP_Exception::factory(405, 'The :method method is not supported. Supported methods are :allowed_methods', array(':method' => $this->request->method(), ':allowed_methods' => implode(',', $methods_with_http_request)))->allowed($methods_with_http_request);
     }
     $this->_provider = DataProvider::factory('smssync');
     $this->options = $this->_provider->options();
     // Process incoming messages from SMSSync only if the request is POST
     if ($this->request->method() == 'POST') {
         $this->_incoming();
     }
     // Attempt Task if request is GET and task type is 'send'
     if ($this->request->method() == 'GET' and $this->request->query('task') == 'send') {
         $this->_task();
     }
     // Set the response
     $this->_set_response();
 }
开发者ID:nolanglee,项目名称:platform,代码行数:22,代码来源:Smssync.php

示例5: constant

/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
if (strpos($_SERVER['HTTP_HOST'], 'savvyled.pl') !== false || $_SERVER['HTTP_HOST'] == 'localhost') {
    Kohana::$environment = Kohana::DEVELOPMENT;
} else {
    Kohana::$environment = Kohana::PRODUCTION;
}
if (isset($_SERVER['KOHANA_ENV'])) {
    Kohana::$environment = constant('Kohana::' . strtoupper($_SERVER['KOHANA_ENV']));
}
if (Kohana::$environment == Kohana::PRODUCTION) {
    Kohana_Exception::$error_view = 'Exception';
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
开发者ID:Alex-AG,项目名称:exeltek-mima,代码行数:31,代码来源:bootstrap.php

示例6: elseif

<?php

if (PHP_SAPI == 'cli') {
    Kohana_Exception::$error_view = 'errors/cli_generic_error';
} elseif (Kohana::$environment < Kohana::DEVELOPMENT) {
    // By default, friendlier error with sanitised trace
    Kohana_Exception::$error_view = 'errors/web_generic_error';
}
开发者ID:it2k,项目名称:kohana-errors,代码行数:8,代码来源:init.php

示例7: array

 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */
if (in_array(@$_SERVER['SERVER_NAME'], array('127.0.0.1', 'fe80::1', '::1', 'localhost', '192.168.2.164', '192.168.0.123', '10.48.176.31', '155.133.44.94')) || strpos($_SERVER['SERVER_NAME'], 'ngrok.io')) {
    $init = array('base_url' => "/michales", 'index_file' => "index.php", 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::DEVELOPMENT);
    Kohana::$environment = Kohana::DEVELOPMENT;
} elseif ($_SERVER['SERVER_NAME'] == "michal.es" || $_SERVER['SERVER_NAME'] == "rookgaard.pl") {
    $init = array('base_url' => "/serwis", 'index_file' => "index.php", 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::PRODUCTION);
    //	Kohana_Exception::$error_view = 'errors/general';
    Kohana::$environment = Kohana::PRODUCTION;
} else {
    $init = array('base_url' => "/", 'index_file' => FALSE, 'errors' => FALSE, 'profile' => Kohana::$environment === Kohana::PRODUCTION);
    Kohana_Exception::$error_view = 'errors/general';
    Kohana::$environment = Kohana::PRODUCTION;
}
Kohana::init($init);
/**
 * Setting Cookie::$salt
 */
Cookie::$salt = '29961408e9a1bbbf0456dd913a12d31fffa587cc';
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
开发者ID:korejwo,项目名称:michales,代码行数:31,代码来源:bootstrap.php


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