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


PHP limit_text函数代码示例

本文整理汇总了PHP中limit_text函数的典型用法代码示例。如果您正苦于以下问题:PHP limit_text函数的具体用法?PHP limit_text怎么用?PHP limit_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: wikiplugin_rss

function wikiplugin_rss($data, $params)
{
    global $smarty;
    global $rsslib;
    require_once 'lib/rss/rsslib.php';
    $params = array_merge(array('max' => 10, 'date' => 0, 'desc' => 0, 'author' => 0, 'icon' => '', 'showtitle' => 1, 'ticker' => 0, 'desclen' => 0), $params);
    if (!isset($params['id'])) {
        return WikiParser_PluginOutput::argumentError(array('id'));
    }
    $params['id'] = (array) $params['id'];
    $items = $rsslib->get_feed_items($params['id'], $params['max']);
    $title = null;
    if (count($params['id']) == 1) {
        $module = $rsslib->get_rss_module(reset($params['id']));
        if ($module['sitetitle']) {
            $title = array('title' => $module['sitetitle'], 'link' => $module['siteurl']);
        }
    }
    if ($params['desc'] > 0 && $params['desclen'] > 0) {
        foreach ($items as &$item) {
            $item['description'] = limit_text($item['description'], $params['desclen']);
        }
    }
    global $smarty;
    $smarty->assign('rsstitle', $title);
    $smarty->assign('items', $items);
    $smarty->assign('showdate', $params['date'] > 0);
    $smarty->assign('showtitle', $params['showtitle'] > 0);
    $smarty->assign('showdesc', $params['desc'] > 0);
    $smarty->assign('showauthor', $params['author'] > 0);
    $smarty->assign('icon', $params['icon']);
    $smarty->assign('ticker', $params['ticker']);
    return $smarty->fetch('wiki-plugins/wikiplugin_rss.tpl');
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:34,代码来源:wikiplugin_rss.php

示例2: _print_blog_category_lists


//.........这里部分代码省略.........
                                        $comments = $num_comments . __(' Comments', 'wip');
                                    } else {
                                        $comments = __('1 Comment', 'wip');
                                    }
                                    $write_comments = '<a href="' . get_comments_link($post->ID) . '">' . $comments . '</a>';
                                } else {
                                    $write_comments = __('Comment Off', 'wip');
                                }
                                $content .= '<div class="full-column-blog-lists ' . $colClass . ' float_left">' . "\n";
                                $content .= '<div class="full-column-blog-thumbnail">' . "\n";
                                $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . "\n";
                                $content .= '<img src="' . $colImage . '" alt="' . the_title_attribute('echo=0') . '"/>';
                                $content .= '</a>' . "\n";
                                $content .= '</div>' . "\n";
                                $content .= '<h3 class="blog-list-title"><a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . get_the_title() . '</a></h3>' . "\n";
                                if ($column == '4') {
                                    $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '</span>' . "\n";
                                } else {
                                    $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '
												&ndash;
												' . __('In', 'wip') . ' ' . $ct . '
												' . __('With', 'wip') . ' ' . $write_comments . '
												</span>' . "\n";
                                }
                                if ($column == '2') {
                                    $content .= wpautop(str_replace('[...]', '...', get_the_excerpt()));
                                } else {
                                    $content .= wpautop(limit_text(get_the_excerpt(), 120, '...'));
                                }
                                $content .= '</div>' . "\n";
                                if ($intloop % $column == 0) {
                                    $content .= '<div class="clear"></div>' . "\n";
                                }
                            }
                            if ($intloop % $column != 0) {
                                $content .= '<div class="clear"></div>' . "\n";
                            }
                            $content .= '</div><!-- end .col_wraper -->' . "\n";
                            $content .= wip_pagenavi('', false, '<div class="pagination_wrap">', '</div>');
                        } else {
                            $content .= __('No Posts Found!', 'wip');
                        }
                        wp_reset_postdata();
                        break;
                }
            } else {
                /** if content use sidebar */
                switch ($layout_type) {
                    case 'default':
                    case 'default-fullwidth':
                        if (have_posts()) {
                            while (have_posts()) {
                                the_post();
                                global $post;
                                $ccat = get_the_category();
                                $ct = '';
                                foreach ($ccat as $a => $cct) {
                                    if ($a != 0) {
                                        $ct .= ', ';
                                    }
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:67,代码来源:_wip.layout.helper.php

示例3: the_title_attribute

            the_title_attribute();
            ?>
"/>
	</a>
	</div>

	<h3 class="blog-list-title">
		<a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            printf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0'));
            ?>
">
			<?php 
            echo limit_text(get_the_title(), 24);
            ?>
		</a>
	</h3>

	<span class="meta-blog-lists">
											<?php 
            print __('Posted In', 'wip');
            ?>
 <?php 
            the_category(', ');
            ?>
, <?php 
            printf(__('On %1$s', 'wip'), get_the_time('F d, Y', $post->ID));
            ?>
	</span>
开发者ID:pmariopereira,项目名称:peter-sassy,代码行数:31,代码来源:blog-related.php

示例4: posts_grid_shortcode


//.........这里部分代码省略.........
            $output .= '</div></div></div>';
        } else {
            if (has_post_thumbnail($post_id)) {
                $output .= '<div style="position:relative; margin: 0 auto; ">';
                $output .= '<figure class="featured-thumbnail-grid"><a class="image-wrap" href="' . get_permalink($post_id) . '" title="' . get_the_title($post_id) . '">';
                $output .= '<img src="' . $attachment_url[0] . '" width="' . $attachment_url[1] . '" height="' . $attachment_url[2] . '" alt="' . get_the_title($post_id) . '" />';
                $output .= '<div class="zoom-icon"></div>';
                $output .= '</a></figure></div>';
            }
            $output .= '<div style="padding:30px 0 30px 0;">';
            $output .= '<div class="post_title_grid">';
            if ($formaticons == "link") {
                $output .= '<h5><a href="' . $link_format_url . '" title="' . get_the_title($post_id) . '">';
                $output .= $link_format_url;
                $output .= '</a></h5>';
                //Other formats
            } else {
                $output .= '<h5><a href="' . get_permalink($post_id) . '" title="' . get_the_title($post_id) . '">';
                $output .= get_the_title($post_id);
                $output .= '</a></h5>';
            }
            if ($isdate == "yes") {
                $output .= '<span>';
                $output .= '<time datetime="' . get_the_time('l, F j, Y', $post_id) . '">' . get_the_time('l, F j, Y', $post_id) . '</time>';
                $output .= '</span>';
            }
            $output .= '</div>';
            if ($meta == 'yes') {
                // begin post meta
                $output .= '<div class="post_meta_grid">';
                // post category
                $output .= '<span class="post_category_grid">';
                if ($type != '' && $type != 'post') {
                    $terms = get_the_terms($post_id, $type . '_category');
                    if ($terms && !is_wp_error($terms)) {
                        $out = array();
                        $output .= 'Posted in ';
                        foreach ($terms as $term) {
                            $out[] = '<a href="' . get_term_link($term->slug, $type . '_category') . '">' . $term->name . '</a>';
                        }
                        $output .= join(', ', $out);
                    }
                } else {
                    $categories = get_the_category();
                    if ($categories) {
                        $out = array();
                        $output .= 'Posted in ';
                        foreach ($categories as $category) {
                            $out[] = '<a href="' . get_category_link($category->term_id) . '" title="' . $category->name . '">' . $category->cat_name . '</a> ';
                        }
                        $output .= join(', ', $out);
                    }
                }
                $output .= '</span>';
                // post author
                $output .= '<span class="post_author_grid">';
                $output .= ' By ';
                $output .= '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>';
                $output .= '</span>, ';
                // post comment count
                $num = 0;
                $queried_post = get_post($post_id);
                $cc = $queried_post->hs_comment_count;
                if ($cc == $num || $cc > 1) {
                    $cc = $cc . ' Comments';
                } else {
                    $cc = $cc . ' Comment';
                }
                $permalink = get_permalink($post_id);
                $output .= '<span class="post_comment_grid">';
                $output .= '<a href="' . $permalink . '" class="comments_link">' . $cc . '</a>';
                $output .= '</span>';
                $output .= '</div>';
                // end post meta
            }
            if ($excerpt_count >= 1) {
                $output .= '<div class="post_excerpt_grid"><p class="excerpt">';
                $output .= limit_text($excerpt, $excerpt_count);
                $output .= '</p></div>';
            }
            if ($link) {
                $output .= '<span class="post_comment_grid"><a class="btn btn-white btn-large" href="' . get_permalink($post_id) . '" title="' . get_the_title($post_id) . '">';
                $output .= $link_text;
                $output .= '</a></span>';
            }
            $output .= '</div>';
        }
        $output .= '</li>';
        if ($j == count($posts) - 1) {
            $output .= $output_end;
        }
        if ($count % $columns == 0) {
            $output .= '</ul><!-- .posts-grid (end) -->';
        }
        $count++;
        $i++;
    }
    // end for
    return $output;
}
开发者ID:FelixNong1990,项目名称:andy,代码行数:101,代码来源:posts_grid.php

示例5: htmlentities

    ?>
" title="<?php 
    echo $issue["user"]["login"];
    ?>
"></a>
							</div>
							<div class="col-sm-11" >
								<h4 class="list-group-item-heading"><a href="<?php 
    echo $issue["html_url"];
    ?>
" target="_blank"><?php 
    echo htmlentities($issue["title"]);
    ?>
</a></h4>
								<p><?php 
    echo limit_text($issue["body"], 35);
    ?>
</p>
								<ul class="list-inline text-muted small">
									<li><a href="<?php 
    echo $repos_array[$repo_name]['url'];
    ?>
" target="_blank"><span class="glyphicon glyphicon-hdd"></span> <?php 
    echo HW_GITHUB_USER;
    ?>
/<?php 
    echo $repo_name;
    ?>
</a></li>
									<li><span class="glyphicon glyphicon-time"></span> Updated <time class="timeago" datetime="<?php 
    echo $issue["updated_at"];
开发者ID:hursey013,项目名称:helpwanted,代码行数:31,代码来源:index.php

示例6: while

 while ($DATA = mysql_fetch_array($GET)) {
     $msg = $DATA["msg"];
     $msg = str_replace("&amp;", "&", $msg);
     $author = $DATA["login"];
     $level = $DATA["level"];
     $orden_d = $DATA["orden"];
     $dealer_d = $DATA["dealer"];
     $admin_level = $DATA["admin_level"];
     $clan_s = $DATA["clan_s"];
     $clan_f = $DATA["clan"];
     $top_id = $DATA['id'];
     $cut_count = 300;
     if ($fid == "palach") {
         if ($view_id != $top_id) {
             if (strlen($msg) > $cut_count) {
                 $msg = limit_text($msg, $cut_count) . "<br><br><div align=right><a href='?fid=" . $fid . "&tid=" . $tid . "&page=" . $page . "&view_id=" . $top_id . "'><b>Читать полностью</b></a></div>";
             }
         }
     }
     echo "<tr>\n\t\t\t\t\t<td width=250 bgcolor=#d0f5d0 valign=top>\n\t\t\t\t\t\t<script>drwfl('{$author}', '1', '{$level}', '{$dealer_d}', '{$orden_d}', '{$admin_level}', '{$clan_s}', '{$clan_f}');</script>\n\t\t\t\t\t</td>";
     echo "<td bgcolor=#e0ffe0 valign=top>";
     echo "<table width=100% cellpadding=0 cellspacing=0><tr><td width=15 bgcolor=#99CC99></td><td style='font-size: 8pt;' align=left bgcolor=#d0f5d0>&nbsp;&nbsp;написано: " . $DATA["date"] . "&nbsp;</td><td align=right bgcolor=#d0f5d0>";
     if ($USER_DATA["admin_level"] >= 4) {
         echo "<a href='?action=del_topic&fid={$fid}&tid={$tid}&id={$top_id}' style='text-decoration:none;font-size:8pt;color:#99CC99;'>[Удалить тему]</a>&nbsp;&nbsp;&nbsp;";
         echo "<a href=\"javascript:formforum('Добавить ответ','?action=add_comment&fid={$fid}&tid={$tid}&id={$top_id}', 'comment','', '5')\" style='text-decoration:none;font-size:8pt;color:#99CC99;'>[Добавить ответ]</A>";
     }
     if ($USER_DATA["admin_level"] >= 9) {
         echo "&nbsp;&nbsp;&nbsp;<a href='?action=del_topic_full&fid={$fid}&tid={$tid}&id={$top_id}' style='text-decoration:none;font-size:8pt;color:#99CC99;'>[Удалить Полностью]</a>";
     }
     echo "</td></tr></table>";
     echo "<br>" . $msg . "<br><br></td>\n\t\t\t\t</tr>";
开发者ID:ehmedov,项目名称:www,代码行数:31,代码来源:messages.php

示例7: limit_text

        echo $posts['url_amigavel'];
        ?>
" name="imagem_destacada">
						<img src="admin/images/<?php 
        echo $posts['imagem'];
        ?>
" class="autow" alt="<?php 
        echo $posts['titulo'];
        ?>
">
					</a>
				<?php 
    }
    ?>
				<div class="postagem-dental p-topo Cycle fs-20 justfy" style="margin:25px 0"><?php 
    echo limit_text($posts['conteudo'], 50);
    ?>
</div>	
				<a href="blog/<?php 
    echo $posts['url_amigavel'];
    ?>
"><img src="imagens/ler_mais.png"></a>
				<hr class="hr-blog">
			</article>
		<?php 
}
?>
	</div>

	<div class="categorias-sidebar">
		<p class="title-cat-sidebar Oswald fs-20 upper branco textcenter bkg-azul">categorias</p>
开发者ID:mvnp,项目名称:purophp,代码行数:31,代码来源:blog.php

示例8: ago

            ?>
</span>&nbsp;&nbsp;<span class="ago"> <?php 
            echo ago($comment["created_on"]) . " ago";
            ?>
</span>
			</div>
		<?php 
        }
    }
    ?>
		</div>
		<br>
		<br>
		<div>
		<?php 
    $content = limit_text(trim(strip_tags($posts["content"])), 20);
    ?>
			<a href="javascript:void(0)" target="_blank" class="fb-share-post" title="Share this car on facebook">Share on facebook</a>
			
			<a class="twitter-share-button" href="https://twitter.com/share" data-size="small" data-url="<?php 
    echo site_url("post/" . $posts['url']);
    ?>
