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


PHP Controller::replaceInsertTags方法代码示例

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


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

示例1: replace

 public static function replace($strBuffer, \HeimrichHannot\Submissions\SubmissionModel $objSubmission)
 {
     $tokens = preg_split('/\\[(([^\\[\\]]*)*)\\]/', $strBuffer, -1, PREG_SPLIT_DELIM_CAPTURE);
     $strBuffer = '';
     for ($_rit = 0, $_cnt = count($tokens); $_rit < $_cnt; $_rit += 3) {
         $strBuffer .= $tokens[$_rit];
         $strToken = $tokens[$_rit + 1];
         // Skip empty tokens
         if ($tokens == '') {
             continue;
         }
         // Run the replacement again if there are more tags (see #4402)
         if (strpos($strToken, '[') !== false) {
             $strToken = static::replace($strToken, $objSubmission);
         }
         $arrParams = explode('::', $strToken);
         $strField = $arrParams[0];
         $varValue = $objSubmission->{$strField};
         if ($arrParams[1]) {
             $varValue = static::transform($varValue, $strField, array_slice($arrParams, 1, count($arrParams)), $objSubmission);
         }
         $strBuffer .= $varValue;
     }
     return \Controller::replaceInsertTags($strBuffer);
 }
开发者ID:heimrichhannot,项目名称:contao-submissions,代码行数:25,代码来源:Tokens.php

示例2: generate

 public function generate()
 {
     global $objPage;
     $this->Template = new \FrontendTemplate($this->strTemplate);
     $this->Template->setData($this->arrData);
     $this->Template->title = '';
     // title should be empty by default, use headline or pageTitle instead
     $arrClasses = array();
     if ($this->objConfig->activeClass) {
         $arrClasses[] = $this->objConfig->activeClass;
     }
     if ($this->Template->headline == '') {
         $this->Template->headline = $this->headline;
     }
     if ($this->Template->hl == '') {
         $this->Template->hl = $this->hl;
     }
     $this->Template->class = implode(' ', $arrClasses);
     $this->Template->back = $this->getBackLink();
     $this->Template->redirectBack = $this->getRedirectBack();
     $this->compile();
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['generateModal']) && is_array($GLOBALS['TL_HOOKS']['generateModal'])) {
         foreach ($GLOBALS['TL_HOOKS']['generateModal'] as $callback) {
             static::importStatic($callback[0])->{$callback[1]}($this->Template, $this->objModel, $this->objConfig, $this);
         }
     }
     return \Controller::replaceInsertTags($this->Template->parse());
 }
开发者ID:heimrichhannot,项目名称:contao-modal,代码行数:29,代码来源:Modal.php

示例3: replaceInsertTags

 /**
  * Replace matching inserttags
  * @param string InsertTag
  * @param bool Use cache
  * @return string
  */
 protected function replaceInsertTags($strBuffer, $blnCache = false)
 {
     $this->import('Database');
     $aParams = explode('::', $strBuffer);
     switch ($aParams[0]) {
         case 'store':
             $this->Template = new FrontendTemplate('mod_storelocator_inserttag');
             // find store
             $objStore = NULL;
             $objStore = $this->Database->prepare("SELECT * FROM `tl_storelocator_stores` WHERE `id` = ? ")->limit(1)->execute($aParams[1]);
             $entry = NULL;
             $entry = $objStore->fetchAssoc();
             // get opening times
             $entry['opening_times'] = unserialize($entry['opening_times']);
             $entry['opening_times'] = !empty($entry['opening_times'][0]['from']) ? $entry['opening_times'] : NULL;
             // set country name
             $aCountryNames = $this->getCountries();
             $entry['country_code'] = $entry['country'];
             $entry['country_name'] = $aCountryNames[$entry['country']];
             if (!$objStore) {
                 return false;
             }
             $this->Template->entry = $entry;
             $sTemplate = $this->Template->parse();
             $sTemplate = Controller::replaceInsertTags($sTemplate);
             return $sTemplate;
             break;
             // not our insert tag?
         // not our insert tag?
         default:
             return false;
             break;
     }
     return false;
 }
开发者ID:numero2,项目名称:contao-storelocator,代码行数:41,代码来源:ModuleStorelocatorInsertTags.php

