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


PHP Codes::beautify_title方法代码示例

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


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

示例1: layout

 /**
  * list articles
  *
  * @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;
     }
     // clear flows
     $text .= '<br style="clear: left" />';
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // get the related overlay
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // 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']);
         }
         // the hovering title
         if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
             $hover = strip_tags(Codes::beautify_introduction($item['introduction']));
         } else {
             $hover = i18n::s('View the page');
         }
         // title is a link to the target article
         $title =& Skin::build_link($url, $title, 'basic', $hover);
         // use the thumbnail for this article
         if ($icon = trim($item['thumbnail_url'])) {
             // fix relative path
             if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
                 $icon = $context['url_to_root'] . $icon;
             }
             // use parameter of the control panel for this one
             $options = '';
             if (isset($context['classes_for_thumbnail_images'])) {
                 $options = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
             }
             // build the complete HTML element
             $icon = '<img src="' . $icon . '" alt="" title="' . encode_field($hover) . '" ' . $options . ' />';
             // use default icon if nothing to display
         } else {
             $icon = MAP_IMG;
         }
         // use the image as a link to the target page
         $icon =& Skin::build_link($url, $icon, 'basic', $hover);
         // add a floating box
         $text .= Skin::build_box($title, $icon, 'floating');
     }
     // clear flows
     $text .= '<br style="clear: left" />';
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:67,代码来源:layout_articles_as_titles.php

示例2: layout

 /**
  * list dates
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // build the calendar
     $text = 'BEGIN:VCALENDAR' . CRLF . 'VERSION:2.0' . CRLF . 'PRODID:YACS' . CRLF . 'METHOD:PUBLISH' . CRLF;
     // organization, if any
     if (isset($context['site_name']) && $context['site_name']) {
         $text .= 'X-WR-CALNAME:' . $context['site_name'] . CRLF;
     }
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // one event at a time
         $text .= 'BEGIN:VEVENT' . CRLF;
         // the event spans limited time
         if (isset($item['duration']) && $item['duration']) {
             $text .= 'DTSTART:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($item['date_stamp'])) . CRLF;
             $text .= 'DTEND:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($item['date_stamp']) + $item['duration'] * 60) . CRLF;
             // a full-day event
         } else {
             $text .= 'DTSTART;VALUE=DATE:' . date('Ymd', SQL::strtotime($item['date_stamp'])) . CRLF;
             $text .= 'DTEND;VALUE=DATE:' . date('Ymd', SQL::strtotime($item['date_stamp']) + 86400) . CRLF;
         }
         // url to view the date
         $text .= 'URL:' . Articles::get_permalink($item) . CRLF;
         // organization, if any
         if (isset($item['introduction']) && $item['introduction']) {
             $text .= 'DESCRIPTION:' . str_replace(array("\n", "\r"), ' ', strip_tags($item['introduction'])) . CRLF;
         }
         // build a valid title
         if (isset($item['title']) && $item['title']) {
             $text .= 'SUMMARY:' . Codes::beautify_title($item['title']) . CRLF;
         }
         // required by Outlook 2003
         if (isset($item['id']) && $item['id']) {
             $text .= 'UID:' . $item['id'] . CRLF;
         }
         // date of creation
         if (isset($item['create_date']) && $item['create_date']) {
             $text .= 'CREATED:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($item['create_date'])) . CRLF;
         }
         // date of last modification
         if (isset($item['edit_date']) && $item['edit_date']) {
             $text .= 'DTSTAMP:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($item['edit_date'])) . CRLF;
         }
         // next event
         $text .= 'SEQUENCE:0' . CRLF . 'END:VEVENT' . CRLF;
     }
     // date of last update
     $text .= 'END:VCALENDAR' . CRLF;
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:61,代码来源:layout_dates_as_ics.php

示例3: layout

 /**
  * list files
  *
  * @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 = 'full';
     }
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // download the file directly
         $url = Files::get_url($item['id'], 'fetch', $item['file_name']);
         // initialize variables
         $prefix = $suffix = '';
         // flag files that are dead, or created or updated very recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private files
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // file title or file name
         $label = Codes::beautify_title($item['title']);
         if (!$label) {
             $label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
         }
         // the main anchor link, except on user profiles
         if (is_object($anchor) && $anchor->get_reference() != $this->focus) {
             $suffix .= ' - <span class="details">' . sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()))) . '</span>';
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'basic', NULL);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:57,代码来源:layout_files_as_simple.php

示例4: layout

 /**
  * list dates
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @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
     while ($item = SQL::fetch($result)) {
         // the url to use
         $url = Articles::get_permalink($item);
         // initialize variables
         $prefix = $suffix = $icon = '';
         // signal restricted and private dates/articles
         if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE) {
             $prefix .= DRAFT_FLAG;
         }
         // signal restricted and private dates/articles
         if (!isset($item['active'])) {
         } elseif ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag new dates/articles
         if ($item['edit_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         }
         // build a valid label
         if (isset($item['title'])) {
             $label = Codes::beautify_title($item['title']);
             if (isset($item['date_stamp'])) {
                 $label .= ' [' . Skin::build_date($item['date_stamp'], 'day') . ']';
             }
         } else {
             $label = Skin::build_date($item['date_stamp'], 'day');
         }
         // may have variant overlay for links
         $link_type = $this->has_variant('overlaid') ? 'overlaid' : 'basic';
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, $link_type, NULL, $item['date_stamp']);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:56,代码来源:layout_dates_as_compact.php

示例5: layout

 /**
  * list files
  *
  * @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
     while ($item = SQL::fetch($result)) {
         // download the file directly
         $url = Files::get_url($item['id'], 'fetch', $item['file_name']);
         // initialize variables
         $prefix = $suffix = '';
         // flag files that are dead, or created or updated very recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private files
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // file title or file name
         $label = Codes::beautify_title($item['title']);
         if (!$label) {
             $label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
         }
         // with hits
         if ($item['hits'] > 1) {
             $suffix .= ' <span class="details">- ' . Skin::build_number($item['hits'], i18n::s('downloads')) . '</span>';
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'basic', NULL);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:51,代码来源:layout_files_as_hits.php

示例6: layout

 /**
  * list files
  *
  * @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
     while ($item = SQL::fetch($result)) {
         // download the file directly
         $url = Files::get_url($item['id'], 'fetch', $item['file_name']);
         // file title or file name
         $label = Codes::beautify_title($item['title']);
         if (!$label) {
             $label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
         }
         // initialize variables
         $prefix = $suffix = '';
         $contributor = Users::get_link($item['create_name'], $item['create_address'], $item['create_id']);
         $flag = '';
         if ($item['create_date'] >= $context['fresh']) {
             $flag = NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $flag = UPDATED_FLAG;
         }
         $suffix .= '<span class="details"> - ' . sprintf(i18n::s('By %s'), $contributor) . ' ' . Skin::build_date($item['create_date']) . $flag . '</span>';
         // signal restricted and private files
         if ($item['active'] == 'N' && defined('PRIVATE_FLAG')) {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R' && defined('RESTRICTED_FLAG')) {
             $prefix .= RESTRICTED_FLAG;
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'file', NULL);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:49,代码来源:layout_files_as_dates.php

示例7: layout

 /**
  * list files
  *
  * @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
     while ($item = SQL::fetch($result)) {
         // play freemind maps and flash files in separate windows
         if (preg_match('/\\.(mm|swf)$/i', $item['file_name'])) {
             $url = Files::get_url($item['id'], 'stream', $item['file_name']);
         } else {
             $url = Files::get_url($item['id'], 'fetch', $item['file_name']);
         }
         // provide absolute links because these could be put in a mail
         $url = $context['url_to_home'] . $context['url_to_root'] . $url;
         // initialize variables
         $prefix = $suffix = '';
         // signal restricted and private files
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // file title or file name
         $label = Codes::beautify_title($item['title']);
         if (!$label) {
             $label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'basic', NULL);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:47,代码来源:layout_files_as_compact.php

示例8: sprintf

 $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;
         } elseif ($section['active'] == 'R') {
             $section .= RESTRICTED_FLAG;
         }
         // flag sections that are dead, or created or updated very recently
         if ($section['expiry_date'] > NULL_DATE && $section['expiry_date'] <= $context['now']) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select.php

示例9: get_invite_default_message

 /**
  * get invitation default message
  *
  * This is put in the invitation form.
  *
  * @see articles/invite.php
  *
  * @param string 'PUBLISH' or 'CANCEL'
  * @return string to be put in the web form
  */
 function get_invite_default_message($method = 'PUBLISH')
 {
     global $context;
     // to be displayed into the web form for this invitation
     $text = '';
     if ($value = $this->anchor->get_title()) {
         $text .= sprintf(i18n::c('%s: %s'), i18n::c('Topic'), Skin::build_link($context['url_to_home'] . $context['url_to_root'] . $this->anchor->get_url(), Codes::beautify_title($value))) . BR;
     }
     // dates
     if (isset($this->attributes['date_stamp']) && $this->attributes['date_stamp']) {
         $text .= sprintf(i18n::c('%s: %s'), i18n::c('Date'), Skin::build_date($this->attributes['date_stamp'], 'day')) . BR;
     }
     // build a link to the chairman page, if any
     if (isset($this->attributes['chairman']) && ($user = Users::get($this->attributes['chairman']))) {
         $text .= sprintf(i18n::c('%s: %s'), i18n::c('Chairman'), Users::get_link($user['full_name'], NULL, $user['id'])) . BR;
     }
     // event has been cancelled
     if ($method == 'CANCEL') {
         $text .= '<div><p>' . i18n::c('Event has been cancelled.') . '</p></div>';
     } else {
         // copy content of the introduction field, if any
         if ($value = $this->anchor->get_value('introduction')) {
             $text .= '<div>' . Codes::beautify('<p>' . $value . '</p>') . '</div>';
         }
         // copy the induction message, if any
         if (isset($this->attributes['induction_message'])) {
             $text .= '<div>' . Codes::render($this->attributes['induction_message']) . '</div>';
         }
     }
     // done
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:42,代码来源:day.php

示例10: layout

 /**
  * list users
  *
  * @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 (!($count = SQL::count($result))) {
         return $text;
     }
     // allow for several lists in the same page
     static $serial;
     if (isset($serial)) {
         $serial++;
     } else {
         $serial = 1;
     }
     // don't blast too many people
     if ($count > 100) {
         $checked = '';
     } elseif (isset($this->layout_variant) && $this->layout_variant == 'unchecked') {
         $checked = '';
     } else {
         $checked = ' checked="checked"';
     }
     // div prefix
     $text .= '<div id="users_as_mail_panel_' . $serial . '">';
     // allow to select/deslect multiple rows at once
     $text .= '<input type="checkbox" class="row_selector" onclick="check_user_as_mail_panel_' . $serial . '(\'div#users_as_mail_panel_' . $serial . '\', this);"' . $checked . ' /> ' . i18n::s('Select all/none') . BR;
     // process all items in the list
     $count = 0;
     while ($item = SQL::fetch($result)) {
         // we need some address
         if (!$item['email']) {
             continue;
         }
         // do not write to myself
         if ($item['id'] == Surfer::get_id()) {
             continue;
         }
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'user:' . $item['id']);
         // column to select the row
         $text .= '<input type="checkbox" name="selected_users[]" class="row_selector" value="' . encode_field($item['email']) . '"' . $checked . ' />';
         // signal restricted and private users
         if ($item['active'] == 'N') {
             $text .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $text .= RESTRICTED_FLAG;
         }
         // the url to view this item
         $url = Users::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['full_name']);
         }
         // sanity check
         if (!$title) {
             $title = $item['nick_name'];
         }
         // link to this page
         $text .= Skin::build_link($url, $title, 'user');
         // the introductory text
         if ($item['introduction']) {
             $text .= '<span class="tiny"> - ' . Codes::beautify_introduction($item['introduction']) . '</span>';
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $text .= $overlay->get_text('list', $item);
         }
         // display all tags
         if ($item['tags']) {
             $text .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'user:' . $item['id']) . '</span>';
         }
         // append the row
         $text .= BR;
         $count++;
     }
     // the script used to check all items at once
     Page::insert_script('function check_user_as_mail_panel_' . $serial . '(scope, handle) {' . "\n" . '	$(scope + " input[type=\'checkbox\'].row_selector").each(' . "\n" . '		function() { $(this).attr("checked", $(handle).is(":checked"));}' . "\n" . '	);' . "\n" . '}' . "\n");
     // div suffix
     $text .= '</div>';
     // no valid account has been found
     if (!$count) {
         $text = '';
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:99,代码来源:layout_users_as_mail.php

示例11: layout

 /**
  * list articles 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 articles
     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']);
         }
         // 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;
         }
         // 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,代码行数:90,代码来源:layout_articles_as_directory.php

示例12: layout

 /**
  * list articles
  *
  * @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;
     }
     // sanity check
     if (!isset($this->focus)) {
         $this->focus = 'map';
     }
     // put in cache
     $cache_id = Cache::hash('articles/layout_articles_as_carrousel:' . $this->focus) . '.xml';
     // save for one minute
     if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 60 < time()) {
         // content of the slideshow
         $content = '<?xml version="1.0" encoding="utf-8"?><!-- fhShow Carousel 2.0 configuration file Please visit http://www.flshow.net/ -->' . "\n" . '<slide_show>' . "\n" . '	<options>' . "\n" . '		<debug>false</debug>				  <!-- true, false -->' . "\n" . '		<background>transparent</background>	  <!-- #RRGGBB, transparent -->' . "\n" . '		<friction>5</friction>			  <!-- [1,100] -->' . "\n" . '		<fullscreen>false</fullscreen>	  <!-- true, false -->' . "\n" . '		<margins>' . "\n" . '			<top>0</top>								  <!-- [-1000,1000] pixels -->' . "\n" . '			<left>0</left>							  <!-- [-1000,1000] pixels -->' . "\n" . '			<bottom>0</bottom>						  <!-- [-1000,1000] pixels -->' . "\n" . '			<right>0</right>							  <!-- [-1000,1000] pixels -->' . "\n" . '			<horizontal_ratio>20%</horizontal_ratio>	  <!-- [1,50] a photo may occupy at most horizontalRatio percent of the Carousel width -->' . "\n" . '			<vertical_ratio>90%</vertical_ratio>		  <!-- [1,100] a photo may occupy at most verticalRatio percent of the Carousel height -->' . "\n" . '		</margins>' . "\n" . '		<interaction>' . "\n" . '			<rotation>mouse</rotation>			<!-- auto, mouse, keyboard -->' . "\n" . '			<view_point>none</view_point>		   <!-- none, mouse, keyboard -->' . "\n" . '			<speed>15</speed>						<!-- [-360,360] degrees per second -->' . "\n" . '			<default_speed>15</default_speed>				<!-- [-360,360] degrees per second -->' . "\n" . '			<default_view_point>20%</default_view_point>	<!-- [0,100] percentage -->' . "\n" . '			<reset_delay>20</reset_delay>					<!-- [0,600] seconds, 0 means never reset -->' . "\n" . '		</interaction>' . "\n" . '		<far_photos>' . "\n" . '			<size>50%</size>					<!-- [0,100] percentage -->' . "\n" . '			<amount>50%</amount>				<!-- [0,100] percentage -->' . "\n" . '			<blur>10</blur>					<!-- [0,100] amount -->' . "\n" . '			<blur_quality>3</blur_quality>	<!-- [1,3] 1=low - 3=high -->' . "\n" . '		</far_photos>' . "\n" . '		<reflection>' . "\n" . '			<amount>25</amount>	   <!-- [0,1000] pixels -->' . "\n" . '			<blur>2</blur>			<!-- [0,100] blur amount -->' . "\n" . '			<distance>0</distance>	<!-- [-1000,1000] pixels -->' . "\n" . '			<alpha>40%</alpha>		<!-- [0,100] percentage -->' . "\n" . '		</reflection>' . "\n" . '		<titles>' . "\n" . '			<style>font-size: 14px; font-family: Verdana, _serif; color: #000000;</style>' . "\n" . '			<position>above center</position>			  <!-- [above, below] [left,center,right]-->' . "\n" . '			<background>' . $context['url_to_home'] . $context['url_to_root'] . 'skins/_reference/layouts/carrousel_bubble.png</background>	   <!-- image url -->' . "\n" . '			<scale9>35 35 35 35</scale9>				 <!-- [0,1000] pixels -->' . "\n" . '			<padding>8 15 10 15</padding>					<!-- [-1000,1000] pixels -->' . "\n" . '		</titles>' . "\n" . '	</options>' . "\n";
         // get a default image
         if (Safe::GetImageSize($context['path_to_root'] . $context['skin'] . '/layouts/map.gif')) {
             $default_href = $context['url_to_root'] . $context['skin'] . '/layouts/map.gif';
         } elseif ($size = Safe::GetImageSize($context['path_to_root'] . 'skins/_reference/layouts/map.gif')) {
             $default_href = $context['url_to_root'] . 'skins/_reference/layouts/map.gif';
         } else {
             $default_href = NULL;
         }
         // process all items in the list
         while ($item = SQL::fetch($result)) {
             // get the related overlay
             $overlay = Overlay::load($item, 'article:' . $item['id']);
             // get the anchor
             $anchor = Anchors::get($item['anchor']);
             // this is visual
             if (isset($item['icon_url']) && $item['icon_url']) {
                 $image = $item['icon_url'];
             } elseif (isset($item['thumbnail_url']) && $item['thumbnail_url']) {
                 $image = $item['thumbnail_url'];
             } elseif (is_callable(array($anchor, 'get_bullet_url')) && ($image = $anchor->get_bullet_url())) {
             } elseif ($default_href) {
                 $image = $default_href;
             } else {
                 continue;
             }
             // fix relative path
             if (!preg_match('/^(\\/|http:|https:|ftp:)/', $image)) {
                 $image = $context['url_to_home'] . $context['url_to_root'] . $image;
             }
             // build a title
             if (is_object($overlay)) {
                 $title = Codes::beautify_title($overlay->get_text('title', $item));
             } else {
                 $title = Codes::beautify_title($item['title']);
             }
             // the url to view this item
             $url = Articles::get_permalink($item);
             // add to the list
             $content .= '	<photo>' . "\n" . '		<title>' . $title . '</title>' . "\n" . '		<src>' . $image . '</src>' . "\n" . '		<href>' . $url . '</href>' . "\n" . '		<target>_self</target>' . "\n" . '	</photo>' . "\n";
         }
         // finalize slideshow content
         $content .= '</slide_show>';
         // put in cache
         Safe::file_put_contents($cache_id, $content);
     }
     // allow multiple instances
     static $count;
     if (!isset($count)) {
         $count = 1;
     } else {
         $count++;
     }
     // load the right file
     $text = '<div id="articles_as_carrousel_' . $count . '"></div>' . "\n";
     Page::insert_script('swfobject.embedSWF("' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/carrousel.swf",' . "\n" . '"articles_as_carrousel_' . $count . '",' . "\n" . '"100%",' . "\n" . '"150",' . "\n" . '"9.0.0",' . "\n" . 'false,' . "\n" . '{xmlfile:"' . $context['url_to_home'] . $context['url_to_root'] . $cache_id . '", loaderColor:"0x666666"},' . "\n" . '{wmode: "transparent"},' . "\n" . '{});' . "\n");
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:86,代码来源:layout_articles_as_carrousel.php

示例13: layout

 /**
  * list files
  *
  * Recognize following variants:
  * - 'section:123' to list items attached to one particular anchor
  * - 'no_author' to list items attached to one user profile
  *
  * @param resource the SQL result
  * @return string HTML text to be displayed, or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // sanity check
     if (!isset($this->focus)) {
         $this->focus = '';
     }
     // process all items in the list
     $items = array();
     while ($item = SQL::fetch($result)) {
         // one box at a time
         $box = '';
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // we feature only the head of the list, if we are at the origin page
         if (!count($items) && $anchor && is_string($this->focus) && $this->focus == $anchor->get_reference()) {
             $box .= Codes::render_object('file', $item['id']);
             // no side icon
             $icon = '';
             // we are listing various files from various places
         } else {
             $prefix = $suffix = '';
             // stream the file
             if (Files::is_stream($item['file_name'])) {
                 $url = Files::get_url($item['id'], 'stream', $item['file_name']);
             } else {
                 $url = Files::get_url($item['id'], 'fetch', $item['file_name']);
             }
             // absolute url
             $url = $context['url_to_home'] . $context['url_to_root'] . $url;
             // signal restricted and private files
             if ($item['active'] == 'N') {
                 $prefix .= PRIVATE_FLAG;
             } elseif ($item['active'] == 'R') {
                 $prefix .= RESTRICTED_FLAG;
             }
             // file title or file name
             $label = Codes::beautify_title($item['title']);
             if (!$label) {
                 $label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
             }
             // show a reference to the file for members
             $hover = i18n::s('Get the file');
             if (Surfer::is_member()) {
                 $hover .= ' [file=' . $item['id'] . ']';
             }
             // flag files uploaded recently
             if ($item['create_date'] >= $context['fresh']) {
                 $suffix .= NEW_FLAG;
             } elseif ($item['edit_date'] >= $context['fresh']) {
                 $suffix .= UPDATED_FLAG;
             }
             // one line of text
             $box .= $prefix . Skin::build_link($url, $label, 'basic', $hover) . $suffix;
             // side icon
             if ($item['thumbnail_url']) {
                 $icon = $item['thumbnail_url'];
             } else {
                 $icon = $context['url_to_root'] . Files::get_icon_url($item['file_name']);
             }
             // build the complete HTML element
             $icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($label)) . '" />';
             // make it a clickable link
             $icon = Skin::build_link($url, $icon, 'basic');
         }
         // first line of details
         $details = array();
         // file poster and last action
         if ($this->layout_variant != 'no_author') {
             $details[] = sprintf(i18n::s('shared by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
         } else {
             $details[] = Skin::build_date($item['edit_date']);
         }
         // downloads
         if ($item['hits'] > 1) {
             $details[] = Skin::build_number($item['hits'], i18n::s('downloads'));
         }
         // file size
         if ($item['file_size'] > 1) {
             $details[] = Skin::build_number($item['file_size'], i18n::s('bytes'));
         }
         // anchor link
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_files.php

示例14: substr

 /**
  * get sections as radio buttons
  *
  * This allow to move a page to a parent section, or to a child section
  *
  * @param string the current anchor to an existing section (e.g., 'section:12')
  * @param int id of the section that is moved
  * @return the HTML to insert in the page
  *
  * @see articles/edit.php
  * @see articles/import.php
  * @see files/edit.php
  * @see images/edit.php
  * @see links/edit.php
  * @see panel.php
  * @see skins/upload.php
  */
 public static function &get_radio_buttons($current = NULL, $me = NULL)
 {
     global $context;
     // we put radio buttons in a string
     $text = '';
     // get section id from reference
     if (!strncmp($current, 'section:', 8)) {
         $current = substr($current, 8);
     }
     // get the current parent, if any
     $item = Sections::get($current);
     // list all children sections of parent
     $children = '';
     if (isset($item['id'])) {
         $query = "SELECT * FROM " . SQL::table_name('sections') . " AS sections" . " WHERE (anchor LIKE 'section:" . $item['id'] . "')" . " ORDER BY sections.rank, sections.title, sections.edit_date DESC LIMIT 5000";
         if ($result = SQL::query($query)) {
             while ($row = SQL::fetch($result)) {
                 if ($children) {
                     $children .= BR;
                 }
                 // prevent anchoring to myself
                 if ($row['id'] == $me) {
                     $children .= '<input type="radio" name="anchor" value="section:' . $row['id'] . '" disabled="disabled" /> <i>' . Codes::beautify_title($row['title']) . '</i>';
                 } else {
                     $children .= '<input type="radio" name="anchor" value="section:' . $row['id'] . '" /> ' . Codes::beautify_title($row['title']);
                 }
             }
         }
     }
     // list sections at the same level as parent
     $family = '';
     if (isset($item['anchor']) && ($granparent = Anchors::get($item['anchor']))) {
         // limit to accessible scope
         $query = "SELECT * FROM " . SQL::table_name('sections') . " AS sections" . " WHERE (anchor LIKE '" . $item['anchor'] . "') AND " . sections::get_sql_where() . " ORDER BY sections.rank, sections.title, sections.edit_date DESC LIMIT 5000";
         if ($result = SQL::query($query)) {
             // brothers and sisters of parent
             while ($row = SQL::fetch($result)) {
                 if ($family && strncmp(substr($family, -6), '</div>', 6)) {
                     $family .= BR;
                 }
                 if ($row['id'] == $item['id']) {
                     if ($children) {
                         $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']) . '<div style="margin: 0 0 0 3em">' . $children . '</div>';
                     } else {
                         $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']);
                     }
                 } else {
                     $family .= '<input type="radio" name="anchor" value="section:' . $row['id'] . '" /> ' . Codes::beautify_title($row['title']);
                 }
             }
         }
         // move to granparent
         if ($granparent->is_assigned()) {
             $family = '<input type="radio" name="anchor" value="' . $granparent->get_reference() . '" /> ' . $granparent->get_title() . '<div style="margin: 0 0 0 3em">' . $family . '</div>';
         } else {
             $family = '<input type="radio" name="anchor" value="' . $granparent->get_reference() . '"  disabled="disabled" /> ' . $granparent->get_title() . '<div style="margin: 0 0 0 3em">' . $family . '</div>';
         }
         // list top-level sections
     } else {
         // at the very top of the content tree
         if (surfer::is_associate()) {
             $family .= '<input type="radio" name="anchor" value="" ' . (!isset($item['id']) ? 'checked="checked"' : '') . ' /> ' . i18n::s('Top of the content tree') . BR . '<div style="margin: 0 0 0 3em">';
         }
         // restrict to accessible scope
         $where = sections::get_sql_where();
         // always mention current and parent sections
         if ($me) {
             $where .= " OR (sections.id=" . $me . ")";
         }
         if ($current) {
             $where .= " OR (sections.id=" . $current . ")";
         }
         // list regular sections first
         $query = "SELECT * FROM " . SQL::table_name('sections') . " AS sections" . " WHERE (sections.anchor='' OR sections.anchor IS NULL) AND (" . $where . ")" . " AND (sections.index_map = 'Y')" . " ORDER BY sections.rank, sections.title, sections.edit_date DESC LIMIT 5000";
         if ($result = SQL::query($query)) {
             // process all matching sections
             while ($row = SQL::fetch($result)) {
                 if ($row['id'] == $item['id']) {
                     if ($children) {
                         $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']) . '<div style="margin: 0 0 0 3em">' . $children . '</div>';
                     } else {
                         $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']) . BR;
                     }
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:sections.php

示例15: elseif

            $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>' . Users::list_for_ids($owners, 'request') . Skin::finalize_list(array(Skin::build_submit_button(i18n::s('Submit a request to get access'))), 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '">' . '</div></form>';
        }
    }
    // re-enforce the canonical link
} elseif (!$zoom_type && $page == 1 && $context['self_url'] && $whole_rendering && strncmp($context['self_url'], $context['page_link'], strlen($context['page_link']))) {
    Safe::header('Status: 301 Moved Permanently', TRUE, 301);
    Safe::header('Location: ' . $context['page_link']);
    Logger::error(Skin::build_link($context['page_link']));
    // display the article
} else {
    // behaviors can change page menu
    if (is_object($behaviors)) {
        $context['page_menu'] = $behaviors->add_commands('articles/view.php', 'article:' . $item['id'], $context['page_menu']);
    }
    // remember surfer visit
    Surfer::is_visiting(Articles::get_permalink($item), Codes::beautify_title($item['title']), 'article:' . $item['id'], $item['active']);
    // increment silently the hits counter if not robot, nor associate, nor owner, nor at follow-up page
    if (Surfer::is_crawler() || Surfer::is_associate()) {
    } elseif (isset($item['owner_id']) && Surfer::is($item['owner_id'])) {
    } elseif (!$zoom_type) {
        $item['hits'] = isset($item['hits']) ? $item['hits'] + 1 : 1;
        Articles::increment_hits($item['id']);
    }
    // initialize the rendering engine
    Codes::initialize(Articles::get_permalink($item));
    // neighbours information
    $neighbours = NULL;
    if (Articles::has_option('with_neighbours', $anchor, $item) && is_object($anchor)) {
        $neighbours = $anchor->get_neighbours('article', $item);
    }
    //
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php


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