本文整理汇总了PHP中UTF8::ucfirst方法的典型用法代码示例。如果您正苦于以下问题:PHP UTF8::ucfirst方法的具体用法?PHP UTF8::ucfirst怎么用?PHP UTF8::ucfirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTF8
的用法示例。
在下文中一共展示了UTF8::ucfirst方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: label
/**
* Return an html label linked to a given input field
* @param string $name the name of the Jam_Model attribute
* @param string $label the text of the label, can be autogenerated if NULL
* @param array $attributes of the input field, extract the id from there
* @return string
*/
public function label($name, $label = NULL, array $attributes = array())
{
$field_attributes = $this->default_attributes($name, $attributes);
if ($label === NULL) {
if ($this->meta()->field($name) and $this->meta()->field($name)->label !== NULL) {
$label = UTF8::ucfirst($this->meta()->field($name)->label);
} else {
$label = UTF8::ucfirst(Inflector::humanize($name));
}
}
return Form::label($field_attributes['id'], $label, $attributes);
}
示例2:
<span class="error-message"><?php
echo UTF8::ucfirst($field->error());
?>
</span>
示例3: _group_by_city
/**
* Group events by city
*
* @param array|Database_Result $events
* @return array
*/
protected function _group_by_city($events)
{
$grouped = array();
if (count($events)) {
// Build grouped array
foreach ($events as $event) {
// Date
$date = date('Y-m-d', $event->stamp_begin);
if (!isset($grouped[$date])) {
$grouped[$date] = array();
}
// City
$city = UTF8::ucfirst(mb_strtolower($event->city_id ? $event->city()->name : $event->city_name));
if (!isset($grouped[$date][$city])) {
$grouped[$date][$city] = array();
}
$grouped[$date][$city][] = $event;
}
// Sort by city
$dates = array_keys($grouped);
foreach ($dates as $date) {
ksort($grouped[$date]);
// Drop empty cities to last
if (isset($grouped[$date][''])) {
$grouped[$date][__('Elsewhere')] = $grouped[$date][''];
unset($grouped[$date]['']);
}
}
}
return $grouped;
}
示例4: foreach
foreach ($notifications as $type => $notification) {
?>
<?php
if (!empty($notification)) {
?>
<?php
foreach ($notification as $notice) {
?>
<div class="<?php
echo $type;
?>
">
<div class="inner">
<h6><?php
echo __(UTF8::ucfirst($type));
?>
</h6>
<?php
if ($notice['message'] !== NULL) {
?>
<p><?php
echo $notice['message'];
?>
</p>
<?php
}
?>
<?php
示例5: driver
/**
* Return or create a new driver instance
*
* @access public
* @param mixed $save_instance. (default: FALSE)
* @return Formo_Driver
*/
public function driver($save_instance = TRUE)
{
// Fetch the current settings
$driver = $this->get('driver');
$instance = $this->get('driver_instance');
$class = 'Formo_Driver_' . ucfirst($driver);
// If the instance is the correct driver for the field, return it
if ($instance and $instance instanceof $class) {
return $instance;
}
// Build the class name
$driver_class_name = Kohana::config('formo')->driver_prefix . UTF8::ucfirst($driver);
// Create the new instance
$instance = new $driver_class_name($this);
if ($save_instance === TRUE) {
// Save the instance if asked to
$this->set('driver_instance', $instance);
}
$this->_loaded['driver'] = TRUE;
// Return the new driver instance
return $instance;
}
示例6: matches
/**
* Tests if the route matches a given Request. A successful match will return
* all of the routed parameters as an array. A failed match will return
* boolean FALSE.
*
* // Params: controller = users, action = edit, id = 10
* $params = $route->matches(Request::factory('users/edit/10'));
*
* This method should almost always be used within an if/else block:
*
* if ($params = $route->matches($request))
* {
* // Parse the parameters
* }
*
* @param Request $request Request object to match
* @return array on success
* @return FALSE on failure
* @uses Lang::$i18n_routes
* @uses Route::matches
* @uses Route::remap
* @uses Request::$lang
* @uses Lang::$default
* @uses HTTP_Exception_404
*/
public function matches(Request $request)
{
if (!Lang::$i18n_routes) {
// i18n routes are off
return parent::matches($request);
}
// Set params
$params = parent::matches($request);
if ($params !== FALSE) {
foreach ($params as $label => &$param) {
if (isset($this->_translate['<' . $label . '>']) or isset($this->_translate[$param])) {
// If param might be translated see if it needs to be
// converted back to application (source) language
$source_param = Route::remap(UTF8::strtolower($param));
if (Request::$lang !== Lang::$default and isset($this->_translate['<' . $label . '>']) and $source_param === $param and strtolower($param) !== $this->_defaults[$label]) {
// To avoid duplicate content throw 404
throw new HTTP_Exception_404('The requested URL :uri was not found on this server.', array(':uri' => $request->uri()));
}
// Set translated param
$param = UTF8::ucfirst($source_param);
}
}
// Return URI converted back to application (source) language
return $params;
} else {
// No match
return FALSE;
}
}
示例7: get_editable_types
/**
* @return array
*/
public function get_editable_types()
{
if ($this->is_superadmin()) {
return array(self::TYPE_SUPERADMIN => UTF8::ucfirst(__(UTF8::strtolower(self::TYPE_SUPERADMIN))), self::TYPE_ADMIN => UTF8::ucfirst(__(UTF8::strtolower(self::TYPE_ADMIN))), self::TYPE_INTERNAL => UTF8::ucfirst(__(UTF8::strtolower(self::TYPE_INTERNAL))));
}
if ($this->is_only_admin()) {
return array(self::TYPE_EXTERNAL => UTF8::ucfirst(__(UTF8::strtolower(self::TYPE_EXTERNAL))));
}
return array();
}
示例8: _send_mail
private function _send_mail()
{
$message = array("user" => array("name" => "admin@dreamweddingceremonies.com.au", "from" => "admin@dreamweddingceremonies.com.au", "from_name" => UTF8::ucfirst(UTF8::get_value($this->_form, "display_name")), "to" => "admin@dreamweddingceremonies.com.au", "subject" => UTF8::get_value($this->_form, "reason"), "html" => UTF8::get_value($this->_form, "message"), "user_email" => UTF8::get_value($this->_form, "user_email")));
Mailer::factory("user", "say_hello", $message);
}
示例9: _group_by_city
/**
* Group events by city
*
* @param array|Database_Result $events
* @return array
*/
protected function _group_by_city($events)
{
$grouped = array();
if (count($events)) {
// Build grouped array
foreach ($events as $event) {
$city = UTF8::ucfirst(mb_strtolower($event->city_name));
$days = ceil(($event->stamp_end - $event->stamp_begin) / Date::DAY);
for ($day = 0; $day < $days; $day++) {
$date = date('Y-m-d', strtotime('+' . $day . ' days', $event->stamp_begin));
if (!isset($grouped[$date])) {
$grouped[$date] = array();
}
if (!isset($grouped[$date][$city])) {
$grouped[$date][$city] = array();
}
$grouped[$date][$city][] = $event;
}
}
// Sort by city
$dates = array_keys($grouped);
foreach ($dates as $date) {
ksort($grouped[$date]);
// Drop empty cities to last
if (isset($grouped[$date][''])) {
$grouped[$date][__('Elsewhere')] = $grouped[$date][''];
unset($grouped[$date]['']);
}
}
}
return $grouped;
}
示例10:
<div class="group">
<h2><?php
echo UTF8::ucfirst($group->alias());
?>
</h2>
<?php
if ($group->error) {
?>
<div>There were errors with this section</div>
<?php
}
?>
<?php
foreach ($group->fields() as $group) {
?>
<?php
echo $group->generate();
?>
<?php
}
?>
</div>
示例11:
<span class="label"><?php
echo UTF8::ucfirst($field->label());
?>
:</span>
示例12: _model_messages_dump
private function _model_messages_dump(Jam_Model $model)
{
$messages = array();
foreach ($model->errors() as $attribute_name => $errors) {
if ($model->meta()->association($attribute_name) instanceof Jam_Association_Collection) {
foreach ($model->{$attribute_name} as $i => $item) {
if (!$item->is_valid()) {
$messages[] = UTF8::ucfirst(Inflector::humanize($attribute_name)) . ' (' . $i . '): ' . join(', ', $this->_model_messages_dump($item));
}
}
} elseif ($model->meta()->association($attribute_name) and $model->{$attribute_name}) {
$messages[] = UTF8::ucfirst(Inflector::humanize($attribute_name)) . ': ' . join(', ', $this->_model_messages_dump($model->{$attribute_name}));
} else {
foreach ($errors as $error => $params) {
$messages[] = Jam_Errors::message($model->meta()->errors_filename(), $attribute_name, $error, Arr::merge($params, array(':model' => $model->meta()->model(), ':attribute' => Jam_Errors::attribute_label($model->meta(), $attribute_name))));
}
}
}
return $messages;
}
示例13: foreach
<ul class="nav">
<?php
foreach ($links as $link) {
printf('<li%s>%s</li>', html::attributes(array('class' => Request::instance()->controller == $link ? 'active' : NULL)), html::anchor($link, UTF8::ucfirst($link)));
}
?>
</ul>
示例14:
<?php
if ($error = $form->error() and $error !== TRUE) {
?>
<span class="error-message"><?php
echo UTF8::ucfirst($form->error());
?>
</span>
<?php
}
?>
<?php
echo $form->open();
?>
<?php
foreach ($form->fields() as $field) {
?>
<?php
echo $field->render('html');
?>
<?php
}
echo $form->close();
示例15: _filters
/**
* Build filter items
*
* @param array $events
* @return array
*/
protected function _filters(array $events = null)
{
$filters = array();
if (count($events)) {
$cities = array();
$empty = false;
$elsewhere = URL::title(__('Elsewhere'));
// Build filter list
foreach ($events as $day) {
foreach ($day as $city => $city_events) {
// City filter
$filter = URL::title($city);
if ($filter == $elsewhere) {
$empty = true;
continue;
}
if (!isset($cities[$filter])) {
$cities[$filter] = $city;
}
}
}
// Drop empty to last
ksort($cities);
if ($empty) {
$cities[$elsewhere] = UTF8::ucfirst(mb_strtolower(__('Elsewhere')));
}
// Build city filter
$filters['city'] = array('name' => __('City'), 'filters' => $cities);
}
return $filters;
}