本文整理汇总了PHP中ucWords函数的典型用法代码示例。如果您正苦于以下问题:PHP ucWords函数的具体用法?PHP ucWords怎么用?PHP ucWords使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ucWords函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Standard init function to instantiate language object
* and create title, etc
*/
public function init()
{
try {
$this->objLanguage = $this->getObject('language', 'language');
$this->title = ucWords($this->objLanguage->code2Txt('mod_context_learneroutcomes', 'context'));
} catch (customException $e) {
customException::cleanUp();
}
}
示例2: stringToName
/**
* Converts given string into CamelCased class name
*
* @return string
* @param string $string
*/
public static function stringToName($string)
{
$result = strToLower($string);
$result = str_replace('-', ' ', $result);
$result = ucWords($result);
$result = str_replace(' ', '', $result);
$result = trim($result);
return $result;
}
示例3: getBlankXml
function getBlankXml($type)
{
$function = 'Pulsestorm\\Magento2\\Cli\\Xml_Template';
$function .= '\\getBlankXml' . ucWords(strToLower($type));
if (function_exists($function)) {
return call_user_func($function);
}
throw new Exception("No such type, {$type}");
}
示例4: common
/**
* Выполняет общее преобразование короткого имени в имя класса:
* - Приводит переданное значение к CamelCase
* - Удаляет знак "минус"
* - Заменяет знак "слеш" на разделитель пространства имён
*
* @return string
* @param string $value
*/
public static function common($value)
{
$result = preg_replace('/\\s+/', '', trim($value));
$result = strToLower($result);
$result = str_replace(array('-', '/'), array(' ', '. '), $result);
$result = ucWords($result);
$result = str_replace(array(' ', '.'), array('', NS), $result);
return trim($result);
}
示例5: init
/**
* Standard init function to instantiate language object
* and create title, etc
*/
public function init()
{
try {
$this->loadClass('link', 'htmlelements');
$this->objLanguage = $this->getObject('language', 'language');
$this->title = ucWords($this->objLanguage->code2Txt('mod_context_aboutcontext', 'context'));
} catch (customException $e) {
customException::cleanUp();
}
}
示例6: mb_convert_case
function mb_convert_case($str, $mode, $enc = '')
{
switch ($mode) {
case MB_CASE_LOWER:
return strToLower($str);
case MB_CASE_UPPER:
return strToUpper($str);
case MB_CASE_TITLE:
return ucWords(strToLower($str));
default:
return $str;
}
}
示例7: init
/**
* Standard init function to instantiate language object
* and create title, etc
*/
public function init()
{
try {
$this->objLanguage = $this->getObject('language', 'language');
$this->title = ucWords($this->objLanguage->code2Txt('mod_context_allcontexts', 'context', NULL, 'All [-contexts-]'));
// HTML Elements
$this->loadClass('form', 'htmlelements');
$this->loadClass('dropdown', 'htmlelements');
$this->loadClass('button', 'htmlelements');
} catch (customException $e) {
customException::cleanUp();
}
}
示例8: Radio
function Radio($name, $value = '', $class = 'check_radio', $js_event_str = '')
{
$data = $this->getStatusCodes();
$str = '';
foreach ($data as $k => $v) {
$slcted = '';
if ($v == $value) {
$slcted .= " checked='checked'";
}
$str .= "<input type='radio' name='" . $name . "' value='" . $v . "'" . $slcted . " class='" . $class . "'" . $js_event_str . "> " . ucWords($v) . " ";
}
return $str;
}
示例9: formatName
public static function formatName($name, $controller = true)
{
$result = strToLower($name);
$result = str_replace('-', ' ', $result);
$result = ucWords($result);
$result = str_replace(' ', '', $result);
$result = trim($result);
if ($controller) {
$result .= self::SUFFIX_CONTROLLER;
} else {
$result = strToLower($result[0]) . subStr($result, 1);
$result .= self::SUFFIX_ACTION;
}
return $result;
}
示例10: request
public function request($url, $post = null)
{
$method = $this->getUse();
if (in_array($method, $this->_methods)) {
$method_name = '_request' . ucWords($method);
if (!method_exists($this, $method_name)) {
throw new Exception("Method {$method_name} does not exists.");
}
if ($this->debug()) {
echo "\nTrying to get '{$url}' using " . strtoupper($method);
}
return call_user_func(array($this, $method_name), $url, $post);
} else {
throw new Exception('Method not seted.');
}
}
示例11: run
/**
* 呼び出し元のコントローラーから呼び出すモデルを判定しrun()を実行します。
*
* 実行モデル:
* 同一Bundle内にコントローラー名のControllerを省く文字のディレクトリ内にある
* 実行したActionをCamel式で表したファイル名
*/
protected final function run($inputParam = array())
{
$backtrace = debug_backtrace();
$controllerClass = get_class($this);
$functionName = $backtrace[1]['function'];
$serviceName = preg_replace('/Controller$/', '', preg_replace('/^.*\\\\/', '', $controllerClass));
$actionName = ucWords(preg_replace('/Action$/', '', $functionName));
$tmp = '\\Service\\' . $serviceName . '\\' . $actionName;
$classPath = preg_replace('/\\\\Controller.*$/', $tmp, $controllerClass);
$service = new $classPath($this->container);
if (is_null($service)) {
throw new \ErrorException('Service is not found.');
}
$result = $service->run($inputParam);
return $result;
}
示例12: init
/**
* Standard init function to instantiate language object
* and create title, etc
*/
public function init()
{
try {
$this->objLanguage = $this->getObject('language', 'language');
$this->objUserContext = $this->getObject('usercontext', 'context');
$this->objUser = $this->getObject('user', 'security');
$this->objContext = $this->getObject('dbcontext');
$this->objGroups = $this->getObject('groupAdminModel', 'groupadmin');
$this->title = ucWords($this->objLanguage->code2Txt('phrase_mycourses', 'system', NULL, 'My [-contexts-]'));
// HTML Elements
$this->loadClass('form', 'htmlelements');
$this->loadClass('dropdown', 'htmlelements');
$this->loadClass('button', 'htmlelements');
} catch (customException $e) {
customException::cleanUp();
}
}
示例13: letrasIniciais
function letrasIniciais($nome, $minusculas = true)
{
$nome = ucWords(strtolower($nome));
#ESSA LINHA
$nome = ereg_replace("Da|De|Di|Do|Du", "", $nome);
# ESSA Tambem
preg_match_all('/\\s?([A-Z])/', $nome, $matches);
$ret = implode('', $matches[1]);
return $minusculas ? strtoupper($ret) : $ret;
}
示例14: _get_request_headers_as_string
function _get_request_headers_as_string()
{
global $_SERVER, $orig_url;
$ret = '';
$ret .= $_SERVER['REQUEST_METHOD'] . ' ' . $orig_url . ' ' . $_SERVER['SERVER_PROTOCOL'] . "\r\n";
foreach ($_SERVER as $k => $v) {
if (subStr($k, 0, 5) === 'HTTP_') {
$k = str_replace(' ', '-', ucWords(str_replace('_', ' ', strToLower(subStr($k, 5)))));
$ret .= $k . ': ' . $v . "\r\n";
}
}
$ret .= "\r\n";
return $ret;
}
示例15: execute
function execute(&$data, &$parent)
{
if (!array_key_exists($this->data, $data)) {
//echo "did not find " . $this->data;
return "";
}
$result = $data[$this->data];
if ($this->args) {
// print "[[" . $this->args . "]]";
$modifiers = preg_split("!\\s!", $this->args);
//print count($modifiers) . "modifiers";
// print_r($modifiers);
foreach ($modifiers as $modifierString) {
preg_match("!(\\w*)(.*)!", $modifierString, $matches);
//print_r($matches);
$modifier = $matches[1];
//print "[$modifier]";
$argumentString = $matches[2];
$arguments = array();
if ($argumentString) {
$delim = $argumentString[0];
$arguments = explode($delim, substr($argumentString, 1));
}
switch ($modifier) {
case 'capUpper':
$result = strtoupper($result);
break;
case 'capLower':
$result = strtolower($result);
break;
case 'capWord':
$result = ucWords($result);
break;
case 'capSentence':
$result = ucFirst($result);
break;
case 'trim':
$result = trim($result);
break;
case 'htmlencode':
$result = htmlentities($result);
break;
case 'htmldecode':
$result = html_entity_decode($result);
break;
case 'makesafe':
$result = mysql_real_escape_string($result);
break;
case 'utf8decode':
$result = utf8_decode($result);
break;
case 'utf8encode':
$result = utf8_encode($result);
break;
case 'strtotime':
$result = strtotime($result);
break;
case 'stripslashes':
$result = stripslashes($result);
break;
case 'addslashes':
$result = addslashes($result);
break;
case 'addone':
$result++;
break;
case 'number':
//print_r($arguments);
$dec = 2;
if (count($arguments) > 0) {
$dec = $arguments[0];
}
$dot = ",";
if (count($arguments) > 1) {
$dot = $arguments[1];
}
$sep = ".";
if (count($arguments) > 2) {
$sep = $arguments[2];
}
$result = number_format($result, $dec, $dot, $sep);
break;
case 'printf':
$format = "";
if (count($arguments) == 0) {
break;
}
$format = $arguments[0];
$result = sprintf($format, $result);
break;
case 'date':
$format = "";
if (count($arguments) == 0) {
break;
}
$format = $arguments[0];
$result = date($format, $result);
break;
default:
}
//.........这里部分代码省略.........