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


PHP StringUtility::endsWith方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Utility\StringUtility::endsWith方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtility::endsWith方法的具体用法?PHP StringUtility::endsWith怎么用?PHP StringUtility::endsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Utility\StringUtility的用法示例。


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

示例1: addTcaTypeIcon

 /**
  * Add the given icon to the TCA table type
  *
  * @param string $table
  * @param string $type
  * @param string $icon
  */
 public static function addTcaTypeIcon($table, $type, $icon)
 {
     if (GeneralUtility::compat_version('7.0')) {
         $fullIconPath = substr(PathUtility::getAbsoluteWebPath($icon), 1);
         if (StringUtility::endsWith(strtolower($fullIconPath), 'svg')) {
             $iconProviderClass = 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\SvgIconProvider';
         } else {
             $iconProviderClass = 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\BitmapIconProvider';
         }
         /** @var IconRegistry $iconRegistry */
         $iconRegistry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconRegistry');
         $iconIdentifier = 'tcarecords-' . $table . '-' . $type;
         $iconRegistry->registerIcon($iconIdentifier, $iconProviderClass, ['source' => $fullIconPath]);
         $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'][$type] = $iconIdentifier;
     } else {
         $fullIconPath = str_replace('../typo3/', '', $icon);
         SpriteManager::addTcaTypeIcon('tt_content', $type, $fullIconPath);
     }
 }
开发者ID:c2po,项目名称:autoloader,代码行数:26,代码来源:IconUtility.php

示例2: _parseFunc


//.........这里部分代码省略.........
                             if (isset($tsfe->config['config']['sword_noMixedCase']) && !empty($tsfe->config['config']['sword_noMixedCase'])) {
                                 $pregSplitMode = '';
                             }
                             $pieces = preg_split('/' . $tsfe->sWordRegEx . '/' . $pregSplitMode, $data, 2);
                             $newstring .= $pieces[0];
                             $match_len = strlen($data) - (strlen($pieces[0]) + strlen($pieces[1]));
                             $inTag = false;
                             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::endsWith($data, '/>') && !StringUtility::beginsWith($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 = false;
                 $stripNL = false;
                 // in-tag
                 if (!$currentTag && !$tag['out']) {
                     // $currentTag (array!) is the tag we are currently processing
                     $currentTag = $tag;
                     $contentAccumP++;
                     $treated = true;
                     // 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 = (bool) $theConf['stripNL'];
                     // This flag indicates, that this TypoTag section should NOT be included in the nonTypoTag content.
                     $breakOut = $theConf['breakoutTypoTagContent'] ? 1 : 0;
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:67,代码来源:ContentObjectRenderer.php

示例3: endsWithReturnsThrowsExceptionWithInvalidArguments

 /**
  * @test
  * @dataProvider endsWithReturnsThrowsExceptionWithInvalidArgumentsDataProvider
  * @expectedException \InvalidArgumentException
  */
 public function endsWithReturnsThrowsExceptionWithInvalidArguments($string, $part)
 {
     StringUtility::endsWith($string, $part);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:9,代码来源:StringUtilityTest.php

示例4: getGitRevision

 /**
  * Gets the current GIT revision and branch
  *
  * @return void
  */
 protected function getGitRevision()
 {
     if (!StringUtility::endsWith(TYPO3_version, '-dev') || \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::isFunctionDisabled('exec')) {
         return;
     }
     // check if git exists
     CommandUtility::exec('git --version', $_, $returnCode);
     if ((int) $returnCode !== 0) {
         // git is not available
         return;
     }
     $revision = trim(CommandUtility::exec('git rev-parse --short HEAD'));
     $branch = trim(CommandUtility::exec('git rev-parse --abbrev-ref HEAD'));
     if (!empty($revision) && !empty($branch)) {
         $this->systemInformation[] = array('title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.gitrevision')), 'value' => sprintf('%s [%s]', $revision, $branch), 'icon' => $this->iconFactory->getIcon('sysinfo-git', Icon::SIZE_SMALL)->render());
     }
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:22,代码来源:SystemInformationToolbarItem.php

示例5: getIconHtml

 /**
  * Renders the $icon, supports a filename for skinImg or sprite-icon-name
  *
  * @param string $icon The icon passed, could be a file-reference or a sprite Icon name
  * @param string $alt Alt attribute of the icon returned
  * @param string $title Title attribute of the icon return
  * @return string A tag representing to show the asked icon
  * @internal
  */
 public static function getIconHtml($icon, $alt = '', $title = '')
 {
     $icon = (string) $icon;
     $iconFile = '';
     $iconInfo = false;
     if (StringUtility::beginsWith($icon, 'EXT:')) {
         $absoluteFilePath = GeneralUtility::getFileAbsFileName($icon);
         if (!empty($absoluteFilePath)) {
             $iconFile = '../' . PathUtility::stripPathSitePrefix($absoluteFilePath);
             $iconInfo = StringUtility::endsWith($absoluteFilePath, '.svg') ? true : getimagesize($absoluteFilePath);
         }
     } elseif (StringUtility::beginsWith($icon, '../')) {
         // @TODO: this is special modList, files from folders and selicon
         $iconFile = GeneralUtility::resolveBackPath($icon);
         if (is_file(PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)))) {
             $iconInfo = StringUtility::endsWith($icon, '.svg') ? true : getimagesize(PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)));
         }
     }
     if ($iconInfo !== false && is_file(GeneralUtility::resolveBackPath(PATH_typo3 . $iconFile))) {
         return '<img' . ' src="' . htmlspecialchars($iconFile) . '"' . ' alt="' . htmlspecialchars($alt) . '" ' . ($title ? 'title="' . htmlspecialchars($title) . '"' : '') . ' />';
     }
     $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     return '<span alt="' . htmlspecialchars($alt) . '" title="' . htmlspecialchars($title) . '">' . $iconFactory->getIcon($icon, Icon::SIZE_SMALL)->render() . '</span>';
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:33,代码来源:FormEngineUtility.php

