예제 #1
0
<?php

require 'spellutils.php';
require 'class.spellcheck.php';
$words = get_param('words');
$sp = new SpellCheck();
$recognized = $sp->check($words);
$data = array('recognized' => $recognized);
return_jsonp_data($data);
예제 #2
0
<?php

$classes = Class_Prog::model()->findAll();
foreach ($classes as $class) {
    $errors = SpellCheck::check($class->description);
    if (!empty($errors)) {
        echo CHtml::link($class->name, array('class/view', 'id' => $class->id_class));
        echo " - Description";
        echo '<ul>';
        foreach ($errors as $err) {
            echo "<li>{$err}</li>";
        }
        echo '</ul>';
    }
    $errors = SpellCheck::check($class->usage);
    if (!empty($errors)) {
        echo CHtml::link($class->name, array('class/view', 'id' => $class->id_class));
        echo " - Usage";
        echo '<ul>';
        foreach ($errors as $err) {
            echo "<li>{$err}</li>";
        }
        echo '</ul>';
    }
}
<?php

if (isset($_POST['message'])) {
    include './spell.php';
    $post_message = get_magic_quotes_gpc() ? stripslashes($_POST['message']) : $_POST['message'];
    $spell = new SpellCheck();
    $errors = $spell->getErrors(isset($_GET['bbcode']) ? $spell->filterBB($post_message) : $post_message);
    print $spell->getCorrectedText($post_message, $errors['word'], $errors['suggest']);
}
예제 #4
0
  <?php 
head($GLOBALS['displayQ'], array("search"));
?>
 </head>
 <body>
  <?php 
headerElem();
?>
  <div class="container">
   <script>document.getElementById('query').focus();</script>
   <?php 
if ($GLOBALS['q'] == "") {
    echo "A query please...";
} else {
    require "inc/spellcheck.php";
    $SC = new SpellCheck();
    $corSp = $SC->check($GLOBALS['q']);
    if ($corSp != "") {
        echo "<p style='color:red;font-size:15px;margin-bottom:10px'>Did you mean ? <br/><a href='?q={$corSp}'>" . $corSp . "</a></p>";
    }
    $res = getResults();
    if ($res == 0) {
        echo "<p>Sorry, no results were found</p><h3>Search Suggestions</h3>";
        echo "<ul>";
        echo "<li>Check your spelling</li>";
        echo "<li>Try more general words</li>";
        echo "<li>Try different words that mean the same thing</li>";
        echo "</ul>";
    } else {
        ?>
    <div class="info">