本文整理汇总了PHP中mb_ucfirst函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_ucfirst函数的具体用法?PHP mb_ucfirst怎么用?PHP mb_ucfirst使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mb_ucfirst函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:kotow,项目名称:work,代码行数:34,代码来源:LocalisationHelper.php
示例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);
}
开发者ID:burbuja,项目名称:pluf,代码行数:37,代码来源:Field.php
示例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));
}
}
开发者ID:agelxnash,项目名称:functions,代码行数:7,代码来源:UcfirstTest.php
示例4: modify_element
protected function modify_element($element)
{
if ($this->mb) {
return mb_ucfirst($element);
} else {
return ucfirst($element);
}
}
开发者ID:tomzx,项目名称:wikimedia-apibot,代码行数:8,代码来源:ucfirst.php
示例5: modify_paramvalue
protected function modify_paramvalue($from_value)
{
if ($this->mb) {
return mb_ucfirst($from_value);
} else {
return ucfirst($from_value);
}
}
开发者ID:tomzx,项目名称:wikimedia-apibot,代码行数:8,代码来源:ucfirst.php
示例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'));
}
开发者ID:martinlindhe,项目名称:php-mb-helpers,代码行数:8,代码来源:mb_helpersTest.php
示例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();
}
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:16,代码来源:Call.php
示例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;
}
开发者ID:pta,项目名称:oes,代码行数:10,代码来源:TXTGen.php
示例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;
}
}
开发者ID:niieani,项目名称:nandu,代码行数:11,代码来源:Email.php
示例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++;
}
}
开发者ID:JuriMelnikov,项目名称:starinar,代码行数:15,代码来源:upload.php
示例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];
}
}
开发者ID:chenchaodev,项目名称:vimercode,代码行数:16,代码来源:BoundField.php
示例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;
}
}
开发者ID:ValenokPC,项目名称:tabernacms,代码行数:41,代码来源:function.lang.php
示例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;
}
开发者ID:Honvid,项目名称:HCMS,代码行数:41,代码来源:functions.php
示例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);
}
}
开发者ID:jimtendo,项目名称:named-entities-finder,代码行数:16,代码来源:NamedEntitiesFinder.php
示例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);
}
开发者ID:Cheren,项目名称:union,代码行数:18,代码来源:BulkProcessComponent.php
示例16: __
}
// Lang trick
$a = __('1day') . __('1week') . __('1month');
if (!isset($datam['misc'])) {
break;
}
if (is_null($datam['misc']['sum_rain'])) {
break;
}
echo '<tr><th valign="top">' . __('Rain Sum') . ' (' . __($scales['module']) . ')' . '</th><td valign="top" class="mm">';
echo sprintf(__('%smm'), floor((double) $datam['misc']['sum_rain'] * 10) / 10);
echo '</td></tr>';
$this_device_disp--;
if ($mm_display_when) {
echo '<tr><td class="mmd" colspan="2">';
echo sprintf(__('on %1$s %2$s at %5$s:%6$s'), mb_ucfirst(strftime('%A', $datam['misc']['date_sum_rain'])), strftime('%e', $datam['misc']['date_sum_rain']), mb_ucfirst(strftime('%B', $datam['misc']['date_sum_rain'])), strftime('%Y', $datam['misc']['date_sum_rain']), strftime('%H', $datam['misc']['date_sum_rain']), strftime('%M', $datam['misc']['date_sum_rain']));
echo '</td></tr>';
$this_device_disp--;
}
break;
case 'sum_rain_24':
if ($type !== 'rain') {
break;
}
if (!isset($datam['dashboard']['sum_rain_24'])) {
break;
}
if (is_null($datam['dashboard']['sum_rain_24'])) {
break;
}
echo '<tr><th valign="top">' . __('Rain Sum (24h)') . '</th><td valign="top" class="mm">';
开发者ID:potskymac,项目名称:Netatmo,代码行数:31,代码来源:index_combined.php
示例17: display_post_format
/**
* This function design for return a string of the post format with the appropriate text
*/
function display_post_format()
{
if (has_post_format()) {
return 'Post Format: ' . mb_ucfirst(get_post_format());
}
}
开发者ID:DimaStelmakh,项目名称:primary-technology-test,代码行数:9,代码来源:shortcodes.php
示例18: getImport
public function getImport()
{
$xsdstring = $_SERVER['DOCUMENT_ROOT'] . "/import.xml";
$excel = new XML2003Parser($xsdstring);
$table = $excel->getTableData();
function mb_ucfirst($str, $enc = 'utf-8')
{
return mb_strtoupper(mb_substr($str, 0, 1, $enc), $enc) . mb_substr($str, 1, mb_strlen($str, $enc), $enc);
}
foreach ($table["table_contents"] as $row) {
if (isset($row["row_contents"][2]) && isset($row["row_contents"][0])) {
$id = $row["row_contents"][0]['value'];
$value = trim(mb_ucfirst(mb_strtolower($row["row_contents"][2]['value'])));
$postlang = PostLang::find($id);
if ($postlang) {
$postlang->title = $value;
$postlang->uri = PostLang::uniqURI($id, $value);
$postlang->save();
} else {
echo "undefined {$id} <br>";
}
//echo "$id $value<br><br><br>";
}
}
return [];
}
开发者ID:vcorobceanu,项目名称:WebAPL,代码行数:26,代码来源:PageController.php
示例19: rule
/**
* Convenience method to add a single validation rule
*
* @param string $rule
* @param array $fields
* @return $this
* @throws \InvalidArgumentException
*/
public function rule($rule, $fields)
{
if (!isset(static::$_rules[$rule])) {
$ruleMethod = 'validate' . ucfirst($rule);
if (!method_exists($this, $ruleMethod)) {
throw new \InvalidArgumentException("Rule '" . $rule . "' has not been registered with " . __CLASS__ . "::addRule().");
}
}
// Ensure rule has an accompanying message
$message = isset(static::$_ruleMessages[$rule]) ? static::$_ruleMessages[$rule] : self::ERROR_DEFAULT;
// Get any other arguments passed to function
$params = array_slice(func_get_args(), 2);
$this->_validations[] = array('rule' => $rule, 'fields' => (array) $fields, 'params' => (array) $params, 'message' => mb_ucfirst($message, 'UTF-8'));
return $this;
}
开发者ID:asabirov,项目名称:valitron,代码行数:23,代码来源:Validator.php
示例20: work
public function work($money, $kopnum = false)
{
$kop = substr($money, -2);
$rub = substr($money, 0, -3);
if (!$rub) {
$this->out[] = 'ноль';
} else {
$this->out[] = $this->num2str->work($rub, $this->names[1]['sem']);
}
$this->out[] = $this->num2str->semantic($rub, $this->names[1]);
if (!$kopnum) {
if (!$kop) {
$this->out[] = 'ноль';
} else {
$this->out[] = $this->num2str->work($kop, $this->names[2]['sem']);
}
} else {
$this->out[] = $kop;
}
$this->out[] = $this->num2str->semantic($kop, $this->names[2]);
$temp = trim(implode(' ', $this->out), ' ');
$temp = trim($temp);
$this->out = array();
return mb_ucfirst($temp, 'UTF-8');
}
开发者ID:slavic18,项目名称:cats,代码行数:25,代码来源:fruitframe-money2str.php
注:本文中的mb_ucfirst函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论