maj syntaxe accolades et correction param manquant
[mw_pages] / out / dist / functions.php
index eae629a..f96e4b8 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
   if(!function_exists("datetime2timestamp")) :
-  function datetime2timestamp($string)
-  { list($date, $time) = explode(" ", $string);
+  function datetime2timestamp($string){
+    list($date, $time) = explode(" ", $string);
     list($year, $month, $day) = explode("-", $date);
     list($hour, $minute, $second) = explode(":", $time);
     $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
   endif;
 
   if(!function_exists("pages_arbo_navig_lis")) :
-  function pages_arbo_navig_lis($env, $arbo, $ariane = array())
-  { $content = "";
-    if($arbo["subs"])
-    { if($path_item = array_shift($ariane))
-      { foreach($arbo["subs"] as $page)
-        { $content .= "<li".($path_item["id"] == $page["id"] ? " class=\"current\"" : "")."><a href=\"".$env->url("pages/view/page", array("id" => $page["id"]))."\">".$page["title"]."</a></li>\n";
-          if($path_item["id"] == $page["id"])
-          { if($sub_content = pages_arbo_navig_lis($env, $page, $ariane))
-            { $content .=
+  function pages_arbo_navig_lis($env, $arbo, $ariane = array()){
+    $content = "";
+    if($arbo["subs"]){
+      if($path_item = array_shift($ariane)){
+        foreach($arbo["subs"] as $page){
+          $content .= "<li".($path_item["id"] == $page["id"] ? " class=\"current\"" : "")."><a href=\"".$env->url("pages/view/page", array("id" => $page["id"]))."\">".$page["title"]."</a></li>\n";
+          if($path_item["id"] == $page["id"]){
+            if($sub_content = pages_arbo_navig_lis($env, $page, $ariane)){
+              $content .=
                "<ul>\n"
               .$sub_content
               ."</ul>\n";
@@ -27,9 +27,9 @@
           }
         }
       }
-      else
-      { foreach($arbo["subs"] as $page)
-        { $content .= "<li><a href=\"".$env->url("pages/view/page", array("id" => $page["id"]))."\">".$page["title"]."</a></li>\n";
+      else{
+        foreach($arbo["subs"] as $page){
+          $content .= "<li><a href=\"".$env->url("pages/view/page", array("id" => $page["id"]))."\">".$page["title"]."</a></li>\n";
         }
       }
     }
@@ -38,8 +38,8 @@
   endif;
 
   if(!function_exists("pages_arbo_edit_select_options")) :
-  function pages_arbo_edit_select_options($arbo, $id_page, $id_parent, $indent_increment = "", $indent = "")
-  { $arbo["id"] = $arbo["id"] ? $arbo["id"] : "";
+  function pages_arbo_edit_select_options($arbo, $id_page, $id_parent, $indent_increment = "", $indent = ""){
+    $arbo["id"] = $arbo["id"] ? $arbo["id"] : "";
     $content =
      "<option"
     ." value=\"".$arbo["id"]."\""
     .">"
     .$indent.($arbo["id"] ? $arbo["title"] : "Aucune")
     ."</option>";
-    if($arbo["subs"])
-    { $indent .= $indent_increment;
-      foreach($arbo["subs"] as $i => $sub)
-      { if(!isset($id_page) || $id_page != $sub["id"])
-        { $content .= pages_arbo_edit_select_options($sub, $id_page, $id_parent, $indent_increment, $indent);
+    if($arbo["subs"]){
+      $indent .= $indent_increment;
+      foreach($arbo["subs"] as $i => $sub){
+        if(!isset($id_page) || $id_page != $sub["id"]){
+          $content .= pages_arbo_edit_select_options($sub, $id_page, $id_parent, $indent_increment, $indent);
         }
       }
     }
@@ -60,8 +60,8 @@
   endif;
 
   if(!function_exists("pages_arbo_list_select_options")) :
-  function pages_arbo_list_select_options($env, $etat, $arbo, $current_page_id, $indent_increment = "", $indent = "")
-  { $arbo["id"] = isset($arbo["id"]) ? $arbo["id"] : "";
+  function pages_arbo_list_select_options($env, $etat, $arbo, $current_page_id, $indent_increment = "", $indent = ""){
+    $arbo["id"] = isset($arbo["id"]) ? $arbo["id"] : "";
     $content =
      "<option"
     ." value=\"".$env->url($etat, array("parent" => $arbo["id"]))."\""
     .">"
     .$indent.($arbo["id"] ? $arbo["title"] : "Racine des pages")
     ."</option>";
-    if($arbo["subs"])
-    { $indent .= $indent_increment;
-      foreach($arbo["subs"] as $i => $sub)
-      { $content .= pages_arbo_list_select_options($env, $etat, $sub, $current_page_id, $indent_increment, $indent);
+    if($arbo["subs"]){
+      $indent .= $indent_increment;
+      foreach($arbo["subs"] as $i => $sub){
+        $content .= pages_arbo_list_select_options($env, $etat, $sub, $current_page_id, $indent_increment, $indent);
       }
     }
     return $content;
   endif;
 
   if(!function_exists("pages_arbo_start_select_options")) :
-  function pages_arbo_start_select_options($env, $arbo, $current_start_action, $current_start_action_params, $indent_increment = "", $indent = "")
-  { $arbo["id"] = isset($arbo["id"]) ? $arbo["id"] : "";
-    if($arbo["id"])
-    { $content =
+  function pages_arbo_start_select_options($env, $arbo, $current_start_action, $current_start_action_params, $indent_increment = "", $indent = ""){
+    $arbo["id"] = isset($arbo["id"]) ? $arbo["id"] : "";
+    if($arbo["id"]){
+      $content =
        "<option"
       ." value=\"".$arbo["id"]."\""
       .(    isset($current_start_action)
       .$indent.$arbo["title"]
       ."</option>";
     }
-    if($arbo["subs"])
-    { $indent .= $indent_increment;
+    if($arbo["subs"]){
+      $indent .= $indent_increment;
       $indent .= "&nbsp;&nbsp;";
-      foreach($arbo["subs"] as $i => $sub)
-      { $content .= pages_arbo_start_select_options($env, $sub, $current_start_action, $current_start_action_params, $indent_increment, $indent);
+      foreach($arbo["subs"] as $i => $sub){
+        $content .= pages_arbo_start_select_options($env, $sub, $current_start_action, $current_start_action_params, $indent_increment, $indent);
       }
     }
     return $content;