Skip to content
Snippets Groups Projects

Dev/15442 Adaptation des flux RSS pour intégration des carrousels sur yonne-biblio.fr

Closed Ghost User requested to merge dev/15442 into WIP

Merge request reports

Approval is optional

Closed by (Apr 17, 2025 10:30pm UTC)

Merge details

  • The changes were not merged into .

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Laurent
    Laurent @llaffont started a thread on the diff
    529 542 return($flux);
    530 543 }
    531 544
    545 protected function getMediaContentsFromHTMLDescription($description) {
    546 $media_contents = [];
    547
    548 if (preg_match('/<img/', $description)) {
    549 $description = preg_replace('/<!\[CDATA\[(.*)\]\]>/s', '$1', $description);
    550 $doc = new DOMDocument();
    551 $doc->loadHTML($description);
    552 $imgs = $doc->getElementsByTagName('img');
    553
    554 foreach ($imgs as $img) {
    555 $url = $img->attributes->getNamedItem('src')->nodeValue;
    556 if ($url[0] == '/') {
    557 $url = 'http://' . $_SERVER['SERVER_NAME'] . $url;
    • Pendant qu'on y est :) je transformerait Class_Rss en ViewHelper (car un RSS est une vue). Cela permettrait aussi de faire un $url = $this->view->url($url) pour construire les urls absolues

  • Laurent
    Laurent @llaffont started a thread on the diff
    508 <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
    509 509 <channel>
    510 510 <title>'.$data_array["titre"].'</title>
    511 <link>'.$data_array["lien"].'</link>
    512 <description>'.$data_array["description"].'</description>
    513 <image>
    511 <link>'.$data_array["lien"].'</link>';
    512 if (isset($data_array['description'])) {
    513 $flux .= '<description>'.$data_array["description"].'</description>';
    514 }
    515 if (isset($data_array['lastBuildDate'])) {
    516 $lastBuildDate = date(DATE_RSS, $data_array['lastBuildDate']);
    517 $flux .= '<lastBuildDate>' . $lastBuildDate . '</lastBuildDate>';
    518 }
    519 $flux .= '<image>
    514 520 <url>http://'.$_SERVER['SERVER_NAME'].URL_IMG.'site/logo.jpg</url>
  • Laurent
    Laurent @llaffont started a thread on the diff
    353 352 }
    354 353
    355 354
    356 $entries = array();
    355 $items = [];
    357 356 foreach($notices as $notice) {
    358 $entries []= array(
    359 'title' => $notice["titre"].', '.$notice["auteur"],
    360 'link' => 'http://' . $_SERVER['SERVER_NAME'].BASE_URL.'/recherche/viewnotice/id/'.$notice['id_notice'],
    361 'description' => $this->_noticeRssDescription($notice),
    362 'lastUpdate' => strtotime($notice['date_maj']));
    357 $items[] = [
    358 'titre' => $notice["titre"] . ', ' . $notice["auteur"],
    359 'lien' => 'http://' . $_SERVER['SERVER_NAME'] . BASE_URL . '/recherche/viewnotice/id/' . $notice['id_notice'],
  • Laurent
    Laurent @llaffont started a thread on the diff
    530 . '<description>'.$item["desc"].'</description>';
    531 if (isset($item['pubDate'])) {
    532 $pubDate = date(DATE_RSS, $item['pubDate']);
    533 $flux .= '<pubDate>' . $pubDate . '</pubDate>';
    534 }
    535 foreach ($media_contents as $mc) {
    536 $flux .= '<media:content url="' . $mc['url'] . '"/>';
    526 537 }
    538 $flux .= '</item>';
    539 }
    527 540
    528 541 $flux.='</channel></rss>';
    529 542 return($flux);
    530 543 }
    531 544
    545 protected function getMediaContentsFromHTMLDescription($description) {
  • Laurent Status changed to closed

    Status changed to closed

Please register or sign in to reply