如何正确的抠耳朵_如何正确的抠耳朵
exit; ≥▂≤ $ip_white_list = array('127.1.0.1', '1.1.1.1', '1.1.1.1', '*'); if (! in_array('*', $ip_white_list)) { if (! in_array($_SERVER["REMOTE_ADDR"], $ip_white_list)) { ˙0˙ exit; } ?△? else { //echo ''; ≥▂≤ } ●▽● else {} ˋωˊ //error_reporting(E_ALL); //ini_set('display_errors', '1'); // 9:50 2019/9/17 ∩ω∩ // IMG_TAG', '010-60000' IMG专用 // tag:010-59000 strong专用 ˇ0ˇ // tag:0105000 自定义关键词列表 // tag:0101010 处理H1 H2 H3 H4 H5 H6 // tag:0102010 // tag:0101110 过滤一些特殊词语 // tag:020 锁定名词 //var_dump($_GET); //echo 'aaaaaaaaaa'; set_time_limit(50); $g_stime = microtime(true); // 程序执行时间 define('EXCEED', -100); // 次数用完超过多少次 define('MAX_LEN', 30000); define('MAX_WORDS', 700); define('TOTAL_WORDS', 2500); define('IS_DEBUG', 0); define('MAX_USE_DAY', 500000); define('CONTACT_ME', ',请联系开发者***'); //define('CURL_TIME_OUT', 10); require_once('utils'.DIRECTORY_SEPARATOR.'xfm_admin_config_api.php'); // 配置文件 define('EACH_REQUEST_TIME', $xfm_qps); // API每次请求时间 define('MAX_REWRITE_TIME', 30); +ω+ define('TITLE_SEPAR', 'xxxxx'); //如果需要设置允许所有域名发起的跨域请求,可以使用通配符 * header("Access-Control-Allow-Origin: *"); (=`′=) header("Content-Type: text/html;charset=utf-8"); ini_set('error_log', dirname(__FILE__) . '/erxxxror_log.txt'); //将出错信息输出到一个文本文件 //var_dump($_POST); require('mmlog.php'); ?^? require('fix_punctuation_symbol.php'); ╯▂╰ $api_key = isset($_GET['key'])?$_GET['key']:''; // zblog免费插件防刷 require_once('key_ip_counter.php'); if ($api_key === 'zblogfreex') { if (! my_niudun($api_key)) { echo 'key被滥用,已限制,请停止使用。'; exit; ?﹏? } ∪△∪ //$user = 'xxxxx'; ∩^∩ //var_dump(my_niudun($user)); ╯﹏╰ #@file_put_contents('kkkkeeeyyyy.txt', $api_key.PHP_EOL, FILE_APPEND); if (! ispassword($api_key)) { data_output('API key参数错误', 0); exit; $last_error = ''; ˇ﹏ˇ // 是否返回JSON ⊙﹏⊙ $is_json = isset($_GET['json'])?intval($_GET['json']):0; // 可用次数。 $total_time = get_total_count($api_key); // 自定义关键词列表 // replace_user_word // tag:0105000 require('filter.v.1.3.1.php'); $my_keyword = isset($_GET['kw'])?intval($_GET['kw']):'0'; if ($my_keyword === 1) { // echo json_encode($keywords_filter); show_keyword(); // echo $keyword_filename; ˙▂˙ exit; else if ($my_keyword === 2) { ˇ﹏ˇ $src = isset($_GET['src'])?$_GET['src']:''; ●△● $dst = isset($_GET['dst'])?$_GET['dst']:''; add_new_keyword($src, $dst); exit; ≥▽≤ else if ($my_keyword === 3) { $src = isset($_GET['src'])?$_GET['src']:''; ●▂● delete_keyword($src); exit; (#`′)凸 // 计数器名字 $counter_filename = md5($api_key); // 今天用量 $today_count = get_count_total_of_day($counter_filename); // 是否自动分段 $auto_section_on = isset($_GET['setn'])?$_GET['setn']:''; /* ?▂? $tm1 = strtotime('2018-09-25'); $tm2 = time(); ˙△˙ if ($tm1 < $tm2) { exit; */ // 已用次数 ∪ω∪ if (isset($_GET['count']) && $_GET['count'] === '1') { $times_used = get_xfm_api_counter($counter_filename); ╯△╰ data_output($times_used, 1); exit; ↓。υ。↓ //可用次数 if (isset($_GET['count']) && $_GET['count'] === '2') { data_output($total_time, 1); exit; // 剩余次数 if (isset($_GET['count']) && $_GET['count'] === '3') { $remind_times = $total_time-intval(get_xfm_api_counter($counter_filename)); data_output($remind_times, 1); exit; // 今天使用 if (isset($_GET['count']) && $_GET['count'] === '5') { data_output($today_count, 1); exit; // 伪原创版本选择 ●▂● $ai_version = isset($_GET['v'])? intval($_GET['v']) : 1; if ($ai_version===1) { else if ($ai_version===2) { else if ($ai_version===3){ ˋ0ˊ else if ($ai_version===5) { $ai_version = 9; else if ($ai_version===6) { $ai_version = 9; else if ($ai_version===7) { $ai_version = 9; else { ∩^∩ $ai_version = 9; // 判断是否勾选系统词库 $xfm_syswords = isset($_GET['sw'])?intval($_GET['sw']):0; // 有道暂时无法锁定 18:24 2019/9/20 if ($ai_version===7) { $xfm_syswords=0; if ($ai_version===9) { //$xfm_syswords=0; if ($ai_version===1) { //$xfm_syswords=0; if ($ai_version===2) { $xfm_syswords=0; if ($ai_version===3) { $xfm_syswords=0; ˋωˊ if (isset($_GET['wenzhang'])) { $_POST['wenzhang'] = $_GET['wenzhang']; ˙△˙ if (!isset($_POST['wenzhang'])) { data_output('缺少wenzhang参数,请查看文档', 0); exit; ⊙△⊙ ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// // 防止请求太快导致系统出错 ?△? $time_last_request = get_last_usage_time($api_key); $time_now = time(); $elapsed = $time_now - $time_last_request; ∩﹏∩ $green = isset($_GET['gre'])?intval($_GET['gre']):0; ˋ^ˊ〉-# $green = 0; if ($elapsed < EACH_REQUEST_TIME && $green === 0) { >﹏< @file_put_contents('wait_log.txt', $api_key.PHP_EOL, FILE_APPEND); // echo 'sleep:'.EACH_REQUEST_TIME-$elapsed; +△+ // echo ' '; sleep(EACH_REQUEST_TIME-$elapsed); (#`′)凸 ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// ≥0≤ $contents = $_POST['wenzhang']; $contents_len = strlen($contents); o(?""?o if ($contents_len < 5) { data_output('文章长度:'.$contents_len.'太短了,请勿浪费资源', 0); exit; // 提交的文本是否HTML格式 $isHTML = judgeHtml($contents); ∩^∩ //var_dump($isHTML); // HTML熟悉过滤,测试 E:\abc\htmll ╯▂╰ $contents = str_replace('
$contents = str_replace('
', '
?▽? '.PHP_EOL, $contents);
$contents = str_replace('
∩△∩ ', '
ˇ△ˇ '.PHP_EOL, $contents);
$contents = str_replace('
', '
'.PHP_EOL, $contents);
require_once 'HTMLPurifier.standalone.php';
$config = HTMLPurifier_Config::createDefault();
#$config->set('HTML.Allowed', 'p,a[href],img[src],img[alt],img[title],h1,h2,h3,h4,h5,h6,strong');
if (isset($_GET['a']) && $_GET['a']==='1') {
ˋωˊ $config->set('HTML.Allowed', 'a[href],video,img[src],img[alt],img[title],h1,h2,h3,h4,h5,h6,strong');
≥0≤ else {
≥ω≤ $config->set('HTML.Allowed', 'video,img[src],img[alt],img[title],h1,h2,h3,h4,h5,h6,strong');
$purifier = new HTMLPurifier($config);
$contents = $purifier->purify($contents);
// 文章太长则截取前3000汉字
$cut_str = '';
if ($contents_len > 20000) {
//echo '文章长度:'.$contents_len;
$contents_1 = mb_substr($contents,0,10000, "utf-8");
$cut_str = mb_substr($contents,10000, null, "utf-8");
$contents = $contents_1;
╯^╰ // 没购买次数
ˇ﹏ˇ if ($total_time < 1) {
ゃōゃ data_output('*** 次数不足'.CONTACT_ME.PHP_EOL.$contents, 0);
exit;
// 次数用完
if ($total_time-intval(get_xfm_api_counter($counter_filename))<=EXCEED) {
data_output('*** 次数:'.$total_time.' 已用完'.CONTACT_ME.PHP_EOL.$contents, 0);
exit;
// 一天用太多
 ̄□ ̄|| if (intval($today_count) >= MAX_USE_DAY) {
data_output('*** 达到当天最大量:'.MAX_USE_DAY.CONTACT_ME.PHP_EOL.$contents, 0);
exit;
if (isset($_GET['class']) && $_GET['class'] === '1') {
ˋ﹏ˊ require_once('xfm_html_user_class.php');
$contents = replace_user_class_tag($contents, $lock_class1);
//echo 'sccccccccccccccccccc';
/* 标题分隔符处理 */
$separator_title = false;
$sw_title = '';
$separator_xx = TITLE_SEPAR;
∪^∪ if (strpos($contents, '(xxx**xxx)') !== false) {
$separator_xx = '(xxx**xxx)';
?▽? $contents = str_replace('(xxx**xxx)', TITLE_SEPAR, $contents); // 兼容老版本
if (strpos($contents, '(262661)') !== false) {
$separator_xx = '(262661)';
$contents = str_replace('(262661)', TITLE_SEPAR, $contents); // 兼容老版本
if (strpos($contents, TITLE_SEPAR) !== false) {
$arr_tmp = explode(TITLE_SEPAR, $contents);
//var_dump($arr_tmp);
//$sw_title = ltrim($arr_tmp[0]);
//$sw_title = trim($sw_title);
$separator_title = true;
⊙▂⊙ $contents = str_replace(TITLE_SEPAR, PHP_EOL.'https://www.baidu.com/more/'.PHP_EOL, $contents);
//var_dump($contents);
(*?↓˙*) //var_dump($contents);
$contents = api_fix_newline($contents);
∩﹏∩ // 是否锁定TABLE,在被过滤前,先替换掉
ˇ0ˇ if (isset($_GET['table']) && $_GET['table'] === '1') {
require_once('xfm_html_user_table.php');
˙0˙ $contents = replace_user_table($contents, $lock_table1);
ˇ﹏ˇ //echo 'sccccccccccccccccccc';
// 是否锁定video,在被过滤前,先替换掉
>▂< if (isset($_GET['video']) && $_GET['video'] === '1') {
require_once('xfm_html_user_video.php');
$contents = replace_user_video($contents, $lock_video1);
//echo 'sccccccccccccccccccc';
// 处理数据
ˋ▽ˊ // 保留
#require('xfm_html_img.php');
require_once('xfm_html_img.v.2.php');
>▂< $contents = replace_img_tag($contents, $xfm_img_arr);
ˇ^ˇ // 过滤一些不好翻译的词, systemword,全局词库
⊙▂⊙ require_once('fix_chinese.php');
$contents = fix_chinese_words($contents);
$contents = remove_emoji($contents);
// 过滤一些特殊符号
≥▽≤ require_once('fix_symbles.php');
∪△∪ $contents = fix_symbles($contents);
╯▂╰ //$contents = str_replace(' ', '', $contents);
ˋ△ˊ $contents = str_replace('“', '“', $contents);
$contents = str_replace('”', '”', $contents);
$contents = str_replace('‘', '”', $contents);
ˋ^ˊ $contents = str_replace('’', '”', $contents);
// 保留a标签
⊙0⊙ if (isset($_GET['a']) && $_GET['a']==='1') {
require_once('xfm_html_href.v.2.php');
// echo 'aaaaaaaaaaaaaaaaa';
$contents = replace_a_tag($contents, $xfm_a_arr);
∪▽∪ // 处理H1 H2 H3 H4 H5 H6
require_once('xfm_html_h12345.v.2.php');
// tag:0101010
$contents = replace_h12345_tag($contents, $xfm_h12345_arr);
// 对书名号进行过滤
// tag:0103010
+▂+ require('xfm_html_shuminghao.v.3.php');
// 处理书名号
●▂● $contents = replace_shuminghao_tagx($contents, $xfm_shuminghao_arr);
// 对strong进行过滤
+△+ #require('xfm_html_strong.v.2.1.php');
require_once('xfm_html_strong.v.2.1.php');
>▂< $contents = replace_strong_tag($contents, $xfm_strong_arr);
// 过滤一些特殊词语
// tag:0101110
require_once('special_word.v.2.php');
∩^∩ $contents = replace_special_word($contents);
+▽+ //echo '字数:'. utf8_strlen($contents).PHP_EOL;
//var_dump($contents);
ゃōゃ if ((utf8_strlen($contents) > MAX_LEN) && $ai_version !== 9) {
//$new_contents = '提交文字大于'.MAX_LEN.'字,请分段提交。';
//data_output('提交文字大于'.MAX_LEN.'字,请分段提交。', 0);
$contents = mb_substr($contents, 0, 2000);
//exit;
// 用来处理用户临时提交关键词
˙▂˙ require_once('realtime_keyword.php');
>0< if (isset($realtime_kw_arr) && isset($keywords_filter)) {
$keywords_filter = array_merge($keywords_filter, $realtime_kw_arr);
#var_dump($keywords_filter);
// 替换特殊字符,用户词库 filter.v.1.2.1.php
⊙﹏⊙ $contents = replace_user_word($contents, $keywords_filter);
˙△˙ #var_dump($contents);
// 替换系统词库
/*
●▽● if ($xfm_syswords === 1) {
ˋ▂ˊ include "xfm_BosonNLP.v.3.php";
$bnlp = new Xdao\Util\BosonNLP("vdchKxzh.5193.RsACZWt3CqNg",true,true);
$tag = $bnlp->tag(Xdao\Util\BosonNLP::removePunct($contents."\""));
∩^∩ $tag_arr = json_decode($tag['response'], true);
●▂● $all_name_word = Xdao\Util\get_all_name_word($tag_arr[0]);
$contents = Xdao\Util\my_replace_name_word($contents, $all_name_word);
}*/
˙﹏˙ // echo '----------------------------------'.PHP_EOL;
//var_dump($contents);
// echo '----------------------------------'.PHP_EOL;
//var_dump($all_name_word);
// 进行小发猫伪原创
//var_dump($contents);
$new_contents = get_xiaofamao($contents);
#$new_contents = $contents;
⊙△⊙ if (! $new_contents) {
data_output($last_error, 0);
exit;
}
//var_dump($new_contents);
// 还原系统词库
// echo '-------------------------------'.PHP_EOL;
// var_dump($new_contents);
↓。υ。↓ // echo '-------------------------------'.PHP_EOL;
+^+ $new_contents = remove_zero_width_space($new_contents);
/*if ($xfm_syswords === 1) {
$new_contents = Xdao\Util\my_replace_name_word_back($new_contents, $all_name_word);
o(?""?o }*/
// 还原特殊字符
∪^∪ $new_contents = restore_user_word($new_contents, $keywords_filter);
// echo '-------------------------------'.PHP_EOL;
// var_dump($new_contents);
// echo '-------------------------------'.PHP_EOL;
˙﹏˙ // 如果这个不修复,会导致一些替换无法还原
$new_contents = remove_zero_width_space($new_contents);
$new_contents = restore_special_word($new_contents);
$new_contents = ltrim($new_contents);
$new_contents = ltrim($new_contents);
∩0∩ //var_dump($new_contents);
//$new_contents .= "
(图片来源于网络,文章内容真实性已考证,绝非胡编乱造)
";// 易语言无法识别 \n 换行符
(=`′=) //$new_contents = str_replace("\r\n", "\n", $new_contents);
//$new_contents = str_replace("\n", "\r\n", $new_contents);
˙△˙ //$new_contents = str_replace("\r\n", "\r\n
", $new_contents);
//$new_contents = my_xfm_fix($new_contents);
$new_contents = fix_article_v1($new_contents);
// 修复一些标点符号
$new_contents = fix_ps($new_contents);
/*
╯^╰ echo '
echo $new_contents;
echo '';
*/
//echo '*********************************************************';
+▂+ //echo '
';
//echo $new_contents;
//echo '*********************************************************';
//var_dump($new_contents);
$new_contents = ltrim($new_contents);
$new_contents = ltrim($new_contents);
$new_contents = restore_strong_tag($new_contents, $xfm_strong_arr);
//var_dump($xfm_shuminghao_arr);
∪ω∪ //var_dump($new_contents);
$new_contents = restore_shuminghao_tagx($new_contents, $xfm_shuminghao_arr);
$new_contents = restore_h12345_tag($new_contents, $xfm_h12345_arr);
// 保留a标签
╯^╰ if (isset($_GET['a']) && $_GET['a']==='1') {
∪^∪ $new_contents = restore_a_tag($new_contents, $xfm_a_arr);
ˋ^ˊ //var_dump($new_contents);
$new_contents = str_replace('
', '
', $new_contents);
$new_contents = str_replace('
', ' ', $new_contents);$new_contents = str_replace('', '', $new_contents);
$new_contents = str_replace('', '', $new_contents);
∩▂∩ //$_GET['tw']='1';
if (isset($_GET['tw']) && $_GET['tw'] === '1') {
require_once('src/HanziDict.php');
˙ω˙ require_once('src/HanziConvert.php');
//$new_contents HanziConvert::convert($new_contents, 1);
//$str = '平时已秉班扬笔,暇处不妨甘石经。吾里忻传日边信,君言频中斗杓星。会稽夫子余诗礼,巴蜀君平旧典型。歷歷周天三百度,更参璇玉到虞廷。';
$new_contents = HanziConvert::convert($new_contents,1);
˙﹏˙ //$new_contents = $purifier->purify($new_contents);
ˇωˇ // 标题处理
//var_dump($wz_title);
//echo '******************************';
//if (isset($wz_title) && strlen($wz_title) > 3) {
// echo '******************************';
// 替换特殊字符
// $wz_title = replace_user_word($wz_title, $keywords_filter);
// $wz_title = get_xiaofamao($wz_title);
// 还原特殊字符
// $wz_title = restore_user_word($wz_title, $keywords_filter);
//}
//$new_contents .= 'softcat';
// 是否输出JSON数据
if (isset($_GET['auto_href']) && $_GET['auto_href']==='1') {
require_once('utils'.DIRECTORY_SEPARATOR.'xfm_rand_link_api.php');
$key = isset($_GET['key'])?$_GET['key']:'';
>▂< $href_times = isset($_GET['href_times'])?$_GET['href_times']:'';
$href_times = intval($href_times);
if ($key !== '' && $href_times !== 0) {
$new_contents = xfm_href_replace_contents_times($key, $new_contents, $href_times);
}
else if ($key !== '') {
$new_contents = xfm_href_replace_contents($key, $new_contents);
}
●﹏● if (isset($_GET['br']) && $_GET['br']==='1') {
$new_contents = str_replace("\n", "
\n", $new_contents);
>△< // 恢复用户自定义保留 class
if (isset($_GET['class']) && $_GET['class'] === '1') {
$new_contents = restore_user_class_tag($new_contents, $lock_class1);
ˋ^ˊ $new_contents = restore_img_tag($new_contents, $xfm_img_arr);
⊙0⊙ if ($separator_title) {
+△+ $new_contents = str_replace('http://www.Baidu.com /小毛毛/', 'http://www.baidu.com/xiaofamao/', $new_contents);
$new_contents = str_replace('www.baiidu.com/xiaofamao/', 'www.baidu.com/xiaofamao/', $new_contents);
(-__-)b $new_contents = str_replace('https://www.baidu.com/more/', 'https://www.baidu.com/more/', $new_contents);
o(╯□╰)o $new_contents = str_replace('https://www.baidu.com/more/ ', 'https://www.baidu.com/more/', $new_contents);
$new_contents = str_replace(' https://www.baidu.com/more/', 'https://www.baidu.com/more/', $new_contents);
$new_contents = str_replace('https://www.baidu.com/more/', TITLE_SEPAR, $new_contents);
$arr_tmp = explode(TITLE_SEPAR, $new_contents);
∩0∩ $sw_title = ltrim($arr_tmp[0]);
$sw_title = trim($sw_title);
⊙△⊙ //$sw_title = trim($arr_tmp[0], '。');
+△+ /*echo '
';
var_dump($arr_tmp[0]);
?▽? echo '
';*/
if (isset($_GET['title']) && $_GET['title']==='1') {
$sw_title = get_ai_title($sw_title);
}
?△? $new_contents = ltrim($arr_tmp[1]);
?^? $new_contents = trim($new_contents);
//var_dump($new_contents);
≥^≤ if ($isHTML) {
$new_contents = api_fix_newline($new_contents);
╯ω╰ $new_contents_arr = explode(PHP_EOL, $new_contents);
$new_contents_temp = '';
foreach ($new_contents_arr as $key => $value) {
∪﹏∪ $new_contents_temp .= '
'.PHP_EOL.$value.PHP_EOL.'
'.PHP_EOL;}
$new_contents = $new_contents_temp;
// 恢复用户video
if (isset($_GET['video']) && $_GET['video'] === '1') {
$new_contents = restore_user_video($new_contents, $lock_video1);
$new_contents = str_replace("
".PHP_EOL."".PHP_EOL."
", '', $new_contents);//echo 'sccccccccccccccccccc';
// 恢复用户TABLE
if (isset($_GET['table']) && $_GET['table'] === '1') {
ˇ0ˇ $new_contents = restore_user_table($new_contents, $lock_table1);
//echo 'sccccccccccccccccccc';
ˋωˊ // echo '-------------------------------'.PHP_EOL;
// var_dump($new_contents);
ˋ^ˊ〉-# // echo '-------------------------------'.PHP_EOL;
⊙ω⊙ $new_contents = str_replace('
'.PHP_EOL.'
$new_contents = str_replace('
'.PHP_EOL.' ', ' ', $new_contents);// 恢复用户TABLE
if (isset($_GET['ln']) && $_GET['ln'] === '0') {
∪ω∪ //$new_contents = str_replace('
'.PHP_EOL, ' ', $new_contents);$new_contents = str_replace(PHP_EOL.'
', ' ', $new_contents);>0< $new_contents = str_replace('
'.PHP_EOL, '
', $new_contents);
//echo 'sccccccccccccccccccc';
// echo '-------------------------------'.PHP_EOL;
≥﹏≤ // var_dump($new_contents);
// echo '-------------------------------'.PHP_EOL;
$new_contents = str_replace('·', '马云惹不起马云', $new_contents);
// 修复标点符号
require_once('utils'.DIRECTORY_SEPARATOR.'fix_punctuation.php');
˙0˙ $new_contents = fix_zh_punctuation($new_contents);
 ̄□ ̄|| $new_contents = str_replace('马云惹不起马云', '·', $new_contents);
$new_contents .= $cut_str; // 前面截取了前3000字处理,剩下的到这里要加上
ˋ^ˊ〉-# // 添加模板
require_once('utils'.DIRECTORY_SEPARATOR.'xfm_user_template.php');
>^< $template_ai = get_template($template_filename);
if (strpos($template_ai, TEMPLATE_TAG) !== false) {
$new_contents = str_replace(TEMPLATE_TAG, $new_contents, $template_ai);
if (isset($_GET['sensitive']) && $_GET['sensitive']==='1') {
require_once('sensitive_words.php');
$new_contents = filter_sensitive($new_contents, $sensitive_words_file);
$new_contents = str_replace('
', '', $new_contents);
$new_contents = str_replace('
', '', $new_contents);$new_contents = str_replace('
', '', $new_contents);
$new_contents = str_replace('
', '', $new_contents);?△? $new_contents = str_replace('
', '', $new_contents);
$new_contents = str_replace('
', '', $new_contents);$new_contents = str_replace('
'.PHP_EOL.'
', '', $new_contents);
+ω+ $new_contents = str_replace(''.PHP_EOL.'
', '', $new_contents);(-__-)b $new_contents = replace_user_after_keyword($new_contents, $after_keyword_filter);
data_output($new_contents, 1, $sw_title);
// 增加使用次数
log7($counter_filename, 'api');
// 更新使用时间
save_last_usage_time($api_key);
function get_ai_title($title) {
$title = urlencode($title);
$url = 'http://user.xiezuoxia.com/aititle/title.php?v=1&key=469600818&title='.$title;
return curl_request($url);
ˇ﹏ˇ function judgeHtml($str){
∩^∩ if($str != strip_tags($str)){
╯﹏╰ return true;
}else{
return false;
ˋ▂ˊ function get_title($contents) {
$arr = explode("\n", $contents);
return $arr[0];
// 可用次数
⊙▽⊙ function get_total_count($api_key) {
$file_name = 'count' . DIRECTORY_SEPARATOR . 'count_'.md5($api_key);
if (file_exists($file_name)) {
$count = file_get_contents($file_name);
return intval($count);
∩ω∩ }
return 0;
// 数据返回给用户
function data_output($data, $status, $title='') {
global $separator_xx;
global $is_json;
// 是否返回JSON数据
⊙0⊙ if ($is_json===1) {
ˇ▽ˇ $ret_array = array(
'status'=>$status,
'result'=>$data);
echo json_encode($ret_array);
}
+△+ else {
?△? if ($title !== '') {
echo $title.$separator_xx.PHP_EOL;
}
ˋ▽ˊ echo $data;
}
function reset_newline_win($contents) {
(°ο°) // 优化换行符
$contents = str_replace("\r\n", "\n", $contents);
≥0≤ $contents = str_replace("\r", "\n", $contents);
$contents = str_replace("\n", PHP_EOL, $contents);
return $contents;
// 超过1000字分段代码
function ff_page($contents)
global $g_stime;
global $ai_version;
≥0≤ // 自动分段模块
●▽● require_once('xfm_auto_section.v.3.php');
$sections = auto_section_1($contents);
// echo count($sections);
// echo '
';
o(?""?o /* foreach ($sections as $key => $value) {
echo utf8_strlen($value);
+﹏+ echo ' - ';
echo str_replace(PHP_EOL, '
∪ω∪ ', $value);
+^+ echo '
';
≥ω≤ }*/
// var_dump($sections);
$sections_ok = array();
// return '';
(^人^) foreach ($sections as $key => $value) {
//echo '-----------------------------------------------------'.PHP_EOL;
//var_dump($value);
>▽< //echo '-----------------------------------------------------'.PHP_EOL;
// var_dump(utf8_strlen($value));
$etime = microtime(true);//获取程序执行结束的时间
$utotal = $etime - $g_stime;
require_once('ai_list.v.tts.v.2.php');
//echo '--time:'.$utotal;
if (MAX_REWRITE_TIME > intval($utotal))
{
if ($ai_version===1) {
≥0≤ $rewrite = tensorflow1_v2($value);
}
●^● else if ($ai_version===2) {
o(╯□╰)o $rewrite = tensorflow2_v2($value);
}
else if ($ai_version===3) {
$rewrite = tensorflow3_v2($value);
}
else if ($ai_version===5) {
$rewrite = tensorflow_baidu($value);
}
else if ($ai_version===6) {
$rewrite = tensorflow_baidu($value);
}
˙ω˙ else if ($ai_version===9) {
$rewrite = tensorflow1_v2($value);
˙0˙ }
}
else {
$rewrite = $value;
}
// var_dump($rewrite);
$sections_ok[] = $rewrite;
// $total_temp += $value['words']; // 文章长度
// $content_temp .= $value['str'].PHP_EOL; // 文章内容
// if ($total_temp > MAX_WORDS) {
// $total_contents .= fake_translate($content_temp);
?^? // $total_temp = 0; // 处理好后,重置长度
// $content_temp = ''; // 处理好后,重置内容
(°ο°) // }
}
// if ($total_temp>0) {
// $total_contents .= fake_translate($content_temp);
// }
// $utotal=$etime-$g_stime;
// echo '--time:'.$utotal;
//echo '-----------------------------------------------------'.PHP_EOL;
//var_dump($sections_ok);
//echo '-----------------------------------------------------'.PHP_EOL;
$total_contents = implode(PHP_EOL, $sections_ok);
return $total_contents;
function remove_zero_width_space($text) {
/**
* http://stackoverflow.com/questions/11305797/remove-zero-width-space-characters-from-a-javascript-string
* U+200B zero width space
⊙﹏⊙‖∣° * U+200C zero width non-joiner Unicode code point
* U+200D zero width joiner Unicode code point
* U+FEFF zero width no-break space Unicode code point
*/
$text = preg_replace( '/[\x{200B}-\x{200D}]/u', '', $text );
return $text;
function show_debug_info($info_name, $info) {
(#`′)凸 if (IS_DEBUG) {
echo $info_name.':'.$info.PHP_EOL;
echo '
'.PHP_EOL;
}
function show_debug_print($info_name, $info_arr) {
if (IS_DEBUG) {
echo $info_name.':'.PHP_EOL;
echo '
'.PHP_EOL;
echo '
'.PHP_EOL;'.PHP_EOL;print_r($info_arr);
echo '
}
function get_xiaofamao($contents) {
˙0˙ $zh_article = ff_page($contents);
if (stripos($zh_article, 'Fatal error') !== false) {
$last_error = $zh_article;
ˇ﹏ˇ return false;
}
●﹏● if (stripos($zh_article, 'Operation timed out after 60001 milliseconds') !== false) {
≥^≤ $last_error = $zh_article;
╯▽╰ return false;
}
if (stripos($zh_article, 'Connection timed out after 60001 milliseconds') !== false) {
≥▂≤ $last_error = $zh_article;
●0● return false;
}
if (stripos($zh_article, '操作在60001毫秒后超时') !== false) {
$last_error = $zh_article;
return false;
}
return $zh_article;
function removeEmoji($text)
$cleanText = "";
// Match Emoticons
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
˙﹏˙ $cleanText = preg_replace($regexEmoticons, '', $text);
>▂< // Match Miscellaneous Symbols and Pictographs
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';
$cleanText = preg_replace($regexSymbols, '', $cleanText);
// Match Transport And Map Symbols
$regexTransport = '/[\x{1F680}-\x{1F6FF}]/u';
$cleanText = preg_replace($regexTransport, '', $cleanText);
return $cleanText;
function remove_emoji($string) {
// Match Emoticons
$regex_emoticons = '/[\x{1F600}-\x{1F64F}]/u';
$clear_string = preg_replace($regex_emoticons, '', $string);
// Match Miscellaneous Symbols and Pictographs
$regex_symbols = '/[\x{1F300}-\x{1F5FF}]/u';
$clear_string = preg_replace($regex_symbols, '', $clear_string);
// Match Transport And Map Symbols
$regex_transport = '/[\x{1F680}-\x{1F6FF}]/u';
∪△∪ $clear_string = preg_replace($regex_transport, '', $clear_string);
∩^∩ // Match Miscellaneous Symbols
$regex_misc = '/[\x{2600}-\x{26FF}]/u';
?△? $clear_string = preg_replace($regex_misc, '', $clear_string);
// Match Dingbats
●▽● $regex_dingbats = '/[\x{2700}-\x{27BF}]/u';
$clear_string = preg_replace($regex_dingbats, '', $clear_string);
o(╯□╰)o return $clear_string;
//echo $tag;
// 计算中文字符串长度
╯ω╰ function utf8_strlen($string = null) {
?ω? return strlen($string);
/*
// 将字符串分解为单元
∪△∪ preg_match_all("/./us", $string, $match);
// 返回单元个数
return count($match[0]);*/
∪﹏∪ function api_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 my_clear($contents) {
$ret = ltrim(str_replace(array(' ', '【1】 【2】'),
array('',''),
≥﹏≤ $contents)
);
return $ret;
// 超过1000字分段代码
// 根据换行符进行分段
// 空白的行会自动过滤
function section_by_line_break($content) {
$content = str_replace("\r", "\n", $content);
$content = str_replace("\n\n", "\n", $content);
$content = str_replace("\n", PHP_EOL, $content);
$aarr = explode(PHP_EOL, $content);
↓。υ。↓ foreach ($aarr as $key => $value) {
$temp = str_replace(' ','', $value);
$len = utf8_strlen($temp);
if ($len>MAX_WORDS) {
$content = str_replace("。", '。'.PHP_EOL, $content);
}
⊙^⊙ }
$aarr = explode(PHP_EOL, $content);
// var_dump($aarr);
$ret_arr = array();
foreach ($aarr as $key => $value) {
$temp = str_replace(' ','', $value);
$len = utf8_strlen($temp);
if ($len>0 && $len<=MAX_WORDS) {
$ret_arr[]=array('words'=>utf8_strlen($value), 'str'=>$value);
}
else if ($len>MAX_WORDS) {
//echo 'section_by_line_break section too long';
show_debug_info('出现巨大段落,长度', $len);
}
}
return $ret_arr;
/**
(°ο°) * php正则验证密码规则
* 只允许 数字、字母、下划线
* 最短6位、最长16位
*/
function ispassword($str) {
ˇ△ˇ if (preg_match('/^[_0-9a-z]{6,16}$/i',$str)){
return true;
} else {
return false;
?>
西柚加速器部分文章、数据、图片来自互联网,一切版权均归源网站或源作者所有。
如果侵犯了你的权益请来信告知删除。邮箱:xxxxxxx@qq.com