当前位置: 首页>>代码示例>>PHP>>正文


PHP mb_strtolower函数代码示例

本文整理汇总了PHP中mb_strtolower函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_strtolower函数的具体用法?PHP mb_strtolower怎么用?PHP mb_strtolower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mb_strtolower函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __call

 /**
  * Build required method if it's in the configuration
  *
  * @param string $method
  * @param array $args
  * @return Route
  */
 public function __call($method, $args)
 {
     // See if we can find the method being referenced
     $called = str_replace('apiresource', '', mb_strtolower($method));
     // Check if this function is in our configuration
     if ($this->config->get('apirouter::router.' . $called)) {
         // Capture config
         $config = $this->config->get('apirouter::router.' . $called);
         // Determine whether to use id or not
         $uri = $this->getResourceUri($args[0]);
         if (isset($config['id']) && $config['id'] == true) {
             $uri .= '/{' . ($args[1] ? $args[1] : 'id') . '}';
         }
         if (isset($config['suffix']) && $config['suffix']) {
             $uri .= '/' . $config['suffix'];
         }
         // Determine the function name
         $function = isset($config['function']) && $config['function'] ? $config['function'] : $called;
         // Get action
         $action = $this->getResourceAction($args[0], $args[2], $called, $args[3], $function);
         // Get method
         $method = isset($config['method']) && $config['method'] ? $config['method'] : 'get';
         // Put it all together
         return $this->{$method}($uri, $action);
     }
 }
开发者ID:lakedawson,项目名称:apirouter,代码行数:33,代码来源:ApiRouter.php

示例2: getAttributesByAttributeGroupId

 public function getAttributesByAttributeGroupId($data = array())
 {
     $sql = "SELECT *, (SELECT agd.name FROM " . DB_PREFIX . "attribute_group_description agd WHERE agd.attribute_group_id = a.attribute_group_id AND agd.language_id = '" . (int) $this->config->get('config_language_id') . "') AS attribute_group FROM " . DB_PREFIX . "attribute a LEFT JOIN " . DB_PREFIX . "attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE ad.language_id = '" . (int) $this->config->get('config_language_id') . "'";
     if (isset($data['filter_name']) && !is_null($data['filter_name'])) {
         $sql .= " AND LCASE(ad.name) LIKE '" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%'";
     }
     if (isset($data['filter_attribute_group_id']) && !is_null($data['filter_attribute_group_id'])) {
         $sql .= " AND a.attribute_group_id = '" . $this->db->escape($data['filter_attribute_group_id']) . "'";
     }
     $sort_data = array('ad.name', 'attribute_group', 'a.sort_order');
     if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
         $sql .= " ORDER BY " . $data['sort'];
     } else {
         $sql .= " ORDER BY ad.name";
     }
     if (isset($data['order']) && $data['order'] == 'DESC') {
         $sql .= " DESC";
     } else {
         $sql .= " ASC";
     }
     if (isset($data['start']) || isset($data['limit'])) {
         if ($data['start'] < 0) {
             $data['start'] = 0;
         }
         if ($data['limit'] < 1) {
             $data['limit'] = 20;
         }
         $sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
     }
     $query = $this->db->query($sql);
     return $query->rows;
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:32,代码来源:attribute.php

