本文整理汇总了PHP中io::evalPHPCode方法的典型用法代码示例。如果您正苦于以下问题:PHP io::evalPHPCode方法的具体用法?PHP io::evalPHPCode怎么用?PHP io::evalPHPCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io
的用法示例。
在下文中一共展示了io::evalPHPCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _evalPHPContent
protected function _evalPHPContent($content)
{
//eval() the PHP code
if ($content != '' && !function_exists((string) $content)) {
//first, try to get all items ids to search
$count = preg_match_all("#(<\\?php|<\\?).*'([0-9]*?)', '([0-9]*?)',.*\\?>#Usi", $content, $matches);
//if more than one item is found in text, it is faster to search them by one search
if ($count > 1) {
$ids = $GLOBALS['polymod']['preparedItems'] = array();
//then sort all items ids by plugin ID
foreach ($matches[2] as $key => $match) {
$ids[$match][] = $matches[3][$key];
}
//then search all items
foreach ($ids as $pluginID => $itemsIds) {
//get plugin
$plugin = new CMS_poly_plugin_definitions($pluginID);
if ($plugin && is_object($plugin) && !$plugin->hasError()) {
//then search all objects and put results in a global var usable in CMS_poly_definition_functions::pluginCode method (ugly i know)
$GLOBALS['polymod']['preparedItems'][$plugin->getValue('objectID')] = CMS_poly_object_catalog::getAllObjects($plugin->getValue('objectID'), $this->_public, array('items' => $itemsIds), true);
}
}
}
//then eval all php codes if any
if (strpos($content, '<?php') !== false) {
$content = io::evalPHPCode($content);
}
if (isset($GLOBALS['polymod']['preparedItems'])) {
unset($GLOBALS['polymod']['preparedItems']);
}
}
return $content;
}
示例2: parseInnerContent
/**
* Parse content which go to the WYSIWYG editor to handle all plugins tags
*
* @param string $text The inputed text of fckeditor
* @param string $module The module codename which made the request
* @return string the text with plugins tags adapted for fckeditor
* @access public
*/
function parseInnerContent($value, $module = MOD_STANDARD_CODENAME)
{
$modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_WYSIWYG_INNER_TAGS, RESOURCE_DATA_LOCATION_EDITION, $this);
$wantedTags = $modulesTreatment->getWantedTags();
//create regular expression on wanted tags
$exp = '';
foreach ($wantedTags as $aWantedTag) {
$exp .= $exp ? '|<' . $aWantedTag["tagName"] : '<' . $aWantedTag["tagName"];
}
//is parsing needed (value contain some of these wanted tags)
if ($value && is_array($wantedTags) && $wantedTags && preg_match('#(' . $exp . ')+#', $value) !== false) {
$modulesTreatment->setTreatmentParameters(array('module' => $module));
$modulesTreatment->setDefinition($value);
$value = $modulesTreatment->treatContent(true);
}
//eval PHP content if any
if (strpos($value, '<?php') !== false) {
$value = io::evalPHPCode($value);
}
return $value;
}
示例3: getNewsletterContent
public static function getNewsletterContent($pageId)
{
$page = CMS_tree::getPageByID($pageId);
if ($page->hasError()) {
return;
}
$website = $page->getWebsite();
$websiteUrl = $website->getURL();
$language = CMS_languagesCatalog::getByCode($page->getLanguage());
$content = $page->getContent($language, PAGE_VISUALMODE_HTML_PUBLIC);
$modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_LINXES_TAGS, PAGE_VISUALMODE_HTML_PUBLIC, $page);
$modulesTreatment->setDefinition($content);
$content = $modulesTreatment->treatContent(true);
//eval all php code in page
$php_evalued_content = io::evalPHPCode($content);
//change all relative URL in page
$parsed_content = self::prepareHTML($php_evalued_content, $websiteUrl);
return $parsed_content;
}