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


PHP Articles::get_url方法代码示例

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


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

示例1: elseif

 /**
  * display content below main panel
  *
  * Everything is in a separate panel
  *
  * @param array the hosting record, if any
  * @return some HTML to be inserted into the resulting page
  */
 function &get_trailer_text($host = NULL)
 {
     $text = '';
     // display the following only if at least one comment has been attached to this page
     if (is_object($this->anchor) && !Comments::count_for_anchor($this->anchor->get_reference())) {
         return $text;
     }
     // ask the surfer if he has not answered yet, and if the page has not been locked
     $ask = TRUE;
     if (isset($_COOKIE['rating_' . $host['id']])) {
         $ask = FALSE;
     } elseif (isset($host['locked']) && $host['locked'] == 'Y') {
         $ask = FALSE;
     }
     // ask the surfer
     if ($ask) {
         $text = '<p style="line-height: 2.5em;">' . i18n::s('Has this page been useful to you?') . ' ' . Skin::build_link(Articles::get_url($host['id'], 'like'), i18n::s('Yes'), 'button') . ' ' . Skin::build_link(Articles::get_url($host['id'], 'dislike'), i18n::s('No'), 'button') . '</p>';
         // or report on results
     } elseif ($host['rating_count']) {
         $text = '<p>' . Skin::build_rating_img((int) round($host['rating_sum'] / $host['rating_count'])) . ' ' . sprintf(i18n::ns('%d rating', '%d ratings', $host['rating_count']), $host['rating_count']) . '</p>';
     }
     // add a title
     if ($text) {
         $text = Skin::build_box(i18n::s('Feed-back'), $text);
     }
     // done
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:36,代码来源:question.php

示例2: add_commands

 /**
  * extend the page menu
  *
  * @param string script name
  * @param string target anchor, if any
  * @param array current menu
  * @return array updated menu
  */
 function add_commands($script, $anchor, $menu = array())
 {
     global $context;
     // limit the scope of our check to viewed pages
     if (!preg_match('/articles\\/view/', $script)) {
         return $menu;
     }
     // surfer has to be authenticated
     if (!Surfer::is_logged()) {
         return $menu;
     }
     // sanity checks
     if (!$anchor) {
         Logger::error(i18n::s('No anchor has been found.'));
     } elseif (!($target = Anchors::get($anchor))) {
         Logger::error(i18n::s('No anchor has been found.'));
     } elseif (!$this->parameters) {
         Logger::error(sprintf(i18n::s('No parameter has been provided to %s'), 'behaviors/move_on_article_access'));
     } else {
         // look at parent container if possible
         if (!($origin = Anchors::get($target->get_parent()))) {
             $origin = $target;
         }
         // only container editors can proceed
         if ($origin->is_assigned() || Surfer::is_associate()) {
             // load target section
             $tokens = explode(' ', $this->parameters, 2);
             if ($section = Anchors::get('section:' . $tokens[0])) {
                 // make a label
                 if (count($tokens) < 2) {
                     $tokens[1] = sprintf(i18n::s('Move to %s'), $section->get_title());
                 }
                 // the target link to move the page
                 $link = Articles::get_url(str_replace('article:', '', $anchor), 'move', str_replace('section:', '', $section->get_reference()));
                 // make a sub-menu
                 $menu = array_merge(array($link => array('', $tokens[1], '', 'button')), $menu);
             }
         }
     }
     return $menu;
 }
开发者ID:rair,项目名称:yacs,代码行数:49,代码来源:move_on_article_access.php

示例3:

        }
        // lock command provided to container and page owners
        if ($cur_article->allows('locking')) {
            if (!isset($item['locked']) || $item['locked'] == 'N') {
                Skin::define_img('ARTICLES_LOCK_IMG', 'articles/lock.gif');
                $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'lock'), ARTICLES_LOCK_IMG . i18n::s('Lock'));
            } else {
                Skin::define_img('ARTICLES_UNLOCK_IMG', 'articles/unlock.gif');
                $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'lock'), ARTICLES_UNLOCK_IMG . i18n::s('Unlock'));
            }
        }
        // delete command
        if ($cur_article->allows('deletion')) {
            Skin::define_img('ARTICLES_DELETE_IMG', 'articles/delete.gif');
            if (!is_object($overlay) || !($label = $overlay->get_label('delete_command', 'articles'))) {
                $label = i18n::s('Delete this page');
            }
            $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'delete'), ARTICLES_DELETE_IMG . $label);
        }
        // duplicate command provided to container owners
        if ($cur_article->allows('duplicate')) {
            Skin::define_img('ARTICLES_DUPLICATE_IMG', 'articles/duplicate.gif');
            if (!is_object($overlay) || !($label = $overlay->get_label('duplicate_command', 'articles'))) {
                $label = i18n::s('Duplicate this page');
            }
            $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'duplicate'), ARTICLES_DUPLICATE_IMG . $label);
        }
    }
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例4: array

 $menu = array();
 // the submit button
 $menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
 // cancel button
 if (isset($item['id'])) {
     $menu[] = Skin::build_link(Users::get_permalink($item), i18n::s('Cancel'), 'span');
 }
 // several options to check
 $suffix = array();
 // associates may decide to not stamp changes -- complex command
 if (isset($item['id']) && Surfer::is_associate() && Surfer::has_all()) {
     $suffix[] = '<input type="checkbox" name="silent" value="Y" />' . ' ' . i18n::s('Do not change modification date.');
 }
 // link to privacy statement
 if (!isset($item['id']) && !Surfer::is_associate()) {
     $suffix[] = '<span>' . sprintf(i18n::s('By clicking submit, you agree to the terms and conditions outlined in the %s.'), Skin::build_link(Articles::get_url('privacy'), i18n::s('privacy statement'), 'basic')) . '</span>';
 }
 // validate page content
 if (Surfer::is_associate()) {
     $suffix[] = '<input type="checkbox" name="option_validate" value="Y" checked="checked" /> ' . i18n::s('Ensure this post is valid XHTML.');
 }
 // an assistant-like rendering at page bottom
 $context['text'] .= Skin::build_assistant_bottom('', $menu, $suffix, isset($item['tags']) ? $item['tags'] : '');
 // transmit the id as a hidden field
 if (isset($item['id']) && $item['id']) {
     $context['text'] .= '<input type="hidden" name="id" value="' . $item['id'] . '" />';
 }
 // transmit the link to use after registration
 if (!isset($item['id']) && isset($_REQUEST['forward']) && $_REQUEST['forward']) {
     $context['text'] .= '<input type="hidden" name="forward" value="' . encode_field($_REQUEST['forward']) . '" />';
 }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:edit.php

