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


PHP Util::getTypoScriptObject方法代码示例

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


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

示例1: execute

 /**
  * Creates a link to a given page with a given link text
  *
  * @param array Array of arguments, [0] is the link text, [1] is the (optional) page Id to link to (otherwise TSFE->id), [2] are additional URL parameters, [3] use cache, defaults to FALSE, [4] additional A tag parameters
  * @return string complete anchor tag with URL and link text
  */
 public function execute(array $arguments = array())
 {
     $linkText = $arguments[0];
     $additionalParameters = $arguments[2] ? $arguments[2] : '';
     $useCache = $arguments[3] ? true : false;
     $ATagParams = $arguments[4] ? $arguments[4] : '';
     // by default or if no link target is set, link to the current page
     $linkTarget = $GLOBALS['TSFE']->id;
     // if the link target is a number, interpret it as a page ID
     $linkArgument = trim($arguments[1]);
     if (is_numeric($linkArgument)) {
         $linkTarget = intval($linkArgument);
     } elseif (!empty($linkArgument) && is_string($linkArgument)) {
         if (Util::isValidTypoScriptPath($linkArgument)) {
             try {
                 $typoscript = Util::getTypoScriptObject($linkArgument);
                 $pathExploded = explode('.', $linkArgument);
                 $lastPathSegment = array_pop($pathExploded);
                 $linkTarget = intval($typoscript[$lastPathSegment]);
             } catch (\InvalidArgumentException $e) {
                 // ignore exceptions caused by markers, but accept the exception for wrong TS paths
                 if (substr($linkArgument, 0, 3) != '###') {
                     throw $e;
                 }
             }
         } elseif (GeneralUtility::isValidUrl($linkArgument) || GeneralUtility::isValidUrl(GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '/' . $linkArgument)) {
             // $linkTarget is an URL
             $linkTarget = filter_var($linkArgument, FILTER_SANITIZE_URL);
         }
     }
     $linkConfiguration = array('useCacheHash' => $useCache, 'no_cache' => false, 'parameter' => $linkTarget, 'additionalParams' => $additionalParameters, 'ATagParams' => $ATagParams);
     return $this->contentObject->typoLink($linkText, $linkConfiguration);
 }
开发者ID:Gregor-Agnes,项目名称:ext-solr,代码行数:39,代码来源:Link.php

示例2: resolveTypoScriptPath

 /**
  * Resolves a TS path and returns its value
  *
  * @param string $path a TS path, separated with dots
  * @return string
  */
 protected function resolveTypoScriptPath($path, $arguments = NULL)
 {
     $value = '';
     $pathExploded = explode('.', trim($path));
     $lastPathSegment = array_pop($pathExploded);
     $pathBranch = Util::getTypoScriptObject($path);
     // generate ts content
     $cObj = $this->getContentObject();
     if (!isset($pathBranch[$lastPathSegment . '.'])) {
         $value = htmlspecialchars($pathBranch[$lastPathSegment]);
     } else {
         if (count($arguments)) {
             $data = array('arguments' => $arguments);
             $numberOfArguments = count($arguments);
             for ($i = 0; $i < $numberOfArguments; $i++) {
                 $data['argument_' . $i] = $arguments[$i];
             }
             $cObj->start($data);
         }
         $value = $cObj->cObjGetSingle($pathBranch[$lastPathSegment], $pathBranch[$lastPathSegment . '.']);
     }
     return $value;
 }
开发者ID:nxpthx,项目名称:ext-solr,代码行数:29,代码来源:Ts.php

示例3: determinePageId

 /**
  * Take the link target ID viewhelper argument and try to find a page ID from it.
  *
  * @param string $linkArgument The viewhelper's link target argument
  * @return integer Page ID
  * @throws \InvalidArgumentException if an invalid TypoScript path was given
  */
 protected function determinePageId($linkArgument)
 {
     $pageId = $GLOBALS['TSFE']->id;
     if (is_numeric($linkArgument)) {
         // if the link target is a number, interpret it as a page ID
         $pageId = intval($linkArgument);
     } elseif (is_string($linkArgument) && !empty($linkArgument)) {
         // interpret a TypoScript path
         try {
             $typoscript = Util::getTypoScriptObject($linkArgument);
             $pathExploded = explode('.', $linkArgument);
             $lastPathSegment = array_pop($pathExploded);
             $pageId = intval($typoscript[$lastPathSegment]);
         } catch (\InvalidArgumentException $e) {
             // ignore exceptions caused by markers, but accept the exception for wrong TS paths
             if (substr($linkArgument, 0, 3) != '###') {
                 throw $e;
             }
         }
     }
     return $pageId;
 }
开发者ID:Gregor-Agnes,项目名称:ext-solr,代码行数:29,代码来源:SolrLink.php


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