Changeset 35805 in spip-zone
- Timestamp:
- Mar 4, 2010, 9:47:48 PM (14 years ago)
- Location:
- _squelettes_/zpip
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_squelettes_/zpip/plugin.xml
r35062 r35805 4 4 <icon>img/zpip-128.png</icon> 5 5 <licence>GNU/GPL</licence> 6 <version>1. 3.0</version>6 <version>1.4.0</version> 7 7 <etat>stable</etat> 8 8 <description> -
_squelettes_/zpip/z_pipelines.php
r35542 r35805 20 20 */ 21 21 function Z_styliser($flux){ 22 $dir_dist = array('navigation','extra','head'); 22 $z_blocs = isset($GLOBALS['z_blocs'])?$GLOBALS['z_blocs']:array('contenu','navigation','extra','head'); 23 $contenu = array_shift($z_blocs); // contenu par defaut 23 24 24 25 $squelette = $flux['data']; … … 26 27 AND $fond = $flux['args']['fond'] 27 28 AND $ext = $flux['args']['ext']){ 28 if ($flux['args']['contexte'][_SPIP_PAGE] == $fond) { 29 30 // si on est sur un ?page=XX non trouve 31 if ($flux['args']['contexte'][_SPIP_PAGE] == $fond) { 29 32 // si c'est un objet spip, associe a une table, utiliser le fond homonyme 30 33 if (z_scaffoldable($fond)){ 31 34 $flux['data'] = substr(find_in_path("objet.$ext"), 0, - strlen(".$ext")); 32 35 } 36 // sinon, si brancher sur contenu/page-xx si elle existe 33 37 else { 34 $base = " contenu/page-".$fond.".".$ext;38 $base = "$contenu/page-".$fond.".".$ext; 35 39 if ($base = find_in_path($base)){ 36 40 $flux['data'] = substr(find_in_path("page.$ext"), 0, - strlen(".$ext")); … … 38 42 } 39 43 } 44 40 45 // scaffolding : 41 // si c'est un fond de contenu d'un objet spip46 // si c'est un fond de contenu d'un objet en base 42 47 // generer un fond automatique a la volee pour les webmestres 43 elseif (strncmp($fond, " contenu/", 8)==048 elseif (strncmp($fond, "$contenu/", strlen($contenu)+1)==0 44 49 AND include_spip('inc/autoriser') 50 AND isset($GLOBALS['visiteur_session']['id_auteur']) // performance 45 51 AND autoriser('webmestre')){ 46 $type = substr($fond, 8);52 $type = substr($fond,strlen($contenu)+1); 47 53 if ($is = z_scaffoldable($type)) 48 54 $flux['data'] = z_scaffolding($type,$is[0],$is[1],$is[2],$ext); 49 55 } 56 57 // sinon, si on demande un fond non trouve dans un des autres blocs 58 // et si il y a bien un contenu correspondant ou scaffoldable 59 // se rabbatre sur le dist.html du bloc concerne 50 60 else{ 51 61 if ( $dir = explode('/',$fond) 52 62 AND $dir = reset($dir) 53 AND in_array($dir,$ dir_dist)){63 AND in_array($dir,$z_blocs)){ 54 64 $type = substr($fond,strlen("$dir/")); 55 if (find_in_path(" contenu/$type.$ext") OR z_scaffoldable($type))65 if (find_in_path("$contenu/$type.$ext") OR z_scaffoldable($type)) 56 66 $flux['data'] = substr(find_in_path("$dir/dist.$ext"), 0, - strlen(".$ext")); 57 67 } … … 69 79 } 70 80 81 /** 82 * Tester si un type est scaffoldable 83 * cad si il correspond bien a un objet en base 84 * 85 * @staticvar array $scaffoldable 86 * @param string $type 87 * @return bool 88 */ 71 89 function z_scaffoldable($type){ 72 90 static $scaffoldable = array(); … … 84 102 return $scaffoldable[$type] = false; 85 103 } 104 105 106 /** 107 * Generer a la volee un fond a partir d'une table de contenu 108 * 109 * @param string $type 110 * @param string $table 111 * @param string $table_sql 112 * @param array $desc 113 * @param string $ext 114 * @return string 115 */ 86 116 function z_scaffolding($type,$table,$table_sql,$desc,$ext){ 87 117 include_spip('public/interfaces'); … … 173 203 } 174 204 205 /** 206 * Ajouter le inc-insert-head du theme si il existe 207 * 208 * @param string $flux 209 * @return string 210 */ 175 211 function Z_insert_head($flux){ 176 212 if (find_in_path('inc-insert-head.html')){ … … 238 274 } 239 275 276 /** 277 * Tester la presence sur une page 278 * @param <type> $p 279 * @return <type> 280 */ 281 function balise_SI_PAGE_dist($p) { 282 $_page = interprete_argument_balise(1,$p); 283 $p->code = "(((\$Pile[0][_SPIP_PAGE]==(\$zp=$_page)) OR (\$Pile[0]['composition']==\$zp AND \$Pile[0]['type']=='page'))?' ':'')"; 284 $p->interdire_scripts = false; 285 return $p; 286 } 287 240 288 ?>
Note: See TracChangeset
for help on using the changeset viewer.