" data-text="<?php 
    echo $posts['title'];
    ?>
" data-count="none" >Share on Twitterrrrrrrrrrrr</a>
			
			
			
		</div>
开发者ID:gorgeousdreams,项目名称:Codeigniter-datatech,代码行数:30,代码来源:post_by_url.php

示例9: foreach

    foreach ($authors as $author) {
        $author_info = get_userdata($author->ID);
        $attachment_id = get_user_meta($author->ID, 'avatar_manager_custom_avatar', true);
        $custom_avatar = get_post_meta($attachment_id, '_avatar_manager_custom_avatar', true);
        $avatar_url = avatar_manager_generate_avatar_url($attachment_id, 300);
        ?>
            <div class="redactie__member">
                <div class="redactie__member-meta" onclick="">
                    <div>
                        <h3 class="redactie__member-title"><?php 
        echo $author->display_name;
        ?>
</h3>
                        <p class="redactie__member-summery">
                        <?php 
        echo limit_text($author->description, 35);
        ?>
                        </p>
                    </div>
                </div>
                <img class="redactie__img" src="<?php 
        echo $avatar_url;
        ?>
"/>
          </div>
        <?php 
    }
} else {
    echo 'No authors found';
}
?>
开发者ID:simulacrum-amsterdam,项目名称:simulacrum-sage,代码行数:31,代码来源:redactie.php

