• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP parse_html函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getCommentList

 /**
  * 获取评论列表,已在后台被使用
  * @param array $map 查询条件
  * @param string $order 排序条件,默认为comment_id ASC
  * @param integer $limit 结果集数目,默认为10
  * @param boolean $isReply 是否显示回复信息
  * @return array 评论列表信息
  */
 public function getCommentList($map = null, $order = 'comment_id ASC', $limit = 10, $isReply = false)
 {
     !$map['app'] && $this->_app && ($map['app'] = $this->_app);
     !$map['table'] && $this->_app_table && ($map['table'] = $this->_app_table);
     !isset($map['is_del']) && ($map['is_del'] = 0);
     $data = $this->where($map)->order($order)->findPage($limit);
     // dump($data);exit;
     // TODO:后续优化
     foreach ($data['data'] as &$v) {
         if (!empty($v['to_comment_id']) && $isReply) {
             $replyInfo = $this->setAppName($map['app'])->setAppTable($map['table'])->getCommentInfo(intval($v['to_comment_id']), false);
             $v['replyInfo'] = '//@{uid=' . $replyInfo['user_info']['uid'] . '|' . $replyInfo['user_info']['uname'] . '}:' . $replyInfo['content'];
         }
         $v['user_info'] = model('User')->getUserInfo($v['uid']);
         $groupData = static_cache('groupdata' . $v['uid']);
         if (!$groupData) {
             $groupData = model('UserGroupLink')->getUserGroupData($v['uid']);
             if (!$groupData) {
                 $groupData = 1;
             }
             static_cache('groupdata' . $v['uid'], $groupData);
         }
         $v['user_info']['groupData'] = $groupData;
         //获取用户组信息
         $v['content'] = parse_html($v['content'] . $v['replyInfo']);
         $v['sourceInfo'] = model('Source')->getSourceInfo($v['table'], $v['row_id'], false, $v['app']);
         //$v['data'] = unserialize($v['data']);
     }
     return $data;
 }
开发者ID:yang7hua,项目名称:hunshe,代码行数:38,代码来源:GroupCommentModel.class.php


示例2: notify

 /**
  * 系统通知
  * @return void
  */
 public function notify()
 {
     //$list = model('Notify')->getMessageList($this->mid);     //2012/12/27
     //下边这句是为了获取$count
     $limit = 20;
     $list = D('notify_message')->where('uid=' . $this->mid)->order('ctime desc')->findpage($limit);
     $count = $list['count'];
     $this->assign('count', $count);
     $page = $_GET['page'] ? intval($_GET['page']) : 1;
     $start = ($page - 1) * $limit;
     $list = D('notify_message')->where('uid=' . $this->mid)->order('ctime desc')->limit("{$start},{$limit}")->select();
     foreach ($list as $k => $v) {
         $list[$k]['body'] = parse_html($v['body']);
         if ($appname != 'public') {
             $list[$k]['app'] = model('App')->getAppByName($v['appname']);
         }
     }
     model('Notify')->setRead($this->mid);
     $this->assign('page', $page);
     $this->assign('list', $list);
     $this->setTitle(L('PUBLIC_MESSAGE_NOTIFY'));
     $this->setKeywords(L('PUBLIC_MESSAGE_NOTIFY'));
     $this->assign('headtitle', '系统通知');
     $this->display('mynotify');
 }
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:29,代码来源:MessageAction.class.php


示例3: parse_response

