本文整理汇总了PHP中gcms::html2txt方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::html2txt方法的具体用法?PHP gcms::html2txt怎么用?PHP gcms::html2txt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::html2txt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$error = false;
$tab = false;
// details
$details = array();
$alias_topic = '';
foreach ($config['languages'] as $value) {
$topic = $db->sql_trim_str($_POST, "write_topic_{$value}");
$alias = gcms::aliasName($_POST["write_topic_{$value}"]);
$relate = $db->sql_trim($_POST, "write_relate_{$value}");
$keywords = gcms::getTags($_POST["write_keywords_{$value}"]);
$description = $db->sql_trim($_POST, "write_description_{$value}");
if ($topic != '') {
$save = array();
$save['topic'] = $topic;
$save['keywords'] = $db->sql_clean(gcms::cutstring(preg_replace('/[\'\\"\\r\\n\\s]{1,}/isu', ' ', $keywords == '' ? gcms::getTags($_POST["write_topic_{$value}"]) : $keywords), 255));
$save['description'] = gcms::cutstring(gcms::html2txt($description == '' ? $_POST["write_detail_{$value}"] : $description), 255);
$save['detail'] = gcms::ckDetail($_POST["write_detail_{$value}"]);
$save['language'] = $value;
$save['relate'] = $relate == '' ? $save['keywords'] : $relate;
$details[$value] = $save;
$alias_topic = $alias_topic == '' ? $alias : $alias_topic;
}
}
$save = array();
$save['alias'] = gcms::aliasName($_POST['write_alias']);
// id ที่แก้ไข
$id = gcms::getVars($_POST, 'write_id', 0);
$module_id = gcms::getVars($_POST, 'module_id', 0);
if ($id > 0) {
// ตรวจสอบโมดูล หรือ เรื่องที่เลือก (แก้ไข)
$sql = "SELECT I.`id`,I.`module_id`,M.`module`,M.`config`,I.`picture`,I.`member_id`";
示例2: header
// modules/event/admin_write_save.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
$ret = array();
// ตรวจสอบ referer และ สมาชิก
if (gcms::isReferer() && gcms::canConfig($config, 'event_can_write')) {
if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
$ret['error'] = 'EX_MODE_ERROR';
} else {
// ค่าที่ส่งมา
$save['topic'] = gcms::getTags($_POST['write_topic']);
$keywords = gcms::getTags($_POST['write_keywords']);
$save['keywords'] = $db->sql_clean(gcms::cutstring(preg_replace('/[\'\\"\\r\\n\\s]{1,}/isu', ' ', $keywords == '' ? $save['topic'] : $keywords), 149));
$description = trim(gcms::getVars($_POST, 'write_description', ''));
$save['description'] = $db->sql_trim_str(gcms::cutstring(gcms::html2txt($description == '' ? $_POST['write_detail'] : $description), 149));
$save['detail'] = gcms::ckDetail($_POST['write_detail']);
$save['published_date'] = $db->sql_trim_str($_POST, 'write_published_date');
$save['published'] = $_POST['write_published'] == '1' ? '1' : '0';
$save['begin_date'] = "{$_POST['write_d']} {$_POST['write_h']}:{$_POST['write_m']}:00";
$save['color'] = $db->sql_trim_str($_POST, 'write_color');
$id = gcms::getVars($_POST, 'write_id', 0);
if ($id > 0) {
// ตรวจสอบโมดูล หรือ เรื่องที่เลือก (แก้ไข)
$sql = "SELECT I.`module_id`,M.`module`";
$sql .= " FROM `" . DB_EVENTCALENDAR . "` AS I";
$sql .= " INNER JOIN `" . DB_MODULES . "` AS M ON M.`owner`='event' AND M.`id`=I.`module_id`";
$sql .= " WHERE I.`id`='{$id}'";
$sql .= " LIMIT 1";
} else {
// ตรวจสอบโมดูล (ใหม่)
示例3: foreach
}
foreach ($words as $a => $word) {
if (mb_stripos($item['topic'], $word) !== false) {
$v = $v + (90 - $a);
}
if (mb_stripos($item['detail'], $word) !== false) {
$v = $v + (85 - $a);
}
}
$search_result[$i]['id'] = $item['id'];
$search_result[$i]['category_id'] = gcms::getVars($item, 'category_id', 0);
$search_result[$i]['topic'] = $item['topic'];
$search_result[$i]['alias'] = $item['alias'];
$search_result[$i]['index'] = $item['index'];
if ($item['description'] == '') {
$search_result[$i]['detail'] = gcms::cutstring(gcms::html2txt($item['detail']), 149);
} else {
$search_result[$i]['detail'] = $item['description'];
}
$search_result[$i]['module'] = $item['module'];
$search_result[$i]['owner'] = $item['owner'];
$search_result[$i]['value'] = $v * ($item['level'] + $item['index']);
}
if (sizeof($search_result) > 0) {
// เรียงลำดับผลลัพท์ตาม score
gcms::sortby($search_result, 'value', false);
// จัดรูปแบบข้อความ
$searchitem = gcms::loadtemplate('search', 'search', 'searchitem');
$match = array('/{URL}/', '/{TOPIC}/', '/{DETAIL}/', '/{LINK}/');
foreach ($search_result as $item) {
unset($data);
示例4: elseif
<?php
// modules/gallery/feed.php
if (isset($modules)) {
// ค่าที่ีส่งมา
$aid = gcms::getVars($_GET, 'album', 0);
// query
$sql = "SELECT C.`id`,C.`topic`,C.`detail`,C.`last_update`,G.`image` FROM `" . DB_GALLERY . "` AS G";
$sql .= " INNER JOIN `" . DB_GALLERY_ALBUM . "` AS C ON C.`module_id`='{$modules['id']}' AND C.`id`=G.`album_id`";
$sql .= " WHERE G.`module_id`='{$modules['id']}'";
if ($aid == -1) {
$sql .= " AND G.`count`='0'";
} elseif ($aid > 0) {
$sql .= " AND G.`album_id`={$aid}";
}
$sql .= ' ORDER BY ' . (isset($_GET['rnd']) ? 'RAND()' : 'G.`id` DESC');
$sql .= " LIMIT {$count}";
foreach ($db->customQuery($sql) as $item) {
$link = gcms::getURL($modules['module'], '', 0, 0, "id={$item['id']}");
echo '<item>';
echo '<title>' . $item['topic'] . '</title>';
echo '<link>' . $link . '</link>';
echo '<description><![CDATA[' . gcms::cutstring(gcms::html2txt($item['detail']), 50) . ']]></description>';
echo '<enclosure url="' . urldecode(DATA_URL . "gallery/{$item['id']}/thumb_{$item['image']}") . '" type="image/jpeg"></enclosure>';
echo '<guid isPermaLink="true">' . $link . '</guid>';
echo '<pubDate>' . date("D, d M Y H:M", $item['last_update']) . ':00 +0700</pubDate>';
echo '</item>';
}
}