Firefox PHP

Module: Search Spelling

Posted by Maurice Makaay 
All files from this thread

File Name File Size   Posted by Date  
search_spelling-1.0.3.zip 11.8 KB open | download Maurice Makaay 08/31/2016 Read message
Module: Search Spelling
October 22, 2007 02:05PM
This module queries Google's search engine for each search request to implement a "Did you mean ...?" function for the Phorum search pages. This will suggest alternative spellings for words that are possibly misspelled in the search query.

To be able to query the Google web site, PHP must be configured to allow opening of URLs for file reading commands. This means that the php.ini option "allow_url_fopen" must be set to 1. If this option is disabled, then this module will not work.

Changelog:
----------

2016-08-31 v1.0.3 by Oliver Riesen-Mallmann <oliver@riesen.org>

    - Made XHTML 1.0 Transitional compliant.

2011-01-09 v1.0.2

    - Fixed the module to work with the latest Google pages.

    - Switched to using the HTTP GET Phorum API code for better compatibility.

    - Added new German language files. Thanks to Oliver Riesen!

2007-10-22 v1.0.1

    - Fixed a small bug which sneaked into the v1.0.0 code right before
      releasing it. This bug killed the search arguments in the
      search_action hook, causing the regular search to fail.

2007-10-17 v1.0.0

    - Initial release


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 3 time(s). Last edit at 08/31/2016 03:51PM by Oliver Riesen-Mallmann.
Attachments:
open | download - search_spelling-1.0.3.zip (11.8 KB)
Re: Module: Search Spelling
May 31, 2010 03:09PM
Hi Maurice,

current version 1.0.1 doesn't work any longer. Goggle changed his markup and delivers now in utf-8.

I did the following changes to get it work:

settings.php (just an additional space in search pattern):

Language: PHP
19c19 < if (preg_match_all('/<option value=\"lang_(\w+)\">([^<>]+)/', $page, $m)) { --- > if (preg_match_all('/<option value=\"lang_(\w+)\" >([^<>]+)/', $page, $m)) {

search_spelling.php:
22c22
<     $page = file_get_contents($url);
---
>     $page = utf8_encode(file_get_contents($url));
27c27
<     if (preg_match('/: *<\/font><a href=[^>]+&spell=1[^>]*>(.+?)<\/a>/i', $page, $m)) {
---
>     if (preg_match('/: *<\/span><a href=[^>]+&amp;spell=1[^>]*>(.+?)<\/a>/i', $page, $m)) {

Regards
Oliver


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.20)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Module: Search Spelling
August 31, 2016 03:51PM
New version:

2016-08-31 v1.0.3 by Oliver Riesen-Mallmann <oliver@riesen.org>
    - Made XHTML 1.0 Transitional compliant.


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.20)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Sorry, only registered users may post in this forum.

Click here to login