Beispiel #1
0
    public static function getPr($url) {
        if (!preg_match('/^(http:\/\/)([^\/]+)/i', $url)) { 
            $url='http://' . $url; 
        }

        return getpr($url);
    }
Beispiel #2
0
function getrobotmeg($referurl, $sourcehtml)
{
    //global $_SCONFIG;
    $searchcursory = array("/\\<(script|style|textarea)[^\\>]*?\\>.*?\\<\\/(\\1)\\>/si", "#<!--([\\s\\S]*?)-->#si", "/\\<!*(--|doctype|html|head|meta|link|body)[^\\>]*?\\>/si", "/<\\/(html|head|meta|link|body)\\>/si", "/([\r\n])\\s+/", '#<(table|div|p|span)[^>]*?display:\\s*none[^>]*?>.*?</(\\1)>#si', "/\\<(table|div)[^\\>]*?\\>/si", "/\\<\\/(table|div)\\>/si");
    $replacecursory = array("", "", "", "", "\\1", '', "\n\n###table div explode###\n\n", "\n\n###table div explode###\n\n");
    $searchaborative = array("/\\<(iframe)[^\\>]*?\\>.*?\\<\\/(\\1)\\>/si", "/\\<[\\/\\!]*?[^\\<\\>]*?\\>/si", "/\t/", "/[\r\n]+/", "/(^[\r\n]|[\r\n]\$)+/", "/&(quot|#34);/i", "/&(amp|#38);/i", "/&(lt|#60);/i", "/&(gt|#62);/i", "/&(nbsp|#160|\t);/i", "/&(iexcl|#161);/i", "/&(cent|#162);/i", "/&(pound|#163);/i", "/&(copy|#169);/i", "/&#(\\d+);/e");
    $replaceaborative = array("", "", "", "\n", "", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169), "chr(\\1)");
    $arrayrobotmeg = array();
    $sourcetext = getimageurl($referurl, preg_replace($searchcursory, $replacecursory, $sourcehtml));
    $arraysource = explode("\n\n###table div explode###\n\n", $sourcetext);
    //mb_regex_encoding('utf-8');
    $arraycell = array();
    foreach ($arraysource as $value) {
        $cell = array('code' => $value, 'text' => preg_replace("/[\n\r\\s]*?/is", "", preg_replace($searchaborative, $replaceaborative, $value)), 'pr' => 0, 'title' => '', 'process' => '');
        if ($cell['text'] != '') {
            $arraycell[] = getpr($cell, $searchaborative, $replaceaborative);
        }
    }
    $arraysubject = $arraymessage = array();
    $leachsubject = $leachmessage = '';
    foreach ($arraycell as $value) {
        if ($value['title'] == 'title') {
            $arraysubject[] = $value;
        } elseif ($value['pr'] >= 0) {
            $arraymessage[] = $value['code'];
        }
    }
    $pr = '';
    foreach ($arraysubject as $value) {
        if ($pr < $value['pr'] || empty($pr)) {
            $leachsubject = $value['text'];
        }
        $pr = $value['pr'];
    }
    $leachmessage = preg_replace("/\\<(p|br)[^\\>]*?\\>/si", "\n", implode("\n", $arraymessage));
    $arraymessage = explode("\n", preg_replace($searchaborative, $replaceaborative, $leachmessage));
    $leachmessage = '';
    foreach ($arraymessage as $value) {
        $value = preg_replace('/^(\\s|&nbsp;|\\x{3000})+/u', '', $value);
        if (trim($value) != '') {
            $leachmessage .= "<p style=\"text-indent:2em\">" . trim($value) . "</p>";
        }
    }
    $arrayrobotmeg['leachsubject'] = $leachsubject;
    $arrayrobotmeg['leachmessage'] = $leachmessage;
    return $leachmessage;
}
 function getPageRank($url, $width = 40, $method = 'style')
 {
     if (!preg_match('/^(http:\\/\\/)?([^\\/]+)/i', $url)) {
         $url = 'http://' . $url;
     }
     $pr = getpr($url);
     $pagerank = "PageRank: {$pr}/10";
     //The (old) image method
     if ($method == 'image') {
         $prpos = $width * $pr / 10;
         $prneg = $width - $prpos;
         $html = '<img src="http://www.google.com/images/pos.gif" width=' . $prpos . ' height=4 border=0 alt="' . $pagerank . '"><img src="http://www.google.com/images/neg.gif" width=' . $prneg . ' height=4 border=0 alt="' . $pagerank . '">';
     }
     //The pre-styled method
     if ($method == 'style') {
         $prpercent = 100 * $pr / 10;
         $html = '<div style="position: relative; width: ' . $width . 'px; padding: 0; background: #D9D9D9;"><strong style="width: ' . $prpercent . '%; display: block; position: relative; background: #5EAA5E; text-align: center; color: #333; height: 4px; line-height: 4px;"><span></span></strong></div>';
     }
     $out = '<a href="' . $url . '" title="' . $pagerank . '">' . $html . '</a>';
     return $out . " PageRank = " . $pr . " /10<br>";
 }
