本文整理汇总了PHP中cutString函数的典型用法代码示例。如果您正苦于以下问题:PHP cutString函数的具体用法?PHP cutString怎么用?PHP cutString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cutString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSynopsis
function getSynopsis($description, $max_length = 0)
{
if ($max_length <= 0) {
return nl2br($description);
}
return cutString($description, $max_length, ' [..]');
}
示例2: getContent
function getContent($description, $max_length = 0, $id = 0)
{
if ($max_length <= 0) {
return nl2br($description);
}
return cutString($description, $max_length, ' <a href="article.php?id=' . $id . '"> [...]</a>');
}
示例3: savePassThruToCookie
function savePassThruToCookie($_fullname, $_email, $_company, $_question, $_phone, $_customs)
{
global $INPUTS;
initData(array("INPUTS"));
if (!empty($_fullname) && $INPUTS[111]->Cookie && $INPUTS[111]->Active) {
setCookieValue("form_111", cutString(base64UrlDecode($_fullname), 255), true);
}
if (!empty($_email) && $INPUTS[112]->Cookie && $INPUTS[112]->Active) {
setCookieValue("form_112", cutString(base64UrlDecode($_email), 255), true);
}
if (!empty($_company) && $INPUTS[113]->Cookie && $INPUTS[113]->Active) {
setCookieValue("form_113", cutString(base64UrlDecode($_company), 255), true);
}
if (!empty($_question) && $INPUTS[114]->Cookie && $INPUTS[114]->Active) {
setCookieValue("form_114", base64UrlDecode($_question), true);
}
if (!empty($_phone) && $INPUTS[116]->Cookie && $INPUTS[116]->Active) {
setCookieValue("form_116", base64UrlDecode($_phone), true);
}
foreach ($INPUTS as $index => $input) {
if ($input->Custom && $input->Active && !empty($_customs[$index]) && $input->Cookie) {
setCookieValue("cf_" . $index, $_customs[$index], true);
}
}
}
示例4: index
public function index()
{
$this->language->load('promotion/duonglich');
$this->load->model('catalog/category');
$this->load->model('catalog/product');
$this->load->model('tool/image');
$banggia = $this->config->get('banggia');
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
$this->data['breadcrumbs'][] = array('text' => $banggia['title'], 'href' => $this->url->link('product/list'), 'separator' => $this->language->get('text_separator'));
$this->document->setTitle($banggia['customtitle']);
$this->document->setDescription($banggia['metadesc']);
$this->document->setKeywords($banggia['metakey']);
$this->data['heading_title'] = $banggia['title'];
$this->data['url'] = $this->url->link('product/list');
$this->data['desc'] = html_entity_decode($banggia['desc'], ENT_QUOTES, 'UTF-8');
$this->data['list_product'] = $this->data['list_product_box'] = array();
$this->data['lists'] = $this->config->get('list_product');
//Product
$products = $this->data['lists'];
foreach ($products as $k => $item) {
$product = explode(',', $item['list_product']);
foreach ($product as $product_id) {
$result = $this->model_catalog_product->getProduct($product_id);
if ($result) {
if ($result['price'] != 0) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ($result['image'] && file_exists(DIR_IMAGE . $result['image'])) {
$image = $this->model_tool_image->cropsize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
} else {
$image = $this->model_tool_image->cropsize('no_image.jpg', $this->config->get('config_image_product_width'), $this->config->get('config_image_product_width'));
}
if ($result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if (isset($result['custom_link'])) {
$custom_link = '&path=' . $result['custom_link'];
}
$this->data['list_product_box'][$k][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name_tour'] ? $result['name_tour'] : $result['name'], 'name_title' => cutString($result['name_tour'] ? $result['name_tour'] : $result['name'], 16), 'description' => cutString(preg_replace('/\\n/', "", strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 50), 'model' => $result['model'], 'start_time' => $result['start_time'], 'start_time_holiday' => $result['start_time_holiday'] ? $result['start_time_holiday'] : ' ', 'duration' => $result['duration'], 'product_type' => $result['product_type'], 'transport' => $result['transport'], 'price' => $price, 'special' => $special ? $special : 'Liên hệ', 'href' => $this->url->link('product/product', $custom_link . '&product_id=' . $result['product_id']));
}
}
}
$this->data['button_view_more'] = $this->language->get('button_view_more');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/list.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/list.tpl';
} else {
$this->template = 'default/template/product/list.tpl';
}
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
$this->response->setOutput($this->render());
}
示例5: getInsertStatement
function getInsertStatement($table, $data)
{
$columns = " (";
$values = " (";
foreach ($data as $columnName => $value) {
$columns .= "`" . $columnName . "`, ";
$values .= "" . getCleanValue($value) . ", ";
}
$columns = cutString($columns, 2) . ")";
$values = cutString($values, 2) . ")";
return "INSERT INTO " . getTableQuote($table) . $columns . " VALUES " . $values . ";";
}
示例6: getPages
function getPages()
{
global $db;
$pages = $db->queryToList("\r\n\t\t\t\tselect `key` as k,\r\n\t\t\t\t(\r\n\t\t\t\tselect count(*) \r\n\t\t\t\tfrom " . MYSQL_TABLE_PREFIX . "content as c2\r\n\t\t\t\twhere c2.`key` = c.`key`\r\n\t\t\t\t) as version_count,\r\n\t\t\t\t(\r\n\t\t\t\tselect title\r\n\t\t\t\tfrom " . MYSQL_TABLE_PREFIX . "content as c3\r\n\t\t\t\twhere c3.`key` = c.`key`\r\n\t\t\t\torder by version desc\r\n\t\t\t\tlimit 1\r\n\t\t\t\t) as title\r\n\t\t\t\tfrom " . MYSQL_TABLE_PREFIX . "content as c\r\n\t\t\t\tgroup by `key`\r\n\t\t\t\torder by `key` asc\r\n\t\t\t");
if (count($pages) > 0) {
foreach ($pages as $i => $v) {
$pages[$i]['title'] = cutString($v['title']);
$pages[$i]['edit_url'] = makeURL('admin', array('mode' => 'content', 'action' => 'edit', 'key' => $v['k']));
$pages[$i]['remove_url'] = makeURL('admin', array('mode' => 'content', 'action' => 'remove', 'key' => $v['k']));
$pages[$i]['url'] = makeURL($v['k']);
}
}
return $pages;
}
示例7: index
protected function index($setting)
{
$this->language->load('module/latest');
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['button_cart'] = $this->language->get('button_cart');
$this->load->model('catalog/product');
$this->load->model('tool/image');
$this->data['products'] = array();
$data = array('filter_price_on' => true, 'sort' => 'p.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $setting['limit']);
$results = $this->model_catalog_product->getProducts($data);
foreach ($results as $result) {
if ($result['image']) {
$image = $this->model_tool_image->onesize($result['image'], $setting['image_width'], $setting['image_height']);
} else {
$image = false;
}
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price') && $result['price'] != 0) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((double) $result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ((double) $result['special1']) {
$special1 = $this->currency->format($this->tax->calculate($result['special1'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special1 = false;
}
if ($this->config->get('config_review_status')) {
$rating = $result['rating'];
} else {
$rating = false;
}
if (isset($result['custom_link'])) {
$custom_link = '&path=' . $result['custom_link'];
}
$this->data['products'][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'name' => cutString($result['name'], 12), 'price' => $price, 'special' => $special, 'special1' => $special1, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']), 'href' => $this->url->link('product/product', $custom_link . '&product_id=' . $result['product_id']));
}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/latest.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/latest.tpl';
} else {
$this->template = 'default/template/module/latest.tpl';
}
$this->render();
}
示例8: news
function news($s)
{
global $db, $lang;
$tbl = MYSQL_TABLE_PREFIX . 'news';
$return = array();
$result = $db->selectList($tbl, "*", "INSTR(`title`, '" . $s . "') > 0 OR\r\n\t\t\t\t\t\t\t\t\t\t\t\tINSTR(`text`, '" . $s . "') > 0");
if (count($result) > 0) {
foreach ($result as $i => $r) {
$engine = $lang->get('engines_news');
$title = cutString($r['title']);
$description = $r['text'];
$url = makeURL('news', array('newsid' => $r['newsid']));
$relevance = strcount($r['text'] . $r['title'], $s);
$return[] = array('engine' => $engine, 'title' => $title, 'description' => $description, 'url' => $url, 'relevance' => $relevance);
}
}
return $return;
}
示例9: content
function content($s)
{
global $db, $lang;
$tbl = MYSQL_TABLE_PREFIX . 'content';
$return = array();
$result = $db->queryToList("select c.key, c.title, c.text, c.box_content\r\n\t\t\tfrom (\r\n\t\t\tselect `key`, max(version) as latest\r\n\t\t\tfrom " . $tbl . "\r\n\t\t\tgroup by `key`\r\n\t\t\t)\r\n\t\t\tas x\r\n\t\t\tinner join " . $tbl . " as c\r\n\t\t\ton c.key = x.key and c.version = x.latest\r\n\t\t\twhere title like '%" . $s . "%'\r\n\t\t\tor text like '%" . $s . "%'\r\n\t\t\tor box_content like '%" . $s . "%'");
if (count($result) > 0) {
foreach ($result as $i => $r) {
$engine = $lang->get('engines_content');
$title = cutString($r['title']);
$description = $r['text'];
$url = makeURL($r['key']);
$relevance = strcount($r['text'] . ' ' . $r['title'] . ' ' . $r['title'] . ' ' . $r['title'], $s);
$return[] = array('engine' => $engine, 'title' => $title, 'description' => $description, 'url' => $url, 'relevance' => $relevance);
}
}
return $return;
}
示例10: cutString
" /></td>
<td class="listview_id"><?php
echo $row["id"];
?>
</td>
<td><?php
echo $row["title"];
?>
</td>
<td><i class="fa fa-link"></i> 浏览</td>
<td class="text-center"><i class="fa fa-photo showpic"></td>
<td align="center"> <a href="?pid=<?php
echo $row["sort_id"];
?>
"><?php
echo cutString($row["sort_title"], 10);
?>
</a></td>
<td>
<?php
echo $row["att"];
?>
</td>
<td><?php
echo $row["hits"];
?>
</td>
<td class="ajax_weight"><?php
echo $row["weight"];
?>
</td>
示例11: base_url
?>
<li class="color">
<a href="<?php
echo base_url() . '/tintuc/detail/' . $list_tintuc_right[$i]->id;
?>
">
<p><?php
echo $tieude;
?>
</p>
<i>
<?php
if ($lang == "vn") {
echo cutString(strip_tags($list_tintuc_right[$i]->noidung_v), 100) . '...';
} else {
echo cutString(strip_tags($list_tintuc_right[$i]->noidung_e), 100) . '...';
}
?>
</i>
</a>
</li>
<?php
}
?>
</marquee>
<!-- <div style="width:80%; float:left;padding:8px 17px;">
<marquee direction="down" width="100%" onmouseover="this.stop()" scrollamount="2" onmouseout="this.start()" height="280" align="left">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody><tr><td>
<div style="padding:10px 0px;">
示例12: array
makeURL($mod, array('mode' => 'newmovie', 'beamerid' => $beamerid))
)
);
*/
$smarty->assign('custom', false);
require_once $mod_dir . "/available_modules.php";
if (isset($available) && count($available) > 0) {
foreach ($available as $i => $av) {
$available[$i]['url'] = str_replace("&", "&", $av['url']);
}
}
$messages = $db->selectList('beamer_message', "*", "`beamerid`=" . $beamerid);
if (isset($messages) && count($messages) > 0) {
$available[] = array('name' => '---', 'url' => '-');
foreach ($messages as $message) {
$available[] = array('name' => cutString($message['text'], 30), 'url' => str_replace('&', '&', makeURL($mod, array('mode' => 'message', 'messageid' => $message['messageid']))));
}
}
/*
$movies = $db->selectList('beamer_movie', "*",
"`beamerid`=".$beamerid);
if (isset($movies) && count($movies) > 0) {
$available[] = array('name' => '---', 'url' => '-');
foreach ($movies as $movie) {
$available[] = array(
'name' => cutString($movie['file'], 30),
'url' => str_replace('&', '&',
makeURL($mod, array('mode' => 'movie', 'movieid' => $movie['movieid'])))
);
}
示例13: LoadFromLogin
function LoadFromLogin($_group)
{
if (Server::$Inputs[111]->IsServerInput()) {
$this->Fullname = cutString($_group->GetServerInput(Server::$Inputs[111]), 255);
}
if (Server::$Inputs[112]->IsServerInput()) {
$this->Email = cutString($_group->GetServerInput(Server::$Inputs[112]), 255);
}
if (Server::$Inputs[113]->IsServerInput()) {
$this->Company = cutString($_group->GetServerInput(Server::$Inputs[113]), 255);
}
if (Server::$Inputs[114]->IsServerInput()) {
$this->Text = cutString($_group->GetServerInput(Server::$Inputs[114]), MAX_INPUT_LENGTH);
}
if (Server::$Inputs[116]->IsServerInput()) {
$this->Phone = cutString($_group->GetServerInput(Server::$Inputs[116]), 255);
}
foreach (Server::$Inputs as $index => $input) {
if ($input->Active && $input->Custom) {
if ($input->IsServerInput()) {
$this->Customs[$index] = $_group->GetServerInput($input);
}
}
}
}
示例14: index
//.........这里部分代码省略.........
}
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price') && $result['price'] != 0) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((double) $result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
$price_save_c = $result['price'] - $result['special'];
if ($price_save_c > 0) {
$price_save = $this->currency->format($this->tax->calculate($price_save_c, $result['tax_class_id'], $this->config->get('config_tax')));
// $percent = round(($price_save_c / $result['price']) * 100);
$percent = $this->currency->format(round($price_save_c));
} else {
$price_save = false;
$percent = false;
}
if ($this->config->get('config_tax')) {
$tax = $this->currency->format((double) $result['special'] ? $result['special'] : $result['price']);
} else {
$tax = false;
}
if ($this->config->get('config_review_status')) {
$rating = (int) $result['rating'];
} else {
$rating = false;
}
if (isset($result['custom_link'])) {
$custom_link = '&path=' . $result['custom_link'];
}
$this->data['products'][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name_tour'] ? $result['name_tour'] : $result['name'], 'description' => cutString(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 50), 'model' => $result['model'], 'start_time' => $result['start_time'], 'start_time_holiday' => $result['start_time_holiday'], 'start_time_tet' => $result['start_time_tet'], 'not_start_time' => $result['not_start_time'], 'departure' => $result['departure'], 'location_to' => $result['location_to'], 'location_from' => $result['location_from'], 'transport' => $result['transport'], 'duration' => $result['duration'], 'schedule' => $result['schedule'], 'product_type' => $result['product_type'], 'product_class' => $result['product_class'], 'price' => $price ? $price : $this->language->get('text_contact'), 'special' => $special, 'price_save' => $price_save, 'percent' => $percent, 'tax' => $tax, 'rating' => $result['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']), 'href' => $this->url->link('product/product', $custom_link . '&product_id=' . $result['product_id']));
}
$url = '';
if (isset($this->request->get['search'])) {
$url .= '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['tag'])) {
$url .= '&tag=' . urlencode(html_entity_decode($this->request->get['tag'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['description'])) {
$url .= '&description=' . $this->request->get['description'];
}
if (isset($this->request->get['category_id'])) {
$url .= '&category_id=' . $this->request->get['category_id'];
}
if (isset($this->request->get['sub_category'])) {
$url .= '&sub_category=' . $this->request->get['sub_category'];
}
if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}
$this->data['sorts'] = array();
$this->data['sorts'][] = array('text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/search', 'sort=p.sort_order&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/search', 'sort=pd.name&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/search', 'sort=pd.name&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/search', 'sort=p.price&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/search', 'sort=p.price&order=DESC' . $url));
if ($this->config->get('config_review_status')) {
$this->data['sorts'][] = array('text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/search', 'sort=rating&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/search', 'sort=rating&order=ASC' . $url));
}
$this->data['sorts'][] = array('text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/search', 'sort=p.model&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/search', 'sort=p.model&order=DESC' . $url));
示例15: login
function login()
{
global $INTERNAL, $USER, $CONFIG;
if (empty($_POST[POST_EXTERN_USER_NAME]) && !isnull(getCookieValue("form_111"))) {
$USER->Browsers[0]->Fullname = cutString(getCookieValue("form_111"), 254);
} else {
$USER->Browsers[0]->Fullname = cutString(AJAXDecode($_POST[POST_EXTERN_USER_NAME]), 254);
}
if (empty($_POST[POST_EXTERN_USER_EMAIL]) && !isnull(getCookieValue("form_112"))) {
$USER->Browsers[0]->Email = cutString(getCookieValue("form_112"), 254);
} else {
$USER->Browsers[0]->Email = cutString(AJAXDecode($_POST[POST_EXTERN_USER_EMAIL]), 254);
}
if (empty($_POST[POST_EXTERN_USER_COMPANY]) && !isnull(getCookieValue("form_113"))) {
$USER->Browsers[0]->Company = cutString(getCookieValue("form_113"), 254);
} else {
$USER->Browsers[0]->Company = cutString(AJAXDecode($_POST[POST_EXTERN_USER_COMPANY]), 254);
}
$USER->Browsers[0]->Question = cutString(AJAXDecode($_POST[POST_EXTERN_USER_QUESTION]), 254);
$USER->Browsers[0]->SaveLoginData();
for ($i = 0; $i <= 9; $i++) {
if (isset($_POST["p_cf" . $i]) && !empty($_POST["p_cf" . $i]) && isset($CONFIG["gl_ci_list"][$i])) {
$USER->Browsers[0]->Customs[$i] = AJAXDecode($_POST["p_cf" . $i]);
setCookieValue("cf_" . $i, $USER->Browsers[0]->Customs[$i]);
}
}
if (isset($_POST[POST_EXTERN_USER_NAME]) && !empty($_POST[POST_EXTERN_USER_NAME])) {
setCookieValue("form_111", $USER->Browsers[0]->Fullname);
}
if (isset($_POST[POST_EXTERN_USER_EMAIL]) && !empty($_POST[POST_EXTERN_USER_EMAIL])) {
setCookieValue("form_112", $USER->Browsers[0]->Email);
}
if (isset($_POST[POST_EXTERN_USER_COMPANY]) && !empty($_POST[POST_EXTERN_USER_COMPANY])) {
setCookieValue("form_113", $USER->Browsers[0]->Company);
}
$USER->AddFunctionCall("lz_chat_set_status(lz_chat_data.STATUS_INIT);", false);
}