本文整理汇总了PHP中wcf\util\StringUtil::toLowerCase方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::toLowerCase方法的具体用法?PHP StringUtil::toLowerCase怎么用?PHP StringUtil::toLowerCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\util\StringUtil
的用法示例。
在下文中一共展示了StringUtil::toLowerCase方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* @see wcf\system\option\IOptionType::getData()
*/
public function getData(Option $option, $newValue) {
$number = StringUtil::replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
$d = preg_quote(WCF::getLanguage()->get('wcf.global.decimalPoint'), '~');
if (!preg_match('~^(?:\d*)(?:'.$d.')?\d+~', $number, $matches)) return 0;
$number = $matches[0];
if (preg_match('/[kmgt]i?b$/i', $newValue, $multiplier)) {
switch (StringUtil::toLowerCase($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;
}
示例2: execute
/**
* @see wcf\system\ICronjob::execute()
*/
public function execute(Cronjob $cronjob)
{
$filename = FileUtil::downloadFileFromHttp('http://www.woltlab.com/spiderlist/spiderlist.xml', 'spiders');
$xml = new XML();
$xml->load($filename);
$xpath = $xml->xpath();
// fetch spiders
$spiders = $xpath->query('/spiderlist/spider');
if (count($spiders)) {
// delete old entries
$sql = "DELETE FROM wcf" . WCF_N . "_spider";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
$statementParameters = array();
foreach ($spiders as $spider) {
$identifier = StringUtil::toLowerCase($spider->getAttribute('ident'));
$name = $xpath->query('name', $spider)->item(0);
$info = $xpath->query('info', $spider)->item(0);
$statementParameters[$identifier] = array('spiderIdentifier' => $identifier, 'spiderName' => $name->nodeValue, 'spiderURL' => $info ? $info->nodeValue : '');
}
if (!empty($statementParameters)) {
$sql = "INSERT INTO\twcf" . WCF_N . "_spider\n\t\t\t\t\t\t\t(spiderIdentifier, spiderName, spiderURL)\n\t\t\t\t\tVALUES\t\t(?, ?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($statementParameters as $parameters) {
$statement->execute(array($parameters['spiderIdentifier'], $parameters['spiderName'], $parameters['spiderURL']));
}
}
// clear spider cache
CacheHandler::getInstance()->clear(WCF_DIR . 'cache', 'cache.spiders.php');
}
// delete tmp file
@unlink($filename);
}
示例3: getFileExtension
/**
* Returns the extension of the original file name.
*
* @return string
*/
public function getFileExtension() {
if (($position = StringUtil::lastIndexOf($this->getFilename(), '.')) !== false) {
return StringUtil::toLowerCase(StringUtil::substring($this->getFilename(), $position + 1));
}
return '';
}
示例4: compareSetting
/**
* Compares settings, converting values into compareable ones.
*
* @param string $setting
* @param string $value
* @param mixed $compareValue
* @return boolean
*/
protected static function compareSetting($setting, $value, $compareValue) {
if ($compareValue === false) return false;
$value = StringUtil::toLowerCase($value);
$trueValues = array('1', 'on', 'true');
$falseValues = array('0', 'off', 'false');
// handle values considered as 'true'
if (in_array($value, $trueValues)) {
return ($compareValue) ? true : false;
}
// handle values considered as 'false'
else if (in_array($value, $falseValues)) {
return (!$compareValue) ? true : false;
}
else if (!is_numeric($value)) {
$compareValue = self::convertShorthandByteValue($compareValue);
$value = self::convertShorthandByteValue($value);
}
return ($compareValue >= $value) ? true : false;
}
示例5: validateAttribute
/**
* Validates a cronjob attribute.
*
* @param string $name
* @param string $value
*/
protected static function validateAttribute($name, $value)
{
if ($value === '') {
throw new SystemException("invalid value '" . $value . "' given for cronjob attribute '" . $name . "'");
}
$pattern = '';
$step = '[1-9]?[0-9]';
$months = 'jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec';
$days = 'mon|tue|wed|thu|fri|sat|sun';
$namesArr = array();
switch ($name) {
// check if startMinute is a valid minute or a list of valid minutes.
case 'startMinute':
$pattern = '[ ]*(\\b[0-5]?[0-9]\\b)[ ]*';
break;
// check if startHour is a valid hour or a list of valid hours.
// check if startHour is a valid hour or a list of valid hours.
case 'startHour':
$pattern = '[ ]*(\\b[01]?[0-9]\\b|\\b2[0-3]\\b)[ ]*';
break;
// check if startDom is a valid day of month or a list of valid days of month.
// check if startDom is a valid day of month or a list of valid days of month.
case 'startDom':
$pattern = '[ ]*(\\b[01]?[1-9]\\b|\\b2[0-9]\\b|\\b3[01]\\b)[ ]*';
break;
// check if startMonth is a valid month or a list of valid months.
// check if startMonth is a valid month or a list of valid months.
case 'startMonth':
$digits = '[ ]*(\\b[0-1]?[0-9]\\b)[ ]*';
$namesArr = explode('|', $months);
$pattern = '(' . $digits . ')|([ ]*(' . $months . ')[ ]*)';
break;
// check if startDow is a valid day of week or a list of valid days of week.
// check if startDow is a valid day of week or a list of valid days of week.
case 'startDow':
$digits = '[ ]*(\\b[0]?[0-7]\\b)[ ]*';
$namesArr = explode('|', $days);
$pattern = '(' . $digits . ')|([ ]*(' . $days . ')[ ]*)';
break;
}
// perform the actual regex pattern matching.
$range = '(((' . $pattern . ')|(\\*\\/' . $step . ')?)|(((' . $pattern . ')-(' . $pattern . '))(\\/' . $step . ')?))';
// $longPattern prototype: ^\d+(,\d)*$
// $longPattern = '/^(?<!,)'.$range.'+(,'.$range.')*$/i'; // with assertions?
// $longPattern = '/^'.$range.'+(,'.$range.')*$/i'; / does not work on some php installations
$longPattern = '/^' . $range . '(,' . $range . ')*$/i';
preg_match($longPattern, $value);
if ($value != '*' && !preg_match($longPattern, $value)) {
throw new SystemException("invalid value '" . $value . "' given for cronjob attribute '" . $name . "'");
} else {
$testArr = explode(',', $value);
foreach ($testArr as $testField) {
if ($pattern && preg_match('/^(((' . $pattern . ')-(' . $pattern . '))(\\/' . $step . ')?)+$/', $testField)) {
$compare = explode('-', $testField);
$compareSlash = explode('/', $compare['1']);
if (count($compareSlash) == 2) {
$compare['1'] = $compareSlash['0'];
}
// see if digits or names are being given.
$left = array_search(StringUtil::toLowerCase($compare['0']), $namesArr);
$right = array_search(StringUtil::toLowerCase($compare['1']), $namesArr);
if (!$left) {
$left = $compare['0'];
}
if (!$right) {
$right = $compare['1'];
}
// now check the values.
if (intval($left) > intval($right)) {
throw new SystemException("invalid value '" . $value . "' given for cronjob attribute '" . $name . "'");
}
}
}
}
}
示例6: validateEmail
/**
* Throws a UserInputException if the email is not unique or not valid.
*
* @param string $email
* @param string $confirmEmail
*/
protected function validateEmail($email, $confirmEmail) {
if (empty($email)) {
throw new UserInputException('email');
}
// check for valid email (one @ etc.)
if (!UserUtil::isValidEmail($email)) {
throw new UserInputException('email', 'notValid');
}
// Check if email exists already.
if (!UserUtil::isAvailableEmail($email)) {
throw new UserInputException('email', 'notUnique');
}
// check confirm input
if (StringUtil::toLowerCase($email) != StringUtil::toLowerCase($confirmEmail)) {
throw new UserInputException('confirmEmail', 'notEqual');
}
}
示例7: smf1
/**
* Validates the password hash for Simple Machines Forums 1.x (smf1).
*
* @param string $username
* @param string $password
* @param string $salt
* @param string $dbHash
* @return boolean
*/
protected static function smf1($username, $password, $salt, $dbHash) {
return self::secureCompare($dbHash, sha1(StringUtil::toLowerCase($username) . $password));
}
示例8: getPluginClassName
/**
* Returns the class name of a plugin.
*
* @param string $type
* @param string $tag
* @return string class name
*/
public function getPluginClassName($type, $tag)
{
return $this->pluginNamespace . StringUtil::firstCharToUpperCase($tag) . StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($type)) . 'TemplatePlugin';
}
示例9: save
/**
* @see wcf\form\IForm::save()
*/
public function save() {
parent::save();
// get style filename
$filename = str_replace(' ', '-', preg_replace('/[^a-z0-9 _-]/', '', StringUtil::toLowerCase($this->style->styleName)));
// send headers
header('Content-Type: application/x-gzip; charset=utf-8');
if ($this->exportAsPackage) {
header('Content-Disposition: attachment; filename="'.$this->packageName.'.tar.gz"');
}
else {
header('Content-Disposition: attachment; filename="'.$filename.'-style.tgz"');
}
// export style
$styleEditor = new StyleEditor($this->style);
$styleEditor->export($this->exportTemplates, $this->exportImages, $this->packageName);
// call saved event
$this->saved();
exit;
}
示例10: parseFootnotes
/**
* Check pages and set parse status.
*/
public static function parseFootnotes()
{
$request = RequestHandler::getInstance()->getActiveRequest();
$pageName = StringUtil::toLowerCase($request->getPageName());
$allowedPages = ArrayUtil::trim(explode("\n", StringUtil::toLowerCase(BBCODES_FOOTNOTE_PARSE_PAGE)));
if (in_array($pageName, $allowedPages)) {
static::$parse = true;
} else {
static::$parse = false;
}
}
示例11: validateEmail
/**
* @see wcf\acp\form\UserAddForm::validateEmail()
*/
protected function validateEmail($email, $confirmEmail)
{
if (StringUtil::toLowerCase($this->user->email) != StringUtil::toLowerCase($email)) {
parent::validateEmail($email, $this->confirmEmail);
}
}
示例12: save
/**
* @see wcf\form\Form::save()
*/
public function save() {
parent::save();
if ($this->mode == 'copy') {
$this->language = LanguageEditor::create(array(
'languageCode' => StringUtil::toLowerCase($this->languageCode)
));
$languageEditor = new LanguageEditor($this->sourceLanguage);
$languageEditor->copy($this->language);
}
LanguageFactory::getInstance()->clearCache();
LanguageFactory::getInstance()->deleteLanguageCache();
$this->saved();
// show success message
WCF::getTPL()->assign('success', true);
}