當前位置: 首頁>>代碼示例>>PHP>>正文


PHP parse_html函數代碼示例

本文整理匯總了PHP中parse_html函數的典型用法代碼示例。如果您正苦於以下問題:PHP parse_html函數的具體用法?PHP parse_html怎麽用?PHP parse_html使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了parse_html函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的parse_html函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。