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


PHP String::decodeEntities方法代码示例

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


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

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->Template->src = $this->singleSRC;
     $this->Template->href = $this->source == 'external' ? $this->url : $this->singleSRC;
     $this->Template->alt = $this->altContent;
     $this->Template->var = 'swf' . $this->id;
     $this->Template->transparent = $this->transparent ? true : false;
     $this->Template->interactive = $this->interactive ? true : false;
     $this->Template->flashId = $this->flashID ?: 'swf_' . $this->id;
     $this->Template->fsCommand = '  ' . preg_replace('/[\\n\\r]/', "\n  ", \String::decodeEntities($this->flashJS));
     $this->Template->flashvars = 'URL=' . \Environment::get('base');
     $this->Template->version = $this->version ?: '6.0.0';
     $size = deserialize($this->size);
     $this->Template->width = $size[0];
     $this->Template->height = $size[1];
     $intMaxWidth = TL_MODE == 'BE' ? 320 : \Config::get('maxImageWidth');
     // Adjust movie size
     if ($intMaxWidth > 0 && $size[0] > $intMaxWidth) {
         $this->Template->width = $intMaxWidth;
         $this->Template->height = floor($intMaxWidth * $size[1] / $size[0]);
     }
     if (strlen($this->flashvars)) {
         $this->Template->flashvars .= '&' . \String::decodeEntities($this->flashvars);
     }
 }
开发者ID:juergen83,项目名称:contao,代码行数:28,代码来源:ModuleFlash.php

示例2: recursiveReplaceTokensAndTags

 /**
  * Recursively replace simple tokens and insert tags
  *
  * @param   string $strText
  * @param   array  $arrTokens Array of Tokens
  *
  * @return  string
  */
 public static function recursiveReplaceTokensAndTags($text, $tokens)
 {
     // Must decode, tokens could be encoded
     $text = \String::decodeEntities($text);
     // Replace all opening and closing tags with a hash so they don't get stripped
     // by parseSimpleTokens()
     $hash = md5($text);
     $openTagReplacement = 'LEADS-TAG-OPEN-' . $hash;
     $closeTagReplacement = 'LEADS-TAG-CLOSE-' . $hash;
     $original = array('<', '>');
     $replacement = array($openTagReplacement, $closeTagReplacement);
     $text = str_replace($original, $replacement, $text);
     // first parse the tokens as they might have if-else clauses
     $buffer = \String::parseSimpleTokens($text, $tokens);
     // Restore tags
     $buffer = str_replace($replacement, $original, $buffer);
     // Replace the Insert Tags
     $buffer = \Haste\Haste::getInstance()->call('replaceInsertTags', array($buffer, false));
     // Check if the Insert Tags have returned a Simple Token or an Insert Tag to parse
     if ((strpos($buffer, '##') !== false || strpos($buffer, '{{') !== false) && $buffer != $text) {
         $buffer = static::recursiveReplaceTokensAndTags($buffer, $tokens);
     }
     $buffer = \String::restoreBasicEntities($buffer);
     return $buffer;
 }
开发者ID:terminal42,项目名称:contao-leads,代码行数:33,代码来源:Tokens.php

示例3: 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);
     }
     // 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 = 'NC-TAG-OPEN-' . $strHash;
     $strTagCloseReplacement = 'NC-TAG-CLOSE-' . $strHash;
     $arrOriginal = array('<', '>');
     $arrReplacement = array($strTagOpenReplacement, $strTagCloseReplacement);
     $strText = str_replace($arrOriginal, $arrReplacement, $strText);
     // first parse the tokens as they might have if-else clauses
     $strBuffer = \String::parseSimpleTokens($strText, $arrTokens);
     $strBuffer = str_replace($arrReplacement, $arrOriginal, $strBuffer);
     // then replace the insert tags
     $strBuffer = \Haste\Haste::getInstance()->call('replaceInsertTags', array($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);
     }
     $strBuffer = \String::restoreBasicEntities($strBuffer);
     if ($intTextFlags > 0) {
         $strBuffer = static::convertToText($strBuffer, $intTextFlags);
     }
     return $strBuffer;
 }