示例4: output

 /**
  * Output the response and clean output buffer
  */
 public function output()
 {
     ob_get_clean();
     $strBuffer = json_encode($this);
     echo \Controller::replaceInsertTags($strBuffer, false);
     // do not cache inserttags
     exit;
 }
开发者ID:heimrichhannot,项目名称:contao-ajax,代码行数:11,代码来源:Response.php

示例5: replaceInsertTagsOnlineView

 public static function replaceInsertTagsOnlineView(RenderMessageContentEvent $objEvent)
 {
     global $objPage;
     if ($objPage) {
         $strContent = $objEvent->getRenderedContent();
         $strContent = str_replace(array('%7B%7B', '%7D%7D'), array('{{', '}}'), $strContent);
         $objEvent->setRenderedContent(\Controller::replaceInsertTags($strContent));
     }
 }
开发者ID:heimrichhannot,项目名称:contao-avisota_inline_css,代码行数:9,代码来源:AvisotaInlineCss.php

示例6: replaceInsertTags

 public static function replaceInsertTags($varValue, $blnCache = true)
 {
     if (is_array($varValue)) {
         foreach ($varValue as $key => $value) {
             $varValue[$key] = static::replaceInsertTags($value, $blnCache);
         }
         return $varValue;
     }
     return \Controller::replaceInsertTags($varValue, $blnCache);
 }
开发者ID:heimrichhannot,项目名称:contao-formhybrid,代码行数:10,代码来源:FormHelper.php

示例7: replaceRecursively

 /**
  * Recursively replace insert tags
  *
  * @param array|string $varValue
  *
  * @return array|string
  */
 public static function replaceRecursively($varValue)
 {
     if (is_array($varValue)) {
         foreach ($varValue as $k => $v) {
             $varValue[$k] = static::replaceRecursively($v);
         }
         return $varValue;
     } elseif (is_object($varValue)) {
         return $varValue;
     }
     return \Controller::replaceInsertTags($varValue, false);
 }
开发者ID:codefog,项目名称:contao-haste,代码行数:19,代码来源:InsertTag.php

示例8: recursiveReplaceTokensAndTags

 /**
  * Recursively replace simple tokens and insert tags
  *
  * @param string $strText
  * @param array  $arrTokens    Array of Tokens
  * @param int    $intTextFlags Filters the tokens and the text for a given set of options
  *
  * @return string
  */
 public static function recursiveReplaceTokensAndTags($strText, $arrTokens, $intTextFlags = 0)
 {
     if ($intTextFlags > 0) {
         $arrTokens = static::convertToText($arrTokens, $intTextFlags);
     }
     // PHP 7 compatibility
     // See #309 (https://github.com/contao/core-bundle/issues/309)
     if (version_compare(VERSION . '.' . BUILD, '3.5.1', '>=')) {
         // Must decode, tokens could be encoded
         $strText = \StringUtil::decodeEntities($strText);
     } else {
         // Must decode, tokens could be encoded
         $strText = \String::decodeEntities($strText);
     }
     // Replace all opening and closing tags with a hash so they don't get stripped
     // by parseSimpleTokens() - this is useful e.g. for XML content
     $strHash = md5($strText);
     $strTagOpenReplacement = 'HASTE-TAG-OPEN-' . $strHash;
     $strTagCloseReplacement = 'HASTE-TAG-CLOSE-' . $strHash;
     $arrOriginal = array('<', '>');
     $arrReplacement = array($strTagOpenReplacement, $strTagCloseReplacement);
     $strBuffer = str_replace($arrOriginal, $arrReplacement, $strText);
     // PHP 7 compatibility
     // See #309 (https://github.com/contao/core-bundle/issues/309)
     if (version_compare(VERSION . '.' . BUILD, '3.5.1', '>=')) {
         // first parse the tokens as they might have if-else clauses
         $strBuffer = \StringUtil::parseSimpleTokens($strBuffer, $arrTokens);
     } else {
         // first parse the tokens as they might have if-else clauses
         $strBuffer = \String::parseSimpleTokens($strBuffer, $arrTokens);
     }
     $strBuffer = str_replace($arrReplacement, $arrOriginal, $strBuffer);
     // then replace the insert tags
     $strBuffer = \Controller::replaceInsertTags($strBuffer, false);
     // check if the inserttags have returned a simple token or an insert tag to parse
     if ((strpos($strBuffer, '##') !== false || strpos($strBuffer, '{{') !== false) && $strBuffer != $strText) {
         $strBuffer = static::recursiveReplaceTokensAndTags($strBuffer, $arrTokens, $intTextFlags);
     }
     // PHP 7 compatibility
     // See #309 (https://github.com/contao/core-bundle/issues/309)
     if (version_compare(VERSION . '.' . BUILD, '3.5.1', '>=')) {
         $strBuffer = \StringUtil::restoreBasicEntities($strBuffer);
     } else {
         $strBuffer = \String::restoreBasicEntities($strBuffer);
     }
     if ($intTextFlags > 0) {
         $strBuffer = static::convertToText($strBuffer, $intTextFlags);
     }
     return $strBuffer;
 }
