コード例 #1
0
 /**
  * 生成文章内容,注意:必须先生成标题!
  */
 function GenerateBody()
 {
     for ($i = 5; $i < 28; $i++) {
         $indexLib = $this->arrLibFeature[$i] . '.txt';
         $this->arrContent[$i] = GetContent($indexLib, $this->storyPath . $indexLib, $this->memcached, 0, $this->isMemcached);
     }
     $arrBody = $this->arrContent;
     //初始化插入一些数据
     $lenArrKeys = count($this->arrKeys);
     $arrOutLinks = explode('|', $this->outLink);
     $arrOutLinks[] = '';
     //比较方便的保证在foreach里面插入所有的外链。
     $lenArrOutLinks = count($arrOutLinks);
     foreach ($arrBody as $k => &$v) {
         if ($k == 0) {
             continue;
         }
         if ($k % 3 == 0) {
             $v .= '|' . $this->key;
         }
         if ($k % 4 == 0) {
             $v .= '|。<br>';
         }
         if ($k % $lenArrKeys == 0) {
             $v .= '|' . $this->arrKeys[(int) ($k / $lenArrKeys) - 1];
         }
         if ($k % $lenArrOutLinks == 0) {
             $v .= '|' . $arrOutLinks[(int) ($k / $lenArrOutLinks) - 1];
         }
     }
     $body = implode('|', $arrBody);
     $arrBody = explode('|', $body);
     for ($i = 0; $i < 6; $i++) {
         $arrBody = $this->JumbleArrayUseFeature($arrBody);
     }
     $body = implode('', $arrBody) . '。';
     $body = replace_dbs($body, '。');
     $this->body = $body;
 }