示例3: __construct

 public function __construct($text)
 {
     $this->text = $text;
     $text = (string) $text;
     // преобразуем в строковое значение
     $text = strip_tags($text);
     // убираем HTML-теги
     $text = str_replace(array("\n", "\r"), " ", $text);
     // убираем перевод каретки
     $text = preg_replace("/\\s+/", ' ', $text);
     // удаляем повторяющие пробелы
     $text = trim($text);
     // убираем пробелы в начале и конце строки
     $text = mb_strtolower($text, 'utf-8');
     // переводим строку в нижний регистр
     $text = strtr($text, array('а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'j', 'з' => 'z', 'и' => 'y', 'і' => 'i', 'ї' => 'і', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'y', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'ъ' => '', 'ь' => ''));
     // в данном случае язык
     //будет укр.(изначально скрипт для русского яз.) поэтому некоторые буквы заменены или удалены, а именно ('и'=>'i')
     $text = preg_replace("/[^0-9a-z-_ ]/i", "", $text);
     // очищаем строку от недопустимых символов
     $text = str_replace(" ", "_", $text);
     // заменяем пробелы нижним подчеркиванием
     $text = str_replace("-", "_", $text);
     //заменяет минус на нижнее подчеркивание
     $this->translit = $text;
 }
开发者ID:artemkuchma,项目名称:php_academy_site2,代码行数:26,代码来源:Translit.php

示例4: save

 function save(&$data)
 {
     $isNew = Sanitize::getInt($data['FieldOption'], 'optionid') ? false : true;
     $field_id = Sanitize::getInt($data['FieldOption'], 'fieldid');
     if ($isNew) {
         // Remove non alphanumeric characters from option value
         $data['FieldOption']['value'] = Sanitize::translate($data['FieldOption']['value']);
         $data['FieldOption']['value'] = str_replace($this->blackList, '', $data['FieldOption']['value']);
         $data['FieldOption']['value'] = str_replace($this->dashReplacements, '-', $data['FieldOption']['value']);
         $data['FieldOption']['value'] = preg_replace(array('/[-]+/'), array('-'), $data['FieldOption']['value']);
         $data['FieldOption']['value'] = mb_strtolower($data['FieldOption']['value'], 'UTF-8');
         // If is new checks for duplicate value
         $query = "SELECT count(fieldid) FROM #__jreviews_fieldoptions WHERE fieldid = '{$field_id}' AND value = " . $this->_db->Quote($data['FieldOption']['value']);
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             return 'duplicate';
         }
         // Find last option
         $this->_db->setQuery("select max(ordering) FROM #__jreviews_fieldoptions WHERE fieldid = '" . $field_id . "'");
         $max = $this->_db->loadResult();
         if ($max > 0) {
             $data['FieldOption']['ordering'] = $max + 1;
         } else {
             $data['FieldOption']['ordering'] = 1;
         }
     }
     # store it in the db
     if (!$this->store($data)) {
         return 'db_error';
     }
     return 'success';
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:32,代码来源:field_option.php

示例5: execute

 /**
  * Execute requested action
  */
 public function execute()
 {
     $method = $_SERVER['REQUEST_METHOD'];
     $verbs = $this->verbs();
     if (isset($verbs[$this->requestMethod])) {
         $action = 'action' . ucfirst(mb_strtolower($verbs[$method]));
         $reflectionMethod = new \ReflectionMethod($this, $action);
         $parsePath = array_slice($this->path, count($this->route));
         $args = [];
         $errors = [];
         if ($params = $reflectionMethod->getParameters()) {
             foreach ($params as $key => $param) {
                 if (isset($parsePath[$key])) {
                     $args[$param->name] = $parsePath[$key];
                 } else {
                     $errors[] = ['code' => 'required', 'message' => ucfirst(mb_strtolower(explode('_', $param->name)[0])) . ' cannot be blank.', 'name' => $param->name];
                 }
             }
             if ($errors) {
                 throw new \phantomd\ShopCart\modules\base\HttpException(400, 'Invalid data parameters', 0, null, $errors);
             }
         }
         if (count($parsePath) === count($params)) {
             return call_user_func_array([$this, $action], $args);
         }
     }
     throw new HttpException(404, 'Unable to resolve the request "' . $this->requestPath . '".', 0, null, $errors);
 }
开发者ID:phantom-d,项目名称:shop-cart,代码行数:31,代码来源:BaseController.php

示例6: getData

 /**
  * @see	\wcf\system\option\IOptionType::getData()
  */
 public function getData(Option $option, $newValue)
 {
     $number = str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
     $number = str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $number);
     if (!preg_match('~^(?:\\d*)\\.?\\d+~', $number, $matches)) {
         return 0;
     }
     $number = $matches[0];
     if (preg_match('/[kmgt]i?b$/i', $newValue, $multiplier)) {
         switch (mb_strtolower($multiplier[0])) {
             case 'tb':
                 $number *= 1000;
             case 'gb':
                 $number *= 1000;
             case 'mb':
                 $number *= 1000;
             case 'kb':
                 $number *= 1000;
                 break;
             case 'tib':
                 $number *= 1024;
             case 'gib':
                 $number *= 1024;
             case 'mib':
                 $number *= 1024;
             case 'kib':
                 $number *= 1024;
                 break;
         }
     }
     return $number;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:35,代码来源:FileSizeOptionType.class.php

示例7: Start

 public function Start($string, $language, $count, $F)
 {
     $snippets = array();
     $query = urlencode(mb_strtolower($string, 'UTF-8'));
     $url = "http://www.mysearch.com/search/GGmain.jhtml?searchfor={$query}&lr=lang_{$language}&ie=utf-8&oe=utf-8";
     $html = $F->GetHTML($url, 'www.mysearch.com');
     if (!is_bool($html)) {
         $i = 0;
         foreach ($html->find('div[class="algoLinkBox"]') as $e) {
             $t = 'a[class="pseudolink"]';
             $d = 'span[class="nDesc"]';
             if (isset($e->find($t, 0)->plaintext)) {
                 $title = $e->find($t, 0)->plaintext;
             }
             if (isset($e->find($d, 0)->plaintext)) {
                 $description = $e->find($d, 0)->plaintext;
             }
             if ($i < $count) {
                 if (!empty($title) and !empty($description)) {
                     $snippets[$i]['title'] = trim($title);
                     $snippets[$i]['description'] = trim($description);
                     $i++;
                 }
             }
         }
         $html->clear();
         $html = null;
         $e = null;
         unset($html, $e);
     } else {
         $F->Error("Can't create outgoing request. Please check MySearch snippets plugin.");
     }
     return $snippets;
 }
开发者ID:VarenKoks,项目名称:fdt-page-scrapper,代码行数:34,代码来源:MySearch.php

示例8: urlize

 /**
  * Create a version of a string for embedding in a URL
  *
  * @param string $string    A UTF-8 string
  * @param string $separator The character to separate words with
  * @return string
  */
 public static function urlize($string, $separator = '-')
 {
     // Iñtërnâtiônàlizætiøn, AND 日本語!
     // try to force combined chars because the translit map and others expect it
     if (self::hasNormalizerSupport()) {
         $nfc = normalizer_normalize($string);
         if (is_string($nfc)) {
             $string = $nfc;
         }
     }
     // Internationalization, AND 日本語!
     $string = self::transliterateAscii($string);
     // allow HTML tags in titles
     $string = preg_replace('~<([a-zA-Z][^>]*)>~', ' $1 ', $string);
     // more substitutions
     // @todo put these somewhere else
     $string = strtr($string, array("€" => ' E ', "£" => ' GBP '));
     // remove all ASCII except 0-9a-zA-Z, hyphen, underscore, and whitespace
     // note: "x" modifier did not work with this pattern.
     $string = preg_replace('~[' . '\\x00-\\x08' . '\\x0b\\x0c' . '\\x0e-\\x1f' . '\\x21-\\x2c' . '\\x2e\\x2f' . '\\x3a-\\x40' . '\\x5b-\\x5e' . '\\x60' . '\\x7b-\\x7f' . ']~', '', $string);
     $string = strtr($string, '', '');
     // internationalization, and 日本語!
     // note: not using elgg_strtolower to keep this class portable
     $string = is_callable('mb_strtolower') ? mb_strtolower($string, 'UTF-8') : strtolower($string);
     // split by ASCII chars not in 0-9a-zA-Z
     // note: we cannot use [^0-9a-zA-Z] because that matches multibyte chars.
     // note: "x" modifier did not work with this pattern.
     $pattern = '~[' . '\\x00-\\x2f' . '\\x3a-\\x40' . '\\x5b-\\x60' . '\\x7b-\\x7f' . ']+~x';
     // ['internationalization', 'and', '日本語']
     $words = preg_split($pattern, $string, -1, PREG_SPLIT_NO_EMPTY);
     // ['internationalization', 'and', '%E6%97%A5%E6%9C%AC%E8%AA%9E']
     $words = array_map('urlencode', $words);
     // internationalization-and-%E6%97%A5%E6%9C%AC%E8%AA%9E
     return implode($separator, $words);
 }
开发者ID:tjcaverly,项目名称:Elgg,代码行数:42,代码来源:Translit.php

示例9: aliasOrSlug

 public function aliasOrSlug($title)
 {
     $seo_st = str_replace(' ', '-', $title);
     $seo_alm = str_replace('--', '-', $seo_st);
     $title_seo = str_replace(' ', '', $seo_alm);
     return mb_strtolower($title_seo, 'UTF-8');
 }
开发者ID:adibhanna,项目名称:agency,代码行数:7,代码来源:Helper.php

示例10: post_xhr

 function post_xhr()
 {
     if ($this->checkAuth()) {
         $usernameOrEmail = mb_strtolower($_POST['usernameOrEmail']);
         if (mb_strlen($usernameOrEmail) >= 8 && preg_match('/^[a-zA-Z0-9_\\-]+$/', $usernameOrEmail) || filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) {
             $secondFactor = mb_strtolower($_POST['secondFactor']);
             if (ctype_alnum($secondFactor) || empty($secondFactor)) {
                 $answer = mb_strtolower($_POST['answer']);
                 if (mb_strlen($answer) >= 6 || empty($answer)) {
                     $newPassword = $_POST['passwordForgot'];
                     $newRetypedPassword = $_POST['passwordRetypedForgot'];
                     if ($newPassword == $newRetypedPassword) {
                         $userForgot = new AuthUser();
                         $responseArr = $userForgot->forgotPassword($usernameOrEmail, $secondFactor, $answer, $newPassword);
                         if ($responseArr['continue'] == true) {
                             echo json_encode(StatusReturn::S200($responseArr));
                         } else {
                             echo json_encode(StatusReturn::E400('Unknown Error 5'));
                         }
                     } else {
                         echo json_encode(StatusReturn::E400('Unknown Error 4'));
                     }
                 } else {
                     echo json_encode(StatusReturn::E400('Unknown Error'));
                 }
             } else {
                 echo json_encode(StatusReturn::E400('Unknown Error'));
             }
         } else {
             echo json_encode(StatusReturn::E400('Unknown Error'));
         }
     }
 }
开发者ID:rapidDevGroup,项目名称:PHP-REST-API,代码行数:33,代码来源:ForgotPassword.php

示例11: stem_word

 /**
  * Возвращает основу слова
  *
  * @param string $word
  *
  * @return string
  */
 public function stem_word($word)
 {
     $word = strtr(mb_strtolower($word), array('ё' => 'е'));
     if ($this->use_cache && isset($this->cache[$word])) {
         return $this->cache[$word];
     }
     list($str, $start, $rv) = Core_Regexps::match_with_results(self::RVRE, $word);
     if (!$rv) {
         return $word;
     }
     // step 1
     if (!Core_Regexps::replace_ref(self::PERFECTIVEGROUND, '', $rv)) {
         $rv = preg_replace(self::REFLEXIVE, '', $rv);
         if (Core_Regexps::replace_ref(self::ADJECTIVE, '', $rv)) {
             $rv = preg_replace(self::PARTICIPLE, '', $rv);
         } else {
             if (!Core_Regexps::replace_ref(self::VERB, '', $rv)) {
                 $rv = preg_replace(self::NOUN, '', $rv);
             }
         }
     }
     // step 2
     $rv = preg_replace('{и$}', '', $rv);
     // step 3
     if (preg_match(self::DERIVATIONAL, $rv)) {
         $rv = preg_replace('{ость?$}', '', $rv);
     }
     // step 4
     if (!Core_Regexps::replace_ref('{ь$}', '', $rv)) {
         $rv = preg_replace(array('{ейше?}', '{нн$}'), array('', 'н'), $rv);
     }
     return $this->use_cache ? $this->cache[$word] = $start . $rv : $start . $rv;
 }
开发者ID:techart,项目名称:tao,代码行数:40,代码来源:RU.php

示例12: addFieldDefinition

 /**
  * @param string $fieldName
  * @param FieldDefinition $type
  * @throws InvalidArgumentException
  */
 private function addFieldDefinition(string $fieldName, FieldDefinition $type)
 {
     if (array_key_exists(mb_strtolower($fieldName), $this->definitions)) {
         throw InvalidArgumentException::fieldNameAlreadyExists($fieldName, $this->name);
     }
     $this->definitions[mb_strtolower($fieldName)] = $type;
 }
开发者ID:dumplie,项目名称:dumplie,代码行数:12,代码来源:TypeSchema.php

示例13: parse_array

	function parse_array ($items, $default = 'Проставьте_теги') {

		if (empty($items)) {
			return array($default);
		}

		if (!is_array($items)) {
			return $this->parse($items);
		}

		$tags = array_unique(array_filter($items));

		foreach ($tags as $key => $tag) {
			$tag = str_replace(array('&amp;'), array('&'), $tag);

			if (preg_match('/(^(:?&lt;|<)\p{L}+(?:&gt;|>)|(?:&lt;|<)\p{L}+(?:&gt;|>)$)/u',$tag,$type)) {
				$tags[$key] = str_replace($type[0],'',$tag);

				$color_key = mb_strtolower(substr($type[0],4,-4),'UTF-8');
				if (isset($this->tag_types[$color_key])) {
					$this->colors[$tags[$key]] = $this->tag_types[$color_key];
				}
			}
		}
		return $tags;
	}
开发者ID:4otaku,项目名称:4otaku,代码行数:26,代码来源:meta.php

示例14: Users_validate_username

/**
 * Override this to validate the username in your own way.
 */
function Users_validate_username($params)
{
    // override this to change the rules for validating the username
    extract($params);
    if (empty($username)) {
        return;
    }
    if ($first = mb_substr($username, 0, 1, "UTF-8") and mb_strtolower($first, "UTF-8") != $first) {
        return;
        // first letter is uppercase, this represents an organization
    }
    if (strlen($username) < 4) {
        throw new Q_Exception("usernames are at least 4 characters long", array('username'));
    }
    if (strlen($username) > 16) {
        throw new Q_Exception("usernames are at most 16 characters long", array('username'));
    }
    $match = preg_match('/^[a-zA-Z][a-zA-Z0-9-_]+$/', $username);
    if (!$match) {
        if (preg_match('/^[a-zA-Z0-9-_]+$/', $username)) {
            throw new Q_Exception("usernames must start with a letter", array('username'));
        }
        throw new Q_Exception("please use only A..Z, a..z, 0..9, - and _", array('username'));
    }
}
开发者ID:dmitriz,项目名称:Platform,代码行数:28,代码来源:username.php

示例15: __construct

 /**
  * Validar::__construct()
  * 
  * Genera las variables correspondientes
  * que se requieren para el proceso de
  * validacion
  * 
  * @param string $namespace
  * @param objetc $peticiones
  * @return void
  */
 function __construct($confgClase = false, $confgMetodo = false, $peticiones = false)
 {
     $this->confgClase = $confgClase;
     $this->confgMetodo = $confgMetodo;
     $this->peticiones = $peticiones;
     $this->metodoPeticion = mb_strtolower($this->confgClase->formulario->metodo);
 }
开发者ID:NeuralFramework,项目名称:NeuralPHPv4,代码行数:18,代码来源:Validar.php


注:本文中的mb_strtolower函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。