示例5: layout

 /**
  * list articles as topics in a forum
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // allow for complete styling
     $text = '<div class="last_articles">';
     // build a list of articles
     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
         $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);
         // build a title
         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 = '';
         // signal articles to be published
         if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
             $prefix .= DRAFT_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag expired articles
         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;
         }
         // signal locked articles
         if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
             $suffix .= ' ' . LOCKED_FLAG;
         }
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $suffix .= ' ' . Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // indicate the id in the hovering popup
         $hover = i18n::s('View the page');
         if (Surfer::is_member()) {
             $hover .= ' [article=' . $item['id'] . ']';
         }
         // one box per update
         $text .= '<div class="last_article" >';
         // use the title as a link to the page
         $text .= Skin::build_block($prefix . ucfirst($title) . $suffix, 'header1');
         // some details about this page
         $details = array();
         // page starter and date
         if ($item['create_name']) {
             $details[] = sprintf(i18n::s('Started by %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id'])) . ' ' . Skin::build_date($item['create_date']);
         }
         // page last modification
         if ($item['edit_date'] && $item['edit_action'] == 'article:update' && $item['edit_name']) {
             $details[] = Anchors::get_action_label($item['edit_action']) . ' ' . sprintf(i18n::s('by %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'])) . ' ' . Skin::build_date($item['edit_date']);
         }
         // friends
         if ($friends =& Members::list_users_by_posts_for_anchor('article:' . $item['id'], 0, USERS_LIST_SIZE, 'comma5', $item['create_id'])) {
             $details[] = sprintf(i18n::s('with %s'), $friends);
         }
         // people details
         if ($details) {
             $text .= '<p class="details">' . join(', ', $details) . "</p>\n";
         }
         // the introductory text
         $introduction = '';
         if (is_object($overlay)) {
             $introduction = $overlay->get_text('introduction', $item);
         } elseif ($item['introduction']) {
             $introduction = $item['introduction'];
         }
         if ($introduction) {
             $text .= '<div style="margin: 1em 0;">' . Codes::beautify_introduction($introduction) . '</div>';
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_last.php

示例6: layout

 /**
  * list articles as topics in a forum
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // page size for comments
     include_once $context['path_to_root'] . 'comments/layout_comments_as_updates.php';
     $layout = new Layout_comments_as_updates();
     // build a list of articles
     $rows = array();
     include_once $context['path_to_root'] . 'comments/comments.php';
     while ($item = SQL::fetch($result)) {
         // get the related overlay
         $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);
         // build a title
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // reset everything
         $text = $prefix = $label = $suffix = $icon = '';
         // signal articles to be published
         if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
             $prefix .= DRAFT_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag expired articles, and articles 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 . ' ';
         }
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $suffix .= ' ' . Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // select an icon for this thread
         $item['comments_count'] = Comments::count_for_anchor('article:' . $item['id']);
         if (is_object($overlay) && $overlay->attributes['overlay_type'] == 'poll') {
             Skin::define_img('POLL_IMG', 'articles/poll.gif');
             $icon = POLL_IMG;
         } elseif ($item['rank'] < 10000) {
             Skin::define_img('STICKY_THREAD_IMG', 'articles/sticky_thread.gif');
             $icon = STICKY_THREAD_IMG;
         } elseif (isset($item['comments_count']) && $item['comments_count'] >= 20) {
             Skin::define_img('VERY_HOT_THREAD_IMG', 'articles/very_hot_thread.gif');
             $icon = VERY_HOT_THREAD_IMG;
         } elseif (isset($item['comments_count']) && $item['comments_count'] >= 10) {
             $icon = HOT_THREAD_IMG;
         } else {
             $icon = THREAD_IMG;
         }
         // indicate the id in the hovering popup
         $hover = i18n::s('View the page');
         if (Surfer::is_member()) {
             $hover .= ' [article=' . $item['id'] . ']';
         }
         // use the title as a link to the page
         $title = $prefix . Skin::build_link($url, ucfirst($title), 'basic', $hover) . $suffix;
         $suffix = '';
         // the introductory text
         $introduction = '';
         if (is_object($overlay)) {
             $introduction = $overlay->get_text('introduction', $item);
         } elseif ($item['introduction']) {
             $introduction = $item['introduction'];
         }
         if ($introduction) {
             $suffix .= BR . Codes::beautify_introduction($introduction);
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $suffix .= $overlay->get_text('list', $item);
         }
         // shortcuts to comments pages
         if (isset($item['comments_count']) && ($pages = (int) ceil($item['comments_count'] / $layout->items_per_page())) && $pages > 1) {
             $suffix .= '<p class="details">Pages ';
             for ($index = 1; $index <= $pages; $index++) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_yabb.php

示例7: layout


//.........这里部分代码省略.........
         // signal articles to be published
         if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
             $prefix .= DRAFT_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // introduction
         $introduction = '';
         if (is_object($overlay)) {
             $introduction = $overlay->get_text('introduction', $item);
         } else {
             $introduction = $item['introduction'];
         }
         // the introductory text
         if ($introduction) {
             $suffix .= ' -&nbsp;' . Codes::beautify_introduction($introduction);
             // link to description, if any
             if ($item['description']) {
                 $suffix .= ' ' . Skin::build_link($url, MORE_IMG, 'more', i18n::s('View the page')) . ' ';
             }
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $suffix .= $overlay->get_text('list', $item);
         }
         // details
         $details = array();
         // the author
         if ($item['create_name'] != $item['edit_name']) {
             $details[] = sprintf(i18n::s('by %s, %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']));
         } else {
             $details[] = sprintf(i18n::s('by %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']));
         }
         // the last action
         $details[] = Anchors::get_action_label($item['edit_action']) . ' ' . Skin::build_date($item['edit_date']);
         // the number of hits
         if (Surfer::is_logged() && $item['hits'] > 1) {
             $details[] = Skin::build_number($item['hits'], i18n::s('hits'));
         }
         // info on related files
         if ($count = Files::count_for_anchor('article:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
         }
         // info on related links
         if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
         }
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // the main anchor link
         if (is_object($anchor)) {
             $details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'section'));
         }
         // display all tags
         if ($item['tags']) {
             $details[] = '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
         }
         // combine in-line details
         if (count($details)) {
             $suffix .= '<p class="details">' . Skin::finalize_list($details, 'menu') . '</p>';
         }
         // insert a suffix separator
         if (trim($suffix)) {
             $suffix = ' ' . $suffix;
         }
         // item summary
         $box .= $prefix . Skin::build_link($url, $title, 'article') . $suffix;
         // the icon to put in the left column
         if ($item['thumbnail_url']) {
             $icon = $item['thumbnail_url'];
         } elseif (is_callable(array($anchor, 'get_bullet_url'))) {
             $icon = $anchor->get_bullet_url();
         }
         // build the complete HTML element
         if ($icon) {
             $icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($title)) . '" />';
             // make it a clickable link
             $icon = Skin::build_link($url, $icon, 'basic');
             // default icon
         } else {
             $icon = DECORATED_IMG;
         }
         // layout this item
         $list = array(array($box, $icon));
         $items[] = array($item['score'], Skin::finalize_list($list, 'decorated'));
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_search.php

示例8: layout

 /**
  * list articles as topics in a forum
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // start a table
     $text .= Skin::table_prefix('jive');
     // headers
     $text .= Skin::table_row(array(i18n::s('Topic'), i18n::s('Content')), 'header');
     // build a list of articles
     $odd = FALSE;
     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, 'article:' . $item['id']);
         // get the 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']);
         }
         // one row per article
         $text .= '<tr class="' . ($odd ? 'odd' : 'even') . '"><td>';
         $odd = !$odd;
         // signal articles to be published
         if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
             $text .= DRAFT_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $text .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $text .= RESTRICTED_FLAG;
         }
         // use the title as a link to the page
         $text .= Skin::build_link($url, '<strong>' . $title . '</strong>', 'basic');
         // signal locked articles
         if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
             $text .= ' ' . LOCKED_FLAG;
         }
         // flag articles updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $text .= ' ' . EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $text .= ' ' . NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $text .= ' ' . UPDATED_FLAG;
         }
         // add details, if any
         $details = array();
         // poster name
         if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
             if ($item['create_name']) {
                 $details[] = sprintf(i18n::s('posted by %s %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Skin::build_date($item['create_date']));
             }
         }
         // last update
         $details[] = sprintf(i18n::s('Updated %s'), Skin::build_date($item['edit_date']));
         // add details to the title
         if (count($details)) {
             $text .= '<p class="details" style="margin: 3px 0">' . join(', ', $details) . '</p>';
         }
         // display all tags
         if ($item['tags']) {
             $text .= '<p class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</p>';
         }
         // next cell for the content
         $text .= '</td><td width="70%">';
         // the content to be displayed
         $content = '';
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $content .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // the introductory text
         if (is_object($overlay)) {
             $content .= Codes::beautify_introduction($overlay->get_text('introduction', $item));
         } else {
             $content .= Codes::beautify_introduction($item['introduction']);
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $content .= $overlay->get_text('list', $item);
         }
         // the description
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_jive.php

示例9: get_url

 /**
  * get the url to display the main page for this anchor
  *
  * @see shared/anchor.php
  *
  * @param string the targeted action ('view', 'print', 'edit', 'delete', ...)
  * @return an anchor to the viewing script, or NULL on error
  */
 function get_url($action = 'view')
 {
     // sanity check
     if (!isset($this->item['id'])) {
         return NULL;
     }
     switch ($action) {
         // view comments
         case 'comments':
             // variants that start at the article page
             if ($this->has_option('view_as_chat')) {
                 return $this->get_url() . '#comments';
             }
             // start threads on a separate page
             if ($this->has_layout('alistapart')) {
                 return Comments::get_url($this->get_reference(), 'list');
             }
             // layouts that start at the article page --assume we have at least one comment, on a tab
             return Articles::get_permalink($this->item) . '#_discussion';
             // list of files
         // list of files
         case 'files':
             return $this->get_url() . '#_attachments';
             // list of links
         // list of links
         case 'links':
             return $this->get_url() . '#_attachments';
             // jump to parent page
         // jump to parent page
         case 'parent':
             if (!isset($this->anchor)) {
                 $this->anchor = Anchors::get($this->item['anchor']);
             }
             return $this->anchor->get_url();
             // the permalink page
         // the permalink page
         case 'view':
             return Articles::get_permalink($this->item);
             // another action
         // another action
         default:
             return Articles::get_url($this->item['id'], $action, $this->item['title'], $this->item['nick_name']);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:52,代码来源:article.php

示例10: get_permalink

 /**
  * get permanent address
  *
  * @param array page attributes
  * @return string the permanent web address to this item, relative to the installation path
  */
 public static function get_permalink($item)
 {
     global $context;
     // sanity check
     if (!isset($item['id'])) {
         return null;
     }
     // get host to this page
     $vhost = Sections::get_vhost($item['anchor']);
     // absolute link
     return $vhost . Articles::get_url($item['id'], 'view', $item['title'], isset($item['nick_name']) ? $item['nick_name'] : '');
 }
开发者ID:rair,项目名称:yacs,代码行数:18,代码来源:articles.php

示例11: elseif

if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // an error has occured
} elseif (count($context['error'])) {
} elseif (!isset($item['id'])) {
    include '../error.php';
    // a destination anchor is mandatory
} elseif (!is_object($destination)) {
    Safe::header('Status: 404 Not Found', TRUE, 404);
    Logger::error(i18n::s('No anchor has been found.'));
    // permission denied
} elseif (!Articles::is_owned($item, $anchor)) {
    // anonymous users are invited to log in or to register
    if (!Surfer::is_logged()) {
        $link = Articles::get_url($item['id'], 'move', $destination->get_reference());
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode($link));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // maybe this article cannot be modified anymore
} elseif (isset($item['locked']) && $item['locked'] == 'Y' && !Surfer::is_empowered()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('This page has been locked.'));
    // do the job
} else {
    // attributes to change
    $fields = array();
    $fields['id'] = $item['id'];
    $fields['anchor'] = $destination->get_reference();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:move.php

示例12: encode_field

 if (!isset($context['site_email']) || !$context['site_email']) {
     $context['site_email'] = 'unknown_webmaster@acme.heaven';
 }
 $label = i18n::s('Contact mail address');
 $input = '<input type="text" name="site_email" size="40" value="' . encode_field($context['site_email']) . '" maxlength="255" />';
 $hint = sprintf(i18n::s('May be subject to spam attacks; featured in the %s page and in RSS feeds, at least'), Skin::build_link(Articles::get_url('about'), i18n::s('about'), 'shortcut'));
 $fields[] = array($label, $input, $hint);
 // copyright
 $label = i18n::s('Copyright');
 $input = '<input type="text" name="site_copyright" size="50" value="' . encode_field(isset($context['site_copyright']) ? $context['site_copyright'] : '') . '" maxlength="255" />';
 $hint = i18n::s('Example: "2002-2008, Acme incorporated"; inserted in the "copyright" meta field');
 $fields[] = array($label, $input, $hint);
 // site owner
 $label = i18n::s('Site owner');
 $input = '<input type="text" name="site_owner" size="50" value="' . encode_field(isset($context['site_owner']) ? $context['site_owner'] : '') . '" maxlength="255" />';
 $hint = sprintf(i18n::s('The name of the site owner, e.g. "ACME and company"; Featured in the %s page and in ATOM feeds, at least'), Skin::build_link(Articles::get_url('about'), i18n::s('about'), 'shortcut'));
 $fields[] = array($label, $input, $hint);
 // revisit after
 if (!isset($context['site_revisit_after']) || !$context['site_revisit_after']) {
     $context['site_revisit_after'] = 7;
 }
 $label = i18n::s('Usual delay between updates');
 $input = '<input type="text" name="site_revisit_after" size="4" value="' . encode_field($context['site_revisit_after']) . '" maxlength="4" /> ' . i18n::s('days');
 $hint = i18n::s('Please be realistic here. Used to flag new and updated items. Also featured in "revisit-after" meta field.');
 $fields[] = array($label, $input, $hint);
 // position
 $label = i18n::s('Geographical position');
 $input = '<input type="text" name="site_position" size="40" value="' . encode_field(isset($context['site_position']) ? $context['site_position'] : '') . '" maxlength="255" />';
 $hint = sprintf(i18n::s('Latitude and longitude, separated by a comma, for example: 47.98481,-71.42124, featured as meta fields "geo.position" and "ICBM" at the front page. See %s or %s'), Skin::build_link('http://geotags.com/', i18n::s('GeoTags Search Engine'), 'external'), Skin::build_link('http://www.travelgis.com/geocode/Default.aspx', i18n::s('Geocoding Service'), 'external'));
 $fields[] = array($label, $input, $hint);
 // head
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:configure.php

示例13: round

// surfer name and execution time, if known
if (is_callable(array('Surfer', 'get_name')) && is_callable(array('i18n', 's'))) {
    $execution_time = round(get_micro_time() - $context['start_time'], 2);
    echo sprintf(i18n::s('Page prepared in %.2f seconds for %s'), $execution_time, ucwords(Surfer::get_name())) . ' ';
}
// site copyright
if (isset($context['site_copyright'])) {
    echo '<br />Copyright &copy; ' . $context['site_copyright'] . "\n";
}
// a command to authenticate
if (is_callable(array('Surfer', 'is_logged')) && !Surfer::is_logged() && is_callable(array('i18n', 's'))) {
    echo ' - ' . Skin::build_link('users/login.php', i18n::s('login'), 'basic') . ' ';
}
// about this site
if (is_callable(array('i18n', 's')) && is_callable(array('Articles', 'get_url'))) {
    echo ' - ' . Skin::build_link(Articles::get_url('about'), i18n::s('about this site'), 'basic') . ' ';
}
// privacy statement
if (is_callable(array('i18n', 's')) && is_callable(array('Articles', 'get_url'))) {
    echo ' - ' . Skin::build_link(Articles::get_url('privacy'), i18n::s('privacy statement'), 'basic') . ' ';
}
// a reference to YACS
if (is_callable(array('i18n', 's'))) {
    echo BR . sprintf(i18n::s('Powered by %s'), Skin::build_link(i18n::s('http://www.yacs.fr/'), 'Yacs', 'external'));
}
// end of the footer panel
echo '</div>' . "\n";
// insert the footer
echo $context['page_footer'];
// end of page
echo '</body>' . "\n" . '</html>';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:template.php

示例14: layout

 /**
  * list articles as a daily weblog 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)) {
         if (Surfer::is_associate()) {
             $text .= '<p>' . sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut')) . '</p>';
         }
         return $text;
     }
     // build a list of articles
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // three components per box
         $box = array();
         $box['date'] = '';
         $box['title'] = '';
         $box['content'] = '';
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // permalink
         $url = Articles::get_permalink($item);
         // make a live title
         if (is_object($overlay)) {
             $box['title'] .= Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $box['title'] .= Codes::beautify_title($item['title']);
         }
         // make a clickable title
         $box['title'] = Skin::build_link($url, $box['title'], 'basic');
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $box['title'] = PRIVATE_FLAG . $box['title'];
         } elseif ($item['active'] == 'R') {
             $box['title'] = RESTRICTED_FLAG . $box['title'];
         }
         // flag articles updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $box['title'] .= EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $box['title'] .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $box['title'] .= UPDATED_FLAG;
         }
         // what's the date of publication?
         if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
             $box['date'] .= Skin::build_date($item['publish_date'], 'publishing');
         }
         // the icon to put aside - never use anchor images
         if ($item['icon_url']) {
             $box['content'] .= '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $item['icon_url'] . '" class="left_image" alt="" /></a>';
         }
         // details
         $details = array();
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // show details
         if (count($details)) {
             $box['content'] .= '<p class="details">' . implode(' ~ ', $details) . '</p>' . "\n";
         }
         // list categories by title, if any
         if ($items = Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
             $tags = array();
             foreach ($items as $id => $attributes) {
                 // add background color to distinguish this category against others
                 if (isset($attributes['background_color']) && $attributes['background_color']) {
                     $attributes['title'] = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $attributes['title'] . '</span>';
                 }
                 $tags[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic');
             }
             $box['content'] .= '<p class="tags">' . implode(' ', $tags) . '</p>';
         }
         // the introduction text, if any
         if (is_object($overlay)) {
             $box['content'] .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
         } else {
             $box['content'] .= Skin::build_block($item['introduction'], 'introduction');
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $box['content'] .= $overlay->get_text('list', $item);
         }
         // the description
         $box['content'] .= Skin::build_block($item['description'], 'description', '', $item['options']);
         // a compact list of attached files
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_home_articles_as_daily.php

示例15: layout

 /**
  * list articles as a table of content of a manual
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // build a list of articles
     include_once $context['path_to_root'] . 'links/links.php';
     $text .= '<ul class="manual">';
     while ($item = SQL::fetch($result)) {
         // 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);
         // 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 articles to be published
         if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
             $prefix .= DRAFT_FLAG;
         }
         // signal restricted and private articles
         if (isset($item['active']) && $item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif (isset($item['active']) && $item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag articles 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;
         }
         // attachment details
         $details = array();
         // info on related files
         if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
             Skin::define_img('FILES_LIST_IMG', 'files/list.gif');
             $details[] = FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count);
         }
         // info on related links
         if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
             Skin::define_img('LINKS_LIST_IMG', 'links/list.gif');
             $details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count);
         }
         // rating
         if ($item['rating_count']) {
             $details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // describe attachments
         if (count($details)) {
             $suffix .= ' <span class="details">' . join(', ', $details) . '</span>';
         }
         // display all tags
         if ($item['tags']) {
             $suffix .= ' <span class="details">- ' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
         }
         // make a link
         $label = $prefix . Skin::build_link($url, $title, 'basic') . $suffix;
         // use the title as a link to the page
         $text .= '<li>' . $label . "</li>\n";
     }
     $text .= '</ul>' . "\n";
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:85,代码来源:layout_articles_as_manual.php


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