本文整理汇总了PHP中utf8::strtolower方法的典型用法代码示例。如果您正苦于以下问题:PHP utf8::strtolower方法的具体用法?PHP utf8::strtolower怎么用?PHP utf8::strtolower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utf8
的用法示例。
在下文中一共展示了utf8::strtolower方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _strcasecmp
/**
* utf8::strcasecmp
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _strcasecmp($str1, $str2)
{
if (utf8::is_ascii($str1) and utf8::is_ascii($str2)) {
return strcasecmp($str1, $str2);
}
$str1 = utf8::strtolower($str1);
$str2 = utf8::strtolower($str2);
return strcmp($str1, $str2);
}
示例2: __set
/**
* Magic setter
*
* @param string $key
* @param mixed $value
*/
public function __set($key, $value)
{
switch ($key) {
// Date of birth
case 'dob':
$value = date::format(date::DATE_SQL, $value);
break;
// Always lowercase e-mail
// Always lowercase e-mail
case 'email':
$value = utf8::strtolower($value);
break;
}
parent::__set($key, $value);
}
示例3: _stristr
/**
* utf8::stristr
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _stristr($str, $search)
{
if (utf8::is_ascii($str) and utf8::is_ascii($search)) {
return stristr($str, $search);
}
if ($search == '') {
return $str;
}
$str_lower = utf8::strtolower($str);
$search_lower = utf8::strtolower($search);
preg_match('/^(.*?)' . preg_quote($search, '/') . '/s', $str_lower, $matches);
if (isset($matches[1])) {
return substr($str, strlen($matches[1]));
}
return FALSE;
}
示例4: __set
/**
* Magic setter
*
* @param string $key
* @param mixed $value
*/
public function __set($key, $value)
{
switch ($key) {
// Date of birth
case 'dob':
$value = date::format(date::DATE_SQL, $value);
break;
// Always lowercase e-mail
// Always lowercase e-mail
case 'email':
$value = utf8::strtolower($value);
break;
// Use Auth to hash the password
// Use Auth to hash the password
case 'password':
$value = Visitor::instance()->hash_password($value);
break;
}
parent::__set($key, $value);
}
示例5: _str_ireplace
/**
* utf8::str_ireplace
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _str_ireplace($search, $replace, $str, &$count = NULL)
{
if (utf8::is_ascii($search) and utf8::is_ascii($replace) and utf8::is_ascii($str)) {
return str_ireplace($search, $replace, $str, $count);
}
if (is_array($str)) {
foreach ($str as $key => $val) {
$str[$key] = utf8::str_ireplace($search, $replace, $val, $count);
}
return $str;
}
if (is_array($search)) {
$keys = array_keys($search);
foreach ($keys as $k) {
if (is_array($replace)) {
if (array_key_exists($k, $replace)) {
$str = utf8::str_ireplace($search[$k], $replace[$k], $str, $count);
} else {
$str = utf8::str_ireplace($search[$k], '', $str, $count);
}
} else {
$str = utf8::str_ireplace($search[$k], $replace, $str, $count);
}
}
return $str;
}
$search = utf8::strtolower($search);
$str_lower = utf8::strtolower($str);
$total_matched_strlen = 0;
$i = 0;
while (preg_match('/(.*?)' . preg_quote($search, '/') . '/s', $str_lower, $matches)) {
$matched_strlen = strlen($matches[0]);
$str_lower = substr($str_lower, $matched_strlen);
$offset = $total_matched_strlen + strlen($matches[1]) + $i * (strlen($replace) - 1);
$str = substr_replace($str, $replace, $offset, strlen($search));
$total_matched_strlen += $matched_strlen;
$i++;
}
$count += $i;
return $str;
}
示例6: get_user
/**
* Retrieve User by UserName or Real Name
*/
public function get_user()
{
$db = Database::instance();
$this->template = "";
$this->auto_render = FALSE;
$name = isset($_GET['q']) ? utf8::strtolower('%' . str_replace(array('%', '_'), array('|%', '|_'), $_GET['q']) . '%') : "";
if ($name) {
$users = $db->query("SELECT * from users where id != :id AND LOWER(name) LIKE :name ESCAPE '|'", array(':id' => $this->user->id, ':name' => $name));
foreach ($users as $user) {
echo "{$user->name}\n";
}
} else {
return;
}
}
示例7: foreach
</h3>
<sup><?php
echo $venue_category->description;
?>
</sup>
<ul>
<?php
$city_id = false;
foreach ($venue_category->venues->find_all() as $venue) {
if ($venue->city_id == $city_id) {
continue;
}
$city_id = $venue->city_id;
?>
<li><?php
echo html::anchor(url::model($venue_category) . '#' . utf8::strtolower($venue->city->city), $venue->city->city);
?>
</li>
<?php
}
?>
</ul>
</li>
<?php
}
?>
</ul>
</div>
</section>
示例8: title
/**
* Formatted title text
*
* @param string $title
* @param bool $format text
* @return string
*/
public static function title($title, $format = true)
{
return html::specialchars($title);
return html::specialchars($format ? utf8::ucwords(utf8::strtolower($title)) : $title);
}
示例9: _saveField
protected function _saveField($plugin, $table, $categoryID, $fieldID, $fieldOld, $configs, $hidden)
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
// Rules array
$rules = array();
// Data array
$inputData = array('keyword', 'type', 'style', 'class', 'required', 'system', 'multilang');
// Name
foreach (config::item('languages', 'core', 'keywords') as $languageID => $lang) {
$rules['name_' . $lang] = array('label' => __('name', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'required', 'max_length' => 255));
$rules['vname_' . $lang] = array('label' => __('name_view', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'max_length' => 255));
$rules['sname_' . $lang] = array('label' => __('name_search', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'max_length' => 255));
$rules['validate_error_' . $lang] = array('label' => __('validate_error', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'max_length' => 255));
$inputData[] = 'name_' . $lang;
$inputData[] = 'vname_' . $lang;
$inputData[] = 'sname_' . $lang;
$inputData[] = 'validate_error_' . $lang;
}
// Keyword
$rules['keyword'] = array('label' => __('keyword', 'system'), 'rules' => array('trim', 'required', 'alpha_dash', 'max_length' => 128, 'callback__is_unique_keyword' => array($plugin, $categoryID, $fieldID), 'callback__is_system_field' => array($fieldID ? $fieldOld['keyword'] : '', $fieldID ? $fieldOld['system'] : '')));
// Type
$rules['type'] = array('label' => __('field_type', 'system_fields'), 'rules' => array('required', 'callback__is_system_field' => array($fieldID ? $fieldOld['type'] : '', $fieldID ? $fieldOld['system'] : '')));
// Style value
$rules['style'] = array('label' => __('style', 'system_fields'), 'rules' => array('trim'));
// Class value
$rules['class'] = array('label' => __('class', 'system_fields'), 'rules' => array('trim'));
// Required
$rules['required'] = array('label' => __('required', 'system_fields'), 'rules' => array('intval'));
// Regular expression
$rules['validate'] = array('label' => __('validate', 'system_fields'), 'rules' => array('trim'));
$inputData[] = 'validate';
// Configuration array
$inputConfig = array();
foreach (array('custom', input::post('type')) as $conf) {
if (isset($configs[$conf])) {
foreach ($configs[$conf] as $option) {
$rules['config_' . $conf . '_' . $option['keyword']] = array('label' => utf8::strtolower($option['label']), 'rules' => isset($option['rules']) ? $option['rules'] : array());
$inputConfig[$option['keyword']] = 'config_' . $conf . '_' . $option['keyword'];
}
}
}
// Add items rules
$items = array();
$oldItems = $fieldID ? $fieldOld['items'] : array();
if ($this->fields_model->isMultiValue(input::post('type'))) {
$itemsPost = input::post('items');
$sitemsPost = input::post('sitems');
foreach (config::item('languages', 'core', 'keywords') as $languageID => $lang) {
$orderID = 1;
if (isset($itemsPost[$lang]) && is_array($itemsPost[$lang])) {
foreach ($itemsPost[$lang] as $itemID => $itemName) {
// Trim name
$itemName = utf8::trim($itemName);
// Assign item data
$items[$itemID]['order_id'] = $orderID;
$items[$itemID]['name_' . $lang] = $itemName;
$items[$itemID]['sname_' . $lang] = $sitemsPost[$lang][$itemID];
$orderID++;
// Add rule
$rules['items[' . $lang . '][' . $itemID . ']'] = array();
if ($itemName == '') {
validate::setRule('items', '', '');
validate::setFieldError('items', __('empty_item', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''));
}
}
}
}
if (!$items) {
validate::setRule('items', '', '');
validate::setFieldError('items', __('no_items', 'system_fields'));
}
view::assign(array('field' => array('items' => $items)));
}
// Assign rules
validate::setRules($rules);
// Validate fields
if (!validate::run()) {
return false;
}
// Get post data
$fieldData = input::post($inputData);
// Default data
$fieldData['system'] = isset($hidden['system']) ? $hidden['system'] : 0;
$fieldData['multilang'] = isset($hidden['multilang']) ? $hidden['multilang'] : 0;
// Get config data
$fieldData['config'] = array();
foreach ($inputConfig as $key => $val) {
$fieldData['config'][$key] = input::post($val);
}
// Set additional config data
$fieldData['config']['html'] = input::post('html') ? 1 : 0;
$fieldData['config']['in_search'] = input::post('in_search') ? 1 : 0;
$fieldData['config']['in_search_advanced'] = input::post('in_search_advanced') ? 1 : 0;
if ($fieldData['config']['in_search'] || $fieldData['config']['in_search_advanced']) {
$fieldData['config']['search_options'] = input::post('search_options') ? input::post('search_options') : '';
}
if (input::post('type') == 'checkbox' || input::post('search_options') == 'multiple') {
//.........这里部分代码省略.........
示例10: _is_comments_delay
public function _is_comments_delay()
{
if (session::permission('comments_delay_limit', 'comments')) {
$comments = $this->comments_model->countRecentComments();
if ($comments >= session::permission('comments_delay_limit', 'comments')) {
validate::setError('_is_comments_delay', __('comments_delay_reached', 'comments', array('%comments' => session::permission('comments_delay_limit', 'comments'), '%time' => session::permission('comments_delay_time', 'comments'), '%type' => utf8::strtolower(__((session::permission('comments_delay_type', 'comments') == 'minutes' ? 'minute' : 'hour') . (session::permission('comments_delay_time', 'comments') > 1 ? 's' : ''), 'date')))));
return false;
}
}
return true;
}
示例11: mb_strtolower
function mb_strtolower($str)
{
return utf8::strtolower($str);
}
示例12: _build_filters
/**
* Build filter items
*
* @param ORM_Iterator $events
* @return array
*/
public function _build_filters(ORM_Iterator $events)
{
$filters = array();
if ($events->count()) {
$cities = array();
// Build filter list
foreach ($events as $event) {
// Build city
$city = $event->city_id ? $event->city->city : $event->city_name;
$filter = url::title($city);
if (!isset($cities[$filter])) {
$cities[$filter] = utf8::ucfirst(utf8::strtolower($city));
}
}
// Drop empty to last
ksort($cities);
if (isset($cities[''])) {
$cities[url::title(__('Elsewhere'))] = utf8::ucfirst(utf8::strtolower(__('Elsewhere')));
unset($cities['']);
}
// Build city filter
$filters['city'] = array('name' => __('City'), 'filters' => $cities);
}
return $filters;
}
示例13: validate
/**
* Validate this input based on the set rules.
*
* @return bool
*/
public function validate()
{
// Validation has already run
if (is_bool($this->is_valid)) {
return $this->is_valid;
}
// No data to validate
if ($this->input_value() == FALSE) {
return $this->is_valid = FALSE;
}
// Load the submitted value
$this->load_value();
// No rules to validate
if (count($this->rules) == 0 and count($this->matches) == 0 and count($this->callbacks) == 0) {
return $this->is_valid = TRUE;
}
if (!empty($this->rules)) {
foreach ($this->rules as $rule) {
if (($offset = strpos($rule, '[')) !== FALSE) {
// Get the args
$args = preg_split('/, ?/', trim(substr($rule, $offset), '[]'));
// Remove the args from the rule
$rule = substr($rule, 0, $offset);
}
if (substr($rule, 0, 6) === 'valid_' and method_exists('valid', substr($rule, 6))) {
$func = substr($rule, 6);
if ($this->value and !valid::$func($this->value)) {
$this->errors[$rule] = TRUE;
}
} elseif (method_exists($this, 'rule_' . $rule)) {
// The rule function is always prefixed with rule_
$rule = 'rule_' . $rule;
if (isset($args)) {
// Manually call up to 2 args for speed
switch (count($args)) {
case 1:
$this->{$rule}($args[0]);
break;
case 2:
$this->{$rule}($args[0], $args[1]);
break;
default:
call_user_func_array(array($this, $rule), $args);
break;
}
} else {
// Just call the rule
$this->{$rule}();
}
// Prevent args from being re-used
unset($args);
} else {
throw new Kohana_Exception('validation.invalid_rule', $rule);
}
// Stop when an error occurs
if (!empty($this->errors)) {
break;
}
}
}
if (!empty($this->matches)) {
foreach ($this->matches as $input) {
if ($this->value != $input->value) {
// Field does not match
$this->errors['matches'] = array($input->label ? utf8::strtolower($input->label) : $input->name);
break;
}
}
}
if (!empty($this->callbacks)) {
foreach ($this->callbacks as $callback) {
call_user_func($callback, $this);
// Stop when an error occurs
if (!empty($this->errors)) {
break;
}
}
}
// If there are errors, validation failed
return $this->is_valid = empty($this->errors);
}
示例14: __construct
/**
* Construct new page controller
*/
function __construct()
{
parent::__construct();
// Init page values
$this->country = Session::instance()->get('country', false);
// AJAX requests output without template
if (request::is_ajax()) {
$this->auto_render = false;
$this->history = false;
return;
}
// Use profiler only when an admin is logged in
if ($this->visitor->logged_in('admin')) {
Profiler::enable();
}
// Bind the generic page variables
$this->template->bind('skin', $this->skin)->bind('skin_imports', $this->skin_imports)->bind('stylesheets', $this->stylesheets)->bind('language', $this->language)->bind('page_width', $this->page_width)->bind('page_main', $this->page_main)->bind('page_id', $this->page_id)->bind('page_class', $this->page_class)->bind('page_title', $this->page_title)->bind('page_subtitle', $this->page_subtitle);
// Add controller name as default page id
$this->page_id = Router::$controller;
// Init page values
$this->menu = Kohana::config('site.menu');
$skin_path = 'ui/' . Kohana::config('site.skin') . '/';
$this->skin = $skin_path . 'skin.less';
$this->skin_imports = array('ui/layout.less', 'ui/widget.less', 'ui/jquery-ui.css', 'ui/site.css', $skin_path . 'jquery-ui.css');
$this->page_width = Session::instance()->get('page_width', 'fixed');
$this->page_main = Session::instance()->get('page_main', 'left');
//$this->stylesheets = array('ui/' . Kohana::config('site.skin') . '/skin', 'ui/' . Kohana::config('site.skin') . '/jquery-ui');
$this->breadcrumb = array();
//html::anchor('/', __('Home')));
$this->tabs = array();
// If a country is seleced, add custom stylesheet
if ($this->country && Kohana::config('site.country_css')) {
widget::add('head', html::stylesheet('ui/' . utf8::strtolower($this->country) . '/skin'));
}
// Generic views
widget::add('actions', View::factory('generic/actions')->bind('actions', $this->page_actions));
// widget::add('breadcrumb', View::factory('generic/breadcrumb')->bind('breadcrumb', $this->breadcrumb));
widget::add('navigation', View::factory('generic/navigation')->bind('items', $this->menu)->bind('selected', $this->page_id));
widget::add('tabs', View::factory('generic/tabs_top')->bind('tabs', $this->tabs)->bind('selected', $this->tab_id));
// Header
widget::add('header', View::factory('generic/header'));
// Footer
widget::add('footer', View_Mod::factory('events/events_list', array('mod_id' => 'footer-events-new', 'mod_class' => 'article unit size1of4 cut events', 'mod_title' => __('New events'), 'events' => ORM::factory('event')->order_by('id', 'DESC')->find_all(10))));
widget::add('footer', View_Mod::factory('forum/topics_list', array('mod_id' => 'footer-topics-active', 'mod_class' => 'article unit size1of4 cut topics', 'mod_title' => __('New posts'), 'topics' => ORM::factory('forum_topic')->order_by('last_post_id', 'DESC')->find_all(10))));
widget::add('footer', View_Mod::factory('blog/entries_list', array('mod_id' => 'footer-blog-entries', 'mod_class' => 'article unit size1of4 cut blogentries', 'mod_title' => __('New blogs'), 'entries' => ORM::factory('blog_entry')->find_latest(10))));
// Dock
$classes = array(html::anchor('set/width/narrow', __('Narrow'), array('onclick' => '$("body").addClass("fixed").removeClass("liquid"); $.get(this.href); return false;')), html::anchor('set/width/wide', __('Wide'), array('onclick' => '$("body").addClass("liquid").removeClass("narrow"); $.get(this.href); return false;')), html::anchor('set/main/left', __('Left'), array('onclick' => '$("body").addClass("left").removeClass("right"); $.get(this.href); return false;')), html::anchor('set/main/right', __('Right'), array('onclick' => '$("body").addClass("right").removeClass("left"); $.get(this.href); return false;')));
widget::add('dock2', __('Layout: ') . implode(', ', $classes));
// Language selection
$available_languages = Kohana::config('locale.languages');
if (count($available_languages)) {
$languages = array();
foreach ($available_languages as $lang => $locale) {
$languages[] = html::anchor('set/lang/' . $lang, html::chars($locale[2]));
}
widget::add('dock2', ' | ' . __('Language: ') . implode(', ', $languages));
}
if ($this->user) {
// Authenticated view
widget::add('dock', __('[#:id] :user', array(':id' => $this->user->id, ':user' => html::nick($this->user->id, $this->user->username))));
$new_messages = array();
if ($this->user->newcomments) {
$new_messages[] = html::anchor(url::user($this->user), __(':commentsC', array(':comments' => $this->user->newcomments)), array('title' => __('New comments'), 'class' => 'new-comments'));
}
if (!empty($new_messages)) {
widget::add('dock', ' - ' . __('New messages: ') . implode(' ', $new_messages));
}
// Logout also from Facebook
if (FB::enabled() && Visitor::instance()->get_provider()) {
widget::add('dock', ' - ' . html::anchor('sign/out', FB::icon() . __('Sign out'), array('onclick' => "FB.Connect.logoutAndRedirect('/sign/out'); return false;")));
} else {
widget::add('dock', ' - ' . html::anchor('sign/out', __('Sign out')));
}
if (Kohana::config('site.inviteonly')) {
// widget::add('dock', ' | ' . html::anchor('sign/up', __('Send invite')));
}
// Admin functions
if ($this->visitor->logged_in('admin')) {
widget::add('dock2', ' | ' . __('Admin: ') . html::anchor('roles', __('Roles')) . ', ' . html::anchor('tags', __('Tags')) . ', ' . html::anchor('#kohana-profiler', __('Profiler'), array('onclick' => '$("#kohana-profiler").toggle();')));
}
} else {
// Non-authenticated view
$form = form::open('sign/in');
$form .= form::input('username', null, 'title="' . __('Username') . '"');
$form .= form::password('password', '', 'title="' . __('Password') . '"');
$form .= form::submit('submit', __('Sign in'));
$form .= form::close();
$form .= html::anchor('/sign/up', __('Sign up'));
if (FB::enabled()) {
$form .= ' | ' . FB::fbml_login();
}
widget::add('dock', $form);
}
// End
widget::add('end', View::factory('generic/end'));
// Analytics
$google_analytics = Kohana::config('site.google_analytics');
//.........这里部分代码省略.........
示例15: manage
public function manage()
{
// Is user loggedin ?
if (!users_helper::isLoggedin()) {
router::redirect('users/login');
}
// Assign user from session to variable
$user = session::section('session');
$user['config'] = session::section('config');
// Get user counters
$counters = hook::filter('users/profile/view/counters', array(), $user);
// Merge user and counters
if ($counters) {
$user = array_merge($user, $counters);
}
// Get fields
$fields = $this->fields_model->getFields('users', session::item('type_id'), 'view', 'in_view');
// Delete empty sections
$this->fields_model->deleteEmptySections($fields, $user);
// Assign vars
view::assign(array('user' => $user, 'fields' => $fields));
// Set title
view::setMetaTitle(__('my_profile', 'system_navigation'));
// Set trail
view::setTrail($user['slug'], __('my_profile', 'system_navigation'));
if (config::item('user_last_visit', 'users')) {
if (!$user['invisible']) {
if ($user['online']) {
view::setTrail(false, '<span class="users online">' . __('status_online', 'users') . '</span>', array('side' => true));
} else {
view::setTrail(false, '<span class="users date">' . __('status_visit_date', 'users', array('%span' => utf8::strtolower(date_helper::humanSpan($user['visit_date'])))) . '</span>', array('side' => true));
}
}
}
// Load view
view::load('users/profile/view');
}