本文整理汇总了PHP中gcms::ser2Str方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::ser2Str方法的具体用法?PHP gcms::ser2Str怎么用?PHP gcms::ser2Str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::ser2Str方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
$a[] = '<a href="{URLQUERY?module=download-config}">{LNG_DOWNLOAD}</a>';
$a[] = '{LNG_CATEGORY}';
// แสดงผล
$content[] = '<div class=breadcrumbs><ul><li>' . implode('</li><li>', $a) . '</li></ul></div>';
$content[] = '<section>';
$content[] = '<header><h1 class=icon-category>' . $title . '</h1></header>';
// หมวดหมู่
$content[] = '<div class=subtitle>{LNG_DOWNLOAD_CATEGORY_DETAIL}</div>';
$content[] = '<dl id=config_category class=editinplace_list>';
$sql = "SELECT `id`,`category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['id']}' ORDER BY `category_id`";
foreach ($db->customQuery($sql) as $item) {
$id = $item['id'];
$row = '<dd id=config_category_' . $id . '>';
$row .= '<span class=no>[' . $item['category_id'] . ']</span>';
$row .= '<span class=icon-delete id=config_category_delete_' . $id . ' title="{LNG_DELETE} {LNG_CATEGORY}"></span>';
$row .= '{LNG_CATEGORY} <span id=config_category_name_' . $id . ' title="{LNG_CLICK_TO} {LNG_EDIT}">' . htmlspecialchars(gcms::ser2Str($item, 'topic')) . '</span>';
$row .= '</dd>';
$content[] = $row;
}
$content[] = '</dl>';
// submit
$content[] = '<div class=submit>';
$content[] = '<a id=config_category_add class="button large add"><span class=icon-plus>{LNG_ADD_NEW} {LNG_CATEGORY}</span></a>';
$content[] = '</div>';
$content[] = '</section>';
$content[] = '<script>';
$content[] = '$G(window).Ready(function(){';
$content[] = "inintModuleCategory('config_category', '{$index['id']}', 'download');";
$content[] = '});';
$content[] = '</script>';
// หน้านี้
示例2: array
// breadcrumb ของ โมดูล
$m = $install_modules[$index['module']]['menu_text'];
$breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL($index['module']), $install_modules[$index['module']]['menu_tooltip'], $m == '' ? $index['module'] : $m, $breadcrumb);
// หมวด
$categories = array();
$categories[0] = '<option value=0>{LNG_NO_CATEGORY}</option>';
$sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['module_id']}' ORDER BY `category_id`";
$list = $cache->get($sql);
if (!$list) {
$list = $db->customQuery($sql);
$cache->save($sql, $list);
}
foreach ($list as $item) {
if ($isAdmin || $cat == $item['category_id']) {
$sel = $cat == $item['category_id'] ? ' selected' : '';
$categories[$item['category_id']] = "<option value={$item['category_id']}{$sel}>" . gcms::ser2Str($item, 'topic') . "</option>";
}
}
if (sizeof($categories) > 1) {
unset($categories[0]);
}
// antispam
$register_antispamchar = gcms::rndname(32);
$_SESSION[$register_antispamchar] = gcms::rndname(4);
// แสดงผล
$patt = array('/{BREADCRUMS}/', '/<MEMBER>(.*)<\\/MEMBER>/s', '/<UPLOAD>(.*)<\\/UPLOAD>/s', '/{CATEGORIES}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{LOGIN_PASSWORD}/', '/{LOGIN_EMAIL}/', '/{ANTISPAM}/', '/{ANTISPAMVAL}/', '/{SIZE}/', '/{TYPE}/', '/{MODULEID}/');
$replace = array();
$replace[] = implode("\n", $breadcrumbs);
$replace[] = $isMember ? '' : '$1';
$replace[] = $index['img_upload_type'] == '' ? '' : '$1';
$replace[] = implode("\n", $categories);
示例3: foreach
$content[] = '<div class=comment id=result_download_name>{LNG_DOWNLOAD_NAME_COMMENT}</div>';
$content[] = '</div>';
// download_description
$content[] = '<div class=item>';
$content[] = '<label for=download_description>{LNG_DESCRIPTION}</label>';
$content[] = '<span class="g-input icon-file"><input type=text id=download_description name=download_description title="{LNG_DOWNLOAD_DESCRIPTION_COMMENT}" value="' . $index['detail'] . '"></span>';
$content[] = '<div class=comment id=result_download_description>{LNG_DOWNLOAD_DESCRIPTION_COMMENT}</div>';
$content[] = '</div>';
// category
$sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['module_id']}' ORDER BY `category_id`";
$content[] = '<div class=item>';
$content[] = '<label for=download_category>{LNG_CATEGORY}</label>';
$content[] = '<span class="g-input icon-category"><select name=download_category id=download_category title="{LNG_CATEGORY_SELECT}">';
foreach ($db->customQuery($sql) as $item) {
$sel = $item['category_id'] == $index['category_id'] ? ' selected' : '';
$content[] = '<option value=' . $item['category_id'] . $sel . '>' . gcms::ser2Str($item, 'topic') . '</option>';
}
$content[] = '</select></span>';
$content[] = '<div class=comment id=result_download_category>{LNG_CATEGORY_SELECT}</div>';
$content[] = '</div>';
// download_file
$content[] = '<div class=item>';
$content[] = '<label for=download_file>{LNG_DOWNLOAD_FILE}</label>';
$content[] = '<span class="g-input icon-world"><input type=text id=download_file name=download_file title="{LNG_DOWNLOAD_FILE_COMMENT}" value="' . $index['file'] . '"></span>';
$content[] = '<div class=comment id=result_download_file>{LNG_DOWNLOAD_FILE_COMMENT}</div>';
$content[] = '</div>';
// download_upload
$content[] = '<div class=item>';
$t = str_replace(array('{TYPE}', '{SIZE}'), array(str_replace(',', ', ', $config['download_file_typies']), gcms::formatFileSize($config['download_upload_size'])), $lng['LNG_DOWNLOAD_FILE_BROWSER_COMMENT']);
$content[] = '<label for=download_upload>{LNG_BROWSE_FILE}</label>';
$content[] = '<span class="g-input icon-upload"><input type=file class=g-file id=download_upload name=download_upload title="' . $t . '" placeholder="' . $index['file'] . '"></span>';
示例4: round
$totalpage = round($count[0]['count'] / $list_per_page);
$totalpage += $totalpage * $list_per_page < $count[0]['count'] ? 1 : 0;
$page = max(1, $page > $totalpage ? $totalpage : $page);
$start = $list_per_page * ($page - 1);
// คำนวณรายการที่แสดง
$s = $start < 0 ? 0 : $start + 1;
$e = min($count[0]['count'], $s + $list_per_page - 1);
$patt2 = array('/{SEARCH}/', '/{COUNT}/', '/{PAGE}/', '/{TOTALPAGE}/', '/{START}/', '/{END}/');
$replace2 = array($search, $count[0]['count'], $page, $totalpage, $s, $e);
// save cookie
setCookie('document_listperpage', $list_per_page, time() + 3600 * 24 * 365);
// หมวดหมู่
$categories = array();
$sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['id']}' ORDER BY `category_id`";
foreach ($db->customQuery($sql) as $item) {
$categories[$item['category_id']] = gcms::ser2Str($item, 'topic');
}
// title
$m = ucwords($index['module']);
$title = "{$lng['LNG_CREATE']}-{$lng['LNG_EDIT']} {$lng['LNG_CONTENTS']} {$m}";
$a = array();
$a[] = '<span class=icon-documents>{LNG_MODULES}</span>';
$a[] = '<a href="{URLQUERY?module=document-config&id=' . $index['id'] . '}">' . $m . '</a>';
if ($cat > 0) {
$a[] = $categories[$cat];
}
$a[] = '{LNG_CONTENTS}';
// แสดงผล
$content[] = '<div class=breadcrumbs><ul><li>' . implode('</li><li>', $a) . '</li></ul></div>';
$content[] = '<section>';
$content[] = '<header><h1 class=icon-list>' . $title . '</h1></header>';
示例5: foreach
$bg = 'bg2';
foreach ($datas as $i => $item) {
if ($i > 0 && $i % $match[2] == 0) {
$widget[] = '</div><div class="row ' . $styles . 'view">';
}
$bg = $bg == 'bg1' ? 'bg2' : 'bg1';
$replace = array();
$replace[] = "{$bg} background" . rand(0, 5);
if ($config['module_url'] == '1') {
$replace[] = gcms::getURL($index['module'], $item['alias']);
} else {
$replace[] = gcms::getURL($index['module'], '', 0, $item['id']);
}
$replace[] = $item['topic'];
$replace[] = $item['description'];
$replace[] = gcms::ser2Str($item, 'category');
$replace[] = gcms::mktime2date($item['create_date'], 'd M Y');
$replace[] = $item['member_id'];
$replace[] = $item['displayname'] == '' ? $item['email'] : $item['displayname'];
$replace[] = $item['status'];
$replace[] = number_format($item['comments']);
$replace[] = number_format($item['visited']);
if ($item['picture'] != '' && is_file(DATA_PATH . "document/{$item['picture']}")) {
$replace[] = DATA_URL . "document/{$item['picture']}";
} else {
$replace[] = WEB_URL . "/{$index['default_icon']}";
}
if ($item['create_date'] > $valid_date && $item['comment_date'] == 0) {
$replace[] = 'new';
} elseif ($item['last_update'] > $valid_date || $item['comment_date'] > $valid_date) {
$replace[] = 'update';
示例6: isset
$title = $lng['LNG_DATA_NOT_FOUND'];
$content = '<div class=error>' . $title . '</div>';
} else {
$index = $index[0];
// ค่าที่ส่งมา
$id = isset($_REQUEST['cat']) ? (int) $_REQUEST['cat'] : 0;
// หมวดทั้งหมด
$categories = array();
$sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['module_id']}' ORDER BY `category_id`";
$saved = $cache->get($sql);
if (!$saved) {
$saved = $db->customQuery($sql);
$cache->save($sql, $saved);
}
foreach ($saved as $category) {
$categories[$category['category_id']] = gcms::ser2Str($category, 'topic');
}
// breadcrumbs
$breadcrumb = gcms::loadtemplate($index['module'], '', 'breadcrumb');
$breadcrumbs = array();
// หน้าหลัก
$breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
// โมดูล
if (isset($install_modules[$index['module']]['menu_text'])) {
$m = $install_modules[$index['module']]['menu_text'];
$t = $install_modules[$index['module']]['menu_tooltip'];
} else {
$m = ucwords($index['module']);
$t = $m;
}
$canonical = gcms::getURL($index['module']);
示例7: array
}
$canonical = gcms::getURL($index['module']);
$breadcrumbs['MODULE'] = gcms::breadcrumb('', $canonical, $t, $m, $breadcrumb);
}
// อ่าน config
gcms::r2config($index['config'], $index);
}
}
if (!$index) {
$title = $lng['LNG_DOCUMENT_NOT_FOUND'];
$content = '<div class=error>' . $title . '</div>';
} else {
if ($cat_count == 1) {
$index['topic'] = gcms::ser2Str($index, 'topic');
$index['description'] = gcms::ser2Str($index, 'description');
$index['icon'] = gcms::ser2Str($index, 'icon');
}
// category
if ($cat_count == 1 && $index['topic'] != '') {
$breadcrumbs['CATEGORY'] = gcms::breadcrumb('', gcms::getURL($index['module'], '', (int) $index['category_id']), $index['description'], $index['topic'], $breadcrumb);
}
$splitpage = '';
$list = array();
if ($cat_count > 0 || $index['categories'] == 0 || $index['category_display'] == 0) {
// เลือกหมวดมา หรือไม่มีหมวด หรือปิดการแสดงผลหมวดหมู่ แสดงรายการเรื่อง
include ROOT_PATH . 'modules/document/stories.php';
$template = 'list';
} else {
// ลิสต์รายชื่อหมวด
include ROOT_PATH . 'modules/document/categories.php';
$template = 'category';
示例8: IN
$sql .= " WHERE I.`module_id`={$index['module_id']} AND I.`language` IN ('" . LANGUAGE . "','') LIMIT 1";
$mo = $cache->get($sql);
if (!$mo) {
$mo = $db->customQuery($sql);
$cache->save($sql, $mo);
}
$m = $mo[0]['topic'];
$t = $mo[0]['topic'];
}
$canonical = gcms::getURL($index['module']);
$breadcrumbs['MODULE'] = gcms::breadcrumb('', $canonical, $t, $m, $breadcrumb);
}
// category
$category = gcms::ser2Str($index, 'category');
if (!empty($category)) {
$breadcrumbs['CATEGORY'] = gcms::breadcrumb('', gcms::getURL($index['module'], '', $index['category_id']), gcms::ser2Str($index, 'cat_tooltip'), $category, $breadcrumb);
}
// ความคิดเห็น
$comments = array();
if ($canReply) {
$patt = array('/(edit-{QID}-{RID}-{NO}-{MODULE})/', '/(delete-{QID}-{RID}-{NO}-{MODULE})/', '/{DETAIL}/', '/{UID}/', '/{DISPLAYNAME}/', '/{STATUS}/', '/{DATE}/', '/{DATEISO}/', '/{IP}/', '/{NO}/', '/{RID}/');
$skin = gcms::loadtemplate($index['module'], 'document', 'commentitem');
// query
$sql = "SELECT C.*,U.`status`";
$sql .= ",(CASE WHEN ISNULL(U.`id`) THEN C.`email` WHEN U.`displayname`='' THEN U.`email` ELSE U.`displayname` END) AS `displayname`";
$sql .= " FROM `" . DB_COMMENT . "` AS C";
$sql .= " LEFT JOIN `" . DB_USER . "` AS U ON U.`id`=C.`member_id`";
$sql .= " WHERE C.`index_id`='{$index['id']}' AND C.`module_id`='{$index['module_id']}'";
$sql .= " ORDER BY C.`id` ASC";
if (isset($_REQUEST['visited'])) {
$datas = $db->customQuery($sql);
示例9: foreach
<?php
// widgets/categories/index.php
if (defined('MAIN_INIT') && preg_match('/^[a-z]{4,}$/', $module) && isset($install_modules[$module])) {
$index = $install_modules[$module];
$sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['module_id']}' ORDER BY `category_id` DESC";
$datas = $cache->get($sql);
if (!$datas) {
$datas = $db->customQuery($sql);
$cache->save($sql, $datas);
}
foreach ($datas as $item) {
$widget[] = '<li><a href="' . gcms::getURL($index['module'], '', $item['category_id']) . '">' . gcms::ser2Str($item, 'topic') . '</a></li>';
}
if (sizeof($widget) > 0) {
$widget = '<ul>' . implode("\n", $widget) . '</ul>';
}
}
示例10: array
// modules/document/categories.php
if (defined('MAIN_INIT') && is_array($index)) {
// list รายการหมวดหมู่
$listitem = gcms::loadtemplate($index['module'], 'document', 'categoryitem');
$patt = array('/{THUMB}/', '/{URL}/', '/{TOPIC}/', '/{COUNT}/', '/{COMMENTS}/', '/{DETAIL}/');
$sql = "SELECT * FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['id']}' AND `published`='1' ORDER BY `category_id` DESC";
$datas = $cache->get($sql);
if (!$datas) {
$datas = $db->customQuery($sql);
$cache->save($sql, $datas);
}
foreach ($datas as $item) {
$replace = array();
$icon = gcms::ser2Str($item, 'icon');
if ($icon != '' && is_file(DATA_PATH . "document/{$icon}")) {
$replace[] = DATA_URL . "document/{$icon}";
} else {
$replace[] = WEB_URL . "/{$index['default_icon']}";
}
$replace[] = gcms::getURL($index['module'], '', $item['category_id']);
$replace[] = gcms::ser2Str($item, 'topic');
$replace[] = $item['c1'];
$replace[] = $item['c2'];
$replace[] = gcms::ser2Str($item, 'detail');
$list[] = preg_replace($patt, $replace, $listitem);
}
// canonical
if ($index['module'] != $module_list[0]) {
$canonical = gcms::getURL($index['module']);
}
}
示例11: array
$breadcrumbs = array();
// หน้าหลัก
$breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
// โมดูล
if (isset($install_modules[$index['module']]['menu_text'])) {
$m = $install_modules[$index['module']]['menu_text'];
$t = $install_modules[$index['module']]['menu_tooltip'];
} else {
$m = ucwords($index['module']);
$t = $m;
}
$canonical = gcms::getURL($index['module']);
$breadcrumbs['MODULE'] = gcms::breadcrumb('', $canonical, $t, $m, $breadcrumb);
// อัลบัม
$canonical = gcms::getURL($index['module'], '', 0, 0, "id={$index['category_id']}");
$index['category'] = gcms::ser2Str($index, 'category');
$breadcrumbs['CATEGORY'] = gcms::breadcrumb('', $canonical, $index['category'], $index['category'], $breadcrumb);
// แสดงผล list รายการ
$patt = array('/{BREADCRUMS}/', '/{NAME}/', '/{POSITION}/', '/{CATEGORY}/', '/{DETAIL}/', '/{ADDRESS}/', '/{PHONE}/', '/{EMAIL}/', '/{PICTURE}/');
$replace = array();
$replace[] = implode("\n", $breadcrumbs);
$replace[] = $index['name'];
$replace[] = $index['position'];
$replace[] = $index['category'];
$replace[] = $index['detail'];
$replace[] = $index['address'];
$replace[] = $index['phone'];
$replace[] = $index['email'];
$replace[] = $index['picture'] != '' && is_file(DATA_PATH . "personnel/{$index['picture']}") ? DATA_URL . "personnel/{$index['picture']}" : WEB_URL . '/modules/personnel/img/noicon.jpg';
$content = preg_replace($patt, $replace, gcms::loadtemplate($index['module'], 'personnel', 'view'));
// ตัวแปรหลังจากแสดงผลแล้ว