ecshop二次開發指南

所有函數功能說明:

lib_time.php

gmtime()

P: 獲得當前格林威治時間的時間戳 /$0

server_timezone()

P: 獲得服務器的時區 /$0

local_mktime($hour = NULL , $minute= NULL, $second = NULL, $month = NULL, $day = NULL, $year = NULL)

P: 生成一個用戶自定義時區日期的GMT時間戳

local_date($format, $time = NULL)

P: 將GMT時間戳格式化爲用戶自定義時區日期

gmstr2time($str)

P: 轉換字符串形式的時間表達式爲GMT時間戳

local_strtotime($str)

P: 將一個用戶自定義時區的日期轉爲GMT時間戳

local_gettime($timestamp = NULL)

P: 獲得用戶所在時區指定的時間戳

local_getdate($timestamp = NULL)

P: 獲得用戶所在時區指定的日期和時間信息

[b]lib_base.php[/b]

sub_str($str, $length = 0, $append = true)

P: 截取UTF-8編碼下字符串的函數

real_ip()

P: 獲得用戶的真實IP地址

str_len($str)

P: 計算字符串的長度(漢字按照兩個字符計算)

get_crlf()

P: 獲得用戶操作系統的換行符

send_mail($name, $email, $subject, $content, $type = 0, $notification=false)

P: 郵件發送

gd_version()

P: 獲得服務器上的 GD 版本

file_get_contents($file)

P: 如果系統不存在file_get_contents函數則聲明該函數

file_put_contents($file, $data, $flags = ”)

P: 如果系統不存在file_put_contents函數則聲明該函數

floatval($n)

P: 如果系統不存在 floatval 函數則聲明該函數

file_mode_info($file_path)

P: 文件或目錄權限檢查函數

log_write($arg, $file = ”, $line = ”)

P: 寫入日誌內容

make_dir($folder)

P: 檢查目標文件夾是否存在,如果不存在則自動創建該目錄

gzip_enabled()

P: 獲得系統是否啓用了 gzip

addslashes_deep($value)

P: 遞歸方式的對變量中的特殊字符進行轉義

addslashes_deep_obj($obj)

P: 將對象成員變量或者數組的特殊字符進行轉義

stripslashes_deep($value)

P: 遞歸方式的對變量中的特殊字符去除轉義

make_semiangle($str)

P: 將一個字串中含有全角的數字字符、字母、空格或’%+-()’字符轉換爲相應半角字符

check_file_type($filename, $realname = ”, $limit_ext_types = ”)

P: 檢查文件類型 /文件名/真實文件名/允許的文件類型

mysql_like_quote($str)

P: 對 MYSQL LIKE 的內容進行轉義 過濾掉_ %等字符.

real_server_ip()

P: 獲取服務器的ip

ecs_header($string, $replace = true, $http_response_code = 0)

P: 自定義 header 函數,用於過濾可能出現的安全隱患

ecs_iconv($source_lang, $target_lang, $source_string = ”)

P: 自定義的編碼轉換

ecs_geoip($ip)

P: 取得IP的地址,採用IP庫

trim_right($str)

P: 去除字符串右側可能出現的亂碼

move_upload_file($file_name, $target_name = ”)

P: 將上傳文件轉移到指定位置

json_str_iconv($str)

P: 將JSON傳遞的參數轉碼

get_file_suffix($file_name, $allow_type = array())

P: 獲取文件後綴名,並判斷是否合法

read_static_cache($cache_name)

P: 讀結果緩存文件

write_static_cache($cache_name, $caches)

P: 寫結果緩存文件

[b]lib_common.php (公用函數庫)[/b]

db_create_in($item_list, $field_name = ”)

P: 創建像這樣的查詢: “IN(‘a’,’b’)” $item_list爲數組

is_email($user_email)

P: 驗證輸入的郵件地址是否合法

is_time($time)

P: 檢查是否爲一個合法的時間格式

assign_query_info()

P: 獲得查詢時間和次數,並賦值給smarty

region_result($parent, $sel_name, $type)

P: 創建地區的返回信息

get_regions($type = 0, $parent = 0)

P: 獲得指定國家的所有省份, 函數需要數據庫支持.

get_shipping_config($area_id)

P: 獲得配送區域中指定的配送方式的配送費用的計算參數 比如快捷公司不同.

init_users()

P: 初始化會員數據整合類

cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0, $is_show_all = true)

P: 獲得指定分類下的子分類的數組, $re_type控制返回類型

cat_options($spec_cat_id, $arr)

P: 過濾和排序所有分類,返回一個帶有縮進級別的數組

load_config()

P: 載入配置信息

get_brand_list()

P: 取得品牌列表

