本文整理汇总了PHP中character_limiter函数的典型用法代码示例。如果您正苦于以下问题:PHP character_limiter函数的具体用法?PHP character_limiter怎么用?PHP character_limiter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了character_limiter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
// Pass a language strings to client side
clientLang("account_name", "gm");
clientLang("ban_reason", "gm");
clientLang("account", "gm");
clientLang("has_been_banned", "gm");
clientLang("character_name", "gm");
clientLang("character_has_been_kicked", "gm");
clientLang("close_ticket", "gm");
clientLang("close_short", "gm");
clientLang("ban_short", "gm");
clientLang("kick_short", "gm");
clientLang("send", "gm");
clientLang("mail_sent", "gm");
clientLang("teleported", "gm");
clientLang("must_be_offline", "gm");
clientLang("item_sent", "gm");
$output = "";
foreach ($this->realms->getRealms() as $realm) {
$tickets = $this->gm_model->getTickets($realm);
if ($tickets) {
foreach ($tickets as $key => $value) {
$tickets[$key]['name'] = $realm->getCharacters()->getNameByGuid($value['guid']);
$tickets[$key]['ago'] = $this->template->formatTime(time() - $value['createTime']) . " ago";
$tickets[$key]['message_short'] = character_limiter($value['message'], 20);
}
}
$data = array('url' => pageURL, 'tickets' => $tickets, 'hasConsole' => $realm->getEmulator()->hasConsole(), 'realmId' => $realm->getId(), 'disable_items' => $this->config->item('gm_disable_send_item'));
$content = $this->template->loadPage('panel.tpl', $data);
$output .= $this->template->box($realm->getName(), $content);
}
$this->template->view($output, "modules/gm/css/gm.css", "modules/gm/js/gm.js");
}
示例2: rss
public function rss()
{
if (mw_is_installed() == true) {
event_trigger('mw_cron');
}
header('Content-Type: application/rss+xml; charset=UTF-8');
$cont = get_content('is_active=1&is_deleted=0&limit=2500&orderby=updated_at desc');
$site_title = $this->app->option_manager->get('website_title', 'website');
$site_desc = $this->app->option_manager->get('website_description', 'website');
$rssfeed = '<?xml version="1.0" encoding="UTF-8"?>';
$rssfeed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' . "\n";
$rssfeed .= '<channel>' . "\n";
$rssfeed .= '<atom:link href="' . site_url('rss') . '" rel="self" type="application/rss+xml" />' . "\n";
$rssfeed .= '<title>' . $site_title . '</title>' . "\n";
$rssfeed .= '<link>' . site_url() . '</link>' . "\n";
$rssfeed .= '<description>' . $site_desc . '</description>' . "\n";
foreach ($cont as $row) {
if (!isset($row['description']) or $row['description'] == '') {
$row['description'] = $row['content'];
}
$row['description'] = character_limiter(strip_tags($row['description']), 500);
$rssfeed .= '<item>' . "\n";
$rssfeed .= '<title>' . $row['title'] . '</title>' . "\n";
$rssfeed .= '<description><![CDATA[' . $row['description'] . ' ]]></description>' . "\n";
$rssfeed .= '<link>' . content_link($row['id']) . '</link>' . "\n";
$rssfeed .= '<pubDate>' . date('D, d M Y H:i:s O', strtotime($row['created_at'])) . '</pubDate>' . "\n";
$rssfeed .= '<guid>' . content_link($row['id']) . '</guid>' . "\n";
$rssfeed .= '</item>' . "\n";
}
$rssfeed .= '</channel>' . "\n";
$rssfeed .= '</rss>';
event_trigger('mw_robot_url_hit');
echo $rssfeed;
$this->app->content_manager->ping();
}
示例3: save
function save($items, $customer_id, $employee_id, $comment, $invoice_number, $payments, $sale_id = false)
{
if (count($items) == 0) {
return -1;
}
$sales_data = array('sale_time' => date('Y-m-d H:i:s'), 'customer_id' => $this->Customer->exists($customer_id) ? $customer_id : null, 'employee_id' => $employee_id, 'comment' => $comment, 'invoice_number' => $invoice_number);
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->trans_start();
$this->db->insert('sales_suspended', $sales_data);
$sale_id = $this->db->insert_id();
foreach ($payments as $payment_id => $payment) {
$sales_payments_data = array('sale_id' => $sale_id, 'payment_type' => $payment['payment_type'], 'payment_amount' => $payment['payment_amount']);
$this->db->insert('sales_suspended_payments', $sales_payments_data);
}
foreach ($items as $line => $item) {
$cur_item_info = $this->Item->get_info($item['item_id']);
$sales_items_data = array('sale_id' => $sale_id, 'item_id' => $item['item_id'], 'line' => $item['line'], 'description' => character_limiter($item['description'], 30), 'serialnumber' => character_limiter($item['serialnumber'], 30), 'quantity_purchased' => $item['quantity'], 'discount_percent' => $item['discount'], 'item_cost_price' => $cur_item_info->cost_price, 'item_unit_price' => $item['price'], 'item_location' => $item['item_location']);
$this->db->insert('sales_suspended_items', $sales_items_data);
$customer = $this->Customer->get_info($customer_id);
if ($customer_id == -1 or $customer->taxable) {
foreach ($this->Item_taxes->get_info($item['item_id']) as $row) {
$this->db->insert('sales_suspended_items_taxes', array('sale_id' => $sale_id, 'item_id' => $item['item_id'], 'line' => $item['line'], 'name' => $row['name'], 'percent' => $row['percent']));
}
}
}
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
return -1;
}
return $sale_id;
}
示例4: test_character_limiter
public function test_character_limiter()
{
$this->assertEquals('Once upon a time, a…', character_limiter($this->_long_string, 20));
$this->assertEquals('Once upon a time, a…', character_limiter($this->_long_string, 20, '…'));
$this->assertEquals('Short', character_limiter('Short', 20));
$this->assertEquals('Short', character_limiter('Short', 5));
}
示例5: index
public function index()
{
$this->load->model('clientes/Clientes_model', 'cliente');
$this->load->model('obras/Obras_model', 'obra');
$this->load->model('usuarios/Usuarioslocatarios_model', 'users');
$this->load->model('obras/Obras_model', 'obras');
$this->load->model('importacao/Importacao_model', 'import');
$this->load->model('importacao/Importacao_model', 'import');
$this->load->helper('text');
$data['titulo'] = 'Steel4Web - Administrador';
$data['pagina'] = 'dash-admin';
$data['clientes'] = $this->cliente->get_all_order('clientes');
$data['obras'] = $this->obras->get_all_order();
$data['users'] = $this->users->get_all_order();
$data['imports'] = $this->import->get_all_order();
$data['qtdClientes'] = count($this->cliente->get_all('clientes'));
$data['qtdObras'] = count($this->obra->get_all());
$data['qtdUsers'] = count($this->users->get_all());
$data['qtdImport'] = count($this->import->get_all_count());
for ($x = 0; $x < count($data['clientes']); $x++) {
$data['clientes'][$x]->razao = character_limiter($data['clientes'][$x]->razao, 50);
}
for ($y = 0; $y < count($data['obras']); $y++) {
$data['obras'][$y]->nomeObra = character_limiter($data['obras'][$y]->nomeObra, 50);
}
for ($h = 0; $h < count($data['users']); $h++) {
$data['users'][$h]->nome = character_limiter($data['users'][$h]->nome, 50);
}
for ($j = 0; $j < count($data['imports']); $j++) {
$data['imports'][$j]->arquivo = character_limiter($data['imports'][$j]->arquivo, 50);
}
$this->render($data);
}
示例6: get_message
function get_message()
{
$id = is_logged_in();
$ci =& get_instance();
$ci->load->helper('text');
$query = $ci->db->query('SELECT * FROM (SELECT * FROM `workstreams` ORDER BY time DESC) AS t where receiver ="' . $id . '" GROUP BY job_id');
$result = $query->result_object();
if (!empty($result)) {
$total = '';
$liHtml = '';
foreach ($result as $key => $value) {
$job_data = job_data('id', $value->job_id, ['slug', 'user_id']);
$rel = $job_data->user_id == $id ? 'buyer' : 'seller';
$first_name = get_user_data($value->sender, 'first_name');
if ($value->is_read == 0) {
$class = 'active';
$total++;
} else {
$class = '';
}
$liHtml .= '<li class=' . $class . '><a href="' . base_url("job/view/" . $job_data->slug . '?rel=' . $rel) . '">' . character_limiter($first_name . ' : ' . $value->message, 55) . '</a></li><hr style="margin-top:5px; margin-bottom:5px">';
}
return array('html' => $liHtml, 'total' => $total);
} else {
return $liHtml = '<li><a href="javascript:void(0)">No Message</a></li>';
}
}
示例7: getEpisode
public function getEpisode($permalink, $episode)
{
/**
* Get title website from database with the same parameter.
*
* @title (Object)
*
*/
$title = $this->config_model->select_by_function('SITE_TITLE')->row();
/**
* Get data anime from selected @permalink
*
* Paremeters:
* @permalink (String)
*
* return @anime (Object)
*/
$info['anime'] = $this->anime_model->select_by_permalink($permalink)->row();
/**
* Get data episode from @idanime
*
* Paremeters:
* @idanime (int)
* @episode (int)
*
* return @sAnime (Object)
*/
$info['sAnime'] = $this->episode_model->select_by_episode($info['anime']->idanime, $episode)->result();
/**
* Condition when selected data anime not found
* Show Error Code 404
*/
if (empty($info['sAnime'])) {
show_404();
}
/**
* Define variable @data (array) that need to be used in header
* Configuring meta tag header
*
*/
$desc = "Download " . $info['anime']->title_anime . " episode " . $episode . " from " . $title->content;
$data['website'] = $title->content;
$data['title'] = 'Download ' . $info['anime']->title_anime . ' Episode ' . $episode . ' | ' . $title->content;
$data['description'] = character_limiter($desc, 150, '...');
$data['keywords'] = "download anime " . $info['anime']->title_anime . ", streaming anime " . $info['anime']->title_anime;
/**
* Define variable @info (Object) that need to use within template.
*
*/
$info['rating'] = $this->rating->get($info['anime']->idanime);
$genre_count = $this->generate_genres->countTags($info['anime']->genres);
$info['genre_link'] = $this->generate_genres->get_tag_link($info['anime']->genres, $genre_count);
$this->load->view('header', $data);
$this->load->view('templates/downloads', $info);
$this->load->view('footer', $data);
}
示例8: get_aseguradoras
function get_aseguradoras()
{
$this->db->order_by("nombre", "asc");
$aseguradoras = $this->db->get_where("clientes", array("id_grupo" => 1, "estado" => 1));
$aseguradoras = $aseguradoras->result();
foreach ($aseguradoras as $aseguradora) {
$aseguradora->nombre = character_limiter($aseguradora->nombre, 25);
}
return $aseguradoras;
}
示例9: index
public function index()
{
$this->load->model('Share_inventory');
$model = $this->Share_inventory;
$tabular_data = [];
$report_data = $model->getData();
foreach ($report_data as $row) {
$tabular_data[] = [$row['item_id'], character_limiter($row['name'], 16), $row['quantity']];
}
$data = ['title' => $this->lang->line('share_items'), 'subtitle' => 'Send Items to others Locations', 'headers' => $model->getDataColumns(), 'data' => $tabular_data, 'controller_name' => strtolower(get_class()), 'session' => $this->session->userdata('items_shipping')];
$this->load->view('items/share_inventory', $data);
}
示例10: block_content
public function block_content($context, array $blocks = array())
{
// line 8
echo "<div class=\"module message\">\n <div class=\"module-head\">\n <h3>Pesan</h3>\n </div>\n <div class=\"module-body\">\n <div class=\"module-option clearfix\">\n ";
// line 14
echo get_flashdata("msg");
echo "\n\n <div class=\"pull-right\">\n <form class=\"form-search\" method=\"get\" action=\"";
// line 17
echo twig_escape_filter($this->env, site_url("message/index/"), "html", null, true);
echo "\">\n <div class=\"input-append\">\n <input type=\"text\" class=\"span3 search-query\" placeholder=\"cari pesan...\" name=\"q\" value=\"";
// line 19
echo twig_escape_filter($this->env, isset($context["keyword"]) ? $context["keyword"] : null, "html", null, true);
echo "\">\n <button type=\"submit\" class=\"btn\"><i class=\"icon-search\"></i></button>\n </div>\n </form>\n </div>\n <div class=\"pull-left\">\n <a href=\"";
// line 25
echo twig_escape_filter($this->env, site_url("message/create/"), "html", null, true);
echo "\" class=\"btn btn-primary\"><i class=\"icon-pencil\"></i> Tulis pesan</a>\n </div>\n </div>\n <div class=\"module-body table\">\n <table class=\"table table-message\">\n <tbody>\n ";
// line 31
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable(isset($context["inbox"]) ? $context["inbox"] : null);
foreach ($context['_seq'] as $context["_key"] => $context["d"]) {
// line 32
echo " <tr class=\"";
echo $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "opened") == 0 ? "unread" : "";
echo " clickable-row\" data-href=\"";
echo twig_escape_filter($this->env, site_url("message/detail/" . $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "id") . "#msg-" . $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "id")), "html", null, true);
echo "\">\n <td class=\"cell-author\">\n <img style=\"height:30px;width:30px; margin-right: 10px;\" class=\"img-polaroid img-circle pull-left\" src=\"";
// line 34
echo twig_escape_filter($this->env, get_url_image_siswa($this->getAttribute($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "profil"), "foto"), "medium", $this->getAttribute($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "profil"), "jenis_kelamin")), "html", null, true);
echo "\">\n <a href=\"";
// line 35
echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "profil"), "link_profil"), "html", null, true);
echo "\">";
echo twig_escape_filter($this->env, character_limiter($this->getAttribute($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "profil"), "nama"), 23, "..."), "html", null, true);
echo "</a>\n <br><small>";
// line 36
echo twig_escape_filter($this->env, $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "date"), "html", null, true);
echo "</small>\n </td>\n <td class=\"cell-title hidden-phone hidden-tablet\">\n <a class=\"pull-right\" style=\"margin-left:10px;\" href=\"";
// line 39
echo twig_escape_filter($this->env, site_url("message/detail/" . $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "id") . "/?confirm=1#confirm"), "html", null, true);
echo "\"><i class=\"icon-trash\"></i></a>\n ";
// line 40
echo character_limiter(strip_tags($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "content")), 80, "...");
echo "\n </td>\n </tr>\n ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['d'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 44
echo "\n </tbody>\n </table>\n </div>\n <div class=\"module-foot\">\n ";
// line 49
echo isset($context["pagination"]) ? $context["pagination"] : null;
echo "\n </div>\n\n </div>\n</div>\n";
}
开发者ID:unregister,项目名称:new_elearning,代码行数:53,代码来源:ab62e07afcd72ffe171409b0a6dbbb650bf91e8a072a4e9ac9dcbf44706d.php
示例11: summary_items
function summary_items($start_date, $end_date, $sale_type, $export_excel = 0)
{
$this->CI->load->model('reports/Summary_items');
$model = $this->CI->Summary_items;
$tabular_data = array();
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type));
foreach ($report_data as $row) {
$tabular_data[] = array(character_limiter($row['name'], 16), $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['profit']));
}
$data = array("title" => $this->CI->lang->line('reports_items_summary_report'), "subtitle" => date('m/d/Y', strtotime($start_date)) . '-' . date('m/d/Y', strtotime($end_date)), "headers" => $model->getDataColumns(), "data" => $tabular_data, "summary_data" => $model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type)), "export_excel" => $export_excel, "report_name" => __FUNCTION__);
$this->renderData = array('view' => 'partial/tabular_report', 'data' => $data);
return $this;
}
示例12: smarty_function_shorten
function smarty_function_shorten($params, $smarty)
{
if (!isset($params['length'])) {
return 'You must specify a "length" parameter for the {shorten} template function.';
} elseif (!isset($params['string'])) {
return 'You must specify a "string" parameter for the {shorten} template function.';
} else {
$smarty->CI->load->helper('text');
$shortened = character_limiter($params['string'], $params['length']);
// we may have HTML, so remove any unclosed tags
$shortened = preg_replace("/<([^<>]*)(?=<|\$)/", "\$1", $shortened);
return $shortened;
}
}
示例13: parseRow
protected function parseRow(array $r)
{
if ($r['active'] == 1) {
$r['active_icon'] = '<img src="' . assets_img('admin/button_green.gif', false) . '">';
} else {
$r['active_icon'] = '<img src="' . assets_img('admin/button_red.gif', false) . '">';
}
if (!empty($r['description'])) {
$r['description_active'] = character_limiter($r['description'], 120);
} else {
$r['description_active'] = '<img src="' . assets_img('admin/no.gif', false) . '">';
}
return $r;
}
示例14: index
function index()
{
if (is_dir('./installer')) {
$this->data->messages['notice'] = lang('delete_installer_message');
}
// Load stuff
$this->data->modules = $this->modules_m->getModules();
$this->load->model('comments/comments_m');
$this->load->model('pages/pages_m');
$this->load->model('users/users_m');
$this->lang->load('comments/comments');
$this->data->recent_users = $this->users_m->order_by('created_on')->limit(10)->get_all();
$this->data->recent_comments = $this->comments_m->get_recent();
foreach ($this->data->recent_comments as &$comment) {
// work out who did the commenting
if ($comment->user_id > 0) {
$comment->name = anchor('admin/users/edit/' . $comment->user_id, $comment->name);
}
// What did they comment on
switch ($comment->module) {
case 'news':
$this->load->model('news/news_m');
$article = $this->news_m->get($comment->module_id);
$comment->item = anchor('admin/news/preview/' . $article->id, $article->title, 'class="modal-large"');
break;
case 'photos':
$this->load->model('photos/photo_albums_m');
$album = $this->photo_albums_m->get($comment->module_id);
$comment->item = anchor('photos/' . $album->slug, $album->title, 'class="modal-large iframe"');
break;
default:
$comment->item = $comment->module . ' #' . $comment->module_id;
break;
}
// Link to the comment
if (strlen($comment->comment) > 30) {
$comment->comment = character_limiter($comment->comment, 30);
}
}
// Dashboard RSS feed (using SimplePie)
$this->load->library('simplepie');
$this->simplepie->set_cache_location(APPPATH . 'cache/simplepie/');
$this->simplepie->set_feed_url($this->settings->item('dashboard_rss'));
$this->simplepie->init();
$this->simplepie->handle_content_type();
// Store the feed items
$this->data->rss_items = $this->simplepie->get_items(0, $this->settings->item('dashboard_rss_count'));
$this->template->set_partial('sidebar', 'admin/partials/sidebar', FALSE);
$this->template->build('admin/dashboard', $this->data);
}
示例15: get_person_data_row
function get_person_data_row($person, $controller)
{
$CI =& get_instance();
$controller_name = $CI->uri->segment(1);
$width = $controller->get_form_width();
$table_data_row = '<tr>';
$table_data_row .= "<td width='5%'><input type='checkbox' id='person_{$person->person_id}' value='" . $person->person_id . "'/></td>";
$table_data_row .= '<td width="20%">' . character_limiter($person->last_name, 13) . '</td>';
$table_data_row .= '<td width="20%">' . character_limiter($person->first_name, 13) . '</td>';
$table_data_row .= '<td width="30%">' . mailto($person->email, character_limiter($person->email, 22)) . '</td>';
$table_data_row .= '<td width="20%">' . character_limiter($person->phone_number, 13) . '</td>';
$table_data_row .= '<td width="5%">' . anchor($controller_name . "/view/{$person->person_id}/width:{$width}", $CI->lang->line('common_edit'), array('class' => 'thickbox', 'title' => $CI->lang->line($controller_name . '_update'))) . '</td>';
$table_data_row .= '</tr>';
return $table_data_row;
}