本文整理汇总了PHP中eZURL::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURL::fetch方法的具体用法?PHP eZURL::fetch怎么用?PHP eZURL::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURL
的用法示例。
在下文中一共展示了eZURL::fetch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttributeContent
/**
* @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
* @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
* @return array
*/
public static function getAttributeContent( eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute )
{
$url = eZURL::fetch( $contentObjectAttribute->attribute( 'data_int' ) );
return array(
'content' => array(
'url' => ( $url instanceof eZURL ) ? $url->attribute( 'url' ) : null,
'text' => $contentObjectAttribute->attribute( 'data_text' ),
),
'has_rendered_content' => false,
'rendered' => null,
);
}
示例2: handleInlineNode
static function handleInlineNode($child, $generator, $prevLineBreak = false)
{
$paragraphParameters = array();
$imageArray = array();
switch ($child->localName) {
case "line":
// @todo: (Alex) check why this is needed here and not after the next line
if ($prevLineBreak) {
$paragraphParameters[] = array(eZOOGenerator::LINE, '');
}
// Todo: support inline tags
$paragraphParameters[] = array(eZOOGenerator::TEXT, $child->textContent);
foreach ($child->childNodes as $lineChild) {
if ($lineChild->localName == 'embed') {
// Only support objects of image class for now
$object = eZContentObject::fetch($lineChild->getAttribute("object_id"));
if ($object && $object->canRead()) {
$classIdentifier = $object->attribute("class_identifier");
// Todo: read class identifiers from configuration
if ($classIdentifier == "image") {
$imageSize = $lineChild->getAttribute('size');
if ($imageSize == "") {
$imageSize = "large";
}
$imageAlignment = $lineChild->getAttribute('align');
if ($imageAlignment == "") {
$imageAlignment = "center";
}
$dataMap = $object->dataMap();
$imageAttribute = $dataMap['image'];
$imageHandler = $imageAttribute->content();
$originalImage = $imageHandler->attribute('original');
$fileHandler = eZClusterFileHandler::instance($originalImage['url']);
$uniqueFile = $fileHandler->fetchUnique();
$displayImage = $imageHandler->attribute($imageSize);
$displayWidth = $displayImage['width'];
$displayHeight = $displayImage['height'];
$imageArray[] = array("FileName" => $uniqueFile, "Alignment" => $imageAlignment, "DisplayWidth" => $displayWidth, "DisplayHeight" => $displayHeight);
}
} else {
eZDebug::writeError("Image (object_id = " . $child->getAttribute('object_id') . " ) could not be used (does not exist or due to insufficient privileges)");
}
}
}
break;
// text nodes
// text nodes
case "":
$paragraphParameters[] = array(eZOOGenerator::TEXT, $child->textContent);
break;
case "link":
$href = $child->getAttribute('href');
if (!$href) {
$url_id = $child->getAttribute('url_id');
if ($url_id) {
$eZUrl = eZURL::fetch($url_id);
if (is_object($eZUrl)) {
$href = $eZUrl->attribute('url');
}
}
}
$paragraphParameters[] = array(eZOOGenerator::LINK, $href, $child->textContent);
break;
case "emphasize":
case "strong":
$style = $child->localName == 'strong' ? 'bold' : 'italic';
$paragraphParameters[] = array(eZOOGenerator::STYLE_START, $style);
foreach ($child->childNodes as $inlineNode) {
$return = self::handleInlineNode($inlineNode);
$paragraphParameters = array_merge($paragraphParameters, $return['paragraph_parameters']);
}
$paragraphParameters[] = array(eZOOGenerator::STYLE_STOP);
break;
case "literal":
$literalContent = $child->textContent;
$literalContentArray = explode("\n", $literalContent);
foreach ($literalContentArray as $literalLine) {
$generator->addParagraph("Preformatted_20_Text", htmlspecialchars($literalLine));
}
break;
case "custom":
$customTagName = $child->getAttribute('name');
// Check if the custom tag is inline
$ini = eZINI::instance('content.ini');
$isInlineTagList = $ini->variable('CustomTagSettings', 'IsInline');
$isInline = array_key_exists($customTagName, $isInlineTagList) && $isInlineTagList[$customTagName];
// Handle inline custom tags
if ($isInline) {
$paragraphParameters[] = array(eZOOGenerator::STYLE_START, "eZCustominline_20_{$customTagName}");
$paragraphParameters[] = array(eZOOGenerator::TEXT, $child->textContent);
$paragraphParameters[] = array(eZOOGenerator::STYLE_STOP);
} else {
$GLOBALS['CustomTagStyle'] = "eZCustom_20_{$customTagName}";
foreach ($child->childNodes as $customParagraph) {
// Alex 2008-06-03: changed $level (3rd argument) to $prevLineBreak
self::handleNode($customParagraph, $generator, $prevLineBreak);
}
$GLOBALS['CustomTagStyle'] = false;
}
break;
//.........这里部分代码省略.........
示例3: unserializeContentObjectAttribute
function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode)
{
$urlNode = $attributeNode->getElementsByTagName('url')->item(0);
if (is_object($urlNode)) {
unset($url);
$url = urldecode($urlNode->textContent);
$urlID = eZURL::registerURL($url);
if ($urlID) {
$urlObject = eZURL::fetch($urlID);
$urlObject->setAttribute('original_url_md5', $urlNode->getAttribute('original-url-md5'));
$urlObject->setAttribute('is_valid', $urlNode->getAttribute('is-valid'));
$urlObject->setAttribute('last_checked', $urlNode->getAttribute('last-checked'));
$urlObject->setAttribute('created', time());
$urlObject->setAttribute('modified', time());
$urlObject->store();
$objectAttribute->setAttribute('data_int', $urlID);
}
}
$textNode = $attributeNode->getElementsByTagName('text')->item(0);
if ($textNode) {
$objectAttribute->setAttribute('data_text', $textNode->textContent);
}
}
示例4: testUrlCaseSensitivity
/**
* Test scenario for issue #018211: URL datatype is not case sensitive
*
* @link http://issues.ez.no/18211
* @group issue18211
*/
public function testUrlCaseSensitivity()
{
$url = 'http://ez.no/EZPUBLISH';
$urlId = eZURL::registerURL($url);
$urlObject = eZURL::fetch($urlId);
self::assertEquals($url, $urlObject->attribute('url'));
unset($urlId, $urlObject);
$url2 = 'http://ez.no/ezpublish';
$url2Id = eZURL::registerURL($url2);
$url2Object = eZURL::fetch($url2Id);
self::assertEquals($url2, $url2Object->attribute('url'));
self::assertEquals(md5($url2), $url2Object->attribute('original_url_md5'));
unset($url2Id, $url2Object);
}
示例5: transformLinksToRemoteLinks
static function transformLinksToRemoteLinks(DOMNodeList $nodeList)
{
foreach ($nodeList as $node) {
$linkID = $node->getAttribute('url_id');
$isObject = $node->localName == 'object';
$objectID = $isObject ? $node->getAttribute('id') : $node->getAttribute('object_id');
$nodeID = $node->getAttribute('node_id');
if ($linkID) {
$urlObj = eZURL::fetch($linkID);
if (!$urlObj) {
continue;
}
$url = $urlObj->attribute('url');
$node->setAttribute('href', $url);
$node->removeAttribute('url_id');
} elseif ($objectID) {
$object = eZContentObject::fetch($objectID, false);
if (is_array($object)) {
$node->setAttribute('object_remote_id', $object['remote_id']);
}
if ($isObject) {
$node->removeAttribute('id');
} else {
$node->removeAttribute('object_id');
}
} elseif ($nodeID) {
$nodeData = eZContentObjectTreeNode::fetch($nodeID, false, false);
if (is_array($nodeData)) {
$node->setAttribute('node_remote_id', $nodeData['remote_id']);
}
$node->removeAttribute('node_id');
}
}
}
示例6: fetchLinkList
static function fetchLinkList($contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true)
{
$linkList = array();
$urlObjectLinkList = self::fetchLinkObjectList($contentObjectAttributeID, $contentObjectAttributeVersion, $asObject);
foreach ($urlObjectLinkList as $urlObjectLink) {
if ($asObject) {
$linkID = $urlObjectLink->attribute('url_id');
$linkList[] = eZURL::fetch($linkID);
} else {
$linkID = $urlObjectLink['url_id'];
$linkList[] = $linkID;
}
}
return $linkList;
}
示例7: getenv
break;
case '3':
$limit = 50;
break;
default:
$limit = 10;
break;
}
} else {
$limit = 10;
}
$offset = $Params['Offset'];
if (!is_numeric($offset)) {
$offset = 0;
}
$url = eZURL::fetch($urlID);
if (!$url) {
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$link = $url->attribute('url');
if (preg_match("/^(http:)/i", $link) or preg_match("/^(ftp:)/i", $link) or preg_match("/^(https:)/i", $link) or preg_match("/^(file:)/i", $link) or preg_match("/^(mailto:)/i", $link)) {
// No changes
} else {
$domain = getenv('HTTP_HOST');
$protocol = eZSys::serverProtocol();
$preFix = $protocol . "://" . $domain;
$preFix .= eZSys::wwwDir();
$link = preg_replace("/^\\//e", "", $link);
$link = $preFix . "/" . $link;
}
$viewParameters = array('offset' => $offset, 'limit' => $limit);
示例8: fetchLinkList
static function fetchLinkList( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true )
{
$linkList = array();
$conditions = array( 'contentobject_attribute_id' => $contentObjectAttributeID );
if ( $contentObjectAttributeVersion !== false )
$conditions['contentobject_attribute_version'] = $contentObjectAttributeVersion;
$urlObjectLinkList = eZPersistentObject::fetchObjectList( eZURLObjectLink::definition(),
null,
$conditions,
null,
null,
$asObject );
foreach ( $urlObjectLinkList as $urlObjectLink )
{
if ( $asObject )
{
$linkID = $urlObjectLink->attribute( 'url_id' );
$linkList[] = eZURL::fetch( $linkID );
}
else
{
$linkID = $urlObjectLink['url_id'];
$linkList[] = $linkID;
}
}
return $linkList;
}