get_brands($cat = 0, $app = ‘brand’)

P: 獲得某個分類下的品牌列表

get_promotion_info($goods_id = ”)

P: 所有的促銷活動信息

get_children($cat = 0)

P: 獲得指定分類下所有底層分類的ID

get_article_children ($cat = 0)

P: 獲得指定文章分類下所有底層分類的ID

get_mail_template($tpl_name)

P: 獲取郵件模板

order_action($order_sn, $order_status, $shipping_status, $pay_status, $note = ”, $username = null)

P: 記錄訂單操作記錄

price_format($price, $change_price = true)

P: 格式化商品價格

get_virtual_goods($order_id, $shipping = false)

P: 返回訂單中的虛擬商品 記錄是否發貨.

virtual_goods_ship(&$virtual_goods, &$msg, $order_sn, $return_result = false, $process = ‘other’)

P: 虛擬商品發貨

virtual_card_shipping ($goods, $order_sn, &$msg, $process = ‘other’)

P: 虛擬卡發貨

virtual_card_result($order_sn, $goods)

P: 返回虛擬卡信息

get_snatch_result($id)

P: 獲取指定 id snatch 活動的結果

clear_tpl_files($is_cache = true, $ext = ”)

P: 清除指定後綴的模板緩存或編譯文件

clear_compiled_files($ext = ”)

P: 清除模版編譯文件

clear_cache_files($ext = ”)

P: 清除緩存文件

clear_all_files($ext = ”)

P: 清除模版編譯和緩存文件

smarty_insert_scripts($args)

P: 頁面上調用的js文件,組合功能.

smarty_create_pages($params)

P: 創建分頁的列表

build_uri($app, $params, $append = ”, $page = 0, $size = 0)

P: 重寫 URL 地址

formated_weight($weight)

P: 格式化重量

log_account_change($user_id, $user_money = 0, $frozen_money = 0, $rank_points = 0, $pay_points = 0, $change_desc = ”, $change_type = ACT_OTHER)

P: 記錄帳戶變動

article_cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0)

P: 獲得指定分類下的子分類的數組/ 向下取數組.

article_cat_options($spec_cat_id, $arr)

P: 過濾和排序所有文章分類,返回一個帶有縮進級別的數組

uc_call($func, $params=null)

P: 調用UCenter的函數

exception_handler($errno, $errstr, $errfile, $errline)

P: error_handle回調函數未啓用.

get_image_path($goods_id, $image=”, $thumb=false, $call=’goods’, $del=false)

P: 重新獲得商品圖片與商品相冊的地址

user_uc_call($func, $params = null)

P: 調用使用UCenter插件時的函數

get_volume_price_list($goods_id, $price_type = ‘1′)

P: 取得商品優惠價格列表

get_final_price($goods_id, $goods_num = ‘1′, $is_spec_price = false, $spec = array())

P: 取得商品最終使用價格

get_package_info($id)

P: 獲取指定id package 的信息

get_package_goods($package_id)

P: 獲得指定禮包的商品

[b]lib_main.php (前臺公用函數庫)[/b]

update_user_info()

P: 更新用戶SESSION,COOKIE及登錄時間、登錄次數。

get_user_info($id=0)

P: 獲取用戶信息數組

assign_ur_here($cat = 0, $str = ”)

P: 取得當前位置和頁面標題

get_parent_cats($cat)

P: 獲得指定分類的所有上級分類

build_pagetitle($arr, $type = ‘category’)

P: 根據提供的數組編譯成頁面標題

build_urhere($arr, $type = ‘category’)

P: 根據提供的數組編譯成當前位置

