예제 #1
0
 /**
  * Get the string representation of this backtrace
  * @return string
  */
 public function __toString()
 {
     try {
         $trace = $this->getSane(0);
         $output = [];
         foreach ($trace as $n => $fragment) {
             $output[] = $this->toStringTraceComponent($n, $fragment);
         }
         return implode("\n", $output);
     } catch (\Exception $e) {
         d_e($e);
         die;
     }
 }
예제 #2
0
function get_single_article($content, $url, $args = array())
{
    global $_G;
    extract($args);
    if (strlen(trim($content)) < 1) {
        return;
    }
    d_s('evo');
    $get_type = $_GET['get_type'] ? intval($_GET['get_type']) : $get_type;
    $get_type = $get_type ? $get_type : 1;
    $milu_set = pick_common_get();
    $rules_info = match_rules($url, $content, $get_type, 0);
    if (is_array($rules_info)) {
        pload('F:fastpick');
        $data = rules_get_article($content, $rules_info);
        write_evo_errlog($data, $url, $rules_info);
    } else {
        $data = (array) cloud_match_rules($get_type, $url, $content);
        //从云端下载规则 这里应该做点优化,暂时没想到方法。
        if (!$data['content'] && $milu_set['fp_open_auto'] == 1) {
            //开启智能获取
            pload('C:HtmlExtractor');
            pload('F:article');
            $he = new HtmlExtractor($content, $url);
            $data = (array) $he->get_text();
            $data['content'] = dz_attach_format($url, $data['content']);
            $arr = format_article_imgurl($url, $data['content']);
            $data['content'] = $arr['message'];
            $del_dom_rules = array('div[id*=share]', 'div[class*=page]');
            foreach ($del_dom_rules as $k => $v) {
                $data['content'] = dom_filter_something($data['content'], $v, 2);
            }
            unset($data['evo_title_info']);
        }
    }
    if ($_GET['type'] == 'bbs') {
        $data['content'] = media_htmlbbcode($data['content'], $url);
        $data['content'] = img_htmlbbcode($data['content'], $url);
    }
    $data['evo_time'] = d_e(0, 'evo');
    return $data;
}
예제 #3
0
function get_show_arr($now_get, $success_count, $get_count, $all_get_time = 0, $end = 1)
{
    $pro = ceil(100 * ($success_count / $get_count));
    if ($pro == 101 || $pro > 101) {
        return FALSE;
    }
    if ($end == 1) {
        $get_time = d_e(0);
    }
    $all_get_time += $get_time;
    $avg_get_time = $success_count > 0 ? $all_get_time / $success_count : 0;
    $wait_count = $get_count - $success_count;
    $wait_time = $avg_get_time * $wait_count;
    if (function_exists('php_set')) {
        $memory = 100 * (get_memory() / php_set('memory_limit'));
        $memory = $memory || $memory != 0 ? sprintf('%.0f%%', $memory) : milu_lang('un_know');
    }
    $show_arr = array('pro' => $pro, 'wait_time' => $wait_time, 'memory' => $memory, 'wait_count' => $wait_count, 'now' => $now_get, 'all_get_time' => $all_get_time);
    return $show_arr;
}
예제 #4
0
function fast_pick()
{
    global $_G;
    d_s('f_g');
    d_s('g_t');
    pload('F:spider');
    $url = $_GET['url'];
    $content = get_contents($url, array('cache' => -1));
    $get_time = d_e(0, 'g_t');
    $type = $_GET['type'] ? $_GET['type'] : 'bbs';
    $milu_set = pick_common_get();
    $data = (array) get_single_article($content, $url);
    if ($milu_set['fp_word_replace_open'] == 1 && !VIP) {
        //开启同义词替换
        $words = get_replace_words();
        if ($data['title']) {
            $data['title'] = strtr($data['title'], $words);
        }
        if ($data['content']) {
            $data['content'] = strtr($data['content'], $words);
        }
    }
    if ($milu_set['fp_article_from'] == 1) {
        //开启来源
        $data['fromurl'] = $url;
        if ($type == 'bbs' && $data['content']) {
            $data['content'] .= "[p=30, 2, left]" . milu_lang('article_from') . ':' . $url . "[/p]";
        }
    }
    $data['get_text_time'] = $get_time;
    $data['all_get_time'] = d_e(0, 'f_g');
    $data = $data ? $data : array();
    $data = js_base64_encode($data);
    $re = json_encode($data);
    return $re;
}
예제 #5
0
 function get_pick_status($end = 0)
 {
     $get_count = $this->get_pick_count();
     if ($end == 1) {
         $get_time = d_e(0, 'run');
         $this->all_get_time += $get_time;
         $this->pick_cache_data['all_get_time'] = $this->all_get_time;
     }
     if ($get_count) {
         $pro = ceil(100 * ($this->i / $get_count));
         if ($pro == 101 || $pro > 101) {
             return;
         }
         $avg_get_time = $this->all_get_time / $this->i;
         $wait_count = $get_count - $this->i;
         $wait_time = $avg_get_time * $wait_count;
     } else {
         $pro = $wait_time = $wait_count = milu_lang('un_know');
     }
     if (function_exists('php_set')) {
         $memory = 100 * (get_memory() / php_set('memory_limit'));
         $memory = $memory || $memory != 0 ? sprintf('%.0f%%', $memory) : milu_lang('un_know');
     }
     $wait_time = is_numeric($wait_time) ? round($wait_time) : $wait_time;
     $this->status_arr = array('pro' => $pro, 'wait_time' => $wait_time, 'memory' => $memory, 'wait_count' => $wait_count, 'now' => $this->i);
     $this->status_arr = array_merge($this->status_arr, $this->msg_args);
 }