Changeset 54485 in spip-zone


Ignore:
Timestamp:
Nov 15, 2011, 10:41:00 AM (8 years ago)
Author:
cedric@…
Message:

annoncer le service oembed par insertion de PHP dans #INSERT_HEAD plutot que de passer par affichage_final a chaque hit

Location:
_plugins_/oembed
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/oembed/oembed_pipelines.php

    r54481 r54485  
    88if (!defined('_ECRIRE_INC_VERSION')) return;
    99
    10 // ajouter le lien oembed dans le head des pages publiques
    11 function oembed_affichage_final($page) {
    12         if (!$GLOBALS['html']) return $page;
    13         if ($url_oembed = url_absolue(parametre_url($GLOBALS['meta']['adresse_site'] . '/services/oembed/','url',url_absolue(self())))) {
    14                 $page = preg_replace(',</head>,i',
    15                         "\n".'<link rel="alternate" type="application/json+oembed" href="'.$url_oembed.'&amp;format=json" />'.
    16                         "\n".'<link rel="alternate" type="text/xml+oembed" href="'.$url_oembed.'&amp;format=xml" />'."\n".'\0',
    17                         $page, 1);
    18         }
    19         return $page;
     10//
     11/**
     12 * annoncer le service oembed dans le head des pages publiques
     13 *
     14 * @param string $head
     15 * @return string
     16 */
     17function oembed_insert_head($head) {
     18        $service = "services/oembed/";
     19        $head .= '<link rel="alternate" type="application/json+oembed" href="<?php echo parametre_url(url_absolue("'.parametre_url($service,'format','json').'"),"url",url_absolue(self()));?>" />'."\n";
     20        $head .= '<link rel="alternate" type="text/xml+oembed" href="<?php echo parametre_url(url_absolue("'.parametre_url($service,'format','xml').'"),"url",url_absolue(self()));?>" />'."\n";
     21        return $head;
    2022}
    2123
  • _plugins_/oembed/paquet.xml

    r54481 r54485  
    22        prefix="oembed"
    33        categorie="multimedia"
    4         version="0.3.3"
     4        version="0.3.4"
    55        etat="dev"
    66        compatibilite="[3.0.0-dev;["
     
    2121        <pipeline nom="post_edition" inclure="oembed_pipelines.php" />
    2222        <pipeline nom="pre_propre" inclure="oembed_pipelines.php" />
    23         <pipeline nom="affichage_final" inclure="oembed_pipelines.php" />
     23        <pipeline nom="insert_head" inclure="oembed_pipelines.php" />
    2424        <pipeline nom="formulaire_charger" inclure="oembed_pipelines.php" />
    2525        <pipeline nom="recuperer_fond" inclure="oembed_pipelines.php" />
Note: See TracChangeset for help on using the changeset viewer.