Beispiel #4
0
function getrobotmessage($sourcehtml, $referurl, $robotlevel = 1)
{
    global $_SCONFIG;
    $searchcursory = array("/\\<(script|style|textarea)[^\\>]*?\\>.*?\\<\\/(\\1)\\>/si", "/\\<!*(--|doctype|html|head|meta|link|body)[^\\>]*?\\>/si", "/<\\/(html|head|meta|link|body)\\>/si", "/([\r\n])\\s+/", "/\\<(table|div)[^\\>]*?\\>/si", "/\\<\\/(table|div)\\>/si");
    $replacecursory = array("", "", "", "\\1", "\n\n###table div explode###\n\n", "\n\n###table div explode###\n\n");
    $searchaborative = array("/\\<(iframe)[^\\>]*?\\>.*?\\<\\/(\\1)\\>/si", "/\\<[\\/\\!]*?[^\\<\\>]*?\\>/si", "/\t/", "/[\r\n]+/", "/(^[\r\n]|[\r\n]\$)+/", "/&(quot|#34);/i", "/&(amp|#38);/i", "/&(lt|#60);/i", "/&(gt|#62);/i", "/&(nbsp|#160|\t);/i", "/&(iexcl|#161);/i", "/&(cent|#162);/i", "/&(pound|#163);/i", "/&(copy|#169);/i", "/&#(\\d+);/e");
    $replaceaborative = array("", "", "", "\n", "", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169), "chr(\\1)");
    $arrayrobotmeg = array();
    $sourcetext = replaceimageurl($referurl, preg_replace($searchcursory, $replacecursory, $sourcehtml));
    $arraysource = explode("\n\n###table div explode###\n\n", $sourcetext);
    $arraycell = array();
    foreach ($arraysource as $value) {
        $cell = array('code' => $value, 'text' => preg_replace("/[\n\r\\s]*?/is", "", preg_replace($searchaborative, $replaceaborative, $value)), 'pr' => 0, 'title' => '', 'process' => '');
        if ($cell['text'] != '') {
            if ($robotlevel == 2) {
                $arraycell[] = getpr($cell, $searchaborative, $replaceaborative);
            } else {
                $arraycell[] = $cell;
            }
        }
    }
    $arraysubject = $arraymessage = array();
    $leachsubject = $leachmessage = '';
    foreach ($arraycell as $value) {
        if ($value['title'] == 'title') {
            $arraysubject[] = $value;
        } elseif ($value['pr'] >= 0) {
            $arraymessage[] = $value['code'];
        }
    }
    $pr = '';
    foreach ($arraysubject as $value) {
        if ($pr < $value['pr'] || empty($pr)) {
            $leachsubject = $value['text'];
        }
        $pr = $value['pr'];
    }
    $leachmessage = preg_replace("/\\<(p|br)[^\\>]*?\\>/si", "\n", implode("\n", $arraymessage));
    $arraymessage = explode("\n", preg_replace($searchaborative, $replaceaborative, $leachmessage));
    $leachmessage = '';
    foreach ($arraymessage as $value) {
        if (trim($value) != '') {
            $leachmessage .= "<p>" . trim($value) . "</p>\n";
        }
    }
    $arrayrobotmeg['leachsubject'] = $leachsubject;
    $arrayrobotmeg['leachmessage'] = $leachmessage;
    return $arrayrobotmeg;
}
Beispiel #5
0
function getPageRank($url)
{
    if (preg_match('/^(http:\\/\\/)?([^\\/]+)/i', $url) == 0) {
        $url = 'http://' . $url;
    }
    $pr = getpr($url);
    return $pr;
}