本文整理汇总了PHP中str::ucfirst方法的典型用法代码示例。如果您正苦于以下问题:PHP str::ucfirst方法的具体用法?PHP str::ucfirst怎么用?PHP str::ucfirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类str
的用法示例。
在下文中一共展示了str::ucfirst方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send()
{
if (c::get('email.disabled')) {
return array('status' => 'error', 'msg' => l::get('email.disabled', 'Email has been disabled'));
}
if (!v::email($this->extractAddress($this->options['from']))) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.sender', 'Invalid sender'));
}
if (!v::email($this->extractAddress($this->options['to']))) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.recipient', 'Invalid recipient'));
}
if (!v::email($this->extractAddress($this->options['replyto']))) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.replyto', 'Invalid Reply-To Address'));
}
if (str::length($this->options['subject']) == 0) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.subject', 'The subject is missing'));
}
$method = 'sendWith' . str::ucfirst($this->options['use']);
if (!method_exists(__CLASS__, $method)) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.mailer', 'This email service is not supported'));
}
return $this->{$method}();
}
示例2: array
}
/**
* Json adapter
*/
data::$adapters['json'] = array('extension' => 'json', 'encode' => function ($data) {
return json_encode($data);
}, 'decode' => function ($string) {
return json_decode($string, true);
});
/**
* Kirby data adapter
*/
data::$adapters['kd'] = array('extension' => array('md', 'txt'), 'encode' => function ($data) {
$result = array();
foreach ($data as $key => $value) {
$key = str::ucfirst(str::slug($key));
if (empty($key) or is_null($value)) {
continue;
}
// escape accidental dividers within a field
$value = preg_replace('!(\\n|^)----(.*?\\R*)!', "\$1\\----\$2", $value);
// multi-line content
if (preg_match('!\\R!', $value, $matches)) {
$result[$key] = $key . ": \n\n" . trim($value);
// single-line content
} else {
$result[$key] = $key . ': ' . trim($value);
}
}
return implode("\n\n----\n\n", $result);
}, 'decode' => function ($string) {
示例3: ecco
ecco(trim($variant->description()) != '', $variant->description()->kirbytext()->bidi());
?>
</div>
<?php
if ($variant->hasOptions) {
?>
<select dir="auto" class="uk-width-1-1" name="option">
<?php
foreach (str::split($variant->options()) as $option) {
?>
<option value="<?php
echo str::slug($option);
?>
"><?php
echo str::ucfirst($option);
?>
</option>
<?php
}
?>
</select>
<?php
}
?>
<button <?php
e(inStock($variant), '', 'disabled');
?>
class="uk-button uk-button-primary uk-width-1-1" type="submit" property="offers" typeof="Offer">
<?php
示例4: testUcfirst
public function testUcfirst()
{
$string = str::lower($this->sample);
$this->assertEquals('Super äwesøme string', str::ucfirst($string));
}
示例5: foreach
?>
</div>
<?php
} else {
?>
<div class="info">
<dl>
<?php
foreach (data::siteData() as $key => $value) {
?>
<dt><?php
echo str::ucfirst($key);
?>
</dt>
<dd><?php
echo empty($value) ? ' ' : html($value);
?>
</dd>
<?php
}
?>
</dl>
</div>
<?php
}
示例6: label
function label($var)
{
return '<label>' . str::ucfirst($var) . '</label>';
}
示例7: templateName
static function templateName($name = false)
{
global $page;
$template = $name ? $name : $page->template();
$settings = settings::load($template);
return $settings ? a::get($settings, 'title', str::ucfirst($template)) : str::ucfirst($template);
}
示例8: label
function label($var, $field)
{
$text = self::multilangtext($var, $field['name']);
$required = $field['required'] == true ? '<span class="required">*</span>' : '';
$lang = c::get('lang.support') ? '<small>' . c::get('lang.current') . '</small>' : '';
return '<label>' . str::ucfirst($text) . $lang . $required . '</label>';
}
示例9: label
function label($var, $field)
{
$required = $field['required'] == true ? '<span class="required">*</span>' : '';
return '<label>' . str::ucfirst($var) . $required . '</label>';
}
示例10: array
data::$adapters['json'] = array('extension' => 'json', 'encode' => function ($data) {
return json_encode($data);
}, 'decode' => function ($string) {
return json_decode($string, true);
});
/**
* Kirby data adapter
*/
data::$adapters['kd'] = array('extension' => array('md', 'txt'), 'encode' => function ($data) {
$divider = "\n----\n";
$result = null;
$break = null;
$keys = array();
foreach ($data as $key => $value) {
$key = str::slug($key);
$key = str::ucfirst(str_replace('-', '_', $key));
if (in_array($key, $keys) || empty($key)) {
continue;
}
$keys[] = $key;
$result .= $break . $key . ': ' . trim($value);
$break = $divider;
}
return $result;
}, 'decode' => function ($string) {
// remove BOM
$string = str_replace(BOM, '', $string);
// explode all fields by the line separator
$fields = explode("\n----", $string);
// start the data array
$data = array();