Syndicat CGT Laborit

Rechercher

Rechercher

\D aKVKVKdYZ0l+ZKKKdYlY0 K K KdY'eX0}UK[TK[TKdYZ0sKKKdYNY0tKKKdܩYZ0KKKd#Yo,X0FKKKdY]XFKKKdYY0h]KKKdYYY0RKRKRKd`Y"5K5K5KdYYYX0 KKKd?Y/Z?FKFKFKdZ0/s3Ks3Ks3KdYYYZ0tKKKdYZbbKpKpKPYMIWA0]IKs3Ks3KdYcY0KKKdYY0sKKKdYZFkKVKVKdYY0s6KKKdŐYQY0 qIKqIKqIKd5Y|Z0tKKKdYg+Z0:8KKKdYYi+Z0*.K*.K*.KdYY9Z0K7K7KdYYhZ08YKKKd YYYY{Y0SKSKSKdeY0"1eQKfKfKd YYYYYA0KbKbKd^YkY0 >K>K>KdYZ0$\KSKSKd7Y8Y9YhY0tKKKdYY0SKSKSKdmY0K7K7KdYmZ0 K K KduYeZ0mKmKmKdYiTY0KsKsKdRGYHYIYJYKYLYMYNYOYPYQYRYSYtZNp00tKtKtKdY9W0\ *KfKfKdYY0K7K7KdYoZ0KKKdYW\<  KKKdY*zZ0%aKlKlKdYYYiYA0)K^K^KdQYsY0bKfKfKdYY0*KwKwKd>YpYFZ0[K[K[KdYjY0g *KgKgKdאYؐYY0KKKdYYFA#KΐKΐKYYY*YAFKKK6YY0<_KGKGKd # Site source if (preg_match(',(]*>)(([^<>]+))?,i', $item, $match)) { $data['source'] = trim($match[3]); $data['url_source'] = str_replace('&', '&', trim(extraire_attribut($match[1], 'url'))); } // tags # a partir de "", (del.icio.us) # ou (flickr) # ou (apple) # on cree nos tags microformat titre # http://microformats.org/wiki/rel-directory-fr $tags = array(); if (preg_match_all( ',<(([a-z]+:)?(subject|category|directory|keywords?|tags?|type))[^>]*>' .'(.*?),ims', $item, $matches, PREG_SET_ORDER)) $tags = ajouter_tags($matches, $item); # array() elseif (preg_match_all( ',<(([a-z]+:)?(subject|category|directory|keywords?|tags?|type))[^>]*/>' .',ims', $item, $matches, PREG_SET_ORDER)) $tags = ajouter_tags($matches, $item); # array() // Pieces jointes : // chercher au format RSS et les passer en microformat // ou des microformats relEnclosure, // ou encore les media:content if (!afficher_enclosures(join(', ', $tags))) { if (preg_match_all(',]+>,i', $item, $matches, PREG_PATTERN_ORDER)) $data['enclosures'] = join(', ', array_map('enclosure2microformat', $matches[0])); else if ( preg_match_all(',]+rel=["\']?enclosure["\']?[^<>]+>,i', $item, $matches, PREG_PATTERN_ORDER)) $data['enclosures'] = join(', ', array_map('enclosure2microformat', $matches[0])); else if ( preg_match_all(',]+>,i', $item, $matches, PREG_PATTERN_ORDER)) $data['enclosures'] = join(', ', array_map('enclosure2microformat', $matches[0])); } $data['item'] = $item; // Nettoyer les donnees et remettre les CDATA en place cdata_echappe_retour($data, $echappe_cdata); cdata_echappe_retour($tags, $echappe_cdata); // passer l'url en absolue $data['url'] = url_absolue(filtrer_entites($data['url']), $url_syndic); // Trouver les microformats (ecrase les et ) if (preg_match_all( ',]+[[:space:]])?rel=[^>]+>.*,Uims', $data['item'], $regs, PREG_PATTERN_ORDER)) { $tags = $regs[0]; } // Cas particulier : tags Connotea sous la forme if (preg_match_all( ',]+ class="postedtag"[^>]*>.*,Uims', $data['item'], $regs, PREG_PATTERN_ORDER)) $tags = preg_replace(', class="postedtag",i', ' rel="tag"', $regs[0]); $data['tags'] = $tags; // enlever le html des titre pour etre homogene avec les autres objets spip $data['titre'] = textebrut($data['titre']); $articles[] = $data; } return $articles; } // helas strtotime ne reconnait pas le format W3C // http://www.w3.org/TR/NOTE-datetime // http://doc.spip.org/@my_strtotime function my_strtotime($la_date) { // format complet if (preg_match( ',^(\d+-\d+-\d+[T ]\d+:\d+(:\d+)?)(\.\d+)?' .'(Z|([-+]\d{2}):\d+)?$,', $la_date, $match)) { $la_date = str_replace("T", " ", $match[1])." GMT"; return strtotime($la_date) - intval($match[5]) * 3600; } // YYYY if (preg_match(',^\d{4}$,', $la_date, $match)) return strtotime($match[0]."-01-01"); // YYYY-MM if (preg_match(',^\d{4}-\d{2}$,', $la_date, $match)) return strtotime($match[0]."-01"); // utiliser strtotime en dernier ressort $s = strtotime($la_date); if ($s > 0) return $s; // YYYY-MM-DD hh:mm:ss if (preg_match(',^\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\b,', $la_date, $match)) return strtotime($match[0]); // erreur spip_log("Impossible de lire le format de date '$la_date'"); return false; } // A partir d'un ou autre essayer de recuperer // le mot et son url ; on cree // http://doc.spip.org/@creer_tag function creer_tag($mot,$type,$url) { if (!strlen($mot = trim($mot))) return ''; $mot = "$mot"; if ($url) $mot = inserer_attribut($mot, 'href', $url); if ($type) $mot = inserer_attribut($mot, 'rel', $type); return $mot; } // http://doc.spip.org/@ajouter_tags function ajouter_tags($matches, $item) { include_spip('inc/filtres'); $tags = array(); foreach ($matches as $match) { $type = ($match[3] == 'category' OR $match[3] == 'directory') ? 'directory':'tag'; $mot = supprimer_tags($match[0]); if (!strlen($mot) AND !strlen($mot = extraire_attribut($match[0], 'label'))) break; // rechercher un url if ($url = extraire_attribut($match[0], 'domain')) { // category@domain est la racine d'une url qui se prolonge // avec le contenu text du tag ; mais dans SPIP < 2.0 // on donnait category@domain = #URL_RUBRIQUE, et // text = #TITRE_RUBRIQUE ; d'ou l'heuristique suivante sur le slash if (substr($url, -1) == '/') $url .= rawurlencode($mot); } else if ($url = extraire_attribut($match[0], 'resource') OR $url = extraire_attribut($match[0], 'url') ) {} ## cas particuliers else if (extraire_attribut($match[0], 'scheme') == 'urn:flickr:tags') { foreach(explode(' ', $mot) as $petit) if ($t = creer_tag($petit, $type, 'http://www.flickr.com/photos/tags/'.rawurlencode($petit).'/')) $tags[] = $t; $mot = ''; } else if ( // cas atom1, a faire apres flickr $term = extraire_attribut($match[0], 'term') ) { if ($scheme = extraire_attribut($match[0], 'scheme')) $url = suivre_lien($scheme,$term); else $url = $term; } else { # type delicious.com foreach(explode(' ', $mot) as $petit) if (preg_match(',]*\bresource=["\']([^>]*/' .preg_quote(rawurlencode($petit),',').')["\'],i', $item, $m)) { $mot = ''; if ($t = creer_tag($petit, $type, $m[1])) $tags[] = $t; } } if ($t = creer_tag($mot, $type, $url)) $tags[] = $t; } return $tags; } // Retablit le contenu des blocs [[CDATA]] dans un tableau // http://doc.spip.org/@cdata_echappe_retour function cdata_echappe_retour(&$table, &$echappe_cdata) { foreach ($table as $var => $val) { $table[$var] = filtrer_entites($table[$var]); foreach ($echappe_cdata as $n => $e) $table[$var] = str_replace("@@@SPIP_CDATA$n@@@", $e, $table[$var]); } } ?>