本文整理汇总了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;
}