Changeset 96980 in spip-zone
- Timestamp:
- May 3, 2016, 12:18:56 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/shortcut_url/trunk/shortcut_url_pipelines.php
r96858 r96980 10 10 * @package SPIP\shortcut_url\pipelines 11 11 */ 12 13 if (!defined("_ECRIRE_INC_VERSION")) return; 12 if (!defined('_ECRIRE_INC_VERSION')) { 13 return; 14 } 14 15 15 16 /** 16 17 * Autorisation du menu d'entrée dans l'admin pour spip 3.1 17 * 18 * @param string $faire, $type, $id, $qui, $opt 18 * 19 * @param string $faire, $type, $id, $qui, $opt 19 20 * @return string 20 21 */ 21 function autoriser_menugrandeentree($faire, $type, $id, $qui, $opt){ 22 23 if(!in_array($type ,array('menuaccueil','menuedition','menupublication','menuadministration','menuconfiguration','menushortcuturl'))){ 22 function autoriser_menugrandeentree($faire, $type, $id, $qui, $opt) { 23 if (!in_array($type, array('menuaccueil', 'menuedition', 'menupublication', 'menuadministration', 'menuconfiguration', 'menushortcuturl'))) { 24 24 return false; 25 25 } … … 30 30 /** 31 31 * Autorisation du menu d'entrée dans l'admin pour spip 3.0 32 * 33 * @param string $faire, $type, $id, $qui, $opt 32 * 33 * @param string $faire, $type, $id, $qui, $opt 34 34 * @return string 35 35 */ 36 function autoriser_revisions_menu($faire, $type, $id, $qui, $opt) {36 function autoriser_revisions_menu($faire, $type, $id, $qui, $opt) { 37 37 return true; 38 38 } 39 40 function autoriser_mediabox_menu($faire, $type, $id, $qui, $opt){ 39 function autoriser_mediabox_menu($faire, $type, $id, $qui, $opt) { 41 40 return false; 42 41 } 43 44 function autoriser_visiteurs_menu($faire, $type, $id, $qui, $opt){ 42 function autoriser_visiteurs_menu($faire, $type, $id, $qui, $opt) { 45 43 return false; 46 44 } 47 48 function autoriser_suiviedito_menu($faire, $type, $id, $qui, $opt){ 45 function autoriser_suiviedito_menu($faire, $type, $id, $qui, $opt) { 49 46 return false; 50 47 } 51 52 function autoriser_synchro_menu($faire, $type, $id, $qui, $opt){ 48 function autoriser_synchro_menu($faire, $type, $id, $qui, $opt) { 53 49 return false; 54 50 } 55 56 function autoriser_articles_menu($faire, $type, $id, $qui, $opt){ 51 function autoriser_articles_menu($faire, $type, $id, $qui, $opt) { 57 52 return false; 58 53 } 59 60 function autoriser_rubriques_menu($faire, $type, $id, $qui, $opt){ 54 function autoriser_rubriques_menu($faire, $type, $id, $qui, $opt) { 61 55 return false; 62 56 } 63 64 function autoriser_rubrique_creer($faire, $type, $id, $qui, $opt){ 57 function autoriser_rubrique_creer($faire, $type, $id, $qui, $opt) { 65 58 return false; 66 59 } 67 68 function autoriser_documents_menu($faire, $type, $id, $qui, $opt){ 60 function autoriser_documents_menu($faire, $type, $id, $qui, $opt) { 69 61 return false; 70 62 } 71 72 function autoriser_sites_menu($faire, $type, $id, $qui, $opt){ 63 function autoriser_sites_menu($faire, $type, $id, $qui, $opt) { 73 64 return false; 74 65 } 75 76 function autoriser_mots_menu($faire, $type, $id, $qui, $opt){ 66 function autoriser_mots_menu($faire, $type, $id, $qui, $opt) { 77 67 return false; 78 68 } 79 80 function autoriser_breves_menu($faire, $type, $id, $qui, $opt){ 69 function autoriser_breves_menu($faire, $type, $id, $qui, $opt) { 81 70 return false; 82 71 } 83 84 function autoriser_voirrevisions($faire, $type, $id, $qui, $opt){ 72 function autoriser_voirrevisions($faire, $type, $id, $qui, $opt) { 85 73 return true; 86 74 } 87 75 88 76 /** 89 * Ajouter un bouton stats 90 * 91 * @param string $faire, $type, $id, $qui, $opt 77 * Ajouter un bouton stats 78 * 79 * @param string $faire, $type, $id, $qui, $opt 92 80 * @return string 93 81 */ 94 function shortcut_url_ajouter_menus($boutons_admin) {82 function shortcut_url_ajouter_menus($boutons_admin) { 95 83 include_spip('inc/autoriser'); 96 if (autoriser('menu','_menu_shortcut_url')){84 if (autoriser('menu', '_menu_shortcut_url')) { 97 85 $pages = array('shortcut_url_logs', 'shortcut_url_logs_export'); 98 foreach ($pages as $page){86 foreach ($pages as $page) { 99 87 $boutons_admin['menu_shortcut_url']->sousmenu[] = new Bouton(find_in_theme('images/shortcut_url-16.png'), 'shortcut_url:' . $page, $page); 100 88 } 101 } 102 else{ 89 } else { 103 90 unset($boutons_admin['menu_shortcut_url']); 104 91 } … … 106 93 return $boutons_admin; 107 94 } 108 109 function autoriser_menushortcuturl_menu($faire, $type, $id, $qui, $opt){ 110 return in_array($qui['statut'], array('1comite','0minirezo')) && count($qui['restreint']) == 0; 95 function autoriser_menushortcuturl_menu($faire, $type, $id, $qui, $opt) { 96 return in_array($qui['statut'], array('1comite', '0minirezo')) && count($qui['restreint']) == 0; 111 97 } 112 98 113 99 /** 114 100 * Affiche les URL publié par un auteur dans sa fiche 115 * 116 * @param string $flux 101 * 102 * @param string $flux 117 103 * @return string 118 104 */ 119 105 function shortcut_url_affiche_milieu($flux) { 120 if (trouver_objet_exec($flux['args']['exec'] == "auteur") && $flux['args']['id_auteur']){106 if (trouver_objet_exec($flux['args']['exec'] == 'auteur') && $flux['args']['id_auteur']) { 121 107 $id_auteur = $flux['args']['id_auteur']; 122 $texte = recuperer_fond('prive/objets/editer/shortcut_url_auteurs', 123 array( 124 'id_auteur'=>$id_auteur 125 ) 126 ); 127 if ($p=strpos($flux['data'],"<!--affiche_milieu-->")) 108 $texte = recuperer_fond('prive/objets/editer/shortcut_url_auteurs', array('id_auteur' => $id_auteur)); 109 if ($p = strpos($flux['data'], '<!--affiche_milieu-->')) { 128 110 $flux['data'] .= $texte; 129 else 130 $flux['data'] = substr_replace($flux['data'],$texte,$p,0); 111 } else { 112 $flux['data'] = substr_replace($flux['data'], $texte, $p, 0); 113 } 131 114 } 132 115 … … 136 119 /** 137 120 * Ajoute les css pour shortcut_url chargées dans le privé 138 * 121 * 139 122 * @param string $flux Contenu du head HTML concernant les CSS 140 123 * @return string Contenu du head HTML concernant les CSS 141 124 */ 142 125 function shortcut_url_header_prive_css($flux) { 143 144 126 $css = find_in_path('css/shortcut_url.css'); 145 $flux .= "<link rel='stylesheet' type='text/css' media='all' href='" .direction_css($css)."' />\n";127 $flux .= "<link rel='stylesheet' type='text/css' media='all' href='" . direction_css($css) . "' />\n"; 146 128 147 129 return $flux; … … 154 136 * @return mixed 155 137 */ 156 function shortcut_url_d3js_plugins($plugins) {157 if (test_espace_prive()){138 function shortcut_url_d3js_plugins($plugins) { 139 if (test_espace_prive()) { 158 140 $plugins[] = 'topojson'; 159 141 }
Note: See TracChangeset
for help on using the changeset viewer.