本文整理汇总了PHP中trim_text函数的典型用法代码示例。如果您正苦于以下问题:PHP trim_text函数的具体用法?PHP trim_text怎么用?PHP trim_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trim_text函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render_photoAlbum
function render_photoAlbum(array $info = array())
{
// add admin edit.
global $locale, $gallery_settings;
echo "<div class='panel panel-default'>\n";
echo "<div class='panel-heading'>\n";
echo "<a title='" . $locale['430'] . "' href='" . $info['album_link']['link'] . "'>\n<strong>" . trim_text($info['album_link']['name'], 18) . "</strong>\n</a>\n";
echo "</div>\n";
echo "<div class='overflow-hide' style='background: #ccc; height: " . ($gallery_settings['thumb_h'] - 15) . "px'>\n";
echo $info['image'];
echo "</div>\n";
echo "<div class='panel-body'>\n";
echo "<span class='album_count'>" . $info['photo_rows'] . " " . ($info['photo_rows'] > 1 ? $locale['462'] : $locale['461']) . "</span>";
echo "</div>\n";
echo "<div class='panel-footer'>\n";
echo "<abbr title='" . $locale['464'] . showdate("shortdate", $info['album_datestamp']) . "'><i class='entypo calendar text-lighter'></i></abbr> " . timer($info['album_datestamp']) . "";
if (!empty($info['album_edit']) && !empty($info['album_delete'])) {
echo "</div>\n<div class='panel-footer'>\n";
echo "<a class='btn btn-default' href='" . $info['album_edit']['link'] . "' title='" . $info['album_edit']['name'] . "'><i class='fa fa-edit fa-lg'></i></a>\n";
echo "<a class='btn btn-danger' href='" . $info['album_delete']['link'] . "' title='" . $info['album_delete']['name'] . "'><i class='fa fa-trash fa-lg'></i></a>\n";
}
echo "</div></div>\n";
}
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:23,代码来源:gallery.php
示例2: parseDescription
private function parseDescription($text)
{
if ($this->content === 'getVideoEntry') {
return $text;
} else {
return trim_text($text, 90);
}
}
开发者ID:videouri,项目名称:videouri-old,代码行数:8,代码来源:ApiProcessing.php
示例3: show_faq
function show_faq($faq_cat_id, $total_faq_count)
{
global $locale, $aidlink, $show_faqs;
// xss
$_GET['faq_start'] = isset($_GET['faq_start']) && isnum($_GET['faq_start']) && $_GET['faq_start'] <= $total_faq_count ? $_GET['faq_start'] : 0;
echo "<tr id='faq_" . $faq_cat_id . "' class='faq_list'>\n<td colspan='4'>\n";
echo "<div class='panel panel-default'>\n";
echo "<div class='panel-body'>\n";
// need to improve a faq ordering .. it's hard manage content
$result2 = dbquery("SELECT faq_id, faq_question, faq_answer\n\t\t\tFROM " . DB_FAQS . " WHERE faq_cat_id='" . intval($faq_cat_id) . "'\n\t\t\tORDER BY faq_id\n\t\t\tlimit " . intval($_GET['faq_start']) . ", " . intval($show_faqs) . "\n\t\t\t");
$faq_rows = dbrows($result2);
if ($faq_rows) {
echo "<table class='table table-responsive table-hover table-striped'>\n";
echo "<tr><th colspan='2' style='border-top:0;'>\n";
echo "<div class='pull-right'>" . sprintf($locale['faq_0114'], $faq_rows, $total_faq_count) . "</div>\n";
if ($total_faq_count > $faq_rows) {
echo makepagenav($_GET['faq_start'], $show_faqs, $total_faq_count, 3, FUSION_SELF . $aidlink . "&show_faq=" . $faq_cat_id . "&", "faq_start");
}
echo "</td></th>\n";
echo "<tbody>\n";
while ($data2 = dbarray($result2)) {
echo "<tr>\n<td>\n\n\t\t\t\t\t<strong>" . $locale['faq_0110'] . " " . $data2['faq_question'] . "</strong><br/>\n\n\t\t\t\t\t<strong>" . $locale['faq_0111'] . "</strong>" . trim_text(parse_textarea($data2['faq_answer']), 60) . "<br/>\n\n\t\t\t\t\t</td>\n";
echo "<td align='right'>\n<a href='" . FUSION_SELF . $aidlink . "&action=edit&faq_cat_id=" . $faq_cat_id . "&faq_id=" . $data2['faq_id'] . "&section=faqs'>" . $locale['faq_0107'] . "</a> -\n";
echo "<a href='" . FUSION_SELF . $aidlink . "&action=delete&faq_cat_id=" . $faq_cat_id . "&faq_id=" . $data2['faq_id'] . "&section=faqs' onclick=\"return confirm('" . $locale['faq_0112'] . "');\">" . $locale['faq_0108'] . "</a></td>\n";
echo "</tr>\n";
}
echo "</tbody>\n</table>\n";
} else {
echo $locale['faq_0113'];
}
echo "</div>\n</div></td></tr>";
}
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:32,代码来源:faq_admin.php
示例4: widget
/**
* Widget
*
* Display the widget in the sidebar
* Save output to the cache if empty
*
* @param array sidebar arguments
* @param array instance
*/
public function widget($args, $instance)
{
// Get the widget cache from the transient
$cache = get_transient('asp_widget_cache');
// If this category widget instance is cached, get from the cache
/*if ( isset( $cache[$this->id] ) ) {
echo $cache[$this->id];
return false;
}*/
// Otherwise Start buffering and output the Widget
ob_start();
extract($args);
// Set the widget title
$title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Product Category', 'asp'), $instance, $this->id_base);
// Get options
$cat1 = isset($instance['cat1']) ? $instance['cat1'] : 0;
$cat2 = isset($instance['cat2']) ? $instance['cat2'] : 0;
$cat3 = isset($instance['cat3']) ? $instance['cat3'] : 0;
$cat4 = isset($instance['cat4']) ? $instance['cat4'] : 0;
$cat5 = isset($instance['cat5']) ? $instance['cat5'] : 0;
$cat6 = isset($instance['cat6']) ? $instance['cat6'] : 0;
$cat7 = isset($instance['cat7']) ? $instance['cat7'] : 0;
$cat8 = isset($instance['cat8']) ? $instance['cat8'] : 0;
$cat9 = isset($instance['cat9']) ? $instance['cat9'] : 0;
$cat10 = isset($instance['cat10']) ? $instance['cat10'] : 0;
$cat11 = isset($instance['cat11']) ? $instance['cat11'] : 0;
$cat12 = isset($instance['cat12']) ? $instance['cat12'] : 0;
// Print the widget wrapper & title
echo $before_widget;
echo $before_title . $title . $after_title;
//echo "<ul>";
for ($i = 1; $i < 13; $i++) {
$a = 'cat' . $i;
$term = get_term(${$a}, 'product_cat');
if ($term && !is_wp_error($term)) {
$thumbnail_id = get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true);
$image = wp_get_attachment_url($thumbnail_id);
if (empty($image)) {
$image = plugins_url() . '/ASP_plugin/images/no_cat_thumb.png';
}
?>
<div title="<?php
echo $term->name;
?>
" class="asp-product-category">
<a href="<?php
echo get_term_link($term->slug, 'product_cat');
?>
"><img src="<?php
echo $image;
?>
" style="width:150px;height:87px;" /></a>
<div title="<?php
echo $term->name;
?>
" class="asp-product-category-title-bar"><?php
echo trim_text($term->name, 27);
?>
</div>
</div>
<?php
}
}
//echo "</ul>";
// Print closing widget wrapper
echo $after_widget;
// Flush output buffer and save to transient cache
$result = ob_get_flush();
$cache[$this->id] = $result;
set_transient('asp_widget_cache', $cache, 3600 * 3);
// 3 hours ahead
}
开发者ID:jaiweb,项目名称:ASP,代码行数:81,代码来源:asp_product_category.php
示例5: format_text
function format_text($text)
{
$text = html_entity_decode($text);
$enter = array("\r", "<br />", "<br>", "<br/>", "<p>", "</p>");
$text = str_replace($enter, "\n", $text);
$words = array(" ", "", """, "<", ">", "&", "®", "©", "®", "©");
$text = str_replace($words, "", $text);
$text = trim($text);
$text = trim_text($text);
$text = str_replace("\n \n", "\n", $text);
$text = trim_dot($text);
//$text = trim_period($text);
$text = trim_sigh($text);
$text = trim_dot_zh($text);
$text = trim_period_zh($text);
$text = trim_sigh_zh($text);
$text = build_text($text);
$text = " " . $text;
$text = str_replace("\n", "\n\n ", $text);
$text = str_replace(" ", " ", $text);
$text = nl2br($text);
return $text;
}
开发者ID:pbchen,项目名称:dns-cache,代码行数:23,代码来源:function.inc.php
示例6: foreach
$list .= '<tr>';
$list .= '<th>user</th>';
$list .= '<th>time</th>';
$list .= '<th>content</th>';
$list .= '<th>action</th>';
$list .= '</tr>';
$list .= '</thead>';
$list .= '<tbody>';
foreach ($notes as $note) {
$user = db_select(TBL_PREFIX . TBL_USERS, "login", "id='" . $note['uid'] . "'");
// build row
$list .= '<tr>';
$list .= '<td>' . $user['login'] . '</td>';
$qs = array('id' => $id, 'start' => $note['pos']);
$list .= '<td><a href="../track.php?' . http_build_query($qs) . '" class="track">' . $note['pos'] . '</a></td>';
$list .= '<td>' . trim_text(strip_tags($note['txt']), 10) . '</td>';
$list .= '<td>';
$qs = array('id' => $id, 'login' => $user['login'], 'time' => $note['pos']);
$list .= '<a href="read.php?' . http_build_query($qs) . '">read</a>';
if ($_SESSION['login'] == $user['login'] || is_admin()) {
$list .= ' | <a href="edit.php?' . http_build_query($qs) . '">edit</a>';
}
if (is_root()) {
$list .= ' | <a class="conf" href="delete.php?' . http_build_query($qs) . '">delete</a>';
}
$list .= '</td>';
$list .= '</tr>';
}
$list .= '</tbody>';
$list .= '</table>';
echo $list;
开发者ID:Simo22,项目名称:smt2,代码行数:31,代码来源:list.php
示例7: gen_sort_selects
$last_blogs[$row['blog_id']] = $row;
}
$db->sql_freeresult($result);
}
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
$pagination = generate_blog_pagination($blog_urls['start_zero'], $total, $limit, $start, false);
generate_blog_breadcrumbs($user->lang['USERLIST']);
// Generate the left menu
generate_menu();
page_header($user->lang['BLOG'] . ' ' . $user->lang['USERLIST']);
// Output some data
$template->assign_vars(array('FOLDER_IMG' => $user->img('forum_read', ''), 'FORUM_FOLDER_IMG_SRC' => $user->img('forum_read', '', false, '', 'src'), 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total, $limit, $start), 'TOTAL_POSTS' => $total == 1 ? $user->lang['ONE_BLOG'] : sprintf($user->lang['CNT_BLOGS'], $total), 'S_SORT' => true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days));
unset($pagination);
$i = -1;
foreach ($users as $row) {
$i++;
if ($i < $start) {
continue;
} else {
if ($i >= $start + $limit) {
break;
}
}
$user_id = $row['user_id'];
$last_blog = $last_blogs[$row['blog_id']];
$blog_text = trim_text($last_blog['blog_text'], $last_blog['bbcode_uid'], $config['user_blog_text_limit'], $last_blog['bbcode_bitfield'], $last_blog['enable_bbcode']);
$bbcode_options = ($last_blog['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0) + ($last_blog['enable_smilies'] ? OPTION_FLAG_SMILIES : 0) + ($last_blog['enable_magic_url'] ? OPTION_FLAG_LINKS : 0);
$blog_text = generate_text_for_display($blog_text, $last_blog['bbcode_uid'], $last_blog['bbcode_bitfield'], $bbcode_options);
$template->assign_block_vars('userrow', array('BLOG_COUNT' => $row['blog_count'], 'BLOG_TITLE' => $row['title'] ? censor_text($row['title']) : sprintf($user->lang['USERNAMES_BLOGS'], $row['username']), 'USERNAME' => get_username_string('full', $user_id, $row['username'], $row['user_colour']), 'LAST_BLOG' => $blog_text, 'LAST_BLOG_SUBJECT' => censor_text($last_blog['blog_subject']), 'LAST_BLOG_TIME' => $user->format_date($last_blog['blog_time']), 'U_VIEW_BLOG' => blog_url($user_id), 'U_VIEW_LAST_BLOG' => blog_url($user_id, $last_blog['blog_id'])));
}
$template->set_filenames(array('body' => 'blog/userlist.html'));
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:31,代码来源:userlist.php
示例8: other_asset_url
" >
<?php
if ($sale['from_api'] == 0) {
$image_path_original = other_asset_url($sale['product_image'] . '_m.' . $sale['product_ext'], '', 'uploads/images/products');
} else {
$image_path_original = str_replace('160', '440', $sale['product_image']);
}
?>
<img src="<?php
echo $image_path_original;
?>
" alt=""> </a>
<div class="clear"></div>
<p>
<?php
echo trim_text(strip_tags($sale['product_name']), 25);
?>
</p>
<span class="clear"></span>
<?php
if ($sale['sale_type_id'] == 5) {
$new_value = $sale['sale_value'];
$off_percentage = $sale['api_reduction_percent'];
} else {
$new_value = $sale['sale_price'];
$off_percentage = 100 - $sale['sale_price'] * 100 / $sale['product_price'];
}
?>
<span style="float:left;"> Före:
<?php
echo makeCurrency($sale['product_price']);
开发者ID:mrj0909,项目名称:sf,代码行数:31,代码来源:detail.php
示例9: index
public function index()
{
$cat_id = $_GET['cat_id'];
$config['base_url'] = base_url() . 'category/?cat_id=' . $_GET['cat_id'];
$config['total_rows'] = $this->product_model->total_product_by_category($_GET['cat_id']);
$config['per_page'] = 20;
$config['uri_segment'] = isset($_GET['per_page']) ? $_GET['per_page'] : 9;
$this->pagination->initialize($config);
$offset = $config['uri_segment'];
$limit = $config['per_page'];
$config['enable_query_strings'] = TRUE;
$config['page_query_string'] = TRUE;
$this->pagination->initialize($config);
$products = $this->product_model->product_by_category($cat_id, $limit, $offset);
$pro_html = '';
if ($products) {
foreach ($products as $products) {
if ($products['product_image']) {
$image_path_original = other_asset_url($products['product_image'] . '_m.' . $products['product_ext'], '', 'uploads/images/products');
}
$iarr = @getimagesize($image_path_original);
if (!is_array($iarr)) {
$image_path_original = image_asset_url('no_image.gif');
}
$img_featue = 'header.jpg';
$heart_class = '<div class="heart" rel="' . $products['pro_id'] . '" id="wish_heart_' . $products['pro_id'] . '" style="display:none">
' . image_asset($img_featue) . '
</div>';
$whislist_detail = $this->wishlist_model->get_wishlist_detail_product($products['pro_id']);
if ($this->wishlist_model->get_wishlist_detail_product($products['pro_id'])) {
$img_featue = 'heart_red.jpg';
$heart_class = '<div class="heartred" rel="' . $products['pro_id'] . '" id="wish_heart_' . $products['pro_id'] . '">
' . image_asset($img_featue) . '
</div>';
}
$sale_tag = '';
if ($products['sale_type_id'] == '1') {
$sale_tag = '<span style="float:left;"> Before: ' . round($products['product_price']) . ' kr
<br>
<label style="color:red">Now: ' . round($products['sale_value']) . ' kr</label> </span>
<div class="persentage_imgs">
-' . round(100 - $products['sale_value'] / $products['product_price'] * 100) . '%
</div>';
} elseif ($products['sale_type_id'] == '2') {
$now_price = $products['product_price'] * ($products['sale_value'] / 100);
$sale_tag = '<span style="float:left;"> Before: ' . round($products['product_price']) . ' kr
<br>
<label style="color:red">Now: ' . round($products['product_price'] - $now_price) . ' kr</label> </span>
<div class="persentage_imgs">
-' . round($products['sale_value']) . '%
</div><!--persentage_img-->';
} else {
$sale_tag = '<span style="float:left;">
<label style="color:red">Now:' . round($products['product_price']) . ' kr</label> </span>';
if ($products['sale_type_id'] == '3') {
$sale_tag .= '<br /><span style="float:left;"><label> Buy 1 get ' . $products['sale_value'] . ' free</label></span>';
}
if ($products['sale_type_id'] == '4') {
$deals = explode('_', $products['sale_value']);
$sale_tag .= '<span style="float:left;"><label >Buy ' . $deals[0] . ' and pay for ' . $deals[1] . '</label></span>';
}
}
$pro_html .= '<div class="cata_pro product_detail" rel="' . $products['pro_id'] . '">
<a id="product_' . $products['pro_id'] . '" href="' . base_url() . 'product/product_detail/' . $products['pro_id'] . '" ><img height="256" width="200" src="' . $image_path_original . '"/></a>
' . $heart_class . '
<p>
' . trim_text(strip_tags($products['product_name']), 30) . '
</p>
<div class="clear"></div>
' . $sale_tag . '
</div><!--cata_pro-->';
}
} else {
$pro_html .= '<div class="cata_pro"><p>Sorry No Record Yet!</p></div>';
}
$cat_id = $this->input->get("cat_id");
$data['category_name'] = get_categroy_name($cat_id);
$data['category_detail'] = $this->categories_model->get_category_detail($cat_id);
$data['product_category'] = get_product_oncategory($cat_id);
//$data['product_category'] = '';
$data['other_choice'] = other_choice_category();
$data['related_categories'] = related_categories($cat_id);
$data['sales_to_missed'] = sales_not_missed();
$data['products'] = $pro_html;
$data['pagination'] = $this->pagination->create_links();
$data['query_params'] = $this->input->get();
$data['total_records'] = $config['base_url'];
$this->load->view('main/category.html', $data);
}
开发者ID:mrj0909,项目名称:sf,代码行数:90,代码来源:category.php
示例10: foreach
<?php
if (!empty($comments)) {
?>
<div class='user-comments'>
<h3>Kommentarer</h3>
<ul class="fa-ul">
<?php
foreach ($comments as $comment) {
?>
<li>
<a href='<?php
echo $this->url->create("forum/view/{$comment->question_id}/#comment-{$comment->id}");
?>
'>
<i class="fa-li fa fa-commenting"></i> <?php
echo trim_text($comment->content, 149);
?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<hr>
<?php
}
?>
<?php
if (!empty($voteCount[0]->sum)) {
开发者ID:jonasahlsson,项目名称:WGTOTW,代码行数:31,代码来源:view-user.tpl.php
示例11: _relatedVideos
/**
* This function will retrieve related videos according to its id or some of its tags
*
* @param string $origId The id for which to look for data
* @return the php response from parsing the data.
*/
private function _relatedVideos($api, $origId = null)
{
$this->apiprocessing->content = 'getRelatedVideos';
$this->apiprocessing->maxResults = 8;
// $this->apiprocessing->api = $api;
// $this->apiprocessing->videoId = $origId;
$results = $this->apiprocessing->individualCall($api);
// $results = $this->apiprocessing->parseApiResult($api, $results);
// dd($results);
$related = [];
switch ($api) {
case 'Dailymotion':
$i = 0;
// dd($results);
foreach ($results['list'] as $video) {
preg_match('@video/([^_]+)_([^/]+)@', $video['url'], $match);
$url = $match[1] . '/' . $match[2];
$url = site_url('video/' . substr($url, 0, 1) . 'd' . substr($url, 1));
$httpsUrl = preg_replace("/^http:/i", "https:", $url);
$related[$i]['url'] = $url;
$thumbnailUrl = preg_replace("/^http:/i", "https:", $video['thumbnail_240_url']);
$related[$i]['img'] = $thumbnailUrl;
$related[$i]['title'] = $video['title'];
$related[$i]['source'] = 'Dailymotion';
$i++;
}
break;
case "Metacafe":
$i = 0;
foreach ($results->channel->item as $video) {
preg_match('/http:\\/\\/[w\\.]*metacafe\\.com\\/watch\\/([^?&#"\']*)/is', $video->link, $match);
$id = substr($match[1], 0, -1);
$url = site_url('video/' . substr($id, 0, 1) . 'M' . substr($id, 1));
$related[$i]['url'] = $url;
$related[$i]['title'] = trim_text($video->title, 83);
$related[$i]['img'] = "http://www.metacafe.com/thumb/{$video->id}.jpg";
$related[$i]['source'] = 'Metacafe';
$i++;
}
break;
case "Vimeo":
$i = 0;
foreach ($results['body']['data'] as $video) {
$origid = explode('/', $video['uri'])[2];
$id = substr($origid, 0, 1) . 'v' . substr($origid, 1);
$url = site_url('video/' . $id);
$related[$i]['url'] = $url;
$related[$i]['title'] = trim_text($video['name'], 83);
$related[$i]['img'] = $video['pictures']['sizes'][2]['link'];
$related[$i]['source'] = 'Metacafe';
$i++;
}
break;
case 'YouTube':
$i = 0;
foreach ($results['feed']['entry'] as $video) {
$origid = substr($video['id']['$t'], strrpos($video['id']['$t'], '/') + 1);
$id = substr($origid, 0, 1) . 'y' . substr($origid, 1);
$url = site_url('video/' . $id);
$related[$i]['url'] = $url;
$related[$i]['title'] = trim_text($video['title']['$t'], 83);
$thumbnailUrl = preg_replace("/^http:/i", "https:", $video['media$group']['media$thumbnail'][0]['url']);
$related[$i]['img'] = $thumbnailUrl;
$related[$i]['source'] = 'YouTube';
$i++;
}
break;
}
return $related;
}
开发者ID:videouri,项目名称:videouri-old,代码行数:76,代码来源:Video.php
示例12: scBestSeller
function scBestSeller()
{
global $post;
global $wpdb;
?>
<div class="asp-best-seller">
<p>OUR CURRENT BEST SELLERS:</p>
<?php
$query_args = array('posts_per_page' => 5, 'nopaging' => 0, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => '_featured', 'orderby' => 'meta_value');
$r = new WP_Query($query_args);
if ($r->have_posts()) {
?>
<!--<ul class="product_list_widget">-->
<?php
while ($r->have_posts()) {
$r->the_post();
global $product;
?>
<div class="home-best-seller-item">
<!--<li>--><a href="<?php
the_permalink();
?>
" title="<?php
echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
?>
">
<?php
//if (has_post_thumbnail()) the_post_thumbnail('shop_thumbnail'); else echo '<img src="'. woocommerce_placeholder_img_src() .'" alt="Placeholder" width="'.$woocommerce->get_image_size('shop_thumbnail_image_width').'" height="'.$woocommerce->get_image_size('shop_thumbnail_image_height').'" />';
?>
<div class="home-best-seller-img-outline"><?php
if (has_post_thumbnail()) {
the_post_thumbnail('large', array('style' => 'width:150px; height:87px;'));
} else {
echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" style="width:150px; height:87px;" />';
}
?>
</div>
</a>
<div class="paper-shadow"></div>
<p><a href="<?php
the_permalink();
?>
" title="<?php
if (get_the_title()) {
the_title();
} else {
the_ID();
}
?>
"><?php
if (get_the_title()) {
echo trim_text(get_the_title(), 24, true, false);
} else {
the_ID();
}
?>
</a><br/>
<span style="color:#000000;">
<?php
if (!empty($product->price)) {
echo 'ONLY ' . $product->get_price_html();
} else {
echo $product->get_price_html();
}
?>
</span>
</p><!--</li>-->
</div>
<?php
}
?>
<!--</ul>-->
<?php
}
?>
</div>
<div style="clear:both"></div>
<?php
}
开发者ID:jaiweb,项目名称:ASP,代码行数:80,代码来源:asp_best_seller.php
示例13: simplexml_unCDATAise
function simplexml_unCDATAise($xml)
{
$new_xml = NULL;
preg_match_all("/\\<\\!\\[CDATA\\[(.*)\\]\\]\\>/U", $xml, $args);
if (is_array($args)) {
if (isset($args[0]) && isset($args[1])) {
$new_xml = $xml;
for ($i = 0; $i < count($args[0]); $i++) {
$old_text = $args[0][$i];
$new_text = htmlspecialchars($args[1][$i]);
$new_xml = str_replace($old_text, $new_text, $new_xml);
}
}
}
return $new_xml;
}
$tag = mysql_real_escape_string($_GET['load']);
$xmlFile = '../../../cache/xml/feeds_' . $tag . '.xml';
$xml = simplexml_load_file($xmlFile);
echo wrt_table(0, 0, 0, '100%', 'center');
$items = $xml->item;
foreach ($items as $item) {
echo '<tr>';
echo '<th class="ft_head font_m left"><a href="' . $item->link . '" target="_blank">' . $item->title . '</a></th>';
echo '</tr><tr>';
echo '<td class="font_s">' . trim_text($item->description, 240) . '</td>';
echo '</tr>';
echo '<tr><td> </td></tr>';
}
echo '</table>';
}
开发者ID:CraXyOW3,项目名称:eve_cms,代码行数:31,代码来源:load_feeds.php
示例14: lorem_ipsum
function lorem_ipsum($length)
{
$text = "\n\t<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquam felis nunc, in dignissim metus suscipit eget. Nunc scelerisque laoreet purus, in ullamcorper magna sagittis eget. Aliquam ac rhoncus orci, a lacinia ante. Integer sed erat ligula. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce ullamcorper sapien mauris, et tempus mi tincidunt laoreet. Proin aliquam vulputate felis in viverra.</p>\n\t<p>Duis sed lorem vitae nibh sagittis tempus sed sed enim. Mauris egestas varius purus, a varius odio vehicula quis. Donec cursus interdum libero, et ornare tellus mattis vitae. Phasellus et ligula velit. Vivamus ac turpis dictum, congue metus facilisis, ultrices lorem. Cras imperdiet lacus in tincidunt pellentesque. Sed consectetur nunc vitae fringilla volutpat. Mauris nibh justo, luctus eu dapibus in, pellentesque non urna. Nulla ullamcorper varius lacus, ut finibus eros interdum id. Proin at pellentesque sapien. Integer imperdiet, sapien nec tristique laoreet, sapien lacus porta nunc, tincidunt cursus risus mauris id quam.</p>\n\t<p>Ut vulputate mauris in facilisis euismod. Ut id libero vitae neque laoreet placerat a id mi. Integer ornare risus placerat, interdum nisi sed, commodo ligula. Integer at ipsum id magna blandit volutpat. Sed euismod mi odio, vitae molestie diam ornare quis. Aenean id ligula finibus, convallis risus a, scelerisque tellus. Morbi quis pretium lectus. In convallis hendrerit sem. Vestibulum sed ultricies massa, ut tempus risus. Nunc aliquam at tellus quis lobortis. In hac habitasse platea dictumst. Vestibulum maximus, nibh at tristique viverra, eros felis ultrices nunc, et efficitur nunc augue a orci. Phasellus et metus mauris. Morbi ut ex ut urna tincidunt varius eu id diam. Aenean vestibulum risus sed augue vulputate, a luctus ligula laoreet.</p>\n\t<p>Nam tempor sodales mi nec ullamcorper. Mauris tristique ligula augue, et lobortis turpis dictum vitae. Aliquam leo massa, posuere ac aliquet quis, ultricies eu elit. Etiam et justo et nulla cursus iaculis vel quis dolor. Phasellus viverra cursus metus quis luctus. Nulla massa turpis, porttitor vitae orci sed, laoreet consequat urna. Etiam congue turpis ac metus facilisis pretium. Nam auctor mi et auctor malesuada. Mauris blandit nulla quis ligula cursus, ut ullamcorper dui posuere. Fusce sed urna id quam finibus blandit tempus eu tellus. Vestibulum semper diam id ante iaculis iaculis.</p>\n\t<p>Fusce suscipit maximus neque, sed consectetur elit hendrerit at. Sed luctus mi in ex auctor mollis. Suspendisse ac elementum tellus, ut malesuada purus. Mauris condimentum elit at dolor eleifend iaculis. Aenean eget faucibus mauris. Pellentesque fermentum mattis imperdiet. Donec mattis nisi id faucibus finibus. Vivamus in eleifend lorem, vel dictum nisl. Morbi ut mollis arcu.</p>\n\t";
return trim_text($text, $length);
}
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:5,代码来源:theme_functions_include.php
示例15: index
public function index()
{
$query_params = $this->input->get();
$tmp_url = '';
if (isset($query_params['brand'])) {
$tmp_url .= "&brand=" . $query_params['brand'];
}
if (isset($query_params['min_price'])) {
$tmp_url .= "&min_price=" . $query_params['min_price'];
}
if (isset($query_params['max_price'])) {
$tmp_url .= "&max_price=" . $query_params['max_price'];
}
$cat_id = $_GET['cat_id'];
$config['base_url'] = base_url() . 'category/?cat_id=' . $_GET['cat_id'] . $tmp_url;
$config['total_rows'] = $this->product_model->total_product_by_category($_GET['cat_id']);
$config['per_page'] = 24;
$config['prev_link'] = '< Föregående';
$config['next_link'] = 'Nästa >';
$config['uri_segment'] = isset($_GET['per_page']) ? $_GET['per_page'] : 0;
//$this->pagination->initialize($config);
$offset = $config['uri_segment'];
$limit = $config['per_page'];
$config['enable_query_strings'] = TRUE;
$config['page_query_string'] = TRUE;
$this->pagination->initialize($config);
$products = $this->product_model->product_by_category($cat_id, $limit, $offset);
$pro_html = '';
if ($products) {
foreach ($products as $products) {
if ($products['from_api'] == 0) {
$image_path_original = other_asset_url($products['product_image'] . '_m.' . $products['product_ext'], '', 'uploads/images/products');
} else {
$image_path_original = str_replace('440', '220', $products['product_image']);
}
// echo $image_path_original ;
//$iarr = @getimagesize($image_path_original);
//if(!is_array($iarr)){
//$image_path_original = image_asset_url('no_image.gif');
// }
$img_featue = 'header.jpg';
$heart_class = '<div class="heart" rel="' . $products['pro_id'] . '" id="wish_heart_' . $products['pro_id'] . '" style="display:none">
' . image_asset($img_featue) . '
</div>';
$whislist_detail = $this->wishlist_model->get_wishlist_detail_product($products['pro_id']);
if ($this->wishlist_model->get_wishlist_detail_product($products['pro_id'])) {
$img_featue = 'heart_red.jpg';
$heart_class = '<div class="heartred" rel="' . $products['pro_id'] . '" id="wish_heart_' . $products['pro_id'] . '">
' . image_asset($img_featue) . '
</div>';
}
$sale_tag = '';
if ($products['sale_type_id'] == '1') {
$sale_tag = '<span style="float:left;"> Före: ' . makeCurrency($products['product_price']) . ' kr
<br>
<label style="color:red">Nu: ' . makeCurrency($products['sale_value']) . ' kr</label> </span>
<div class="persentage_imgs">
-' . makeCurrency(100 - $products['sale_value'] / $products['product_price'] * 100) . '%
</div>';
} elseif ($products['sale_type_id'] == '5') {
$sale_tag = '<span style="float:left;"> Före: ' . makeCurrency($products['product_price']) . ' kr
<br>
<label style="color:red">Nu: ' . makeCurrency($products['sale_price']) . ' kr</label> </span>
<div class="persentage_imgs">
-' . $products['api_reduction_percent'] . '%
</div>';
} elseif ($products['sale_type_id'] == '2') {
$now_price = $products['product_price'] * ($products['sale_value'] / 100);
$sale_tag = '<span style="float:left;"> Före: ' . makeCurrency($products['product_price']) . ' kr
<br>
<label style="color:red">Nu: ' . makeCurrency($products['product_price'] - $now_price) . ' kr</label> </span>
<div class="persentage_imgs">
-' . makeCurrency($products['sale_value']) . '%
</div><!--persentage_img-->';
} else {
$sale_tag = '<span style="float:left;">
<label style="color:red">Nu:' . makeCurrency($products['product_price']) . ' kr</label> </span>';
if ($products['sale_type_id'] == '3') {
$sale_tag .= '<br /><span style="float:left;"><label> Buy 1 get ' . $products['sale_value'] . ' free</label></span>';
}
if ($products['sale_type_id'] == '4') {
$deals = explode('_', $products['sale_value']);
$sale_tag .= '<span style="float:left;"><label >Buy ' . $deals[0] . ' and pay for ' . $deals[1] . '</label></span>';
}
}
$pro_html .= '<div class="cata_pro product_detail" rel="' . $products['pro_id'] . '">
<a id="product_' . $products['pro_id'] . '" href="' . base_url() . 'product/product_detail/' . $products['pro_id'] . '" ><img src="' . $image_path_original . '"/></a>
' . $heart_class . '
<p>
' . trim_text(strip_tags($products['product_name']), 32) . '
</p>
<div class="clear"></div>
' . $sale_tag . '
</div><!--cata_pro-->';
}
} else {
$pro_html .= '<div class="cata_pro"><p>Kommer snart! </p></div>';
}
$cat_id = $this->input->get("cat_id");
//.........这里部分代码省略.........
开发者ID:mrj0909,项目名称:sf,代码行数:101,代码来源:category.php
示例16: widget
/**
* Widget
*
* Display the widget in the sidebar
* Save output to the cache if empty
*
* @param array sidebar arguments
* @param array instance
*/
public function widget($args, $instance)
{
// Get the widget cache from the transient
$cache = get_transient('asp_widget_cache');
// If this category widget instance is cached, get from the cache
/*if ( isset( $cache[$this->id] ) ) {
echo $cache[$this->id];
return false;
}*/
// Otherwise Start buffering and output the Widget
ob_start();
extract($args);
// Set the widget title
$title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Services', 'asp'), $instance, $this->id_base);
// Get options
$srv1 = isset($instance['srv1']) ? $instance['srv1'] : 0;
$srv2 = isset($instance['srv2']) ? $instance['srv2'] : 0;
$srv3 = isset($instance['srv3']) ? $instance['srv3'] : 0;
$srv4 = isset($instance['srv4']) ? $instance['srv4'] : 0;
// Print the widget wrapper & title
echo $before_widget;
echo $before_title . $title . $after_title;
global $post;
for ($i = 1; $i < 5; $i++) {
$a = 'srv' . $i;
$post = get_post(${$a});
?>
<div class="asp-service" title="<?php
echo $post->post_title;
?>
">
<?php
if (has_post_thumbnail()) {
?>
<a href="<?php
echo get_permalink();
?>
"><?php
the_post_thumbnail('full', array('style' => 'width:230px;height:128px;', 'title' => ''));
?>
</a>
<?php
} else {
?>
<a href="<?php
echo get_permalink();
?>
"><img src="<?php
echo plugins_url() . '/ASP_plugin/images/no_srv_thumb.png';
?>
" style="width:230px; height:128px;" /></a>
<?php
}
?>
<div class="asp-service-title-bar" title="<?php
echo $post->post_title;
?>
"><?php
echo trim_text($post->post_title, 32, true, false);
?>
</div>
</div>
<?php
}
// Print closing widget wrapper
echo $after_widget;
// Flush output buffer and save to transient cache
$result = ob_get_flush();
$cache[$this->id] = $result;
set_transient('asp_widget_cache', $cache, 3600 * 3);
// 3 hours ahead
}
开发者ID:jaiweb,项目名称:ASP,代码行数:82,代码来源:asp_services.php
|
请发表评论