コード例 #1
0
ファイル: sections.php プロジェクト: rair/yacs
 /**
  * get the id of one section knowing its nick name
  *
  * At the moment following section nick names are used throughout yacs:
  * - 'clicks' - to host external link that are embed into ordinary pages
  * - 'covers' - pages to be displayed as introductory articles at the front page
  * - 'forum' - the coffee machine, for those that are not drinking so much coffee
  * - 'extra_boxes' - page to be displayed as small boxes at the front page
  * - 'letters' - pages sent by e-mail to subscribers
  * - 'menus' - page to be displayed on all pages as the main site menu
  * - 'my_section' - sample section for demonstrattion purpose
  * - 'navigation_boxes' - pages to be displayed as small boxes on all pages
  * - 'partners' - pages dedicated to external partners
  * - 'queries' - pages sent by surfers to submit their queries to the webmaster
  *
  * @param string the nick name looked for
  * @return string either 'section:<id>', or NULL
  *
  * @see articles/populate.php
  * @see articles/review.php
  * @see index.php
  * @see letters/index.php
  * @see letters/new.php
  * @see links/index.php
  * @see links/links.php
  */
 public static function lookup($nick_name)
 {
     global $context;
     // the section already exists
     if ($item = Sections::get($nick_name)) {
         return 'section:' . $item['id'];
     }
     // attempt to create a default item
     Sections::post_default($nick_name);
     // do the check again
     if ($item = Sections::get($nick_name)) {
         return 'section:' . $item['id'];
     }
     // tough luck
     return NULL;
 }