Changeset 117870 in spip-zone
- Timestamp:
- Sep 16, 2019, 5:12:44 PM (17 months ago)
- Location:
- _plugins_/links/trunk
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/links/trunk/links_fonctions.php
r117869 r117870 12 12 if (!defined("_ECRIRE_INC_VERSION")) return; 13 13 14 // Gerer les articles virtuels rediriges 15 // on ne traite que les #URL_ARTICLE, pas les #URL_ARTICLE{13} 16 // https://code.spip.net/@balise_URL_ARTICLE_dist 14 /** 15 * Gerer les articles virtuels rediriges 16 * on ne traite que les #URL_ARTICLE, pas les #URL_ARTICLE{13} 17 * @param $p 18 * @return mixed 19 */ 17 20 function balise_URL_ARTICLE($p){ 18 21 include_spip('balise/url_'); … … 21 24 if ($p->type_requete=='articles' AND !interprete_argument_balise(1, $p)){ 22 25 include_spip('inc/lien'); 23 if (function_exists('chapo_redirigetil')){ 24 $_chapo = champ_sql('chapo', $p); 25 $p->code = "(chapo_redirigetil(\$c=$_chapo)?chapo_redirige(substr(\$c,1),true):" . $p->code . ')'; 26 } else { 27 $_virtuel = champ_sql('virtuel', $p); 28 $_redirige = (function_exists('virtuel_redirige') ? "virtuel_redirige($_virtuel,true)" : "($_virtuel)"); 29 $p->code = "(($_virtuel)?$_redirige:" . $p->code . ')'; 30 } 26 $_virtuel = champ_sql('virtuel', $p); 27 $_redirige = (function_exists('virtuel_redirige') ? "virtuel_redirige($_virtuel,true)" : "($_virtuel)"); 28 $p->code = "(($_virtuel)?$_redirige:" . $p->code . ')'; 31 29 } 32 30 return $p; 33 31 } 32 33 /** 34 * Lire la configuration 35 * @return array|mixed 36 */ 37 function links_configuration(){ 38 static $config; 39 if (is_null($config)) { 40 $defaut = [ 41 'style' => 'off', 42 'external' => 'off', 43 'download' => 'off', 44 'window' => 'off', 45 'doc_list' => ".pdf,.ppt,.xls,.doc", 46 ]; 47 $config = []; 48 if (isset($GLOBALS['meta']['links'])) { 49 $config = unserialize($GLOBALS['meta']['links']); 50 if (!$config) { 51 $config = []; 52 } 53 } 54 $config = array_merge($defaut, $config); 55 } 56 57 return $config; 58 } 59 60 /** 61 * Inserer les CSS 62 * @param $flux 63 * @return string 64 */ 65 function links_insert_head_css($flux){ 66 //Recuperation de la configuration 67 $links = links_configuration(); 68 69 //Styles 70 if ($links['style']=='on'){ 71 $flux .= '<link rel="stylesheet" href="' . find_in_path('css/links.css') . '" type="text/css" media="all" />'; 72 } 73 //Ouverture d'une nouvelle fenetre : insertion des init js inline, en amont des CSS (perf issue) 74 if ($links['window']=='on'){ 75 $js = 'var js_nouvelle_fenetre=\'' . _T('links:js_nouvelle_fenetre') . '\';'; 76 //Ouverture dune nouvelel fenetre sur les liens externes 77 if ($links['external']=='on'){ 78 // quand un site fait du multidomaine on prend en reference le domaine de la page concernee : 79 // sur www.example.org : autre.example.org est external 80 // sur autre.example.org : www.example.org est external 81 // sur un site mono-domaine ca ne change rien :) 82 // ca marche parce que le cache change quand le HTTP_HOST change (donc quand le domaine change) 83 $js .= 'var links_site = \'' . protocole_implicite(url_de_base()) . '\';'; 84 } 85 //Ouverture d'une nouvelle fenetre sur les documents (extensions a preciser) 86 if (($links['download']=='on') && ($links['doc_list'])){ 87 $js .= 'var links_doc = \'' . $links['doc_list'] . '\';'; 88 } 89 $flux = '<script type="text/javascript">' . $js . '</script>' . "\n" . $flux; 90 } 91 92 return $flux; 93 } 94 95 /** 96 * Inserer le JS 97 * @param $flux 98 * @return string 99 */ 100 function links_insert_head($flux){ 101 //Recuperation de la configuration 102 $links = links_configuration(); 103 104 //Ouverture d'une nouvelle fenetre 105 if ($links['window']=='on'){ 106 $flux .= '<script src="' . find_in_path('links.js') . '" type="text/javascript"></script>' . "\n"; 107 } 108 return $flux; 109 } -
_plugins_/links/trunk/paquet.xml
r117869 r117870 18 18 <licence lien="http://www.gnu.org/licenses/gpl-3.0.html">GPL 3</licence> 19 19 20 <pipeline nom="insert_head_css" inclure="links_ pipelines.php" />21 <pipeline nom="insert_head" inclure="links_ pipelines.php" />20 <pipeline nom="insert_head_css" inclure="links_fonctions.php" /> 21 <pipeline nom="insert_head" inclure="links_fonctions.php" /> 22 22 23 23 <necessite nom="spip_bonux" compatibilite="[3.0.0;[" /> 24 24 25 <menu nom="links" titre="links:titre_menu_liens" parent=" bando_squelette" icone="images/links-16.png" action="configurer_links" />25 <menu nom="links" titre="links:titre_menu_liens" parent="menu_squelette" icone="images/links-16.png" action="configurer_links" /> 26 26 27 <onglet nom="links" titre="links:titre_menu_liens" parent="configuration" icone="prive/themes/spip/images/links-16.png" action="configurer_links" />28 27 </paquet>
Note: See TracChangeset
for help on using the changeset viewer.