本文整理汇总了PHP中sensitiveIO::evalPHPCode方法的典型用法代码示例。如果您正苦于以下问题:PHP sensitiveIO::evalPHPCode方法的具体用法?PHP sensitiveIO::evalPHPCode怎么用?PHP sensitiveIO::evalPHPCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sensitiveIO
的用法示例。
在下文中一共展示了sensitiveIO::evalPHPCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
/**
* Get the page content for the specified visualization mode and language.
*
* @return string The content of the page.
* @access public
*/
function getContent(&$language, $visualizationMode = false)
{
if (!$language instanceof CMS_language || !SensitiveIO::isInSet($visualizationMode, CMS_page::getAllVisualizationModes())) {
$this->raiseError("Language must be a valid language and visualization mode in the set of possibles");
return false;
}
$this->_checkTemplate();
if ($this->_template) {
//get parsed content definition from template (including CS block contents)
$definition = $this->_template->getContent($language, $this, $visualizationMode);
//instanciate modules treatments for page content tags
$modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_PAGECONTENT_TAGS, $visualizationMode, $this);
$modulesTreatment->setTreatmentParameters(array("language" => $language));
$modulesTreatment->setDefinition($definition);
$content = $modulesTreatment->treatContent(true);
//instanciate modules treatments for page header tags
$modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_PAGEHEADER_TAGS, $visualizationMode, $this);
$modulesTreatment->setTreatmentParameters(array("language" => $language, 'replaceVars' => true));
$modulesTreatment->setDefinition($content);
$content = $modulesTreatment->treatContent(true);
/*if ($visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE) {
//eval() the PHP code
$content = sensitiveIO::evalPHPCode($content);
return $content;
}*/
//include modules header codes on top of output file
$modulesCodes = new CMS_modulesCodes();
$headerInclude = $modulesCodes->getModulesCodes(MODULE_TREATMENT_PAGECONTENT_HEADER_CODE, $visualizationMode, $this);
if (is_array($headerInclude) && $headerInclude) {
$content = implode("\n", $headerInclude) . $content;
}
//include modules footers codes on bottom of output file
$footerInclude = $modulesCodes->getModulesCodes(MODULE_TREATMENT_PAGECONTENT_FOOTER_CODE, $visualizationMode, $this);
if (is_array($footerInclude) && $footerInclude) {
$content .= implode("\n", $footerInclude);
}
//replace {{pageID}} tag in all page content.
$content = str_replace('{{pageID}}', $this->getID(), $content);
if ($visualizationMode != PAGE_VISUALMODE_HTML_PUBLIC && $visualizationMode != PAGE_VISUALMODE_PRINT) {
//eval() the PHP code
$content = sensitiveIO::evalPHPCode($content);
}
return $content;
} else {
return false;
}
}
示例2: ob_start
$view->setContent($datas);
$edited = true;
} else {
CMS_grandFather::raiseError('Can\'t get row type ' . $rowId . ' from clientspace ' . $cs . ' of page ' . $cms_page->getID() . ' with row id ' . $rowTag);
$view->setActionMessage($cms_language->getJsMessage(MESSAGE_PAGE_ERROR_UPDATE_BLOCK_CONTENT));
}
} else {
CMS_grandFather::raiseError('Can\'t get block class type ' . $blockClass . ' to update content');
$view->setActionMessage($cms_language->getJsMessage(MESSAGE_PAGE_ERROR_UPDATE_BLOCK_CONTENT));
}
break;
default:
CMS_grandFather::raiseError('Unknown action ' . $action . ' to do for page ' . $currentPage);
$view->show();
break;
}
//set user message if any
if (isset($cms_message) && $cms_message) {
$view->setActionMessage($cms_message);
}
//Eval PHP content if any
$content = $view->getContent();
if (io::strpos($content, '<?php') !== false) {
ob_start();
$content = sensitiveIO::evalPHPCode($content);
$return = ob_get_clean();
$content = $return . $content;
//set datas as returned content
$view->setContent($content);
}
$view->show();
示例3: scriptTask
/**
* Module script task
* @param array $parameters the task parameters
* task : string task to execute
* object : string module codename for the task
* field : string module uid
* ... : optional field relative parameters
* @return Boolean true/false
* @access public
*/
function scriptTask($parameters)
{
switch ($parameters['task']) {
case 'emailNotification':
@set_time_limit(300);
$module = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
//create a new script for all recipients
$allUsers = $this->_getRecipients($parameters['object']);
foreach ($allUsers as $userId) {
//add script to send email for user if needed
CMS_scriptsManager::addScript($module, array('task' => 'emailSend', 'user' => $userId, 'field' => $parameters['field'], 'object' => $parameters['object']));
}
//then set sending date to current date
$sendingDate = new CMS_date();
$sendingDate->setNow();
$this->_subfieldValues[1]->setValue($sendingDate->getDBValue());
$this->writeToPersistence();
break;
case 'emailSend':
@set_time_limit(300);
$params = $this->getParamsValues();
if (!sensitiveIO::isPositiveInteger($parameters['user'])) {
return false;
}
//instanciate script related item
$item = CMS_poly_object_catalog::getObjectByID($parameters['object'], false, true);
if (!is_object($item) || $item->hasError()) {
return false;
}
//instanciate user
$cms_user = new CMS_profile_user($parameters['user']);
//check user
if (!$cms_user || $cms_user->hasError() || !$cms_user->isActive() || $cms_user->isDeleted() || !sensitiveIO::isValidEmail($cms_user->getEmail())) {
return false;
}
$cms_language = $cms_user->getLanguage();
//globalise cms_user and cms_language
$GLOBALS['cms_language'] = $cms_user->getLanguage();
$GLOBALS['cms_user'] = $cms_user;
//check user clearance on object
if (!$item->userHasClearance($cms_user, CLEARANCE_MODULE_VIEW)) {
return false;
}
//create email subject
$parameters['item'] = $item;
$parameters['public'] = true;
$polymodParsing = new CMS_polymod_definition_parsing($params['emailSubject'], false);
$subject = $polymodParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_RESULT, $parameters);
$body = '';
//create email body
if ($params['emailBody']['type'] == 1) {
//send body
$parameters['module'] = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
$polymodParsing = new CMS_polymod_definition_parsing($params['emailBody']['html'], true, CMS_polymod_definition_parsing::PARSE_MODE, $parameters['module']);
$body = $polymodParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_RESULT, $parameters);
} elseif ($params['emailBody']['type'] == 2) {
//send a page
$page = CMS_tree::getPageById($params['emailBody']['pageID']);
if (!$page || $page->hasError()) {
$this->raiseError('Page ID is not a valid page : ' . $params['emailBody']['pageID']);
return false;
}
$pageHTMLFile = new CMS_file($page->getHTMLURL(false, false, PATH_RELATIVETO_FILESYSTEM));
if (!$pageHTMLFile->exists()) {
$this->raiseError('Page HTML file does not exists : ' . $page->getHTMLURL(false, false, PATH_RELATIVETO_FILESYSTEM));
return false;
}
$body = $pageHTMLFile->readContent();
//create page URL call
$polymodParsing = new CMS_polymod_definition_parsing($params['emailBody']['pageURL'], false);
$pageURL = $polymodParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_RESULT, $parameters);
parse_str($pageURL, $GLOBALS['_REQUEST']);
//$GLOBALS['_REQUEST']
//parse and eval HTML page
$cms_page_included = true;
$GLOBALS['cms_page_included'] = $cms_page_included;
//eval() the PHP code
$body = sensitiveIO::evalPHPCode($body);
$website = $page->getWebsite();
$webroot = $website->getURL();
//replace URLs values
$replace = array('="/' => '="' . $webroot . '/', "='/" => "='" . $webroot . "/", "url(/" => "url(" . $webroot . "/");
$body = str_replace(array_keys($replace), $replace, $body);
} else {
$this->raiseError('No valid email type to send : ' . $params['emailBody']['type']);
return false;
}
if (isset($sendmail)) {
//$body .= print_r($sendmail,true);
}
//.........这里部分代码省略.........