大家好,我想在我的插件里面改个东西,能不能在标题前面插入我要的关键词?

set_time_limit(270);

error_reporting(E_ERROR | E_WARNING | E_PARSE);

define('TITLE_SEPAR', 'xxx**xxx');

define('TITLE_SEPAR2', '262661');

$url = '这里填写你的小发猫伪原创API地址';

$content_tag_name = '内容';

$headdd = '';

$taill = '';

switch($LabelArray['PageType'])

{

case 'List'://处理列表页,只能处理html

break;

case 'Pages'://处理多页,只能处理html

break;

case 'Content'://处理默认页,只能处理html

break;

case 'Save'://只有保存时是可以处理标签值的

// 保存原文

try {

/**********************************************************************/

// 这一步用来获取伪原创文章

/**********************************************************************/

$title = $LabelArray['标题'];

$title = '标题:'.$title;

$content = $LabelArray[$content_tag_name];

$article_src = compose_article($title, $content);

$article_src_b = $article_src;

$article_new = get_wyc_article($article_src);

$title_wyc = trim($article_new[0]);

$content_wyc = trim($article_new[1]);

$content_wyc = fix_newline($content_wyc);

$LabelArray[$content_tag_name] = $headdd. $content_wyc. $taill;

$title_wyc = str_replace(array('。',',','%'), array(' ',' ',' '), $title_wyc);

$LabelArray['标题'] = $title_wyc;

}

catch (Exception $e) {

$LabelArray['标题'] .= $e->getMessage();

$LabelArray[$content_tag_name] .= $e->getMessage();

}

break;

default:

//$LabelArray[$content_tag_name]=curl_request($url, array('wenzhang'=>$LabelArray[$content_tag_name] ));

}

echo serialize($LabelArray);

function compose_article($title, $content) {

$separator = compose_separator();

return $title.$separator.$content;

}

function compose_separator() {

return PHP_EOL.'('.TITLE_SEPAR2.')'.PHP_EOL;

}

function fix_separator($article) {

return $article;

}

function get_wyc_article($str) {

global $url;

$separator = compose_separator();

$separator = str_replace(PHP_EOL, '', $separator);

$wyc = curl_request($url, array('wenzhang'=>$str));

$wyc_f = $wyc;

$wyc = fix_separator($wyc);

$wyc = explode($separator, $wyc);

if (isset($wyc[0])){

$wyc[0] = trim($wyc[0]);

$wyc[0] = ltrim($wyc[0], '标题');

$wyc[0] = ltrim($wyc[0], '目:');

$wyc[0] = ltrim($wyc[0], ':');

$wyc[0] = ltrim($wyc[0], ':');

}

//if (isset($wyc[1])) $wyc[1] = trim($wyc[1]);

//$wyc[1] = $wyc_f.'jjjjjjjj'.$wyc[1];

return $wyc;

}

function get_wyc_title($str) {

$title = get_wyc_article($str.PHP_EOL.PHP_EOL.PHP_EOL.$str.PHP_EOL.PHP_EOL.PHP_EOL.$str);

$title = fix_newline($title);

$title = explode(PHP_EOL, $title);

return $title[0];

}

function get_keywords($title, $contents) {

$url_kw = 'xx';

$kws = curl_request($url_kw, array(

'title'=>$title,

'len'=>100,

'text'=>$contents));

return $kws;

}

function remove_alt($contents) {

$contents = preg_replace('/alt=\"(.*)\"/', '', $contents);

return $contents;

}

function fix_title($contents) {

$punctuation_symbol = array('。', '?', ',', ':', ';', '、', '!',

'.',  '?',  ',',  ':',  ';', '!');

$contents = str_replace($punctuation_symbol, '', $contents);

return $contents;

}

