本文整理汇总了PHP中TYPO3\CMS\Core\Utility\StringUtility::isLastPartOfString方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtility::isLastPartOfString方法的具体用法?PHP StringUtility::isLastPartOfString怎么用?PHP StringUtility::isLastPartOfString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\StringUtility
的用法示例。
在下文中一共展示了StringUtility::isLastPartOfString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createZipFileFromExtension
/**
* Create a zip file from an extension
*
* @param array $extension
* @return string
*/
public function createZipFileFromExtension($extension)
{
$extensionPath = $this->getAbsoluteExtensionPath($extension);
$version = $this->getExtensionVersion($extension);
$fileName = $this->getAbsolutePath('typo3temp/' . $extension . '_' . $version . '.zip');
$zip = new \ZipArchive();
$zip->open($fileName, \ZipArchive::CREATE);
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($extensionPath));
foreach ($iterator as $key => $value) {
$archiveName = str_replace($extensionPath, '', $key);
if (\TYPO3\CMS\Core\Utility\StringUtility::isLastPartOfString($key, '.')) {
continue;
} else {
$zip->addFile($key, $archiveName);
}
}
$zip->close();
return $fileName;
}
示例2: isLastPartOfStringReturnsThrowsExceptionWithInvalidArguments
/**
* @test
* @dataProvider isLastPartOfStringReturnsInvalidArgumentDataProvider
* @expectedException \InvalidArgumentException
*/
public function isLastPartOfStringReturnsThrowsExceptionWithInvalidArguments($string, $part)
{
$this->assertFalse(\TYPO3\CMS\Core\Utility\StringUtility::isLastPartOfString($string, $part));
}
示例3: _parseFunc
//.........这里部分代码省略.........
$pregSplitMode = 'i';
if (isset($GLOBALS['TSFE']->config['config']['sword_noMixedCase']) && !empty($GLOBALS['TSFE']->config['config']['sword_noMixedCase'])) {
$pregSplitMode = '';
}
$pieces = preg_split('/' . $GLOBALS['TSFE']->sWordRegEx . '/' . $pregSplitMode, $data, 2);
$newstring .= $pieces[0];
$match_len = strlen($data) - (strlen($pieces[0]) + strlen($pieces[1]));
if (strstr($pieces[0], '<') || strstr($pieces[0], '>')) {
// Returns TRUE, if a '<' is closer to the string-end than '>'.
// This is the case if we're INSIDE a tag (that could have been
// made by makelinks...) and we must secure, that the inside of a tag is
// not marked up.
$inTag = strrpos($pieces[0], '<') > strrpos($pieces[0], '>');
}
// The searchword:
$match = substr($data, strlen($pieces[0]), $match_len);
if (trim($match) && strlen($match) > 1 && !$inTag) {
$match = $this->wrap($match, $conf['sword']);
}
// Concatenate the Search Word again.
$newstring .= $match;
$data = $pieces[1];
} while ($pieces[1]);
$data = $newstring;
}
}
$contentAccum[$contentAccumP] .= $data;
}
$inside = 1;
} else {
// tags
$len = strcspn(substr($theValue, $pointer), '>') + 1;
$data = substr($theValue, $pointer, $len);
if (StringUtility::isLastPartOfString($data, '/>') && !GeneralUtility::isFirstPartOfStr($data, '<link ')) {
$tagContent = substr($data, 1, -2);
} else {
$tagContent = substr($data, 1, -1);
}
$tag = explode(' ', trim($tagContent), 2);
$tag[0] = strtolower($tag[0]);
if ($tag[0][0] === '/') {
$tag[0] = substr($tag[0], 1);
$tag['out'] = 1;
}
if ($conf['tags.'][$tag[0]]) {
$treated = 0;
$stripNL = 0;
// in-tag
if (!$currentTag && !$tag['out']) {
// $currentTag (array!) is the tag we are currently processing
$currentTag = $tag;
$contentAccumP++;
$treated = 1;
// in-out-tag: img and other empty tags
if (preg_match('/^(area|base|br|col|hr|img|input|meta|param)$/i', $tag[0])) {
$tag['out'] = 1;
}
}
// out-tag
if ($currentTag[0] == $tag[0] && $tag['out']) {
$theName = $conf['tags.'][$tag[0]];
$theConf = $conf['tags.'][$tag[0] . '.'];
// This flag indicates, that NL- (13-10-chars) should be stripped first and last.
$stripNL = $theConf['stripNL'] ? 1 : 0;
// This flag indicates, that this TypoTag section should NOT be included in the nonTypoTag content.
$breakOut = $theConf['breakoutTypoTagContent'] ? 1 : 0;
示例4: getConfiguration
/**
* Returns the parsed and processed configuration
*
* @param array $rawConfiguration Raw configuration from TypoScriptFrontendController::$config['config']
* @return array
*/
protected function getConfiguration(array $rawConfiguration)
{
$configuration = isset($rawConfiguration['cors.']) ? $rawConfiguration['cors.'] : [];
foreach ($configuration as $option => $value) {
// Perform stdWrap processing on all options
if (StringUtility::isLastPartOfString($option, '.') && isset($value['stdWrap.'])) {
unset($configuration[$option]);
$option = substr($option, 0, -1);
$value = $this->frontendController->cObj->stdWrap($configuration[$option], $value['stdWrap.']);
}
switch ($option) {
case 'allowCredentials':
$value = in_array($value, ['1', 'true'], TRUE);
break;
case 'allowHeaders':
case 'allowMethods':
case 'allowOrigin':
case 'exposeHeaders':
$value = GeneralUtility::trimExplode(',', $value);
break;
case 'maxAge':
$value = (int) $value;
break;
}
if ($option == 'allowOrigin.' && isset($value['pattern'])) {
$option = 'allowOriginPattern';
$value = $value['pattern'];
}
$configuration[$option] = $value;
}
return $configuration;
}
示例5: applyStandardWrapToFluidPaths
/**
* Applies stdWrap on Fluid path definitions
*
* @param array $paths
*
* @return array
*/
protected function applyStandardWrapToFluidPaths(array $paths)
{
$finalPaths = array();
foreach ($paths as $key => $path) {
if (StringUtility::isLastPartOfString($key, '.')) {
if (isset($paths[substr($key, 0, -1)])) {
continue;
}
$path = $this->cObj->stdWrap('', $path);
} elseif (isset($paths[$key . '.'])) {
$path = $this->cObj->stdWrap($path, $paths[$key . '.']);
}
$finalPaths[$key] = GeneralUtility::getFileAbsFileName($path);
}
return $finalPaths;
}
示例6: isLastPartOfStringReturnsFalseForNotMatchingFirstPart
/**
* @test
* @dataProvider isLastPartOfStringReturnsFalseForNotMatchingFirstPartDataProvider
*/
public function isLastPartOfStringReturnsFalseForNotMatchingFirstPart($string, $part)
{
$this->assertFalse(\TYPO3\CMS\Core\Utility\StringUtility::isLastPartOfString($string, $part));
}