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


PHP Skin::build_box_title方法代码示例

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


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

示例1: array

    // see also
    $lines = array();
    $lines[] = Skin::build_link('categories/', i18n::s('Categories'));
    $lines[] = Skin::build_link('search.php', i18n::s('Search'));
    $lines[] = Skin::build_link('help/', i18n::s('Help index'));
    $lines[] = Skin::build_link('query.php', i18n::s('Contact'));
    $text .= Skin::build_box(i18n::s('See also'), Skin::finalize_list($lines, 'compact'), 'boxes');
    // list monthly publications in an extra box
    $anchor = Categories::get(i18n::c('monthly'));
    if (isset($anchor['id']) && ($items = Categories::list_by_date_for_anchor('category:' . $anchor['id'], 0, COMPACT_LIST_SIZE, 'compact'))) {
        $text .= Skin::build_box($anchor['title'], Skin::build_list($items, 'compact'), 'boxes') . "\n";
    }
    // side boxes for related categories, if any
    if ($categories = Categories::list_by_date_for_display('section:index', 0, 7, 'raw')) {
        foreach ($categories as $id => $attributes) {
            // link to the category page from the box title
            $label =& Skin::build_box_title(Skin::strip($attributes['title']), Categories::get_permalink($attributes), i18n::s('View the category'));
            // box content
            if ($items =& Members::list_articles_by_date_for_anchor('category:' . $id, 0, COMPACT_LIST_SIZE, 'compact')) {
                $text .= Skin::build_box($label, Skin::build_list($items, 'compact'), 'boxes') . "\n";
            }
        }
    }
    // save, whatever change, for 5 minutes
    Cache::put($cache_id, $text, 'stable', 300);
}
$context['components']['boxes'] = $text;
// referrals, if any
$context['components']['referrals'] = Skin::build_referrals('sections/index.php');
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:index.php

