当前位置: 首页>>代码示例>>PHP>>正文


PHP Sections::get方法代码示例

本文整理汇总了PHP中Sections::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::get方法的具体用法?PHP Sections::get怎么用?PHP Sections::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sections的用法示例。


在下文中一共展示了Sections::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gmstrftime

     $fields['edit_date'] = gmstrftime('%Y-%m-%d %H:%M:%S', time());
     $fields['index_map'] = 'N';
     // not mentioned at the home page
     $fields['locked'] = 'Y';
     // no direct contributions
     $fields['options'] = 'no_contextual_menu';
     $fields['rank'] = 40000;
     // at the end of the list
     $fields['sections_layout'] = 'directory';
     $fields['title'] = i18n::c('Groups');
     if (!($fields['id'] = Sections::post($fields, FALSE))) {
         Logger::remember('sections/new.php: Impossible to add a section.');
         return;
     }
     // retrieve the new section
     $anchor = Sections::get('groups');
 }
 // we are creating a blog
 if (isset($_REQUEST['space_type']) && $_REQUEST['space_type'] == 'blog') {
     $_REQUEST['articles_layout'] = 'daily';
     $_REQUEST['articles_templates'] = 'simple_template';
     $_REQUEST['content_options'] = 'with_extra_profile with_neighbours';
     $_REQUEST['options'] = 'with_extra_profile';
     $_REQUEST['locked'] = 'Y';
     // only editors can contribute
     // we are creating a project
 } elseif (isset($_REQUEST['space_type']) && $_REQUEST['space_type'] == 'project') {
     $_REQUEST['articles_layout'] = 'none';
     $_REQUEST['locked'] = 'Y';
     // only section owner can create sub-sections
     $_REQUEST['options'] = 'view_as_tabs';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:new.php

示例2:

// compute extra information -- $context['extra']
//
// page tools
//
if (Surfer::is_associate()) {
    $context['page_tools'][] = Skin::build_link('configure.php', i18n::s('Configure'));
    if (isset($cover_page['id'])) {
        $context['page_tools'][] = Skin::build_link(Articles::get_permalink($cover_page), i18n::s('Cover page'), 'basic');
    }
    if (($section = Sections::get('gadget_boxes')) && isset($section['id'])) {
        $context['page_tools'][] = Skin::build_link(Sections::get_permalink($section), i18n::s('Gadget boxes'), 'basic');
    }
    if (($section = Sections::get('extra_boxes')) && isset($section['id'])) {
        $context['page_tools'][] = Skin::build_link(Sections::get_permalink($section), i18n::s('Extra boxes'), 'basic');
    }
    if (($section = Sections::get('navigation_boxes')) && isset($section['id'])) {
        $context['page_tools'][] = Skin::build_link(Sections::get_permalink($section), i18n::s('Navigation boxes'), 'basic');
    }
}
// save some database requests
$cache_id = 'index.php#extra_news';
if (!($text = Cache::get($cache_id))) {
    // show featured articles -- set in configure.php
    if (isset($context['root_featured_layout']) && $context['root_featured_layout'] != 'none') {
        // set in configure.php
        if (!isset($context['root_featured_count']) || $context['root_featured_count'] < 1) {
            $context['root_featured_count'] = 7;
        }
        // the category used to assign featured pages
        $anchor = Categories::get(i18n::c('featured'));
        if ($anchor['id'] && ($items =& Members::list_articles_by_date_for_anchor('category:' . $anchor['id'], 0, $context['root_featured_count'] + 1, 'news'))) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:index.php

示例3: parse_match

 /**
  * called from within a preg_replace_callback() in Article::parse()
  *
  */
 function parse_match($matches)
 {
     global $context;
     // useful if they are a lot of tags to process
     Safe::set_time_limit(30);
     switch ($matches[1]) {
         case 'anchor':
             $this->item['anchor'] = $matches[2];
             break;
         case 'author':
             if ($user = Users::get($matches[2])) {
                 $this->item['create_name'] = $user['nick_name'];
                 $this->item['create_id'] = $user['id'];
                 $this->item['create_address'] = $user['email'];
                 $this->item['publish_name'] = $user['nick_name'];
                 $this->item['publish_id'] = $user['id'];
                 $this->item['publish_address'] = $user['email'];
                 $this->item['edit_name'] = $user['nick_name'];
                 $this->item['edit_id'] = $user['id'];
                 $this->item['edit_address'] = $user['email'];
             }
             break;
         case 'blogid':
         case 'section':
             if ($section = Sections::get($matches[2])) {
                 $this->item['anchor'] = 'section:' . $section['id'];
             }
             break;
         case 'introduction':
             if (isset($this->item['introduction'])) {
                 $this->item['introduction'] .= $matches[2] . ' ';
             } else {
                 $this->item['introduction'] = $matches[2] . ' ';
             }
             break;
         case 'source':
             $this->item['source'] = $matches[2];
             break;
         case 'tags':
             // web form
         // web form
         case 'category':
             // xml-rpc
         // xml-rpc
         case 'categories':
             // legacy
             if (isset($this->item['tags'])) {
                 $this->item['tags'] .= $matches[2] . ' ';
             } else {
                 $this->item['tags'] = $matches[2] . ' ';
             }
             break;
         case 'title':
             if (isset($this->item['title'])) {
                 $this->item['title'] .= $matches[2] . ' ';
             } else {
                 $this->item['title'] = $matches[2] . ' ';
             }
             break;
         default:
             return $matches[0];
     }
     return '';
 }
开发者ID:rair,项目名称:yacs,代码行数:68,代码来源:article.php

示例4:

 // sollicitate users for feed-back
 $context['text'] .= '<p><input type="radio" name="action" value="petition" /> ' . i18n::s('Sollicitate users input -- create a petition, or a poll') . '</p>' . "\n";
 // create a forum
 $context['text'] .= '<p><input type="radio" name="action" value="forum" /> ' . i18n::s('Add a forum -- let people interact') . '</p>' . "\n";
 // create a blog
 $context['text'] .= '<p><input type="radio" name="action" value="blog" /> ' . i18n::s('Add a blog -- and share your feeling, your findings, your soul') . '</p>' . "\n";
 // create a wiki
 $context['text'] .= '<p><input type="radio" name="action" value="wiki" /> ' . i18n::s('Add a wiki -- to support collaborative work in a team of peers') . '</p>' . "\n";
 // post original work
 $context['text'] .= '<p><input type="radio" name="action" value="original" /> ' . i18n::s('Post original work -- in a section that will feature author\'s profiles') . '</p>' . "\n";
 // create a book
 $context['text'] .= '<p><input type="radio" name="action" value="book" /> ' . i18n::s('Add an electronic book, or a manual -- actually, a structured set of pages') . '</p>' . "\n";
 // create a section for polls
 $context['text'] .= '<p><input type="radio" name="action" value="polls" /> ' . i18n::s('Add a section for polls -- the most recent is active; previous polls are still listed') . '</p>' . "\n";
 // create a section for partners if none exists
 if (!Sections::get('partners')) {
     $context['text'] .= '<p><input type="radio" name="action" value="partners" /> ' . i18n::s('Add a section for partners -- the special people or sites that are supporting your site') . '</p>' . "\n";
 }
 // create a cookbook
 $context['text'] .= '<p><input type="radio" name="action" value="recipes" /> ' . i18n::s('Add a cookbook -- cooking recipes, the French secret to happiness') . '</p>' . "\n";
 // create a directory of links
 $context['text'] .= '<p><input type="radio" name="action" value="links" /> ' . i18n::s('Add a directory of links -- a small version of Yahoo!, or of DMOZ') . '</p>' . "\n";
 // create sample server profiles
 $context['text'] .= '<p><input type="radio" name="action" value="servers" /> ' . i18n::s('Add sample server profiles -- ping well-known news aggregator and become famous') . '</p>' . "\n";
 // create basic records
 $context['text'] .= '<p><input type="radio" name="action" value="build" /> ' . i18n::s('Add basic items -- in case you would need to replay some steps of the setup process') . '</p>' . "\n";
 // create a test environment
 if (file_exists($context['path_to_root'] . 'tools/populate.php')) {
     $context['text'] .= '<p><input type="radio" name="action" value="test" /> ' . i18n::s('Add sample items -- for test purpose') . '</p>' . "\n";
 }
 // the submit button
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:populate.php

示例5: load_by_id

 /**
  * load the related item
  *
  * @see shared/anchor.php
  *
  * @param int the id of the record to load
  * @param boolean TRUE to always fetch a fresh instance, FALSE to enable cache
  */
 function load_by_id($id, $mutable = FALSE)
 {
     $this->item = Sections::get($id, $mutable);
 }
开发者ID:rair,项目名称:yacs,代码行数:12,代码来源:section.php

示例6: put_template

 /**
  * change the template of a section
  *
  * This function saves the template as an attribute of the section.
  *
  * Also, it attempts to translate it as a valid YACS skin made
  * of [code]template.php[/code] and [code]skin.php[/code].
  * The theme name is [code]section_&lt;id&gt;[/code].
  *
  * Lastly, it updates the options field to actually use the template for pages of this section.
  *
  * @param int the id of the target section
  * @param string the new or updated template
  * @return string either a null string, or some text describing an error to be inserted into the html response
  *
  * @see services/blog.php
  * @see skins/import.php
  **/
 public static function put_template($id, $template, $directory = NULL)
 {
     global $context;
     // id cannot be empty
     if (!$id || !is_numeric($id)) {
         return i18n::s('No item has the provided id.');
     }
     // load section attributes
     if (!($item = Sections::get($id))) {
         return i18n::s('No item has the provided id.');
     }
     // locate the new skin
     if (!$directory) {
         $directory = 'section_' . $id;
     }
     // make a valid YACS skin
     include_once $context['path_to_root'] . 'skins/import.php';
     if ($error = Import::process($template, $directory)) {
         return $error;
     }
     // change the skin for this section
     $options = preg_replace('/\\bskin_.+\\b/i', '', $item['options']) . ' skin_' . $directory;
     // set default values for this editor
     Surfer::check_default_editor(array());
     // update an existing record
     $query = "UPDATE " . SQL::table_name('sections') . " SET " . "template='" . SQL::escape($template) . "',\n" . "options='" . SQL::escape($options) . "',\n" . "edit_name='" . SQL::escape($fields['edit_name']) . "',\n" . "edit_id=" . SQL::escape($fields['edit_id']) . ",\n" . "edit_address='" . SQL::escape($fields['edit_address']) . "',\n" . "edit_action='section:update',\n" . "edit_date='" . SQL::escape($fields['edit_date']) . "'\n" . "\tWHERE id = " . SQL::escape($id);
     SQL::query($query);
     // clear the cache because of the new rendering
     Sections::clear(array('sections', 'section:' . $id, 'categories'));
 }
开发者ID:rair,项目名称:yacs,代码行数:48,代码来源:sections.php

示例7: render

 /**
  * list dates at some anchor
  *
  * @param string type of replaced items (e.g., 'articles')
  * @param string the anchor to consider (e.g., 'section:123')
  * @param int page index
  * @return string to be inserted in resulting web page, or NULL
  */
 function render($type, $anchor, $page = 1)
 {
     global $context;
     // instead of articles
     if ($type != 'articles') {
         return NULL;
     }
     // get the containing page
     $container = Anchors::get($anchor);
     // handle dates
     include_once $context['path_to_root'] . 'dates/dates.php';
     // the maximum number of articles per page
     if (!defined('DATES_PER_PAGE')) {
         define('DATES_PER_PAGE', 50);
     }
     // where we are
     $offset = ($page - 1) * DATES_PER_PAGE;
     // should we display all dates, or not?
     $with_past_dates = FALSE;
     if (preg_match('/\\bwith_past_dates\\b/i', $this->attributes['overlay_parameters'])) {
         $with_past_dates = TRUE;
     }
     // menu to be displayed at the top
     $menu = array();
     // empowered users can contribute
     if (Articles::allow_creation(NULL, $container)) {
         Skin::define_img('ARTICLES_ADD_IMG', 'articles/add.gif');
         $menu[] = '<div style="display: inline">' . Skin::build_link('articles/edit.php?anchor=' . urlencode($anchor), ARTICLES_ADD_IMG . i18n::s('Add an event'), 'span') . '</div>';
     }
     // ensure access to past dates
     if (!$with_past_dates && ($items = Dates::list_past_for_anchor($anchor, $offset, DATES_PER_PAGE, 'compact'))) {
         // turn an array to a string
         if (is_array($items)) {
             $items =& Skin::build_list($items, 'compact');
         }
         // navigation bar
         $bar = array();
         // count the number of dates in this section
         $stats = Dates::stat_past_for_anchor($anchor);
         if ($stats['count'] > DATES_PER_PAGE) {
             $bar = array_merge($bar, array('_count' => sprintf(i18n::ns('%d date', '%d dates', $stats['count']), $stats['count'])));
         }
         // navigation commands for dates
         if ($section = Sections::get(str_replace('section:', '', $anchor))) {
             $home = Sections::get_permalink($section);
             $prefix = Sections::get_url($section['id'], 'navigate', 'articles');
             $bar = array_merge($bar, Skin::navigate($home, $prefix, $stats['count'], DATES_PER_PAGE, $page));
         }
         // display the bar
         if (is_array($bar)) {
             $items = Skin::build_list($bar, 'menu_bar') . $items;
         }
         // in a separate box
         $menu[] = Skin::build_sliding_box(i18n::s('Past dates'), $items, 'past_dates', TRUE);
     }
     // menu displayed towards the top of the page
     $text = Skin::finalize_list($menu, 'menu_bar');
     // build a list of events
     if (preg_match('/\\blayout_as_list\\b/i', $this->attributes['overlay_parameters'])) {
         // list all dates
         if ($with_past_dates) {
             // navigation bar
             $bar = array();
             // count the number of dates in this section
             $stats = Dates::stat_for_anchor($anchor);
             if ($stats['count'] > DATES_PER_PAGE) {
                 $bar = array_merge($bar, array('_count' => sprintf(i18n::ns('%d date', '%d dates', $stats['count']), $stats['count'])));
             }
             // navigation commands for dates
             $section = Sections::get($anchor);
             $home = Sections::get_permalink($section);
             $prefix = Sections::get_url($section['id'], 'navigate', 'articles');
             $bar = array_merge($bar, Skin::navigate($home, $prefix, $stats['count'], DATES_PER_PAGE, $page));
             // display the bar
             if (count($bar)) {
                 $text .= Skin::build_list($bar, 'menu_bar');
             }
             // list one page of dates
             if ($items = Dates::list_for_anchor($anchor, $offset, DATES_PER_PAGE, 'family')) {
                 $text .= $items;
             }
             // display only future dates to regular surfers
         } else {
             // show future dates on first page
             if ($page == 1 && ($items = Dates::list_future_for_anchor($anchor, 0, 500, 'family', TRUE))) {
                 $text .= $items;
             }
         }
         // deliver a calendar view for current month, plus months around
     } else {
         // show past dates as well
         if ($with_past_dates) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:event.php

示例8: sprintf

     $fields['content_options'] = 'auto_publish';
     // these will be reviewed anyway
     $fields['index_map'] = 'N';
     // listed with special sections
     $fields['introduction'] = i18n::c('Models to be duplicated');
     $fields['locked'] = 'Y';
     // only associates can contribute
     $fields['title'] = i18n::c('Templates');
     if (Sections::post($fields)) {
         $text .= sprintf(i18n::s('A section "%s" has been created.'), $fields['title']) . BR . "\n";
     } else {
         $text .= Logger::error_pop() . BR . "\n";
     }
 }
 // 'threads' section
 if (!Sections::get('threads')) {
     $fields = array();
     $fields['nick_name'] = 'threads';
     $fields['articles_layout'] = 'yabb';
     // these are threads
     $fields['articles_templates'] = 'information_template, question_template, chat_template, event_template';
     $fields['content_options'] = 'auto_publish with_export_tools with_neighbours';
     $fields['index_map'] = 'N';
     // listed with special sections
     $fields['introduction'] =& i18n::c('For standalone pages');
     $fields['maximum_items'] = 20000;
     // limit the overall number of threads
     $fields['title'] =& i18n::c('Threads');
     if (Sections::post($fields)) {
         $text .= sprintf(i18n::s('A section "%s" has been created.'), $fields['title']) . BR . "\n";
     } else {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:populate.php

示例9: elseif

        $menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('View the section'), 'span');
        $menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), i18n::s('Manage it'), 'span');
        $follow_up .= Skin::finalize_list($menu, 'menu_bar');
        $context['text'] .= Skin::build_block($follow_up, 'bottom');
        // nothing to do
    } else {
        Logger::error(i18n::s('No page has been selected.'));
    }
    // unlock pages
} elseif ($action == 'unlock_sections') {
    // sections
    if (isset($_REQUEST['selected_sections'])) {
        $count = 0;
        foreach ($_REQUEST['selected_sections'] as $dummy => $id) {
            // an section to lock
            if (($section = Sections::get($id)) && $section['locked'] == 'Y') {
                $attributes = array();
                $attributes['id'] = $section['id'];
                $attributes['locked'] = 'N';
                $attributes['silent'] = 'Y';
                // too minor to be noted
                if (Sections::put_attributes($attributes)) {
                    $count++;
                }
            }
        }
        // clear cache for containing section
        Sections::clear($item);
        // report on results
        $context['text'] .= '<p>' . sprintf(i18n::ns('%d section has been unlocked.', '%d sections have been unlocked.', $count), $count) . '</p>';
        // follow-up commands
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:manage.php

示例10: array_merge

            $menu = array_merge($menu, array(Surfer::get_permalink() => i18n::s('Back to my profile')));
        }
        if (count($menu)) {
            $context['text'] .= Skin::build_block(i18n::s('Where do you want to go now?') . Skin::build_list($menu, 'menu_bar'), 'bottom');
        }
    }
} elseif ($with_form) {
    // target user statut doen't allow MP, except from associates
    if (!Surfer::is_associate() && ($overlay->attributes['user_status'] == 'donotdisturb' || $overlay->attributes['user_status'] == 'anonymous' || $item['without_alerts'] == 'Y')) {
        $context['text'] .= '<p>' . sprintf(i18n::s('Sorry, "%s" wish not to receive private message'), $item['nick_name']) . '</p>' . "\n";
        render_skin();
        finalize_page(TRUE);
    }
    $context['text'] .= Users::get_thread_creation_form($item['id']);
    // layout the available contact options
} elseif ($threads = Sections::get('threads')) {
    // do not link to this user profile
    //include_once $context['path_to_root'].'articles/layout_articles_as_timeline.php';
    //$layout = new Layout_articles_as_timeline();
    //$layout->set_variant($item['id']);
    $layout = layouts::new_('last', 'article');
    // i am looking at my own record
    if (Surfer::get_id() == $item['id']) {
        Skin::define_img('ARTICLES_ADD_IMG', 'articles/add.gif');
        $url = 'users/contact.php?start=Y&overlaid=Y';
        $label = ARTICLES_ADD_IMG . i18n::s('Start a new thread');
        // new theard is overlaid
        $label = array(null, $label, null, 'edit-overlaid');
        $menu_top = array($url => $label);
        $context['text'] .= Skin::build_list($menu_top, 'menu_bar');
        $context['text'] .= Members::list_surfer_threads(0, 50, $layout);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:contact.php

示例11: foreach

        $offset = ($page - 1) * $items_per_page;
        if (!($text = Links::list_by_date($offset, $items_per_page, $layout))) {
            $text = '<p>' . i18n::s('No link has been recorded yet.') . '</p>';
        }
        // we have an array to format
        if (is_array($text)) {
            $text =& Skin::build_list($text, 'decorated');
        }
        // cache this to speed subsequent queries
        Cache::put($cache_id, $text, 'links');
    }
    $context['text'] .= $text;
}
// page tools
if (Surfer::is_associate()) {
    if ($section = Sections::get('clicks')) {
        $context['page_tools'][] = Skin::build_link(Sections::get_permalink($section), i18n::s('Detected clicks'), 'basic');
    }
    $context['page_tools'][] = Skin::build_link('links/check.php', i18n::s('Maintenance'), 'basic');
}
// page extra content
$cache_id = 'links/index.php#extra';
if (!($text = Cache::get($cache_id))) {
    // side bar with the list of most popular links
    if ($items = Links::list_by_hits(0, COMPACT_LIST_SIZE, 'compact')) {
        $text .= Skin::build_box(i18n::s('Popular'), Skin::build_list($items, 'compact'), 'boxes');
    }
    // side boxes for related categories, if any
    if ($categories = Categories::list_by_date_for_display('link:index', 0, 7, 'raw')) {
        foreach ($categories as $id => $attributes) {
            // link to the category page from the box title
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:index.php

示例12: parse_tag_close

 function parse_tag_close($parser, $tag)
 {
     global $context;
     global $in_overlay, $overlay_class, $overlay_parameters;
     global $parsed_cdata, $parsed_item, $parsed_overlay, $parsing_report;
     // save gathered data if necessary
     switch ($tag) {
         case 'article':
             // end of article
             // transcode owner id
             $parsed_item['owner_id'] = Surfer::get_id();
             if (isset($parsed_item['owner_nick_name']) && ($user = Users::get($parsed_item['owner_nick_name']))) {
                 $parsed_item['owner_id'] = $user['id'];
             }
             // transcode creator id
             $parsed_item['create_id'] = Surfer::get_id();
             if (isset($parsed_item['create_nick_name']) && ($user = Users::get($parsed_item['create_nick_name']))) {
                 $parsed_item['create_id'] = $user['id'];
             }
             // transcode editor id
             $parsed_item['edit_id'] = Surfer::get_id();
             if (isset($parsed_item['edit_nick_name']) && ($user = Users::get($parsed_item['edit_nick_name']))) {
                 $parsed_item['edit_id'] = $user['id'];
             }
             // transcode publisher id
             $parsed_item['publish_id'] = Surfer::get_id();
             if (isset($parsed_item['publish_nick_name']) && ($user = Users::get($parsed_item['publish_nick_name']))) {
                 $parsed_item['publish_id'] = $user['id'];
             }
             // bind to given overlay
             $overlay = NULL;
             if ($overlay_class) {
                 $overlay = Overlay::bind($overlay_class . ' ' . $overlay_parameters);
             }
             // when the page has been overlaid
             if (is_object($overlay)) {
                 // update the overlay from content
                 foreach ($parsed_overlay as $label => $value) {
                     $overlay->attributes[$label] = $value;
                 }
                 // save content of the overlay in this item
                 $parsed_item['overlay'] = $overlay->save();
                 $parsed_item['overlay_id'] = $overlay->get_id();
             }
             // find anchor from handle
             if (isset($parsed_item['anchor_handle']) && ($reference = Sections::lookup($parsed_item['anchor_handle']))) {
                 $parsed_item['anchor'] = $reference;
             }
             // update an existing page
             if (isset($parsed_item['handle']) && ($item = Articles::get($parsed_item['handle']))) {
                 // transcode page id
                 $parsed_item['id'] = $item['id'];
                 // stop on error
                 if (!Articles::put($parsed_item) || is_object($overlay) && !$overlay->remember('update', $parsed_item, 'article:' . $item['id'])) {
                     Logger::error(sprintf('Unable to save article %s', $parsed_item['title'] . ' (' . $parsed_item['id'] . ')'));
                 }
                 // create a new page
             } else {
                 unset($parsed_item['id']);
                 // stop on error
                 if (!($parsed_item['id'] = Articles::post($parsed_item))) {
                     Logger::error(sprintf('Unable to save article %s', $parsed_item['title']));
                 } else {
                     // save overlay content
                     if (is_object($overlay)) {
                         $overlay->remember('insert', $parsed_item, 'article:' . $parsed_item['id']);
                     }
                 }
             }
             // report to surfer
             $parsing_report .= '<li>' . Skin::build_link(Articles::get_permalink($parsed_item), $parsed_item['title']) . "</li>\n";
             // ready for next item
             $overlay_class = NULL;
             $overlay_parameters = '';
             $parsed_overlay = array();
             $parsed_item = array();
             Safe::set_time_limit(30);
             break;
         case 'overlay':
             // end of overlay data
             $in_overlay = FALSE;
             break;
         case 'section':
             // end of section
             // transcode owner id
             $parsed_item['owner_id'] = Surfer::get_id();
             if (isset($parsed_item['owner_nick_name']) && ($user = Users::get($parsed_item['owner_nick_name']))) {
                 $parsed_item['owner_id'] = $user['id'];
             }
             // transcode creator id
             $parsed_item['create_id'] = Surfer::get_id();
             if (isset($parsed_item['create_nick_name']) && ($user = Users::get($parsed_item['create_nick_name']))) {
                 $parsed_item['create_id'] = $user['id'];
             }
             // transcode editor id
             $parsed_item['edit_id'] = Surfer::get_id();
             if (isset($parsed_item['edit_nick_name']) && ($user = Users::get($parsed_item['edit_nick_name']))) {
                 $parsed_item['edit_id'] = $user['id'];
             }
             // bind to given overlay
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:import.php

示例13: strip_tags

}
$id = strip_tags($id);
// load localized strings
i18n::bind('root');
// load the skin
load_skin('go');
// the title of the page
$context['page_title'] = i18n::s('Page locator');
// ensure we have a non-empty string
if (!($id = trim($id)) || !preg_match('/\\w/', $id)) {
    $context['text'] .= '<p>' . i18n::s('Please indicate a nick name to look for.') . "</p>\n";
    // short link to some article
} elseif (!strncmp($id, 'a~', 2) && ($item = Articles::get(restore_number(substr($id, 2))))) {
    Safe::redirect(Articles::get_permalink($item));
    // short link to some section
} elseif (!strncmp($id, 's~', 2) && ($item = Sections::get(restore_number(substr($id, 2))))) {
    Safe::redirect(Sections::get_permalink($item));
    // look in sections
} elseif ($items =& Sections::list_for_name($id, NULL, 'full')) {
    // only one section has this name
    if (count($items) == 1) {
        list($url, $attributes) = each($items);
        Safe::redirect($url);
    }
    // splash
    $context['text'] .= '<p>' . i18n::s('Select below among available sections.') . '</p>';
    // several pages
    $context['text'] .= Skin::build_list($items, 'decorated');
    // look in categories
} elseif (($item = Categories::get($id)) || ($item =& Categories::get_by_keyword($id))) {
    Safe::redirect(Categories::get_permalink($item));
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:go.php

示例14: elseif

// common definitions and initial processing
include_once '../shared/global.php';
// check network credentials, if any
if ($user = Users::authenticate()) {
    Surfer::empower($user['capability']);
}
// look for the id
$id = NULL;
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
} elseif (isset($context['arguments'][0])) {
    $id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Sections::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor']) && $item['anchor']) {
    $anchor = Anchors::get($item['anchor']);
}
// editors have associate-like capabilities
if (isset($item['id']) && Sections::is_assigned($item['id']) || is_object($anchor) && $anchor->is_assigned()) {
    Surfer::empower();
}
// load the skin, maybe with a variant
load_skin('sections', $anchor, isset($item['options']) ? $item['options'] : '');
// stop crawlers
if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    die(i18n::s('You are not allowed to perform this operation.'));
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:describe.php

示例15: array

 } else {
     $fields = array();
     $fields['nick_name'] = 'links';
     $fields['title'] = i18n::c('Links');
     $fields['introduction'] = i18n::c('Social bookmarking section');
     $fields['options'] = 'with_links';
     // enable link upload
     $fields['articles_layout'] = 'none';
     if (Sections::post($fields)) {
         $text .= sprintf(i18n::s('A section "%s" has been created.'), $fields['nick_name']) . BR . "\n";
     } else {
         $text .= Logger::error_pop() . BR . "\n";
     }
 }
 // 'my_section' section
 if (Sections::get('my_section')) {
     $text .= sprintf(i18n::s('A section "%s" already exists.'), 'my_section') . BR . "\n";
 } else {
     $fields = array();
     $fields['nick_name'] = 'my_section';
     $fields['title'] = i18n::c('My Section');
     $fields['introduction'] = i18n::c('Sample plain section');
     $fields['content_options'] = 'with_export_tools';
     if (Sections::post($fields)) {
         $text .= sprintf(i18n::s('A section "%s" has been created.'), $fields['nick_name']) . BR . "\n";
     } else {
         $text .= Logger::error_pop() . BR . "\n";
     }
 }
 // categories
 //
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:populate.php


注:本文中的Sections::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。