本文整理汇总了PHP中cleanurl函数的典型用法代码示例。如果您正苦于以下问题:PHP cleanurl函数的具体用法?PHP cleanurl怎么用?PHP cleanurl使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cleanurl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_category
function update_category()
{
$conn = connDB();
$category_name = $_POST['category_name'];
$category_description = $_POST['category_description'];
$visibility_status = $_POST['visibility_status'];
$category_parent = $_POST['category_parent'];
$category_id = $_POST['hidden_category_id'];
// CUSTOM
$rgb_code = $_POST['rgb_code'];
$code = $_POST['code'];
$existing_image = $_POST['hidden_image'];
if (!empty($_FILES['upload_tag_1']['name'])) {
// ADD FOR ANTICIPATED CROWDED IMAGE NAME @ 4 November 2013
$file_name = substr($_FILES['upload_tag_1']['name'], 0, -4);
$file_type = substr($_FILES['upload_tag_1']['name'], -4);
$uploads_dir = '../files/uploads/tagging_image/';
//$userfile_name = str_replace(array('(',')',' '),'_',$_FILES['upload_tag_1']['name']);
$userfile_name = cleanurl($file_name) . $file_type;
$userfile_tmp = $_FILES['upload_tag_1']['tmp_name'];
$prefix = 'tag_image-';
$prod_img = $uploads_dir . $prefix . $userfile_name;
move_uploaded_file($userfile_tmp, $prod_img);
$slider_image = $prefix . $userfile_name;
$filename = "files/uploads/tagging_image/" . $slider_image;
} else {
if ($_POST['hidden_image_flag'] == 'deleted') {
unlink('../' . $existing_image);
$filename = '';
} else {
$filename = $existing_image;
}
}
//if(empty($category_id)){
//category level
if ($category_parent == 'top') {
$category_level = '0';
} else {
$get_level = mysql_query("SELECT * from tbl_tags WHERE category_id = '{$category_parent}'", $conn);
if (mysql_num_rows($get_level) != null) {
$get_level_array = mysql_fetch_array($get_level);
$category_level = $get_level_array["category_level"] * 1 + 1;
}
}
$get_order = mysql_query("SELECT * from tbl_tags ORDER BY category_order DESC", $conn);
if (mysql_num_rows($get_order) != null) {
$get_order_array = mysql_fetch_array($get_order);
$category_order = $get_order_array["category_order"] * 1 + 1;
}
mysql_query(" UPDATE tbl_tags SET category_name = '{$category_name}',\n category_level = '{$category_level}',\n\t\t\t\t\t\t\t\t\t category_visibility_status = '{$visibility_status}',\n\t\t\t\t\t\t\t\t\t category_description='{$category_description}', \n\t\t\t\t\t\t\t\t\t rgb_code = '{$rgb_code}', \n\t\t\t\t\t\t\t\t\t image = '{$filename}', \n\t\t\t\t\t\t\t\t\t code = '{$code}'\n WHERE category_id = '{$category_id}'\n\t\t\t ", $conn) or die(mysql_error());
update_category_relation($category_id, $category_parent);
}
示例2: getAdminToken
function getAdminToken($type, $token, $tokentime)
{
$sql = "SELECT COUNT(*) AS rows FROM `tbl_token` WHERE `type` = '{$type}'";
$result = $this->fetchData('single', $sql);
if ($result->rows > 0) {
$sql = "SELECT `token`, `description`, `created_date`, `parameter` FROM `tbl_token` WHERE `token` = '{$token}'";
$result = $this->fetchData('single', $sql);
$temp_token = $this->verify($result->description . cleanurl($result->created_date . $result->parameter), $token);
if ($temp_token) {
$result = $result;
} else {
$result = 0;
}
} else {
$result = 0;
}
return $result;
}
示例3: update_category
function update_category($name, $description, $visibility, $parent, $category_id)
{
if ($parent == 'top') {
$category_level = '0';
} else {
$sql = "SELECT * from tbl_category WHERE category_id = '{$parent}'";
$query = $this->conn->query($sql);
if ($query->num_rows != null) {
$get_level_array = $query->fetch_object();
$category_level = $get_level_array->category_level * 1 + 1;
}
}
$sql = "SELECT * FROM tbl_category ORDER BY category_order DESC";
$query = $this->conn->query($sql);
if ($query->num_rows != null) {
$get_order_array = $query->fetch_object();
$category_order = $get_order_array->category_order * 1 + 1;
}
$get_alias = $this->get_alias($parent);
if ($parent == 'top') {
$alias = cleanurl($name);
} else {
$alias = $get_alias->category_alias . '-' . cleanurl($name);
}
$count_alias = $this->count_alias($alias, $category_id);
if ($count_alias->rows > 0) {
$type = 'danger';
$msg = $name . ' has already existed';
safe_redirect('detail-category/' . $category_id . '/' . $name);
} else {
$alias = $alias;
}
$sql = "UPDATE tbl_category SET category_name = ?,\n\t \t\t\t\t\t\t\t\t\t category_alias = ?,\n category_level = ?,\n\t\t\t\t\t\t\t\t\t\t category_visibility_status = ?,\n\t\t\t\t\t\t\t\t\t\t category_description = ? \n WHERE category_id = ?\n\t\t\t ";
$stmt = $this->conn->prepare($sql);
if ($stmt === false) {
trigger_error('Database error: ' . $sql . ' Error: ' . $this->conn->errno . ' ' . $this->conn->error, E_USER_ERROR);
} else {
$stmt->bind_param("ssssss", $name, $alias, $category_level, $visibility, $description, $category_id);
$stmt->execute();
}
$stmt->close();
$this->update_category_relation($category_id, $parent);
}
示例4: filter_var
}
} else {
$image_delete = filter_var($_POST['delete_news_' . $i], FILTER_SANITIZE_NUMBER_INT);
if ($image_delete == 1) {
$image = '';
$_update->delete_news_img($news_id, $i);
if (is_file('../' . $news_detail->news_image)) {
unlink('../' . $news_detail->news_image);
}
} else {
$oldImg = $_get->get_news_image($news_id, $i);
/*$image = $oldImg->image;*/
}
}
}
$image_null = '';
if ($_req_lang === 'ID') {
$_update->updateNewsLangField($news_detail->news_category, $image_null, $date, $visibility, $news_id);
$_update->updateNews($category, $title, $alias, $date, $image_null, $excerpt, $content, $description, $keywords, $visibility, $news_id);
} else {
if ($_req_lang === 'EN') {
$_update->updateNewsLang($title, $alias, $excerpt, $content, $description, $keywords, $news_id);
}
}
$page = 'news-detail/' . $_req_lang . '/' . $news_detail->news_id . '/' . cleanurl(preg_replace("/[^A-Za-z0-9]/", ' ', $alias));
$type = 'success';
$msg = 'Changes successfully saved';
set_alert($type, $msg);
safe_redirect($page);
}
}
示例5: foreach
<div class="form-group col-xs-6 hidden" id="id-label-type">
<label><?php
echo $var_bag_lbl_variant;
?>
</label>
<select class="form-control" id="id_option_type">
<?php
foreach ($types as $types) {
echo '<option ';
if ($types->type_alias == $_REQUEST['prod_type']) {
echo 'selected = "selected"';
} else {
echo '';
}
echo ' value="' . BASE_URL . 'item/' . cleanurl($types->category_name) . '/' . $types->product_alias . '/' . $types->type_alias . '">' . $types->type_name . '</option> \\n';
}
?>
</select>
</div>
<div class="form-group col-xs-4 hidden">
<label>Size</label>
<select class="form-control" id="id_option_stock">
<?php
$total_stock = count($stock);
foreach ($stock as $stock) {
/* --- DEFAULT STOCK NON SOLD OUT --- */
$default_stock = $_shop_detail_get->get_default_size($product->type_id, 0, 1);
echo '<option value="' . $stock->stock_id . '" md_name="' . $stock->stock_name . '" ';
示例6: LOCATION_GET
*/
$_get = new LOCATION_GET();
$_update = new LOCATION_UPDATE();
//$full_order = $_get->count_listing_news_category($search_query, $sort_by, $query_per_page);
//$total_query = $full_order['total_query'];
//$total_page = $full_order['total_page'];
//$all_news = $_get->get_listing_news_category($search_query, $sort_by, $first_record, $query_per_page);
/* --- BUTTON HANDLER --- */
if (isset($_POST['btn-insert-new-category']) && $_POST['btn-insert-new-category'] == 'Save Changes') {
$name = filter_var($_POST['name'], FILTER_SANITIZE_STRING);
$description = filter_var($_POST['description'], FILTER_SANITIZE_STRING);
$active = filter_var($_POST['active'], FILTER_SANITIZE_STRING);
$visibility = filter_var($_POST['visibility']);
$meta_description = filter_var($_POST['meta_description'], FILTER_SANITIZE_STRING);
$meta_keyword = filter_var($_POST['meta_keyword'], FILTER_SANITIZE_STRING);
$alias = cleanurl($name);
$temp_order = $_get->get_max_category_order();
$order = $temp_order->max_order + 1;
$count_alias = $_get->count_category($_POST['name']);
if ($count_alias->rows > 0) {
$page = 'self';
$type = 'danger';
$msg = $name . ' has already existed';
set_alert($type, $msg);
safe_redirect($page);
} else {
$alias = $alias;
}
$_update->insert($name, $alias, $description, $active, $visibility, $meta_description, $meta_keyword, $order);
$page = 'self';
$type = 'success';
示例7: cleanurl
')">
<td>
<input type="checkbox" name="color_id[]" value="<?php
echo $all_color->gender_id;
?>
" id="<?php
echo "check_" . $row;
?>
" onmouseover="downCheck()" onmouseout="upCheck()" onclick="selectRowCheck('<?php
echo $row;
?>
')">
</td>
<td>
<a href="<?php
echo BASE_URL . 'detail-gender/' . $all_color->gender_id . '/' . cleanurl($all_color->gender_name);
?>
">
<?php
echo $all_color->gender_name;
?>
</a>
</td>
<td class="tr">
<!--<a href="<?php
echo BASE_URL . "product-view/1/top/25/product_name/collection_id-" . $all_color->gender_id;
?>
" target="_new">-->
<?php
echo $total_product->total_products;
?>
示例8: set_alert
$type = 'error';
$msg = 'Error: ' . $error;
set_alert($type, $msg);
safe_redirect('self');
}
} else {
//$color_id = $this->color_id[$i];
$category_image = $_POST["color_image_" . $i];
}
$_update->update_category($name, $category_image, $visibility, $parent, $category_id);
//HILLPAK
//ACTIVATE NOT HILLPAK $_update->update_category($name, $description, $visibility, $parent, $category_id);
//if($detail_category->category_level > 0){
$count_child = $_get->count_childs($category_id);
if ($count_child->rows > 0) {
$temp_child = $_get->get_childs($detail_category->category_id);
foreach ($temp_child as $temp_child) {
$child_category_alias = cleanurl($name) . '-' . cleanurl($temp_child->category_name);
$child_category_id = $temp_child->category_id;
$_update->update_child($child_category_alias, $child_category_id);
}
}
// }
$page = 'self';
$type = 'success';
$msg = 'Changes successfully saved';
set_alert($type, $msg);
safe_redirect($page);
}
}
}
示例9: Exception
throw new Exception("Wrong secured token");
}
if (empty($_POST['subject'])) {
throw new Exception("Missing subject name");
}
if (empty($_POST['content'])) {
throw new Exception("Missing topic content");
}
$t = new DB("forum_topics");
$t->setColPrefix("topic_");
$t->userid = USER_ID;
$t->subject = $_POST['subject'];
$t->forum = $forum_id;
$t->insert();
$topic_id = $t->getId();
$topic_name = cleanurl($_POST['subject']);
$p = new DB("forum_posts");
$p->setColPrefix("post_");
$p->topic = $topic_id;
$p->user = USER_ID;
$p->content = $_POST['content'];
$p->added = time();
$p->insert();
$post_id = $p->getId();
header("location: " . page("forums", "view-topic", "{$topic_name}-" . $topic_id, "", "", "page=p{$post_id}#post{$post_id}"));
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
}
echo "<h4>" . _t("Create topic in") . " " . $db->name . "</h4>";
?>
示例10: get_prod_alias
}
function get_prod_alias($id)
{
$sql = "SELECT * FROM `tbl_product` WHERE `id` = '{$id}'";
$query = $this->conn->query($sql);
$result = $query->fetch_object();
return $result;
}
}
$_custom = new CUSTOM_PRODUCT();
echo '<input type="hidden" id="custom_product_alias" value="' . $data['product_id'] . '">';
/* --- COLLECTION --- */
include 'custom/products/details/_collection/index.php';
/* --- GENDER --- */
include 'custom/products/details/_gender/index.php';
/* --- REDIRECT --- */
if (isset($_POST['btn-product-detail'])) {
$alias = cleanurl($_POST['product_name']);
//$check_product_name = $_custom->check_product_name($alias, $data['product_id']);
$check_product_name = $_custom->get_prod_alias($data['product_id']);
/*
if($check_product_name->rows > 0){
$product_alias = $alias.'-'.$check_product_name->rows;
}else{
$product_alias = $alias;
}
*/
$product_alias = $check_product_name->product_alias;
$page = 'product-details-' . $product_alias;
safe_redirect($page);
}
示例11: foreach
$count_promo_banner = $_get->count_promos();
$max_id_promo = $_get->promo_get_maxid();
$item = 12;
$promo_banner = $_get->get_promos($item);
$promo_row = 1;
/* --- BUTTON HANDLER --- */
if (isset($_POST['btn-pages-home']) && $_POST['btn-pages-home'] == "Save Changes") {
$promo_banner_id = $_POST['promo_id'];
$promo_order = $_POST['promo_order'];
foreach ($promo_banner_id as $promo_key => $promo_banner_id) {
if ($_FILES['upload_promo_' . $promo_banner_id]['name'] != '') {
$promo_banner_id = filter_var($promo_banner_id, FILTER_SANITIZE_NUMBER_INT);
$promo_banner_name = substr($_FILES['upload_promo_' . $promo_banner_id]['name'], 0, -4);
$promo_banner_type = substr($_FILES['upload_promo_' . $promo_banner_id]['name'], -4);
$promo_uploads_dir = '../files/uploads/promo/';
$promo_userfile_name = cleanurl(str_replace(array('(', ')', ' '), '_', $promo_banner_name)) . $promo_banner_type;
$promo_userfile_tmp = $_FILES['upload_promo_' . $promo_banner_id]['tmp_name'];
$promo_prefix = 'promo-' . $promo_banner_id . "-";
$promo_prod_img = $promo_uploads_dir . $promo_prefix . $promo_userfile_name;
move_uploaded_file($promo_userfile_tmp, $promo_prod_img);
$promo_image = $promo_prefix . $promo_userfile_name;
$promo_filename = 'files/uploads/promo/' . $promo_prefix . $promo_userfile_name;
$promo_dml = $_get->check_promos($promo_banner_id);
$promo_link = addslashes($_POST['promo_link_' . $promo_banner_id]);
if ($promo_dml->rows > 0) {
$_update->update_promo($promo_filename, $promo_link, $promo_order, ' ', $promo_banner_id);
} else {
if ($count_promo_banner->rows > 0) {
$temp_order = $_get->promo_get_max_order(0);
$row_order = array();
foreach ($temp_order as $temp_order) {
示例12: upload_file
$alias = $alias;
}
/* --- IMAGE --- */
if ($_FILES['upload_news_1']['name'] != '') {
$image = upload_file($_global_general->url, 'images', $_FILES['upload_news_1'], 'news', 'files/uploads/news-image/', $ini_max_upload);
} else {
$image_delete = filter_var($_POST['delete_news'], FILTER_SANITIZE_NUMBER_INT);
if ($image_delete == 1) {
$image = '';
if (is_file('../' . $news_detail->news_image)) {
unlink('../' . $news_detail->news_image);
}
} else {
$image = $news_detail->news_image;
}
}
if ($_req_lang === 'ID') {
//$_update->updateNewsLangField($news_detail->news_category, $image, $date, $visibility, $news_id);
$_update->updateNews($category, $title, $title_second, $alias, $date, $image, $excerpt, $content, $description, $keywords, $visibility, $news_id);
} else {
if ($_req_lang === 'EN') {
$_update->updateNewsLang($title, $alias, $excerpt, $content, $description, $keywords, $news_id);
}
}
$page = 'service-detail/' . $_req_lang . '/' . $news_detail->news_id . '/' . cleanurl(preg_replace("/[^A-Za-z0-9]/", ' ', $title));
$type = 'success';
$msg = 'Changes successfully saved';
set_alert($type, $msg);
safe_redirect($page);
}
}
示例13: cleanurl
<option <?php
if (strpos(ACT, 'categories')) {
echo 'selected="selected"';
}
?>
value="category">Grouped by Categories</option>
</select>
<div class="btn-placeholder" style="margin-bottom:10px;">
<?php
if ($date_start != '0000-00-00 00:00:00') {
echo '<a href="' . BASE_URL . 'reporting/sales-by-category">';
echo '<input type="button" class="btn btn-danger btn-sm m_r_10" value="Reset">';
echo '</a>';
}
if (is_file('custom/reports/exports/' . '[' . $_global_general->website_title . ']-' . cleanurl($date_title . ' Sales By Items (Orders)') . '.xlsx')) {
echo '<a class="hidden" target="_blank" href="' . BASE_URL . 'custom/reports/exports/' . '[' . $_global_general->website_title . ']-' . cleanurl($date_title . ' Sales By Items (Orders)') . '.xlsx">';
echo '<input type="button" class="btn btn-success btn-sm" value="Download Report">';
echo '</a>';
} else {
echo '<a class="hidden" href="http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '">';
echo '<input type="button" class="btn btn-warning btn-sm" value="Refresh">';
echo '</a>';
}
?>
</div>
</div>
</div>
<div class="container main">
<div class="box row">
<div class="desc col-xs-3">
示例14: ini_set
ini_set('session.gc_maxlifetime', 172800);
// 48 hours
// Session cookie life time
ini_set('session.cookie_lifetime', 172800);
// 48 hours
// Prevent document expiry when user hits Back in browser
session_cache_limiter('private, must-revalidate');
session_name(COOKIE_PREFIX . 'session');
session_start();
//ob_start("ob_gzhandler"); //Uncomment this line and comment the one below to enable output compression.
ob_start();
// Sanitise $_SERVER globals
$_SERVER['PHP_SELF'] = cleanurl($_SERVER['PHP_SELF']);
$_SERVER['QUERY_STRING'] = isset($_SERVER['QUERY_STRING']) ? cleanurl($_SERVER['QUERY_STRING']) : "";
$_SERVER['REQUEST_URI'] = isset($_SERVER['REQUEST_URI']) ? cleanurl($_SERVER['REQUEST_URI']) : "";
$PHP_SELF = cleanurl($_SERVER['PHP_SELF']);
// Redirects to the index if the URL is invalid (eg. file.php/folder/)
if ($_SERVER['SCRIPT_NAME'] != $_SERVER['PHP_SELF']) {
redirect($settings['siteurl']);
}
define("FUSION_QUERY", isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : "");
define("FUSION_SELF", basename($_SERVER['PHP_SELF']));
define("FUSION_REQUEST", isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] != "" ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);
// Variables initializing
$mysql_queries_count = 0;
$mysql_queries_time = array();
$locale = array();
// Calculate ROOT path for Permalinks
$current_path = $_SERVER['REQUEST_URI'];
if (isset($settings['site_path']) && strcmp($settings['site_path'], "/") != 0) {
$current_path = str_replace($settings['site_path'], "", $current_path);
示例15: date
/* --- CALL FUNCTION --- */
$category = $_get->add_news_category();
/* --- BUTTON HANDLER --- */
if (isset($_POST['btn-add-news']) && $_POST['btn-add-news'] == "Save Changes") {
$day = date('d');
$month = date('m');
$year = date('Y');
$hour = date('H');
$minute = date('i');
$second = date('s');
$category = filter_var($_POST['category'], FILTER_SANITIZE_STRING);
$title = filter_var($_POST['title'], FILTER_SANITIZE_STRING);
$title_second = filter_var($_POST['title_second'], FILTER_SANITIZE_STRING);
$content = $_POST['content'];
$excerpt = filter_var($_POST['excerpt'], FILTER_SANITIZE_STRING);
$alias = cleanurl($_POST['title']);
$description = filter_var($_POST['description'], FILTER_SANITIZE_STRING);
$keywords = filter_var($_POST['keywords'], FILTER_SANITIZE_STRING);
$visibility = filter_var($_POST['visibility'], FILTER_SANITIZE_NUMBER_INT);
$created_date = $year . '-' . $month . '-' . $day . ' ' . $hour . ':' . $minute . ':' . $second;
$date = $created_date;
$check_title = $_get->check_news_title($alias);
if ($check_title->rows > 0) {
$alias = $alias . '-' . $check_title->rows;
} else {
$alias = $alias;
}
/* --- IMAGE --- */
if (isset($_FILES['upload_new_1'])) {
$image = upload_file($_global_general->url, 'images', $_FILES['upload_news_1'], 'news', 'files/uploads/news-image/', $ini_max_upload);
} else {