Show
Ignore:
Timestamp:
06/18/08 20:00:00 (5 months ago)
Author:
llaumgui
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ez_publish/myutils/trunk/cronjobs/planet.php

    r178 r181  
    3737//include_once( "lib/ezdb/classes/ezdb.php" ); 
    3838//include_once( "lib/ezutils/classes/ezhttptool.php" ); 
    39  
    40 //For ezUser, we would make this the ezUser class id but otherwise just pick and choose. 
     39//include_once( "extension/myutils/classes/myutilsfunction.php" ); 
     40 
     41 
    4142 
    4243$iniPlanet              = eZINI::instance( "planet.ini" ); 
     
    4546$rssImportArray = $rssImportArray->children (); 
    4647 
    47 /*$rssImportArray->subTree(     array(  'Depth' => 1, 
    48                                                                         'SortBy => array( 'priority', true() ) 
    49                                                                 );*/ 
    50  
    5148 
    5249// Loop through all configured and active rss imports. If something goes wrong while processing them, continue to next import 
     
    5754        $rssImportDataMap               = $rssImport->dataMap(); 
    5855    $rssSource                          = $rssImportDataMap['location_rss']->content(); 
     56     
    5957    if( empty($rssSource)) 
    6058    { 
     
    7068            } 
    7169         
    72             $xmlData = eZHTTPTool::getDataByURL( $rssSource ); 
     70            $xmlData = myUtilsFunctions::getDataByURL( $rssSource ); 
    7371            if ( $xmlData === false ) 
    7472            { 
     
    140138eZStaticCache::executeActions(); 
    141139 
    142 /*! 
    143   Parse RSS 1.0 feed 
    144  
    145   \param DOM root node 
    146   \param RSS Import item 
    147   \param cli 
    148 */ 
     140 
     141 
     142/** 
     143 * Parse RSS 1.0 feed 
     144 * @param DOM root node 
     145 * @param RSS Import item 
     146 * @param cli 
     147 */ 
    149148function rssImport1( $root, $rssImport, $cli ) 
    150149{ 
     
    167166        $cli->output( 'RSSImport '.$rssImport->attribute( 'name' ).': End. '.$addCount.' objects added' ); 
    168167    } 
    169  
    170 } 
    171  
    172 /*! 
    173   Parse RSS 2.0 feed 
    174  
    175   \param DOM root node 
    176   \param RSS Import item 
    177   \param cli 
    178 */ 
     168} 
     169 
     170 
     171 
     172/** 
     173 * Parse RSS 2.0 feed 
     174 * @param DOM root node 
     175 * @param RSS Import item 
     176 * @param cli 
     177 */ 
    179178function rssImport2( $root, $rssImport, $cli ) 
    180179{ 
     
    196195        $cli->output( 'RSSImport '.$rssImport->attribute( 'name' ).': End. '.$addCount.' objects added' ); 
    197196    } 
    198  
    199 } 
    200  
    201 /*! 
    202  Import specifiec rss item into content tree 
    203  
    204  \param RSS item xml element 
    205  \param $rssImport Object 
    206  \param cli 
    207  \param channel 
    208  
    209  \return 1 if object added, 0 if not 
    210 */ 
     197} 
     198 
     199 
     200 
     201/** 
     202 * Import specifiec rss item into content tree 
     203 * @param RSS item xml element 
     204 * @param $rssImport Object 
     205 * @param cli 
     206 * @param channel 
     207 * @return 1 if object added, 0 if not 
     208 */ 
    211209function importRSSItem( $item, $rssImport, $cli, $channel ) 
    212210{ 
     
    424422} 
    425423 
     424 
     425/** 
     426 *  
     427 * 
     428 * @param array $importDescriptionArray 
     429 * @param DOM $xmlDomNode 
     430 * @return unknown 
     431 */ 
    426432function recursiveFindRSSElementValue( $importDescriptionArray, $xmlDomNode ) 
    427433{ 
     
    459465} 
    460466 
     467 
     468 
     469/** 
     470 * Enter description here... 
     471 * 
     472 * @param unknown_type $objectAttribute 
     473 * @param unknown_type $value 
     474 */ 
    461475function setObjectAttributeValue( $objectAttribute, $value ) 
    462476{ 
     
    501515} 
    502516 
     517 
     518 
     519/** 
     520 * Enter description here... 
     521 * 
     522 * @param unknown_type $attribute 
     523 * @param unknown_type $attributeValue 
     524 * @param unknown_type $link 
     525 */ 
    503526function setEZXMLAttribute( $attribute, $attributeValue, $link = false ) 
    504527{ 
     
    525548 
    526549 
     550 
     551/** 
     552 * Enter description here... 
     553 * 
     554 * @param unknown_type $attribute 
     555 * @param unknown_type $attributeValue 
     556 * @param unknown_type $link 
     557 */ 
    527558function setEZTXTAttribute( $attribute, $attributeValue, $link = false ) 
    528559{ 
    529         /* Nettoyage tidy */ 
    530         if ( class_exists( 'tidy' ) ) 
    531         { 
    532                 $tidy           = new tidy; 
    533                 $config   = array(      'show-body-only'     => true, 
    534                                                         'output-xhtml'       => true, 
    535                                                         'wrap'               => 0, 
    536                                                         'alt-text'           => "" 
    537                                ); 
    538                 $tidy->parseString( $attributeValue, $config, 'utf8' ); 
    539                 $tidy->cleanRepair(); 
    540                 $attributeValue = $tidy; 
    541         } 
     560        myUtilsFunctions::cleanTidy( $attributeValue ); 
    542561         
    543562        /* Liens relatifs dans un flux RSS ! */ 
     
    549568} 
    550569 
    551  
    552570?>