blog->url); # Liste des catégories $categories_combo = array(); $categories_label = array(); try { $rs = $core->blog->getCategories(array('post_type'=>'post')); while ($rs->fetch()) { $categories_combo[] = new formSelectOption( str_repeat('  ',$rs->level-1).($rs->level-1 == 0 ? '' : '• ').html::escapeHTML($rs->cat_title), $rs->cat_url ); $categories_label[$rs->cat_url] = html::escapeHTML($rs->cat_title); } } catch (Exception $e) { } # Liste des langues utilisées $langs_combo = array(); try { $rs = $core->blog->getLangs(array('order'=>'asc')); if ($rs->count() > 1) { $all_langs = l10n::getISOcodes(0,1); while ($rs->fetch()) { $lang_name = isset($all_langs[$rs->post_lang]) ? $all_langs[$rs->post_lang] : $rs->post_lang; $langs_combo[$lang_name] = $rs->post_lang; } unset($all_langs); } unset($rs); } catch (Exception $e) { } # Liste des mois d'archive $months_combo = array(); try { $rs = $core->blog->getDates(array('type'=>'month')); $months_combo[__('All months')] = '-'; $first_year = $last_year = 0; while ($rs->fetch()) { $months_combo[dt::str('%B %Y',$rs->ts())] = $rs->year().$rs->month(); if (($first_year == 0) || ($rs->year() < $first_year)) $first_year = $rs->year(); if (($last_year == 0) || ($rs->year() > $last_year)) $last_year = $rs->year(); } unset($rs); } catch (Exception $e) { } # Liste des pages -- Doit être pris en charge plus tard par le plugin ? $pages_combo = array(); try { $rs = $core->blog->getPosts(array('post_type'=>'page')); while ($rs->fetch()) { $pages_combo[$rs->post_title] = $rs->getURL(); } unset($rs); } catch (Exception $e) { } # Liste des tags -- Doit être pris en charge plus tard par le plugin ? $tags_combo = array(); try { $rs = $core->meta->getMetadata(array('meta_type' => 'tag')); $tags_combo[__('All tags')] = '-'; while ($rs->fetch()) { $tags_combo[$rs->meta_id] = $rs->meta_id; } unset($rs); } catch (Exception $e) { } # Liste des types d'item de menu $items = array('home' => array(__('Home'),false)); if (count($langs_combo) > 1) { $items['lang'] = array(__('Language'),true); } if (count($categories_combo)) { $items['category'] = array(__('Category'),true); } if (count($months_combo) > 1) { $items['archive'] = array(__('Archive'),true); } if ($core->plugins->moduleExists('pages')) { if(count($pages_combo)) $items['pages'] = array(__('Page'),true); } if ($core->plugins->moduleExists('tags')) { if (count($tags_combo) > 1) $items['tags'] = array(__('Tags'),true); } # --BEHAVIOR-- adminSimpleMenuAddType # Should add an item to $items as an array(