Ecshop Functions
http://www.cnblogs.com/jessezhao/archive/2010/06/09/1755127.html
lib_time.php | |
---|---|
获得当前格林威治时间的时间戳 /$0 | gmtime() |
获得服务器的时区 /$0 | server_timezone() |
生成一个用户自定义时区日期的GMT时间戳 | local_mktime($hour = NULL , $minute= NULL, $second = NULL, $month = NULL, $day = NULL, $year = NULL) |
将GMT时间戳格式化为用户自定义时区日期 | local_date($format, $time = NULL) |
转换字符串形式的时间表达式为GMT时间戳 | gmstr2time($str) |
将一个用户自定义时区的日期转为GMT时间戳 | local_strtotime($str) |
获得用户所在时区指定的时间戳 | local_gettime($timestamp = NULL) |
获得用户所在时区指定的日期和时间信息 | local_getdate($timestamp = NULL) |
lib_base.php | |
截取UTF-8编码下字符串的函数 | sub_str($str, $length = 0, $append = true) |
获得用户的真实IP地址 | real_ip() |
计算字符串的长度(汉字按照两个字符计算) | str_len($str) |
获得用户操作系统的换行符 | get_crlf() |
邮件发送 | send_mail($name, $email, $subject, $content, $type = 0, $notification=false) |
获得服务器上的 GD 版本 | gd_version() |
如果系统不存在file_get_contents函数则声明该函数 | file_get_contents($file) |
如果系统不存在file_put_contents函数则声明该函数 | file_put_contents($file, $data, $flags = ”) |
如果系统不存在 floatval 函数则声明该函数 | floatval($n) |
文件或目录权限检查函数 | file_mode_info($file_path) |
写入日志内容 | log_write($arg, $file = ”, $line = ”) |
检查目标文件夹是否存在,如果不存在则自动创建该目录 | make_dir($folder) |
获得系统是否启用了 gzip | gzip_enabled() |
递归方式的对变量中的特殊字符进行转义 | addslashes_deep($value) |
将对象成员变量或者数组的特殊字符进行转义 | addslashes_deep_obj($obj) |
递归方式的对变量中的特殊字符去除转义 | stripslashes_deep($value) |
将一个字串中含有全角的数字字符、字母、空格或’%+-()’字符转换为相应半角字符 | make_semiangle($str) |
检查文件类型 /文件名/真实文件名/允许的文件类型 | check_file_type($filename, $realname = ”, $limit_ext_types = ”) |
对 MYSQL LIKE 的内容进行转义 过滤掉_ %等字符. | mysql_like_quote($str) |
获取服务器的ip | real_server_ip() |
自定义 header 函数,用于过滤可能出现的安全隐患 | ecs_header($string, $replace = true, $http_response_code = 0) |
自定义的编码转换 | ecs_iconv($source_lang, $target_lang, $source_string = ”) |
取得IP的地址,采用IP库 | ecs_geoip($ip) |
去除字符串右侧可能出现的乱码 | trim_right($str) |
将上传文件转移到指定位置 | move_upload_file($file_name, $target_name = ”) |
将JSON传递的参数转码 | json_str_iconv($str) |
获取文件后缀名,并判断是否合法 | get_file_suffix($file_name, $allow_type = array()) |
读结果缓存文件 | read_static_cache($cache_name) |
写结果缓存文件 | write_static_cache($cache_name, $caches) |
lib_common.php (公用函数库) | |
创建像这样的查询: “IN(’a',’b')” $item_list为数组 | db_create_in($item_list, $field_name = ”) |
验证输入的邮件地址是否合法 | is_email($user_email) |
检查是否为一个合法的时间格式 | is_time($time) |
获得查询时间和次数,并赋值给smarty | assign_query_info() |
创建地区的返回信息 | region_result($parent, $sel_name, $type) |
获得指定国家的所有省份, 函数需要数据库支持. | get_regions($type = 0, $parent = 0) |
获得配送区域中指定的配送方式的配送费用的计算参数 比如快捷公司不同. | get_shipping_config($area_id) |
初始化会员数据整合类 | init_users() |
获得指定分类下的子分类的数组, $re_type控制返回类型 | cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0, $is_show_all = true) |
过滤和排序所有分类,返回一个带有缩进级别的数组 | cat_options($spec_cat_id, $arr) |
载入配置信息 | load_config() |
取得品牌列表 | get_brand_list() |
获得某个分类下的品牌列表 | get_brands($cat = 0, $app = ‘brand’) |
所有的促销活动信息 | get_promotion_info($goods_id = ”) |
获得指定分类下所有底层分类的ID | get_children($cat = 0) |
获得指定文章分类下所有底层分类的ID | get_article_children ($cat = 0) |
获取邮件模板 | get_mail_template($tpl_name) |
记录订单操作记录 | order_action($order_sn, $order_status, $shipping_status, $pay_status, $note = ”, $username = null) |
格式化商品价格 | price_format($price, $change_price = true) |
返回订单中的虚拟商品 记录是否发货. | get_virtual_goods($order_id, $shipping = false) |
虚拟商品发货 | virtual_goods_ship(&$virtual_goods, &$msg, $order_sn, $return_result = false, $process = ‘other’) |
虚拟卡发货 | virtual_card_shipping ($goods, $order_sn, &$msg, $process = ‘other’) |
返回虚拟卡信息 | virtual_card_result($order_sn, $goods) |
获取指定 id snatch 活动的结果 | get_snatch_result($id) |
清除指定后缀的模板缓存或编译文件 | clear_tpl_files($is_cache = true, $ext = ”) |
清除模版编译文件 | clear_compiled_files($ext = ”) |
清除缓存文件 | clear_cache_files($ext = ”) |
清除模版编译和缓存文件 | clear_all_files($ext = ”) |
页面上调用的js文件,组合功能. | smarty_insert_scripts($args) |
创建分页的列表 | smarty_create_pages($params) |
重写 URL 地址 | build_uri($app, $params, $append = ”, $page = 0, $size = 0) |
格式化重量 | formated_weight($weight) |
记录帐户变动 | log_account_change($user_id, $user_money = 0, $frozen_money = 0, $rank_points = 0, $pay_points = 0, $change_desc = ”, $change_type = ACT_OTHER) |
获得指定分类下的子分类的数组/ 向下取数组. | article_cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0) |
过滤和排序所有文章分类,返回一个带有缩进级别的数组 | article_cat_options($spec_cat_id, $arr) |
调用UCenter的函数 | uc_call($func, $params=null) |
error_handle回调函数未启用. | exception_handler($errno, $errstr, $errfile, $errline) |
重新获得商品图片与商品相册的地址 | get_image_path($goods_id, $image=”, $thumb=false, $call=’goods’, $del=false) |
调用使用UCenter插件时的函数 | user_uc_call($func, $params = null) |
取得商品优惠价格列表 | get_volume_price_list($goods_id, $price_type = ‘1′) |
取得商品最终使用价格 | get_final_price($goods_id, $goods_num = ‘1′, $is_spec_price = false, $spec = array()) |
获取指定id package 的信息 | get_package_info($id) |
获得指定礼包的商品 | get_package_goods($package_id) |
lib_main.php (前台公用函数库) | |
更新用户SESSION,COOKIE及登录时间、登录次数。 | update_user_info() |
获取用户信息数组 | get_user_info($id=0) |
取得当前位置和页面标题 | assign_ur_here($cat = 0, $str = ”) |
获得指定分类的所有上级分类 | get_parent_cats($cat) |
根据提供的数组编译成页面标题 | build_pagetitle($arr, $type = ‘category’) |
根据提供的数组编译成当前位置 | build_urhere($arr, $type = ‘category’) |
获得指定页面的动态内容 | assign_dynamic($tmp |
分配文章列表给smarty | assign_articles($id, $num) |
分配帮助信息 | get_shop_help() |
创建分页信息.分页函数. | 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=”) |
生成给pager.lbi赋值的数组 | get_pager($url, $param, $record_count, $page = 1, $size = 10) |
调用调查内容 | get_vote($id = ”) |
获得浏览器名称和版本 | get_user_browser() |
判断是否为搜索引擎蜘蛛 | is_spider($record = true) |
获得客户端的操作系统 | get_os() |
统计访问信息 | visit_stats() |
保存搜索引擎关键字 | save_searchengine_keyword($domain, $path) |
获得指定用户、商品的所有标记 | get_tags($goods_id = 0, $user_id = 0) |
获取指定主题某个模板的主题的动态模块 | get_dyna_libs($theme, $tmp) |
换动态模块 | dyna_libs_replace($matches) |
处理上传文件,并返回上传图片名(上传失败时返回图片名为空) | upload_file($upload, $type) |
显示一个提示信息 | show_message($content, $links = ”, $hrefs = ”, $type = ‘info’, $auto_redirect = true) |
将一个形如+10, 10, -10, 10%的字串转换为相应数字,并返回操作符号 | parse_rate_value($str, &$operate) |
重新计算购物车中的商品价格:目的是当用户登录时享受会员价格,当用户退出登录时不享受会员价格 | recalculate_price() |
查询评论内容 | assign_comment($id, $type, $page = 1) |
默认的smarty赋值 | assign_template($ctype = ”, $catlist = array()) |
将一个本地时间戳转成GMT时间戳 | time2gmt($time) |
查询会员的红包金额 | get_user_bonus($user_id = 0) |
保存推荐uid | set_affiliate() |
获取推荐uid | get_affiliate() |
获得指定分类同级的所有分类以及该分类下的子分类 | article_categories_tree($cat_id = 0) |
获得指定文章分类的所有上级分类 | get_article_parent_cats($cat) |
取得某模板某库设置的数量 | get_library_number($library, $template = null) |
取得自定义导航栏列表 | get_navigator($ctype = ”, $catlist = array()) |
授权信息内容 | license_info() |
lib_insert.php (动态内容函数库) | |
获得查询次数以及查询时间 | insert_query_info() |
调用浏览历史 | insert_history() |
调用购物车信息 | insert_cart_info() |
调用指定的广告位的广告 | insert_ads($arr) |
调用会员信息 | insert_member_info() |
调用评论信息 | insert_comments($arr) |
调用在线调查信息 | insert_vote() |
lib_goods.php (商品相关函数库) | |
商品推荐usort用自定义排序行数 | goods_sort($goods_a, $goods_b) |
获得指定分类同级的所有分类以及该分类下的子分类 | get_categories_tree($cat_id = 0) |
取和指定分类ID下的分类树 | get_child_tree($tree_id = 0) |
调用当前分类的销售排行榜 | get_top10($cats = ”) |
获得推荐商品 | get_recommend_goods($type = ”, $cats = ”) |
获得促销商品 | get_promote_goods($cats = ”) |
获得指定分类下的推荐商品 | get_category_recommend_goods($type = ”, $cats = ”, $brand = 0, $min =0, $max = 0, $ext=”) |
获得商品的详细信息 | get_goods_info($goods_id) |
获得商品的属性和规格 | get_goods_properties($goods_id) |
获得属性相同的商品 | get_same_attribute_goods($attr) |
获得指定商品的相册 | get_goods_gallery($goods_id) |
获得指定分类下的商品 | assign_cat_goods($cat_id, $num = 0, $from = ‘web’) |
获得指定的品牌下的商品 | assign_brand_goods($brand_id, $num = 0, $cat_id = 0) |
获得所有扩展分类属于指定分类的所有商品ID | get_extension_goods($cats) |
判断某个商品是否正在特价促销期 | bargain_price($price, $start, $end) |
获得指定的规格的价格 | spec_price($spec) |
取得团购活动信息 | group_buy_info($group_buy_id, $current_num = 0) |
取得某团购活动统计信息 | group_buy_stat($group_buy_id, $deposit) |
获得团购的状态 | group_buy_status($group_buy) |
取得拍卖活动信息 | auction_info($act_id, $config = false) |
取得拍卖活动出价记录 | auction_log($act_id) |
计算拍卖活动状态(注意参数一定是原始信息) | auction_status($auction) |
取得商品信息 | goods_info($goods_id) |
取得优惠活动信息 | favourable_info($act_id) |
批发信息 | wholesale_info($act_id) |
添加商品名样式 | add_style($goods_name, $style) |
取得商品属性 | get_goods_attr($goods_id) |
获得购物车中商品的配件 | get_goods_fittings($goods_list = array()) |
lib_article.php (文章及文章分类相关函数库) | |
获得文章分类下的文章列表 | get_cat_articles($cat_id, $page = 1, $size = 20 ,$requirement=”) |
获得指定分类下的文章总数 | get_article_count($cat_id ,$requirement=”) |