コード例 #2
0
ファイル: reads.php プロジェクト: baiyunping333/seo-marketing
function insertart($key, $keys, $a_no, $base_url)
{
    global $cfg_xs_url;
    $url = 'http://' . $base_url . 'reads-' . $a_no . 'html';
    $md5_url = md5($url);
    /*
     * 生成指纹序列
     * $body_sp:正文指纹序列
     * $choas_sp:乱序指纹序列
     */
    for ($i = 0; $i < 7; $i++) {
        //标题取第1个,文章28个指纹序列
        $body_sp[$i] = toTen(substr($md5_url, $i * 4, 4)) + 1;
        $body_sp[$i + 7] = toTen(substr($md5_url, $i * 4 + 1, 4)) + 1;
        $body_sp[$i + 14] = toTen(substr($md5_url, $i * 4 + 2, 4)) + 1;
        $body_sp[$i + 21] = toTen(substr($md5_url, $i * 4 + 3, 4)) + 1;
    }
    $choas_sp = str_split(toTen(substr($md5_url, 0, 8)) . toTen(substr($md5_url, 8, 8)) . toTen(substr($md5_url, 16, 8)) . toTen(substr($md5_url, 24, 8)), 1);
    /*
     * 副关键词
     */
    $arr_keys = explode(",", $keys);
    $arr_keys = arr_choas($arr_keys, $choas_sp);
    $key2 = $arr_keys[0];
    /*
     * 确定标题
     * 选取第一个文章。
     * 按指纹插入关键词。
     */
    $title = file_get_contents($cfg_xs_url . $body_sp[0] . ".txt");
    $body = $title;
    $arr_title = explode("|", $title);
    $arr_key = array($key, $key2);
    $title = arr_insertkey($arr_title, $choas_sp, $arr_key, 1);
    $title = preg_replace("%<[^>]+>%", ',', $title);
    //防止网址中字母被匹配
    $title = str_replace(array(',', '。', ':', '”', '“', '!', '……', '?', ';', ' ', ','), '', $title);
    $title = replace_db($title, '');
    $title = substr_utf8($title, 0, 20);
    /*
     * 确定描述
     * 选取28个文章。
     * 按指纹插入关键词。
     */
    for ($i = 0; $i < 28; $i++) {
        $temp = file_get_contents($cfg_xs_url . $body_sp[$i] . ".txt");
        $body .= '|' . $temp;
        if ($i % 5 > 3) {
            $body .= '<br>';
        }
    }
    $arr_body = explode('|', $body);
    $arr_key = explode(",", $key . ',' . $keys . ',' . $key . ',' . $key . ',' . $key);
    $body = arr_insertkey($arr_body, $choas_sp, $arr_key, 10);
    $body = replace_dbs($body, '.');
    $body = str_replace(' ', '', $body);
    //$body=substr_utf8($body,0,500);
    /*
     * 返回
     * $arr_res[]
     */
    $arr_res = array();
    $arr_res['title'] = $title;
    $arr_res['body'] = $body;
    return $arr_res;
}
コード例 #3
0
ファイル: index.php プロジェクト: baiyunping333/seo-marketing
function randart($key, $keys, $a_no, $base_url)
{
    global $cfg_xs_url;
    $url = 'http://' . $base_url . 'read-' . $a_no . 'html';
    $md5_url = md5($url);
    /*
     * 生成指纹序列
     * $art_sp:文章指纹序列
     * $choas_sp:乱序指纹序列
     */
    for ($i = 0; $i < 5; $i++) {
        //标题指纹序列
        $art_sp[$i] = toTen(substr($md5_url, $i * 4, 4)) + 1;
    }
    $choas_sp = str_split(toTen(substr($md5_url, 0, 8)) . toTen(substr($md5_url, 8, 8)) . toTen(substr($md5_url, 16, 8)) . toTen(substr($md5_url, 24, 8)), 1);
    /*
     * 副关键词
     */
    $arr_keys = explode(",", $keys);
    $arr_keys = arr_choas($arr_keys, $choas_sp);
    $key2 = $arr_keys[0];
    /*
     * 确定标题
     * 先从5个文本组合副关键词组合打乱一次
     * 再提取20字符,加入主关键词打乱一次
     */
    $title = '';
    $des = '';
    for ($i = 0; $i < 5; $i++) {
        $temp = file_get_contents($cfg_xs_url . $art_sp[$i] . ".txt");
        $title .= $temp . '|' . $key2;
        $des .= $temp;
    }
    $arr_title = explode("|", $title);
    $arr_title = arr_choas($arr_title, $choas_sp);
    //按指纹乱序标题
    $title = implode('|', $arr_title);
    $title = preg_replace("%<[^>]+>%", ',', $title);
    //防止网址中字母被匹配
    $title = str_replace(array(',', '。', ':', '”', '“', '!', '……', '?', ';', ' ', ','), '', $title);
    $title = replace_db($title, '');
    $title = substr_utf8($title, 0, 20);
    $arr_title = explode("|", $title . '|' . $key);
    $arr_title = arr_choas($arr_title, $choas_sp);
    $title = implode('', $arr_title);
    /*
     *  确定描述
     */
    if (rand(0, 10) > 7) {
        $arr_des = explode('|', $des . '|' . $key2 . '|' . $key);
    } else {
        $arr_des = explode('|', $des . '|' . $key);
    }
    shuffle($arr_des);
    $des = implode('', $arr_des);
    $des = replace_dbs($des, '.');
    $des = substr_utf8($des, 0, 500);
    /*
     * 返回
     * $arr_res[]
     */
    $arr_res = array();
    $arr_res['title'] = $title;
    $arr_res['des'] = $des;
    return $arr_res;
}
コード例 #4
0
ファイル: read.php プロジェクト: baiyunping333/seo-marketing
function readart($key, $keys, $a_no, $base_url)
{
    global $cfg_xs_url;
    $url = 'http://' . $base_url . 'read-' . $a_no . 'html';
    $md5_url = md5($url);
    /*
     * 生成指纹序列
     * $art_sp:文章指纹序列
     * $body_sp:正文指纹序列
     * $choas_sp:乱序指纹序列
     */
    for ($i = 0; $i < 7; $i++) {
        //标题5个,文章28个指纹序列
        $body_sp[$i] = toTen(substr($md5_url, $i * 4, 4)) + 1;
        $body_sp[$i + 7] = toTen(substr($md5_url, $i * 4 + 1, 4)) + 1;
        $body_sp[$i + 14] = toTen(substr($md5_url, $i * 4 + 2, 4)) + 1;
        $body_sp[$i + 21] = toTen(substr($md5_url, $i * 4 + 3, 4)) + 1;
        if ($i < 5) {
            $art_sp[$i] = $body_sp[$i];
        }
        //标题文章序列
    }
    $choas_sp = str_split(toTen(substr($md5_url, 0, 8)) . toTen(substr($md5_url, 8, 8)) . toTen(substr($md5_url, 16, 8)) . toTen(substr($md5_url, 24, 8)), 1);
    /*
     * 副关键词
     */
    $arr_keys = explode(",", $keys);
    $arr_keys = arr_choas($arr_keys, $choas_sp);
    $key2 = $arr_keys[0];
    /*
     * 确定标题
     * 先从5个文本组合副关键词组合打乱一次
     * 再提取20字符,加入主关键词打乱一次
     */
    $title = '';
    $des = '';
    for ($i = 0; $i < 5; $i++) {
        $temp = file_get_contents($cfg_xs_url . $art_sp[$i] . ".txt");
        $title .= $temp . '|' . $key2;
    }
    $body = $title;
    $arr_title = explode("|", $title);
    $arr_title = arr_choas($arr_title, $choas_sp);
    //按指纹乱序标题
    $title = implode('|', $arr_title);
    $title = preg_replace("%<[^>]+>%", ',', $title);
    //防止网址中字母被匹配
    $title = str_replace(array(',', '。', ':', '”', '“', '!', '……', '?', ';', ' ', ','), '', $title);
    $title = replace_db($title, '');
    $title = substr_utf8($title, 0, 20);
    $arr_title = explode("|", $title . '|' . $key);
    $arr_title = arr_choas($arr_title, $choas_sp);
    $title = implode('', $arr_title);
    /*
     *  确定正文
     */
    for ($i = 5; $i < 28; $i++) {
        $temp = file_get_contents($cfg_xs_url . $body_sp[$i] . ".txt");
        $body .= '|' . $temp;
        if ($i < 16) {
            $body .= '|' . $key . '|' . '。<br>';
        }
    }
    $arr_body = explode("|", $body);
    $arr_body = arr_choas($arr_body, $choas_sp);
    $body = implode('', $arr_body) . '。';
    $body = replace_dbs($body, '。');
    /*
     * 返回
     * $arr_res[]
     */
    $arr_res = array();
    $arr_res['title'] = $title;
    $arr_res['body'] = $body;
    return $arr_res;
}