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


PHP Sections::get_permalink方法代码示例

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


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

示例1: layout

 /**
  * list sections
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return some text
     $text = '';
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // we want to make it visual
         if (!$item['thumbnail_url']) {
             continue;
         }
         // a title for the image --do not force a title
         if (isset($item['title'])) {
             $title = $item['title'];
         } else {
             $title = '';
         }
         // the url to view this item
         $url = Sections::get_permalink($item);
         // use the skin to shape it
         $text .= Skin::build_image('thumbnail', $item['thumbnail_url'], $title, $url);
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:39,代码来源:layout_sections_as_thumbnails.php

示例2: layout

 /**
  * list sections
  *
  * @param resource the SQL result
  * @return an array of $url => (NULL, $title, NULL, 'section_123', NULL, 'visit this section')
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // no hovering label
     $href_title = '';
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // the url to view this item
         $url = Sections::get_permalink($item);
         // initialize variables
         $prefix = $suffix = '';
         // list all components for this item
         $items[$url] = array($prefix, ucfirst(Skin::strip($item['index_title'], 30)), $suffix, 'section_' . $item['id'], NULL, $href_title);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:33,代码来源:layout_sections_as_main_tabs.php

示例3: layout

 /**
  * list sections as an index
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // referenced items
     $letters = array();
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // build a list of sections
     while ($item = SQL::fetch($result)) {
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // the url to view this item
         $url = Sections::get_permalink($item);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // reset everything
         $prefix = $label = $suffix = $icon = $details = '';
         // signal restricted and private sections
         if (isset($item['active']) && $item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif (isset($item['active']) && $item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag sections updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= ' ' . NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= ' ' . UPDATED_FLAG;
         }
         // make a link
         $label = $prefix . Skin::build_link($url, $title, 'basic') . $suffix;
         // the associated letter
         $letter = strtoupper(ltrim($title[0]));
         if ($letter < 'A' || $letter > 'Z') {
             $letter = '#';
         }
         // a new entry for this letter
         if (!isset($letters[$letter])) {
             $letters[$letter] = array();
         }
         $letters[$letter][] = $label;
     }
     // mention all letters at the top
     $bar = array();
     // all potential letters, in expected order
     $all = '#ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     for ($index = 0; $index < strlen($all); $index++) {
         $letter = $all[$index];
         // some content for this letter
         if (isset($letters[$letter])) {
             // internal link to the right place
             $bar[] = Skin::build_link('#letter' . $letter, $letter, 'span');
             // actual content for this letter
             $content = '<ul class="index"><li>' . join('</li><li>', $letters[$letter]) . '</li></ul>';
             // content displayed in the page
             $text .= Skin::build_header_box($letter, $content, 'letter' . $letter);
             // no content for this letter
         } else {
             $bar[] = $letter;
         }
     }
     // insert local links at the top
     $text = Skin::finalize_list($bar, 'menu_bar') . $text;
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:83,代码来源:layout_sections_as_directory.php

示例4: encode_field

 // the form to link additional sections
 if (!is_array($sections) || count($sections) < SECTIONS_LIST_SIZE) {
     $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . i18n::s('To assign a section, look in the content tree below and assign one section at a time') . BR . '<select name="member">' . Sections::get_options(NULL, $sections) . '</select>' . ' ' . Skin::build_submit_button(' >> ') . '<input type="hidden" name="anchor" value="' . encode_field($anchor->get_reference()) . '">' . '<input type="hidden" name="action" value="set">' . '</p></form>' . "\n";
 }
 // splash
 $context['text'] .= '<p style="margin-top: 2em;">' . sprintf(i18n::s('This is the list of sections assigned to %s'), $anchor->get_title()) . '</p>';
 // layout assigned sections
 if ($sections) {
     // browse the list
     foreach ($sections as $id => $section) {
         // get the related overlay, if any
         $overlay = Overlay::load($section, 'section:' . $id);
         // get parent anchor
         $parent = Anchors::get($section['anchor']);
         // the url to view this item
         $url = Sections::get_permalink($section);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $section));
         } else {
             $title = Codes::beautify_title($section['title']);
         }
         // initialize variables
         $prefix = $suffix = $icon = '';
         // flag sticky pages
         if ($section['rank'] < 10000) {
             $prefix .= STICKY_FLAG;
         }
         // signal restricted and private sections
         if ($section['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select.php

示例5: layout

 /**
  * list sections as topics in a forum
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // layout in a table
     $text = Skin::table_prefix('wide');
     // 'even' is used for title rows, 'odd' for detail rows
     $class_title = 'odd';
     $class_detail = 'even';
     // build a list of sections
     $family = '';
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // change the family
         if ($item['family'] != $family) {
             $family = $item['family'];
             // show the family
             $text .= Skin::table_suffix() . '<h2><span>' . $family . '&nbsp;</span></h2>' . "\n" . Skin::table_prefix('wide');
         }
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // reset everything
         $prefix = $label = $suffix = $icon = '';
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // indicate the id in the hovering popup
         $hover = i18n::s('View the section');
         if (Surfer::is_member()) {
             $hover .= ' [section=' . $item['id'] . ']';
         }
         // the url to view this item
         $url = Sections::get_permalink($item);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // use the title as a link to the page
         $title =& Skin::build_link($url, $title, 'basic', $hover);
         // flag sections updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $suffix = EXPIRED_FLAG . ' ';
         } elseif ($item['create_date'] >= $context['fresh']) {
             $suffix = NEW_FLAG . ' ';
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix = UPDATED_FLAG . ' ';
         }
         // this is another row of the output
         $text .= '<tr class="' . $class_title . '"><th>' . $prefix . $title . $suffix . '</th><th>' . i18n::s('Poster') . '</th><th>' . i18n::s('Messages') . '</th><th>' . i18n::s('Last active') . '</th></tr>' . "\n";
         $count = 1;
         // get last posts for this board --avoid sticky pages
         if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
             $order = $matches[1];
         } else {
             $order = 'edition';
         }
         if ($articles =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], 0, 5, 'raw', TRUE)) {
             foreach ($articles as $id => $article) {
                 // get the related overlay, if any
                 $article_overlay = Overlay::load($article, 'article:' . $id);
                 // flag articles updated recently
                 if ($article['expiry_date'] > NULL_DATE && $article['expiry_date'] <= $context['now']) {
                     $flag = EXPIRED_FLAG . ' ';
                 } elseif ($article['create_date'] >= $context['fresh']) {
                     $flag = NEW_FLAG . ' ';
                 } elseif ($article['edit_date'] >= $context['fresh']) {
                     $flag = UPDATED_FLAG . ' ';
                 } else {
                     $flag = '';
                 }
                 // use the title to label the link
                 if (is_object($article_overlay)) {
                     $title = Codes::beautify_title($article_overlay->get_text('title', $article));
                 } else {
                     $title = Codes::beautify_title($article['title']);
                 }
                 // title
                 $title = Skin::build_link(Articles::get_permalink($article), $title, 'article');
                 // poster
                 $poster = Users::get_link($article['create_name'], $article['create_address'], $article['create_id']);
                 // comments
                 $comments = Comments::count_for_anchor('article:' . $article['id']);
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_sections_as_jive.php

示例6:

//
// 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'))) {
            // link to the category page from the box title
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:index.php

示例7: array

                Sections::post($fields);
            }
        }
        // increment the post counter of the surfer
        Users::increment_posts(Surfer::get_id());
        // reward the poster
        $context['page_title'] = i18n::s('Congratulation, you have successfully added a new web space');
        // follow-up commands
        $follow_up = i18n::s('What do you want to do now?');
        $menu = array();
        if ($_REQUEST['space_type'] == 'blog') {
            $menu = array_merge($menu, array(Sections::get_permalink($_REQUEST) => i18n::s('View the new blog')));
        } elseif ($_REQUEST['space_type'] == 'project') {
            $menu = array_merge($menu, array(Sections::get_permalink($_REQUEST) => i18n::s('View the new project')));
        } else {
            $menu = array_merge($menu, array(Sections::get_permalink($_REQUEST) => i18n::s('View the new group')));
        }
        if (Surfer::may_upload()) {
            $menu = array_merge($menu, array('images/edit.php?anchor=' . urlencode('section:' . $_REQUEST['id']) => i18n::s('Add an image')));
        }
        if (preg_match('/\\bwith_files\\b/i', $section->item['options']) && Surfer::may_upload()) {
            $menu = array_merge($menu, array('files/edit.php?anchor=' . urlencode('section:' . $_REQUEST['id']) => i18n::s('Add a file')));
        }
        if (preg_match('/\\bwith_links\\b/i', $section->item['options'])) {
            $menu = array_merge($menu, array('links/edit.php?anchor=' . urlencode('section:' . $_REQUEST['id']) => i18n::s('Add a link')));
        }
        $follow_up .= Skin::build_list($menu, 'menu_bar');
        $context['text'] .= $follow_up;
    }
    // display the form on GET
} else {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:new.php

示例8: switch

            // feed-back on contributor scope
            switch ($_REQUEST['contribution']) {
                case 'Y':
                    $context['text'] .= '<p>' . i18n::s('Any surfer is allowed to contribute anonymously to this wiki. Internet robots are prevented to submit new posts, however you should continuously review content to avoid unappropriate material.') . '</p>';
                    break;
                case 'R':
                    $context['text'] .= '<p>' . i18n::s('Any authenticated member of the community is allowed to contribute to this wiki. You should control community membership to avoid unappropriate material.') . '</p>';
                    break;
                case 'N':
                    $context['text'] .= '<p>' . i18n::s('You have selected to implement a private wiki. Assign individual members as editors of this wiki to enable contributions beyond associates.') . '</p>';
                    break;
            }
            // follow-up commands
            $follow_up = i18n::s('What do you want to do now?');
            $menu = array();
            $menu = array_merge($menu, array(Sections::get_permalink($fields) => i18n::s('Access the new wiki')));
            if (Surfer::may_upload()) {
                $menu = array_merge($menu, array('images/edit.php?anchor=' . urlencode('section:' . $fields['id']) => i18n::s('Add an image')));
            }
            $menu = array_merge($menu, array('help/populate.php' => i18n::s('Launch the Content Assistant again')));
            $menu = array_merge($menu, array('control/' => i18n::s('Control Panel')));
            $follow_up .= Skin::build_list($menu, 'menu_bar');
            $context['text'] .= Skin::build_block($follow_up, 'bottom');
            // new content has been created
            Logger::remember('help/populate.php: content assistant has created new content');
        }
    }
    // make the user select an option
} else {
    // the splash message
    $context['text'] .= '<p>' . i18n::s('This script will help to structure content for your server. Please select below the action you would like to perform.Depending on your choice, the assistant may ask for additional parameters on successive panels.') . '</p>';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:populate.php

示例9: load_skin

load_skin('sitemap');
// get the list from the cache, if possible
$cache_id = Cache::hash('sitemap') . '.xml';
// save for 5 minutes
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
    $text = '';
    // the preamble
    $text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n";
    // the front page
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . '</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '		<priority>1.0</priority>' . "\n" . '	</url>' . "\n\n";
    // the site map
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . 'sections/</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '		<priority>1.0</priority>' . "\n" . '	</url>' . "\n\n";
    // main sections
    if ($items = Sections::list_by_title_for_anchor(NULL, 0, 25, 'raw')) {
        foreach ($items as $id => $item) {
            $text .= '	<url>' . "\n" . '		<loc>' . encode_link(Sections::get_permalink($item)) . '</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '	</url>' . "\n\n";
        }
    }
    // the categories tree
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . 'categories/</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '		<priority>0.7</priority>' . "\n" . '	</url>' . "\n\n";
    // main categories
    if ($items = Categories::list_by_date(0, 25, 'raw')) {
        foreach ($items as $id => $item) {
            $text .= '	<url>' . "\n" . '		<loc>' . encode_link(Categories::get_permalink($item)) . '</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '	</url>' . "\n\n";
        }
    }
    // members
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . 'users/</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '		<priority>0.7</priority>' . "\n" . '	</url>' . "\n\n";
    // the OPML feed
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . 'feeds/describe.php</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '	</url>' . "\n\n";
    // the postamble
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:sitemap.php

示例10: elseif

    // do the job
} elseif (!count($context['error'])) {
    // look for the user through his nick name
    if (isset($_REQUEST['assigned_name']) && ($user = Users::get($_REQUEST['assigned_name']))) {
        $_REQUEST['anchor'] = 'user:' . $user['id'];
    }
    // transfer ownership
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'set' && isset($_REQUEST['anchor'])) {
        // assign a user, and also update his watch list
        $attributes = array('id' => $item['id'], 'owner_id' => $user['id']);
        Sections::put_attributes($attributes);
        Members::assign($_REQUEST['anchor'], 'section:' . $item['id']);
        Members::assign('section:' . $item['id'], $_REQUEST['anchor']);
        $context['text'] .= '<p>' . sprintf(i18n::s('Current owner is %s'), Users::get_link($user['full_name'], $user['email'], $user['id'])) . '</p>';
        // name current owner
    } elseif (isset($item['owner_id']) && ($owner = Users::get($item['owner_id']))) {
        $context['text'] .= '<p>' . sprintf(i18n::s('Current owner is %s'), Users::get_link($owner['full_name'], $owner['email'], $owner['id'])) . '</p>';
    }
    // delegate to another person
    $context['text'] .= '<p style="margin-top: 2em;">' . i18n::s('To transfer ownership to another person, type some letters of the name you are looking for.') . '</p>';
    // the form to link additional users
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . '<input type="text" name="assigned_name" id="assigned_name" size="45" maxlength="255" />' . '<input type="hidden" name="id" value="' . encode_field($item['id']) . '" />' . '<input type="hidden" name="action" value="set" />' . ' <input type="submit" id="submit_button" value="' . i18n::s('Submit') . '" style="display: none;" />' . '</p></form>' . "\n";
    // enable autocompletion
    Page::insert_script('$(function() {' . "\n" . '	$("#name").focus();' . "\n" . '	Yacs.autocomplete_names("assigned_name",true, "", function(data) { $("#submit_button").show().click(); });' . "\n" . '});' . "\n");
    // back to the anchor page
    $links = array();
    $links[] = Skin::build_link(Sections::get_permalink($item) . '#_users', i18n::s('Done'), 'button');
    $context['text'] .= Skin::finalize_list($links, 'assistant_bar');
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:own.php

示例11: layout

 /**
  * list sections
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return some text
     $text = '';
     // maximum number of items
     if (isset($this->layout_variant) && $this->layout_variant > 3) {
         $maximum_items = $this->layout_variant;
     } elseif (defined('YAHOO_LIST_SIZE')) {
         $maximum_items = YAHOO_LIST_SIZE;
     } else {
         $maximum_items = 7;
     }
     // stack of items
     $items = array();
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     $family = '';
     while ($item = SQL::fetch($result)) {
         // change the family
         if ($item['family'] != $family) {
             // flush current stack, if any
             if (count($items)) {
                 $text .= Skin::build_list($items, '2-columns');
             }
             $items = array();
             // show the family
             $family = $item['family'];
             $text .= '<h2><span>' . $family . '&nbsp;</span></h2>' . "\n";
         }
         // the url to view this item
         $url = Sections::get_permalink($item);
         // initialize variables
         $prefix = $label = $suffix = $icon = '';
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag sections that are draft, dead, or created or updated very recently
         if ($item['activation_date'] >= $context['now']) {
             $prefix .= DRAFT_FLAG;
         } elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // details and content
         $details = array();
         $content = array();
         // count related sub-elements
         $related_count = 0;
         // info on related articles
         if ($count = Articles::count_for_anchor('section:' . $item['id'])) {
             if ($count > $maximum_items) {
                 $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
             } elseif (Surfer::is_empowered()) {
                 $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
             }
             $related_count += $count;
             // get the overlay for content of this section, if any
             $content_overlay = NULL;
             if (isset($item['content_overlay'])) {
                 $content_overlay = Overlay::bind($item['content_overlay']);
             }
             // no room to list articles
             if (count($content) >= $maximum_items) {
             } elseif (is_object($content_overlay) && is_callable(array($content_overlay, 'render_list_for_anchor'))) {
                 if ($related = $content_overlay->render_list_for_anchor('section:' . $item['id'], $maximum_items - count($content))) {
                     foreach ($related as $sub_url => $label) {
                         $sub_prefix = $sub_suffix = $sub_hover = '';
                         if (is_array($label)) {
                             $sub_prefix = $label[0];
                             $sub_suffix = $label[2];
                             if (@$label[5]) {
                                 $sub_hover = $label[5];
                             }
                             $label = $label[1];
                         }
                         $content[] = $sub_prefix . Skin::build_link($sub_url, $label, 'basic', $sub_hover) . $sub_suffix;
                     }
                 }
                 // regular rendering of related articles
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_sections_as_yahoo.php

示例12: layout

 /**
  * list articles as slashdot do
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // layout in a table
     $text = Skin::table_prefix('wide');
     // 'even' is used for title rows, 'odd' for detail rows
     $class_title = 'odd';
     $class_detail = 'even';
     // build a list of sections
     $family = '';
     include_once $context['path_to_root'] . 'articles/article.php';
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // change the family
         if ($item['family'] != $family) {
             $family = $item['family'];
             // show the family
             $text .= Skin::table_suffix() . '<h2><span>' . $family . '&nbsp;</span></h2>' . "\n" . Skin::table_prefix('wide');
         }
         // document this section
         $content = $prefix = $title = $suffix = $icon = '';
         $menu = array();
         // permalink
         $url = Sections::get_permalink($item);
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // this is another row of the output
         $text .= '<tr class="' . $class_title . '"><th>' . $prefix . Skin::build_link($url, $title, 'basic', i18n::s('View the section')) . $suffix . '</th></tr>' . "\n";
         // document most recent page here
         $content = $prefix = $title = $suffix = $icon = '';
         $menu = array();
         // branches of this tree
         $anchors = Sections::get_branch_at_anchor('section:' . $item['id']);
         // get last post
         $article =& Articles::get_newest_for_anchor($anchors, TRUE);
         if ($article['id']) {
             // permalink
             $url = Articles::get_permalink($article);
             // get the anchor
             $anchor = Anchors::get($article['anchor']);
             // get the related overlay, if any
             $overlay = Overlay::load($item, 'section:' . $item['id']);
             // use the title to label the link
             if (is_object($overlay)) {
                 $title = Codes::beautify_title($overlay->get_text('title', $article));
             } else {
                 $title = Codes::beautify_title($article['title']);
             }
             // signal restricted and private articles
             if ($article['active'] == 'N') {
                 $prefix .= PRIVATE_FLAG;
             } elseif ($article['active'] == 'R') {
                 $prefix .= RESTRICTED_FLAG;
             }
             // the icon to put aside
             if ($article['thumbnail_url']) {
                 $icon = $article['thumbnail_url'];
             }
             // the icon to put aside
             if (!$icon && is_callable(array($anchor, 'get_bullet_url'))) {
                 $icon = $anchor->get_bullet_url();
             }
             if ($icon) {
                 $icon = '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $icon . '" class="right_image" alt="" title="' . encode_field(i18n::s('View the page')) . '" /></a>';
             }
             // the introductory text
             if ($article['introduction']) {
                 $content .= Codes::beautify_introduction($article['introduction']);
             } elseif (!is_object($overlay)) {
                 $handle = new Article();
                 $handle->load_by_content($article);
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_sections_as_slashdot.php

示例13: layout


//.........这里部分代码省略.........
             $details[] = sprintf(i18n::ns('%d file', '%d files', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'file') . $suffix;
             }
         }
         // info on related comments
         if ($items = Comments::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact', TRUE)) {
             // mention the number of sections in folded title
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'comment') . $suffix;
             }
         }
         // info on related links
         if (Sections::has_option('links_by_title', $anchor, $item)) {
             $items = Links::list_by_title_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
         } else {
             $items = Links::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
         }
         if ($items) {
             // mention the number of sections in folded title
             $details[] = sprintf(i18n::ns('%d link', '%d links', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label) . $suffix;
             }
         }
         // list related sections, if any
         if ($items =& Sections::list_by_title_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact')) {
             // mention the number of sections in folded title
             $details[] = sprintf(i18n::ns('%d section', '%d sections', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'section') . $suffix;
             }
         }
         // signal continuing sections
         if (count($elements) > MAXIMUM_ITEMS_PER_SECTION) {
             $elements[] = Skin::build_link(Sections::get_permalink($item), i18n::s('More pages') . MORE_IMG, 'basic');
         } else {
             $elements[] = Skin::build_link(Sections::get_permalink($item), i18n::s('View the section'), 'shortcut');
         }
         // complement title
         if (count($details)) {
             $box['title'] .= ' <span class="details">(' . join(', ', $details) . ')</span>';
         }
         // insert introduction, if any
         if ($item['introduction']) {
             $box['text'] .= Codes::beautify_introduction($item['introduction']);
         }
         // make a full list
         if (count($elements)) {
             $box['text'] .= '<ul><li>' . implode('</li>' . "\n" . '<li>', $elements) . '</li></ul>' . "\n";
         }
         // if we have an icon for this section, use it
         if (isset($item['thumbnail_url']) && $item['thumbnail_url']) {
             // adjust the class
             $class = '';
             if (isset($context['classes_for_thumbnail_images'])) {
                 $class = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
             }
             // build the complete HTML element
             $icon = '<img src="' . $item['thumbnail_url'] . '" alt="" title="' . encode_field(Codes::beautify_title($item['title'])) . '" ' . $class . '/>';
             // make it clickable
             $link = Skin::build_link(Sections::get_permalink($item), $icon, 'basic');
             // put this aside
             $box['text'] = '<table class="decorated"><tr>' . '<td class="image">' . $link . '</td>' . '<td class="content">' . $box['text'] . '</td>' . '</tr></table>';
         }
         // always make a box
         $text .= Skin::build_box($box['title'], $box['text'], 'folded');
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_sections_as_folded.php

示例14: layout

 /**
  * list sections
  *
  * Accept following variants:
  * - 'full' - include anchor information -- also the default value
  *
  * @param resource the SQL result
  * @return array of resulting items, or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of ($url => $attributes)
     $items = array();
     // empty list
     if (!SQL::count($result)) {
         return $items;
     }
     // sanity check
     if (!isset($this->layout_variant)) {
         $this->layout_variant = 'decorated';
     }
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // the url to view this item
         $url = Sections::get_permalink($item);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // initialize variables
         $prefix = $suffix = $icon = '';
         // flag sections that are draft, dead, or created or updated very recently
         if ($item['activation_date'] >= $context['now']) {
             $prefix .= DRAFT_FLAG;
         } elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG;
         }
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // the introductory text
         if ($item['introduction']) {
             $suffix .= ' -&nbsp;' . Codes::beautify_introduction($item['introduction']);
         }
         // details and content
         $details = array();
         $content = array();
         // count related sub-elements
         $related_count = 0;
         // info on related articles
         if ($count = Articles::count_for_anchor('section:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
             $related_count += $count;
             // add related articles if necessary
             if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
                 $order = $matches[1];
             } else {
                 $order = 'edition';
             }
             if (count($details) < YAHOO_LIST_SIZE && ($related =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], 0, YAHOO_LIST_SIZE - count($details), 'compact'))) {
                 foreach ($related as $link => $label) {
                     $sub_prefix = $sub_suffix = $sub_hover = '';
                     if (is_array($label)) {
                         $sub_prefix = $label[0];
                         $sub_suffix = $label[2];
                         if (@$label[5]) {
                             $sub_hover = $label[5];
                         }
                         $label = $label[1];
                     }
                     $content[$link] = array($sub_prefix, $label, $sub_suffix, 'basic', '', $sub_hover);
                 }
             }
         }
         // info on related files
         if ($count = Files::count_for_anchor('section:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
             $related_count += $count;
             // add related files if necessary
             if (count($details) < YAHOO_LIST_SIZE && ($related = Files::list_by_date_for_anchor('section:' . $item['id'], 0, YAHOO_LIST_SIZE - count($details), 'compact'))) {
                 foreach ($related as $link => $label) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_sections.php

示例15: layout

 /**
  * list sections
  *
  * @param resource the SQL result
  * @return array of resulting items, or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of ($url => $attributes)
     $items = array();
     // empty list
     if (!SQL::count($result)) {
         return $items;
     }
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // the url to view this item
         $url = Sections::get_permalink($item);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // initialize variables
         $prefix = $suffix = $icon = '';
         // flag sticky pages
         if ($item['rank'] < 10000) {
             $prefix .= STICKY_FLAG;
         }
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag sections that are dead, or created or updated very recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('section:' . $item['id'], TRUE)) {
             $suffix .= ' (' . $count . ')';
         }
         // details
         $details = array();
         // info on related sections
         if ($count = Sections::count_for_anchor('section:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d section', '%d sections', $count), $count);
         }
         // info on related articles
         if ($count = Articles::count_for_anchor('section:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
         }
         // info on related files
         if ($count = Files::count_for_anchor('section:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
         }
         // info on related links
         if ($count = Links::count_for_anchor('section:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
         }
         // the main anchor link
         if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
             $details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'section'));
         }
         // combine in-line details
         if (count($details)) {
             $suffix .= ' - <span class="details">' . trim(implode(', ', $details)) . '</span>';
         }
         // list all components for this item
         $items[$url] = array($prefix, $title, $suffix, 'section', $icon);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:90,代码来源:layout_sections_as_simple.php


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