當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Comments::get_img方法代碼示例

本文整理匯總了PHP中Comments::get_img方法的典型用法代碼示例。如果您正苦於以下問題:PHP Comments::get_img方法的具體用法?PHP Comments::get_img怎麽用?PHP Comments::get_img使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Comments的用法示例。


在下文中一共展示了Comments::get_img方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_radio_buttons

 /**
  * get types as radio buttons
  *
  * @param string the current type
  * @return the HTML to insert in the page
  *
  * @see comments/edit.php
  */
 public static function get_radio_buttons($name, $type)
 {
     global $context;
     // a 2-column layout
     $content = '<div style="float: left;">' . "\n";
     // col 1 - attention - also the default
     $content .= '<input type="radio" name="' . $name . '" value="attention"';
     if ($type == 'attention' || !trim($type)) {
         $content .= ' checked="checked"';
     }
     $content .= '/>' . Comments::get_img('attention') . ' ' . i18n::s('Attention') . BR;
     // col 1 - an idea
     $content .= '<input type="radio" name="' . $name . '" value="idea"';
     if ($type == 'idea' || $type == 'suggestion') {
         $content .= ' checked="checked"';
     }
     $content .= '/>' . Comments::get_img('idea') . ' ' . i18n::s('A suggestion') . BR;
     // col 1 - a question
     $content .= '<input type="radio" name="' . $name . '" value="question"';
     if ($type == 'question') {
         $content .= ' checked="checked"';
     }
     $content .= '/>' . Comments::get_img('question') . ' ' . i18n::s('A question') . BR;
     // col 1 - like
     $content .= '<input type="radio" name="' . $name . '" value="like"';
     if ($type == 'like') {
         $content .= ' checked="checked"';
     }
     $content .= '/>' . Comments::get_img('like') . ' ' . i18n::s('I like...');
     // from column 1 to column 2
     $content .= '</div>' . "\n" . '<div style="float: left;">';
     // col 2 - warning
     $content .= '<input type="radio" name="' . $name . '" value="warning"';
     if ($type == 'warning') {
         $content .= ' checked="checked"';
     }
     $content .= '/>' . Comments::get_img('warning') . ' ' . i18n::s('Warning!') . BR;
     // col 2 - done
     $content .= '<input type="radio" name="' . $name . '" value="done"';
     if ($type == 'done') {
         $content .= ' checked="checked"';
     }
     $content .= '/>' . Comments::get_img('done') . ' ' . i18n::s('Job has been completed') . BR;
     // col 2 - information
     $content .= '<input type="radio" name="' . $name . '" value="information"';
     if ($type == 'information') {
         $content .= ' checked="checked"';
     }
     $content .= '/>' . Comments::get_img('information') . ' ' . i18n::s('My two cents') . BR;
     // col2 - dislike
     $content .= '<input type="radio" name="' . $name . '" value="dislike"';
     if ($type == 'dislike') {
         $content .= ' checked="checked"';
     }
     $content .= '/>' . Comments::get_img('dislike') . ' ' . i18n::s('I don\'t like...');
     // end of columns
     $content .= '</div>' . "\n";
     return $content;
 }
開發者ID:rair,項目名稱:yacs,代碼行數:67,代碼來源:comments.php

