ВходПользовательПароль
   
Регистрация
Регистрация
Помощь
Помощь
Поиск
Поиск
Gosudar.com.ru  
  

Меню сайта
Навигация
Объявления Объявления
Блоги Блоги
Файловый архив Файловый архив
Последние Последние
Гостевая Гостевая
Контакты Контакты
Личный Раздел
Вход Вход
Регистрация Регистрация
Cms R3-born
Библиотека Библиотека
Файлы R3-born Файлы R3-born
Разработка(блог) Разработка(блог)
Демо-модули
Фотоальбом Фотоальбом
Новости Новости
Форум Форум

Счётчик
5634956349563495634956349
Главная » Библиотека

Библиотека

Библиотека  » CMS R3-born  » Документация
PHP 5 Using the Akismet class
Описание Manual. English
Автор martin Число Июль 14 2008, 10:04 Тип FAQ
Категория Документация
Просмотров 1557
Трекбек URL для этой записи: Трекбек
  Голосов 0


PHP 5 Using the Akismet class
Manual. English
The Akismet API documentation describes the low level interface. Its intended audience is authors of code such as the Akismet PHP 5 class used in R3-born. As such, it contains some information you don't need to know or be concerned with, but it may help you understand what the Akismet class is doing.

Using the Class

The Akismet class takes care of all the connection and communications with the Akismet server and gives you a simpler high level interface.

Example 1, submitting a comment to be checked:

 Код:  
include 'class_akismet5.php';
   

// instantiate an instance of the class
$akismet = new Akismet('http://www.yourdomain.com/', 'YOUR_WORDPRESS_API_KEY');
$akismet->setCommentAuthor('viagra-test-123');
$akismet->setCommentAuthorEmail('test@example.com');
$akismet->setCommentAuthorURL('http://www.example.com/');
$akismet->setCommentContent('This is a test comment');
$akismet->setPermalink(''http://your-domain.com/path-to-your-comment-page');
$akismet->setCommentType(comment);// type: comment,pingback or trackback
$akismet->setUserIP('an-ip-address');// optional, if not in array defaults to $_SERVER['REMOTE_ADDR']

// test for error
// Was the server down?
if ($akismet_return === 'conn_error')
{
   // Assume it's not spam. We log an error to the error log later
   $error = $lang['Akismet_response_failed'];
   //The comment can't be tagged as Spam is there was an Akismet error, therefore approve the comment by log the error.
   // do something
}
// Is this... SPAM?!?!?!
elseif ($akismet_return === true)
{
   // Oh, the horror! Someone posted spam to your forum!
   // do something with the spam comment
   //$lang['Akismet_spam'];
}
else
{
   //$spam = false;
   // do something with the non-spam comment
   //$lang['Akismet_ham'];
}



Example 2, submitting a mis-diagnosed comment:

You should incorporate the submitSpam() and submitHam() calls in your applications. Doing so helps Akisment improve its spam checking algorithms.

 Код:  
// load array with comment data
// instantiate an instance of the class
$akismet = new Akismet('http://www.yourdomain.com/', 'YOUR_WORDPRESS_API_KEY');
$akismet->setCommentAuthor('viagra-test-123');
$akismet->setCommentAuthorEmail('test@example.com');
$akismet->setCommentAuthorURL('http://www.example.com/');
$akismet->setCommentContent('This is a test comment');
$akismet->setPermalink(''http://your-domain.com/path-to-your-comment-page');
$akismet->setCommentType(comment);// type: comment,pingback or trackback
$akismet->setUserIP('an-ip-address');// optional, if not in array defaults to $_SERVER['REMOTE_ADDR']

// submit the ham or spam comment
$akismet->submitHam();  // or submitSpam()



References
 


Часовой пояс: GMT + 3

Кто онлайн
Кто онлайн
Кто онлайн Всего зарегистрированных пользователей: 405
Последний зарегистрированный пользователь: MugenEi
Сейчас посетителей на сайте: 61, из них зарегистрированных: 0, скрытых: 0, гостей: 56, ботов: 5
Больше всего посетителей (302) здесь было Июль 27 2023, 12:54
Зарегистрированные пользователи: нет
Боты : AhrefsBot (5)
Легенда: Админ, Зам.админа, ViP, Спамеры
Эти данные основаны на активности пользователей за последние пять минут

Вход
Вход
Пользователь:    Пароль:     Автоматически входить при каждом посещении     

Powered by R3-Born² © 2024
Все логотипы и торговые марки являются собственностью их законных владельцев.
Правила пользования | Полис Секретности

Valid XHTML 1.0 Transitional SPECIALIST® Online Certified PHP Specialist Valid CSS!