开发者ID:codefog,项目名称:contao-haste,代码行数:59,代码来源:StringUtil.php

示例9: generate

 /**
  * Should only return the field value
  * @return string
  */
 public function generate()
 {
     $arrData = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strName];
     $value = FormSubmission::prepareSpecialValueForPrint($this->varValue, $arrData, $this->strTable, $this, $this->activeRecord);
     switch ($this->type) {
         case 'multifileupload':
             if ($this->fieldType == 'checkbox') {
                 $value = '<ul class="download-list">' . implode('', array_map(function ($val) {
                     return '<li>{{download::' . str_replace(\Environment::get('url') . '/', '', $val) . '}}</li>';
                 }, explode(', ', $value))) . '</ul>';
                 break;
             }
             $value = '{{download::' . str_replace(\Environment::get('url') . '/', '', $value) . '}}';
             break;
     }
     $value = class_exists('Contao\\StringUtil') ? \StringUtil::decodeEntities(\Controller::replaceInsertTags($value)) : \String::decodeEntities(\Controller::replaceInsertTags($value));
     if (!$value) {
         $value = '-';
     }
     return $value;
 }
开发者ID:heimrichhannot,项目名称:contao-formhybrid,代码行数:25,代码来源:FormReadonlyField.php

示例10: processTarget

 public static function processTarget($target)
 {
     // replace insert tags for Contao 3.5.7 and up
     if (version_compare(VERSION . '.' . BUILD, '3.5.7', '>=')) {
         $target = \Controller::replaceInsertTags($target);
     }
     // check for insert tag
     if (stripos($target, '{{link_url::') === 0) {
         // get the page id
         $pageId = substr($target, 12, strpos($target, '}}') - 12);
         // get the page
         if (($objPage = \PageModel::findPublishedByIdOrAlias($pageId)) === null) {
             return;
         }
         // load details of the page
         $objPage->current()->loadDetails();
         // generate the URL
         $target = \Controller::generateFrontendUrl($objPage->row(), null, $objPage->rootLanguage, true) . substr($target, strpos($target, '}}') + 2);
     }
     // return processed target
     return $target;
 }
开发者ID:fritzmg,项目名称:contao-short-urls,代码行数:22,代码来源:ShortURLs.php

示例11: _replaceInsertTags

 /**
  * @param $strValue
  * @return string
  */
 private static function _replaceInsertTags($strValue)
 {
     if (is_string($strValue)) {
         return \Controller::replaceInsertTags($strValue);
     }
     return $strValue;
 }
开发者ID:alnv,项目名称:fmodul,代码行数:11,代码来源:HelperModel.php