示例10: get_permalink

                    	| <a href="<?php 
echo get_permalink(70);
?>
">Foreign Titles</a> 
                        | <a href="<?php 
echo get_permalink(72);
?>
">Awards</a> |</p>
                  </div>
                </div>
                <div class="line-news"></div>
              </div>
              <div class="col-sm-12">
                <?php 
$page = get_page('68');
$content = apply_filters('the_content', limit_text($page->post_content, 40));
$link = get_permalink($page);
echo $content;
echo "<a href='{$link}'>Read more</a>";
?>
              </div>
            </div>
          </div>
        </div>
        <!-- close .row --> 
      </div>
      <!-- close .main-content -->


<?php 
$CT1 = array('post_type' => 'creator', 'posts_per_page' => -1, 'paged' => get_query_var('paged'), 'meta_query' => array(array('key' => 'creator_types', 'value' => 'CT1', 'compare' => 'LIKE')));
开发者ID:tadas8,项目名称:Kaiseisha,代码行数:31,代码来源:front-page.php

示例11: getJson

    default:
        require_once "include/profile/default.php";
        break;
}
// end content
// news
$template->loadTemplateFile("footer.tpl");
$template->setCurrentBlock("news");
$template->setVariable("NEWS", "Intranet News");
//$template->parseCurrentBlock();
$json = getJson($url_json);
//die($json);
$arr = json_decode($json);
//var_dump($arr);
$template->setCurrentBlock("article");
foreach ($arr as $obj) {
    //die$obj->guid;
    $template->setVariable("NEWSLINK", $obj->guid);
    $template->setVariable("NEWSTITLE", $obj->post_title);
    $template->setVariable("NEWSCONTENT", limit_text($obj->post_content, 15));
    $template->setVariable("NEWSDATE", $obj->post_date);
    $template->setVariable("NEWSAUTHOR", $obj->user_nicename);
    $template->parseCurrentBlock();
}
$template->parse("newsinner");
$template->show();
?>
				

 
开发者ID:cmaere,项目名称:saris_dev,代码行数:27,代码来源:controller.php

