本文整理汇总了PHP中io::decodeEntities方法的典型用法代码示例。如果您正苦于以下问题:PHP io::decodeEntities方法的具体用法?PHP io::decodeEntities怎么用?PHP io::decodeEntities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io
的用法示例。
在下文中一共展示了io::decodeEntities方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
* initializes the linxCondition.
*
* @param string $property The page property we're gonna test. Only a set of these are available here.
* @param string $operator The comparison operator serving to test the condition.
* @param string $tagContent The tag content.
* @return void
* @access public
*/
function __construct($tag)
{
$authorized_properties = array("rank", "title", "id", "lvl", "father", "website", "codename");
$property = $tag->getAttribute('property');
$operator = $tag->getAttribute('operator');
if (SensitiveIO::isInSet($property, $authorized_properties)) {
$this->_pageProperty = $property;
$this->_operator = io::decodeEntities(io::decodeEntities(io::decodeEntities($operator)));
$values = $tag->getElementsByTagName('value');
if ($values->length > 0) {
$value = $values->item(0);
//if value type is "nodeproperty", we must parse the inner content to find a nodespec tag
if ($value->hasAttribute("type") && $value->getAttribute("type") == "nodeproperty") {
$this->_valueIsScalar = false;
$this->_valueNodespecProperty = $value->getAttribute("property");
$nodespecs = $value->getElementsByTagName('nodespec');
if ($nodespecs->length > 0) {
$nodespec = $nodespecs->item(0);
$this->_valueNodespec = CMS_linxNodespec::createNodespec($nodespec);
}
} else {
$this->_valueScalar = $value->nodeValue;
}
} else {
$this->raiseError("Malformed innerContent");
return;
}
} else {
$this->raiseError("Unknown property : " . $property);
}
}
示例2: _compute
/**
* Compute the tag
*
* @return string the PHP / HTML content computed
* @access private
*/
protected function _compute()
{
//decode ampersand
$this->_attributes['what'] = io::decodeEntities($this->_attributes['what']);
$return = '
$ifcondition_' . $this->_uniqueID . ' = CMS_polymod_definition_parsing::replaceVars("' . $this->replaceVars($this->_attributes['what'], false, false, array($this, 'encloseWithPrepareVar')) . '", @$replace);
';
//if attribute name is set, store if result
if (isset($this->_attributes['name']) && $this->_attributes['name']) {
$return .= '$atmIfResults[\'' . $this->_attributes['name'] . '\'][\'if\'] = false;';
}
$return .= '
if ($ifcondition_' . $this->_uniqueID . '):
$func_' . $this->_uniqueID . ' = @create_function("","return (".$ifcondition_' . $this->_uniqueID . '.");");
if ($func_' . $this->_uniqueID . ' === false) {
CMS_grandFather::raiseError(\'Error in atm-if [' . $this->_uniqueID . '] syntax : \'.$ifcondition_' . $this->_uniqueID . ');
}
if ($func_' . $this->_uniqueID . ' && $func_' . $this->_uniqueID . '()):
';
//if attribute name is set, store if result
if (isset($this->_attributes['name']) && $this->_attributes['name']) {
$return .= '$atmIfResults[\'' . $this->_attributes['name'] . '\'][\'if\'] = true;';
}
$return .= '
' . $this->_computeChilds() . '
endif;
unset($func_' . $this->_uniqueID . ');
endif;
unset($ifcondition_' . $this->_uniqueID . ');
';
return $return;
}
示例3: getValidationByID
/**
* Gets a validation for a given item
*
* @param integer $itemID The item we want the validations for
* @param CMS_user $user The user we want the validations for
* @param integer $getEditionType The validation type we want.
* by default function return RESOURCE_EDITION_LOCATION then RESOURCE_EDITION_CONTENT then RESOURCE_EDITION_SIBLINGSORDER
* @return array(CMS_resourceValidation) The resourceValidations objects, false if none found for the given user.
* @access public
*/
function getValidationByID($itemID, &$user, $getEditionType = false)
{
if (!$user instanceof CMS_profile_user) {
$this->raiseError("User is not a valid CMS_profile_user object");
return false;
}
if (!$user->hasValidationClearance($this->_codename)) {
return false;
}
if (CMS_poly_object_catalog::hasPrimaryResource($this->getCodename())) {
//get object type ID
$objectID = CMS_poly_object_catalog::getPrimaryResourceObjectType($this->getCodename());
//get viewvable objects list for current user
if (CMS_poly_object_catalog::objectHasCategories($objectID)) {
$objects = CMS_poly_object_catalog::getAllObjects($objectID, false, array(), false);
//$where = (is_array($objects) && $objects) ? ' and objectID in ('.implode(',',$objects).')' : '';
if (is_array($objects) && $objects) {
$where = ' and objectID in (' . implode(',', $objects) . ')';
} else {
return false;
}
} else {
$where = '';
}
$this->getPrimaryResourceDefinition();
if (!$getEditionType) {
$getEditionType = RESOURCE_EDITION_LOCATION + RESOURCE_EDITION_CONTENT;
}
$sql = "\n\t\t\t\t\tselect\n\t\t\t\t\t\tobjectID as id,\n\t\t\t\t\t\tlocation_rs as location,\n\t\t\t\t\t\tproposedFor_rs as proposedFor,\n\t\t\t\t\t\tvalidationsRefused_rs as validationsRefused,\n\t\t\t\t\t\teditions_rs as editions,\n\t\t\t\t\t\tmod_subobject_integer_edited.id as fieldID\n\t\t\t\t\tfrom\n\t\t\t\t\t\tmod_subobject_integer_edited,\n\t\t\t\t\t\tmod_object_polyobjects,\n\t\t\t\t\t\tresources,\n\t\t\t\t\t\tresourceStatuses\n\t\t\t\t\twhere\n\t\t\t\t\t\tobjectID = '" . $itemID . "'\n\t\t\t\t\t\tand value = id_res\n\t\t\t\t\t\tand object_type_id_moo = '" . $objectID . "'\n\t\t\t\t\t\tand id_moo = objectID\n\t\t\t\t\t\tand objectFieldID = 0\n\t\t\t\t\t\tand objectSubFieldID = 0\n\t\t\t\t\t\tand status_res = id_rs\n\t\t\t\t\t\t{$where}\n\t\t\t\t";
$q = new CMS_query($sql);
if ($q->getNumRows() >= 1) {
$r = $q->getArray();
$id = $r["id"];
//here, this is an ugly hack to resolve a strange bug (multiple resources for an unique object).
//not time to found the real cause for now ...
if ($q->getNumRows() > 1) {
while ($exceptionFiledID = $q->getValue('fieldID')) {
$sql_delete = "delete from mod_subobject_integer_edited where id = '" . $exceptionFiledID . "'";
$q_delete = new CMS_query($sql_delete);
}
}
//search the type of edition
//RESOURCE_EDITION_LOCATION
if ($r["location"] == RESOURCE_LOCATION_USERSPACE && $r["proposedFor"] != 0 && !($r["validationsRefused"] & RESOURCE_EDITION_LOCATION) && $getEditionType & RESOURCE_EDITION_LOCATION) {
$language = $user->getLanguage();
$item = $this->getResourceByID($id);
$validation = new CMS_resourceValidation($this->_codename, RESOURCE_EDITION_LOCATION, $item);
if (!$validation->hasError()) {
$validation->setValidationTypeLabel($language->getMessage(self::MESSAGE_MOD_POLYMOD_VALIDATION_LOCATIONCHANGE, array($this->_primaryResourceObjectDefinition->getLabel($language)), MOD_POLYMOD_CODENAME));
$validation->setValidationLabel($language->getMessage(self::MESSAGE_MOD_POLYMOD_VALIDATION_LOCATIONCHANGE_OFRESOURCE, array($this->_primaryResourceObjectDefinition->getLabel($language)), MOD_POLYMOD_CODENAME) . " " . io::decodeEntities($item->{$this->_resourceNameMethod}()));
$validation->setValidationShortLabel(io::decodeEntities($item->{$this->_resourceNameMethod}()));
$previzURL = $item->getPrevizPageURL();
if ($previzURL) {
$validation->addHelpUrl($language->getMessage(self::MESSAGE_PAGE_ACTION_PREVIZ), $previzURL);
}
$validation->setEditorsStack($item->getEditorsStack());
return $validation;
} else {
return false;
}
//RESOURCE_EDITION_CONTENT
} elseif ($r["location"] == RESOURCE_LOCATION_USERSPACE && $r["proposedFor"] == 0 && ($r["editions"] & RESOURCE_EDITION_CONTENT && !($r["validationsRefused"] & RESOURCE_EDITION_CONTENT)) && $getEditionType & RESOURCE_EDITION_CONTENT) {
$language = $user->getLanguage();
$editions = $r["editions"];
//RESOURCE_EDITION_CONTENT
$item = $this->getResourceByID($id);
$validation = new CMS_resourceValidation($this->_codename, $editions, $item);
if (!$validation->hasError()) {
$validation->setValidationTypeLabel($language->getMessage(self::MESSAGE_MOD_POLYMOD_VALIDATION_EDITION, array($this->_primaryResourceObjectDefinition->getLabel($language)), MOD_POLYMOD_CODENAME));
$validation->setValidationLabel($language->getMessage(self::MESSAGE_MOD_POLYMOD_VALIDATION_EDITION_OFRESOURCE, array($this->_primaryResourceObjectDefinition->getLabel($language)), MOD_POLYMOD_CODENAME) . " " . io::decodeEntities($item->{$this->_resourceNameMethod}()));
$validation->setValidationShortLabel(io::decodeEntities($item->{$this->_resourceNameMethod}()));
$previzURL = $item->getPrevizPageURL();
if ($previzURL) {
$validation->addHelpUrl($language->getMessage(self::MESSAGE_PAGE_ACTION_PREVIZ), $previzURL);
}
$validation->setEditorsStack($item->getEditorsStack());
return $validation;
} else {
return false;
}
}
} elseif ($q->getNumRows() == 0) {
return false;
} else {
$this->raiseError("Can't have more than one item for a given ID");
return false;
}
} else {
return false;
}
//.........这里部分代码省略.........
示例4: addWhereCondition
/**
* Builds where statement with a key and its value
* The key can be a known string, this class will create statements in consequence
* or it can be a field id
*
* @access public
* @param string $key name of statement to set
* @param string $value , the value to give
* @param string $operator, additional optional search operator
* @return void or false if an error occured
*/
function addWhereCondition($type, $value, $operator = false)
{
if (!$type || !$value && !$operator) {
return;
}
//clean value
if (!is_object($value) && !is_array($value)) {
$value = sensitiveIO::sanitizeSQLString($value);
} elseif (is_array($value)) {
$value = array_map(array('sensitiveIO', 'sanitizeSQLString'), $value);
}
$operator = $operator ? io::decodeEntities($operator) : false;
$statusSuffix = $this->_public ? "_public" : "_edited";
switch ($type) {
case "object":
if ($value && !is_a($value, 'CMS_poly_object_definition')) {
$this->raiseError('Value must be a valid CMS_poly_object_definition.');
return false;
}
$this->_object = $value;
$this->_whereConditions['object'][] = array('value' => $value, 'operator' => $operator);
break;
case "item":
if (!sensitiveIO::isPositiveInteger($value)) {
$this->raiseError("Value must be a positive Integer.");
return false;
}
$this->_whereConditions['item'][] = array('value' => $value, 'operator' => $operator);
break;
case "items":
if (!$value) {
$this->raiseError('Value must be a populated array.');
return false;
}
$this->_whereConditions['items'][] = array('value' => $value, 'operator' => $operator);
break;
case 'archives':
if ($this->_public && $this->_object->isPrimaryResource() && ($value == 1 || $value == 'true' || $value == true)) {
unset($this->_whereConditions['publication date before']);
unset($this->_whereConditions['publication date end']);
}
break;
case "itemsOrdered":
if (!$value) {
$this->raiseError('Value must be a populated array.');
return false;
}
$this->_whereConditions['items'][] = array('value' => $value, 'operator' => $operator);
$this->_orderConditions['itemsOrdered']['order'] = $value;
break;
case "profile":
if (!is_a($value, 'CMS_profile_user')) {
$this->raiseError('Value must be a valid CMS_profile_user.');
return false;
}
$this->_whereConditions['profile'][] = array('value' => $value, 'operator' => $operator);
break;
case "category":
//this search type is deprecated, keep it for compatibility but now it is replaced by direct field id access
//get field of categories for searched object type (assume it uses categories)
$categoriesFields = CMS_poly_object_catalog::objectHasCategories($this->_object->getId());
$this->_whereConditions[$categoriesFields[0]][] = array('value' => $value, 'operator' => $operator);
break;
case "keywords":
if ($value) {
$this->_whereConditions['keywords'][] = array('value' => $value, 'operator' => $operator);
}
break;
case "publication date after":
// Date start
if ($this->_object->isPrimaryResource()) {
if (!is_a($value, 'CMS_date')) {
$this->raiseError('Value must be a valid CMS_date.');
return false;
}
$this->_whereConditions['publication date after'][] = array('value' => $value, 'operator' => $operator);
}
break;
case "publication date before":
// Date End
if ($this->_object->isPrimaryResource()) {
if (!is_a($value, 'CMS_date')) {
$this->raiseError('Value must be a valid CMS_date.');
return false;
}
$this->_whereConditions['publication date before'][] = array('value' => $value, 'operator' => $operator);
}
break;
case "publication date end":
//.........这里部分代码省略.........
示例5: CMS_poly_plugin_definitions
$view->setDisplayMode(CMS_view::SHOW_RAW);
$selectedContent = sensitiveIO::request('content');
$pluginId = sensitiveIO::request('plugin');
$selectedPlugin = new CMS_poly_plugin_definitions($pluginId);
//then create the code to paste for the current selected object if any
if (sensitiveIO::isPositiveInteger($itemId) && !$selectedPlugin->needSelection()) {
//$item = CMS_poly_object_catalog::getObjectByID($selectedItem);
$definition = $selectedPlugin->getValue('definition');
$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>';
示例6: htmlspecialchars
<th width="130"><span fckLang="DlgCMSFormsLabel">Libellé</span></th>
<th width="130"><span fckLang="DlgCMSFormsType">Type</span></th>
<th width="60"><span fckLang="DlgCMSFormsOptions">Options</span></th>
<th width="50"><span fckLang="DlgCMSFormsActions">Actions</span></th>
</tr>
</table>
<ul id="sortField" class="sortable">';
}
$content .= '
<li id="f_' . $aFormField->getID() . '">
<table border="0" cellspacing="1" cellpadding="0" width="100%">
<tr>';
$required = $aFormField->getAttribute("required") ? ' checked="checked"' : '';
$content .= '
<td align="right"><input type="checkbox" name="required_' . $aFormField->getID() . '" value="1"' . $required . ' /></td>
<td align="center" width="130"><input type="text" name="label_' . $aFormField->getID() . '" value="' . htmlspecialchars(io::decodeEntities($aFormField->getAttribute("label"))) . '" /><input type="hidden" name="name_' . $aFormField->getID() . '" value="' . $aFormField->getAttribute("name") . '" /></td>
<td align="center" width="130">
<select name="type_' . $aFormField->getID() . '" onchange="viewHideOptionsButton(this,\'options_' . $aFormField->getID() . '\');">';
foreach ($fieldTypes as $aFieldType => $aFieldTypeLabel) {
$selected = $aFormField->getAttribute("type") == $aFieldType ? ' selected="selected"' : '';
$content .= '<option value="' . $aFieldType . '"' . $selected . '>' . $aFieldTypeLabel . '</option>';
}
$content .= '
</select>
</td>
<td align="center" width="60">';
$selectValues = '';
$selectLabels = '';
$countOptions = 0;
if (sizeof($aFormField->getAttribute("options"))) {
foreach ($aFormField->getAttribute("options") as $aSelectValue => $aSelectValueLabel) {
示例7: array
$field = $objectFields[$paramType];
if (is_object($field)) {
//check if field has a method to provide a list of names
$objectType = $field->getTypeObject();
if (method_exists($objectType, 'getListOfNamesForObject')) {
//check if we can associate unused objects
$params = $objectType->getParamsValues();
if (method_exists($objectType, 'getParamsValues') && isset($params['associateUnused']) && $params['associateUnused']) {
$objectsNames = $objectType->getListOfNamesForObject(true, array(), false);
} else {
$objectsNames = $objectType->getListOfNamesForObject(true);
}
$availableItems = array();
if (is_array($objectsNames) && $objectsNames) {
foreach ($objectsNames as $id => $label) {
$availableItems[] = array($id, io::decodeEntities($label));
}
} else {
$availableItems[] = array('', $cms_language(MESSAGE_EMPTY_OBJECTS_SET));
}
$mandatory = $paramValue == true ? '<span class="atm-red">*</span> ' : '';
$value = isset($data["value"]['search'][$searchName][$paramType]) ? $data["value"]['search'][$searchName][$paramType] : '';
$searchParamContent[] = array('fieldLabel' => $mandatory . $field->getLabel($cms_language), 'name' => 'value[search][' . $searchName . '][' . $paramType . ']', 'hiddenName' => 'value[search][' . $searchName . '][' . $paramType . ']', 'anchor' => '99%', 'xtype' => 'atmCombo', 'forceSelection' => true, 'mode' => 'local', 'valueField' => 'id', 'displayField' => 'label', 'triggerAction' => 'all', 'allowBlank' => !$mandatory, 'selectOnFocus' => true, 'editable' => false, 'value' => $value, 'store' => array('xtype' => 'arraystore', 'fields' => array('id', 'label'), 'data' => $availableItems));
} else {
$cms_message .= $cms_language->getMessage(MESSAGE_PAGE_SEARCH_FIELD_ERROR, array($searchName, $row->getLabel()), MOD_POLYMOD_CODENAME) . "\n";
}
} else {
$cms_message .= $cms_language->getMessage(MESSAGE_PAGE_SEARCH_FIELD_ERROR, array($searchName, $row->getLabel()), MOD_POLYMOD_CODENAME) . "\n";
}
} else {
$cms_message .= $cms_language->getMessage(MESSAGE_PAGE_SEARCH_FIELDTYPE_ERROR, array($searchName, $row->getLabel(), $paramType), MOD_POLYMOD_CODENAME) . "\n";
示例8: getHTMLAdmin
/**
* get HTML admin (used to enter object values in admin)
*
* @param integer $fieldID, the current field id (only for poly object compatibility)
* @param CMS_language $language, the current admin language
* @param string prefixname : the prefix to use for post names
* @return string : the html admin
* @access public
*/
function getHTMLAdmin($fieldID, $language, $prefixName)
{
$return = parent::getHTMLAdmin($fieldID, $language, $prefixName);
global $cms_user;
$params = $this->getParamsValues();
$return['name'] = 'polymodFieldsValue[list' . $prefixName . $this->_field->getID() . '_0]';
if ($params['multiUserGroup']) {
// Get all users or groups
$a_all_users = $this->getListOfNamesForObject();
$associatedItems = $availableItems = array();
if (is_array($a_all_users) && $a_all_users) {
foreach (array_keys($this->_subfieldValues) as $subFieldID) {
if (is_object($this->_subfieldValues[$subFieldID])) {
$associatedItems[$this->_subfieldValues[$subFieldID]->getValue()] = $this->_subfieldValues[$subFieldID]->getValue();
}
}
foreach ($a_all_users as $id => $user) {
$availableItems[] = array($id, $user);
}
} else {
$availableItems[] = array('', $language->getMessage(self::MESSAGE_EMPTY_OBJECTS_SET));
$return['disabled'] = true;
$return['value'] = '';
}
/*$return['xtype'] = 'multiselect';
$return['dataFields'] = array('id', 'label');
$return['data'] = $availableItems;
$return['value'] = implode(',',$associatedItems);
$return['valueField'] = "id";
$return['displayField'] = "label";
$return['width'] = '97%';*/
$return['xtype'] = 'superboxselect';
$return['dataFields'] = array('id', 'label');
$return['store'] = $availableItems;
$return['mode'] = 'local';
$return['value'] = implode(',', $associatedItems);
$return['valueField'] = "id";
$return['displayField'] = "label";
$return['width'] = '100%';
$return['stackItems'] = true;
} else {
$usersDatas = array();
if ($params['isCurrentUser']) {
$usersDatas[] = array($cms_user->getUserId(), $cms_user->getFullName());
$return['disabled'] = true;
$return['value'] = $cms_user->getUserId();
} elseif ($params['creationUser']) {
if (sensitiveIO::isPositiveInteger($this->_subfieldValues[0]->getValue())) {
$user = CMS_profile_usersCatalog::getByID($this->_subfieldValues[0]->getValue());
} else {
$user = $cms_user;
}
$usersDatas[] = array($user->getUserId(), $user->getFullName());
$return['disabled'] = true;
$return['value'] = $user->getUserId();
} else {
// Get all users or groups
$a_all_users = $this->getListOfNamesForObject();
if (is_array($a_all_users) && $a_all_users) {
$usersDatas[] = array('', $language->getMessage(self::MESSAGE_CHOOSE_OBJECT));
foreach ($a_all_users as $userGroupID => $aUserGroupLabel) {
$usersDatas[] = array($userGroupID, io::decodeEntities($aUserGroupLabel));
}
$return['value'] = $this->_subfieldValues[0]->getValue();
} else {
$usersDatas[] = array('', $language->getMessage(self::MESSAGE_EMPTY_OBJECTS_SET));
$return['disabled'] = true;
$return['value'] = '';
}
}
$return['hiddenName'] = $return['name'];
/*unset($return['id']);*/
$return['xtype'] = 'atmCombo';
$return['forceSelection'] = true;
$return['mode'] = 'local';
$return['valueField'] = 'id';
$return['displayField'] = 'name';
$return['triggerAction'] = 'all';
$return['store'] = array('xtype' => 'arraystore', 'fields' => array('id', 'name'), 'data' => $usersDatas);
$return['selectOnFocus'] = true;
$return['editable'] = true;
}
return $return;
}
示例9: elseif
$view->setContent($objectsDatas);
$view->show();
}
//CHECKS objectId
if (!$objectId && !$fieldId) {
CMS_grandFather::raiseError('Missing objectId to list in module ' . $codename);
$view->setContent($objectsDatas);
$view->show();
} elseif (!$objectId && $fieldId) {
$objectId = CMS_poly_object_catalog::getObjectIDForField($fieldId);
}
//load current object definition
$object = CMS_poly_object_catalog::getObjectDefinition($objectId);
if (!$object->hasError()) {
$conditions = $query ? array('keywords' => $query) : array();
$objectsNames = CMS_poly_object_catalog::getListOfNamesForObject($objectId, false, $conditions);
if (is_array($objectsNames) && $objectsNames) {
$objectsDatas['objects'][] = array('id' => '0', 'label' => ' ');
foreach ($objectsNames as $id => $label) {
if (!$removeIds || !in_array($id, $removeIds)) {
$objectsDatas['objects'][] = array('id' => $id, 'label' => io::decodeEntities($label));
}
}
} else {
$objectsDatas['objects'][] = array('id' => '0', 'label' => $cms_language->getMessage(MESSAGE_PAGE_NO_ITEM, false, MOD_POLYMOD_CODENAME));
}
} else {
$objectsDatas['objects'][] = array('id' => '0', 'label' => $cms_language->getMessage(MESSAGE_PAGE_ITEM_NON_EXISTENT, false, MOD_POLYMOD_CODENAME));
}
$view->setContent($objectsDatas);
$view->show();
示例10: getInput
/**
* Return the needed form field tag for current object field
*
* @param array $values : parameters values array(parameterName => parameterValue) in :
* id : the form field id to set
* @param multidimentionnal array $tags : xml2Array content of atm-function tag
* @return string : the form field HTML tag
* @access public
*/
function getInput($fieldID, $language, $inputParams)
{
if (isset($this->_objectValues[$fieldID])) {
if (is_a($this->_objectValues[$fieldID], 'CMS_poly_object')) {
if (isset($inputParams['prefix'])) {
$prefixName = $inputParams['prefix'];
unset($inputParams['prefix']);
} else {
$prefixName = '';
}
//serialize all htmlparameters
$htmlParameters = CMS_object_common::serializeHTMLParameters($inputParams);
$html = '';
//get searched objects conditions
$searchedObjects = is_array($this->_objectFieldsDefinition[$fieldID]->getParameter('searchedObjects')) ? $this->_objectFieldsDefinition[$fieldID]->getParameter('searchedObjects') : array();
$objectsNames = CMS_poly_object_catalog::getListOfNamesForObject($this->_objectValues[$fieldID]->getObjectID(), false, $searchedObjects);
if (is_array($objectsNames) && $objectsNames) {
//append field id to html field parameters (if not already exists)
$htmlParameters .= !isset($inputParams['id']) ? ' id="' . $prefixName . $this->_objectFieldsDefinition[$fieldID]->getID() . '_0"' : '';
if (isset($inputParams['hidden']) && ($inputParams['hidden'] == 'true' || $inputParams['hidden'] == 1)) {
//create field value
$value = isset($inputParams['value']) ? $inputParams['value'] : $this->_polyObjectValues[$fieldID]->getValue();
$html .= '<input type="hidden"' . $htmlParameters . ' name="' . $prefixName . $this->_objectFieldsDefinition[$fieldID]->getID() . '_0" value="' . $value . '" />' . "\n";
} else {
$html .= '<select name="' . $prefixName . $this->_objectFieldsDefinition[$fieldID]->getID() . '_0"' . $htmlParameters . '>
<option value="0">' . $language->getMessage(self::MESSAGE_POLYMOD_CHOOSE_OBJECT) . '</option>';
foreach ($objectsNames as $objectID => $objectName) {
$selected = is_object($this->_polyObjectValues[$fieldID]) && $this->_polyObjectValues[$fieldID]->getValue() == $objectID || $inputParams['defaultvalue'] == $objectID && (!is_object($this->_polyObjectValues[$fieldID]) || !$this->_polyObjectValues[$fieldID]->getValue()) ? ' selected="selected"' : '';
$html .= '<option value="' . $objectID . '"' . $selected . '>' . io::htmlspecialchars(io::decodeEntities($objectName)) . '</option>' . "\n";
}
$html .= '</select>';
}
if (POLYMOD_DEBUG) {
$html .= '<span class="admin_text_alert"> (Field : ' . $fieldID . ' - Value : ' . $this->_polyObjectValues[$fieldID]->getValue() . ' - objectID : ' . $this->_objectValues[$fieldID]->getObjectID() . ')</span>';
}
} else {
$html .= $language->getMessage(self::MESSAGE_POLYMOD_EMPTY_OBJECTS_SET);
}
//append html hidden field which store field name
if ($html) {
$html .= '<input type="hidden" name="polymodFields[' . $this->_objectFieldsDefinition[$fieldID]->getID() . ']" value="' . $this->_objectFieldsDefinition[$fieldID]->getID() . '" />';
}
return $html;
} elseif (is_object($this->_objectValues[$fieldID])) {
//return html for other type of objects fields
return $this->_objectValues[$fieldID]->getInput($fieldID, $language, $inputParams);
}
}
return '';
}
示例11: foreach
foreach ($modulesValidations as $codename => $moduleValidations) {
//if module is not standard, echo its name, the number of validations to do and a link to its admin frontend
if ($codename == MOD_STANDARD_CODENAME) {
$modLabel = $cms_language->getMessage(MESSAGE_PAGE_STANDARD_MODULE_LABEL);
} else {
$mod = CMS_modulesCatalog::getByCodename($codename);
$modLabel = $mod->getLabel($cms_language);
}
//sort the validations by type label
$validationsSorted = array();
foreach ($moduleValidations as $validation) {
$validationsSorted[$validation->getValidationTypeLabel()][] = $validation;
}
ksort($validationsSorted);
foreach ($validationsSorted as $label => $validations) {
$label = io::decodeEntities($label);
$validation = $validations[0];
$validationsType['validationsType'][] = array('id' => $count, 'module' => $codename, 'editions' => $validation->getEditions(), 'label' => $modLabel . ' : ' . $label . ' : ' . sizeof($validations) . ' ' . $cms_language->getMessage(MESSAGE_PAGE_VALIDATIONS_PENDING_COUNT));
if ($codename == $module && $validation->getEditions() & $editions) {
$selectedValidations = $count;
}
$count++;
}
}
}
//json encode validations types
$validationsType = sensitiveIO::jsonEncode($validationsType);
//get records / pages
$recordsPerPage = CMS_session::getRecordsPerPage();
$jscontent = <<<END
\tvar validationsWindow = Ext.getCmp('{$winId}');
示例12: treatWantedTag
/**
* Treat given content tag by this module for the specified treatment mode, visualization mode and object.
*
* @param string $tag The CMS_XMLTag.
* @param string $tagContent previous tag content.
* @param integer $treatmentMode The current treatment mode (see constants on top of CMS_modulesTags class for accepted values).
* @param integer $visualizationMode The current visualization mode (see constants on top of cms_page class for accepted values).
* @param object $treatedObject The reference object to treat.
* @param array $treatmentParameters : optionnal parameters used for the treatment. Usually an array of objects.
* @return string the tag content treated.
* @access public
*/
function treatWantedTag(&$tag, $tagContent, $treatmentMode, $visualizationMode, &$treatedObject, $treatmentParameters)
{
switch ($treatmentMode) {
case MODULE_TREATMENT_BLOCK_TAGS:
return parent::treatWantedTag($tag, $tagContent, $treatmentMode, $visualizationMode, $treatedObject, $treatmentParameters);
break;
case MODULE_TREATMENT_CLIENTSPACE_TAGS:
return parent::treatWantedTag($tag, $tagContent, $treatmentMode, $visualizationMode, $treatedObject, $treatmentParameters);
break;
case MODULE_TREATMENT_PAGECONTENT_TAGS:
if (!$treatedObject instanceof CMS_page) {
$this->raiseError('$treatedObject must be a CMS_page object');
return false;
}
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 plugin definition
$definition = $selectedPlugin->getValue('compiledDefinition');
//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 = '';
}
//.........这里部分代码省略.........
示例13: setFooter
/**
* Sets Email footer
*
* @param String $footer
* @return void
* @access public
*
*/
function setFooter($footer)
{
$this->_footer = io::decodeEntities($footer);
}
示例14: pluginCode
/**
* Return a wysiwyg plugin output for given parameters
*
* @param integer $pluginID : the plugin id to use
* @param integer $itemID : the item id to use
* @param string $selection : the selected wysiwyg text if any
* @param boolean $public : the data status
* @param boolean $pluginView : is this plugin is intended to be shown in wysiwyg view ? (default false)
* @return string : the plugin output
* @access public
* @static
*/
static function pluginCode($pluginID, $itemID, $selection, $public = false, $pluginView = false)
{
global $cms_user;
//then create the code to paste for the current selected object if any
if (sensitiveIO::isPositiveInteger($itemID) && sensitiveIO::isPositiveInteger($pluginID)) {
//get plugin
$plugin = new CMS_poly_plugin_definitions($pluginID);
//set execution parameters
$parameters = array();
$parameters['itemID'] = $itemID;
$parameters['public'] = $public;
if ($pluginView) {
$parameters['plugin-view'] = true;
}
//get originaly selected text
if (!$plugin->needSelection()) {
$parameters['selection'] = '';
} else {
$parameters['selection'] = io::decodeEntities($selection);
}
//this line is used to optimise text fields (see CMS_object_text) which use a lot of plugin codes.
//in this case, items are searched before then put in this global var so it is not necessary to do one search for each of them
if (isset($GLOBALS['polymod']['preparedItems'][$plugin->getValue('objectID')][$itemID])) {
$parameters['item'] = $GLOBALS['polymod']['preparedItems'][$plugin->getValue('objectID')][$itemID];
}
//eval item content
ob_start();
eval(sensitiveIO::sanitizeExecCommand(sensitiveIO::stripPHPTags($plugin->getValue('compiledDefinition'))));
$data = ob_get_contents();
ob_end_clean();
return $data;
}
}