示例2: layout

 /**
  * list comments
  *
  * @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;
     }
     // sanity check
     if (!isset($this->layout_variant)) {
         $this->layout_variant = 'full';
     }
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     while ($item = SQL::fetch($result)) {
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // initialize variables
         $prefix = $suffix = '';
         // there is no zoom page for comments
         $label = '_';
         // the icon is a link to comment permalink
         $suffix .= Skin::build_link(Comments::get_url($item['id']), Comments::get_img($item['type']), 'basic', i18n::s('View this comment'));
         // a link to the user profile
         if ($item['create_name']) {
             $suffix .= ' ' . Users::get_link($item['create_name'], $item['create_address'], $item['create_id']);
         } else {
             $suffix .= ' ' . Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']);
         }
         $menu = array();
         // the edition date
         if ($item['create_date']) {
             $menu[] = Skin::build_date($item['create_date']);
         } else {
             $menu[] = Skin::build_date($item['edit_date']);
         }
         // the menu bar for associates, editors and poster
         if (Comments::allow_modification($anchor, $item)) {
             $menu[] = Skin::build_link(Comments::get_url($item['id'], 'edit'), i18n::s('edit'), 'span');
             $menu[] = Skin::build_link(Comments::get_url($item['id'], 'delete'), i18n::s('delete'), 'span');
         }
         if ($menu) {
             $suffix .= ' -' . Skin::finalize_list($menu, 'menu');
         }
         // new line
         $suffix .= BR;
         // description
         if ($description = ucfirst(trim(Codes::beautify($item['description'] . Users::get_signature($item['create_id']))))) {
             $suffix .= ' ' . $description;
         }
         // url to view the comment
         $url = Comments::get_url($item['id']);
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'comment', NULL);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
開發者ID:rair,項目名稱:yacs,代碼行數:69,代碼來源:layout_comments.php

示例3: elseif

         $fields[] = $field;
     }
 }
 // the type
 if (is_object($anchor)) {
     $label = i18n::s('Your intent');
     if (isset($item['type'])) {
         $type = $item['type'];
     } elseif (isset($_REQUEST['type'])) {
         $type = $_REQUEST['type'];
     } else {
         $type = '';
     }
     // this is an approval
     if ($type == 'approval') {
         $input = Comments::get_img('approval') . ' ' . sprintf(i18n::s('You are approving %s'), Skin::build_link($anchor->get_url(), $anchor->get_title())) . '<input type="hidden" name="type" value="approval" />';
         $hint = '';
         // warn in case of multiple approval
         if (!isset($item['id']) && isset($_REQUEST['type']) && $_REQUEST['type'] == 'approval' && Surfer::get_id() && Comments::count_approvals_for_anchor($anchor->get_reference(), Surfer::get_id())) {
             $input .= '<p class="details">' . i18n::s('It is not your first approval for this page.') . '</p>';
         }
         // change page title too
         $context['page_title'] = sprintf(i18n::s('%s: %s'), i18n::s('Approval'), $anchor->get_title());
         // else select a regular type
     } else {
         $input = Comments::get_radio_buttons('type', $type);
         $hint = i18n::s('Please carefully select a type adequate for your comment.');
     }
     $fields[] = array($label, $input, $hint);
 }
 // the description
開發者ID:rair,項目名稱:yacs,代碼行數:31,代碼來源:edit.php

示例4: layout

 /**
  * list comments as successive notes in a thread
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $output = '';
     // empty list
     if (!SQL::count($result)) {
         return $output;
     }
     // build a list of comments
     $rows = array();
     include_once $context['path_to_root'] . 'comments/comments.php';
     while ($item = SQL::fetch($result)) {
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // get poster information
         $poster = array();
         if ($item['create_name']) {
             if (!($poster = Users::get($item['create_id']))) {
                 $poster['id'] = 0;
                 $poster['full_name'] = $item['create_name'];
                 $poster['email'] = $item['create_address'];
             }
         } else {
             if (!($poster = Users::get($item['edit_id']))) {
                 $poster['id'] = 0;
                 $poster['full_name'] = $item['edit_name'];
                 $poster['email'] = $item['edit_address'];
             }
         }
         // author description
         $author = '';
         // avatar, but not for notifications
         if ($item['type'] != 'notification' && isset($poster['avatar_url']) && $poster['avatar_url']) {
             $author .= '<img src="' . $poster['avatar_url'] . '" alt="" title="avatar" class="avatar" />' . BR;
         }
         // link to poster, if possible
         if (isset($poster['id'])) {
             $author .= Users::get_link($poster['full_name'], $poster['email'], $poster['id']);
         }
         // commands to handle this comment
         $menu = array();
         // get an icon for this comment
         $icon = Comments::get_img($item['type']);
         // link to comment permalink
         $label = Skin::build_link(Comments::get_url($item['id']), $icon, 'basic', i18n::s('View this comment')) . ' ';
         // the creation date
         if ($item['create_date']) {
             $label .= Skin::build_date($item['create_date'], 'with_hour');
         } else {
             $label .= Skin::build_date($item['edit_date'], 'with_hour');
         }
         // flag new comments
         if ($item['create_date'] >= $context['fresh']) {
             $label .= NEW_FLAG;
         }
         $menu[] = $label;
         // an approval -- can be modified, but not deleted
         if ($item['type'] == 'approval') {
             // additional commands for associates and poster and editor
             if ($anchor->is_owned()) {
                 Skin::define_img('COMMENTS_EDIT_IMG', 'comments/edit.gif');
                 $menu[] = Skin::build_link(Comments::get_url($item['id'], 'edit'), COMMENTS_EDIT_IMG . i18n::s('Edit'), 'basic');
             }
             // an automatic notification -- can be deleted, but not modified
         } elseif ($item['type'] == 'notification') {
             // additional commands for associates and poster and editor
             if ($anchor->is_owned()) {
                 Skin::define_img('COMMENTS_DELETE_IMG', 'comments/delete.gif');
                 $menu[] = Skin::build_link(Comments::get_url($item['id'], 'delete'), COMMENTS_DELETE_IMG . i18n::s('Delete'), 'basic');
             }
             // regular case
         } else {
             // additional commands for associates and poster and editor
             if (Comments::allow_modification($anchor, $item)) {
                 Skin::define_img('COMMENTS_EDIT_IMG', 'comments/edit.gif');
                 $menu[] = Skin::build_link(Comments::get_url($item['id'], 'edit'), COMMENTS_EDIT_IMG . i18n::s('Edit'), 'basic');
                 Skin::define_img('COMMENTS_DELETE_IMG', 'comments/delete.gif');
                 $menu[] = Skin::build_link(Comments::get_url($item['id'], 'delete'), COMMENTS_DELETE_IMG . i18n::s('Delete'), 'basic');
             }
         }
         // comment main text
         $text = '';
         // state clearly that this is an approval
         if ($item['type'] == 'approval' && isset($poster['id'])) {
             $text .= '<p>' . sprintf(i18n::s('%s has provided his approval'), Users::get_link($poster['full_name'], $poster['email'], $poster['id'])) . '</p>';
         }
         // display comment main text
         $text .= $item['description'];
         // display signature, but not for notifications
         if ($item['type'] != 'notification') {
             $text .= Users::get_signature($item['create_id']);
         }
         // format and display
//.........這裏部分代碼省略.........
開發者ID:rair,項目名稱:yacs,代碼行數:101,代碼來源:layout_comments_as_updates.php

示例5: sprintf

 $context['text'] .= Skin::neighbours($neighbours, 'slideshow');
 // link to the previous comment in thread, if any
 if ($item['previous_id'] && ($previous = Comments::get($item['previous_id']))) {
     $context['text'] .= ' <p>' . sprintf(i18n::s('Comment inspired from %s'), Skin::build_link(Comments::get_url($previous['id']), $previous['create_name'])) . '</p>';
 }
 // display the full comment
 $context['text'] .= Skin::build_block($item['description'], 'description');
 // list follow-ups in thread, if any
 if ($next = Comments::list_next($item['id'], 'compact')) {
     $context['text'] .= ' <p style="margin-bottom: 0; padding-bottom: 0;">' . i18n::s('This comment has inspired:') . '</p>' . Skin::build_list($next, 'compact');
 }
 // some details about this item
 $details = array();
 // the type
 if (is_object($anchor)) {
     $details[] = Comments::get_img($item['type']);
 }
 // the poster of this comment
 if ($poster = Users::get_link($item['create_name'], $item['create_address'], $item['create_id'])) {
     $details[] = sprintf(i18n::s('by %s %s'), $poster, Skin::build_date($item['create_date'], 'with_hour'));
 } else {
     $details[] = Skin::build_date($item['create_date'], 'with_hour');
 }
 // the last edition of this comment
 if ($item['create_name'] != $item['edit_name']) {
     $details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date'], 'with_hour'));
 }
 // all details
 if ($details) {
     $context['text'] .= '<p class="details">' . ucfirst(implode(' ', $details)) . "</p>\n";
 }
開發者ID:rair,項目名稱:yacs,代碼行數:31,代碼來源:view.php


注:本文中的Comments::get_img方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。