<?php
header('Content-type: text/html; charset=utf-8');
// The following variables values must reflect your installation needs.
$aspell_prog = '"C:\Program Files\Aspell\bin\aspell.exe"'; // by FredCK (for Windows)
//$aspell_prog = 'aspell'; // by FredCK (for Linux)
$lang = 'en_US';
$aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; // by FredCK
$tempfiledir = "./";
$spellercss = '../spellerStyle.css'; // by FredCK
$word_win_src = '../wordWindow.js'; // by FredCK
$textinputs = $_POST['textinputs']; # array
$input_separator = "A";
# set the JavaScript variable to the submitted text.
# textinputs is an array, each element corresponding to the (url-encoded)
# value of the text control submitted for spell-checking
function print_textinputs_var() {
global $textinputs;
foreach( $textinputs as $key=>$val ) {
# $val = str_replace( "'", "%27", $val );
echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n";
}
}
# make declarations for the text input index
function print_textindex_decl( $text_input_idx ) {
echo "words[$text_input_idx] = [];\n";
echo "suggs[$text_input_idx] = [];\n";
}
# set an element of the JavaScript 'words' array to a misspelled word
function print_words_elem( $word, $index, $text_input_idx ) {
echo "words[$text_input_idx][$index] = '" . escape_quote( $word ) . "';\n";
}
# set an element of the JavaScript 'suggs' array to a list of suggestions
function print_suggs_elem( $suggs, $index, $text_input_idx ) {
echo "suggs[$text_input_idx][$index] = [";
foreach( $suggs as $key=>$val ) {
if( $val ) {
echo "'" . escape_quote( $val ) . "'";
if ( $key+1 < count( $suggs )) {
echo ", ";
}
}
}
echo "];\n";
}
# escape single quote
function escape_quote( $str ) {
return preg_replace ( "/'/", "\\'", $str );
}
# handle a server-side error.
function error_handler( $err ) {
echo "error = '" . escape_quote( $err ) . "';\n";
}
## get the list of misspelled words. Put the results in the javascript words array
## for each misspelled word, get suggestions and put in the javascript suggs array
function print_checker_results() {
global $aspell_prog;
global $aspell_opts;
global $tempfiledir;
global $textinputs;
global $input_separator;
$aspell_err = "";
# create temp file
$tempfile = tempnam( $tempfiledir, 'aspell_data_' );
# open temp file, add the submitted text.
if( $fh = fopen( $tempfile, 'w' )) {
for( $i = 0; $i < count( $textinputs ); $i++ ) {
$text = urldecode( $textinputs[$i] );
$lines = explode( "\n", $text );
fwrite ( $fh, "%\n" ); # exit terse mode
fwrite ( $fh, "^$input_separator\n" );
fwrite ( $fh, "!\n" ); # enter terse mode
foreach( $lines as $key=>$value ) {
# use carat on each line to escape possible aspell commands
fwrite( $fh, "^$value\n" );
}
}
fclose( $fh );
# exec aspell command - redirect STDERR to STDOUT
$cmd = "$aspell_prog $aspell_opts < $tempfile 2>&1";
if( $aspellret = shell_exec( $cmd )) {
$linesout = explode( "\n", $aspellret );
$index = 0;
$text_input_index = -1;
# parse each line of aspell return
foreach( $linesout as $key=>$val ) {
$chardesc = substr( $val, 0, 1 );
# if '&', then not in dictionary but has suggestions
# if '#', then not in dictionary and no suggestions
# if '*', then it is a delimiter between text inputs
# if '@' then version info
if( $chardesc == '&' || $chardesc == '#' ) {
$line = explode( " ", $val, 5 );
print_words_elem( $line[1], $index, $text_input_index );
if( isset( $line[4] )) {
$suggs = explode( ", ", $line[4] );
} else {
$suggs = array();
}
print_suggs_elem( $suggs, $index, $text_input_index );
$index++;
} elseif( $chardesc == '*' ) {
$text_input_index++;
print_textindex_decl( $text_input_index );
$index = 0;
} elseif( $chardesc != '@' && $chardesc != "" ) {
# assume this is error output
$aspell_err .= $val;
}
}
if( $aspell_err ) {
$aspell_err = "Error executing `$cmd`\\n$aspell_err";
error_handler( $aspell_err );
}
} else {
error_handler( "System error: Aspell program execution failed (`$cmd`)" );
}
} else {
error_handler( "System error: Could not open file '$tempfile' for writing" );
}
# close temp file, delete file
unlink( $tempfile );
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="<?php echo $spellercss ?>" />
<script language="javascript" src="<?php echo $word_win_src ?>"></script>
<script language="javascript">
var suggs = new Array();
var words = new Array();
var textinputs = new Array();
var error;
<?php
print_textinputs_var();
print_checker_results();
?>
var wordWindowObj = new wordWindow();
wordWindowObj.originalSpellings = words;
wordWindowObj.suggestions = suggs;
wordWindowObj.textInputs = textinputs;
function init_spell() {
// check if any error occured during server-side processing
if( error ) {
alert( error );
} else {
// call the init_spell() function in the parent frameset
if (parent.frames.length) {
parent.init_spell( wordWindowObj );
} else {
alert('This page was loaded outside of a frameset. It might not display properly');
}
}
}
</script>
</head>
<!-- <body onLoad="init_spell();"> by FredCK -->
<body onLoad="init_spell();" bgcolor="#ffffff">
<script type="text/javascript">
wordWindowObj.writeBody();
</script>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
自动建站CMS,然不动标签的人也能做出自己的网站
共2148个文件
gif:1038个
asp:491个
js:184个
需积分: 9 8 下载量 105 浏览量
2009-03-19
18:04:14
上传
评论
收藏 6.86MB RAR 举报
温馨提示
自动建站CMS自动建站CMS自动建站CMS自动建站CMS
资源推荐
资源详情
资源评论
收起资源包目录
自动建站CMS,然不动标签的人也能做出自己的网站 (2148个子文件)
Kesion.Label.FunctionCls.asp 207KB
Kesion.CommonCls.asp 158KB
KS.System.asp 134KB
cj_cls.asp 110KB
KS.Article.asp 108KB
KS.Admin.asp 106KB
Kesion.Label.CommonCls.asp 103KB
KS.Down.asp 100KB
KS.Picture.asp 99KB
Index.asp 95KB
SK_GetSoft.asp 83KB
KS.Model.asp 81KB
user_Contributor.asp 79KB
LabelFunctionAdd.asp 78KB
KS.User.asp 77KB
KS.ClassMenu.asp 72KB
SK_GetPhoto.asp 72KB
InsertLabel.asp 70KB
function.asp 69KB
User_Blog.asp 69KB
SK_GetArticle.asp 68KB
User_Blog.asp 59KB
Wap.RCls.asp 57KB
KS.FriendLink.asp 56KB
Kesion.ClassCls.asp 56KB
KS.Ads.asp 55KB
Kesion.CollectCls.asp 54KB
KS.Special.asp 50KB
Kesion.StaticCls.asp 48KB
Kesion.EditorCls.asp 47KB
KS.Form.asp 47KB
Label_Main.asp 46KB
KS.Template.asp 44KB
KS.Class.asp 42KB
Collect_ItemCollecFast.asp 41KB
User_EditInfo.asp 40KB
KS.DownServer.asp 40KB
User_UpFile.asp 39KB
Kesion.AdministratorCls.asp 39KB
Sk_CollectionFast.asp 39KB
Wap_InsertLabel.asp 38KB
spaceajax.asp 37KB
Sk_ItemDatabase.asp 37KB
InsertTsfh.asp 36KB
KS.UpFileForm.asp 35KB
User_MySoftWare.asp 35KB
User_Message.asp 34KB
Search.asp 34KB
User_Photo.asp 34KB
User_Team.asp 34KB
KS.Database.asp 34KB
User_MyPhoto.asp 34KB
SK_Funcls.asp 33KB
GetCirPictureList.asp 33KB
KS.Field.asp 33KB
GetPictureList.asp 32KB
User_PayOnline.asp 31KB
UpFileSave.asp 31KB
User_MyArticle.asp 30KB
KS.FormField.asp 29KB
User_Blog.asp 29KB
Collect_Main.asp 28KB
KS.DIYPage.asp 28KB
Collect_ItemFilters.asp 28KB
User_PayReceive.asp 28KB
User_Order.asp 28KB
GetArticleList.asp 28KB
Collect_ItemModify4.asp 27KB
User_Enterprise.asp 27KB
AddClassJS.asp 27KB
GetCirArticleList.asp 27KB
GetDownLoadList.asp 27KB
SK_Config.asp 27KB
Collect_ItemModify5.asp 26KB
GetCirDownLoadList.asp 26KB
GetLastPictureList.asp 26KB
KS.EnterPrise.asp 25KB
KS.EnterPriseAD.asp 25KB
KS.AdminFiles.asp 25KB
UpFileSave.asp 25KB
MyFunction.asp 25KB
JS_Main.asp 24KB
KS.Card.asp 24KB
Comment.asp 24KB
GetCirSpecialList.asp 24KB
GetCorrelativePicture.asp 24KB
Kesion.SpaceCls.asp 24KB
GetPicArticleList.asp 23KB
GetPicDownLoadList.asp 23KB
Kesion.MemberCls.asp 23KB
KS.Mood.asp 23KB
AddPicArticleJS.asp 22KB
GetNotRuleArticleList.asp 22KB
Collect_ItemAttribute.asp 22KB
KS.UserMessage.asp 22KB
User_EnterPriseAd.asp 22KB
GetSpecialList.asp 22KB
Kesion.Label.SQLCls.asp 22KB
KS.Online.asp 22KB
KS.ProImages.asp 21KB
共 2148 条
- 1
- 2
- 3
- 4
- 5
- 6
- 22
资源评论
yellia19890205
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功