开发者ID:Ainschy,项目名称:contao-notification_center,代码行数:38,代码来源:String.php

示例4: 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

示例5: parseWidget

 /**
  * This function is for the manipulation of the attribute value
  * Must return the value in the format what is needed for MetaModels
  *
  * @param $widget
  * @return mixed
  */
 public function parseWidget($widget)
 {
     if (is_a($widget, 'Contao\\FormTextArea') || is_a($widget, 'Contao\\FormTextField')) {
         if ($this->field->getEval('allowHtml')) {
             $value = strip_tags(\String::decodeEntities($widget->value), \Config::get('allowedTags'));
         } else {
             $value = strip_tags(\String::decodeEntities($widget->value));
         }
         if ($this->field->getEval('decodeEntities')) {
             return $value;
         } else {
             return specialchars($value);
         }
     }
     return $widget->value;
 }
开发者ID:hh-com,项目名称:contao-mm-frontendInput,代码行数:23,代码来源:SaveHandler.php

示例6: addToPDFSearchIndex

 protected static function addToPDFSearchIndex($strFile, $arrParentSet)
 {
     $objFile = new \File($strFile);
     if (!Validator::isValidPDF($objFile)) {
         return false;
     }
     $objDatabase = \Database::getInstance();
     $objModel = $objFile->getModel();
     $arrMeta = \Frontend::getMetaData($objModel->meta, $arrParentSet['language']);
     // Use the file name as title if none is given
     if ($arrMeta['title'] == '') {
         $arrMeta['title'] = specialchars($objFile->basename);
     }
     $arrSet = array('pid' => $arrParentSet['pid'], 'tstamp' => time(), 'title' => $arrMeta['title'], 'url' => $objFile->value, 'filesize' => \System::getReadableSize($objFile->size, 2), 'checksum' => $objFile->hash, 'protected' => $arrParentSet['protected'], 'groups' => $arrParentSet['groups'], 'language' => $arrParentSet['language'], 'mime' => $objFile->mime);
     // Return if the file is indexed and up to date
     $objIndex = $objDatabase->prepare("SELECT * FROM tl_search WHERE url=? AND checksum=?")->execute($arrSet['url'], $arrSet['checksum']);
     // there are already indexed files containing this file (same checksum and filename)
     if ($objIndex->numRows) {
         // Return if the page with the file is indexed
         if (in_array($arrSet['pid'], $objIndex->fetchEach('pid'))) {
             return false;
         }
         $strContent = $objIndex->text;
     } else {
         try {
             // parse only for the first occurrence
             $parser = new \Smalot\PdfParser\Parser();
             $objPDF = $parser->parseFile($strFile);
             $strContent = $objPDF->getText();
         } catch (\Exception $e) {
             // Missing object refernce #...
             return false;
         }
     }
     // Put everything together
     $arrSet['text'] = $strContent;
     $arrSet['text'] = trim(preg_replace('/ +/', ' ', \String::decodeEntities($arrSet['text'])));
     // Update an existing old entry
     if ($objIndex->pid == $arrSet['pid']) {
         $objDatabase->prepare("UPDATE tl_search %s WHERE id=?")->set($arrSet)->execute($objIndex->id);
         $intInsertId = $objIndex->id;
     } else {
         $objInsertStmt = $objDatabase->prepare("INSERT INTO tl_search %s")->set($arrSet)->execute();
         $intInsertId = $objInsertStmt->insertId;
     }
     static::indexContent($arrSet, $intInsertId);
 }
开发者ID:kistermann,项目名称:contao-search_plus,代码行数:47,代码来源:Search.php

示例7: 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