function br2newline($contents) {

$contents = str_replace('
', PHP_EOL, $contents);

$contents = str_replace('
', PHP_EOL, $contents);

$contents = str_replace('
', PHP_EOL, $contents);

$contents = str_replace('
', PHP_EOL, $contents);

$contents = str_replace('
', PHP_EOL, $contents);

$contents = str_replace('
', PHP_EOL, $contents);

return $contents;

}

function newline2br($contnets) {

$contnets = str_replace(PHP_EOL, "
", $contnets);

//    $contnets = str_replace('>

$contnets = str_replace('

', '

', $contnets);

return $contnets;

}

function delete_newline($contents) {

$contents = fix_newline($contents);

//    $contents = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $contents);

//    $contents = str_replace('>'.PHP_EOL, '>', $contents);

return $contents;

}

function reset_newline_win($contents) {

// 优化换行符

$contents = str_replace("\r\n", "\n", $contents);

$contents = str_replace("\r", "\n", $contents);

$contents = str_replace("\n", PHP_EOL, $contents);

return $contents;

}

function fix_newline($data) {

$data = str_replace("\r", "\n", $data);

while(strpos($data, "\n\n") !== false) {

$data = str_replace("\n\n", "\n", $data);

}

$data = str_replace("\n", PHP_EOL, $data);

return $data;

}

function clean_contents($contents) {

//    $str = preg_replace('#\s/]+)[^>]*>#','', $contents);

//    return $str;

$sa = new cleanHtml;

$sa->allow = array( 'src' );

$sa->exceptions = array(

'img' => array( 'src', 'alt' ),

//'a' => array( 'href', 'title' ),

'iframe'=>array('src','frameborder'),

);

$str = $sa->strip( $contents );

return $str;

}

function xfm_strong_str_replace_once($search, $replace, $subject) {

$firstChar = strpos($subject, $search);

if($firstChar !== false) {

$beforeStr = substr($subject,0,$firstChar);

$afterStr = substr($subject, $firstChar + strlen($search));

return $beforeStr.$replace.$afterStr;

} else {

return $subject;

}

}

//参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies

function curl_request($url,$post='',$cookie='', $returnCookie=0){

if (! extension_loaded('curl')) {

file_exists('./ext/php_curl.dll') && dl('php_curl.dll'); // 加载扩展

}

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $url);

curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)');

if (ini_get('open_basedir') == '' && strtolower(ini_get('safe_mode')) != 'on'){

curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);

}

curl_setopt($curl, CURLOPT_AUTOREFERER, 1);

curl_setopt($curl, CURLOPT_REFERER, "http://XXX");

if($post) {

curl_setopt($curl, CURLOPT_POST, 1);

curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));

}

if($cookie) {

curl_setopt($curl, CURLOPT_COOKIE, $cookie);

}

curl_setopt($curl, CURLOPT_HEADER, $returnCookie);

curl_setopt($curl, CURLOPT_TIMEOUT, 150);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($curl);

if (curl_errno($curl)) {

return curl_error($curl);

}

curl_close($curl);

if($returnCookie){

list($header, $body) = explode("\r\n\r\n", $data, 2);

preg_match_all("/Set\-Cookie:([^;]*);/", $header, $matches);

$info['cookie']  = substr($matches[1][0], 1);

$info['content'] = $body;

return $info;

}else{

return $data;

}

}

//echo $tag;

// 计算中文字符串长度

function utf8_strlen($string = null) {

// 将字符串分解为单元

preg_match_all("/./us", $string, $match);

// 返回单元个数

return count($match[0]);

}

function reg_escape( $str )

{

$conversions = array( "^" => "\^", "[" => "\[", "." => "\.", "$" => "\$", "{" => "\{", "*" => "\*", "(" => "\(", "\\" => "\\\\", "/" => "\/", "+" => "\+", ")" => "\)", "|" => "\|", "?" => "\?", " "\" => "\>" );

return strtr( $str, $conversions );

}

/**

* Strip attribute Class

* Remove attributes from XML elements

* @author David (semlabs.co.uk)

* @version 0.2.1

*/

class cleanHtml{

public $str         = '';

public $allow       = array();

public $exceptions  = array();

public $ignore      = array();

public function strip( $str )

{

$this->str = $str;

if( is_string( $str ) && strlen( $str ) > 0 )

{

$res = $this->findElements();

if( is_string( $res ) )

return $res;

$nodes = $this->findAttributes( $res );

$this->removeAttributes( $nodes );

}

return $this->str;

}

private function findElements()

{

# Create an array of elements with attributes

$nodes = array();

preg_match_all( "/\n]+)([^>]*)>/i", $this->str, $elements );

foreach( $elements[1] as $el_key => $element )

{

if( $elements[2][$el_key] )

{

$literal = $elements[0][$el_key];

$element_name = $elements[1][$el_key];

$attributes = $elements[2][$el_key];

if( is_array( $this->ignore ) && !in_array( $element_name, $this->ignore ) )

$nodes[] = array( 'literal' => $literal, 'name' => $element_name, 'attributes' => $attributes );

}

}

# Return the XML if there were no attributes to remove

if( !$nodes[0] )

return $this->str;

else

return $nodes;

}

private function findAttributes( $nodes )

{

# Extract attributes

foreach( $nodes as &$node )

{

preg_match_all( "/([^ =]+)\s*=\s*[\"|']{0,1}([^\"']*)[\"|']{0,1}/i", $node['attributes'], $attributes );

if( $attributes[1] )

{

foreach( $attributes[1] as $att_key => $att )

{

$literal = $attributes[0][$att_key];

$attribute_name = $attributes[1][$att_key];

$value = $attributes[2][$att_key];

$atts[] = array( 'literal' => $literal, 'name' => $attribute_name, 'value' => $value );

}

}

else

$node['attributes'] = null;

$node['attributes'] = $atts;

unset( $atts );

}

return $nodes;

}

private function removeAttributes( $nodes )

{

# Remove unwanted attributes

foreach( $nodes as $node )

{

# Check if node has any attributes to be kept

$node_name = $node['name'];

$new_attributes = '';

if( is_array( $node['attributes'] ) )

{

foreach( $node['attributes'] as $attribute )

{

if( ( is_array( $this->allow ) && in_array( $attribute['name'], $this->allow ) ) || $this->isException( $node_name, $attribute['name'], $this->exceptions ) )

$new_attributes = $this->createAttributes( $new_attributes, $attribute['name'], $attribute['value'] );

}

}

$replacement = ( $new_attributes ) ? "" : "";

$this->str = preg_replace( '/'. reg_escape( $node['literal'] ) .'/', $replacement, $this->str );

}

}

private function isException( $element_name, $attribute_name, $exceptions )

{

if( array_key_exists($element_name, $this->exceptions) )

{

if( in_array( $attribute_name, $this->exceptions[$element_name] ) )

return true;

}

return false;

}

private function createAttributes( $new_attributes, $name, $value )

{

if( $new_attributes )

$new_attributes .= " ";

$new_attributes .= "$name=\"$value\"";

return $new_attributes;

}

}

?>

php标题伪原创,火车头伪原创插件PHP版,如何在标题前面插入关键词?(悬赏1元) - 搜外SEO问答...相关推荐

  1. 火车头伪原创php,使用网站采集软件必备伪原创秘笈

    相信许多站长都曾为文章伪原创感到困惑,本人身为一个站长,经过长时间的网站采集实践,琢磨出一套全面的伪原创方法,操作用到的网站采集软件是火车采集器V9,下面来给大家一一讲解. 伪原创第一步:找到好的文章 ...

  2. 文章采集伪原创工具_伪原创文章技巧(如何提高伪原创文章的原创度)

    伪原创是目前最鲜为人知的文章处理方式,做seo网站优化的也许知道,目前传统的文章伪原创方式的作用已经是越来越低了,所以我们文章在做伪原创时必须要提高伪原创文章的原创度,这样才能让搜索引擎更加信任我们, ...

  3. SEO原创和伪原创文章的一些技巧

    以下分享一些然然最近学到的一些SEO优化的技巧,希望做SEO优化的工作人员可以学好谷歌优化工具,在优化的过程中多注意一些优化细节. 一.网站内容关键词的选定是根据自动分词 很多做网站SEO优化的工作人 ...

  4. 伪原创文章技巧(如何提高伪原创文章的原创度)

    伪原创是目前最鲜为人知的文章处理方式,做seo网站优化的也许知道,目前传统的文章伪原创方式的作用已经是越来越低了,所以我们文章在做伪原创时必须要提高伪原创文章的原创度,这样才能让搜索引擎更加信任我们, ...

  5. 文章采集伪原创工具_卓尔博通|如何把伪原创文章变成原创

    原创内容一致都是搜多引擎所喜的内容,很多SEOer不会有专门的时间进行原创,都会进行伪原创,所以如何把伪原创变成原创是一个非常重要的内容.那我们应该如何做好伪原创呢?下面,我们就来一起了解一下! 怎样 ...

  6. 文章伪原创-文章伪原创工具

    伪原创原理 文章伪原创的原理是将一篇原始文章进行修改.改写.调整或者替换一些词句等方式,生成与原始文章类似但又不完全相同的新文章. 文章伪原创的实现需要用到自然语言处理技术和相关的算法.具体的过程包括 ...

  7. 伪原创视频 审核 原创视频md5

             伪原创视频 审核 原创视频md5          但是在内容为王和粉丝经济的背景下,现在进入还不算晚.至于如何真正把抖音短视频做起来                      在短 ...

  8. PHP同义词伪原创程序V1.0 修复增强版 自带4万+词库

    介绍 PHP同义词伪原创程序V1.0 修复增强版 自带4万+词库是专门生成原创及伪原创文章的在线工具,可以把在互联网上复制的文章瞬间变成原创文章.本工具是一款免费的专业伪原创工具,专门针对谷歌.百度. ...

  9. 抖音视频如何伪原创 视频md5修改器安卓版下载

             抖音视频如何伪原创 视频md5修改器安卓版下载          毋庸置疑的是,技术也是一把双刃剑,大荧幕上无数的科幻作品中都多多少少会表露此方面的担忧.               ...

  10. 批量伪原创工具-伪原创api-伪原创

    相信很多做网站优化的人或多或少都知道伪原创,那什么是伪原创呢?我们如何确定一篇文章是否为伪原创?对于没搞过这个的建议先看看从哪里入手SEO内容让自己有个基本的了解. 一个搜索引擎网站内容检测的时候有两 ...

最新文章

  1. 非递归一次性加载分类数据到TreeViw
  2. 【思维导图】redis
  3. python中break和continue区别_Shell break和continue跳出循环详解
  4. 为什么说spark不稳定
  5. 18--两数之和 II - 输入有序数组
  6. java 成员函数_Java继承中成员变量和成员函数的覆盖
  7. cgi php是什么意思,cgi,fastcgi,php-cgi,php-fpm 是什么
  8. 对文字颜色从左到右(横向)渐变的一点理解(坑)
  9. Android已有的原生Camera框架中加入自己的API的实现方案。
  10. 卸载adobe系列产品工具
  11. 贝叶斯决策论(一):贝叶斯决策理论
  12. MACD:黄白线、红绿柱与0轴关系
  13. PCB封装-正片与负片
  14. 原始套接字Raw Socket基础-- WSADATA wsaData(转)
  15. Photoshop-Camera Raw滤镜
  16. excel筛选中文或者筛选数字
  17. 局域网终端准入控制经典案例,不用SDN。
  18. 阶段二第一部分:第2章 Nginx进阶与实战
  19. 小程序商城和社区团购小程序,商家应该选哪个?
  20. Zabbix设置主动模式与被动模式

热门文章

  1. nexus上传Jar包Anti cross-site request forgery token mismatch
  2. 用微课学计算机应用基础--PPT制作
  3. Chrome将网页背景变成黑色(真正的夜间模式、深色模式)
  4. RFID全面梳理(超高频)
  5. 增强型绿植植被指数_植被指数--数据产品-国家青藏高原科学数据中心
  6. 管家婆服务器端口修改,211端口被占用,如何设置
  7. MTK车载平台实现MIPI转LVDS驱动移植
  8. 序章:企业潜规则认知
  9. 图像风格迁移及代码实现
  10. PTC Creo 8.0.0.0 x64 Multilingual