示例6: detectIconProvider

 /**
  * Detect the IconProvider of an icon
  *
  * @param string $iconReference
  * @return string
  */
 protected function detectIconProvider($iconReference)
 {
     if (StringUtility::endsWith(strtolower($iconReference), 'svg')) {
         return SvgIconProvider::class;
     } else {
         return BitmapIconProvider::class;
     }
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:14,代码来源:IconRegistry.php

示例7: registerTCAIcons

 /**
  * Load icons from TCA for each table and add them as "tcarecords-XX" to $this->icons
  */
 protected function registerTCAIcons()
 {
     // if TCA is not available, e.g. for some unit test, return directly
     if (!is_array($GLOBALS['TCA'])) {
         return;
     }
     $resultArray = array();
     $tcaTables = array_keys($GLOBALS['TCA']);
     // check every table in the TCA, if an icon is needed
     foreach ($tcaTables as $tableName) {
         // This method is only needed for TCA tables where typeicon_classes are not configured
         if (is_array($GLOBALS['TCA'][$tableName])) {
             $tcaCtrl = $GLOBALS['TCA'][$tableName]['ctrl'];
             $icon = null;
             $iconIdentifier = 'tcarecords-' . $tableName . '-default';
             if ($this->isRegistered($iconIdentifier)) {
                 continue;
             }
             if (isset($tcaCtrl['iconfile'])) {
                 if (StringUtility::beginsWith($tcaCtrl['iconfile'], 'EXT:')) {
                     $icon = $tcaCtrl['iconfile'];
                 } elseif (strpos($tcaCtrl['iconfile'], '/') !== false) {
                     $icon = TYPO3_mainDir . GeneralUtility::resolveBackPath($tcaCtrl['iconfile']);
                 }
                 if ($icon !== null) {
                     $resultArray[$iconIdentifier] = $icon;
                 }
             }
         }
     }
     if (!empty($GLOBALS['TBE_STYLES']['spritemanager']['singleIcons'])) {
         foreach ($GLOBALS['TBE_STYLES']['spritemanager']['singleIcons'] as $iconIdentifier => $iconFile) {
             if (StringUtility::beginsWith($iconFile, '../typo3conf/ext/')) {
                 $iconFile = str_replace('../typo3conf/ext/', 'EXT:', $iconFile);
             }
             if (StringUtility::beginsWith($iconFile, 'sysext/')) {
                 $iconFile = str_replace('sysext/', 'EXT:', $iconFile);
             }
             $resultArray[$iconIdentifier] = $iconFile;
         }
     }
     foreach ($resultArray as $iconIdentifier => $iconFilePath) {
         if (StringUtility::endsWith(strtolower($iconFilePath), 'svg')) {
             $iconProviderClass = SvgIconProvider::class;
         } else {
             $iconProviderClass = BitmapIconProvider::class;
         }
         $this->icons[$iconIdentifier] = array('provider' => $iconProviderClass, 'options' => array('source' => $iconFilePath));
     }
     $this->tcaInitialized = true;
 }
开发者ID:sup7even,项目名称:TYPO3-schulung-Distribution,代码行数:54,代码来源:IconRegistry.php


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