示例12: generateField

 protected function generateField($strName, $arrData, $skipValidation = false)
 {
     $strClass = $GLOBALS['TL_FFL'][$arrData['inputType']];
     // overwrite the widget in readonly mode
     if ($this->viewMode == FORMHYBRID_VIEW_MODE_READONLY || $this->viewMode == FORMHYBRID_VIEW_MODE_DEFAULT && $this->addReadOnly && in_array($strName, $this->arrReadOnly)) {
         $strClass = 'HeimrichHannot\\FormHybrid\\FormReadonlyField';
         $skipValidation = true;
     }
     $strInputMethod = $this->strInputMethod;
     // Continue if the class is not defined
     if (!class_exists($strClass)) {
         return false;
     }
     $arrWidgetErrors = array();
     // contains the load_callback!
     $varDefault = $this->getDefaultFieldValue($strName, $arrData);
     $varValue = $varDefault;
     if ($this->isSubmitted && !$skipValidation) {
         $varValue = \Input::$strInputMethod($strName) !== null ? \Input::$strInputMethod($strName) : $varValue;
         $varValue = FormSubmission::prepareSpecialValueForSave($varValue, $arrData, $this->strTable, $this->intId, $varDefault, $arrWidgetErrors);
     }
     // overwrite required fields
     if ($this->overwriteRequired) {
         // set mandatory to false
         $arrData['eval']['mandatory'] = false;
         // overwrite mandatory by config
         if (!$arrData['eval']['mandatory'] && in_array($strName, $this->arrRequired)) {
             $arrData['eval']['mandatory'] = true;
         }
     }
     // prevent name for GET and submit widget, otherwise url will have submit name in
     if ($this->strMethod == FORMHYBRID_METHOD_GET && $arrData['inputType'] == 'submit') {
         $strName = '';
     }
     $arrData['eval']['tagTable'] = $this->strTable;
     // always disable validation for filter form
     if ($this->isFilterForm) {
         $arrData['eval']['mandatory'] = false;
     }
     // to make captcha form related, add the form id without entity id
     if ($arrData['inputType'] == 'captcha') {
         $strName .= '_' . $this->getFormId(false);
     }
     $this->strField = $strName;
     $this->strInputName = $strName;
     $this->varValue = is_array($varValue) ? $varValue : \Controller::replaceInsertTags($varValue);
     $arrWidget = \Widget::getAttributesFromDca($arrData, $strName, is_array($varValue) ? $varValue : \Controller::replaceInsertTags($varValue), $strName, $this->strTable, $this);
     $this->updateWidget($arrWidget, $arrData);
     list($blnActive, $strSubPalette, $arrFields, $arrSubPaletteFields, $blnAutoSubmit, $blnToggleSubpalette) = $this->retrieveSubpaletteWithState($strName, array_keys($this->arrFields));
     // support submitOnChange as form submission
     if ($arrData['eval']['submitOnChange'] && $blnToggleSubpalette) {
         if ($blnAutoSubmit) {
             $arrWidget['onchange'] = $this->async ? 'FormhybridAjaxRequest.asyncSubmit(this.form);' : "this.form.submit();";
         } else {
             $strEvent = 'onclick';
             switch ($arrData['inputType']) {
                 case 'select':
                     $strEvent = 'onchange';
                     break;
             }
             $arrWidget[$strEvent] = "FormhybridAjaxRequest.toggleSubpalette(this, 'sub_" . $strName . "', '" . $strName . "', '" . AjaxAction::generateUrl(Form::FORMHYBRID_NAME, 'toggleSubpalette') . "')";
             unset($arrWidget['submitOnChange']);
         }
     } else {
         if ($arrWidget['submitOnChange']) {
             $strEvent = null;
             if ($arrWidget['onchange']) {
                 $strEvent = 'onchange';
             } else {
                 if ($arrWidget['onclick']) {
                     $strEvent = 'onclick';
                 }
             }
             if ($strEvent !== null) {
                 $arrWidget[$strEvent] = "FormhybridAjaxRequest.reload('" . $this->getFormId() . "', '" . AjaxAction::generateUrl(Form::FORMHYBRID_NAME, 'reload') . "')";
                 unset($arrWidget['submitOnChange']);
             }
         }
     }
     $objWidget = new $strClass($arrWidget);
     if (isset($arrData['formHybridOptions'])) {
         $arrFormHybridOptions = $arrData['formHybridOptions'];
         $this->import($arrFormHybridOptions[0]);
         $objWidget->options = $this->{$arrFormHybridOptions}[0]->{$arrFormHybridOptions}[1]();
     }
     if ($objWidget instanceof \uploadable) {
         $this->hasUpload = true;
     }
     // always xss clean the user input (also if filter, non-model submission, ...) -> done another time
     // FrontendWidget::validateGetAndPost() in
     $objWidget->value = FormHelper::xssClean($objWidget->value, $arrData['eval']['allowHtml']);
     if ($this->isSubmitted) {
         // add filter class if filter is active
         if ($objWidget->value && $this->isFilterForm) {
             $objWidget->class = 'filtered';
         }
         // do not validate fields if not submitted or skipvalidation issset
         // do not submit if ajax request and group is not formhybrid, for example multifileupload (otherwise captcha fields will be validated does not match visible one)
         if (!($this->isSkipValidation() || $skipValidation) && Ajax::isRelated(Form::FORMHYBRID_NAME) !== false) {
             FrontendWidget::validateGetAndPost($objWidget, $this->strMethod, $this->getFormId(), $arrData);
//.........这里部分代码省略.........
开发者ID:heimrichhannot,项目名称:contao-formhybrid,代码行数:101,代码来源:DC_Hybrid.php

示例13: addContextTokens

 /**
  *
  * Add contao core tokens, as long as the cron job does not have these information
  * on sending mail in queue mode
  *
  * @param $arrTokens
  * @param $strLanguage
  * @return bool false if context_tokens has been set already (required by cron)
  */
 protected function addContextTokens($objMessage, &$arrTokens, $strLanguage)
 {
     // add context tokens only once (queue will trigger this function again, and tokens might be overwritten)
     if (isset($arrTokens['context_tokens'])) {
         return false;
     }
     $arrTokens['context_tokens'] = true;
     // add environment variables as token
     $arrTokens['env_host'] = \Idna::decode(\Environment::get('host'));
     $arrTokens['env_http_host'] = \Idna::decode(\Environment::get('httpHost'));
     $arrTokens['env_url'] = \Idna::decode(\Environment::get('url'));
     $arrTokens['env_path'] = \Idna::decode(\Environment::get('base'));
     $arrTokens['env_request'] = \Idna::decode(\Environment::get('indexFreeRequest'));
     $arrTokens['env_ip'] = \Idna::decode(\Environment::get('ip'));
     $arrTokens['env_referer'] = \System::getReferer();
     $arrTokens['env_files_url'] = TL_FILES_URL;
     $arrTokens['env_plugins_url'] = TL_ASSETS_URL;
     $arrTokens['env_script_url'] = TL_ASSETS_URL;
     // add date tokens
     $arrTokens['date'] = \Controller::replaceInsertTags('{{date}}');
     $arrTokens['last_update'] = \Controller::replaceInsertTags('{{last_update}}');
     if (TL_MODE == 'FE') {
         // add current page as token
         global $objPage;
         if ($objPage !== null) {
             foreach ($objPage->row() as $key => $value) {
                 $arrTokens['page_' . $key] = $value;
             }
             if ($objPage->pageTitle == '') {
                 $arrTokens['pageTitle'] = $objPage->title;
             } else {
                 if ($objPage->parentPageTitle == '') {
                     $arrTokens['parentPageTitle'] = $objPage->parentTitle;
                 } else {
                     if ($objPage->mainPageTitle == '') {
                         $arrTokens['mainPageTitle'] = $objPage->mainTitle;
                     }
                 }
             }
         }
         // add user attributes as token
         if (FE_USER_LOGGED_IN) {
             $arrUserData = \FrontendUser::getInstance()->getData();
             if (is_array($arrUserData)) {
                 foreach ($arrUserData as $key => $value) {
                     if (!is_array($value) && \Validator::isBinaryUuid($value)) {
                         $value = \StringUtil::binToUuid($value);
                         $objFile = \FilesModel::findByUuid($value);
                         if ($objFile !== null) {
                             $value = $objFile->path;
                         }
                     }
                     $arrTokens['user_' . $key] = $value;
                 }
             }
         }
     }
 }
开发者ID:heimrichhannot,项目名称:contao-notification_center_plus,代码行数:67,代码来源:NotificationCenterPlus.php

示例14: testCall

 public function testCall()
 {
     $this->assertSame(\Controller::replaceInsertTags('foobar'), 'foobar');
     $this->assertSame(\Controller::generateFrontendUrl('foobar'), 'foobar');
 }
开发者ID:codefog,项目名称:contao-haste,代码行数:5,代码来源:HasteTest.php

示例15: replaceInsertTags

 /**
  * These functions need to be public for Models to access them
  */
 public function replaceInsertTags($strBuffer, $blnCache = false)
 {
     return parent::replaceInsertTags($strBuffer, $blnCache);
 }
开发者ID:rikaix,项目名称:core-1,代码行数:7,代码来源:Isotope.php


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