Exemple #1
0
<?php

/**
 * File containing the rssimport.php cronjob
 *
 * @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version //autogentag//
 * @package kernel
 */
//For ezUser, we would make this the ezUser class id but otherwise just pick and choose.
//fetch this class
$rssImportArray = eZRSSImport::fetchActiveList();
// Loop through all configured and active rss imports. If something goes wrong while processing them, continue to next import
foreach ($rssImportArray as $rssImport) {
    // Get RSSImport object
    $rssSource = $rssImport->attribute('url');
    $addCount = 0;
    $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Starting.');
    $xmlData = eZHTTPTool::getDataByURL($rssSource, false, 'eZ Publish RSS Import');
    if ($xmlData === false) {
        $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Failed to open RSS feed file: ' . $rssSource);
        continue;
    }
    // Create DomDocument from http data
    $domDocument = new DOMDocument('1.0', 'utf-8');
    $success = $domDocument->loadXML($xmlData);
    if (!$success) {
        $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Invalid RSS document.');
        continue;
    }
else
{
    $timeout = checkTimeout( $rssImport );
    if ( $timeout !== false )
    {
        return $timeout;
    }
}

$importDescription = $rssImport->importDescription();

// Handle RSS module action //
if ( $Module->isCurrentAction( 'AnalyzeFeed' ) ||
     $Module->isCurrentAction( 'UpdateClass' ) )
{
    $version = eZRSSImport::getRSSVersion( $http->postVariable( 'url' ) );

    if ( !isset( $importDescription['rss_version'] ) ||
         $importDescription['rss_version'] != $version )
    {
        $importDescription['object_attributes'] = array();
        $importDescription['class_attributes'] = array();
    }
    $importDescription['rss_version'] = $version;
    $rssImport->setImportDescription( $importDescription );
    storeRSSImport( $rssImport, $http );
}
else if ( $Module->isCurrentAction( 'Store' ) )
{
    storeRSSImport( $rssImport, $http, true );
    return $Module->redirectTo( '/rss/list' );
 static function arrayMergeRecursive($arr1, $arr2)
 {
     if (!is_array($arr1) || !is_array($arr2)) {
         return $arr2;
     }
     foreach ($arr2 as $key => $value) {
         $arr1[$key] = eZRSSImport::arrayMergeRecursive(@$arr1[$key], $value);
     }
     return $arr1;
 }
Exemple #4
0
                    $rssImport = eZRSSImport::fetch($deleteID, true, eZRSSImport::STATUS_DRAFT);
                    if ($rssImport) {
                        $rssImport->remove();
                    }
                    $rssImport = eZRSSImport::fetch($deleteID, true, eZRSSImport::STATUS_VALID);
                    if ($rssImport) {
                        $rssImport->remove();
                    }
                }
            }
        }
    }
}
// Get all RSS Exports
$exportArray = eZRSSExport::fetchList();
$exportList = array();
foreach ($exportArray as $export) {
    $exportList[$export->attribute('id')] = $export;
}
// Get all RSS imports
$importArray = eZRSSImport::fetchList();
$importList = array();
foreach ($importArray as $import) {
    $importList[$import->attribute('id')] = $import;
}
$tpl = eZTemplate::factory();
$tpl->setVariable('rssexport_list', $exportList);
$tpl->setVariable('rssimport_list', $importList);
$Result = array();
$Result['content'] = $tpl->fetch("design:rss/list.tpl");
$Result['path'] = array(array('url' => 'rss/list', 'text' => ezpI18n::tr('kernel/rss', 'Really Simple Syndication')));
else
{
    $cli->warning( "\n\nTotal objects re-published with the published and modified date updated: $publicationDatePublishCount");
}
*/
/**
 * File containing the rssimport.php cronjob code
 *
 * @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2013.5
 * @package kernel
 */
//For ezUser, we would make this the ezUser class id but otherwise just pick and choose.
//fetch this class
$rssImportArray[] = eZRSSImport::fetch($rssFeedExportID);
// Loop through all configured and active rss imports. If something goes wrong while processing them, continue to next import
foreach ($rssImportArray as $rssImport) {
    // Get RSSImport object
    $rssSource = $rssImport->attribute('url');
    $addCount = 0;
    $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Starting.');
    $xmlData = eZHTTPTool::getDataByURL($rssSource, false, 'eZ Publish RSS Import');
    if ($xmlData === false) {
        $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Failed to open RSS feed file: ' . $rssSource);
        continue;
    }
    // Create DomDocument from http data
    $domDocument = new DOMDocument('1.0', 'utf-8');
    $success = $domDocument->loadXML($xmlData);
    if (!$success) {