Changeset 1267


Ignore:
Timestamp:
Aug 22, 2010, 5:13:19 PM (11 years ago)
Author:
popeye
Message:

Mise à jour du plugin sfFeed2Plugin

Location:
cpc/trunk/project/plugins/sfFeed2Plugin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/plugins/sfFeed2Plugin/README

    r367 r1267  
    3636== Installation ==
    3737
    38   * Install the plugin
     38Installation of the plugin differs on the version of symfony you are using.
     39
     40  * Install the plugin (symfony 1.0):
    3941{{{
    4042$ symfony plugin-install http://plugins.symfony-project.com/sfFeed2Plugin
     43}}}
     44
     45  * Install the plugin (symfony 1.1+):
     46{{{
     47$ symfony plugin:install sfFeed2Plugin
    4148}}}
    4249
     
    197204{{{
    198205<?php decorate_with(false) ?>
    199 <?php echo $feed->asXml() ?>
     206<?php echo $feed->asXml(ESC_RAW) ?>
    200207}}}
    201208
     
    453460}
    454461}}}
     462
     463By default, the aggregator sorts all items in reverse chronological order. If you wish to sort them in chronological order instead, add 'sort' => 'chronological' to the parameters array.
     464
     465=== Adding an image to the feed ===
     466
     467To add an image to the feed, use the sfFeedImage class
     468
     469{{{
     470$feed = new sfRss201Feed();
     471
     472$feedImage = new sfFeedImage();
     473$feedImage->setLink('http://www.example.org/images/feed-image.png');
     474$feedImage->setTitle('My Title');
     475$feed->setImage($feedImage)
     476}}}}
    455477
    456478== TODO ==
  • cpc/trunk/project/plugins/sfFeed2Plugin/lib/sfAtom1Feed.class.php

    r367 r1267  
    294294      if ($item->getContent())
    295295      {
    296         $xml[] = sprintf('  <content type="text/html"><![CDATA[%s]]></content>', $item->getContent());
     296        $xml[] = sprintf('  <content type="html"><![CDATA[%s]]></content>', $item->getContent());
    297297      }
    298298
  • cpc/trunk/project/plugins/sfFeed2Plugin/lib/sfFeedPeer.class.php

    r367 r1267  
    141141      foreach($feed->getItems() as $item)
    142142      {
    143         $index = is_integer($item->getPubDate()) ?  $item->getPubDate() : 0;
     143        $index = is_integer($item->getPubDate()) || ctype_digit($item->getPubDate()) ?  $item->getPubDate() : 0;
    144144        while(isset($feed_items[$index]))
    145145        {
     
    150150    }
    151151
    152     // sort in reverse chronological order
    153     krsort($feed_items);
    154 
     152    // when specified, sort items chronologically instead of reverse
     153    if (isset($parameters['sort']) && 'chronological' == $parameters['sort'])
     154    {
     155      ksort($feed_items);
     156    }
     157    else
     158    {
     159      // default behaviour: sort in reverse chronological order
     160      krsort($feed_items);
     161    }
     162   
    155163    // limit the number of feed items to be added
    156164    if(isset($parameters['limit']))
     
    293301        $routes = sfContext::getInstance()->getRouting()->getRoutes();
    294302        $route = $routes[substr($routeName, 1)];
    295         $url = $route[0];
    296         $paramNames = array_keys($route[2]);
    297         $defaults = $route[3];
     303        if($route instanceof sfRoute)
     304        {
     305          $url = $route->getPattern();
     306          $paramNames = array_keys($route->getVariables());
     307          $defaults = $route->getDefaults();
     308        }
     309        else
     310        {
     311          $url = $route[0];
     312          $paramNames = array_keys($route[2]);
     313          $defaults = $route[3];
     314        }
    298315      }
    299316
Note: See TracChangeset for help on using the changeset viewer.