3 * BouncingOrange SPIP SEO plugin
6 * @package SPIP\SEO\Pipelines
7 * @author Pierre ROUSSET (p.rousset@gmail.com)
8 * @copyright Copyright (c) 2009 BouncingOrange (http://www.bouncingorange.com)
9 * @license http://opensource.org/licenses/gpl-2.0.php General Public License (GPL 2.0)
12 if (!defined('_ECRIRE_INC_VERSION')) {
16 function seo_autoriser() {
19 function autoriser_seo_bouton_dist($faire, $type, $id, $qui, $opt) {
20 // seul les administrateurs globaux ont acces au bouton de configuration
21 return autoriser('configurer', '_seo');
25 * Insertion dans le squelette head/truc de Z si dispo
26 * Remplace/ajoute des metas et title a celles du squelette
29 * Le contenu de la page
31 * Le contenu de la page modifiée
33 function seo_recuperer_fond($flux) {
34 if (strncmp($flux['args']['fond'], 'head/', 5)==0
35 and strpos($flux['data']['texte'], '<!--seo_insere-->') === false
36 and strpos($flux['data']['texte'], '<title') !== false
37 and include_spip('inc/config')
38 and lire_config('seo/insert_head/activate', 'no') == 'yes'
40 $flux['data']['texte'] = recuperer_fond('inclure/seo-head', array('head' => $flux['data']['texte'], 'contexte' => $flux['args']['contexte']));
46 * Insertion dans le pipeline affichage_final (SPIP)
47 * Remplace/ajoute des metas et title a celles du <head>
50 * Le contenu de la page
52 * Le contenu de la page modifiée
54 function seo_affichage_final($flux) {
58 * On n'agit que si on a un head
59 * sinon c'est tout et n'importe quoi
62 and stripos($flux, '<head>') !== false
63 and strpos($flux, '<!--seo_insere-->') === false
64 and include_spip('inc/config')
65 and lire_config('seo/insert_head/activate', 'no') == 'yes'
66 and ($ps = stripos($flux, '<head>')) !== false
67 and ($pe = stripos($flux, '</head>')) !== false
69 and $head = substr($flux, $ps+
6, $pe-$ps-6)
71 $head_new = recuperer_fond('inclure/seo-head', array('head' => $head, 'contexte' => $GLOBALS['contexte']));
72 $flux = str_replace($head, $head_new, $flux);
74 #var_dump(spip_timer());