示例12: get_part

<div id="<?php 
get_part($the_video_id);
?>
" class="block <?php 
get_part($the_video_status);
?>
">
    <div class="screenshot">
        <a href="<?php 
get_part($the_video_permalink);
?>
">
            <img src="<?php 
get_part($the_video_thumbnail);
?>
" />
        </a>
    </div>
    
    <h2><?php 
limit_text($the_video_title, '25');
?>
</h2>
    <p><?php 
limit_text($the_video_description, '70');
?>
</p>
</div>
开发者ID:cristianoiglesias,项目名称:cinematico,代码行数:28,代码来源:content-gallery-item.php

示例13: foreach

                                        <th>Employer <i class="fa fa-sort"></i></th>
					<th>Actions</th>
				  </tr>
				</thead>
				<tbody>
				<?php 
if (isset($consultant) && $consultant->num_rows() > 0) {
    foreach ($consultant->result_array() as $count => $consultant) {
        ?>
					<tr>
					<td><?php 
        echo ucfirst($consultant['conslt_name']);
        ?>
</td>
					<td><?php 
        echo limit_text($consultant['conslt_skill'], 50);
        ?>
</td>
					<td><?php 
        echo $consultant['conslt_buy_price'];
        ?>
</td>
                                        <td><?php 
        echo $consultant['conslt_sell_price'];
        ?>
</td>
                                        <td></td>
                                        <td></td>
					<td>
					<a href="<?php 
        echo site_url('consultants/editconsultant/' . $consultant['conslt_id']);
开发者ID:anji12172,项目名称:finalProject,代码行数:31,代码来源:consultants.php

示例14: limit_text

						</a>
					<?php 
        }
        ?>
					<h1 class="Cycle fs-24">
						<a href="blog/<?php 
        echo $relatedDado['url_amigavel'];
        ?>
" style="color:#3f3f3f !important">
							<?php 
        echo $relatedDado['titulo'];
        ?>
						</a>
					</h1>
					<div class="Cycle fs-20"><?php 
        echo limit_text($relatedDado['conteudo'], 45);
        ?>
</div>
					<a href="blog/<?php 
        echo $relatedDado['url_amigavel'];
        ?>
">
						<img src="imagens/bot-leiamais-blog.png" alt="<?php 
        echo $relatedDado['titulo'];
        ?>
" style="margin-left:-4px; margin-top:20px" />
					</a>
				</div>	
			<?php 
    }
    ?>
开发者ID:mvnp,项目名称:purophp,代码行数:31,代码来源:index.php

示例15: limit_text

<!DOCTYPE html>
<html lang="en">

<head>
<?php 
if (!$error) {
    ?>
    <title><?php 
    echo $trail['name'];
    ?>
 - Prescription Trails - <?php 
    echo $trail['city'];
    ?>
</title>
    <meta name="description" content="<?php 
    echo limit_text($metaDesc, 24);
    ?>
" />
    
    <!-- Schema.org markup for Google+ -->
    <meta itemprop="image" content="<?php 
    echo $trail['thumbURL'];
    ?>
">
    <link rel="canonical" href="<?php 
    if ($pretty_urls) {
        echo $trail['url'];
    } else {
        echo $baseurl . "trail/?id=" . $trail['id'];
    }
    ?>
开发者ID:jmayfiel,项目名称:prescriptiontrails,代码行数:31,代码来源:index.php


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