summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class11
1 files changed, 7 insertions, 4 deletions
diff --git a/it.class b/it.class
index 067b241..1785ea3 100644
--- a/it.class
+++ b/it.class
@@ -25,7 +25,6 @@ static $error_context; # Callback, can provide $p params like 'head' and 'toscre
/**
* Create config class with static members initialized (e.g. $home).
- * NOTE: PHP5 ONLY
* @param $p Static members to be generated in newly created class
* service: Class name of created class (default: from caller path)
* home: Home directory of application (default: from caller path)
@@ -44,6 +43,10 @@ static function createconfig($p = array())
'service' => $parts[2],
);
+ # Add credentials from service's "var/credentials" as static members so they don't need to be in git
+ foreach (it::match('(\w+)\s*=\s*["\']?(.*?)["\']?$', @it::file_get_contents($GLOBALS['ULTRAHOME'] . "/var/credentials"), ['multiline' => true, 'all' => true]) as $env)
+ $p += [$env[0] => $env[1]];
+
if (class_exists($p['service'] . "_tools"))
$extends = "extends {$p['service']}_tools ";
@@ -623,7 +626,7 @@ static function any2utf8($value, $errprefix = "")
*/
static function ucfirst($string)
{
- return mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1);
+ return mb_ucfirst($string);
}
/**
@@ -631,7 +634,7 @@ static function ucfirst($string)
*/
static function lcfirst($string)
{
- return mb_strtolower(mb_substr($string, 0, 1)) . mb_substr($string, 1);
+ return mb_lcfirst($string);
}
/**
@@ -639,7 +642,7 @@ static function lcfirst($string)
*/
static function ucwords($string)
{
- return preg_replace_callback('/\b\w/u', function($m) { return mb_strtoupper($m[0]); }, mb_strtolower($string));
+ return mb_convert_case($string, MB_CASE_TITLE, "UTF-8");
}
static function substr_replace($string, $replacement, $start, $length)