function parse_response($api, $params)
{
    global $records;
    $page = $params['from'] / $params['size'] + 1;
    echo "Page {$page}\n";
    //compare the individual request parameters into k=>v pairs to the URL
    $qparams = array();
    foreach ($params as $k => $v) {
        $qparams[] = "{$k}=" . urlencode($v);
    }
    $service = $api . implode('&', $qparams);
    //request JSON from API
    $json = file_get_contents($service);
    $data = json_decode($json);
    //iterate through results
    foreach ($data->results as $result) {
        $record = array();
        $record['id'] = $result->priref;
        $record['uri'] = "http://data.fitzmuseum.cam.ac.uk/id/object/{$result->priref}";
        $record['objectnumber'] = $result->ObjectNumber;
        $record['title'] = "Fitzwilliam Museum - Object {$result->ObjectNumber}";
        $imageCount = 0;
        foreach ($result->images->thumbnailURI as $url) {
            switch ($imageCount) {
                case 0:
                    $record['obv_image'] = $url;
                    break;
                case 1:
                    $record['rev_image'] = $url;
            }
            $imageCount++;
        }
        //begin screen scraping
        $url = "http://webapps.fitzmuseum.cam.ac.uk/explorer/index.php?oid={$result->priref}";
        $fields = parse_html($url);
        if (isset($fields['reference'])) {
            $record['reference'] = $fields['reference'];
        }
        if (isset($fields['coinType'])) {
            $record['cointype'] = $fields['coinType'];
        }
        if (isset($fields['weight'])) {
            $record['weight'] = $fields['weight'];
        }
        if (isset($fields['axis'])) {
            $record['axis'] = $fields['axis'];
        }
        $records[] = $record;
    }
    //var_dump($records);
    //if there are more pages to parse, curse function
    $numFound = $data->total;
    if ($params['from'] + $params['size'] <= $numFound) {
        $params['from'] = $params['from'] + $params['size'];
        parse_response($api, $params);
    }
}
开发者ID:AmericanNumismaticSociety,项目名称:migration_scripts,代码行数:57,代码来源:process-api.php


