ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
search_engines_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| get_referer ()
| test_crawler ($CrawlerUrl, $CrawlerName, $Crawler)
| get_search_engine ()
| get_search_prefix ()
| get_search_query ()
| redirected_from_search_engine ()

## Data Fields
| $Security = false
| $Text = false

## Detailed Description

Class provides search engines routine.

Author
  Dodonov A.A.

Definition at line 26 of file search_engines.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Author
  Dodonov A.A.

Definition at line 51 of file search_engines.php.

{
try
{
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->Text = get_package( 'string::text' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

get_referer | ( |  | ) |

Definition at line 82 of file search_engines.php.

{
try
{
$URL = '';
if( $this->Security->get_gp( 'referer' , 'raw' , '' ) != '' )
{
$URL = $this->Security->get_gp( 'referer' , 'raw' );
}
else
{
$URL = $this->Security->get_srv( 'HTTP_REFERER' , 'raw' , false );
}
return( $URL );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_search_engine | ( |  | ) |

Function returns search engine name.

Returns
  Search engine name, or false

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 178 of file search_engines.php.

{
try
{
if( $this->get_referer() === false )
{
return( false );
}
$Crawler = false;
$Crawler = $this->test_crawler( 'google.' , 'Google' , $Crawler );
$Crawler = $this->test_crawler( 'yandex.' , 'Yandex' , $Crawler );
$Crawler = $this->test_crawler( 'qip.ru' , 'Qip' , $Crawler );
$Crawler = $this->test_crawler( 'mail.ru' , 'Mail' , $Crawler );
$Crawler = $this->test_crawler( 'rambler.ru' , 'Rambler' , $Crawler );
$Crawler = $this->test_crawler( 'bing.com' , 'Bing' , $Crawler );
$Crawler = $this->test_crawler( 'nigma.ru' , 'Nigma' , $Crawler );
$Crawler = $this->test_crawler( 'webalta.ru' , 'Webalta' , $Crawler );
$Crawler = $this->test_crawler( 'ukr.net' , 'Ukr.net' , $Crawler );
$Crawler = $this->test_crawler( 'conduit.com' , 'Conduit' , $Crawler );
return( $Crawler );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_search_prefix | ( |  | ) |

Function return search query parametr.

Returns
  Search query parameter.

Exceptions

  Exception | Exception An exception of this type is thrown.

Author
  Додонов А.А.

Definition at line 226 of file search_engines.php.

{
try
{
$SearchEngine = $this->get_search_engine();
$Search = false;
switch( $SearchEngine )
{
case( 'Google' ):
case( 'Webalta' ):
case( 'Mail' ):
case( 'Bing' ):
case( 'Conduit' ):
case( 'Ukr.net' ):$Search = 'q=';break;
case( 'Yandex' ):$Search = 'text=';break;
case( 'Qip' ):
case( 'Rambler' ):$Search = 'query=';break;
case( 'Nigma' ):$Search = 's=';break;
}
return( $Search );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_search_query | ( |  | ) |

Function returns search query.

Returns
  search query, or false.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 278 of file search_engines.php.

{
try
{
$Search = $this->get_search_prefix();
if( $Search !== false )
{
$URL = $this->get_referer();
$Phrase = urldecode( urldecode( $URL ) );
preg_match( "/[\?\&]{1}$Search([^\&\#]*)/" , "$Phrase&" , $Phrase2 );
return( isset( $Phrase2[ 1 ] ) ? $this->Text->iconv( false , 'utf-8' , $Phrase2[ 1 ] ) : false );
}
else
{
return( false );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

redirected_from_search_engine | ( |  | ) |

Function validates value of the function get_search_engine.

Returns
  true if the user has come from the searche engine, false otherwise.

Exceptions

  Exception | Exception An exception of this type is thrown.

Author
  Додонов А.А.

Definition at line 323 of file search_engines.php.

{
try
{
$Redir = $this->get_search_engine();
return( $Redir === false ? false : true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

test_crawler | ( |  | $CrawlerUrl,
|  |  | $CrawlerName,
|  |  | $Crawler
| ) |  |

Definition at line 135 of file search_engines.php.

{
try
{
$URL = $this->get_referer();
if( $Crawler === false && stristr( $URL , $CrawlerUrl ) )
{
$Crawler = $CrawlerName;
}
return( $Crawler );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$Security = false

Cached packages.

Author
  Dodonov A.A.

Definition at line 38 of file search_engines.php.

$Text = false

Definition at line 39 of file search_engines.php.

The documentation for this class was generated from the following file:

- packages/search/packages/search_engines/search_engines.php