本文整理汇总了PHP中Skin::strip方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::strip方法的具体用法?PHP Skin::strip怎么用?PHP Skin::strip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::strip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
// 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)) {
// url to view the comment
$url = Comments::get_url($item['id']);
// initialize variables
$prefix = $label = $suffix = $icon = '';
// the title as the label
if ($item['create_name']) {
$label .= ucfirst($item['create_name']) . ' ';
}
// time of creation
$label .= Skin::build_date($item['create_date']);
// text beginning
if ($text = Skin::strip($item['description'], 10, NULL, NULL)) {
$suffix = ' - ' . $text;
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'comment', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例2: layout
/**
* list tables
*
* Recognize following variants:
* - 'no_anchor' to list items attached to one particular anchor
*
* @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)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Tables::get_url($item['id']);
// flag tables created or updated very recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
$label = Skin::strip($item['title'], 10);
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'table', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例3: layout
/**
* list sections
*
* @param resource the SQL result
* @return an array of $url => (NULL, $title, NULL, 'section_123', NULL, 'visit this section')
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// no hovering label
$href_title = '';
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// the url to view this item
$url = Sections::get_permalink($item);
// initialize variables
$prefix = $suffix = '';
// list all components for this item
$items[$url] = array($prefix, ucfirst(Skin::strip($item['index_title'], 30)), $suffix, 'section_' . $item['id'], NULL, $href_title);
}
// end of processing
SQL::free($result);
return $items;
}
示例4: 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 (!($delta = SQL::count($result))) {
return $text;
}
// flag idle users
$idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
// process all items in the list
$count = 0;
$items = array();
while ($item = SQL::fetch($result)) {
// url to view the user
$url = Users::get_permalink($item);
// initialize variables
$prefix = $suffix = '';
// signal restricted and private users
if (isset($item['active']) && $item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif (isset($item['active']) && $item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked profiles
if (isset($item['capability']) && $item['capability'] == '?') {
$prefix .= EXPIRED_FLAG;
}
// item title
if (isset($item['full_name']) && $item['full_name']) {
$label = ucfirst(Skin::strip($item['full_name'], 10));
$hover = $item['nick_name'];
} else {
$label = ucfirst(Skin::strip($item['nick_name'], 10));
$hover = $item['full_name'];
}
// flag idle users
if (!isset($item['click_date']) || $item['click_date'] < $idle) {
$class = 'idle user';
} else {
$class = 'user';
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, $class, NULL, $hover);
// provide only some results
if (++$count >= 5) {
break;
}
}
// end of processing
SQL::free($result);
// turn this to some text
$text = Skin::build_list($items, 'comma');
// some indications on the number of connections
if ($delta -= $count) {
$text .= ', ...';
}
return $text;
}
示例5: layout
/**
* list servers
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Servers::get_url($item['id']);
// use the title as a label
$label = Skin::strip($item['title'], 10);
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'server', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例6: layout
/**
* list images
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// url to view the image
$url = Images::get_url($item['id']);
// initialize variables
$prefix = $suffix = '';
// flag new images
if ($item['edit_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
}
// image title or image name
$label = Skin::strip($item['title'], 10);
if (!$label) {
$name_as_title = TRUE;
$label = ucfirst($item['image_name']);
}
$label = str_replace('_', ' ', str_replace('%20', ' ', $label));
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'basic', NULL);
}
// end of processing
SQL::free($result);
return $items;
}
示例7: layout
/**
* list servers
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Servers::get_url($item['id']);
// use the title as a label
$label = Skin::strip($item['title'], 10);
// flag files uploaded recently
if ($item['edit_date'] >= $context['fresh']) {
$prefix = NEW_FLAG . $prefix;
}
// description
if ($item['description']) {
$suffix .= ' ' . ucfirst(trim($item['description']));
}
// the menu bar for associates and poster
if (Surfer::is_empowered() || Surfer::is($item['edit_id'])) {
$menu = array(Servers::get_url($item['id'], 'edit') => i18n::s('Edit'), Servers::get_url($item['id'], 'delete') => i18n::s('Delete'));
$suffix .= ' ' . Skin::build_list($menu, 'menu');
}
// add a separator
if ($suffix) {
$suffix = ' - ' . $suffix;
}
// append details to the suffix
$suffix .= BR . '<span class="details">';
// details
$details = array();
// item poster
if ($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']));
}
// the edition date
$details[] = Skin::build_date($item['edit_date']);
// all details
if (count($details)) {
$suffix .= ucfirst(implode(', ', $details)) . "\n";
}
// end of details
$suffix .= '</span>';
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'server', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例8: layout
/**
* list users
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// url to view the user profile
$url = Users::get_permalink($item);
// time of last update
$time = SQL::strtotime($item['edit_date']);
// item title
if ($item['full_name']) {
$label = ucfirst(Skin::strip($item['full_name'], 10));
} else {
$label = ucfirst(Skin::strip($item['nick_name'], 10));
}
// the section
$section = '';
// the author(s) is an e-mail address, according to rss 2.0 spec
$author .= $item['edit_address'] . ' (' . $item['edit_name'] . ')';
// introduction
$introduction = Codes::beautify($item['introduction']);
// the description
$description = Codes::beautify($item['description']);
// cap the number of words
$description = Skin::cap($description, 300);
// fix image references
$description = preg_replace('#"/([^">]+?)"#', '"' . $context['url_to_home'] . '/$1"', $description);
// other rss fields
$extensions = array();
// list all components for this item
$items[$url] = array($time, $label, $author, $section, $icon, $introduction, $description, $extensions);
}
// end of processing
SQL::free($result);
return $items;
}
示例9: layout
/**
* list categories
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// url to view the comment
$url = Categories::get_permalink($item);
// use the title to label the link
$label = ucfirst(Skin::strip($item['title'], 20));
// number of items for this category
$count = 0;
// count sections for this category
if ($scount = Members::count_sections_for_anchor('category:' . $item['id'])) {
$count += $scount;
}
// count articles for this category
if ($acount = Members::count_articles_for_anchor('category:' . $item['id'])) {
$count += $acount;
}
// format total count of items
if ($count) {
$count = ' (' . $count . ')';
} else {
$count = '';
}
// list all components for this item
$items[$url] = array('', $label, $count, 'basic', NULL);
}
// end of processing
SQL::free($result);
return $items;
}
示例10: layout
/**
* list locations
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// url to view the location
$url = Locations::get_url($item['id']);
// initialize variables
$prefix = $suffix = '';
// flag new locations
if ($item['edit_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
}
// build a valid label
if ($item['geo_place_name']) {
$label = Skin::strip($item['geo_place_name'], 10);
} else {
$label = $item['latitude'] . ', ' . $item['longitude'];
}
// the distance, if any
$distance = '';
if ($item['distance']) {
$distance = ' ' . round($item['distance'], -1) . ' km';
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'basic', NULL);
}
// end of processing
SQL::free($result);
return $items;
}
示例11: layout
/**
* list servers
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// the url to view this item
$url = Servers::get_url($item['id']);
// use the title as a label
$label = Skin::strip($item['title'], 10);
// list all components for this item
$items[$url] = array('', $label, ' ' . Skin::build_date($item['edit_date']), 'server', NULL);
}
// end of processing
SQL::free($result);
return $items;
}
示例12: layout
/**
* list categories
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// url to view the comment
$url = Categories::get_permalink($item);
// use the title to label the link
$label = ucfirst(Skin::strip($item['title'], 20));
// list all components for this item
$items[$url] = array('', $label, NULL, 'basic', NULL);
}
// end of processing
SQL::free($result);
return $items;
}
示例13: layout
/**
* list sections
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the related overlay, if any
$overlay = Overlay::load($item, 'section:' . $item['id']);
// the url to view this item
$url = Sections::get_permalink($item);
// initialize variables
$prefix = $label = $suffix = '';
// flag sections that are draft or dead
if ($item['activation_date'] >= $context['now']) {
$prefix .= DRAFT_FLAG;
} elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
}
// signal restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// flag items updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// // start the label with family, if any
// if($item['family'])
// $label = ucfirst(Skin::strip($item['family'], 30)).' - ';
// use the title to label the link
if (is_object($overlay)) {
$label = ucfirst(Codes::beautify_title($overlay->get_text('title', $item)));
} else {
$label .= ucfirst(Skin::strip($item['index_title'], 30));
}
// 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 section');
}
// help members to reference this page
if (Surfer::is_member()) {
$hover .= ' [section=' . $item['id'] . ']';
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'basic', NULL, $hover);
}
// end of processing
SQL::free($result);
return $items;
}
示例14: encode_field
$description = Skin::strip(Codes::beautify($item['description']), 50);
}
// prepare the response
$text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n" . ' <rdf:Description rdf:about="' . $url . '">' . "\n" . ' <dc:title>' . encode_field($item['title']) . '</dc:title>' . "\n" . ' <dc:description>' . encode_field(Skin::strip($description)) . '</dc:description>' . "\n" . ' <dc:date>' . gmdate('Y-m-d') . '</dc:date>' . "\n" . ' <dc:format>text/html</dc:format>' . "\n";
if (isset($item['language']) && $item['language'] && $item['language'] != 'none') {
$text .= ' <dc:language>' . $item['language'] . '</dc:language>' . "\n";
}
$text .= ' </rdf:Description>' . "\n" . '</rdf:RDF>';
//
// transfer to the user agent
//
// handle the output correctly
render_raw('text/xml; charset=' . $context['charset']);
// suggest a name on download
if (!headers_sent()) {
$file_name = utf8::to_ascii(Skin::strip($context['page_title']) . '.opml.xml');
Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook, then exit
示例15: layout
/**
* list categories
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return plain text
$text = '';
// process all items in the list
while ($item = SQL::fetch($result)) {
// one box per category
$box['title'] = '';
$box['text'] = '';
// use the title to label the link
$box['title'] = Skin::strip($item['title'], 50);
// list related categories, if any
if ($items = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'category') . '</li>' . "\n";
}
}
// info on related sections
$items =& Members::list_sections_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'section') . '</li>' . "\n";
}
}
// info on related articles
if (isset($item['options']) && preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
$items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
} else {
$items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'article') . '</li>' . "\n";
}
}
// info on related files
if (isset($item['options']) && preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
$items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
} else {
$items = Files::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'file') . '</li>' . "\n";
}
}
// info on related comments
include_once $context['path_to_root'] . 'comments/comments.php';
if ($items = Comments::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'comment') . '</li>' . "\n";
}
}
// info on related links
include_once $context['path_to_root'] . 'links/links.php';
if (isset($item['options']) && preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
$items = Links::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
} else {
$items = Links::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label) . '</li>' . "\n";
}
}
// add a direct link to the category
if (Surfer::is_associate()) {
$box['title'] .= ' ' . Skin::build_link(Categories::get_permalink($item), MORE_IMG, 'basic');
//.........这里部分代码省略.........