[PLUGINS] ~maj Crayons
[lhc/web/www.git] / www / plugins / seo-v1 / pipelines / seo_insert_head.php
1 <?php
2 /**
3 * BouncingOrange SPIP SEO plugin
4 *
5 * @category SEO
6 * @package SPIP_SEO
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)
10 */
11
12 if (!defined("_ECRIRE_INC_VERSION")) return;
13
14 /**
15 * Inserer les meta dans le head
16 *
17 * @param string $flux
18 * @return string
19 */
20 function seo_insert_head($flux){
21 /* CONFIG */
22 $config = unserialize($GLOBALS['meta']['seo']);
23 if (isset($config['insert_head']) && $config['insert_head']['activate']=='yes'){
24 $contexte = $GLOBALS['contexte'];
25 unset($contexte['lang']);
26 unset($contexte['date']);
27 unset($contexte['date_default']);
28 unset($contexte['date_redac']);
29 unset($contexte['date_redac_default']);
30 unset($contexte['lang']);
31 if (count($contexte)==0){
32 $objet = 'sommaire';
33 } elseif (isset($contexte['id_article'])) {
34 $id_objet = $contexte['id_article'];
35 $objet = 'article';
36 } elseif (isset($contexte['id_rubrique'])) {
37 $id_objet = $contexte['id_rubrique'];
38 $objet = 'rubrique';
39 }
40 /* META TAGS */
41 if (isset($config['meta_tags']) && $config['meta_tags']['activate']=='yes'){
42 if (!defined('_SEO_FORCER_SQUELETTE')){
43 $meta_tags = calculer_meta_tags();
44 $flux .= generer_meta_tags($meta_tags);
45 }
46 }
47 /* META GOOGLE WEBMASTER TOOLS */
48 if (isset($config['webmaster_tools']) && $config['webmaster_tools']['activate']=='yes' && $objet=='sommaire'){
49 $flux .= generer_webmaster_tools();
50 }
51
52 if (isset($config['bing']) && $config['bing']['activate']=='yes' && $objet=='sommaire'){
53 $flux .= generer_bing();
54 }
55
56 /* CANONICAL URL */
57 if (isset($config['canonical_url']) && $config['canonical_url']['activate']=='yes'){
58 $flux .= generer_urls_canoniques();
59 }
60
61 /* GOOGLE ANALYTICS */
62 if (isset($config['analytics']) && $config['analytics']['activate']=='yes'){
63 $flux .= generer_google_analytics();
64 }
65
66 /* ALEXA */
67 if (isset($config['alexa']) && $config['alexa']['activate']=='yes' && $objet=='sommaire'){
68 $flux .= generer_alexa();
69 }
70 }
71
72 return $flux;
73 }
74