本文整理匯總了PHP中textlib::strtotitle方法的典型用法代碼示例。如果您正苦於以下問題:PHP textlib::strtotitle方法的具體用法?PHP textlib::strtotitle怎麽用?PHP textlib::strtotitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類textlib
的用法示例。
在下文中一共展示了textlib::strtotitle方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: uu_process_template_callback
/**
* Internal callback function.
*/
function uu_process_template_callback($username, $firstname, $lastname, $block)
{
switch ($block[3]) {
case 'u':
$repl = $username;
break;
case 'f':
$repl = $firstname;
break;
case 'l':
$repl = $lastname;
break;
default:
return $block[0];
}
switch ($block[1]) {
case '+':
$repl = textlib::strtoupper($repl);
break;
case '-':
$repl = textlib::strtolower($repl);
break;
case '~':
$repl = textlib::strtotitle($repl);
break;
}
if (!empty($block[2])) {
$repl = textlib::substr($repl, 0, $block[2]);
}
return $repl;
}
示例2: tag_display_name
/**
* Function that returns the name that should be displayed for a specific tag
*
* @package core_tag
* @category tag
* @access public
* @param object $tagobject a line out of tag table, as returned by the adobd functions
* @param int $html TAG_RETURN_HTML (default) will return htmlspecialchars encoded string, TAG_RETURN_TEXT will not encode.
* @return string
*/
function tag_display_name($tagobject, $html=TAG_RETURN_HTML) {
global $CFG;
if (!isset($tagobject->name)) {
return '';
}
if (empty($CFG->keeptagnamecase)) {
//this is the normalized tag name
$tagname = textlib::strtotitle($tagobject->name);
} else {
//original casing of the tag name
$tagname = $tagobject->rawname;
}
// clean up a bit just in case the rules change again
$tagname = clean_param($tagname, PARAM_TAG);
if ($html == TAG_RETURN_TEXT) {
return $tagname;
} else { // TAG_RETURN_HTML
return htmlspecialchars($tagname);
}
}
示例3: test_strtotitle
/**
* Tests the static strtotitle method
* @return void
*/
public function test_strtotitle()
{
$str = "žluťoučký koníček";
$this->assertSame(textlib::strtotitle($str), "Žluťoučký Koníček");
}
示例4: process_template_callback
/**
* Internal callback function.
*/
function process_template_callback($block)
{
global $template_globals;
$textlib = textlib::get_instance();
$repl = $block[0];
switch ($block[3]) {
case 'u':
$repl = $template_globals->username;
break;
case 'f':
$repl = $template_globals->firstname;
break;
case 'l':
$repl = $template_globals->lastname;
break;
}
switch ($block[1]) {
case '+':
$repl = textlib::strtoupper($repl);
break;
case '-':
$repl = textlib::strtolower($repl);
break;
case '~':
$repl = textlib::strtotitle($repl);
break;
}
if (!empty($block[2])) {
$repl = textlib::substr($repl, 0, $block[2]);
}
return $repl;
}