File "a_suivre_fonctions.php"

Full path: /home/argothem/www/v4_old/fichiers_obsoletes_20220627_043105/prive/rss/a_suivre_fonctions.php
File size: 572 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

if (!defined('_ECRIRE_INC_VERSION')) {
	return;
}

function trier_rss($texte) {
	if (preg_match_all(',<item.*</item>\s*?,Uims', $texte, $matches, PREG_SET_ORDER)) {
		$placeholder = '<!--REINSERT-->';
		$items = array();
		foreach ($matches as $match) {
			if (preg_match(',<dc:date>(.*)</dc:date>,Uims', $match[0], $r)) {
				$items[strtotime($r[1])] = trim($match[0]);
				$texte = str_replace($match[0], unique($placeholder), $texte);
			}
		}
		krsort($items);
		$texte = str_replace($placeholder, implode("\n\t", $items) . "\n", $texte);
	}

	return $texte;
}