assign_dynamic($tmp

P: 獲得指定頁面的動態內容

assign_articles($id, $num)

P: 分配文章列表給smarty

get_shop_help()

P: 分配幫助信息

assign_pager($app, $cat, $record_count, $size, $sort, $order, $page = 1,$keywords = ”, $brand = 0, $price_min = 0, $price_max = 0, $display_type = ‘list’, $filter_attr=”, $url_format=”, $sch_array=”)

P: 創建分頁信息.分頁函數.

get_pager($url, $param, $record_count, $page = 1, $size = 10)

P: 生成給pager.lbi賦值的數組

get_vote($id = ”)

P: 調用調查內容

get_user_browser()

P: 獲得瀏覽器名稱和版本

is_spider($record = true)

P: 判斷是否爲搜索引擎蜘蛛

get_os()

P: 獲得客戶端的操作系統

visit_stats()

P: 統計訪問信息

save_searchengine_keyword($domain, $path)

P: 保存搜索引擎關鍵字

get_tags($goods_id = 0, $user_id = 0)

P: 獲得指定用戶、商品的所有標記

get_dyna_libs($theme, $tmp)

P: 獲取指定主題某個模板的主題的動態模塊

dyna_libs_replace($matches)

P: 換動態模塊

upload_file($upload, $type)

P: 處理上傳文件,並返回上傳圖片名(上傳失敗時返回圖片名爲空)

show_message($content, $links = ”, $hrefs = ”, $type = ‘info’, $auto_redirect = true)

P: 顯示一個提示信息

parse_rate_value($str, &$operate)

P: 將一個形如+10, 10, -10, 10%的字串轉換爲相應數字,並返回操作符號

recalculate_price()

P: 重新計算購物車中的商品價格:目的是當用戶登錄時享受會員價格,當用戶退出登錄時不享受會員價格

assign_comment($id, $type, $page = 1)

P: 查詢評論內容

assign_template($ctype = ”, $catlist = array())

P: 默認的smarty賦值

time2gmt($time)

P: 將一個本地時間戳轉成GMT時間戳

get_user_bonus($user_id = 0)

P: 查詢會員的紅包金額

set_affiliate()

P: 保存推薦uid

get_affiliate()

P: 獲取推薦uid

article_categories_tree($cat_id = 0)

P: 獲得指定分類同級的所有分類以及該分類下的子分類

get_article_parent_cats($cat)

P: 獲得指定文章分類的所有上級分類

get_library_number($library, $template = null)

P: 取得某模板某庫設置的數量

get_navigator($ctype = ”, $catlist = array())

P: 取得自定義導航欄列表

license_info()

P: 授權信息內容

[b]lib_insert.php (動態內容函數庫)[/b]

insert_query_info()

P: 獲得查詢次數以及查詢時間

insert_history()

P: 調用瀏覽歷史

insert_cart_info()

P: 調用購物車信息

insert_ads($arr)

P: 調用指定的廣告位的廣告

insert_member_info()

P: 調用會員信息

insert_comments($arr)

P: 調用評論信息

insert_vote()

P: 調用在線調查信息

[b]lib_goods.php (商品相關函數庫)[/b]

goods_sort($goods_a, $goods_b)

P: 商品推薦usort用自定義排序行數

get_categories_tree($cat_id = 0)

P: 獲得指定分類同級的所有分類以及該分類下的子分類

get_child_tree($tree_id = 0)

P: 取和指定分類ID下的分類樹

get_top10($cats = ”)

P: 調用當前分類的銷售排行榜

get_recommend_goods($type = ”, $cats = ”)

P: 獲得推薦商品

get_promote_goods($cats = ”)

P: 獲得促銷商品

get_category_recommend_goods($type = ”, $cats = ”, $brand = 0, $min =0, $max = 0, $ext=”)

P: 獲得指定分類下的推薦商品

get_goods_info($goods_id)

P: 獲得商品的詳細信息

get_goods_properties($goods_id)

P: 獲得商品的屬性和規格

get_same_attribute_goods($attr)

P: 獲得屬性相同的商品

get_goods_gallery($goods_id)

P: 獲得指定商品的相冊

assign_cat_goods($cat_id, $num = 0, $from = ‘web’)

P: 獲得指定分類下的商品

assign_brand_goods($brand_id, $num = 0, $cat_id = 0)

P: 獲得指定的品牌下的商品

get_extension_goods($cats)

P: 獲得所有擴展分類屬於指定分類的所有商品ID

bargain_price($price, $start, $end)

P: 判斷某個商品是否正在特價促銷期

spec_price($spec)

P: 獲得指定的規格的價格

group_buy_info($group_buy_id, $current_num = 0)

P: 取得團購活動信息

group_buy_stat($group_buy_id, $deposit)

P: 取得某團購活動統計信息

group_buy_status($group_buy)

P: 獲得團購的狀態

auction_info($act_id, $config = false)

P: 取得拍賣活動信息

auction_log($act_id)

P: 取得拍賣活動出價記錄

auction_status($auction)

P: 計算拍賣活動狀態(注意參數一定是原始信息)

goods_info($goods_id)

P: 取得商品信息

favourable_info($act_id)

P: 取得優惠活動信息

wholesale_info($act_id)

P: 批發信息

add_style($goods_name, $style)

P: 添加商品名樣式

get_goods_attr($goods_id)

P: 取得商品屬性

get_goods_fittings($goods_list = array())

P: 獲得購物車中商品的配件

[b]lib_article.php (文章及文章分類相關函數庫)[/b]

get_cat_articles($cat_id, $page = 1, $size = 20 ,$requirement=”)

P: 獲得文章分類下的文章列表

get_article_count($cat_id ,$requirement=”)

P: 獲得指定分類下的文章總數

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章