示例8: loadDynamicPaletteByParentTable

 public static function loadDynamicPaletteByParentTable($strAct, $strTable, &$dc)
 {
     switch ($strAct) {
         case 'create':
             $strParentTable = FieldPalette::getParentTableFromRequest();
             $strPalette = FieldPalette::getPaletteFromRequest();
             break;
         case 'cut':
         case 'edit':
         case 'show':
         case 'delete':
         case 'toggle':
             $id = strlen(\Input::get('id')) ? \Input::get('id') : CURRENT_ID;
             $objModel = \HeimrichHannot\FieldPalette\FieldPaletteModel::findByPk($id);
             if ($objModel === null) {
                 break;
             }
             $strParentTable = FieldPalette::getParentTable($objModel, $objModel->id);
             $strPalette = $objModel->pfield;
             // set back link from request
             if (\Input::get('popup') && \Input::get('popupReferer')) {
                 $arrSession = \Session::getInstance()->getData();
                 if (class_exists('\\Contao\\StringUtil')) {
                     $arrSession['popupReferer'][TL_REFERER_ID]['current'] = \StringUtil::decodeEntities(rawurldecode(\Input::get('popupReferer')));
                 } else {
                     $arrSession['popupReferer'][TL_REFERER_ID]['current'] = \String::decodeEntities(rawurldecode(\Input::get('popupReferer')));
                 }
                 \Session::getInstance()->setData($arrSession);
             }
             break;
     }
     if (!$strParentTable || !$strPalette) {
         return false;
     }
     if ($strTable !== $strParentTable) {
         \Controller::loadDataContainer($strParentTable);
     }
     static::registerFieldPalette($dc, $strParentTable, $strTable, $strPalette);
 }
开发者ID:heimrichhannot,项目名称:contao-fieldpalette,代码行数:39,代码来源:FieldPalette.php