示例4: getReplyList

 /**
  * 获取回复列表
  * @param array $map 查询条件
  * @param string $order 排序条件,默认为comment_id ASC
  * @param integer $limit 结果集数目,默认为10
  * @return array 评论列表信息
  */
 public function getReplyList($map = null, $order = 'reply_id desc', $limit = 10)
 {
     !isset($map['is_del']) && ($map['is_del'] = 0);
     $data = $this->where($map)->order($order)->findPage($limit);
     // // TODO:后续优化
     foreach ($data['data'] as &$v) {
         $v['user_info'] = model('User')->getUserInfo($v['uid']);
         $v['user_info']['groupData'] = model('UserGroupLink')->getUserGroupData($v['uid']);
         //获取用户组信息
         $v['content'] = parse_html(h(htmlspecialchars($v['content'])));
         //$v['sourceInfo'] = model('Source')->getSourceInfo($v['table'], $v['row_id'], false, $v['app']);
     }
     return $data;
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:21,代码来源:WeibaReplyModel.class.php


示例5: tz

 public function tz()
 {
     $map['uid'] = $this->mid;
     $list = D('notify_message')->where($map)->order('ctime desc')->findpage(20);
     foreach ($list['data'] as $k => $v) {
         $list['data'][$k]['body'] = parse_html($v['body']);
         if ($v['appname'] != 'public') {
             $list['data'][$k]['app'] = model('App')->getAppByName($v['appname']);
         }
     }
     model('Notify')->setRead($this->mid);
     $this->assign('list', $list);
     $this->display();
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:14,代码来源:WebMessageAction.class.php


示例6: notify

 /**
  * 系统通知
  * @return void
  */
 public function notify()
 {
     //$list = model('Notify')->getMessageList($this->mid);     //2012/12/27
     $list = D('notify_message')->where('uid=' . $this->mid)->order('ctime desc')->findpage(20);
     foreach ($list['data'] as $k => $v) {
         $list['data'][$k]['body'] = parse_html($v['body']);
         if ($appname != 'public') {
             $list['data'][$k]['app'] = model('App')->getAppByName($v['appname']);
         }
     }
     model('Notify')->setRead($this->mid);
     $this->assign('list', $list);
     // dump($list);
     $this->setTitle(L('PUBLIC_MESSAGE_NOTIFY'));
     $this->setKeywords(L('PUBLIC_MESSAGE_NOTIFY'));
     $this->display('mynotify');
 }
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:21,代码来源:MessageAction.class.php


示例7: getReplyList

 /**
  * 获取回复列表
  * @param  array  $map   查询条件
  * @param  string $order 排序条件,默认为comment_id ASC
  * @param  int    $limit 结果集数目,默认为10
  * @return array  评论列表信息
  */
 public function getReplyList($map = null, $order = 'reply_id desc', $limit = 10)
 {
     !isset($map['is_del']) && ($map['is_del'] = 0);
     $data = $this->where($map)->order($order)->findPage($limit);
     // // TODO:后续优化
     foreach ($data['data'] as &$v) {
         $v['user_info'] = model('User')->getUserInfo($v['uid']);
         $v['user_info']['groupData'] = model('UserGroupLink')->getUserGroupData($v['uid']);
         //获取用户组信息
         $v['content'] = parse_html(h(htmlspecialchars($v['content'])));
         //$v['sourceInfo'] = model('Source')->getSourceInfo($v['table'], $v['row_id'], false, $v['app']);
         $v['attach_info'] = model('Attach')->getAttachById($v['attach_id']);
         if ($v['attach_info']['attach_type'] == 'weiba_comment_image' || $v['attach_info']['attach_type'] == 'feed_image') {
             $v['attach_info']['attach_url'] = getImageUrl($v['attach_info']['save_path'] . $v['attach_info']['save_name'], 590);
         }
     }
     return $data;
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:25,代码来源:WeibaReplyModel.class.php


示例8: get_data

function get_data($num, $url)
{
    $str = file_get_contents($url);
    $str = trim($str);
    $str = strtolower($str);
    if ($str == '') {
        $str = file_get_contents($url);
    }
    if ($str == '') {
        // recode error
        $fp = fopen('cantdown_' . $num, 'a+');
        fputs($fp, $num . '\\r\\n');
        fclose($fp);
    } else {
        $data = parse_html($str);
        if (insert_db($num, $data)) {
            echo $num . "is ok \r\n";
        }
    }
}
开发者ID:laiello,项目名称:pef,代码行数:20,代码来源:get_ip138.php


示例9: edit

 public function edit($_id = '')
 {
     $this->assigns_layout["gnb_left"] = "contents";
     if ($_REQUEST["subject"]) {
         $content_parsed = parse_html($_REQUEST["contents"]);
         foreach ($content_parsed as $c) {
             if (strtolower(substr($c, 0, 4)) == "<img") {
                 $t = tag_barase($c);
                 if ($t["src"]) {
                     $_REQUEST["img"] = $t["src"];
                     break;
                 }
             }
         }
         $_id = $this->Content->add($_REQUEST);
         if ($_REQUEST["pic"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['pic']);
             $ck = substr($img_temp_name, 0, 1);
             if ($ck == '/') {
                 $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
             }
             $file_ext = explode('.', $img_temp_name);
             //$filename = basename($_FILES['file']['name']);
             $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
             $original_file = $this->settings->root_path . $img_temp_name;
             $copy_file = $this->settings->root_path . 'media/contents/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/contents/' . $_id . $file_ext;
             $this->Content->add_picture($_id, $_pic);
         }
         header("Location: /admin_contents");
     }
     if ($_id) {
         $this->assigns["res"] = $this->Content->get($_id);
     }
     $this->assigns["cat"] = $this->Content_category->list_(1, 100);
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:40,代码来源:admin_contents.php


示例10: reply_commentList

 /**
  * [ 获取评论的评论列表]
  * @return [type] [description]
  */
 public function reply_commentList()
 {
     if (!CheckPermission('weiba_normal', 'weiba_reply')) {
         return false;
     }
     $var = $_POST;
     $var['initNums'] = model('Xdata')->getConfig('weibo_nums', 'feed');
     $var['commentInfo'] = model('Comment')->getCommentInfo($var['comment_id'], false);
     $var['canrepost'] = $var['commentInfo']['table'] == 'feed' ? 1 : 0;
     $var['cancomment'] = 1;
     // 获取原作者信息
     $rowData = model('Feed')->get(intval($var['commentInfo']['row_id']));
     $appRowData = model('Feed')->get($rowData['app_row_id']);
     $var['user_info'] = $appRowData['user_info'];
     // 微博类型
     $var['feedtype'] = $rowData['type'];
     // $var['cancomment_old'] = ($var['commentInfo']['uid'] != $var['commentInfo']['app_uid'] && $var['commentInfo']['app_uid'] != $this->uid) ? 1 : 0;
     if ($var['flag'] != 1) {
         $var['initHtml'] = L('PUBLIC_STREAM_REPLY') . '@' . $var['commentInfo']['user_info']['uname'] . ' :';
     }
     //获取回评
     $commentList = D('weiba_reply')->where('is_del = 0 and to_reply_id=' . $var['to_reply_id'])->order('ctime')->select();
     foreach ($commentList as $k => $v) {
         $commentList[$k]['content'] = parse_html(h(htmlspecialchars($v['content'])));
     }
     $this->assign('commentList', $commentList);
     $uids = getSubByKey($commentList, 'uid');
     $this->_assignUserInfo($uids);
     $this->assign('reply_id', $var['to_reply_id']);
     $this->assign('var', $var);
     if ($var[type] == 2) {
         $con = $this->fetch('reply_commentList1');
     } else {
         $con = $this->fetch();
     }
     echo $con;
 }
开发者ID:a349944418,项目名称:kaopu,代码行数:41,代码来源:CommentAction.class.php


示例11: addComment

 /**
  * 添加评论操作
  * @param array $data 评论数据
  * @param boolean $forApi 是否用于API,默认为false
  * @param boolean $notCount 是否统计到未读评论
  * @param array $lessUids 除去@用户ID
  * @return boolean 是否添加评论成功 
  */
 public function addComment($data, $forApi = false, $notCount = false, $lessUids = null)
 {
     // 判断用户是否登录
     if (!$GLOBALS['ts']['mid']) {
         $this->error = L('PUBLIC_REGISTER_REQUIRED');
         // 请先登录
         return false;
     }
     if (isSubmitLocked()) {
         $this->error = '发布内容过于频繁,请稍后再试!';
         return false;
     }
     /* # 将Emoji编码 */
     $data['content'] = formatEmoji(true, $data['content']);
     // 检测数据安全性
     $add = $this->_escapeData($data);
     if ($add['content'] === '') {
         $this->error = L('PUBLIC_COMMENT_CONTENT_REQUIRED');
         // 评论内容不可为空
         return false;
     }
     $add['is_del'] = 0;
     //判断是否先审后发
     $filterStatus = filter_words($add['content']);
     $weiboSet = model('Xdata')->get('admin_Config:feed');
     $weibo_premission = $weiboSet['weibo_premission'];
     if (in_array('audit', $weibo_premission) || CheckPermission('core_normal', 'feed_audit') || $filterStatus['type'] == 2) {
         $add['is_audit'] = 0;
     } else {
         $add['is_audit'] = 1;
     }
     $add['client_ip'] = get_client_ip();
     $add['client_port'] = get_client_port();
     if ($res = $this->add($add)) {
         //锁定发布
         lockSubmit();
         //添加楼层信息 弃用 20130607
         /*             $storeyCount = $this->where("table='".$add['table']."' and row_id=".$data['row_id'].' and comment_id<'.$res)->count();
                     $this->where('comment_id='.$res)->setField('storey',$storeyCount+1); */
         if (!$add['is_audit']) {
             $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll();
             $touidArr = getSubByKey($touid, 'uid');
             model('Notify')->sendNotify($touidArr, 'comment_audit');
         }
         // 获取排除@用户ID
         $lessUids[] = intval($data['app_uid']);
         !empty($data['to_uid']) && ($lessUids[] = intval($data['to_uid']));
         // 获取用户发送的内容,仅仅以//进行分割
         $scream = explode('//', $data['content']);
         model('Atme')->setAppName('Public')->setAppTable('comment')->addAtme(trim($scream[0]), $res, null, $lessUids);
         // 被评论内容的“评论统计数”加1,同时可检测出app,table,row_id的有效性
         $pk = D($add['table'])->getPk();
         $where = "`{$pk}`={$add['row_id']}";
         D($add['table'])->setInc('comment_count', $where);
         //兼容旧版本app
         //            D($add['table'])->setInc('commentCount', $where);
         //            D($add['table'])->setInc('comment_all_count', $where);
         D($add['app'])->setInc('commentCount', $where);
         D($add['app'])->setInc('comment_all_count', $where);
         //评论时间
         M($add['app'])->where('feed_id=' . $add['row_id'])->setField('rTime', time());
         // 给应用UID添加一个未读的评论数 原作者
         if ($GLOBALS['ts']['mid'] != $add['app_uid'] && $add['app_uid'] != '' && $add['app_uid'] != $add['to_uid']) {
             !$notCount && model('UserData')->updateKey('unread_comment', 1, true, $add['app_uid']);
         }
         // 回复发送提示信息
         if (!empty($add['to_uid']) && $add['to_uid'] != $GLOBALS['ts']['mid']) {
             !$notCount && model('UserData')->updateKey('unread_comment', 1, true, $add['to_uid']);
         }
         // 加积分操作
         if ($add['table'] == 'feed') {
             model('Credit')->setUserCredit($GLOBALS['ts']['mid'], 'comment_weibo');
             model('Credit')->setUserCredit($data['app_uid'], 'commented_weibo');
             model('Feed')->cleanCache($add['row_id']);
         }
         // 发邮件
         if ($add['to_uid'] != $GLOBALS['ts']['mid'] || $add['app_uid'] != $GLOBALS['ts']['mid'] && $add['app_uid'] != '') {
             $author = model('User')->getUserInfo($GLOBALS['ts']['mid']);
             $config['name'] = $author['uname'];
             $config['space_url'] = $author['space_url'];
             $config['face'] = $author['avatar_small'];
             $sourceInfo = model('Source')->getCommentSource($add, $forApi);
             $config['content'] = parse_html($add['content']);
             $config['ctime'] = date('Y-m-d H:i:s', time());
             $config['sourceurl'] = $sourceInfo['source_url'];
             $config['source_content'] = parse_html($sourceInfo['source_content']);
             $config['source_ctime'] = isset($sourceInfo['ctime']) ? date('Y-m-d H:i:s', $sourceInfo['ctime']) : date('Y-m-d H:i:s');
             if (!empty($add['to_uid'])) {
                 // 回复
                 $config['comment_type'] = '回复 我 的评论:';
                 model('Notify')->sendNotify($add['to_uid'], 'comment', $config);
             } else {
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:101,代码来源:CommentModel.class.php


示例12: addComment

 /**
  * 添加评论操作
  * @param array $data 评论数据
  * @param boolean $forApi 是否用于API,默认为false
  * @param boolean $notCount 是否统计到未读评论
  * @param array $lessUids 除去@用户ID
  * @return boolean 是否添加评论成功 
  */
 public function addComment($data, $forApi = false, $notCount = false, $lessUids = null)
 {
     // 判断用户是否登录
     if (!$GLOBALS['ts']['mid']) {
         $this->error = L('PUBLIC_REGISTER_REQUIRED');
         // 请先登录
         return false;
     }
     // 设置评论绝对楼层
     //$data['data']['storey'] = $this->getStorey($data['row_id'], $data['app'], $data['table']);
     // 检测数据安全性
     $add = $this->_escapeData($data);
     if ($add['content'] === '') {
         $this->error = L('PUBLIC_COMMENT_CONTENT_REQUIRED');
         // 评论内容不可为空
         return false;
     }
     $add['is_del'] = 0;
     //判断是否先审后发
     $weiboSet = model('Xdata')->get('admin_Config:feed');
     $weibo_premission = $weiboSet['weibo_premission'];
     if (in_array('audit', $weibo_premission) || CheckPermission('core_normal', 'feed_audit')) {
         $add['is_audit'] = 0;
     } else {
         $add['is_audit'] = 1;
     }
     if ($res = $this->add($add)) {
         //添加楼层信息
         $storeyCount = $this->where('row_id=' . $data['row_id'] . ' and comment_id<' . $res)->count();
         $this->where('comment_id=' . $res)->setField('storey', $storeyCount + 1);
         if (!$add['is_audit']) {
             $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll();
             foreach ($touid as $k => $v) {
                 model('Notify')->sendNotify($v['uid'], 'comment_audit');
             }
         }
         // 获取排除@用户ID
         $lessUids[] = intval($data['app_uid']);
         !empty($data['to_uid']) && ($lessUids[] = intval($data['to_uid']));
         // 获取用户发送的内容,仅仅以//进行分割
         $scream = explode('//', $data['content']);
         model('Atme')->setAppName('Public')->setAppTable('comment')->addAtme(trim($scream[0]), $res, null, $lessUids);
         // 被评论内容的“评论统计数”加1,同时可检测出app,table,row_id的有效性
         $pk = D($add['table'])->getPk();
         D($add['table'])->setInc('comment_count', "`{$pk}`={$add['row_id']}", 1);
         D($add['table'])->setInc('comment_all_count', "`{$pk}`={$add['row_id']}", 1);
         // 给应用UID添加一个未读的评论数 原作者
         if ($GLOBALS['ts']['mid'] != $add['app_uid'] && $add['app_uid'] != '') {
             !$notCount && model('UserData')->updateKey('unread_comment', 1, true, $add['app_uid']);
         }
         // 回复发送提示信息
         if (!empty($add['to_uid']) && $add['to_uid'] != $GLOBALS['ts']['mid']) {
             !$notCount && model('UserData')->updateKey('unread_comment', 1, true, $add['to_uid']);
         }
         // 加积分操作
         if ($add['table'] == 'feed') {
             model('Credit')->setUserCredit($GLOBALS['ts']['mid'], 'comment_weibo');
             model('Credit')->setUserCredit($data['app_uid'], 'commented_weibo');
             model('Feed')->cleanCache($add['row_id']);
         }
         // 发邮件
         if ($add['to_uid'] != $GLOBALS['ts']['mid'] || $add['app_uid'] != $GLOBALS['ts']['mid'] && $add['app_uid'] != '') {
             $author = model('User')->getUserInfo($GLOBALS['ts']['mid']);
             $config['name'] = $author['uname'];
             $config['space_url'] = $author['space_url'];
             $config['face'] = $author['avatar_middle'];
             $sourceInfo = model('Source')->getSourceInfo($add['table'], $add['row_id'], $forApi, $add['app']);
             $config['content'] = parse_html($add['content']);
             $config['ctime'] = date('Y-m-d H:i:s', time());
             $config['sourceurl'] = $sourceInfo['source_url'];
             $config['source_content'] = parse_html($sourceInfo['source_content']);
             $config['source_ctime'] = date('Y-m-d H:i:s', $sourceInfo['ctime']);
             if (!empty($add['to_uid'])) {
                 // 回复
                 $config['comment_type'] = '回复 我 的评论:';
                 model('Notify')->sendNotify($add['to_uid'], 'comment', $config);
             } else {
                 // 评论
                 $config['comment_type'] = '评论 我 的微博:';
                 if (!empty($add['app_uid'])) {
                     model('Notify')->sendNotify($add['app_uid'], 'comment', $config);
                 }
             }
         }
     }
     $this->error = $res ? L('PUBLIC_CONCENT_IS_OK') : L('PUBLIC_CONCENT_IS_ERROR');
     // 评论成功,评论失败
     return $res;
 }
开发者ID:naliduo,项目名称:ThinkSNS,代码行数:97,代码来源:CommentModel.class.php


示例13: regular_express

function regular_express($regexp_array, $thevar)
{
    #$regexp_array[2].='S'; # in benchmarks, this 'optimization' appeared to not do anything at all, or possibly even slow things down
    if ($regexp_array[0] == 1) {
        $newvar = preg_replace($regexp_array[2], $regexp_array[3], $thevar);
    } elseif ($regexp_array[0] == 2) {
        $addproxy = isset($regexp_array[4]) ? $regexp_array[4] : true;
        $framify = isset($regexp_array[5]) ? $regexp_array[5] : false;
        $newvar = parse_html($regexp_array[2], $regexp_array[3], $thevar, $addproxy, $framify);
    }
    return $newvar;
}
开发者ID:469306621,项目名称:Languages,代码行数:12,代码来源:surrogafier2.php


示例14: mysql_query

$sql = "select server, user, password, race, main_village, last_report from accounts where id = {$account}";
$res = mysql_query($sql);
if (!$res) {
    die(mysql_error());
}
$row = mysql_fetch_row($res);
if (!$row) {
    die("Account not found. {$account} \n");
}
$server = $row[0];
$url = "http://{$server}/dorf1.php";
$ch = my_curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
$all_id = parse_html($result);
$db_all = array();
$sql = "select id from villages where account = {$account}";
$res = mysql_query($sql);
if (!$res) {
    die(mysql_error());
}
while ($row = mysql_fetch_row($res)) {
    $id = $row[0];
    array_push($db_all, $id);
}
foreach ($all_id as $id => $val) {
    $name = mysql_escape_string($val[0]);
    $x = $val[1];
    $y = $val[2];
    if (in_array($id, $db_all)) {
开发者ID:GaryHuang-CL,项目名称:y1910061,代码行数:31,代码来源:reset.php


示例15: elseif

         echo '</fieldset>' . "\n";
         echo '</form>' . "\n";
     } else {
         echo 'nothing to do.';
     }
     // $file
 } elseif (isset($_POST['valider']) and !empty($_FILES['file']['tmp_name'])) {
     $message = array();
     switch ($_POST['imp-format']) {
         case 'jsonbak':
             $json = file_get_contents($_FILES['file']['tmp_name']);
             $message = importer_json($json);
             break;
         case 'htmllinks':
             $html = file_get_contents($_FILES['file']['tmp_name']);
             $message['links'] = insert_table_links(parse_html($html));
             break;
         case 'xmlwp':
             $xml = file_get_contents($_FILES['file']['tmp_name']);
             $message = importer_wordpress($xml);
             break;
         case 'rssopml':
             $xml = file_get_contents($_FILES['file']['tmp_name']);
             $message['feeds'] = importer_opml($xml);
             break;
         default:
             die('nothing');
             break;
     }
     if (!empty($message)) {
         echo '<form action="maintenance.php" method="get" class="bordered-formbloc">' . "\n";
开发者ID:CamTosh,项目名称:blogotext,代码行数:31,代码来源:maintenance.php


示例16: getUids

 /**
  * 获取@内容中的@用户
  * @param string $content @Me的相关内容
  * @param array $extra_uids 额外@用户UID
  * @param integer $row_id 资源ID
  * @param array $less_uids 去除@用户ID
  * @return array 用户UID数组
  */
 public function getUids($content, $extra_uids = null, $row_id, $less_uids = null)
 {
     // 正则匹配内容
     preg_match_all($this->_at_regex, $content, $matches);
     $unames = $matches[1];
     $map = "uname in ('" . implode("','", $unames) . "')";
     $ulist = model('User')->where($map)->field('uid')->findall();
     $matchuids = getSubByKey($ulist, 'uid');
     // 如果内容匹配中没有用户
     if (empty($matchuids) && !empty($extra_uids)) {
         // 去除@用户ID
         if (!empty($less_uids)) {
             foreach ($less_uids as $k => $v) {
                 if (in_array($v, $extra_uids)) {
                     unset($extra_uids[$k]);
                 }
             }
         }
         return is_array($extra_uids) ? $extra_uids : array($extra_uids);
     }
     // 如果匹配内容中存在用户
     $suid = array();
     foreach ($matchuids as $v) {
         !in_array($v, $suid) && ($suid[] = (int) $v);
     }
     // 去除@用户ID
     if (!empty($less_uids)) {
         foreach ($suid as $k => $v) {
             if (in_array($v, $less_uids)) {
                 unset($suid[$k]);
             }
         }
     }
     // 发邮件流程
     $author = model('User')->getUserInfo($GLOBALS['ts']['mid']);
     $content = model('Source')->getSourceInfo($this->_app_table, $row_id, false, $this->_app);
     $config['content'] = parse_html($content['source_content']);
     $config['publish_time'] = date('Y-m-d H:i:s', $content['ctime']);
     $config['feed_url'] = $content['source_url'];
     $config['name'] = $author['uname'];
     $config['space_url'] = $author['space_url'];
     $config['face'] = $author['avatar_small'];
     foreach ($suid as $u_v) {
         model('Notify')->sendNotify($u_v, 'atme', $config);
     }
     /*		if(in_array('atme',MailModel::$allowed)){
     			foreach($suid as $u_v){
     				$v = array('table'=>$this->_app_table,'app'=>$this->_app,'row_id'=>$row_id,'uid'=>$u_v);
     				$toUser = model('User')->getUserInfo($u_v);
                     $map['key'] = 'email';
                     $map['uid'] = $u_v;
                     $isEmail = D('user_privacy')->where($map)->field('value')->find();
                     if($isEmail['value'] == 0){
         				$content = model('Source')->getSourceInfo($v['table'],$v['row_id'],false,$v['app']);
         				//model('Mail')->send_email($toUser['email'],'atme','',array('content'=>parse_html($content['source_content'])));
                         model('Mail')->send_email($toUser['email'],$author['uname'].'在微博中@提到了您',parse_html($content['source_content']));
                     }
                     unset($map);
                     unset($isEmail);
     			}
     		}*/
     return array_unique(array_filter(array_merge($suid, (array) $extra_uids)));
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:71,代码来源:AtmeModel.class.php


示例17: foreach

    foreach ($C->RECORD_URLS as $site => $urls) {
        if (is_array($urls) && count($urls) == 0) {
            continue;
        }
        foreach ($urls as $k => $v) {
            $url = str_replace('*****', $v, $val);
            $cnt = 0;
            $tmp = FALSE;
            while ($cnt < 3 && ($tmp = @get_sources($url)) === FALSE) {
                $cnt++;
                sleep(4);
            }
            if (!$tmp) {
                $r[$key][$site][$v] = 0;
            } else {
                $r[$key][$site][$v] = parse_html($tmp);
                //$r[引擎类型][主站][搜索url]
            }
            ob_flush();
            flush();
            echo $v . " ======== " . $r[$key][$site][$v] . "\n";
            sleep(3);
            //抓取间隔5s
        }
    }
}
//var_dump($r);
//save
$timestamp = strtotime('last day');
$filename = date('Ym', $timestamp) . '.txt';
$today = getdate($timestamp);
开发者ID:chaobj001,项目名称:tt,代码行数:31,代码来源:get_record.php


示例18: cron_check_for_new_content

    function cron_check_for_new_content()
    {
        // caut combinatiile url, tag distincte pentru a cauta in net modificari 
        $distinct_tags = select("distinct(Concat_ws('_', url,tag)), url,tag", 'user_stuffs');
        
        if($distinct_tags)
            foreach($distinct_tags as $row)
            {
                //parsez html
                $result = parse_html($row['url'], $row['tag']);

                //daca nu mai pot identifica portiunea de cod html in mod unnic
                if(sizeof($result) != 1)
                {
                    $update = array(
                        'id'  => $row['id'],
                        'time_modified' => date('Y-m-d H:i:s'),
                        'status'  => 2 // not found
                    );
                    
                    insert('user_stuffs', $update,'id');
                }
                else
                {
                    $plaintext = md5($result->plaintext);
                    // daca s-a modificat, inregistrez in db
                    if($update['plaintext'] != $row['plaintext'])
                    {
                        $update = array(
                            'id'  => $row['id'],
                            'time_modified' => date('Y-m-d H:i:s'),
                            'status'  => 1,
                            'plaintext' => $plaintext
                        );

                        insert('user_stuffs', $update,'id');
                    }
                }
            }
    }
开发者ID:nicolaes,项目名称:WatchMyStuff,代码行数:40,代码来源:functions.php


示例19: get_href_from_anchor_tag

function get_href_from_anchor_tag($str)
{
    //      <a href="reference_detail.cfm?ref_number=58&type=Article">
    $beg = 'href="';
    $end1 = '">';
    return trim(parse_html($str, $beg, $end1, $end1, $end1, $end1, "", true));
    //exist on first match = true
}
开发者ID:eliagbayani,项目名称:maps_test,代码行数:8,代码来源:98.php


示例20: addReport

    public function addReport()
    {
        // 获取传入的值
        $post = $_POST;
        // 安全过滤
        foreach ($post as $key => $val) {
            $post[$key] = t($post[$key]);
        }
        // 过滤内容值
        $post['body'] = filter_keyword($post['body']);
        // 判断资源是否删除
        if (empty($post['curid'])) {
            $map['feed_id'] = $post['sid'];
        } else {
            $map['feed_id'] = $post['curid'];
        }
        $map['is_del'] = 0;
        $isExist = model('Feed')->where($map)->count();
        if ($isExist == 0) {
            $return['status'] = 0;
            $return['data'] = '内容已被删除,转发失败';
            exit(json_encode($return));
        }
        // 进行分享操作
        $return = model('Share')->shareFeed($post, 'share');
        if ($return['status'] == 1) {
            $app_name = $post['app_name'];
            // 添加积分
            if ($app_name == 'public') {
                model('Credit')->setUserCredit($this->uid, 'forward_weibo');
                //微博被转发
                $suid = model('Feed')->where($map)->getField('uid');
                model('Credit')->setUserCredit($suid, 'forwarded_weibo');
            }
            if ($app_name == 'weiba') {
                model('Credit')->setUserCredit($this->uid, 'forward_topic');
                //微博被转发
                $suid = D('Feed')->where('feed_id=' . $map['feed_id'])->getField('uid');
                model('Credit')->setUserCredit($suid, 'forwarded_topic');
            }
            $this->assign($return['data']);
            // 微博配置
            $weiboSet = model('Xdata')->get('admin_Config:feed');
            $this->assign('weibo_premission', $weiboSet['weibo_premission']);
            $html = '<dl class="comment_list">
					<dt><a href="' . $return['data']['user_info']['space_url'] . '"><img src="' . $return['data']['user_info']['avatar_tiny'] . '" width="30" height="30"/></a></dt>
					<dd>
					<p class="cont">' . $return['data']['user_info']['space_link'] . ':<em>' . str_replace('__THEME__', THEME_PUBLIC_URL, parse_html($return['data']['content'])) . '<span class="time">(' . friendlyDate($return['data']['publish_time']) . ')</span></em></p>
					<p class="right mt5"><span><a href="javascript:;" onclick="shareFeed(' . $return['data']['feed_id'] . ', ' . $return['data']['curid'] . ');">转发</a></span></p>
					</dd>
					</dl>';
            $return['data'] = $html;
        }
        exit(json_encode($return));
    }
开发者ID:lyhiving,项目名称:icampus,代码行数:55,代码来源:FeedAction.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP parse_ini_file函数代码示例发布时间:2022-05-15
下一篇:
PHP parse_form函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap