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


PHP sensitiveIO::reencodeAmpersand方法代码示例

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


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

示例1: array

         $parameters = array();
         $parameters['itemID'] = $itemId;
         $parameters['module'] = $codename;
         $cms_page = CMS_session::getPage();
         if (is_object($cms_page) && !$cms_page->hasError()) {
             $parameters['pageID'] = $cms_page->getID();
         }
         $parameters['selection'] = io::decodeEntities($selectedContent);
         $parameters['public'] = false;
         $parameters['plugin-view'] = true;
         $definitionParsing = new CMS_polymod_definition_parsing($definition, true, CMS_polymod_definition_parsing::PARSE_MODE);
         $codeTopaste = $definitionParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_RESULT, $parameters);
         //add some attributes to images to prevent resizing into editor
         $codeTopaste = str_replace('<img ', '<img contenteditable="false" unselectable="on" ', $codeTopaste);
         //encode all ampersand without reencode already encoded ampersand
         $codeTopaste = sensitiveIO::reencodeAmpersand($codeTopaste);
         if ($codeTopaste) {
             //add identification span tag arround code to paste
             $codeTopaste = '<span id="polymod-' . $pluginId . '-' . $itemId . '" class="polymod" title="' . io::htmlspecialchars($selectedPlugin->getLabel($cms_language) . ' : ' . trim($item->getLabel($cms_language))) . '">' . $codeTopaste . '</span>';
         }
         $content = $codeTopaste;
     } elseif (sensitiveIO::isPositiveInteger($itemId) && $selectedPlugin->needSelection()) {
         $codeTopaste = '<span id="polymod-' . $pluginId . '-' . $itemId . '" class="polymod">' . $selectedContent . '</span>';
         $content = $codeTopaste;
     } else {
         $selectedContent = $selectedContent ? $selectedContent : ' ';
         $content = $selectedContent;
     }
     break;
 case 'setRowParameters':
     $tpl = sensitiveIO::request('template', 'sensitiveIO::isPositiveInteger');
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:items-controler.php

示例2: treatWantedTag


//.........这里部分代码省略.........
                         //set parsing parameters
                         $parameters = array();
                         $parameters['itemID'] = $selectedItem;
                         $parameters['pageID'] = $treatedObject->getID();
                         $parameters['public'] = $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC || $visualizationMode == PAGE_VISUALMODE_PRINT || $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE ? true : false;
                         //get originaly selected text
                         if (!$selectedPlugin->needSelection()) {
                             $parameters['selection'] = '';
                         } else {
                             $hasSelection = preg_match('#<!--(.*)-->#s', $tag->getInnerContent(), $matches);
                             $parameters['selection'] = io::decodeEntities($hasSelection ? $matches[1] : $tag->getInnerContent());
                             //$parameters['selection'] = io::decodeEntities($tag->getInnerContent());
                         }
                         $tagContent = '<?php $parameters = ' . var_export($parameters, true) . ';' . "\n" . io::substr($definition, 5);
                         //save in global var the page ID who need this module so we can add the header code later.
                         CMS_module::moduleUsage($treatedObject->getID(), $this->_codename, array('block' => true));
                         //Cache management
                         if ($parameters['public']) {
                             //create definition hash
                             $cacheHash = md5(serialize(array('definition' => $tagContent, 'parameters' => $parameters)));
                             $tagContent = CMS_cache::wrapCode($cacheHash, $tagContent);
                         }
                     }
                     return $tagContent;
                     break;
             }
             break;
         case MODULE_TREATMENT_PAGEHEADER_TAGS:
             $content = parent::treatWantedTag($tag, $tagContent, $treatmentMode, $visualizationMode, $treatedObject, $treatmentParameters);
             if ($treatedObject instanceof CMS_page && $tag->getName() === "atm-meta-tags") {
                 $oembed = CMS_polymod_oembed_definition_catalog::getByCodename($treatedObject->getCodename());
                 if ($oembed && CMS_poly_object_catalog::getModuleCodenameForObjectType($oembed->getObjectdefinition()) === $this->_codename) {
                     $content .= '<?php ' . "\n" . 'echo CMS_polymod_oembed_definition::getDiscoveryEndpoint(); ?>';
                 }
             }
             return $content;
             break;
         case MODULE_TREATMENT_WYSIWYG_INNER_TAGS:
             switch ($tag->getName()) {
                 case "span":
                     global $cms_language;
                     $ids = explode('-', $tag->getAttribute('id'));
                     $selectedPluginID = (int) $ids[1];
                     $selectedItem = (int) $ids[2];
                     //then create the code to paste for the current selected object if any
                     if (sensitiveIO::isPositiveInteger($selectedItem) && sensitiveIO::isPositiveInteger($selectedPluginID)) {
                         //get plugin
                         $selectedPlugin = new CMS_poly_plugin_definitions($selectedPluginID);
                         //get selected item
                         $item = CMS_poly_object_catalog::getObjectByID($selectedItem, false, $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC || $visualizationMode == PAGE_VISUALMODE_PRINT || $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE ? true : false);
                         if ($item && !$item->hasError()) {
                             //get originaly selected text if any
                             $selectedText = '';
                             if ($selectedPlugin->needSelection()) {
                                 $hasSelection = preg_match('#<!--(.*)-->#s', $tag->getInnerContent(), $matches);
                                 $selectedText = $hasSelection ? $matches[1] : $tag->getInnerContent();
                                 $tagContent = '<span id="polymod-' . $selectedPluginID . '-' . $selectedItem . '" class="polymod" title="' . io::htmlspecialchars($selectedPlugin->getLabel($cms_language) . ' : ' . trim($item->getLabel($cms_language))) . '">' . $selectedText . '</span>';
                             } else {
                                 $tagContent = '<span id="polymod-' . $selectedPluginID . '-' . $selectedItem . '" class="polymod" title="' . io::htmlspecialchars($selectedPlugin->getLabel($cms_language) . ' : ' . trim($item->getLabel($cms_language))) . '">' . CMS_poly_definition_functions::pluginCode($selectedPluginID, $selectedItem, '', $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC || $visualizationMode == PAGE_VISUALMODE_PRINT || $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE ? true : false, true) . '</span>';
                             }
                         } else {
                             $tagContent = '';
                         }
                     }
                     //strip cache comment
                     $tagContent = preg_replace('#<!--{cache:(.*)}-->#Us', '', $tagContent);
                     //encode all ampersand without reencode already encoded ampersand
                     $tagContent = sensitiveIO::reencodeAmpersand($tagContent);
                     return $tagContent;
                     break;
             }
             return $tagContent;
             break;
         case MODULE_TREATMENT_WYSIWYG_OUTER_TAGS:
             switch ($tag->getName()) {
                 case "span":
                     $ids = explode('-', $tag->getAttribute('id'));
                     $selectedPluginID = (int) $ids[1];
                     $selectedItem = (int) $ids[2];
                     //then create the code to paste for the current selected object if any
                     if (sensitiveIO::isPositiveInteger($selectedItem) && sensitiveIO::isPositiveInteger($selectedPluginID)) {
                         //get plugin
                         $selectedPlugin = new CMS_poly_plugin_definitions($selectedPluginID);
                         //get originaly selected text if any
                         $selectedText = $commentSelectedText = '';
                         if ($selectedPlugin->needSelection()) {
                             $hasSelection = preg_match('#<!--(.*)-->#s', $tag->getInnerContent(), $matches);
                             $selectedText = $hasSelection ? $matches[1] : $tag->getInnerContent();
                             $commentSelectedText = '<!--' . ($hasSelection ? $matches[1] : $tag->getInnerContent()) . '-->';
                         }
                         $tagContent = '<span id="polymod-' . $selectedPluginID . '-' . $selectedItem . '" class="polymod">' . "\n" . '<?php echo CMS_poly_definition_functions::pluginCode(\'' . $selectedPluginID . '\', \'' . $selectedItem . '\', ' . var_export($selectedText, true) . ', true); ?>' . "\n" . $commentSelectedText . '</span>';
                     }
                     return $tagContent;
                     break;
             }
             return $tagContent;
             break;
     }
     return $tag->getContent();
 }
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:polymod.php


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