示例9: get

 /**
  * Get a translation of a value using the translation tabel
  * @param   mixed
  * @param   boolean
  * @return  mixed
  */
 public static function get($varLabel, $strLanguage = null)
 {
     if (!\Database::getInstance()->tableExists(Label::getTable())) {
         return $varLabel;
     }
     if (null === $strLanguage) {
         $strLanguage = $GLOBALS['TL_LANGUAGE'];
     }
     // Recursively translate label array
     if (is_array($varLabel)) {
         foreach ($varLabel as $k => $v) {
             $varLabel[$k] = static::get($v, $strLanguage);
         }
         return $varLabel;
     }
     // Load labels
     static::initialize($strLanguage);
     if (isset(static::$arrLabels[$strLanguage][$varLabel])) {
         static::$arrLabels[$strLanguage][$varLabel] = \String::decodeEntities(static::$arrLabels[$strLanguage][$varLabel]);
         return static::$arrLabels[$strLanguage][$varLabel];
     }
     return $varLabel;
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:29,代码来源:Translation.php

示例10: addCommentsToTemplate


//.........这里部分代码省略.........
             // Reply
             if ($objComments->addReply && $objComments->reply != '') {
                 if (($objAuthor = $objComments->getRelated('author')) !== null) {
                     $objPartial->addReply = true;
                     $objPartial->rby = $GLOBALS['TL_LANG']['MSC']['reply_by'];
                     $objPartial->reply = $this->replaceInsertTags($objComments->reply);
                     $objPartial->author = $objAuthor;
                     // Clean the RTE output
                     if ($objPage->outputFormat == 'xhtml') {
                         $objPartial->reply = \String::toXhtml($objPartial->reply);
                     } else {
                         $objPartial->reply = \String::toHtml5($objPartial->reply);
                     }
                 }
             }
             $arrComments[] = $objPartial->parse();
             ++$count;
         }
     }
     $objTemplate->comments = $arrComments;
     $objTemplate->addComment = $GLOBALS['TL_LANG']['MSC']['addComment'];
     $objTemplate->name = $GLOBALS['TL_LANG']['MSC']['com_name'];
     $objTemplate->email = $GLOBALS['TL_LANG']['MSC']['com_email'];
     $objTemplate->website = $GLOBALS['TL_LANG']['MSC']['com_website'];
     $objTemplate->commentsTotal = $limit ? $gtotal : $total;
     // Get the front end user object
     $this->import('FrontendUser', 'User');
     // Access control
     if ($objConfig->requireLogin && !BE_USER_LOGGED_IN && !FE_USER_LOGGED_IN) {
         $objTemplate->requireLogin = true;
         return;
     }
     // Form fields
     $arrFields = array('name' => array('name' => 'name', 'label' => $GLOBALS['TL_LANG']['MSC']['com_name'], 'value' => trim($this->User->firstname . ' ' . $this->User->lastname), 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 64)), 'email' => array('name' => 'email', 'label' => $GLOBALS['TL_LANG']['MSC']['com_email'], 'value' => $this->User->email, 'inputType' => 'text', 'eval' => array('rgxp' => 'email', 'mandatory' => true, 'maxlength' => 128, 'decodeEntities' => true)), 'website' => array('name' => 'website', 'label' => $GLOBALS['TL_LANG']['MSC']['com_website'], 'inputType' => 'text', 'eval' => array('rgxp' => 'url', 'maxlength' => 128, 'decodeEntities' => true)));
     // Captcha
     if (!$objConfig->disableCaptcha) {
         $arrFields['captcha'] = array('name' => 'captcha', 'inputType' => 'captcha', 'eval' => array('mandatory' => true));
     }
     // Comment field
     $arrFields['comment'] = array('name' => 'comment', 'label' => $GLOBALS['TL_LANG']['MSC']['com_comment'], 'inputType' => 'textarea', 'eval' => array('mandatory' => true, 'rows' => 4, 'cols' => 40, 'preserveTags' => true));
     $doNotSubmit = false;
     $arrWidgets = array();
     $strFormId = 'com_' . $strSource . '_' . $intParent;
     // Initialize widgets
     foreach ($arrFields as $arrField) {
         $strClass = $GLOBALS['TL_FFL'][$arrField['inputType']];
         // Continue if the class is not defined
         if (!$this->classFileExists($strClass)) {
             continue;
         }
         $arrField['eval']['required'] = $arrField['eval']['mandatory'];
         $objWidget = new $strClass($this->prepareForWidget($arrField, $arrField['name'], $arrField['value']));
         // Validate the widget
         if (\Input::post('FORM_SUBMIT') == $strFormId) {
             $objWidget->validate();
             if ($objWidget->hasErrors()) {
                 $doNotSubmit = true;
             }
         }
         $arrWidgets[$arrField['name']] = $objWidget;
     }
     $objTemplate->fields = $arrWidgets;
     $objTemplate->submit = $GLOBALS['TL_LANG']['MSC']['com_submit'];
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->messages = '';
     // Backwards compatibility
开发者ID:rikaix,项目名称:core,代码行数:67,代码来源:Comments.php

示例11: export


