本文整理汇总了PHP中Kohana::version方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::version方法的具体用法?PHP Kohana::version怎么用?PHP Kohana::version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana
的用法示例。
在下文中一共展示了Kohana::version方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
<?php
defined('SYSPATH') or die('No direct script access.');
?>
<div id="footer">
<div class="container">
<div class="row">
<div class="col-sm-6">
<?php
echo $config->year_creation_site == date('Y') ? $config->copyright . ', ' . date('Y') : $config->copyright . ', ' . $config['year_creation_site'] . '-' . date('Y');
?>
<br>
<?php
echo Kohana::get_usage_time_and_memory();
?>
</div>
<div class="col-sm-6 text-right">
<?php
echo __('settings.hf_developed_by') . ' ' . Kohana::company_url();
?>
<br>
<?php
echo __('settings.hf_powered_by') . ' ' . Kohana::version(true);
?>
</div>
</div>
</div>
</div>
示例2: send_headers
/**
* Sends headers to the php processor, or supplied `$callback` argument.
* This method formats the headers correctly for output, re-instating their
* capitalization for transmission.
*
* [!!] if you supply a custom header handler via `$callback`, it is
* recommended that `$response` is returned
*
* @param HTTP_Response $response header to send
* @param boolean $replace replace existing value
* @param callback $callback optional callback to replace PHP header function
* @return mixed
* @since 3.2.0
*/
public function send_headers(HTTP_Response $response = NULL, $replace = FALSE, $callback = NULL)
{
$protocol = $response->protocol();
$status = $response->status();
// Create the response header
$processed_headers = array($protocol . ' ' . $status . ' ' . Response::$messages[$status]);
// Get the headers array
$headers = $response->headers()->getArrayCopy();
foreach ($headers as $header => $value) {
if (is_array($value)) {
$value = implode(', ', $value);
}
$processed_headers[] = Text::ucfirst($header) . ': ' . $value;
}
if (!isset($headers['content-type'])) {
$processed_headers[] = 'Content-Type: ' . Kohana::$content_type . '; charset=' . Kohana::$charset;
}
if (Kohana::$expose and !isset($headers['x-powered-by'])) {
$processed_headers[] = 'X-Powered-By: ' . Kohana::version();
}
// Get the cookies and apply
if ($cookies = $response->cookie()) {
$processed_headers['Set-Cookie'] = $cookies;
}
if (is_callable($callback)) {
// Use the callback method to set header
return call_user_func($callback, $response, $processed_headers, $replace);
} else {
$this->_send_headers_to_php($processed_headers, $replace);
return $response;
}
}
示例3: provider_send_headers
/**
* Data provider for test_send_headers
*
* @return array
*/
public function provider_send_headers()
{
$content_type = Kohana::$content_type . '; charset=' . Kohana::$charset;
return array(array(array(), array('HTTP/1.1 200 OK', 'Content-Type: ' . $content_type), FALSE), array(array(), array('HTTP/1.1 200 OK', 'Content-Type: ' . $content_type, 'X-Powered-By: ' . Kohana::version()), TRUE), array(array('accept' => 'text/html, text/plain, text/*, */*', 'accept-charset' => 'utf-8, utf-10, iso-8859-1', 'accept-encoding' => 'compress, gzip', 'accept-language' => 'en, en-gb, en-us'), array('HTTP/1.1 200 OK', 'Accept: text/html, text/plain, text/*, */*', 'Accept-Charset: utf-8, utf-10, iso-8859-1', 'Accept-Encoding: compress, gzip', 'Accept-Language: en, en-gb, en-us', 'Content-Type: ' . $content_type), FALSE), array(array('accept' => 'text/html, text/plain, text/*, */*', 'accept-charset' => 'utf-8, utf-10, iso-8859-1', 'accept-encoding' => 'compress, gzip', 'accept-language' => 'en, en-gb, en-us', 'content-type' => 'application/json', 'x-powered-by' => 'Mohana', 'x-ssl-enabled' => 'TRUE'), array('HTTP/1.1 200 OK', 'Accept: text/html, text/plain, text/*, */*', 'Accept-Charset: utf-8, utf-10, iso-8859-1', 'Accept-Encoding: compress, gzip', 'Accept-Language: en, en-gb, en-us', 'Content-Type: application/json', 'X-Powered-By: Mohana', 'X-Ssl-Enabled: TRUE'), TRUE));
}
示例4: render
/**
* Renders the HTTP_Interaction to a string, producing
*
* - Protocol
* - Headers
* - Body
*
* If there are variables set to the `Kohana_Request::$_post`
* they will override any values set to body.
*
* @return string
*/
public function render()
{
if (!($post = $this->post())) {
$body = $this->body();
} else {
$this->headers('content-type', 'application/x-www-form-urlencoded; charset=' . Kohana::$charset);
$body = http_build_query($post, NULL, '&');
}
// Set the content length
$this->headers('content-length', (string) $this->content_length());
// If Kohana expose, set the user-agent
if (Kohana::$expose) {
$this->headers('user-agent', Kohana::version());
}
// Prepare cookies
if ($this->_cookies) {
$cookie_string = array();
// Parse each
foreach ($this->_cookies as $key => $value) {
$cookie_string[] = $key . '=' . $value;
}
// Create the cookie string
$this->_header['cookie'] = implode('; ', $cookie_string);
}
$output = $this->method() . ' ' . $this->uri() . ' ' . $this->protocol() . "\r\n";
$output .= (string) $this->_header;
$output .= $body;
return $output;
}
示例5: render
/**
* Renders the HTTP_Interaction to a string, producing
*
* - Protocol
* - Headers
* - Body
*
* @return string
*/
public function render()
{
if (!$this->_header->offsetExists('content-type')) {
// Add the default Content-Type header if required
$this->_header['content-type'] = Kohana::$content_type . '; charset=' . Kohana::$charset;
}
// Set the content length
$this->headers('content-length', (string) $this->content_length());
// If Kohana expose, set the user-agent
if (Kohana::$expose) {
$this->headers('user-agent', Kohana::version());
}
// Prepare cookies
if ($this->_cookies) {
if (extension_loaded('http')) {
$this->_header['set-cookie'] = http_build_cookie($this->_cookies);
} else {
$cookies = array();
// Parse each
foreach ($this->_cookies as $key => $value) {
$string = $key . '=' . $value['value'] . '; expires=' . date('l, d M Y H:i:s T', $value['expiration']);
$cookies[] = $string;
}
// Create the cookie string
$this->_header['set-cookie'] = $cookies;
}
}
$output = $this->_protocol . ' ' . $this->_status . ' ' . Response::$messages[$this->_status] . "\r\n";
$output .= (string) $this->_header;
$output .= $this->_body;
return $output;
}
示例6: execute_request
/**
* Processes the request, executing the controller action that handles this
* request, determined by the [Route].
*
* 1. Before the controller action is called, the [Controller::before] method
* will be called.
* 2. Next the controller action will be called.
* 3. After the controller action is called, the [Controller::after] method
* will be called.
*
* By default, the output from the controller is captured and returned, and
* no headers are sent.
*
* $request->execute();
*
* @param Request $request A request object
* @param Response $response A response object
* @return Response
* @throws Kohana_Exception
* @uses [Kohana::$profiling]
* @uses [Profiler]
*/
public function execute_request(Request $request, Response $response)
{
if (Kohana::$profiling) {
// Set the benchmark name
$benchmark = '"' . $request->uri() . '"';
if ($request !== Request::$initial and Request::$current) {
// Add the parent request uri
$benchmark .= ' « "' . Request::$current->uri() . '"';
}
// Start benchmarking
$benchmark = Profiler::start('Requests', $benchmark);
}
// Store the current active request and replace current with new request
$previous = Request::$current;
Request::$current = $request;
// Resolve the POST fields
if ($post = $request->post()) {
$request->body(http_build_query($post, NULL, '&'))->headers('content-type', 'application/x-www-form-urlencoded; charset=' . Kohana::$charset);
}
$request->headers('content-length', (string) $request->content_length());
// If Kohana expose, set the user-agent
if (Kohana::$expose) {
$request->headers('user-agent', Kohana::version());
}
try {
$response = $this->_send_message($request, $response);
} catch (Exception $e) {
// Restore the previous request
Request::$current = $previous;
if (isset($benchmark)) {
// Delete the benchmark, it is invalid
Profiler::delete($benchmark);
}
// Re-throw the exception
throw $e;
}
// Restore the previous request
Request::$current = $previous;
if (isset($benchmark)) {
// Stop the benchmark
Profiler::stop($benchmark);
}
// Return the response
return $response;
}