本文整理汇总了PHP中gcms::oneLine方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::oneLine方法的具体用法?PHP gcms::oneLine怎么用?PHP gcms::oneLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::oneLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rawurlencode
// new row
$row = '<dd id="config_category_' . $id . '">';
$row .= '<span class="no">[' . $save['category_id'] . ']</span>';
$row .= '<span class="icon-delete" id="config_category_delete_' . $id . '" title="' . $lng['LNG_DELETE'] . ' ' . $text . '"> </span>';
$row .= $text . ' <span id="config_category_name_' . $id . '" title="' . $lng['LNG_CLICK_TO'] . ' ' . $lng['LNG_EDIT'] . '">' . $topic[LANGUAGE] . '</span>';
$row .= '</dd>';
$ret['data'] = rawurlencode($row);
$ret['newId'] = "config_category_" . $id;
} elseif (preg_match('/^config_(category)_delete_([0-9]+)$/', $action, $match)) {
// ลบหมวดหมู่
$db->query("DELETE FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$module_id}' AND `id`='{$match['2']}' LIMIT 1");
// รายการที่ลบ
$ret['del'] = "config_{$match['1']}_" . $match[2];
} elseif (preg_match('/^config_(category)_name_([0-9]+)$/', $action, $match)) {
// แก้ไขชื่อหมวดหมู่
$topic[LANGUAGE] = $db->sql_trim_str(gcms::oneLine($_POST['value']));
$sql = "SELECT `id` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$module_id}' AND `id`='{$match['2']}' LIMIT 1";
$category = $db->customQuery($sql);
if (sizeof($category) == 1) {
$db->edit(DB_CATEGORY, $category[0]['id'], array('topic' => gcms::array2Ser($topic)));
// ส่งข้อมูลใหม่ไปแสดงผล
$ret['edit'] = rawurlencode($topic[LANGUAGE]);
$ret['editId'] = $action;
}
}
}
} else {
$ret['error'] = 'ACTION_ERROR';
}
// คืนค่าเป็น JSON
echo gcms::array2json($ret);
示例2: array
// referer, member
if (gcms::isReferer() && gcms::isMember()) {
if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
$ret['error'] = 'EX_MODE_ERROR';
} else {
$save = array();
$error = false;
$input = false;
$topic = array();
$detail = array();
foreach ($_POST['category_topic'] as $k => $v) {
$v = $db->sql_trim_str(gcms::oneLine($v));
if ($v != '') {
$topic[$k] = $v;
}
$v = $db->sql_trim_str(gcms::oneLine($_POST['category_detail'][$k]));
if ($v != '') {
$detail[$k] = $v;
}
}
// ค่าที่ส่งมา
$id = gcms::getVars($_POST, 'write_id', 0);
$category_id = gcms::getVars($_POST, 'category_id', 0);
$module_id = gcms::getVars($_POST, 'module_id', 0);
if ($id > 0) {
// แก้ไข, ตรวจสอบหมวดที่เลือก
$sql = "SELECT C.`id`,C.`module_id`,C.`icon`,CONCAT(M.`config` ,'\n' ,C.`config`) AS `config`";
$sql .= ",(SELECT `id` FROM `" . DB_CATEGORY . "` WHERE `category_id`={$category_id} AND `module_id`={$module_id}) AS `cid`";
$sql .= " FROM `" . DB_CATEGORY . "` AS C";
$sql .= " INNER JOIN `" . DB_MODULES . "` AS M ON M.`id`={$module_id} AND M.`owner`='board'";
$sql .= " WHERE C.`id`={$id} AND C.`module_id`={$module_id} LIMIT 1";