//.........这里部分代码省略.........
                 $aux[] = $row['pid'];
             }
             array_multisort($aux, SORT_ASC, $result);
         }
         // Process result and format values
         foreach ($result as $row) {
             $intRowCounter++;
             $args = array();
             $this->current[] = $row['id'];
             if ($intRowCounter == 0) {
                 if ($strMode == 'xls') {
                     if (!$blnCustomXlsExport) {
                         $xls->totalcol = count($showFields);
                     }
                 }
                 $strExpEncl = '"';
                 $strExpSep = '';
                 $intColCounter = -1;
                 foreach ($showFields as $k => $v) {
                     if (in_array($v, $ignoreFields)) {
                         continue;
                     }
                     $intColCounter++;
                     if ($useFieldNames) {
                         $strName = $v;
                     } elseif (strlen($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['label'][0])) {
                         $strName = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['label'][0];
                     } elseif (strlen($GLOBALS['TL_LANG']['tl_formdata'][$v][0])) {
                         $strName = $GLOBALS['TL_LANG']['tl_formdata'][$v][0];
                     } else {
                         $strName = strtoupper($v);
                     }
                     if (strlen($strName)) {
                         $strName = \String::decodeEntities($strName);
                     }
                     if ($this->blnExportUTF8Decode || $strMode == 'xls' && !$blnCustomXlsExport) {
                         $strName = $this->convertEncoding($strName, $GLOBALS['TL_CONFIG']['characterSet'], $this->strExportConvertToCharset);
                     }
                     if ($strMode == 'csv') {
                         $strName = str_replace('"', '""', $strName);
                         echo $strExpSep . $strExpEncl . $strName . $strExpEncl;
                         $strExpSep = ";";
                     } elseif ($strMode == 'xls') {
                         if (!$blnCustomXlsExport) {
                             $xls->setcell(array("sheetname" => $strXlsSheet, "row" => $intRowCounter, "col" => $intColCounter, "data" => $strName, "fontweight" => XLSFONT_BOLD, "vallign" => XLSXF_VALLIGN_TOP, "fontfamily" => XLSFONT_FAMILY_NORMAL));
                             $xls->setcolwidth($strXlsSheet, $intColCounter, 0x1aff);
                         } else {
                             $arrHookDataColumns[$v] = $strName;
                         }
                     } elseif ($blnCustomExport) {
                         $arrHookDataColumns[$v] = $strName;
                     }
                 }
                 $intRowCounter++;
                 if ($strMode == 'csv') {
                     echo "\n";
                 }
             }
             $strExpSep = '';
             $intColCounter = -1;
             // Prepare field value
             foreach ($showFields as $k => $v) {
                 if (in_array($v, $ignoreFields)) {
                     continue;
                 }
                 $intColCounter++;
开发者ID:byteworks-ch,项目名称:contao-efg,代码行数:67,代码来源:DC_Formdata.php

示例12: __set

 /**
  * Set an object property
  *
  * @param string $strKey   The property name
  * @param mixed  $varValue The property value
  *
  * @throws \Exception If $strKey is unknown
  */
 public function __set($strKey, $varValue)
 {
     switch ($strKey) {
         case 'subject':
             $this->strSubject = preg_replace(array('/[\\t]+/', '/[\\n\\r]+/'), array(' ', ''), $varValue);
             break;
         case 'text':
             $this->strText = \String::decodeEntities($varValue);
             break;
         case 'html':
             $this->strHtml = $varValue;
             break;
         case 'from':
             $this->strSender = $varValue;
             break;
         case 'fromName':
             $this->strSenderName = $varValue;
             break;
         case 'priority':
             switch ($varValue) {
                 case 1:
                 case 'highest':
                     $this->intPriority = 1;
                     break;
                 case 2:
                 case 'high':
                     $this->intPriority = 2;
                     break;
                 case 3:
                 case 'normal':
                     $this->intPriority = 3;
                     break;
                 case 4:
                 case 'low':
                     $this->intPriority = 4;
                     break;
                 case 5:
                 case 'lowest':
                     $this->intPriority = 5;
                     break;
             }
             break;
         case 'charset':
             $this->strCharset = $varValue;
             break;
         case 'imageDir':
             $this->strImageDir = $varValue;
             break;
         case 'embedImages':
             $this->blnEmbedImages = $varValue;
             break;
         case 'logFile':
             $this->strLogFile = $varValue;
             break;
         default:
             throw new \Exception(sprintf('Invalid argument "%s"', $strKey));
             break;
     }
 }
开发者ID:juergen83,项目名称:contao,代码行数:67,代码来源:Email.php

示例13: compileDefinition

 /**
  * Compile format definitions and return them as string
  *
  * @param array   $row
  * @param boolean $blnWriteToFile
  * @param array   $vars
  * @param array   $parent
  * @param boolean $export
  *
  * @return string
  */
 public function compileDefinition($row, $blnWriteToFile = false, $vars = array(), $parent = array(), $export = false)
 {
     if ($blnWriteToFile) {
         $strGlue = '../../';
         $lb = '';
         $return = '';
     } elseif ($export) {
         $strGlue = '';
         $lb = "\n    ";
         $return = '';
     } else {
         $strGlue = '';
         $lb = "\n    ";
         $return = "\n" . '<pre' . ($row['invisible'] ? ' class="disabled"' : '') . '>';
     }
     $blnNeedsPie = false;
     // Comment
     if ((!$blnWriteToFile || $export) && $row['comment'] != '') {
         $search = array('@^\\s*/\\*+@', '@\\*+/\\s*$@');
         $comment = preg_replace($search, '', $row['comment']);
         if ($export) {
             $return .= "\n/* " . $comment . " */\n";
         } else {
             $comment = wordwrap(trim($comment), 72);
             $return .= "\n" . '<span class="comment">' . $comment . '</span>' . "\n";
         }
     }
     // Selector
     $arrSelector = trimsplit(',', \String::decodeEntities($row['selector']));
     $return .= implode($blnWriteToFile ? ',' : ",\n", $arrSelector) . ($blnWriteToFile ? '' : ' ') . '{';
     // Size
     if ($row['size']) {
         // Width
         $row['width'] = deserialize($row['width']);
         if (isset($row['width']['value']) && $row['width']['value'] != '') {
             $return .= $lb . 'width:' . $row['width']['value'] . ($row['width']['value'] == 'auto' ? '' : $row['width']['unit']) . ';';
         }
         // Height
         $row['height'] = deserialize($row['height']);
         if (isset($row['height']['value']) && $row['height']['value'] != '') {
             $return .= $lb . 'height:' . $row['height']['value'] . ($row['height']['value'] == 'auto' ? '' : $row['height']['unit']) . ';';
         }
         // Min-width
         $row['minwidth'] = deserialize($row['minwidth']);
         if (isset($row['minwidth']['value']) && $row['minwidth']['value'] != '') {
             $return .= $lb . 'min-width:' . $row['minwidth']['value'] . ($row['minwidth']['value'] == 'inherit' ? '' : $row['minwidth']['unit']) . ';';
         }
         // Min-height
         $row['minheight'] = deserialize($row['minheight']);
         if (isset($row['minheight']['value']) && $row['minheight']['value'] != '') {
             $return .= $lb . 'min-height:' . $row['minheight']['value'] . ($row['minheight']['value'] == 'inherit' ? '' : $row['minheight']['unit']) . ';';
         }
         // Max-width
         $row['maxwidth'] = deserialize($row['maxwidth']);
         if (isset($row['maxwidth']['value']) && $row['maxwidth']['value'] != '') {
             $return .= $lb . 'max-width:' . $row['maxwidth']['value'] . ($row['maxwidth']['value'] == 'inherit' || $row['maxwidth']['value'] == 'none' ? '' : $row['maxwidth']['unit']) . ';';
         }
         // Max-height
         $row['maxheight'] = deserialize($row['maxheight']);
         if (isset($row['maxheight']['value']) && $row['maxheight']['value'] != '') {
             $return .= $lb . 'max-height:' . $row['maxheight']['value'] . ($row['maxheight']['value'] == 'inherit' || $row['maxheight']['value'] == 'none' ? '' : $row['maxheight']['unit']) . ';';
         }
     }
     // Position
     if ($row['positioning']) {
         // Top/right/bottom/left
         $row['trbl'] = deserialize($row['trbl']);
         if (is_array($row['trbl'])) {
             foreach ($row['trbl'] as $k => $v) {
                 if ($v != '' && $k != 'unit') {
                     $return .= $lb . $k . ':' . $v . ($v == 'auto' || $v === '0' ? '' : $row['trbl']['unit']) . ';';
                 }
             }
         }
         // Position
         if ($row['position'] != '') {
             $return .= $lb . 'position:' . $row['position'] . ';';
         }
         // Overflow
         if ($row['overflow'] != '') {
             $return .= $lb . 'overflow:' . $row['overflow'] . ';';
         }
         // Float
         if ($row['floating'] != '') {
             $return .= $lb . 'float:' . $row['floating'] . ';';
         }
         // Clear
         if ($row['clear'] != '') {
             $return .= $lb . 'clear:' . $row['clear'] . ';';
//.........这里部分代码省略.........
开发者ID:juergen83,项目名称:contao,代码行数:101,代码来源:StyleSheets.php

示例14: searchFor

 /**
  * Search the index and return the result object
  *
  * @param string  $strKeywords The keyword string
  * @param boolean $blnOrSearch If true, the result can contain any keyword
  * @param array   $arrPid      An optional array of page IDs to limit the result to
  * @param integer $intRows     An optional maximum number of result rows
  * @param integer $intOffset   An optional result offset
  * @param boolean $blnFuzzy    If true, the search will be fuzzy
  *
  * @return \Database\Result The database result object
  *
  * @throws \Exception If the cleaned keyword string is empty
  */
 public static function searchFor($strKeywords, $blnOrSearch = false, $arrPid = array(), $intRows = 0, $intOffset = 0, $blnFuzzy = false)
 {
     // Clean the keywords
     $strKeywords = utf8_strtolower($strKeywords);
     $strKeywords = \String::decodeEntities($strKeywords);
     if (function_exists('mb_eregi_replace')) {
         $strKeywords = mb_eregi_replace('[^[:alnum:] \\*\\+\'"\\.:,_-]|\\. |\\.$|: |:$|, |,$', ' ', $strKeywords);
     } else {
         $strKeywords = preg_replace(array('/\\. /', '/\\.$/', '/: /', '/:$/', '/, /', '/,$/', '/[^\\pN\\pL \\*\\+\'"\\.:,_-]/u'), ' ', $strKeywords);
     }
     // Check keyword string
     if (!strlen($strKeywords)) {
         throw new \Exception('Empty keyword string');
     }
     // Split keywords
     $arrChunks = array();
     preg_match_all('/"[^"]+"|[\\+\\-]?[^ ]+\\*?/', $strKeywords, $arrChunks);
     $arrPhrases = array();
     $arrKeywords = array();
     $arrWildcards = array();
     $arrIncluded = array();
     $arrExcluded = array();
     foreach ($arrChunks[0] as $strKeyword) {
         if (substr($strKeyword, -1) == '*' && strlen($strKeyword) > 1) {
             $arrWildcards[] = str_replace('*', '%', $strKeyword);
             continue;
         }
         switch (substr($strKeyword, 0, 1)) {
             // Phrases
             case '"':
                 if (($strKeyword = trim(substr($strKeyword, 1, -1))) != false) {
                     $arrPhrases[] = '[[:<:]]' . str_replace(array(' ', '*'), array('[^[:alnum:]]+', ''), $strKeyword) . '[[:>:]]';
                 }
                 break;
                 // Included keywords
             // Included keywords
             case '+':
                 if (($strKeyword = trim(substr($strKeyword, 1))) != false) {
                     $arrIncluded[] = $strKeyword;
                 }
                 break;
                 // Excluded keywords
             // Excluded keywords
             case '-':
                 if (($strKeyword = trim(substr($strKeyword, 1))) != false) {
                     $arrExcluded[] = $strKeyword;
                 }
                 break;
                 // Wildcards
             // Wildcards
             case '*':
                 if (strlen($strKeyword) > 1) {
                     $arrWildcards[] = str_replace('*', '%', $strKeyword);
                 }
                 break;
                 // Normal keywords
             // Normal keywords
             default:
                 $arrKeywords[] = $strKeyword;
                 break;
         }
     }
     // Fuzzy search
     if ($blnFuzzy) {
         foreach ($arrKeywords as $strKeyword) {
             $arrWildcards[] = '%' . $strKeyword . '%';
         }
         $arrKeywords = array();
     }
     // Count keywords
     $intPhrases = count($arrPhrases);
     $intWildcards = count($arrWildcards);
     $intIncluded = count($arrIncluded);
     $intExcluded = count($arrExcluded);
     $intKeywords = 0;
     $arrValues = array();
     // Remember found words so we can highlight them later
     $strQuery = "SELECT tl_search_index.pid AS sid, GROUP_CONCAT(word) AS matches";
     // Get the number of wildcard matches
     if (!$blnOrSearch && $intWildcards) {
         $strQuery .= ", (SELECT COUNT(*) FROM tl_search_index WHERE (" . implode(' OR ', array_fill(0, $intWildcards, 'word LIKE ?')) . ") AND pid=sid) AS wildcards";
         $arrValues = array_merge($arrValues, $arrWildcards);
     }
     // Count the number of matches
     $strQuery .= ", COUNT(*) AS count";
     // Get the relevance
//.........这里部分代码省略.........
开发者ID:juergen83,项目名称:contao,代码行数:101,代码来源:Search.php

示例15: processSubmittedData


//.........这里部分代码省略.........
             $arrRecipient = $varRecipient;
         } else {
             $arrRecipient = trimsplit(',', $varRecipient);
         }
         if (!empty($arrForm['confirmationMailRecipient'])) {
             $varRecipient = $arrForm['confirmationMailRecipient'];
             $arrRecipient = array_merge($arrRecipient, trimsplit(',', $varRecipient));
         }
         $arrRecipient = array_filter(array_unique($arrRecipient));
         if (!empty($arrRecipient)) {
             foreach ($arrRecipient as $kR => $recipient) {
                 list($recipientName, $recipient) = \String::splitFriendlyEmail($this->replaceInsertTags($recipient, false));
                 $arrRecipient[$kR] = strlen($recipientName) ? $recipientName . ' <' . $recipient . '>' : $recipient;
             }
         }
         $objMailProperties->recipients = $arrRecipient;
         // Check if we want custom attachments... (Thanks to Torben Schwellnus)
         if ($arrForm['addConfirmationMailAttachments']) {
             if ($arrForm['confirmationMailAttachments']) {
                 $arrCustomAttachments = deserialize($arrForm['confirmationMailAttachments'], true);
                 if (!empty($arrCustomAttachments)) {
                     foreach ($arrCustomAttachments as $varFile) {
                         $objFileModel = \FilesModel::findById($varFile);
                         if ($objFileModel !== null) {
                             $objFile = new \File($objFileModel->path);
                             if ($objFile->size) {
                                 $objMailProperties->attachments[TL_ROOT . '/' . $objFile->path] = array('file' => TL_ROOT . '/' . $objFile->path, 'name' => $objFile->basename, 'mime' => $objFile->mime);
                             }
                         }
                     }
                 }
             }
         }
         $objMailProperties->subject = \String::decodeEntities($arrForm['confirmationMailSubject']);
         $objMailProperties->messageText = \String::decodeEntities($arrForm['confirmationMailText']);
         $objMailProperties->messageHtmlTmpl = $arrForm['confirmationMailTemplate'];
         // Replace Insert tags and conditional tags
         $objMailProperties = $this->Formdata->prepareMailData($objMailProperties, $arrSubmitted, $arrFiles, $arrForm, $arrFormFields);
         // Send Mail
         $blnConfirmationSent = false;
         if (!empty($objMailProperties->recipients)) {
             $objMail = new \Email();
             $objMail->from = $objMailProperties->sender;
             if (!empty($objMailProperties->senderName)) {
                 $objMail->fromName = $objMailProperties->senderName;
             }
             if (!empty($objMailProperties->replyTo)) {
                 $objMail->replyTo($objMailProperties->replyTo);
             }
             $objMail->subject = $objMailProperties->subject;
             if (!empty($objMailProperties->attachments)) {
                 foreach ($objMailProperties->attachments as $strFile => $varParams) {
                     $strContent = file_get_contents($varParams['file'], false);
                     $objMail->attachFileFromString($strContent, $varParams['name'], $varParams['mime']);
                 }
             }
             if (!empty($objMailProperties->messageText)) {
                 $objMail->text = $objMailProperties->messageText;
             }
             if (!empty($objMailProperties->messageHtml)) {
                 $objMail->html = $objMailProperties->messageHtml;
             }
             foreach ($objMailProperties->recipients as $recipient) {
                 $objMail->sendTo($recipient);
                 $blnConfirmationSent = true;
             }
开发者ID:Jobu,项目名称:core,代码行数:67,代码来源:FormdataProcessor.php


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