示例2:

    }
}
// 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
            $title =& Skin::build_box_title($anchor['title'], Categories::get_permalink($anchor), i18n::s('Featured pages'));
            // limit to seven links only
            if (@count($items) > $context['root_featured_count']) {
                @array_splice($items, $context['root_featured_count']);
                // link to the category page
                $url = Categories::get_permalink($anchor);
                $items[$url] = i18n::s('Featured pages') . MORE_IMG;
            }
            // render html
            if (is_array($items)) {
                $items =& Skin::build_list($items, 'news');
            }
            // we do have something to display
            if ($items) {
                // animate the text if required to do so
                if ($context['root_featured_layout'] == 'scroll') {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:index.php

示例3: str_replace

 /**
  * build a box
  *
  * Accept following variants:
  * - 'extra' for a flashy box on page side
  * - 'floating' for a box floated to the left
  * - 'folded' for a folded box with content
  * - 'gadget' for additional content in the main part of the page
  * - 'header1' with a level 1 title
  * - 'header1 even'
  * - 'header1 odd'
  * - 'header2' with a level 2 title
  * - 'header3' with a level 3 title
  * - 'navigation' for additional navigational information on page side
  * - 'sidebar' for some extra information in the main part of the page
  * - 'sidecolumn' for some extra information in the main part of the page
  * - 'sliding' for sliding content
  * - 'toc' for a table of content
  * - 'toq' for a table of questions
  * - 'unfolded' for a folded box with content
  *
  * @param string the box title, if any
  * @param string the box content
  * @param string the box variant, if any
  * @param string a unique object id, if any
  * @param string a link to add to the title, if any
  * @param string the popup to display while hovering the link, if any
  * @return the HTML to display
  *
  */
 public static function &build_box($title, $content, $variant = 'header1', $id = '', $url = '', $popup = '')
 {
     global $context;
     $content = Codes::fix_tags($content);
     // accept line breaks in box titles
     $title = str_replace("\n", BR, $title);
     // append a link to the title, if any
     if ($url) {
         $title =& Skin::build_box_title($title, $url, $popup);
     }
     // depending on variant
     switch ($variant) {
         case 'extra':
             $output =& Skin::build_extra_box($title, $content, $id);
             break;
         case 'floating':
             $output =& Skin::build_floating_box($title, $content, $id);
             break;
         case 'folded':
         case 'folder':
             // obsoleted
             $output =& Skin::build_folded_box($title, $content, $id);
             break;
         case 'gadget':
             $output =& Skin::build_gadget_box($title, $content, $id);
             break;
         case 'header1':
         case 'header1 even':
         case 'header1 odd':
         case 'header2':
         case 'header3':
             $output =& Skin::build_header_box($title, $content, $id, $variant);
             break;
         case 'navigation':
             $output =& Skin::build_navigation_box($title, $content, $id);
             break;
         case 'section':
             // legacy
             $output =& Skin::build_header_box($title, $content, $id);
             break;
         case 'sidebar':
             $output =& Skin::build_sidebar_box($title, $content, $id);
             break;
         case 'sidecolumn':
             $output =& Skin::build_sidecolumn_box($title, $content, $id);
             break;
         case 'sliding':
             $output =& Skin::build_sliding_box($title, $content, $id);
             break;
         case 'toc':
             $output =& Skin::build_toc_box($title, $content, $id);
             break;
         case 'toq':
             $output =& Skin::build_toq_box($title, $content, $id);
             break;
         case 'unfolded':
             $output =& Skin::build_unfolded_box($title, $content, $id);
             break;
         default:
             // displayed in the navigation panel
             if (isset($context['skins_navigation_components']) && strpos($context['skins_navigation_components'], $variant) !== FALSE) {
                 $output =& Skin::build_navigation_box($title, $content, $id);
             } elseif (isset($context['skins_extra_components']) && strpos($context['skins_extra_components'], $variant) !== FALSE) {
                 $output =& Skin::build_extra_box($title, $content, $id);
             } else {
                 $output =& Skin::build_header_box($title, $content, $id, $variant);
             }
             break;
     }
     // job done
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:skin_skeleton.php

示例4: layout_newest

 /**
  * layout the newest articles
  *
  * caution: this function also updates page title directly, and this makes its call non-cacheable
  *
  * @param array the article
  * @return string the rendered text
  **/
 function layout_newest($item)
 {
     global $context;
     // get the related overlay, if any
     $overlay = Overlay::load($item, 'article:' . $item['id']);
     // get the anchor
     $anchor = Anchors::get($item['anchor']);
     // the url to view this item
     $url = Articles::get_permalink($item);
     // reset the rendering engine between items
     Codes::initialize($url);
     // build a title
     if (is_object($overlay)) {
         $title = Codes::beautify_title($overlay->get_text('title', $item));
     } else {
         $title = Codes::beautify_title($item['title']);
     }
     // title prefix & suffix
     $text = $prefix = $suffix = '';
     // flag articles updated recently
     if ($context['site_revisit_after'] < 1) {
         $context['site_revisit_after'] = 2;
     }
     $context['fresh'] = gmstrftime('%Y-%m-%d %H:%M:%S', mktime(0, 0, 0, date("m"), date("d") - $context['site_revisit_after'], date("Y")));
     // link to permalink
     if (Surfer::is_empowered()) {
         $title = Skin::build_box_title($title, $url, i18n::s('Permalink'));
     }
     // signal articles to be published
     if ($item['publish_date'] <= NULL_DATE) {
         $prefix .= DRAFT_FLAG;
     } else {
         if ($item['publish_date'] > NULL_DATE && $item['publish_date'] > $context['now']) {
             $prefix .= DRAFT_FLAG;
         }
     }
     // signal restricted and private articles
     if ($item['active'] == 'N') {
         $prefix .= PRIVATE_FLAG . ' ';
     } elseif ($item['active'] == 'R') {
         $prefix .= RESTRICTED_FLAG . ' ';
     }
     // signal locked articles
     if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
         $suffix .= LOCKED_FLAG;
     }
     // flag expired article
     if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
         $suffix .= EXPIRED_FLAG;
     }
     // update page title directly
     $text .= Skin::build_block($prefix . $title . $suffix, 'title');
     // if this article has a specific icon, use it
     if ($item['icon_url']) {
         $icon = $item['icon_url'];
     } elseif ($item['anchor'] && ($anchor = Anchors::get($item['anchor']))) {
         $icon = $anchor->get_icon_url();
     }
     // if we have a valid image
     if (preg_match('/(.gif|.jpg|.jpeg|.png)$/i', $icon)) {
         // fix relative path
         if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
             $icon = $context['url_to_root'] . $icon;
         }
         // flush the image on the right
         $text .= '<img src="' . $icon . '" class="right_image" alt="" />';
     }
     // article rating, if the anchor allows for it
     if (!is_object($anchor) || !$anchor->has_option('without_rating')) {
         // report on current rating
         $label = '';
         if ($item['rating_count']) {
             $label = Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])) . ' ';
         }
         $label .= i18n::s('Rate this page');
         // allow for rating
         $text .= Skin::build_link(Articles::get_url($item['id'], 'like'), $label, 'basic');
     }
     // the introduction text, if any
     if (is_object($overlay)) {
         $text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
     } else {
         $text .= Skin::build_block($item['introduction'], 'introduction');
     }
     // insert overlay data, if any
     if (is_object($overlay)) {
         $text .= $overlay->get_text('view', $item);
     }
     // the beautified description, which is the actual page body
     if ($item['description']) {
         // use adequate label
         if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_home_articles_as_alistapart.php

示例5: layout

 /**
  * list articles
  *
  * @param resource the SQL result
  * @return array( $title => $content )
  *
  * @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'] . 'articles/article.php';
     while ($item = SQL::fetch($result)) {
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // the url to view this item
         $url = Articles::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']);
         }
         // shortcut for associates
         if (Surfer::is_associate()) {
             $title =& Skin::build_box_title($title, $url, i18n::s('View the page'));
         }
         // title prefix
         $prefix = '';
         // flag articles that are dead, or created or updated very recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG;
         }
         // signal articles to be published
         if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > $context['now']) {
             $prefix .= DRAFT_FLAG;
         }
         // prefix the title
         $title = $prefix . $title;
         // what has to be displayed in this box
         $parts = array();
         // if the page is publicly available, show introduction and link to full content
         $article = new Article();
         $article->load_by_content($item, Anchors::get($item['anchor']));
         if ($article->is_public()) {
             // get introduction from overlay, if any
             if (is_object($overlay)) {
                 $parts[] = Codes::beautify_introduction($overlay->get_text('introduction', $item));
                 // add a link to the main page
                 $parts[] = Skin::build_link($url, i18n::s('More') . MORE_IMG, 'basic', i18n::s('View the page'));
                 // use the introduction, if any
             } elseif ($item['introduction']) {
                 // the content of this box
                 $parts[] = Codes::beautify_introduction($item['introduction']);
                 // add a link to the main page
                 $parts[] = Skin::build_link($url, i18n::s('More') . MORE_IMG, 'basic', i18n::s('View the page'));
                 // no introduction, display article full content
             } else {
                 // insert overlay data, if any
                 if (is_object($overlay)) {
                     $parts[] = $overlay->get_text('box', $item);
                 }
                 // the content of this box
                 $parts[] = Codes::beautify($item['description'], $item['options']);
             }
             // else display full box content
         } else {
             // use the introduction, if any
             if ($item['introduction']) {
                 $parts[] = Codes::beautify_introduction($item['introduction']);
             }
             // get the related overlay, if any
             $overlay = Overlay::load($item, 'article:' . $item['id']);
             // insert overlay data, if any
             if (is_object($overlay)) {
                 $parts[] = $overlay->get_text('box', $item);
             }
             // the content of this box
             if ($item['description']) {
                 $parts[] = Codes::beautify($item['description'], $item['options']);
             }
         }
         // use nick name as box id
         $id = '';
         if (isset($item['nick_name'])) {
             $id = trim($item['nick_name']);
         }
         // append to the list
         $items[$title] = array('content' => implode(BR, $parts), 'id' => $id);
     }
     // end of processing
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_boxes.php


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