make it possible to override all of basics.php

This commit is contained in:
AD7six 2012-09-05 16:43:24 +02:00
parent 6664acba79
commit 99b798fa9a

View file

@ -30,6 +30,8 @@
define('MONTH', 2592000); define('MONTH', 2592000);
define('YEAR', 31536000); define('YEAR', 31536000);
if (!function_exists('config')) {
/** /**
* Loads configuration files. Receives a set of configuration files * Loads configuration files. Receives a set of configuration files
* to load. * to load.
@ -58,6 +60,10 @@ function config() {
return true; return true;
} }
}
if (!function_exists('debug')) {
/** /**
* Prints out debug information about given variable. * Prints out debug information about given variable.
* *
@ -116,6 +122,8 @@ TEXT;
} }
} }
}
if (!function_exists('sortByKey')) { if (!function_exists('sortByKey')) {
/** /**
@ -151,6 +159,8 @@ if (!function_exists('sortByKey')) {
} }
if (!function_exists('h')) {
/** /**
* Convenience method for htmlspecialchars. * Convenience method for htmlspecialchars.
* *
@ -192,6 +202,10 @@ function h($text, $double = true, $charset = null) {
return htmlspecialchars($text, ENT_QUOTES, ($charset) ? $charset : $defaultCharset, $double); return htmlspecialchars($text, ENT_QUOTES, ($charset) ? $charset : $defaultCharset, $double);
} }
}
if (!function_exists('pluginSplit')) {
/** /**
* Splits a dot syntax plugin name into its plugin and classname. * Splits a dot syntax plugin name into its plugin and classname.
* If $name does not have a dot, then index 0 will be null. * 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); return array($plugin, $name);
} }
}
if (!function_exists('pr')) {
/** /**
* Print_r convenience function, which prints out <PRE> tags around * Print_r convenience function, which prints out <PRE> tags around
* the output of given array. Similar to debug(). * the output of given array. Similar to debug().
@ -231,6 +249,10 @@ function pr($var) {
} }
} }
}
if (!function_exists('am')) {
/** /**
* Merge a group of arrays * Merge a group of arrays
* *
@ -253,6 +275,10 @@ function am() {
return $r; return $r;
} }
}
if (!function_exists('env')) {
/** /**
* Gets an environment variable from available sources, and provides emulation * Gets an environment variable from available sources, and provides emulation
* for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on * for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on
@ -362,6 +388,10 @@ function env($key) {
return null; return null;
} }
}
if (!function_exists('cache')) {
/** /**
* Reads/writes temporary data to cache files or session. * 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; return $data;
} }
}
if (!function_exists('clearCache')) {
/** /**
* Used to delete files in the cache directories, or clear contents of cache directories * 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; return false;
} }
}
if (!function_exists('stripslashes_deep')) {
/** /**
* Recursively strips slashes from all values in an array * Recursively strips slashes from all values in an array
* *
@ -494,6 +532,10 @@ function stripslashes_deep($values) {
return $values; return $values;
} }
}
if (!function_exists('__')) {
/** /**
* Returns a translated string if one is found; Otherwise, the submitted message. * Returns a translated string if one is found; Otherwise, the submitted message.
* *
@ -517,6 +559,10 @@ function __($singular, $args = null) {
return vsprintf($translated, $args); return vsprintf($translated, $args);
} }
}
if (!function_exists('__n')) {
/** /**
* Returns correct plural form of message identified by $singular and $plural for count $count. * 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. * 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); return vsprintf($translated, $args);
} }
}
if (!function_exists('__d')) {
/** /**
* Allows you to override the current domain for a single message lookup. * 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); return vsprintf($translated, $args);
} }
}
if (!function_exists('__dn')) {
/** /**
* Allows you to override the current domain for a single plural message lookup. * 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 * 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); return vsprintf($translated, $args);
} }
}
if (!function_exists('__dc')) {
/** /**
* Allows you to override the current domain for a single message lookup. * Allows you to override the current domain for a single message lookup.
* It also allows you to specify a category. * It also allows you to specify a category.
@ -631,6 +689,10 @@ function __dc($domain, $msg, $category, $args = null) {
return vsprintf($translated, $args); return vsprintf($translated, $args);
} }
}
if (!function_exists('__dcn')) {
/** /**
* Allows you to override the current domain for a single plural message lookup. * Allows you to override the current domain for a single plural message lookup.
* It also allows you to specify a category. * 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); 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. * 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. * 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); return vsprintf($translated, $args);
} }
}
if (!function_exists('LogError')) {
/** /**
* Shortcut to Log::write. * Shortcut to Log::write.
* *
@ -721,6 +791,10 @@ function LogError($message) {
CakeLog::write('error', str_replace($bad, $good, $message)); CakeLog::write('error', str_replace($bad, $good, $message));
} }
}
if (!function_exists('fileExistsInPath')) {
/** /**
* Searches include path for files. * Searches include path for files.
* *
@ -742,6 +816,10 @@ function fileExistsInPath($file) {
return false; return false;
} }
}
if (!function_exists('convertSlash')) {
/** /**
* Convert forward slashes to underscores and removes first and last underscores in a string * 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); $string = str_replace('/', '_', $string);
return $string; return $string;
} }
}