function fromString($contentObjectAttribute, $string) { if ($string == '') { return true; } $multiprice = $contentObjectAttribute->attribute('content'); $multipriceData = eZStringUtils::explodeSTR($string, '|'); $vatType = array_shift($multipriceData); $vatExInc = array_shift($multipriceData); $contentObjectAttribute->setAttribute('data_text', $vatType . ',' . $vatExInc); while ($multipriceData) { $currencyCode = array_shift($multipriceData); $value = array_shift($multipriceData); $type = array_shift($multipriceData); if ($type == 'CUSTOM') { $type = 1; } else { if ($type == 'AUTO') { $type = 2; } else { $type = 5000; } } $multiprice->setPriceByCurrency($currencyCode, $value, $type); } $multiprice->store(); return $multiprice; }
function fromString($contentObjectAttribute, $string) { if ($string == '') { return true; } $multioptionArray = eZStringUtils::explodeStr($string, '&'); $multioption = new eZMultiOption(""); $multioption->OptionCounter = 0; $multioption->Options = array(); $multioption->Name = array_shift($multioptionArray); $priority = 1; foreach ($multioptionArray as $multioptionStr) { $optionArray = eZStringUtils::explodeStr($multioptionStr, '|'); $newID = $multioption->addMultiOption(array_shift($optionArray), $priority, array_shift($optionArray)); $optionID = 0; $count = count($optionArray); for ($i = 0; $i < $count; $i += 2) { $multioption->addOption($newID, $optionID, array_shift($optionArray), array_shift($optionArray)); $optionID++; } $priority++; } $contentObjectAttribute->setAttribute("data_text", $multioption->xmlString()); return $multioption; }
function fromString($contentObjectAttribute, $string) { if ($string == '') { return true; } $selectedNames = eZStringUtils::explodeStr($string, '|'); $selectedIDList = array(); $classContent = $this->classAttributeContent($contentObjectAttribute->attribute('contentclass_attribute')); $optionArray = $classContent['options']; foreach ($selectedNames as $name) { foreach ($optionArray as $option) { $optionName = $option['name']; if ($optionName == $name) { $selectedIDList[] = $option['id']; } } } $idString = is_array($selectedIDList) ? implode('-', $selectedIDList) : ""; $contentObjectAttribute->setAttribute('data_text', $idString); return true; }
function fromString($contentObjectAttribute, $string) { $matrix = $contentObjectAttribute->attribute('content'); $matrix->Cells = array(); $matrix->Matrix['rows']['sequential'] = array(); $matrix->NumRows = 0; if ($string != '') { $matrixRowsList = eZStringUtils::explodeStr($string, "&"); foreach ($matrixRowsList as $key => $value) { $newCells = eZStringUtils::explodeStr($value, '|'); $matrixArray[] = $newCells; $matrix->Cells = array_merge($matrix->Cells, $newCells); $newRow['columns'] = $newCells; $newRow['identifier'] = 'row_' . ($matrix->NumRows + 1); $newRow['name'] = 'Row_' . ($matrix->NumRows + 1); $matrix->NumRows++; $matrix->Matrix['rows']['sequential'][] = $newRow; } } return true; }
function fromString($contentObjectAttribute, $string) { $authorList = eZStringUtils::explodeStr($string, '&'); $author = new eZAuthor(); foreach ($authorList as $authorStr) { $authorData = eZStringUtils::explodeStr($authorStr, '|'); $author->addAuthor($authorData[2], $authorData[0], $authorData[1]); } $contentObjectAttribute->setContent($author); return $author; }
function fromString($contentObjectAttribute, $string) { if ($string == '') { return true; } $optionArray = eZStringUtils::explodeStr($string, '|'); $option = new eZOption(); $option->OptionCount = 0; $option->Options = array(); $option->Name = array_shift($optionArray); $count = count($optionArray); for ($i = 0; $i < $count; $i += 2) { $option->addOption(array('value' => array_shift($optionArray), 'additional_price' => array_shift($optionArray))); } $contentObjectAttribute->setAttribute("data_text", $option->xmlString()); return $option; }
static function headerOverrideArray($uri) { $headerArray = array(); if (!eZHTTPHeader::enabled()) { return $headerArray; } $contentView = false; $uriString = eZURLAliasML::cleanURL($uri->uriString()); // If content/view used, get url alias for node if (strpos($uriString, 'content/view/') === 0) { $urlParts = explode('/', $uriString); $nodeID = $urlParts[3]; if (!$nodeID) { return $headerArray; } $node = eZContentObjectTreeNode::fetch($nodeID); if (!$node) { return $headerArray; } $uriString = $node->pathWithNames(); $contentView = true; } else { $uriCopy = clone $uri; eZURLAliasML::translate($uriCopy); if (strpos($uriCopy->uriString(), 'content/view') === 0) { $contentView = true; } } $uriString = '/' . eZURLAliasML::cleanURL($uriString); $ini = eZINI::instance(); foreach ($ini->variable('HTTPHeaderSettings', 'HeaderList') as $header) { foreach ($ini->variable('HTTPHeaderSettings', $header) as $path => $value) { $path = '/' . eZURLAliasML::cleanURL($path); if (strlen($path) == 1 && (!$contentView && $ini->variable('HTTPHeaderSettings', 'OnlyForContent') === 'enabled') && $uriString != '/') { continue; } if (strpos($uriString, $path) === 0) { $config = eZStringUtils::explodeStr($value, ';'); $headerValue = $config[0]; $depth = isset($config[1]) ? $config[1] : null; $level = isset($config[2]) ? $config[2] : null; if ($header == 'Expires') { $headerValue = gmdate('D, d M Y H:i:s', time() + $headerValue) . ' GMT'; } if ($depth === null) { $headerArray[$header] = $headerValue; } else { $pathLevel = count(explode('/', $path)); $uriLevel = count(explode('/', $uriString)); if ($level === null) { if ($uriLevel <= $pathLevel + $depth) { $headerArray[$header] = $headerValue; } } else { if ($uriLevel <= $pathLevel + $depth && $uriLevel >= $pathLevel + $level) { $headerArray[$header] = $headerValue; } } } } } } return $headerArray; }
function transformObject($object, $node = false) { if ($this->tagStyle == self::USE_GENERIC_TAG) { $this->xmlWriter->startElement('object'); $this->xmlWriter->writeAttribute('identifier', $object->attribute('class_identifier')); } else { $this->xmlWriter->startElement($object->attribute('class_identifier')); } $this->writeObjectProperties($object); if ($node) { $this->writeNodeProperties($node); } foreach ($object->attribute('contentobject_attributes') as $attribute) { $attributeIdentifier = $attribute->attribute('contentclass_attribute_identifier'); $datatypeString = $attribute->attribute('data_type_string'); if (isset($this->options['ExcludeAttributeIdentifiers']) && in_array($attributeIdentifier, $this->options['ExcludeAttributeIdentifiers'])) { continue; } if (isset($this->options['ExcludeDatatype']) && in_array($datatypeString, $this->options['ExcludeDatatype'])) { continue; } if ($this->tagStyle == self::USE_GENERIC_TAG) { $this->xmlWriter->startElement('attribute'); $this->xmlWriter->writeAttribute('identifier', $attributeIdentifier); } else { $this->xmlWriter->startElement($attributeIdentifier); } $this->xmlWriter->writeAttribute('type', $datatypeString); $this->xmlWriter->writeAttribute('has_content', (int) $attribute->hasContent()); $attributeContent = false; switch ($datatypeString) { case 'ezobjectrelation': if ($attribute->hasContent()) { $attributeContent = $attribute->content(); if (self::$recursion == $this->options['XMLRelatedObjectRecursion']) { if ($this->tagStyle == self::USE_GENERIC_TAG) { $this->xmlWriter->startElement('object'); $this->xmlWriter->writeAttribute('identifier', $attributeContent->attribute('class_identifier')); } else { $this->xmlWriter->startElement($attributeContent->attribute('class_identifier')); } $this->writeObjectProperties($object); $this->xmlWriter->endElement(); } else { self::$recursion++; $this->transformObject($related); self::$recursion--; } eZContentObject::clearCache($attributeContent->attribute('id')); } break; case 'ezobjectrelationlist': if ($attribute->hasContent()) { $attributeContent = $attribute->content(); $relations = $attributeContent['relation_list']; $relatedNames = array(); foreach ($relations as $relation) { $related = eZContentObject::fetch($relation['contentobject_id']); if ($related) { if (self::$recursion == $this->options['XMLRelatedObjectRecursion']) { if ($this->tagStyle == self::USE_GENERIC_TAG) { $this->xmlWriter->startElement('object'); $this->xmlWriter->writeAttribute('identifier', $related->attribute('class_identifier')); } else { $this->xmlWriter->startElement($related->attribute('class_identifier')); } $this->writeObjectProperties($object); $this->xmlWriter->endElement(); } else { self::$recursion++; $this->transformObject($related); self::$recursion--; } eZContentObject::clearCache($related->attribute('id')); } } } break; case 'ezxmltext': if ($attribute->hasContent()) { $this->xmlWriter->writeCData($attribute->content()->attribute('output')->outputText()); } break; case 'ezstring': case 'eztext': if ($attribute->hasContent()) { $this->xmlWriter->text($attribute->toString()); } break; case 'ezbinaryfile': if ($attribute->hasContent()) { $attributeContent = $attribute->content(); $filePath = "{eZSys::hostname()}/content/download/{$attribute->attribute('contentobject_id')}/{$attribute->attribute('id')}/{$attribute->content()->attribute('original_filename')}"; $this->xmlWriter->writeAttribute('filepath', $filePath); $this->xmlWriter->writeAttribute('filesize', $attributeContent->attribute('filesize')); } break; case 'ezimage': if ($attribute->hasContent()) { $attributeContent = $attribute->content()->attribute('original'); $this->xmlWriter->writeAttribute('full_path', $attributeContent['full_path']); $this->xmlWriter->writeAttribute('filesize', $attributeContent['filesize']); } break; case 'ezselection': if ($attribute->hasContent()) { $attributeContent = $attribute->toString(); $selectedNames = eZStringUtils::explodeStr($attributeContent, '|'); foreach ($selectedNames as $selectedName) { $this->xmlWriter->startElement('item'); $this->xmlWriter->writeAttribute('content', $selectedName); $this->xmlWriter->endElement(); } } break; default: if ($attribute->hasContent()) { $this->xmlWriter->writeAttribute('content', $attribute->toString()); } break; } $this->xmlWriter->endElement(); } eZContentObject::clearCache($object->attribute('id')); $this->xmlWriter->endElement(); }