本文整理汇总了PHP中StringUtil::firstCharToUpperCase方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::firstCharToUpperCase方法的具体用法?PHP StringUtil::firstCharToUpperCase怎么用?PHP StringUtil::firstCharToUpperCase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::firstCharToUpperCase方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
$sql = "SELECT *\r\n\t\t\t\tFROM ugml_stat_type\r\n\t\t\t\tGROUP BY ugml_stat_type.statTypeID";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$sql = "SELECT DISTINCT `time`\r\n\t\t\t\t\tFROM ugml_stat_entry_archive\r\n\t\t\t\t\tWHERE statTypeID = " . $row['statTypeID'];
$result2 = WCF::getDB()->sendQuery($sql);
while ($row2 = WCF::getDB()->fetchArray($result2)) {
$row['times'][] = $row2['time'];
}
// range
$sql = "SELECT MAX(rank)\r\n\t\t\t\t\t\tAS max\r\n\t\t\t\t\tFROM ugml_stat_entry\r\n\t\t\t\t\tWHERE statTypeID = " . $row['statTypeID'];
$row += WCF::getDB()->getFirstRow($sql);
$this->data[$row['statTypeID']] = $row;
}
$this->data = array('byStatTypeID' => $this->data, 'byTypeName' => array());
foreach ($this->data['byStatTypeID'] as $statTypeID => $row) {
$name = StringUtil::firstCharToUpperCase($row['type']) . StringUtil::firstCharToUpperCase($row['name']);
$this->data['byTypeName'][$name] = $row;
}
// get the names and the types
$sql = "SELECT GROUP_CONCAT(DISTINCT type)\r\n\t\t\t\t\t\t\tAS types,\r\n\t\t\t\t\t\tGROUP_CONCAT(DISTINCT name)\r\n\t\t\t\t\t\t\tAS names\r\n\t\t\t\tFROM ugml_stat_type\r\n\t\t\t\tGROUP BY NULL";
$row = WCF::getDB()->getFirstRow($sql);
$this->data['types'] = explode(',', $row['types']);
$this->data['names'] = explode(',', $row['names']);
return $this->data;
}
示例2: checkTypeName
/**
* Checks if a configuration is valid.
*
* @param string type
* @param string name
* @param bool check selectable flag
* @return bool
*/
public static function checkTypeName($type, $name, $checkSelectable = true)
{
$className = StringUtil::firstCharToUpperCase($type) . StringUtil::firstCharToUpperCase($name);
try {
$cache = self::checkClassName($className);
if (!$checkSelectable || $cache['selectable']) {
return true;
}
return false;
} catch (StatException $e) {
return false;
}
}
示例3: getProductorObject
/**
* Returns a productor object.
*
* @param string $productorName
* @return PlanetProduction
*/
public function getProductorObject($productorName)
{
if (!isset($this->productors[$productorName])) {
$className = StringUtil::firstCharToUpperCase($productorName) . 'Production';
$fileName = LW_DIR . 'lib/data/planet/production/' . $className . '.class.php';
if (!file_exists($fileName)) {
throw new PlanetException('can not find production class file ' . $fileName);
}
require_once $fileName;
if (!class_exists($className)) {
throw new PlanetException('production class ' . $className . ' does no exist');
}
$this->productors[$productorName] = new $className($this->getObject());
}
return $this->productors[$productorName];
}
示例4: getFileTypeIcon
/**
* Returns the right file type icon for the given attachment.
*
* @return string
*/
public function getFileTypeIcon()
{
if ($this->fileTypeIcon === null) {
$this->fileTypeIcon = '';
// get file extension
$extension = StringUtil::firstCharToUpperCase(StringUtil::toLowerCase(StringUtil::substring($this->attachmentName, StringUtil::lastIndexOf($this->attachmentName, '.') + 1)));
// get file type icon
if (file_exists(WCF_DIR . 'icon/fileTypeIcon' . $extension . 'M.png')) {
$this->fileTypeIcon = 'fileTypeIcon' . $extension . 'M.png';
} else {
foreach (self::$fileTypeGroups as $key => $group) {
if (in_array($extension, $group)) {
$this->fileTypeIcon = 'fileTypeIcon' . $key . 'M.png';
break;
}
}
if (empty($this->fileTypeIcon)) {
$this->fileTypeIcon = 'fileTypeIconDefaultM.png';
}
}
}
if (!class_exists('StyleManager')) {
return RELATIVE_WCF_DIR . 'icon/' . $this->fileTypeIcon;
} else {
return StyleManager::getStyle()->getIconPath($this->fileTypeIcon);
}
}
示例5: handleRequest
/**
* @see WOTAPIPServerClient::handleRequest()
*/
public function handleRequest($lines)
{
// get data
$this->connection = 'Close';
$this->data = array();
$this->action = '';
$dataComing = false;
$resumption = $this->started;
foreach ($lines as $no => $line) {
// not encrypted
if (($no == 0 || $no == 1) && !$resumption) {
// version
if (substr($line, 0, 8) == 'WOTAPIP/') {
$this->started = true;
continue;
}
// initialization vector
$iv = base64_decode($line);
$this->crypter = new Mcrypt();
$this->crypter->init(CRYPTER_KEY, $iv);
continue;
}
// encrypted
$line = $this->crypter->decryptFromText($line);
$parts = ArrayUtil::trim(explode(':', $line, 2));
if ($dataComing) {
$this->data[StringUtil::toLowerCase($parts[0])] = $parts[1];
continue;
}
switch ($parts[0]) {
case 'ACTION':
$this->action = $parts[1];
break;
case 'CONNECTION':
if ($parts[1] !== 'Close' && $parts[1] !== 'Keep-Alive') {
$this->send('unknown connection value ' . $parts[1], 206);
return;
}
$this->connection = StringUtil::trim($parts[1]);
break;
case 'DATA':
$dataComing = true;
break;
default:
if (substr($parts[0], 0, 5) == 'DATA_') {
$parts[0] = substr($parts[0], 5);
} else {
$this->send('unknown line ' . $parts[0], 204);
return;
}
}
}
// validate
if (empty($this->action)) {
$this->send('no action specified', 202);
return;
}
// execute
$className = 'WOTAPI' . StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($this->action)) . 'Action';
if (!file_exists(LW_DIR . 'lib/wotapi/' . $className . '.class.php')) {
$this->send('classfile not found', 210);
return;
}
require_once LW_DIR . 'lib/wotapi/' . $className . '.class.php';
if (!class_exists($className)) {
$this->send('class \'' . $className . '\' not found', 211);
return;
}
try {
$action = new $className($this);
} catch (Exception $e) {
ob_start();
$e->show();
$output = ob_get_contents();
ob_end_clean();
$this->send('exception thrown while execution: ' . addcslashes($output, ":\n\r\\"), 220);
}
}
示例6: getFileTypeIcon
/**
* Returns the right file type icon for the given attachment.
*
* @param array $data
* @return string
*/
protected static function getFileTypeIcon($data)
{
// get file extension
$extension = StringUtil::firstCharToUpperCase(StringUtil::toLowerCase(StringUtil::substring($data['attachmentName'], StringUtil::lastIndexOf($data['attachmentName'], '.') + 1)));
// get file type icon
if (file_exists(WCF_DIR . 'icon/fileTypeIcon' . $extension . 'M.png')) {
return StyleManager::getStyle()->getIconPath('fileTypeIcon' . $extension . 'M.png');
} else {
foreach (self::$fileTypeGroups as $key => $group) {
if (in_array($extension, $group)) {
return StyleManager::getStyle()->getIconPath('fileTypeIcon' . $key . 'M.png');
}
}
return StyleManager::getStyle()->getIconPath('fileTypeIconDefaultM.png');
}
}
示例7: handleRequest
/**
* @see WOTAPIPServerClient::handleRequest()
*/
public function handleRequest($lines)
{
// get data
$this->connection = 'Close';
$this->data = array();
$this->key = '';
$this->salt = '';
$this->sendTime = 0;
$this->action = '';
foreach ($lines as $no => $line) {
if ($no == 0 && substr($line, 0, 8) == 'WOTAPIP/') {
$this->protocolVersion = substr($line, 8, 3);
continue;
}
$parts = ArrayUtil::trim(explode(':', $line, 2));
switch ($parts[0]) {
case 'KEY':
$this->key = StringUtil::trim($parts[1]);
break;
case 'SALT':
$this->salt = StringUtil::trim($parts[1]);
break;
case 'ACTION':
$this->action = StringUtil::trim($parts[1]);
break;
case 'SENDTIME':
$this->sendTime = intval(StringUtil::trim($parts[1]));
break;
case 'CONNECTION':
if ($parts[1] !== 'Close' && $parts[1] !== 'Keep-Alive') {
$this->send('unkwown connection value ' . $parts[1], 206);
return;
}
$this->connection = StringUtil::trim($parts[1]);
break;
default:
if (substr($parts[0], 0, 5) == 'DATA_') {
$parts[0] = substr($parts[0], 5);
} else {
$this->send('unkwown line ' . $parts[0], 204);
return;
}
$this->data[StringUtil::toLowerCase($parts[0])] = $parts[1];
}
}
// validate
if (empty($this->key)) {
$this->send('no key found', 200);
return;
}
if (empty($this->salt)) {
$this->send('no salt found', 201);
return;
}
if (empty($this->action)) {
$this->send('no key found', 202);
return;
}
if (empty($this->sendTime)) {
$this->send('sendTime not given', 203);
return;
}
if ($this->sendTime < time() - 60 * 60 || $this->sendTime > time()) {
$this->send('invalid sendTime given', 207);
return;
}
/*if(count($this->data) > 5) {
$this->send('too many data given', 205);
return;
}*/
if (!$this->validateKey($this->data)) {
return;
}
// execute
$className = 'WOTAPI' . StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($this->action)) . 'Action';
if (!file_exists(LW_DIR . 'lib/wotapi/' . $className . '.class.php')) {
$this->send('classfile not found', 210);
return;
}
require_once LW_DIR . 'lib/wotapi/' . $className . '.class.php';
if (!class_exists($className)) {
$this->send('class \'' . $className . '\' not found', 211);
return;
}
try {
$action = new $className($this);
} catch (Exception $e) {
ob_start();
$e->show();
$output = ob_get_contents();
ob_end_clean();
$this->send('exception thrown while execution: ' . addcslashes($output, ":\n\r\\"), 220);
}
}
示例8: applyPrefilters
/**
* Applies the prefilters to the given string.
*
* @param string $string
* @return string
*/
public function applyPrefilters($string)
{
foreach ($this->template->getPrefilters() as $prefilter) {
if (!is_object($prefilter)) {
$filename = $this->template->getPluginFilename('prefilter', $prefilter);
if (!file_exists($filename)) {
throw new SystemException('unable to find class file ' . $filename, 11000);
}
require_once $filename;
$className = 'TemplatePluginPrefilter' . StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($prefilter));
if (!class_exists($className)) {
throw new SystemException($this->formatSyntaxError('unable to find prefilter class ' . $className, $this->currentIdentifier), 11001);
}
$prefilter = new $className();
}
if ($prefilter instanceof TemplatePluginPrefilter) {
$string = $prefilter->execute($string, $this);
} else {
throw new SystemException($this->formatSyntaxError("Prefilter '" . $prefilter . "' does not implement the interface 'TemplatePluginPrefilter'", $this->currentIdentifier), 11010);
}
}
return $string;
}
示例9: getPluginFilename
/**
* @see Template::getPluginFilename()
*/
public function getPluginFilename($type, $tag)
{
return $this->pluginDir . TMP_FILE_PREFIX . 'TemplatePlugin' . StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($type)) . StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($tag)) . '.class.php';
}
示例10: getAttachments
//.........这里部分代码省略.........
$row['username'] = $tmp['username'];
}
} else {
if (empty($row['username']) && $row['messageType'] == 'pm') {
$tmp = WCF::getDB()->getFirstRow('SELECT username FROM wcf' . WCF_N . '_pm WHERE pmID = ' . $row['messageID']);
if (isset($tmp['username'])) {
$row['username'] = $tmp['username'];
}
}
}
if (!empty($row['username'])) {
$row['username'] = StringUtil::encodeHTML($row['username']);
} else {
$row['username'] = '-';
}
if (!empty($row['userID'])) {
$row['username'] = '<a href="index.php?form=UserEdit&userID=' . $row['userID'] . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED . '" title="' . WCF::getLanguage()->get('wcf.acp.user.edit') . '">' . $row['username'] . '</a>';
}
// pm
$ownPM = false;
if ($row['messageType'] == 'pm' && !empty($row['userID']) && ($row['userID'] == $userID || $row['userID'] == WCF::getUser()->userID)) {
if (!empty($userID)) {
$tUserID = $userID;
} else {
$tUserID = WCF::getUser()->userID;
}
$sql = "SELECT COUNT(*) AS cnt" . "\n FROM wcf" . WCF_N . "_pm" . "\n WHERE pmID = " . $row['messageID'] . "\n AND userID = " . $tUserID . "\n AND saveInOutbox != 0";
$tmp = WCF::getDB()->getFirstRow($sql);
if (!empty($tmp['cnt'])) {
$ownPM = true;
}
}
if (!empty($row['attachmentSize'])) {
$row['attachmentSize'] = round($row['attachmentSize'] / 1024, 2) . ' kB';
}
// message type urls
$row['messageTypeUrl'] = $row['messageType'];
if (self::wbbExists() && preg_match('/^(post|pm)$/', $row['messageType'])) {
if ($row['messageType'] == 'post') {
$row['messageTypeUrl'] = '<a href="' . RELATIVE_WBB_DIR . 'index.php?page=Thread&postID=' . $row['messageID'] . '#post' . $row['messageID'] . '" target="' . ATTACHMENTMANAGER_TARGETWINDOW . '">' . $row['messageType'] . '</a>';
} else {
if ($ownPM) {
$row['messageTypeUrl'] = '<a href="' . RELATIVE_WBB_DIR . 'index.php?page=PMView&pmID=' . $row['messageID'] . '#pm' . $row['messageID'] . '" target="' . ATTACHMENTMANAGER_TARGETWINDOW . '">' . $row['messageType'] . '</a>';
}
}
}
// thumbnails / files
$maxLength = 0;
$shortFileName = $row['attachmentName'];
if ($isACP && ATTACHMENTMANAGER_MAXLENGTHACP > 0) {
$maxLength = ATTACHMENTMANAGER_MAXLENGTHACP;
} else {
if (ATTACHMENTMANAGER_MAXLENGTHUCP > 0) {
$maxLength = ATTACHMENTMANAGER_MAXLENGTHUCP;
}
}
if ($maxLength > 0 && strlen($shortFileName) > $maxLength) {
preg_match('/^(.*)(\\..*)$/', $shortFileName, $match);
if (isset($match[2])) {
$shortFileName = substr($match[1], 0, $maxLength - (strlen($match[2]) + 2)) . '..' . $match[2];
} else {
$shortFileName = substr($shortFileName, 0, $maxLength);
}
}
$row['attachmentUrl'] = '<span title="' . $row['attachmentName'] . '">' . $shortFileName . '</span>';
if (self::wbbExists()) {
if ($row['messageType'] == 'pm' && !$ownPM) {
$row['attachmentUrl'] = '<span title="' . $row['attachmentName'] . '">' . $shortFileName . '</span>';
} else {
if (!empty($showThumbnails) && !empty($row['isImage'])) {
if (!empty($row['thumbnailSize'])) {
$row['attachmentUrl'] = '<a href="' . RELATIVE_WBB_DIR . 'index.php?page=Attachment&attachmentID=' . $row['attachmentID'] . '&h=' . $row['sha1Hash'] . '" target="' . ATTACHMENTMANAGER_TARGETWINDOW . '" style="width:' . ATTACHMENT_THUMBNAIL_WIDTH . 'px; height:' . ATTACHMENT_THUMBNAIL_HEIGHT . 'px;"><img src="' . RELATIVE_WBB_DIR . 'index.php?page=Attachment&attachmentID=' . $row['attachmentID'] . '&h=' . $row['sha1Hash'] . '&thumbnail=1" alt="' . $row['attachmentName'] . '" title="' . $row['attachmentName'] . '" style="max-width:' . ATTACHMENT_THUMBNAIL_WIDTH . 'px; max-height:' . ATTACHMENT_THUMBNAIL_HEIGHT . 'px;" /></a>';
} else {
$row['attachmentUrl'] = '<a href="' . RELATIVE_WBB_DIR . 'index.php?page=Attachment&attachmentID=' . $row['attachmentID'] . '&h=' . $row['sha1Hash'] . '" target="' . ATTACHMENTMANAGER_TARGETWINDOW . '" style="width:' . ATTACHMENT_THUMBNAIL_WIDTH . 'px; height:' . ATTACHMENT_THUMBNAIL_HEIGHT . 'px;"><img src="' . RELATIVE_WBB_DIR . 'index.php?page=Attachment&attachmentID=' . $row['attachmentID'] . '&h=' . $row['sha1Hash'] . '" alt="' . $row['attachmentName'] . '" title="' . $row['attachmentName'] . '" style="max-width:' . ATTACHMENT_THUMBNAIL_WIDTH . 'px; max-height:' . ATTACHMENT_THUMBNAIL_HEIGHT . 'px;" /></a>';
}
} else {
$row['attachmentUrl'] = '<a href="' . RELATIVE_WBB_DIR . 'index.php?page=Attachment&attachmentID=' . $row['attachmentID'] . '&h=' . $row['sha1Hash'] . '" target="' . ATTACHMENTMANAGER_TARGETWINDOW . '" title="' . $row['attachmentName'] . '">' . $shortFileName . '</a>';
}
}
}
$icon = RELATIVE_WCF_DIR . 'icon/fileTypeIconDefaultM.png';
// get file extension
$extension = StringUtil::firstCharToUpperCase(StringUtil::toLowerCase(StringUtil::substring($row['attachmentName'], StringUtil::lastIndexOf($row['attachmentName'], '.') + 1)));
// get file type icon
if (file_exists(WCF_DIR . 'icon/fileTypeIcon' . $extension . 'M.png')) {
$icon = RELATIVE_WCF_DIR . 'icon/fileTypeIcon' . $extension . 'M.png';
} else {
foreach (self::$fileTypeGroups as $key => $group) {
if (in_array($extension, $group)) {
$icon = RELATIVE_WCF_DIR . 'icon/fileTypeIcon' . $key . 'M.png';
break;
}
}
}
$row['mimeIcon'] = '<img src="' . $icon . '"' . ($isACP ? ' height="16" width="16"' : '') . ' alt="' . $row['fileType'] . '" title="' . $row['fileType'] . '" />';
$ret[$i] = $row;
$i++;
}
return $ret;
}