当前位置: 首页>>代码示例>>PHP>>正文


PHP s_bad_string函数代码示例

本文整理汇总了PHP中s_bad_string函数的典型用法代码示例。如果您正苦于以下问题:PHP s_bad_string函数的具体用法?PHP s_bad_string怎么用?PHP s_bad_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了s_bad_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: s_string_at

function s_string_at(&$weibo)
{
    if (s_bad_string($weibo)) {
        return false;
    }
    return preg_replace("/\\@([\\w_\\x{4e00}-\\x{9fa5}]+)/u", "<a usercard=\"name=\$1\" title=\"\$0\" href=\"http://weibo.com/n/\$1\">\$0</a>", $weibo);
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:7,代码来源:devinc.string.php

示例2: s_cookie_set

function s_cookie_set($key, $val, $exp, $path)
{
    if (s_bad_string($key)) {
        return false;
    }
    return setrawcookie($key, $val);
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:7,代码来源:devinc.cookie.php

示例3: s_memcache_del

function s_memcache_del($key)
{
    if (s_bad_string($key) || false === ($cache = s_memcache_local())) {
        return false;
    }
    //不做值存在检查,直接写
    return $cache->delete(md5(MEM_CACHE_KEY_PREFIX . $key));
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:8,代码来源:devinc.memcache.php

示例4: s_string_length

function s_string_length($string, $trim = false)
{
    if (s_bad_string($string, $string, $trim)) {
        return false;
    }
    $len1 = strlen($string);
    $len2 = mb_strlen($string);
    return $len1 === $len2 ? $len1 : $len2;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:9,代码来源:devinc.string.php

示例5: s_action_redirect

function s_action_redirect($url)
{
    if (s_bad_string($url)) {
        $url = defined('APP_NAME') ? '/' . APP_NAME : '';
    }
    if (!s_bad_ajax()) {
        return s_action_json(array('error' => 1, 'redirect' => $url));
    }
    //302
    header("Location: {$url}");
    return "";
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:12,代码来源:devinc.action.php

示例6: s_safe_unhtml

function s_safe_unhtml($string, $trim = false)
{
    if (s_bad_string($string, $string, $trim)) {
        return false;
    }
    $string = str_replace('&amp;', '&', $string);
    $string = str_replace('&apos;', "'", $string);
    $string = str_replace('&quot;', '"', $string);
    $string = str_replace('&gt;', '>', $string);
    $string = str_replace('&lt;', '>', $string);
    return $string;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:12,代码来源:devinc.safe.php

示例7: s_string_2dir

function s_string_2dir($path, $mask = 0755)
{
    if (s_bad_string($path)) {
        return false;
    }
    if (isset($_SERVER["SINASRV_CACHE_DIR"])) {
        $real = $_SERVER["SINASRV_CACHE_DIR"] . $path;
    }
    if (!is_dir($real) && !mkdir($real, $mask, true)) {
        return false;
    }
    return array("url" => $_SERVER["SINASRV_CACHE_URL"] . "/" . $path, "dir" => $_SERVER["SINASRV_CACHE_DIR"] . $path);
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:13,代码来源:devinc.string.php

示例8: s_badge_new

function s_badge_new($uid, $bid, $username, $password)
{
    if (s_bad_id($uid) || s_bad_string($username) || s_bad_string($password)) {
        return s_err_arg();
    }
    $key = 'badge_new_by#' . $uid . $bid . $username . $password;
    if (false === ($data = s_memcache($key))) {
        $data = array('source' => APP_KEY, 'badge_id' => $bid, 'uids' => $uid, '_username' => $username, '_password' => $password);
        if ($data = s_badge_http('http://i2.api.weibo.com/2/proxy/badges/issue.json', $data, 'post')) {
            //缓存一小时
            s_memcache($key, $data, 3600);
        }
    }
    return $data;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:15,代码来源:devinc.badge.php

示例9: s_weibo_list_time

function s_weibo_list_time($list, $format = "m月d日 H:i", $postfix = "")
{
    if (s_bad_array($list) || s_bad_string($format)) {
        return false;
    }
    foreach ($list as &$item) {
        if (isset($item['time'])) {
            $item['time'] = date($format . $postfix, $item['time']);
        }
        unset($item['fdate']);
        unset($item['ftime']);
        unset($item['status']);
        unset($item);
    }
    return $list;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:16,代码来源:devinc.weibo.php

示例10: s_memcache

function s_memcache($key, $value = false, $method = "set")
{
    return false;
    if (s_bad_string($key)) {
        return false;
    }
    if ($value === false) {
        //获取memcache值
        return s_memcache_get($key);
    } else {
        if ($method === "set") {
            //设置memcache值
            return s_memcache_set($key, $value);
        }
    }
    return false;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:17,代码来源:devinc.memcache.php

示例11: imagesx

function &s_watermark(&$photo, &$watermark, $x = 0, $y = 0)
{
    if (s_bad_gd() || s_bad_string($photo) || s_bad_string($watermark)) {
        return s_err_arg();
    }
    //获取底板图片和水印图片
    if (false === ($plate = @imagecreatefromjpeg($photo)) || false === ($water = @imagecreatefrompng($watermark))) {
        return s_err_log('image error.');
    }
    //计算水平间隔
    //检查图片大小
    $p_w = imagesx($plate);
    $p_h = imagesy($plate);
    $w_w = imagesx($water);
    $w_h = imagesy($water);
    if ($p_w < $w_w || $p_h < $w_h) {
        //消毁对象
        imagedestroy($plate);
        imagedestroy($water);
        return s_err_log('water height or width more than plate');
    }
    //TODO: 使用临时目录
    $time = s_action_time();
    $path = '/tmp/';
    $path .= defined('APP_NAME') ? APP_NAME : date('Y-m-d', $time) . '_auto';
    if (!is_dir($path) && !mkdir($path, 0755, true)) {
        return false;
    }
    $file = $path . '/' . $time . '_' . rand(1, 10000) . '.jpg';
    //合并图片
    if (false === imagecopy($plate, $water, $p_w - $w_w, $p_h - $w_h, 0, 0, $w_w, $w_h) || false === imagejpeg($plate, $file)) {
        return s_err_log('unsuccess to {$file}.');
    }
    //消毁对象
    imagedestroy($plate);
    imagedestroy($water);
    //返回图片地址或者图片数据
    return $file;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:39,代码来源:devinc.watermark.php

示例12: s_weibo_detail_by_mid

function s_weibo_detail_by_mid($mid, $key = false)
{
    if (is_string($mid)) {
        //查一个
        $mid = array($mid);
    } else {
        if (is_array($mid)) {
            //查多个
            if (is_string($key)) {
                //是一个联合数组,那么按$key取值
                $list = $mid;
                $mid = array();
                foreach ($list as $item) {
                    if (!s_bad_string($item[$key], $id)) {
                        $mid[] = $id;
                    }
                }
                unset($list);
            }
            $mid = array_unique($mid);
        }
    }
    if (s_bad_array($mid) || false == ($mid = s_weibo_2id_by_mids($mid))) {
        return false;
    }
    //查询所有的微博详情
    $list = array();
    foreach ($mid as $key => $wid) {
        $list[$key] = s_weibo_by_wid($wid);
    }
    return $list;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:32,代码来源:devinc.weibo.php

示例13: s_live_post

function s_live_post(&$user, &$mids, $act = 0)
{
    if (s_bad_array($user) || s_bad_id($act) || s_bad_string($mids)) {
        return s_err_arg();
    }
    $data = array('uid' => $user['uid'], 'lid' => $lid, 'mid' => $mids, 'act' => $act);
    if (false === ($data = s_live_http('http://i.service.t.sina.com.cn/sapps/live/setmblogstatus.php', $data, 'post'))) {
        return s_err_sdk();
    }
    return $data;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:11,代码来源:devinc.live.php

示例14: s_bad_referer

function s_bad_referer(&$referer = false, $other = false)
{
    if (!isset($_SERVER['HTTP_HOST'])) {
        return false;
    }
    $hosts = array('weibo.cn', 'weibo.com', 'sina.com', 'sina.com.cn');
    if (!s_bad_string($other)) {
        $hosts[] = $other;
    }
    $host = $_SERVER['HTTP_HOST'];
    foreach ($hosts as &$item) {
        if (preg_match("/{$item}\$/i", $host)) {
            if (false !== $referer && isset($_SERVER['HTTP_REFERER'])) {
                $referer = $_SERVER['HTTP_REFERER'];
            }
            return false;
        }
        unset($item);
    }
    return true;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:21,代码来源:devinc.bad.php

示例15: _s_db_delete

function _s_db_delete($table, $v1)
{
    if (s_bad_string($table, $table, true) || !($v1 = is_array($v1) && isset($v1["id"]) ? intval($v1["id"]) : $v1) || s_bad_id($v1)) {
        return s_err_arg();
    }
    if (defined("APP_DB_PREFIX")) {
        //替换表名:"%s_user:update" => "201204disney_user:update"
        $table = sprintf($table, APP_DB_PREFIX, true);
    }
    $sql = "update `{$table}` set `status`=-1 where `id`= {$v1}";
    return s_db_exec($sql);
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:12,代码来源:devinc.mdb2.php


注:本文中的s_bad_string函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。