本文整理汇总了PHP中word_limiter函数的典型用法代码示例。如果您正苦于以下问题:PHP word_limiter函数的具体用法?PHP word_limiter怎么用?PHP word_limiter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了word_limiter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: description
public function description($htmldata, $num)
{
$content = preg_replace('/<a href="[^"]*">[^<]*<img src="[^"]*"[^>]*>[^<]*<\\/a>/sim', '', $htmldata);
//using codeigniter's word limiter helper that accepts the string and the integer of number or count
$content = word_limiter($content, $num);
return $content;
}
示例2: latest_comments
/**
* Set error reporting
*
* @access public
*/
public function latest_comments()
{
$this->_ci->load->model('comments/comments_model');
if ($comments = $this->_ci->comments_model->get_new_comments($this->_ci->session->userdata('user_last_login'))) {
$this->_ci->load->library('table');
$table_template = array('table_open' => '<table class="main" id="grid" width="100%" border="0" cellspacing="0" cellpadding="0">', 'row_start' => '<tr class="second">', 'row_alt_start' => '<tr class="first">');
$this->_ci->table->set_template($table_template);
$this->_ci->table->set_heading(lang('lang_name'), lang('lang_comment'), lang('lang_article'), lang('lang_status'));
foreach ($comments as $item) {
if ($item['comment_approved'] == 'spam') {
$status = '<span class="spam">' . lang('lang_spam') . '</span>';
} elseif ($item['comment_approved'] == 0) {
$status = '<span class="inactive">' . lang('lang_notactive') . '</span>';
} else {
$status = '<span class="active">' . lang('lang_active') . '</span>';
}
$this->_ci->table->add_row('<div class="gravatar"><img class="gravatar" src="' . gravatar($item['comment_author_email'], "PG", "24", "wavatar") . '" /></div>
<strong>
' . $item['comment_author'] . '
</strong>', word_limiter($item['comment_content'], 15) . ' ' . anchor('admin/comments/edit/' . $item['comment_ID'], lang('lang_edit')), anchor('article/' . $item['article_uri'] . '/#comment-' . $item['comment_ID'], $item['article_title']), $status);
}
echo '<h2>' . lang('lang_recent_comments') . '</h2>';
echo $this->_ci->table->generate();
}
}
示例3: get_keyword
function get_keyword($post)
{
if (!$post['meta_keyword']) {
return word_limiter($post['title'], 2);
}
return $post['meta_keyword'];
}
示例4: _GetOrgs
/**
* @param $Pattern string/bool Search pattern or FALSE if all.
* @param $urlpath path that links will point to
* @param $status of the entry 'live','hidden','suggested'
* @return array of organisations matching pattern.
*/
function _GetOrgs($Pattern, $urlpathpre = 'directory/', $urlpathpost = '', $status = 'live')
{
$org_description_words = $this->CI->pages_model->GetPropertyInteger('org_description_words', FALSE, 5);
$orgs = $this->CI->directory_model->GetDirectoryOrganisations($status);
$organisations = array();
foreach ($orgs as $org) {
$organisations[] = array('id' => $org['organisation_entity_id'], 'name' => $org['organisation_name'], 'shortname' => $org['organisation_directory_entry_name'], 'link' => $urlpathpre . $org['organisation_directory_entry_name'] . $urlpathpost, 'description' => $org['organisation_description'], 'shortdescription' => word_limiter($org['organisation_description'], $org_description_words), 'type' => $org['organisation_type_name']);
}
return $organisations;
}
示例5: allnews
public function allnews($tag)
{
if ($this->session->userdata('user_pro_id') && $this->session->userdata('provider')) {
$context = stream_context_create(array('http' => array('header' => 'Connection: close\\r\\n')));
$json_articles = curl_init();
curl_setopt($json_articles, CURLOPT_URL, 'http://graystone.com.ng/kuvukiservice/api/news/newsbytag/tag/' . $tag);
curl_setopt($json_articles, CURLOPT_RETURNTRANSFER, 1);
$obj_articles = json_decode(curl_exec($json_articles));
$json_latest = curl_init();
curl_setopt($json_latest, CURLOPT_URL, 'http://graystone.com.ng/kuvukiservice/api/news/newsbytaglatest/tag/' . $tag);
curl_setopt($json_latest, CURLOPT_RETURNTRANSFER, 1);
$obj_latest = json_decode(curl_exec($json_latest));
if ($obj_articles->status == '100') {
//if data was returned
$this->data['news_data'] = $obj_articles->data;
$this->data['news_data_latest'] = $obj_latest->data;
$this->data['news_data_latest_description'] = word_limiter($this->data['news_data_latest']->content_txt, 60);
//send to view
$this->load->view('_partials/header', $this->data);
$this->load->view('_partials/menu_loggedin');
$this->load->view('home');
$this->load->view('_partials/footer');
} else {
//display no news view
$this->load->view('errors/no_news');
}
} else {
$context = stream_context_create(array('http' => array('header' => 'Connection: close\\r\\n')));
$json_articles = curl_init();
curl_setopt($json_articles, CURLOPT_URL, 'http://graystone.com.ng/kuvukiservice/api/news/newsbytag/tag/' . $tag);
curl_setopt($json_articles, CURLOPT_RETURNTRANSFER, 1);
$obj_articles = json_decode(curl_exec($json_articles));
$json_latest = curl_init();
curl_setopt($json_latest, CURLOPT_URL, 'http://graystone.com.ng/kuvukiservice/api/news/newsbytaglatest/tag/' . $tag);
curl_setopt($json_latest, CURLOPT_RETURNTRANSFER, 1);
$obj_latest = json_decode(curl_exec($json_latest));
if ($obj_articles->status == '100') {
//if data was returned
$this->data['news_data'] = $obj_articles->data;
$this->data['news_data_latest'] = $obj_latest->data;
$this->data['news_data_latest_description'] = word_limiter($this->data['news_data_latest']->content_txt, 60);
//send to view
$this->load->view('_partials/header', $this->data);
$this->load->view('_partials/menu');
$this->load->view('home');
$this->load->view('_partials/footer');
} else {
//if theres no news
$this->load->view('errors/no_news');
//redirect to home
/*redirect(base_url());*/
}
}
}
示例6: fetch
function fetch($fetch_type = 'complete', $type = 1)
{
$user = $this->auth->get_user();
$this->_data['data']['user_id'] = $user['id'];
$sql = '
SELECT
n.*,
CONCAT(uc.first_name, " ", uc.last_name) created_fullname
FROM notification n
JOIN user uc ON n.created_by = uc.id
WHERE n.user_id = ? AND n.`type` = ? AND n.read_time IS NULL
ORDER BY n.id DESC
LIMIT 1
';
$this->_data['data']['new_row'] = $this->db->query($sql, array($user['id'], $type))->row_array();
if (empty($this->_data['data']['new_row'])) {
$this->_data['data']['new_row'] = null;
} else {
$this->load->helper('text');
$this->_data['data']['new_row']['message'] = word_limiter($this->_data['data']['new_row']['message'], 25);
}
if (!empty($this->_data['data']['new_row'])) {
$sql = '
SELECT COUNT(*) count FROM notification
WHERE user_id = ? AND `type` = ? AND read_time IS NULL
';
$this->_data['data']['row_count'] = $this->db->query($sql, array($user['id'], $type))->row()->count;
}
if ($fetch_type == 'rows' || $fetch_type == 'complete') {
$this->load->helper('gravatar');
$sql = '
SELECT n.*, uc.email, uc.image, CONCAT(uc.first_name, " ", uc.last_name) created_fullname
FROM notification n
JOIN user u ON n.user_id = u.id
JOIN user uc ON n.created_by = uc.id
WHERE user_id = ? AND `type` = ?
ORDER BY id DESC
LIMIT 5
';
$rows = $this->db->query($sql, array($user['id'], $type))->result_array();
foreach ($rows as &$row) {
if (!empty($row['icon']) && strpos($row['icon'], '://') === FALSE) {
$row['icon'] = site_url($row['icon']);
}
if (!empty($row['url']) && strpos($row['url'], '://') === FALSE) {
$row['url'] = site_url(str_replace('/edit/', '/detail/', $row['url']));
}
$row['icon'] = get_image_path($row['image']);
}
$this->db->set('read_time', date('Y-m-d H:i:s'))->where('read_time IS NULL', null, false)->where('user_id', $user['id'])->where('type', $type)->update('notification');
$this->_data['data']['rows'] = $rows;
}
}
示例7: allnews
public function allnews($search)
{
if ($this->session->userdata('user_pro_id') && $this->session->userdata('provider')) {
$context = stream_context_create(array('http' => array('header' => 'Connection: close\\r\\n')));
$json_articles = curl_init();
curl_setopt($json_articles, CURLOPT_URL, 'http://localhost/kuvukiservice/api/news/newsbysearch/search/' . $search);
curl_setopt($json_articles, CURLOPT_RETURNTRANSFER, 1);
$obj_articles = json_decode(curl_exec($json_articles));
if ($obj_articles->status == '100') {
//if data was returned
$this->data['news_data'] = $obj_articles->data;
$this->data['news_data_latest'] = $obj_latest->data;
$this->data['news_data_latest_description'] = word_limiter($this->data['news_data_latest']->content_txt, 60);
//send to view
$this->load->view('_partials/header', $this->data);
$this->load->view('_partials/menu_loggedin');
$this->load->view('search');
$this->load->view('_partials/footer_search');
} else {
$this->load->view('_partials/header', $this->data);
$this->load->view('_partials/menu_loggedin');
$this->load->view('search');
$this->load->view('_partials/footer_search');
}
} else {
$context = stream_context_create(array('http' => array('header' => 'Connection: close\\r\\n')));
$json_articles = curl_init();
curl_setopt($json_articles, CURLOPT_URL, 'http://localhost/kuvukiservice/api/news/newsbysearch/search/' . $search);
curl_setopt($json_articles, CURLOPT_RETURNTRANSFER, 1);
$obj_articles = json_decode(curl_exec($json_articles));
if ($obj_articles->status == '100') {
//if data was returned
$this->data['news_data'] = $obj_articles->data;
$this->data['news_data_latest'] = $obj_latest->data;
$this->data['news_data_latest_description'] = word_limiter($this->data['news_data_latest']->content_txt, 60);
//send to view
$this->load->view('_partials/header', $this->data);
$this->load->view('_partials/menu');
$this->load->view('search');
$this->load->view('_partials/footer_search');
} else {
$this->load->view('_partials/header', $this->data);
$this->load->view('_partials/menu');
$this->load->view('search');
$this->load->view('_partials/footer_search');
}
}
}
示例8: notification_header
function notification_header()
{
$ci =& get_instance();
$ci->load->library("lib_message");
$ci->load->helper("text");
$html = "";
//$ci->lib_message->init_redis();
$messages = $ci->lib_message->notification_feed();
if ($messages) {
foreach ($messages as $msg) {
$html .= "<li><a href='" . site_url('message') . "'>" . word_limiter($msg->message, 5, "...") . "</a></li>";
}
return $html;
} else {
return FALSE;
}
}
示例9: page
function page($index=0)
{
$data['list_news'] = $this->Mrss->getListFull('fg_news');
//var_dump($data['list_news']); die();
$last_built = date("D, d M Y H:i:s T");
$copy_year = "COPYRIGHT".date("Y");
header("Content-Type: text/xml charset='UTF-8'");
echo "<?xml version=\"1.0\"?>\n\n";
echo "<rss version=\"2.0\">\n\n"; //mo RSS
echo " <channel>\n";
echo " <title>WebFlashGame</title>\n";
echo " <link>linktrangchutrangweb.com</link>\n";
echo " <description>Web Flash Game</description>\n";
echo " <copyright>$copy_year WebFlashGame</copyright>\n";
echo " <generator>WebFlashGame</generator>\n";
echo " <language>Francais</language>\n";
echo " <lastBuildDate>$last_built</lastBuildDate>\n";
echo " <managingEditor>adminmail@yourdoamain .com</managingEditor>\n";
echo " <webMaster>adminmail@yourdoamain .com</webMaster>\n";
echo " <ttl>60</ttl>\n\n";
echo " <image>\n";
echo " <title>Web Flash Game</title>\n";
echo " <url></url>\n"; //dia chi logo
echo " <link>yourdoamain .com</link>\n";
echo " <width>100</width>\n";
echo " <height>48</height>\n";
echo " <description>tentrangweb</description>\n";
echo " </image>\n\n";
//////sau day la doan code goi mysql cua ban de lay link thuc su cua cac bai viet tren web ban . ban tao no nhu binh thuong .. nhung gan cac dia chi do' vao vai bien' so' de no' thay doi thuong xuyen vi du bien $tieude $mieuta va biet $link
//////////
foreach ( $data['list_news'] as $value) {
echo "<item>\n";
echo "<title>$value->name</title>\n";
echo "<link><?php echo base_url();?>news</link>\n";
//echo "<description>".word_limiter(strip_tags($value->news_content), 8)."</description>\n";
echo "<description>".$value->image."".word_limiter(strip_tags($value->content),30)."</description>\n";
echo "<guid></guid>\n";
echo "</item>\n";
}
//dong lai RSS
echo " </channel>\n\n";
echo "</rss>";
}
示例10: __construct
public function __construct($data)
{
/*
Reçois la zone dans laquelle le widget est appellé, voir clé ['widgets']['requestedZone'] : (LEFT, RIGHT, BOTTOM).
*/
$this->instance = get_instance();
$this->data =& $data;
$this->theme = get_core_vars('active_theme_object');
$this->location = MODULES_DIR . $this->data['currentWidget']['WIDGET_MODULE']['encrypted_dir'];
if (!class_exists('News_smart')) {
include_once $this->location . '/library.php';
}
$this->news = new News_smart();
$setting = $this->news->getBlogsterSetting();
// Dans le cas ou aucune limite n'est fixé nous fixon la limite par défaut à 5 commentaires.
$LIMIT = $this->data['currentWidget']['WIDGET_INFO']['WIDGET_PARAMETERS'] == '' ? 5 : $this->data['currentWidget']['WIDGET_INFO']['WIDGET_PARAMETERS'];
$this->data['comments'] = $this->news->getComments(false, 0, $LIMIT, 'desc');
$controler = $this->instance->tendoo->getControllersAttachedToModule('news');
$end = '<ul>';
foreach ($this->data['comments'] as $c) {
$user = $this->instance->users_global->getUser($c['AUTEUR']);
$article = $this->news->getSpeNews($c['REF_ART']);
if ($article) {
if ($user) {
$end .= '
<a href="' . $this->instance->url->site_url(array('account', 'profile', $user['PSEUDO'])) . '">' . $user['PSEUDO'] . '</a> dit :
"' . word_limiter($c['CONTENT'], 10) . '" dans <a href="' . $this->instance->url->main_url() . 'index.php/' . $controler[0]['PAGE_CNAME'] . '/lecture/' . $article[0]['URL_TITLE'] . '">' . $article[0]['TITLE'] . '</a><br><br>';
} else {
$offlineUser = $c['OFFLINE_AUTEUR'] != '' ? $c['OFFLINE_AUTEUR'] : 'Utilisateur inconnu';
$end .= '
<a href="#">' . $offlineUser . '</a> dit :
"' . word_limiter($c['CONTENT'], 10) . '" dans <a href="' . $this->instance->url->main_url() . 'index.php/' . $controler[0]['PAGE_CNAME'] . '/lecture/' . $article[0]['URL_TITLE'] . '">' . $article[0]['TITLE'] . '</a><br><br>';
}
}
}
$end .= '</ul>';
if (in_array($this->data['widgets']['requestedZone'], array('LEFT', 'BOTTOM', 'RIGHT'))) {
$widget_title = $this->data['currentWidget']['WIDGET_INFO']['WIDGET_TITLE'];
$zone = $this->data['widgets']['requestedZone'];
// requestedZone
set_widget(strtolower($zone), $widget_title, $end, 'text');
}
}
示例11: gg_view_assignment_listing
function gg_view_assignment_listing($section_id, $asec_id)
{
if (!gg_in_section($section_id)) {
return drupal_not_found();
}
$asec = AssignmentSection::find($asec_id);
$section = $asec->section()->first();
if ((int) $section->section_id !== (int) $section_id) {
return drupal_not_found();
}
$assignment = $asec->assignment()->first();
drupal_set_title($assignment->assignment_title);
$createProblems = WorkflowTask::whereIn('workflow_id', function ($query) use($asec_id) {
$query->select('workflow_id')->from('workflow')->where('assignment_id', '=', $asec_id);
})->whereType('edit problem')->whereStatus('complete')->get();
$headers = ['Problem'];
$rows = [];
if (count($createProblems) > 0) {
foreach ($createProblems as $t) {
$rows[] = [sprintf('<a href="%s">%s</a>', url('class/workflow/' . $t->workflow_id), word_limiter($t->data['problem'], 20))];
}
}
$return = '';
// Back Link
$return .= sprintf('<p><a href="%s">%s %s</a>', url('class/assignments'), HTML_BACK_ARROW, t('Back to Assignment List in Everyone\'s Work'));
// Course/section/semester
$course = $section->course()->first();
$semester = $section->semester()->first();
$return .= sprintf('<p><strong>%s</strong>: %s — %s — %s', t('Course'), $course->course_name, $section->section_name, $semester->semester_name);
// Assignment Description
$return .= sprintf('<p class="summary">%s</p>', nl2br($assignment->assignment_description));
$return .= '<hr />';
// Instructions
$return .= sprintf('<p>%s <em>%s</em><p>', t('Select a question to see the work on that question so far.'), t('Note that you will not be allowed to see some work in progress.'));
$return .= theme('table', array('header' => $headers, 'rows' => $rows, 'empty' => 'No problems found.', 'attributes' => array('width' => '100%')));
return $return;
}
示例12: date
"></div>
<div class="content">
<h3><?php
echo $value->title;
?>
</h3>
<div class="press-date-time">
<?php
echo $value->source;
?>
: <?php
echo date('F j, Y', strtotime($value->release_date));
?>
</div>
<p> <?php
echo word_limiter(nl2br($value->description), 40);
?>
<a href="<?php
echo ROOTPATH . $value->pdf_link;
?>
" class="download">
<?php
echo $value->source == "Press Release" ? "Download PDF >>" : "Full Story >>";
?>
</a>
</p>
</div>
</div>
</div>
<?php
示例13: word_limiter
<img src="/media/imagecache.php?width=175&height=170&cropratio=1:1&image=<?php
echo $tabs->path;
?>
" class="player-image" />
<?php
if ($youtube_tray) {
?>
</a>
<?php
}
?>
</div>
<div class="inner-right-tab"><?php
echo word_limiter($tabs->description, 40);
?>
<br /><br />
<?php
$target = '';
// checking link is external or not if yes then it opens in new window.
if (EXTERNAL == $tabs->link_type) {
$target = ' target="_blank"';
}
$cationText = CAPTION_TEXT;
if ($tabs->link_caption != '') {
$cationText = $tabs->link_caption;
}
?>
<a href="<?php
echo $tabs->pdf_link;
示例14: foreach
</tr>
</thead>
<tbody>
<?php
if (!empty($publish_data)) {
foreach ($publish_data as $publish_list) {
$checked = '';
$all_art_see = explode(',', $art_data[0]->pub_must_see);
if (in_array($publish_list->art_id, $all_art_see)) {
$checked = 'checked="checked"';
}
?>
<tr>
<th><?php
echo word_limiter($publish_list->art_fulltitle, 20);
?>
</th>
<td><?php
echo date('m-d-Y', strtotime($publish_list->art_publish));
?>
</td>
<td><?php
if (!empty($publish_list->art_cover)) {
}
?>
</td>
<td><input type="checkbox" class="art_must_see" name="art_see[]" id="art_see" value="<?php
echo $publish_list->art_id;
?>
" <?php
示例15: foreach
<?php
foreach ($posts as $post) {
?>
<li class="space">
<div class="box">
<div class="post-img">
<a href="<?php
echo site_url("/view/" . $post->post_id);
?>
" class="post-hover">
<span class="title"><?php
echo character_limiter($post->post_title, 12);
?>
</span>
<span class="desc"><?php
echo word_limiter($post->post_text, 20);
?>
</span>
<em><?php
echo strftime('%B %d, %Y', mysql_to_unix($post->post_date));
?>
</em>
</a>
<img src="<?php
echo cdn_url(getThumb($post->post_image_path));
?>
" alt="<?php
echo $post->post_title;
?>
" />
</div>