本文整理汇总了PHP中mb_ucfirst函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_ucfirst函数的具体用法?PHP mb_ucfirst怎么用?PHP mb_ucfirst使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mb_ucfirst函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: locale
function locale($label, $lang = null)
{
mb_internal_encoding("UTF-8");
if (is_null($lang)) {
$lang = sfContext::getInstance()->getUser()->getCulture();
}
$localeFile = sfConfig::get('sf_root_dir') . "/cache/locales.php";
if (is_readable($localeFile)) {
include $localeFile;
$lbl = explode('.', $label);
$ind = count($lbl) - 1;
if ($lbl[$ind] == 'label' && $ind > 0) {
unset($lbl[$ind]);
$ind--;
$add = ':';
$labelStr = '.label';
}
$lbl[$ind] = ucfirst($lbl[$ind]);
$upLabel = implode('.', $lbl);
if ($upLabel . $labelStr == $label) {
if ($lang == 'bg') {
$str = mb_ucfirst($locales[strtolower($upLabel)][$lang]) . $add;
} else {
$str = ucfirst($locales[strtolower($upLabel)][$lang]) . $add;
}
} else {
$str = $locales[strtolower($upLabel)][$lang] . $add;
}
}
if ($str == $add) {
$str = '*' . $upLabel . '*';
}
return $str;
}
示例2: formField
/**
* Get the form field for this field.
*
* We put this method at the field level as it allows us to easily
* create a new DB field and a new Form field and use them without
* the need to modify another place where the mapping would be
* performed.
*
* @param array Definition of the field.
* @param string Form field class.
*/
function formField($def, $form_field = 'Pluf_Form_Field_Varchar')
{
Pluf::loadClass('Pluf_Form_BoundField');
// To get mb_ucfirst
$defaults = array('required' => !$def['blank'], 'label' => mb_ucfirst($def['verbose']), 'help_text' => $def['help_text']);
unset($def['blank'], $def['verbose'], $def['help_text']);
if (isset($def['default'])) {
$defaults['initial'] = $def['default'];
unset($def['default']);
}
if (isset($def['choices'])) {
$defaults['widget'] = 'Pluf_Form_Widget_SelectInput';
if (isset($def['widget_attrs'])) {
$def['widget_attrs']['choices'] = $def['choices'];
} else {
$def['widget_attrs'] = array('choices' => $def['choices']);
}
}
foreach (array_keys($def) as $key) {
if (!in_array($key, array('widget', 'label', 'required', 'multiple', 'initial', 'choices', 'widget_attrs'))) {
unset($def[$key]);
}
}
$params = array_merge($defaults, $def);
return new $form_field($params);
}
示例3: testDSuccess
public function testDSuccess()
{
$data = array(array('in' => '1 1', 'out' => '1 1'));
foreach ($data as $num => $item) {
$this->assertEquals($item['out'], mb_ucfirst($item['in']), 'Test #' . ($num + 1));
}
}
示例4: modify_element
protected function modify_element($element)
{
if ($this->mb) {
return mb_ucfirst($element);
} else {
return ucfirst($element);
}
}
示例5: modify_paramvalue
protected function modify_paramvalue($from_value)
{
if ($this->mb) {
return mb_ucfirst($from_value);
} else {
return ucfirst($from_value);
}
}
示例6: test_mb_ucfirst
function test_mb_ucfirst()
{
$this->assertEquals('Åäö', mb_ucfirst('åäö'));
$this->assertEquals('Åäö öäå', mb_ucfirst('åäö öäå'));
$this->assertEquals(ucfirst('H.G. Wells'), mb_ucfirst('H.G. Wells'));
$this->assertEquals(ucfirst('h.g. wells'), mb_ucfirst('h.g. wells'));
$this->assertEquals(ucfirst('H.G. WELLS'), mb_ucfirst('H.G. WELLS'));
}
示例7: form
/**
* Function form
* @param $name
* @param bool $path
* @return object
*/
public static function form($name, $path = false)
{
$name = mb_ucfirst(mb_strtolower($name));
$className = $name . 'Form';
if ($path === false) {
$path = 'modules/' . CONTROLLER . '/system/form/' . $name . '.php';
}
incFile($path);
return new $className();
}
示例8: randSentence
function randSentence($mark = null)
{
$count = mt_rand(1, 3);
$sentence = mb_ucfirst($this->randPhrase());
for ($i = 1; $i < $count; ++$i) {
$sentence .= ', ' . $this->randPhrase();
}
$sentence .= $mark ? $mark : $this->randMark();
return $sentence;
}
示例9: assignViewVariables
protected function assignViewVariables() {
$this->_nickname = mb_ucfirst($this->_user->blip);
switch ($this->_template) {
case 'activation':
$activationUrl = $this->_view->serverUrl($this->_view->url(array('token' => $this->_user->token), 'account-activate'));
$this->_view->activationUrl = $activationUrl;
$this->_view->nickname = $this->_nickname;
break;
}
}
示例10: noteParserAddModel
function noteParserAddModel($note, $serial, $descript, $model, $time, $section)
{
$a = range('a', 'z');
$notes = explode('+', $note);
$descripts = explode(',', $descript);
foreach ($notes as $key => $value) {
$serial = $serial . '.' . $a[$key];
$descript = mb_ucfirst(trim($descripts[$key]));
$model1 = mb_ucfirst(trim($model));
$section = mb_ucfirst($section);
$time1 = sumNotes($value);
$tm->addTechmap($serial, $descript, $model1, $time1, $section);
$i++;
}
}
示例11: __construct
public function __construct($form, $field, $name)
{
$this->form = $form;
$this->field = $field;
$this->name = $name;
$this->html_name = $this->form->addPrefix($name);
if ($this->field->label == '') {
$this->label = mb_ereg_replace('/\\_/', '/ /', mb_ucfirst($name));
} else {
$this->label = $this->field->label;
}
$this->help_text = $this->field->help_text ? $this->field->help_text : '';
if (isset($this->form->errors[$name])) {
$this->errors = $this->form->errors[$name];
}
}
示例12: smarty_function_lang
function smarty_function_lang($params, $smarty)
{
if (!isset($params['code'])) {
throw new rad_exception("lang: missing 'code' parameter", E_USER_WARNING);
}
$params['code'] = trim($params['code'], " \t\"'");
if (isset($params['lang'])) {
$val = call_user_func_array(array(rad_config::getParam('loader_class'), 'lang'), array($params['code'], $params['lang']));
} else {
$val = call_user_func_array(array(rad_config::getParam('loader_class'), 'lang'), array($params['code']));
}
if (isset($params['find']) && isset($params['replace'])) {
if (!is_array($params['find'])) {
$params['find'] = array($params['find']);
}
if (!is_array($params['replace'])) {
$params['replace'] = array($params['replace']);
}
if (count($params['find']) != count($params['replace'])) {
throw new rad_exception('lang: find/replace params should either be both scalar or be arrays of the same size');
}
$find = reset($params['find']);
$replace = reset($params['replace']);
while ($find) {
$val = mb_str_replace($val, $find, $replace);
$find = next($params['find']);
$replace = next($params['replace']);
}
}
if (!empty($params['htmlchars'])) {
$val = mb_str_replace($val, '"', '"');
}
if (!empty($params['ucf'])) {
$val = mb_ucfirst($val);
}
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $val);
} else {
return $val;
}
}
示例13: getMvcRoute
/**
* mvc路由解析器,负责从参数中提取url路由信息
*/
function getMvcRoute()
{
//控制器
$c = getUrlString("_c");
//执行方法
$a = getUrlString("_a");
//url rewrite 读取路由,如 teacher_center/profile解析为$c=teacher_center,$a=profile
$s = getUrlString("_url");
if (!empty($s)) {
$s = trim(str_replace("/", " ", $s));
$urls = explode(" ", $s);
if (isset($urls[0])) {
$c = $urls[0];
}
if (isset($urls[1])) {
$a = $urls[1];
}
}
//默认访问方法为 index
if (empty($a)) {
$a = "index";
}
//默认控制器为 index
if (empty($c)) {
$c = "index";
}
//路由
$route = array("_a" => $a, "_c" => $c);
//转换 _c = 'ab_cd' 为 _c='AbCd'
$cs = explode("_", $c);
for ($index = 0; $index < count($cs); $index++) {
$cs[$index] = mb_ucfirst($cs[$index]);
}
$c = implode("", $cs);
$route["a"] = $a;
$route["c"] = $c;
return $route;
}
示例14: mb_ucfirst
private function mb_ucfirst($str, $encoding = "UTF-8", $lower_str_end = false)
{
if (!function_exists('mb_ucfirst')) {
$first_letter = mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding);
$str_end = "";
if ($lower_str_end) {
$str_end = mb_strtolower(mb_substr($str, 1, mb_strlen($str, $encoding), $encoding), $encoding);
} else {
$str_end = mb_substr($str, 1, mb_strlen($str, $encoding), $encoding);
}
$str = $first_letter . $str_end;
return $str;
} else {
return mb_ucfirst($str);
}
}
示例15: _getEventName
/**
* Get event name.
*
* @param $action
* @param string $position
* @return string
*/
protected function _getEventName($action, $position = 'bulkAfter')
{
$eventName = ['Controller.'];
if ($requestPrefix = $this->request->param('prefix')) {
$eventName[] = mb_ucfirst($requestPrefix) . '.';
}
$eventName[] = $this->_controller->name . '.';
$eventName[] = $position;
$eventName[] = mb_ucfirst($action);
return implode('', $eventName);
}