mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-28 04:32:57 +00:00
make it possible to override all of basics.php
This commit is contained in:
parent
6664acba79
commit
99b798fa9a
1 changed files with 439 additions and 359 deletions
|
@ -30,6 +30,8 @@
|
|||
define('MONTH', 2592000);
|
||||
define('YEAR', 31536000);
|
||||
|
||||
if (!function_exists('config')) {
|
||||
|
||||
/**
|
||||
* Loads configuration files. Receives a set of configuration files
|
||||
* to load.
|
||||
|
@ -58,6 +60,10 @@ function config() {
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('debug')) {
|
||||
|
||||
/**
|
||||
* Prints out debug information about given variable.
|
||||
*
|
||||
|
@ -116,6 +122,8 @@ TEXT;
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('sortByKey')) {
|
||||
|
||||
/**
|
||||
|
@ -151,6 +159,8 @@ if (!function_exists('sortByKey')) {
|
|||
|
||||
}
|
||||
|
||||
if (!function_exists('h')) {
|
||||
|
||||
/**
|
||||
* Convenience method for htmlspecialchars.
|
||||
*
|
||||
|
@ -192,6 +202,10 @@ function h($text, $double = true, $charset = null) {
|
|||
return htmlspecialchars($text, ENT_QUOTES, ($charset) ? $charset : $defaultCharset, $double);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('pluginSplit')) {
|
||||
|
||||
/**
|
||||
* Splits a dot syntax plugin name into its plugin and classname.
|
||||
* If $name does not have a dot, then index 0 will be null.
|
||||
|
@ -215,6 +229,10 @@ function pluginSplit($name, $dotAppend = false, $plugin = null) {
|
|||
return array($plugin, $name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('pr')) {
|
||||
|
||||
/**
|
||||
* Print_r convenience function, which prints out <PRE> tags around
|
||||
* the output of given array. Similar to debug().
|
||||
|
@ -231,6 +249,10 @@ function pr($var) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('am')) {
|
||||
|
||||
/**
|
||||
* Merge a group of arrays
|
||||
*
|
||||
|
@ -253,6 +275,10 @@ function am() {
|
|||
return $r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('env')) {
|
||||
|
||||
/**
|
||||
* Gets an environment variable from available sources, and provides emulation
|
||||
* for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on
|
||||
|
@ -362,6 +388,10 @@ function env($key) {
|
|||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('cache')) {
|
||||
|
||||
/**
|
||||
* Reads/writes temporary data to cache files or session.
|
||||
*
|
||||
|
@ -414,6 +444,10 @@ function cache($path, $data = null, $expires = '+1 day', $target = 'cache') {
|
|||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('clearCache')) {
|
||||
|
||||
/**
|
||||
* Used to delete files in the cache directories, or clear contents of cache directories
|
||||
*
|
||||
|
@ -476,6 +510,10 @@ function clearCache($params = null, $type = 'views', $ext = '.php') {
|
|||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('stripslashes_deep')) {
|
||||
|
||||
/**
|
||||
* Recursively strips slashes from all values in an array
|
||||
*
|
||||
|
@ -494,6 +532,10 @@ function stripslashes_deep($values) {
|
|||
return $values;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('__')) {
|
||||
|
||||
/**
|
||||
* Returns a translated string if one is found; Otherwise, the submitted message.
|
||||
*
|
||||
|
@ -517,6 +559,10 @@ function __($singular, $args = null) {
|
|||
return vsprintf($translated, $args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('__n')) {
|
||||
|
||||
/**
|
||||
* Returns correct plural form of message identified by $singular and $plural for count $count.
|
||||
* Some languages have more than one form for plural messages dependent on the count.
|
||||
|
@ -543,6 +589,10 @@ function __n($singular, $plural, $count, $args = null) {
|
|||
return vsprintf($translated, $args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('__d')) {
|
||||
|
||||
/**
|
||||
* Allows you to override the current domain for a single message lookup.
|
||||
*
|
||||
|
@ -566,6 +616,10 @@ function __d($domain, $msg, $args = null) {
|
|||
return vsprintf($translated, $args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('__dn')) {
|
||||
|
||||
/**
|
||||
* Allows you to override the current domain for a single plural message lookup.
|
||||
* Returns correct plural form of message identified by $singular and $plural for count $count
|
||||
|
@ -593,6 +647,10 @@ function __dn($domain, $singular, $plural, $count, $args = null) {
|
|||
return vsprintf($translated, $args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('__dc')) {
|
||||
|
||||
/**
|
||||
* Allows you to override the current domain for a single message lookup.
|
||||
* It also allows you to specify a category.
|
||||
|
@ -631,6 +689,10 @@ function __dc($domain, $msg, $category, $args = null) {
|
|||
return vsprintf($translated, $args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('__dcn')) {
|
||||
|
||||
/**
|
||||
* Allows you to override the current domain for a single plural message lookup.
|
||||
* It also allows you to specify a category.
|
||||
|
@ -673,6 +735,10 @@ function __dcn($domain, $singular, $plural, $count, $category, $args = null) {
|
|||
return vsprintf($translated, $args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('__c')) {
|
||||
|
||||
/**
|
||||
* The category argument allows a specific category of the locale settings to be used for fetching a message.
|
||||
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
|
||||
|
@ -707,6 +773,10 @@ function __c($msg, $category, $args = null) {
|
|||
return vsprintf($translated, $args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('LogError')) {
|
||||
|
||||
/**
|
||||
* Shortcut to Log::write.
|
||||
*
|
||||
|
@ -721,6 +791,10 @@ function LogError($message) {
|
|||
CakeLog::write('error', str_replace($bad, $good, $message));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('fileExistsInPath')) {
|
||||
|
||||
/**
|
||||
* Searches include path for files.
|
||||
*
|
||||
|
@ -742,6 +816,10 @@ function fileExistsInPath($file) {
|
|||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('convertSlash')) {
|
||||
|
||||
/**
|
||||
* Convert forward slashes to underscores and removes first and last underscores in a string
|
||||
*
|
||||
|
@ -755,3 +833,5 @@ function convertSlash($string) {
|
|||
$string = str_replace('/', '_', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue