summaryrefslogtreecommitdiff
path: root/kohana/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'kohana/helpers')
-rw-r--r--kohana/helpers/inflector.php38
-rw-r--r--kohana/helpers/request.php28
2 files changed, 33 insertions, 33 deletions
diff --git a/kohana/helpers/inflector.php b/kohana/helpers/inflector.php
index b619eddb..94e62d36 100644
--- a/kohana/helpers/inflector.php
+++ b/kohana/helpers/inflector.php
@@ -26,16 +26,16 @@ class inflector_Core {
*/
public static function uncountable($str)
{
- if (self::$uncountable === NULL)
+ if (inflector::$uncountable === NULL)
{
// Cache uncountables
- self::$uncountable = Kohana::config('inflector.uncountable');
+ inflector::$uncountable = Kohana::config('inflector.uncountable');
// Make uncountables mirroed
- self::$uncountable = array_combine(self::$uncountable, self::$uncountable);
+ inflector::$uncountable = array_combine(inflector::$uncountable, inflector::$uncountable);
}
- return isset(self::$uncountable[strtolower($str)]);
+ return isset(inflector::$uncountable[strtolower($str)]);
}
/**
@@ -63,19 +63,19 @@ class inflector_Core {
// Cache key name
$key = 'singular_'.$str.$count;
- if (isset(self::$cache[$key]))
- return self::$cache[$key];
+ if (isset(inflector::$cache[$key]))
+ return inflector::$cache[$key];
if (inflector::uncountable($str))
- return self::$cache[$key] = $str;
+ return inflector::$cache[$key] = $str;
- if (empty(self::$irregular))
+ if (empty(inflector::$irregular))
{
// Cache irregular words
- self::$irregular = Kohana::config('inflector.irregular');
+ inflector::$irregular = Kohana::config('inflector.irregular');
}
- if ($irregular = array_search($str, self::$irregular))
+ if ($irregular = array_search($str, inflector::$irregular))
{
$str = $irregular;
}
@@ -93,7 +93,7 @@ class inflector_Core {
$str = substr($str, 0, -1);
}
- return self::$cache[$key] = $str;
+ return inflector::$cache[$key] = $str;
}
/**
@@ -120,21 +120,21 @@ class inflector_Core {
// Cache key name
$key = 'plural_'.$str.$count;
- if (isset(self::$cache[$key]))
- return self::$cache[$key];
+ if (isset(inflector::$cache[$key]))
+ return inflector::$cache[$key];
if (inflector::uncountable($str))
- return self::$cache[$key] = $str;
+ return inflector::$cache[$key] = $str;
- if (empty(self::$irregular))
+ if (empty(inflector::$irregular))
{
// Cache irregular words
- self::$irregular = Kohana::config('inflector.irregular');
+ inflector::$irregular = Kohana::config('inflector.irregular');
}
- if (isset(self::$irregular[$str]))
+ if (isset(inflector::$irregular[$str]))
{
- $str = self::$irregular[$str];
+ $str = inflector::$irregular[$str];
}
elseif (preg_match('/[sxz]$/', $str) OR preg_match('/[^aeioudgkprt]h$/', $str))
{
@@ -151,7 +151,7 @@ class inflector_Core {
}
// Set the cache and return
- return self::$cache[$key] = $str;
+ return inflector::$cache[$key] = $str;
}
/**
diff --git a/kohana/helpers/request.php b/kohana/helpers/request.php
index ba6f68ac..625f9226 100644
--- a/kohana/helpers/request.php
+++ b/kohana/helpers/request.php
@@ -83,7 +83,7 @@ class request_Core {
{
$method = strtolower($_SERVER['REQUEST_METHOD']);
- if ( ! in_array($method, self::$http_methods))
+ if ( ! in_array($method, request::$http_methods))
throw new Kohana_Exception('request.unknown_method', $method);
return $method;
@@ -101,7 +101,7 @@ class request_Core {
request::parse_accept_header();
if ($type === NULL)
- return self::$accept_types;
+ return request::$accept_types;
return (request::accepts_at_quality($type, $explicit_check) > 0);
}
@@ -175,16 +175,16 @@ class request_Core {
$type = explode('/', $type, 2);
// Exact match
- if (isset(self::$accept_types[$type[0]][$type[1]]))
- return self::$accept_types[$type[0]][$type[1]];
-
+ if (isset(request::$accept_types[$type[0]][$type[1]]))
+ return request::$accept_types[$type[0]][$type[1]];
+
// Wildcard match (if not checking explicitly)
- if ($explicit_check === FALSE AND isset(self::$accept_types[$type[0]]['*']))
- return self::$accept_types[$type[0]]['*'];
+ if ($explicit_check === FALSE AND isset(request::$accept_types[$type[0]]['*']))
+ return request::$accept_types[$type[0]]['*'];
// Catch-all wildcard match (if not checking explicitly)
- if ($explicit_check === FALSE AND isset(self::$accept_types['*']['*']))
- return self::$accept_types['*']['*'];
+ if ($explicit_check === FALSE AND isset(request::$accept_types['*']['*']))
+ return request::$accept_types['*']['*'];
// Content type not accepted
return 0;
@@ -198,17 +198,17 @@ class request_Core {
protected static function parse_accept_header()
{
// Run this function just once
- if (self::$accept_types !== NULL)
+ if (request::$accept_types !== NULL)
return;
// Initialize accept_types array
- self::$accept_types = array();
+ request::$accept_types = array();
// No HTTP Accept header found
if (empty($_SERVER['HTTP_ACCEPT']))
{
// Accept everything
- self::$accept_types['*']['*'] = 1;
+ request::$accept_types['*']['*'] = 1;
return;
}
@@ -229,9 +229,9 @@ class request_Core {
$q = (isset($accept_entry[1]) AND preg_match('~\bq\s*+=\s*+([.0-9]+)~', $accept_entry[1], $match)) ? (float) $match[1] : 1;
// Populate accept_types array
- if ( ! isset(self::$accept_types[$type[0]][$type[1]]) OR $q > self::$accept_types[$type[0]][$type[1]])
+ if ( ! isset(request::$accept_types[$type[0]][$type[1]]) OR $q > request::$accept_types[$type[0]][$type[1]])
{
- self::$accept_types[$type[0]][$type[1]] = $q;
+ request::$accept_types[$type[0]][$type[1]] = $q;
}
}
}