本文整理汇总了PHP中StringUtil::toLowerCase方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::toLowerCase方法的具体用法?PHP StringUtil::toLowerCase怎么用?PHP StringUtil::toLowerCase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::toLowerCase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
list($cache, $boardID, $languageIDs) = explode('-', $cacheResource['cache']);
$data = array();
// get taggable
require_once WCF_DIR . 'lib/data/tag/TagEngine.class.php';
$taggable = TagEngine::getInstance()->getTaggable('com.woltlab.wbb.thread');
// get tag ids
$tagIDArray = array();
$sql = "SELECT\t\tCOUNT(*) AS counter, object.tagID\n\t\t\tFROM \t\twbb" . WBB_N . "_thread thread,\n\t\t\t\t\twcf" . WCF_N . "_tag_to_object object\n\t\t\tWHERE \t\tthread.boardID = " . $boardID . "\n\t\t\t\t\tAND object.taggableID = " . $taggable->getTaggableID() . "\n\t\t\t\t\tAND object.languageID IN (" . $languageIDs . ")\n\t\t\t\t\tAND object.objectID = thread.threadID\n\t\t\tGROUP BY \tobject.tagID\n\t\t\tORDER BY \tcounter DESC";
$result = WCF::getDB()->sendQuery($sql, 500);
while ($row = WCF::getDB()->fetchArray($result)) {
$tagIDArray[$row['tagID']] = $row['counter'];
}
// get tags
if (count($tagIDArray)) {
$sql = "SELECT\t\tname, tagID\n\t\t\t\tFROM\t\twcf" . WCF_N . "_tag\n\t\t\t\tWHERE\t\ttagID IN (" . implode(',', array_keys($tagIDArray)) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['counter'] = $tagIDArray[$row['tagID']];
$this->tags[StringUtil::toLowerCase($row['name'])] = new Tag(null, $row);
}
// sort by counter
uasort($this->tags, array('self', 'compareTags'));
$data = $this->tags;
}
return $data;
}
示例2: checkCondition
/**
* Checks the condition.
*
* @param PMRuleCondition $condition
* @param string $string
* @return boolean
*/
protected function checkCondition(PMRuleCondition $condition, $string)
{
$value = StringUtil::toLowerCase($condition->ruleConditionValue);
$string = StringUtil::toLowerCase($string);
switch ($condition->ruleCondition) {
case 'contains':
if (StringUtil::indexOf($string, $value) !== false) {
return true;
}
break;
case 'dontContains':
if (StringUtil::indexOf($string, $value) === false) {
return true;
}
break;
case 'beginsWith':
if (StringUtil::indexOf($string, $value) === 0) {
return true;
}
break;
case 'endsWith':
if (StringUtil::substring($string, -1 * StringUtil::length($value)) == $value) {
return true;
}
break;
case 'isEqualTo':
if ($value == $string) {
return true;
}
break;
}
return false;
}
示例3: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
list($cache, $packageID, $languageIDs) = explode('-', $cacheResource['cache']);
$data = array();
// get all taggable types
$sql = "SELECT\t\ttaggable.taggableID, taggable.name\n\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency package_dependency,\n\t\t\t\t\twcf" . WCF_N . "_tag_taggable taggable\n\t\t\tWHERE \t\ttaggable.packageID = package_dependency.dependency\n\t\t\t\t\tAND package_dependency.packageID = " . $packageID . "\n\t\t\tORDER BY\tpackage_dependency.priority";
$result = WCF::getDB()->sendQuery($sql);
$itemIDs = array();
while ($row = WCF::getDB()->fetchArray($result)) {
$itemIDs[$row['name']] = $row['taggableID'];
}
if (count($itemIDs) > 0) {
// get tag ids
$tagIDs = array();
$sql = "SELECT\t\tCOUNT(*) AS counter, object.tagID\n\t\t\t\tFROM \t\twcf" . WCF_N . "_tag_to_object object\n\t\t\t\tWHERE \t\tobject.taggableID IN (" . implode(',', $itemIDs) . ")\n\t\t\t\t\t\tAND object.languageID IN (" . $languageIDs . ")\n\t\t\t\tGROUP BY \tobject.tagID\n\t\t\t\tORDER BY \tcounter DESC";
$result = WCF::getDB()->sendQuery($sql, 500);
while ($row = WCF::getDB()->fetchArray($result)) {
$tagIDs[$row['tagID']] = $row['counter'];
}
// get tags
if (count($tagIDs)) {
$sql = "SELECT\t\tname, tagID\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_tag\n\t\t\t\t\tWHERE\t\ttagID IN (" . implode(',', array_keys($tagIDs)) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['counter'] = $tagIDs[$row['tagID']];
$this->tags[StringUtil::toLowerCase($row['name'])] = new Tag(null, $row);
}
// sort by counter
uasort($this->tags, array('self', 'compareTags'));
$data = $this->tags;
}
}
return $data;
}
示例4: getSCM
/**
* Returns class name if scm is known
*
* @param string $scm Source Code Management System
* @return string Class name
*/
public static function getSCM($scm = '')
{
self::getCache();
$scm = StringUtil::toLowerCase($scm);
if (empty($scm)) {
return self::$data;
}
if (isset(self::$data[$scm])) {
return self::$data[$scm];
}
return null;
}
示例5: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
$data = array();
// read available scm
$sql = "SELECT\tscm\n\t\t\tFROM\twcf" . WCF_N . "_scm";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$key = StringUtil::toLowerCase($row['scm']);
$data[$key] = $row['scm'];
}
return $data;
}
示例6: save
/**
* @see Form::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=' . CHARSET);
header('Content-Disposition: attachment; filename="' . $filename . '-style.tgz"');
// export style
$this->style->export($this->exportTemplates, $this->exportImages, $this->exportIcons);
$this->saved();
exit;
}
示例7: readParameters
/**
* @see Page::readParameters()
*/
public function readParameters()
{
parent::readParameters();
if (isset($_REQUEST['format'])) {
$this->format = StringUtil::toLowerCase($_REQUEST['format']);
}
if (isset($_REQUEST['hours'])) {
$this->hours = intval($_REQUEST['hours']);
}
if (isset($_REQUEST['limit'])) {
$this->limit = intval($_REQUEST['limit']);
if ($this->limit < 1) {
$this->limit = 1;
}
}
}
示例8: create
/**
* Creates a new entry event.
*
* @param integer $contestID
* @param integer $userID
* @param integer $groupID
* @param string $eventName
* @param mixed $placeholders
* @param integer $time
* @return ContestEventEditor
*/
public static function create($contestID, $userID, $groupID, $eventName, array $placeholders = array(), $time = TIME_NOW)
{
$eventName = preg_replace('/^Contest(.*)Editor(.*)$/', '$1$2', $eventName);
$eventName = empty($eventName) ? 'contest' : StringUtil::toLowerCase($eventName);
$sql = "INSERT INTO\twcf" . WCF_N . "_contest_event\n\t\t\t\t\t(contestID, userID, groupID, eventName, placeholders, time)\n\t\t\tVALUES\t\t(" . intval($contestID) . ", " . intval($userID) . ", " . intval($groupID) . ", '" . escapeString($eventName) . "', \n\t\t\t\t\t'" . escapeString(serialize($placeholders)) . "', " . intval($time) . ")";
WCF::getDB()->sendQuery($sql);
// get id
$eventID = WCF::getDB()->getInsertID("wcf" . WCF_N . "_contest_event", 'eventID');
// update entry
$sql = "UPDATE\twcf" . WCF_N . "_contest\n\t\t\tSET\tevents = events + 1\n\t\t\tWHERE\tcontestID = " . intval($contestID);
WCF::getDB()->sendQuery($sql);
$event = new ContestEventEditor($eventID);
// any event handlers?
EventHandler::fireAction($event, 'create');
return $event;
}
示例9: readFormParameters
/**
* @see Form::readFormParameters()
*/
public function readFormParameters()
{
parent::readFormParameters();
if (isset($_POST['subject'])) {
$this->subject = StringUtil::trim($_POST['subject']);
}
if (isset($_POST['text'])) {
$this->text = MessageUtil::stripCrap(StringUtil::trim($_POST['text']));
}
if (isset($_POST['activeTab'])) {
$this->activeTab = $_POST['activeTab'];
}
// wysiwyg
if (isset($_POST['wysiwygEditorMode'])) {
$this->wysiwygEditorMode = intval($_POST['wysiwygEditorMode']);
}
if (isset($_POST['wysiwygEditorHeight'])) {
$this->wysiwygEditorHeight = intval($_POST['wysiwygEditorHeight']);
}
// settings
$this->enableSmilies = $this->enableHtml = $this->enableBBCodes = $this->parseURL = $this->showSignature = 0;
if (isset($_POST['parseURL'])) {
$this->parseURL = intval($_POST['parseURL']);
}
if (isset($_POST['enableSmilies'])) {
$this->enableSmilies = intval($_POST['enableSmilies']);
}
$this->enableSmilies = intval($this->enableSmilies && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseSmilies'));
if (isset($_POST['enableHtml'])) {
$this->enableHtml = intval($_POST['enableHtml']);
}
$this->enableHtml = intval($this->enableHtml && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseHtml'));
if (isset($_POST['enableBBCodes'])) {
$this->enableBBCodes = intval($_POST['enableBBCodes']);
}
$this->enableBBCodes = intval($this->enableBBCodes && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseBBCodes'));
if (isset($_POST['showSignature'])) {
$this->showSignature = intval($_POST['showSignature']);
}
// stop shouting
if (StringUtil::length($this->subject) >= MESSAGE_SUBJECT_STOP_SHOUTING && StringUtil::toUpperCase($this->subject) == $this->subject) {
$this->subject = StringUtil::wordsToUpperCase(StringUtil::toLowerCase($this->subject));
}
}
示例10: getUserAgentIcon
/**
* Returns the name of the user agent icon.
*
* @param string $userAgentString
* @return string icon name
*/
public static function getUserAgentIcon($userAgentString)
{
$userAgentString = StringUtil::toLowerCase($userAgentString);
// ie
if (strpos($userAgentString, 'msie') !== false) {
return 'browserInternetExplorer';
} else {
if (strpos($userAgentString, 'firefox') !== false) {
return 'browserFirefox';
} else {
if (strpos($userAgentString, 'chrome') !== false) {
return 'browserChrome';
} else {
if (strpos($userAgentString, 'safari') !== false) {
return 'browserSafari';
} else {
if (strpos($userAgentString, 'opera') !== false) {
return 'browserOpera';
} else {
if (strpos($userAgentString, 'konqueror') !== false) {
return 'browserKonqueror';
} else {
if (strpos($userAgentString, 'netscape') !== false) {
return 'browserNetscape';
} else {
if (strpos($userAgentString, 'webkit') !== false) {
return 'browserSafari';
} else {
if (strpos($userAgentString, 'gecko') !== false) {
return 'browserMozilla';
}
}
}
}
}
}
}
}
}
return '';
}
示例11: checkBot
/**
* @see BotDetectorInterface::checkBot()
*/
public function checkBot()
{
$text = StringUtil::trim($_POST['text']);
// string to lower case
$text = StringUtil::toLowerCase($text);
// split the text in single words
$textSplit = preg_split('/' . $this->delimiters . '+/', $text);
// check each word if it censored.
foreach ($textSplit as $word) {
foreach ($this->badWordList as $censoredWord) {
$maxDiff = ceil(strlen($censoredWord) / 4);
$diff = levenshtein($censoredWord, $word);
if ($diff <= $maxDiff) {
$this->information .= '"' . $word . '" matched "' . $censoredWord . '" with ld ' . $diff . ';';
continue 2;
}
}
}
if (!empty($this->information)) {
return true;
}
return false;
}
示例12: execute
/**
* @see Cronjob::execute()
*/
public function execute($data)
{
$filename = FileUtil::downloadFileFromHttp('http://www.woltlab.com/spiderlist/spiderlist.xml', 'spiders');
$xml = new XML($filename);
$spiders = $xml->getElementTree('spiderlist');
if (count($spiders['children'])) {
// delete old entries
$sql = "TRUNCATE TABLE wcf" . WCF_N . "_spider";
WCF::getDB()->sendQuery($sql);
$inserts = '';
foreach ($spiders['children'] as $spider) {
$identifier = $spider['attrs']['ident'];
// get attributes
foreach ($spider['children'] as $values) {
$spider[$values['name']] = $values['cdata'];
}
$name = $spider['name'];
$info = '';
if (isset($spider['info'])) {
$info = $spider['info'];
}
if (!empty($inserts)) {
$inserts .= ',';
}
$inserts .= "('" . escapeString(StringUtil::toLowerCase($identifier)) . "', '" . escapeString($name) . "', '" . escapeString($info) . "')";
}
if (!empty($inserts)) {
$sql = "INSERT IGNORE INTO\twcf" . WCF_N . "_spider\n\t\t\t\t\t\t\t\t(spiderIdentifier, spiderName, spiderURL)\n\t\t\t\t\tVALUES\t\t\t" . $inserts;
WCF::getDB()->sendQuery($sql);
}
// clear spider cache
WCF::getCache()->clear(WCF_DIR . 'cache', 'cache.spiders.php');
}
// delete tmp file
@unlink($filename);
}
示例13: processConfiguredDates
/**
* Process configured dates with plaintext names, dashed ranges and slashed intervals.
*
* @param array $cronjobsCache
*/
protected function processConfiguredDates($cronjobsCache = array())
{
// get arrays containing the configured dates from our database (or, respectively, the cache).
$this->cronjobsDataRaw['startMinute'] = explode(',', $cronjobsCache['startMinute']);
$this->cronjobsDataRaw['startHour'] = explode(',', $cronjobsCache['startHour']);
$this->cronjobsDataRaw['startDom'] = explode(',', $cronjobsCache['startDom']);
$this->cronjobsDataRaw['startMonth'] = explode(',', $cronjobsCache['startMonth']);
$this->cronjobsDataRaw['startDow'] = explode(',', $cronjobsCache['startDow']);
// process plaintext month and day of week values.
foreach ($this->cronjobsDataRaw as $element => $datesRaw) {
foreach ($datesRaw as $position => $dateRaw) {
switch ($element) {
// months.
case 'startMonth':
$datesPlain = array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec');
break;
// days of week.
// days of week.
case 'startDow':
// for us, the week begins on sunday because date() wants us to think that way.
$datesPlain = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
break;
// nothing to do for the others.
// nothing to do for the others.
default:
break;
}
// if $dateRaw is a time range expressed with a dash, a special handling is needed.
if (StringUtil::indexOf($dateRaw, '-')) {
// dismantle the range into an array.
$range = explode('-', $dateRaw);
// investigate the new array.
foreach ($range as $key => $value) {
$slashPos = StringUtil::indexOf($value, '/');
if (StringUtil::length($value) == 3 && $slashPos === false) {
// this is a plaintext name, so convert this into a number.
$datePlain = StringUtil::toLowerCase($value);
$dateNum = array_search($datePlain, $datesPlain);
// put the converted value back to the array.
if ($dateNum !== false) {
$range[$key] = $dateNum;
}
} else {
if ($slashPos !== false) {
// this value additionally contains a slashed interval,
// so once again part this value.
$interval = explode('/', $value);
if (StringUtil::length($interval['0']) == 3) {
// this is a plaintext name, so convert this into a number.
$datePlain = StringUtil::toLowerCase($interval['0']);
$dateNum = array_search($datePlain, $datesPlain);
if ($dateNum !== false) {
$range[$key] = $dateNum;
}
} else {
$range[$key] = $interval['0'];
}
$range[$key + 1] = $interval['1'];
}
}
}
// reassemble array.
foreach ($range as $key => $digit) {
$range[$key] = intval($digit);
}
$newPos = array_search($dateRaw, $this->cronjobsDataRaw[$element]);
$this->cronjobsDataRaw[$element][$newPos] = $range;
$this->getDashedRange($element, $newPos);
} else {
// this is no range.
$slashPos = StringUtil::indexOf($dateRaw, '/');
if (StringUtil::length($dateRaw) == 3 && $slashPos === false) {
// this is a plaintext name, so convert this into a number.
$datePlain = StringUtil::toLowerCase($dateRaw);
$dateNum = array_search($datePlain, $datesPlain);
// put the converted value back to the original array.
if ($dateNum !== false) {
$this->cronjobsDataRaw[$element][$position] = $dateNum;
}
} else {
if ($slashPos !== false) {
// this value additionally contains a slashed interval,
// so once again part this value.
$interval = explode('/', $dateRaw);
// put parted value back to array.
unset($this->cronjobsDataRaw[$element][$position]);
$this->cronjobsDataRaw[$element][$position][] = $interval['0'];
$this->cronjobsDataRaw[$element][$position][] = $interval['1'];
// break down slashed interval.
$this->getSlashedInterval($element, $position);
}
}
}
}
}
//.........这里部分代码省略.........
示例14: getPackageData
/**
* Reads out PackageData
*
* @param array<array> $package the package array generated in self::readPackages()
* @param mixed $version the version to check
* @param mixed $field should only one information be returned?
* @return mixed either an array with data, or the data wanted in $field
*/
public static function getPackageData(array $package, $version = null, $field = null)
{
$data = array();
if ($version === null) {
// read firest package for general information
$key = array_keys($package);
$xml = $package[$key[0]]['xml']->getElementTree('data');
} else {
$xml = $package[$version]['xml']->getElementTree('data');
}
$data['packageIdentifier'] = $xml['attrs']['name'];
$data['isUpdate'] = false;
$data['plugin'] = $data['packagename'] = $data['packagedescription'] = $data['standalone'] = null;
foreach ($xml['children'] as $child) {
switch (StringUtil::toLowerCase($child['name'])) {
// read in package information
case 'packageinformation':
foreach ($child['children'] as $packageInformation) {
switch (StringUtil::toLowerCase($packageInformation['name'])) {
case 'packagename':
if (!isset($data['packageName'])) {
$data['packageName'] = $packageInformation['cdata'];
}
break;
case 'packagedescription':
if (!isset($data['packageDescription'])) {
$data['packageDescription'] = $packageInformation['cdata'];
}
break;
case 'standalone':
$data['standalone'] = intval($packageInformation['cdata']);
break;
case 'promptparent':
case 'plugin':
if (!Package::isValidPackageName($packageInformation['cdata'])) {
$data['plugin'] = null;
}
$data['plugin'] = $packageInformation['cdata'];
break;
}
}
break;
// read in author information
// read in author information
case 'authorinformation':
foreach ($child['children'] as $authorInformation) {
switch (StringUtil::toLowerCase($authorInformation['name'])) {
case 'author':
$data['author'] = $authorInformation['cdata'];
break;
case 'authorurl':
$data['authorURL'] = $authorInformation['cdata'];
break;
}
}
break;
// read in requirements
// read in requirements
case 'requiredpackages':
foreach ($child['children'] as $requiredPackage) {
if (Package::isValidPackageName($requiredPackage['cdata'])) {
$data['requirements'][$requiredPackage['cdata']] = array('name' => $requiredPackage['cdata']) + $requiredPackage['attrs'];
}
}
break;
// get installation and update instructions
// get installation and update instructions
case 'instructions':
if ($child['attrs']['type'] == 'update') {
$data['isUpdate'] = true;
$data['fromVersions'][] = $child['attrs']['fromversion'];
}
break;
}
}
if ($field === null) {
return $data;
} else {
return $data[$field];
}
}
示例15: readObjects
/**
* @see DatabaseObjectList::readObjects()
*/
public function readObjects()
{
$tagIDArray = $this->getTagsIDArray();
// get tags
if (count($tagIDArray)) {
$sql = "SELECT\t\tname, tagID\n\t\t\t\tFROM\t\twcf" . WCF_N . "_tag\n\t\t\t\tWHERE\t\ttagID IN (" . implode(',', array_keys($tagIDArray)) . ")\n\t\t\t\tORDER BY\tname";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['counter'] = $tagIDArray[$row['tagID']];
$this->tags[StringUtil::toLowerCase($row['name'])] = new Tag(null, $row);
}
// assign sizes
foreach ($this->tags as $tag) {
$tag->setSize($this->calculateSize($tag->getCounter()));
}
}
}