00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 include_once( 'kernel/classes/ezpersistentobject.php' );
00042 include_once( 'kernel/classes/ezrssexportitem.php' );
00043 include_once( "lib/ezdb/classes/ezdb.php" );
00044
00045 define( "EZ_RSSEXPORT_STATUS_VALID", 1 );
00046 define( "EZ_RSSEXPORT_STATUS_DRAFT", 0 );
00047
00048 class eZRSSExport extends eZPersistentObject
00049 {
00050
00051
00052
00053 function eZRSSExport( $row )
00054 {
00055 $this->eZPersistentObject( $row );
00056 }
00057
00058
00059
00060
00061 function definition()
00062 {
00063 return array( "fields" => array( "id" => array( 'name' => 'ID',
00064 'datatype' => 'integer',
00065 'default' => 0,
00066 'required' => true ),
00067 'title' => array( 'name' => 'Title',
00068 'datatype' => 'string',
00069 'default' => ezi18n( 'kernel/rss', 'New RSS Export' ),
00070 'required' => true ),
00071 'url' => array( 'name' => 'URL',
00072 'datatype' => 'string',
00073 'default' => '',
00074 'required' => true ),
00075 'site_access' => array( 'name' => 'SiteAccess',
00076 'datatype' => 'string',
00077 'default' => '',
00078 'required' => true ),
00079 'modified' => array( 'name' => 'Modified',
00080 'datatype' => 'integer',
00081 'default' => 0,
00082 'required' => true ),
00083 'modifier_id' => array( 'name' => 'ModifierID',
00084 'datatype' => 'integer',
00085 'default' => 0,
00086 'required' => true,
00087 'foreign_class' => 'eZUser',
00088 'foreign_attribute' => 'contentobject_id',
00089 'multiplicity' => '1..*' ),
00090 'created' => array( 'name' => 'Created',
00091 'datatype' => 'integer',
00092 'default' => 0,
00093 'required' => true ),
00094 'creator_id' => array( 'name' => 'CreatorID',
00095 'datatype' => 'integer',
00096 'default' => 0,
00097 'required' => true,
00098 'foreign_class' => 'eZUser',
00099 'foreign_attribute' => 'contentobject_id',
00100 'multiplicity' => '1..*' ),
00101 'description' => array( 'name' => 'Description',
00102 'datatype' => 'string',
00103 'default' => '',
00104 'required' => false ),
00105 'image_id' => array( 'name' => 'ImageID',
00106 'datatype' => 'integer',
00107 'default' => 0,
00108 'required' => false ),
00109 'rss_version' => array( 'name' => 'RSSVersion',
00110 'datatype' => 'string',
00111 'default' => 0,
00112 'required' => true ),
00113 'active' => array( 'name' => 'Active',
00114 'datatype' => 'integer',
00115 'default' => 0,
00116 'required' => true ),
00117 'status' => array( 'name' => 'Status',
00118 'datatype' => 'integer',
00119 'default' => 0,
00120 'required' => true ),
00121 'access_url' => array( 'name' => 'AccessURL',
00122 'datatype' => 'string',
00123 'default' => 'rss_feed',
00124 'required' => false ),
00125 'number_of_objects' => array( 'name' => 'NumberOfObjects',
00126 'datatype' => 'integer',
00127 'default' => 0,
00128 'required' => true ),
00129 'main_node_only' => array( 'name' => 'MainNodeOnly',
00130 'datatype' => 'integer',
00131 'default' => 0,
00132 'required' => true ) ),
00133 "keys" => array( "id", 'status' ),
00134 'function_attributes' => array( 'item_list' => 'itemList',
00135 'modifier' => 'modifier',
00136 'rss-xml' => 'rssXml',
00137 'image_path' => 'imagePath',
00138 'image_node' => 'imageNode' ),
00139 "increment_key" => "id",
00140 "sort" => array( "title" => "asc" ),
00141 "class_name" => "eZRSSExport",
00142 "name" => "ezrss_export" );
00143
00144 }
00145
00146
00147
00148
00149
00150
00151
00152
00153 function create( $user_id )
00154 {
00155 $config =& eZINI::instance( 'site.ini' );
00156 $dateTime = time();
00157 $row = array( 'id' => null,
00158 'title' => ezi18n( 'kernel/classes', 'New RSS Export' ),
00159 'site_access' => '',
00160 'modifier_id' => $user_id,
00161 'modified' => $dateTime,
00162 'creator_id' => $user_id,
00163 'created' => $dateTime,
00164 'status' => 0,
00165 'url' => 'http://'. $config->variable( 'SiteSettings', 'SiteURL' ),
00166 'description' => '',
00167 'image_id' => 0,
00168 'active' => 1,
00169 'access_url' => '' );
00170 return new eZRSSExport( $row );
00171 }
00172
00173
00174
00175
00176
00177
00178 function store( $storeAsValid = false )
00179 {
00180 include_once( "kernel/classes/datatypes/ezuser/ezuser.php" );
00181 $dateTime = time();
00182 $user =& eZUser::currentUser();
00183 if ( $this->ID == null )
00184 {
00185 eZPersistentObject::store();
00186 return;
00187 }
00188
00189 $db =& eZDB::instance();
00190 $db->begin();
00191 if ( $storeAsValid )
00192 {
00193 $oldStatus = $this->attribute( 'status' );
00194 $this->setAttribute( 'status', EZ_RSSEXPORT_STATUS_VALID );
00195 }
00196 $this->setAttribute( 'modified', $dateTime );
00197 $this->setAttribute( 'modifier_id', $user->attribute( "contentobject_id" ) );
00198 eZPersistentObject::store();
00199 $db->commit();
00200 if ( $storeAsValid )
00201 {
00202 $this->setAttribute( 'status', $oldStatus );
00203 }
00204 }
00205
00206
00207
00208
00209
00210
00211 function remove()
00212 {
00213 $exportItems = $this->fetchItems();
00214
00215 $db =& eZDB::instance();
00216 $db->begin();
00217 foreach ( $exportItems as $item )
00218 {
00219 $item->remove();
00220 }
00221 eZPersistentObject::remove();
00222 $db->commit();
00223 }
00224
00225
00226
00227
00228
00229
00230
00231 function fetch( $id, $asObject = true, $status = EZ_RSSEXPORT_STATUS_VALID )
00232 {
00233 return eZPersistentObject::fetchObject( eZRSSExport::definition(),
00234 null,
00235 array( "id" => $id,
00236 'status' => $status ),
00237 $asObject );
00238 }
00239
00240
00241
00242
00243
00244
00245
00246 function fetchByName( $access_url, $asObject = true )
00247 {
00248 return eZPersistentObject::fetchObject( eZRSSExport::definition(),
00249 null,
00250 array( 'access_url' => $access_url,
00251 'active' => 1,
00252 'status' => 1 ),
00253 $asObject );
00254 }
00255
00256
00257
00258
00259
00260 function fetchList( $asObject = true )
00261 {
00262 return eZPersistentObject::fetchObjectList( eZRSSExport::definition(),
00263 null, array( 'status' => 1 ), null, null,
00264 $asObject );
00265 }
00266
00267 function &itemList()
00268 {
00269 $items = $this->fetchItems();
00270 return $items;
00271 }
00272
00273 function &imageNode()
00274 {
00275 if ( isset( $this->ImageID ) and $this->ImageID )
00276 {
00277 include_once( "kernel/classes/ezcontentobjecttreenode.php" );
00278 $node = eZContentObjectTreeNode::fetch( $this->ImageID );
00279 }
00280 else
00281 $node = null;
00282 return $node;
00283 }
00284
00285 function &imagePath()
00286 {
00287 if ( isset( $this->ImageID ) and $this->ImageID )
00288 {
00289 include_once( "kernel/classes/ezcontentobjecttreenode.php" );
00290 $objectNode = eZContentObjectTreeNode::fetch( $this->ImageID );
00291 if ( isset( $objectNode ) )
00292 {
00293 $path_array = $objectNode->attribute( 'path_array' );
00294 for ( $i = 0; $i < count( $path_array ); $i++ )
00295 {
00296 $treenode = eZContentObjectTreeNode::fetch( $path_array[$i], false, false );
00297 if( $i == 0 )
00298 $retValue = $treenode['name'];
00299 else
00300 $retValue .= '/'.$treenode['name'];
00301 }
00302 }
00303 else
00304 $retValue = null;
00305 }
00306 else
00307 $retValue = null;
00308
00309 return $retValue;
00310 }
00311
00312 function &modifier()
00313 {
00314 if ( isset( $this->ModifierID ) and $this->ModifierID )
00315 {
00316 include_once( "kernel/classes/datatypes/ezuser/ezuser.php" );
00317 $user = eZUser::fetch( $this->ModifierID );
00318 }
00319 else
00320 $user = null;
00321 return $user;
00322 }
00323
00324 function &rssXml()
00325 {
00326 switch( $this->attribute( 'rss_version' ) )
00327 {
00328 case '1.0':
00329 {
00330 $retRSSXml = $this->fetchRSS1_0();
00331 } break;
00332
00333 case '2.0':
00334 {
00335 $retRSSXml = $this->fetchRSS2_0();
00336 } break;
00337 default:
00338 {
00339 $retRSSXml = null;
00340 } break;
00341 }
00342
00343 return $retRSSXml;
00344 }
00345
00346
00347
00348
00349
00350
00351
00352
00353 function fetchItems( $id = false, $status = EZ_RSSEXPORT_STATUS_VALID )
00354 {
00355 if ( $id === false )
00356 {
00357 if ( isset( $this ) )
00358 {
00359 $id = $this->ID;
00360 $status = $this->Status;
00361 }
00362 else
00363 {
00364 $itemList = null;
00365 return $itemList;
00366 }
00367 }
00368 if ( $id !== null )
00369 $itemList = eZRSSExportItem::fetchFilteredList( array( 'rssexport_id' => $id, 'status' => $status ) );
00370 else
00371 $itemList = null;
00372 return $itemList;
00373 }
00374
00375 function getObjectListFilter()
00376 {
00377 if ( $this->MainNodeOnly == 1 )
00378 {
00379 $this->MainNodeOnly = true;
00380 }
00381 else
00382 {
00383 $this->MainNodeOnly = false;
00384 }
00385
00386 return array( 'number_of_objects' => intval($this->NumberOfObjects),
00387 'main_node_only' => $this->MainNodeOnly
00388 );
00389 }
00390
00391
00392
00393
00394
00395
00396
00397
00398 function fetchRSS2_0( $id = null )
00399 {
00400 if ( $id != null )
00401 {
00402 $rssExport = eZRSSExport::fetch( $id );
00403 return $rssExport->fetchRSS2_0();
00404 }
00405
00406 include_once( 'lib/ezxml/classes/ezdomdocument.php' );
00407
00408 $locale = eZLocale::instance();
00409
00410
00411 $config =& eZINI::instance();
00412 if ( $config->variable( 'URLTranslator', 'Translation' ) == 'enabled' )
00413 {
00414 $useURLAlias = true;
00415 }
00416 else
00417 {
00418 $useURLAlias = false;
00419 }
00420
00421 if ( $this->attribute( 'url' ) == '' )
00422 {
00423 include_once( 'lib/ezutils/classes/ezuri.php' );
00424 $baseItemURL = '';
00425 eZURI::transformURI( $baseItemURL, false, 'full' );
00426 $baseItemURL .= '/';
00427 }
00428 else
00429 {
00430 $baseItemURL = $this->attribute( 'url' ).'/';
00431 }
00432
00433 $doc = new eZDOMDocument();
00434 $doc->setName( 'eZ publish RSS Export' );
00435 $root = $doc->createElementNode( 'rss', array( 'version' => '2.0' ) );
00436 $doc->setRoot( $root );
00437
00438 $channel = $doc->createElementNode( 'channel' );
00439 $root->appendChild( $channel );
00440
00441 $channelTitle = $doc->createElementTextNode( 'title', $this->attribute( 'title' ) );
00442 $channel->appendChild( $channelTitle );
00443
00444 $channelLink = $doc->createElementTextNode( 'link', $this->attribute( 'url' ) );
00445 $channel->appendChild( $channelLink );
00446
00447 $channelDescription = $doc->createElementTextNode( 'description', $this->attribute( 'description' ) );
00448 $channel->appendChild( $channelDescription );
00449
00450 $channel->appendChild( $doc->createElementTextNode( 'language', $locale->httpLocaleCode() ) );
00451 $channel->appendChild( $channelLanguage );
00452
00453 $imageURL = $this->fetchImageURL();
00454 if ( $imageURL !== false )
00455 {
00456 $image = $doc->createElementNode( 'image' );
00457
00458 $imageUrlNode = $doc->createElementTextNode( 'url', $imageURL );
00459 $image->appendChild( $imageUrlNode );
00460
00461 $imageTitle = $doc->createElementTextNode( 'title', $this->attribute( 'title' ) );
00462 $image->appendChild( $imageTitle );
00463
00464 $imageLink = $doc->createElementTextNode( 'link', $this->attribute( 'url' ) );
00465 $image->appendChild( $imageLink );
00466
00467 $channel->appendChild( $image );
00468 }
00469
00470 $cond = array(
00471 'rssexport_id' => $this->ID,
00472 'status' => $this->Status
00473 );
00474 $rssSources = eZRSSExportItem::fetchFilteredList( $cond );
00475
00476 $nodeArray = eZRSSExportItem::fetchNodeList( $rssSources, $this->getObjectListFilter() );
00477
00478 if( is_array( $nodeArray ) && count( $nodeArray ) )
00479 {
00480 $attributeMappings = eZRSSExportItem::getAttributeMappings( $rssSources );
00481 }
00482
00483 foreach ( $nodeArray as $node )
00484 {
00485 $object = $node->attribute( 'object' );
00486 $dataMap = $object->dataMap();
00487 if ( $useURLAlias === true )
00488 {
00489 $nodeURL = $baseItemURL . $node->urlAlias();
00490 }
00491 else
00492 {
00493 $nodeURL = $baseItemURL . 'content/view/full/'.$object->attribute( 'id' );
00494 }
00495
00496
00497 $doesMatch = false;
00498
00499 foreach ( $attributeMappings as $attributeMapping )
00500 {
00501
00502 if ( $attributeMapping[0]->attribute( 'class_id' ) == $object->attribute( 'contentclass_id' ) and
00503 in_array( $attributeMapping[0]->attribute( 'source_node_id' ), $node->attribute( 'path_array' ) ) )
00504 {
00505
00506 $doesMatch = true;
00507
00508 $title = $dataMap[$attributeMapping[0]->attribute( 'title' )];
00509 $description = $dataMap[$attributeMapping[0]->attribute( 'description' )];
00510 break;
00511 }
00512 }
00513
00514 if( !$doesMatch )
00515 {
00516
00517 eZDebug::writeWarning( __CLASS__.'::'.__FUNCTION__.': Cannot find matching RSS source node for content object in '.__FILE__.', Line '.__LINE__ );
00518 $retValue = null;
00519 return $retValue;
00520 }
00521
00522
00523 unset( $itemTitle );
00524 $itemTitle = $doc->createElementNode( 'title' );
00525 $titleContent = $title->attribute( 'content' );
00526 if ( get_class( $titleContent ) == 'ezxmltext' )
00527 {
00528 $outputHandler = $titleContent->attribute( 'output' );
00529 unset( $itemTitleText );
00530 $itemTitleText = $doc->createTextNode( $outputHandler->attribute( 'output_text' ) );
00531 $itemTitle->appendChild( $itemTitleText );
00532 }
00533 else
00534 {
00535 unset( $itemTitleText );
00536 $itemTitleText = $doc->createTextNode( $titleContent );
00537 $itemTitle->appendChild( $itemTitleText );
00538 }
00539
00540
00541 unset( $itemDescription );
00542 $itemDescription = $doc->createElementNode( 'description' );
00543 $descriptionContent = $description->attribute( 'content' );
00544 if ( get_class( $descriptionContent ) == 'ezxmltext' )
00545 {
00546 $outputHandler = $descriptionContent->attribute( 'output' );
00547 unset( $itemDescriptionText );
00548 $itemDescriptionText = $doc->createTextNode( $outputHandler->attribute( 'output_text' ) );
00549 $itemDescription->appendChild( $itemDescriptionText );
00550 }
00551 else
00552 {
00553 unset( $itemDescriptionText );
00554 $itemDescriptionText = $doc->createTextNode( $descriptionContent );
00555 $itemDescription->appendChild( $itemDescriptionText );
00556 }
00557
00558 unset( $itemLink );
00559 $itemLink = $doc->createElementNode( 'link' );
00560
00561 unset( $itemLinkUrl );
00562 $itemLinkUrl = $doc->createTextNode( $nodeURL );
00563 $itemLink->appendChild( $itemLinkUrl );
00564
00565 unset( $item );
00566 $item = $doc->createElementNode( 'item' );
00567
00568 unset( $itemPubDate );
00569 $itemPubDate = $doc->createElementTextNode( 'pubDate', gmdate( 'D, d M Y H:i:s', $object->attribute( 'published' ) ) .' GMT' );
00570
00571 $item->appendChild( $itemPubDate );
00572 $item->appendChild( $itemTitle );
00573 $item->appendChild( $itemLink );
00574 $item->appendChild( $itemDescription );
00575
00576 $channel->appendChild( $item );
00577 }
00578
00579 return $doc;
00580 }
00581
00582
00583
00584
00585
00586
00587
00588
00589 function fetchRSS1_0( $id = null )
00590 {
00591 if ( $id != null )
00592 {
00593 $rssExport = eZRSSExport::fetch( $id );
00594 return $rssExport->fetchRSS1_0();
00595 }
00596
00597 include_once( 'lib/ezxml/classes/ezdomdocument.php' );
00598
00599 $imageURL = $this->fetchImageURL();
00600
00601
00602 $config =& eZINI::instance( 'site.ini' );
00603 if ( $config->variable( 'URLTranslator', 'Translation' ) == 'enabled' )
00604 {
00605 $useURLAlias = true;
00606 }
00607 else
00608 {
00609 $useURLAlias = false;
00610 }
00611
00612 if ( $this->attribute( 'url' ) == '' )
00613 {
00614 include_once( 'lib/ezutils/classes/ezuri.php' );
00615 $baseItemURL = '';
00616 eZURI::transformURI( $baseItemURL, false, 'full' );
00617 $baseItemURL .= '/';
00618 }
00619 else
00620 {
00621 $baseItemURL = $this->attribute( 'url' ).'/';
00622 }
00623
00624 $doc = new eZDOMDocument();
00625 $doc->setName( 'eZ publish RSS Export' );
00626 $root = $doc->createElementNode( 'rdf:RDF', array( 'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
00627 'xmlns:rdfs' => 'http://www.w3.org/2000/01/rdf-schema#',
00628 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
00629 'xmlns' => 'http://purl.org/rss/1.0/' ) );
00630 $doc->setRoot( $root );
00631
00632 $channel = $doc->createElementNode( 'channel', array( 'rdf:about' => $this->attribute( 'url' ) ) );
00633 $root->appendChild( $channel );
00634
00635 $channelTitle = $doc->createElementTextNode( 'title', $this->attribute( 'title' ) );
00636 $channel->appendChild( $channelTitle );
00637
00638 $channelUrl = $doc->createElementTextNode( 'link', $this->attribute( 'url' ) );
00639 $channel->appendChild( $channelUrl );
00640
00641 $channelDescription = $doc->createElementTextNode( 'description', $this->attribute( 'description' ) );
00642 $channel->appendChild( $channelDescription );
00643
00644 if ( $imageURL !== false )
00645 {
00646 $channelImage = $doc->createElementNode( 'image', array( 'rdf:resource' => $imageURL ) );
00647 $channel->appendChild( $channelImage );
00648
00649 $image = $doc->createElementNode( 'image', array( 'rdf:about' => $imageURL ) );
00650
00651 $imageTitle = $doc->createElementTextNode( 'title', $this->attribute( 'title' ) );
00652 $image->appendChild( $imageTitle );
00653
00654 $imageLink = $doc->createElementTextNode( 'link', $this->attribute( 'url' ) );
00655 $image->appendChild( $imageLink );
00656
00657 $imageUrlNode = $doc->createElementTextNode( 'url', $imageURL );
00658 $image->appendChild( $imageUrlNode );
00659
00660 $root->appendChild( $image );
00661 }
00662
00663 $items = $doc->createElementNode( 'items' );
00664 $channel->appendChild( $items );
00665
00666 $rdfSeq = $doc->createElementNode( 'rdf:Seq' );
00667 $items->appendChild( $rdfSeq );
00668
00669 $cond = array(
00670 'rssexport_id' => $this->ID,
00671 'status' => $this->Status
00672 );
00673 $rssSources = eZRSSExportItem::fetchFilteredList( $cond );
00674
00675 $nodeArray = eZRSSExportItem::fetchNodeList( $rssSources, $this->getObjectListFilter() );
00676
00677 if( is_array( $nodeArray ) && count( $nodeArray ) )
00678 {
00679 $attributeMappings = eZRSSExportItem::getAttributeMappings( $rssSources );
00680 }
00681
00682 foreach ( $nodeArray as $node )
00683 {
00684 $object = $node->attribute( 'object' );
00685 $dataMap = $object->dataMap();
00686 if ( $useURLAlias === true )
00687 {
00688 $nodeURL = $baseItemURL.$node->urlAlias();
00689 }
00690 else
00691 {
00692 $nodeURL = $baseItemURL.'content/view/full/'.$object->attribute( 'id' );
00693 }
00694
00695 unset( $rdfSeqLi );
00696 $rdfSeqLi = $doc->createElementNode( 'rdf:li', array( 'rdf:resource' => $nodeURL ) );
00697 $rdfSeq->appendChild( $rdfSeqLi );
00698
00699
00700 $doesMatch = false;
00701
00702 foreach ( $attributeMappings as $attributeMapping )
00703 {
00704
00705 if ( $attributeMapping[0]->attribute( 'class_id' ) == $object->attribute( 'contentclass_id' ) and
00706 in_array( $attributeMapping[0]->attribute( 'source_node_id' ), $node->attribute( 'path_array' ) ) )
00707 {
00708
00709 $doesMatch = true;
00710
00711 $title = $dataMap[$attributeMapping[0]->attribute( 'title' )];
00712 $description = $dataMap[$attributeMapping[0]->attribute( 'description' )];
00713 break;
00714 }
00715 }
00716
00717 if( !$doesMatch )
00718 {
00719
00720 eZDebug::writeWarning( __CLASS__.'::'.__FUNCTION__.': Cannot find matching RSS source node for content object in '.__FILE__.', Line '.__LINE__ );
00721 $retValue = null;
00722 return $retValue;
00723 }
00724
00725
00726 unset( $itemTitle );
00727 $itemTitle = $doc->createElementNode( 'title' );
00728 $titleContent = $title->attribute( 'content' );
00729 if ( get_class( $titleContent ) == 'ezxmltext' )
00730 {
00731 $outputHandler = $titleContent->attribute( 'output' );
00732
00733 unset( $itemTitleText );
00734 $itemTitleText = $doc->createTextNode( $outputHandler->attribute( 'output_text' ) );
00735 $itemTitle->appendChild( $itemTitleText );
00736 }
00737 else
00738 {
00739 unset( $itemTitleText );
00740 $itemTitleText = $doc->createTextNode( $titleContent );
00741 $itemTitle->appendChild( $itemTitleText );
00742 }
00743
00744
00745 unset( $itemDescription );
00746 $itemDescription = $doc->createElementNode( 'description' );
00747 $descriptionContent = $description->attribute( 'content' );
00748 if ( get_class( $descriptionContent ) == 'ezxmltext' )
00749 {
00750 $outputHandler = $descriptionContent->attribute( 'output' );
00751
00752 unset( $itemDescriptionText );
00753 $itemDescriptionText = $doc->createTextNode( $outputHandler->attribute( 'output_text' ) );
00754 $itemDescription->appendChild( $itemDescriptionText );
00755 }
00756 else
00757 {
00758 unset( $itemDescriptionText );
00759 $itemDescriptionText = $doc->createTextNode( $descriptionContent );
00760 $itemDescription->appendChild( $itemDescriptionText );
00761 }
00762
00763 unset( $itemLink );
00764 $itemLink = $doc->createElementNode( 'link' );
00765
00766 unset( $itemLinkText );
00767 $itemLinkText = $doc->createTextNode( $nodeURL );
00768 $itemLink->appendChild( $itemLinkText );
00769
00770 unset( $item );
00771 $item = $doc->createElementNode( 'item', array ( 'rdf:about' => $nodeURL ) );
00772
00773 $item->appendChild( $itemTitle );
00774 $item->appendChild( $itemLink );
00775 $item->appendChild( $itemDescription );
00776
00777 $root->appendChild( $item );
00778 }
00779
00780 return $doc;
00781 }
00782
00783
00784
00785
00786
00787
00788
00789
00790 function fetchImageURL()
00791 {
00792
00793 $imageNode = $this->attribute( 'image_node' );
00794 if ( !$imageNode )
00795 return false;
00796
00797 $imageObject = $imageNode->attribute( 'object' );
00798 if ( !$imageObject )
00799 return false;
00800
00801 $dataMap = $imageObject->attribute( 'data_map' );
00802 if ( !$dataMap )
00803 return false;
00804
00805 $imageAttribute = $dataMap['image'];
00806 if ( !$imageAttribute )
00807 return false;
00808
00809 $imageHandler = $imageAttribute->attribute( 'content' );
00810 if ( !$imageHandler )
00811 return false;
00812
00813 $imageAlias = $imageHandler->imageAlias( 'rss' );
00814 if( !$imageAlias )
00815 return false;
00816
00817 $url = eZSys::hostname() . eZSys::wwwDir() .'/'. $imageAlias['url'];
00818 $url = preg_replace( "#^(//)#", "/", $url );
00819
00820 return 'http://'.$url;
00821 }
00822 }
00823 ?>