*/
function __autoload($className)
{
    ezcBase::autoload($className);
}
// *************************************************************************
echo "eZ Components feed creator\n";
if (count($argv) < 3) {
    echo "\tFirst parameter: feed type (rss1, rss2 or atom)\n";
    echo "\tSecond parameter: text file name\n";
    die;
}
$feedType = $argv[1];
$sourceFile = $argv[2];
$data = readDataFile($sourceFile);
$xml = createFeed($feedType, $data);
$destFile = substr($sourceFile, 0, strrpos($sourceFile, '.')) . '.xml';
echo "Creating xml file {$destFile} with contents:\n\n";
file_put_contents($destFile, $xml);
echo $xml . "\n\n";
// *************************************************************************
/**
 * Reads data from a file and returns an array to be used with the function
 * createFeed().
 *
 * The format of the returned array is:
 * <code>
 * array( 'title' => 'Feed title',
 *        'link' => 'Feed link',
 *        'published' => 'Feed published date',
 *        'authorName' => 'Feed author name',
예제 #2
0
파일: feed.php 프로젝트: haxelsson/emoncms
 function input_config($userid)
 {
     $out = "<div class='lightbox' style='margin-bottom:20px;'>";
     $out .= '<h3>2) Input Configuration:</h3>';
     if (isset($_POST["form"])) {
         $form = $_POST["form"];
     } else {
         $form = 0;
     }
     if ($form == 1 || $form == 2) {
         $input = $_POST["input"];
         $out .= "<h3>" . $input . "</h3>";
         $inputProcessList = getInputProcessList($userid, $input);
         // Form 2 is process addition ------------------------------------------
         if ($form == 2) {
             $processType = $_POST["sel"];
             // get process type
             $arg = $_POST["arg"];
             $out .= "<h2>here: " . $processType . " arg:" . $arg . "</h2>";
             // get feed name or scaler, offset etc
             if ($processType == 1 || $processType == 4 || $processType == 5 || $processType == 7 || $processType == 8) {
                 $name = $arg;
                 $id = getFeedId($userid, $name);
                 if ($id == 0) {
                     // Checks if feed of feed name arg exists
                     $id = createFeed($userid, $name);
                     // if not create feed and get its id
                 }
                 $arg = $id;
             }
             if ($processType == 6) {
                 $arg = getInputId($userid, $arg);
             }
             $inputProcessList[] = array($processType, $arg);
             // Add the new process list entry
             saveInputProcessList($userid, $input, $inputProcessList);
             // Save the new process list
         }
         //----------------------------------------------------------------------
         $out .= $this->view_processList($input, $inputProcessList);
     } else {
         $out .= "<p>Select an input to configure and map through to a feed</p>";
     }
     $out .= "</div>";
     return $out;
 }