diff --git a/system/download.php b/system/download.php index 37778019bff..1dac8da82b5 100644 --- a/system/download.php +++ b/system/download.php @@ -118,13 +118,13 @@ public static function file($path, $name = null) } return Response::make(file_get_contents($path))->header('Content-Description', 'File Transfer') - ->header('Content-Type', static::mime(pathinfo($path, PATHINFO_EXTENSION))) - ->header('Content-Disposition', 'attachment; filename="'.$name.'"') - ->header('Content-Transfer-Encoding', 'binary') - ->header('Expires', 0) - ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') - ->header('Pragma', 'public') - ->header('Content-Length', filesize($path)); + ->header('Content-Type', static::mime(pathinfo($path, PATHINFO_EXTENSION))) + ->header('Content-Disposition', 'attachment; filename="'.$name.'"') + ->header('Content-Transfer-Encoding', 'binary') + ->header('Expires', 0) + ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') + ->header('Pragma', 'public') + ->header('Content-Length', filesize($path)); } /** diff --git a/system/error.php b/system/error.php index 2520a8a4644..c5d29f2b4d1 100644 --- a/system/error.php +++ b/system/error.php @@ -8,19 +8,19 @@ class Error { * @var array */ public static $levels = array( - 0 => 'Error', - E_ERROR => 'Error', - E_WARNING => 'Warning', - E_PARSE => 'Parsing Error', - E_NOTICE => 'Notice', - E_CORE_ERROR => 'Core Error', - E_CORE_WARNING => 'Core Warning', - E_COMPILE_ERROR => 'Compile Error', - E_COMPILE_WARNING => 'Compile Warning', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice' + 0 => 'Error', + E_ERROR => 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Parsing Error', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Runtime Notice' ); /** diff --git a/system/filter.php b/system/filter.php index f5ed5faaa50..47909fb5ccc 100644 --- a/system/filter.php +++ b/system/filter.php @@ -34,7 +34,7 @@ public static function call($filters, $parameters = array(), $override = false) { if ( ! isset(static::$filters[$filter])) { - throw new \Exception("Route filter [$filter] is not defined."); + throw new \Exception("Route filter [$filter] is not defined."); } $response = call_user_func_array(static::$filters[$filter], $parameters); diff --git a/system/form.php b/system/form.php index b303c0ed2fd..bdabef8bc4b 100644 --- a/system/form.php +++ b/system/form.php @@ -16,7 +16,7 @@ class Form { * @param string $method * @param array $attributes * @return string - */ + */ public static function open($action = null, $method = 'POST', $attributes = array()) { // ------------------------------------------------------- @@ -34,7 +34,7 @@ public static function open($action = null, $method = 'POST', $attributes = arra if ( ! array_key_exists('accept-charset', $attributes)) { - $attributes['accept-charset'] = Config::get('application.encoding'); + $attributes['accept-charset'] = Config::get('application.encoding'); } $html = ''; @@ -56,7 +56,7 @@ public static function open($action = null, $method = 'POST', $attributes = arra /** * Close a HTML form. * - * @return void + * @return string */ public static function close() { @@ -82,7 +82,7 @@ public static function raw_token() { if (Config::get('session.driver') == '') { - throw new \Exception('Sessions must be enabled to retrieve a CSRF token.'); + throw new \Exception('Sessions must be enabled to retrieve a CSRF token.'); } return Session::get('csrf_token'); @@ -99,7 +99,7 @@ public static function raw_token() public static function label($name, $value, $attributes = array()) { static::$labels[] = $name; - + return ''.PHP_EOL; } @@ -110,7 +110,7 @@ public static function label($name, $value, $attributes = array()) * @param string $value * @param array $attributes * @return string - */ + */ public static function text($name, $value = null, $attributes = array()) { return static::input('text', $name, $value, $attributes); @@ -122,7 +122,7 @@ public static function text($name, $value = null, $attributes = array()) * @param string $name * @param array $attributes * @return string - */ + */ public static function password($name, $attributes = array()) { return static::input('password', $name, null, $attributes); @@ -134,7 +134,7 @@ public static function password($name, $attributes = array()) * @param string $name * @param array $attributes * @return string - */ + */ public static function hidden($name, $value = null, $attributes = array()) { return static::input('hidden', $name, $value, $attributes); @@ -146,7 +146,7 @@ public static function hidden($name, $value = null, $attributes = array()) * @param string $name * @param array $attributes * @return string - */ + */ public static function file($name, $attributes = array()) { return static::input('file', $name, null, $attributes); diff --git a/system/hash.php b/system/hash.php index 66a87e2d65f..a615a7db2ab 100644 --- a/system/hash.php +++ b/system/hash.php @@ -2,7 +2,7 @@ class Hash { - /** + /** * The salty, hashed value. * * @var string @@ -49,4 +49,4 @@ public static function make($value, $salt = null) return new self($value, $salt); } -} \ No newline at end of file +} \ No newline at end of file diff --git a/system/html.php b/system/html.php index f044234b15f..80934a209cc 100644 --- a/system/html.php +++ b/system/html.php @@ -10,7 +10,7 @@ class HTML { */ public static function entities($value) { - return htmlentities($value, ENT_QUOTES, Config::get('application.encoding'), false); + return htmlentities($value, ENT_QUOTES, Config::get('application.encoding'), false); } /** @@ -186,7 +186,7 @@ private static function list_elements($type, $list, $attributes) * * @param array $attributes * @return string - */ + */ public static function attributes($attributes) { $html = array(); diff --git a/system/inflector.php b/system/inflector.php index 36a637cbf34..2620e72f43a 100644 --- a/system/inflector.php +++ b/system/inflector.php @@ -2,19 +2,19 @@ class Inflector { - /** - * The words that have been converted to singular. - * - * @var array - */ - private static $singular_cache = array(); - - /** - * The words that have been converted to plural. - * - * @var array - */ - private static $plural_cache = array(); + /** + * The words that have been converted to singular. + * + * @var array + */ + private static $singular_cache = array(); + + /** + * The words that have been converted to plural. + * + * @var array + */ + private static $plural_cache = array(); /** * Plural word forms. @@ -22,96 +22,96 @@ class Inflector { * @var array */ private static $plural = array( - '/(quiz)$/i' => "$1zes", - '/^(ox)$/i' => "$1en", - '/([m|l])ouse$/i' => "$1ice", - '/(matr|vert|ind)ix|ex$/i' => "$1ices", - '/(x|ch|ss|sh)$/i' => "$1es", - '/([^aeiouy]|qu)y$/i' => "$1ies", - '/(hive)$/i' => "$1s", - '/(?:([^f])fe|([lr])f)$/i' => "$1$2ves", - '/(shea|lea|loa|thie)f$/i' => "$1ves", - '/sis$/i' => "ses", - '/([ti])um$/i' => "$1a", - '/(tomat|potat|ech|her|vet)o$/i' => "$1oes", - '/(bu)s$/i' => "$1ses", - '/(alias)$/i' => "$1es", - '/(octop)us$/i' => "$1i", - '/(ax|test)is$/i' => "$1es", - '/(us)$/i' => "$1es", - '/s$/i' => "s", - '/$/' => "s" - ); - - /** - * Singular word forms. - * - * @var array - */ - private static $singular = array( - '/(quiz)zes$/i' => "$1", - '/(matr)ices$/i' => "$1ix", - '/(vert|ind)ices$/i' => "$1ex", - '/^(ox)en$/i' => "$1", - '/(alias)es$/i' => "$1", - '/(octop|vir)i$/i' => "$1us", - '/(cris|ax|test)es$/i' => "$1is", - '/(shoe)s$/i' => "$1", - '/(o)es$/i' => "$1", - '/(bus)es$/i' => "$1", - '/([m|l])ice$/i' => "$1ouse", - '/(x|ch|ss|sh)es$/i' => "$1", - '/(m)ovies$/i' => "$1ovie", - '/(s)eries$/i' => "$1eries", - '/([^aeiouy]|qu)ies$/i' => "$1y", - '/([lr])ves$/i' => "$1f", - '/(tive)s$/i' => "$1", - '/(hive)s$/i' => "$1", - '/(li|wi|kni)ves$/i' => "$1fe", - '/(shea|loa|lea|thie)ves$/i' => "$1f", - '/(^analy)ses$/i' => "$1sis", - '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => "$1$2sis", - '/([ti])a$/i' => "$1um", - '/(n)ews$/i' => "$1ews", - '/(h|bl)ouses$/i' => "$1ouse", - '/(corpse)s$/i' => "$1", - '/(us)es$/i' => "$1", - '/(us|ss)$/i' => "$1", - '/s$/i' => "", - ); - - /** - * Irregular word forms. - * - * @var array - */ - private static $irregular = array( - 'move' => 'moves', - 'foot' => 'feet', - 'goose' => 'geese', - 'sex' => 'sexes', - 'child' => 'children', - 'man' => 'men', - 'tooth' => 'teeth', - 'person' => 'people', - ); - - /** - * Uncountable word forms. - * - * @var array - */ - private static $uncountable = array( - 'sheep', - 'fish', - 'deer', - 'series', - 'species', - 'money', - 'rice', - 'information', - 'equipment', - ); + '/(quiz)$/i' => "$1zes", + '/^(ox)$/i' => "$1en", + '/([m|l])ouse$/i' => "$1ice", + '/(matr|vert|ind)ix|ex$/i' => "$1ices", + '/(x|ch|ss|sh)$/i' => "$1es", + '/([^aeiouy]|qu)y$/i' => "$1ies", + '/(hive)$/i' => "$1s", + '/(?:([^f])fe|([lr])f)$/i' => "$1$2ves", + '/(shea|lea|loa|thie)f$/i' => "$1ves", + '/sis$/i' => "ses", + '/([ti])um$/i' => "$1a", + '/(tomat|potat|ech|her|vet)o$/i' => "$1oes", + '/(bu)s$/i' => "$1ses", + '/(alias)$/i' => "$1es", + '/(octop)us$/i' => "$1i", + '/(ax|test)is$/i' => "$1es", + '/(us)$/i' => "$1es", + '/s$/i' => "s", + '/$/' => "s" + ); + + /** + * Singular word forms. + * + * @var array + */ + private static $singular = array( + '/(quiz)zes$/i' => "$1", + '/(matr)ices$/i' => "$1ix", + '/(vert|ind)ices$/i' => "$1ex", + '/^(ox)en$/i' => "$1", + '/(alias)es$/i' => "$1", + '/(octop|vir)i$/i' => "$1us", + '/(cris|ax|test)es$/i'=> "$1is", + '/(shoe)s$/i' => "$1", + '/(o)es$/i' => "$1", + '/(bus)es$/i' => "$1", + '/([m|l])ice$/i' => "$1ouse", + '/(x|ch|ss|sh)es$/i' => "$1", + '/(m)ovies$/i' => "$1ovie", + '/(s)eries$/i' => "$1eries", + '/([^aeiouy]|qu)ies$/i' => "$1y", + '/([lr])ves$/i' => "$1f", + '/(tive)s$/i' => "$1", + '/(hive)s$/i' => "$1", + '/(li|wi|kni)ves$/i' => "$1fe", + '/(shea|loa|lea|thie)ves$/i' => "$1f", + '/(^analy)ses$/i' => "$1sis", + '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => "$1$2sis", + '/([ti])a$/i' => "$1um", + '/(n)ews$/i' => "$1ews", + '/(h|bl)ouses$/i' => "$1ouse", + '/(corpse)s$/i' => "$1", + '/(us)es$/i' => "$1", + '/(us|ss)$/i' => "$1", + '/s$/i' => "", + ); + + /** + * Irregular word forms. + * + * @var array + */ + private static $irregular = array( + 'move' => 'moves', + 'foot' => 'feet', + 'goose' => 'geese', + 'sex' => 'sexes', + 'child' => 'children', + 'man' => 'men', + 'tooth' => 'teeth', + 'person' => 'people', + ); + + /** + * Uncountable word forms. + * + * @var array + */ + private static $uncountable = array( + 'sheep', + 'fish', + 'deer', + 'series', + 'species', + 'money', + 'rice', + 'information', + 'equipment', + ); /** * Convert a word to its plural form. @@ -121,47 +121,47 @@ class Inflector { */ public static function plural($value) { - // ----------------------------------------------------- - // If we have already pluralized this word, return it. - // ----------------------------------------------------- - if (array_key_exists($value, static::$plural_cache)) - { - return static::$plural_cache[$value]; - } - - // ----------------------------------------------------- - // Are the singular and plural forms the same? - // ----------------------------------------------------- - if (in_array(Str::lower($value), static::$uncountable)) - { - return static::$plural_cache[$value] = $value; - } - - // ----------------------------------------------------- - // Is the plural form irregular? - // ----------------------------------------------------- - foreach (static::$irregular as $pattern => $irregular) - { - $pattern = '/'.$pattern.'$/i'; - - if (preg_match($pattern, $value)) - { - return static::$plural_cache[$value] = preg_replace($pattern, $irregular, $value); - } - } - - // ----------------------------------------------------- - // Check the plural forms for matches. - // ----------------------------------------------------- - foreach (static::$plural as $pattern => $plural) - { - if (preg_match($pattern, $value)) - { - return static::$plural_cache[$value] = preg_replace($pattern, $plural, $value); - } - } - - return static::$plural_cache[$value] = $value; + // ----------------------------------------------------- + // If we have already pluralized this word, return it. + // ----------------------------------------------------- + if (array_key_exists($value, static::$plural_cache)) + { + return static::$plural_cache[$value]; + } + + // ----------------------------------------------------- + // Are the singular and plural forms the same? + // ----------------------------------------------------- + if (in_array(Str::lower($value), static::$uncountable)) + { + return static::$plural_cache[$value] = $value; + } + + // ----------------------------------------------------- + // Is the plural form irregular? + // ----------------------------------------------------- + foreach (static::$irregular as $pattern => $irregular) + { + $pattern = '/'.$pattern.'$/i'; + + if (preg_match($pattern, $value)) + { + return static::$plural_cache[$value] = preg_replace($pattern, $irregular, $value); + } + } + + // ----------------------------------------------------- + // Check the plural forms for matches. + // ----------------------------------------------------- + foreach (static::$plural as $pattern => $plural) + { + if (preg_match($pattern, $value)) + { + return static::$plural_cache[$value] = preg_replace($pattern, $plural, $value); + } + } + + return static::$plural_cache[$value] = $value; } /** @@ -172,47 +172,47 @@ public static function plural($value) */ public static function singular($value) { - // ----------------------------------------------------- - // If we have already singularized this word, return it. - // ----------------------------------------------------- - if (array_key_exists($value, static::$singular_cache)) - { - return static::$singular_cache[$value]; - } + // ----------------------------------------------------- + // If we have already singularized this word, return it. + // ----------------------------------------------------- + if (array_key_exists($value, static::$singular_cache)) + { + return static::$singular_cache[$value]; + } // ----------------------------------------------------- // Are the singular and plural forms the same? // ----------------------------------------------------- - if (in_array(Str::lower($value), static::$uncountable)) - { - return static::$singular_cache[$value] = $value; - } + if (in_array(Str::lower($value), static::$uncountable)) + { + return static::$singular_cache[$value] = $value; + } // ----------------------------------------------------- // Is the plural form irregular? // ----------------------------------------------------- - foreach (static::$irregular as $irregular => $pattern) - { - $pattern = '/'.$pattern.'$/i'; - - if (preg_match($pattern, $value)) - { + foreach (static::$irregular as $irregular => $pattern) + { + $pattern = '/'.$pattern.'$/i'; + + if (preg_match($pattern, $value)) + { return static::$singular_cache[$value] = preg_replace($pattern, $irregular, $value); - } - } + } + } // ----------------------------------------------------- // Check the singular forms for matches. // ----------------------------------------------------- - foreach (static::$singular as $pattern => $singular) - { - if (preg_match($pattern, $value)) - { + foreach (static::$singular as $pattern => $singular) + { + if (preg_match($pattern, $value)) + { return static::$singular_cache[$value] = preg_replace($pattern, $singular, $value); - } - } + } + } - return static::$singular_cache[$value] = $value; + return static::$singular_cache[$value] = $value; } /**