SearchEngines
in package
implements
ActionInterface
Uses
BackwardCompatibility
Manages the settings related to search engines.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $subaction : string
- $subactions : array<string|int, mixed>
- $javascript_function : string
- $obj : object
- $backcompat : array<string|int, mixed>
Methods
- call() : void
- Convenience method to load() and execute() an instance of this class.
- consolidateSpiderStats() : void
- This function takes any unprocessed hits and turns them into stats.
- edit() : void
- Here we can add, and edit, spider info!
- editSpider() : void
- Backward compatibility wrapper for the editspiders sub-action.
- execute() : void
- Dispatcher to whichever sub-action method is necessary.
- exportStatic() : void
- Provides a way to export a class's public static properties and methods to global namespace.
- getConfigVars() : array<string|int, mixed>
- Gets the configuration variables for this admin area.
- list_getNumSpiderLogs() : int
- Callback function for SMF\ItemList()
- list_getNumSpiders() : int
- Callback function for SMF\ItemList()
- list_getNumSpiderStats() : int
- Callback function for SMF\ItemList() Get the number of spider stat rows from the log spider stats table
- list_getSpiderLogs() : array<string|int, mixed>
- Callback function for SMF\ItemList()
- list_getSpiders() : array<string|int, mixed>
- Callback function for SMF\ItemList()
- list_getSpiderStats() : array<string|int, mixed>
- Callback function for SMF\ItemList() Get a list of spider stats from the log_spider table
- load() : object
- Static wrapper for constructor.
- logs() : void
- See what spiders have been up to.
- manageSearchEngineSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the settings sub-action.
- recacheSpiderNames() : void
- Recache spider names?
- settings() : void
- The settings page.
- spiderLogs() : void
- Backward compatibility wrapper for the logs sub-action.
- spiderStats() : void
- Backward compatibility wrapper for the stats sub-action.
- stats() : void
- Show the spider statistics.
- view() : void
- View a list of all the spiders we know about.
- viewSpiders() : void
- Backward compatibility wrapper for the spiders sub-action.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
Properties
$subaction
public
string
$subaction
= 'stats'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['stats' => 'stats', 'logs' => 'logs', 'spiders' => 'view', 'settings' => 'settings', 'editspiders' => 'edit']
Available sub-actions.
$javascript_function
protected
static string
$javascript_function
JavaScript to use on the settings page.
$obj
protected
static object
$obj
An instance of this class. This is used by the load() method to prevent mulitple instantiations.
$backcompat
private
static array<string|int, mixed>
$backcompat
= ['func_names' => ['call' => 'SearchEngines', 'consolidateSpiderStats' => 'consolidateSpiderStats', 'list_getSpiders' => 'list_getSpiders', 'list_getNumSpiders' => 'list_getNumSpiders', 'list_getSpiderLogs' => 'list_getSpiderLogs', 'list_getNumSpiderLogs' => 'list_getNumSpiderLogs', 'list_getSpiderStats' => 'list_getSpiderStats', 'list_getNumSpiderStats' => 'list_getNumSpiderStats', 'recacheSpiderNames' => 'recacheSpiderNames', 'spiderStats' => 'SpiderStats', 'spiderLogs' => 'SpiderLogs', 'viewSpiders' => 'ViewSpiders', 'manageSearchEngineSettings' => 'ManageSearchEngineSettings', 'editSpider' => 'EditSpider']]
BackwardCompatibility settings for this class.
Methods
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
consolidateSpiderStats()
This function takes any unprocessed hits and turns them into stats.
public
static consolidateSpiderStats() : void
edit()
Here we can add, and edit, spider info!
public
edit() : void
editSpider()
Backward compatibility wrapper for the editspiders sub-action.
public
static editSpider() : void
execute()
Dispatcher to whichever sub-action method is necessary.
public
execute() : void
exportStatic()
Provides a way to export a class's public static properties and methods to global namespace.
public
static exportStatic() : void
To do so:
- Use this trait in the class.
- At the END of the class's file, call its exportStatic() method.
Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.
Regarding the $backcompat items:
A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].
$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.
$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.
Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.
getConfigVars()
Gets the configuration variables for this admin area.
public
static getConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the news area.
list_getNumSpiderLogs()
Callback function for SMF\ItemList()
public
static list_getNumSpiderLogs() : int
Return values
int —The number of spider log entries
list_getNumSpiders()
Callback function for SMF\ItemList()
public
static list_getNumSpiders() : int
Return values
int —The number of known spiders
list_getNumSpiderStats()
Callback function for SMF\ItemList() Get the number of spider stat rows from the log spider stats table
public
static list_getNumSpiderStats() : int
Return values
int —The number of rows in the log_spider_stats table
list_getSpiderLogs()
Callback function for SMF\ItemList()
public
static list_getSpiderLogs(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Parameters
- $start : int
-
The item to start with (for pagination purposes)
- $items_per_page : int
-
How many items to show per page
- $sort : string
-
A string indicating how to sort the results
Return values
array<string|int, mixed> —An array of spider log data
list_getSpiders()
Callback function for SMF\ItemList()
public
static list_getSpiders(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Parameters
- $start : int
-
The item to start with (for pagination purposes)
- $items_per_page : int
-
The number of items to show per page
- $sort : string
-
A string indicating how to sort the results
Return values
array<string|int, mixed> —An array of information about known spiders
list_getSpiderStats()
Callback function for SMF\ItemList() Get a list of spider stats from the log_spider table
public
static list_getSpiderStats(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Parameters
- $start : int
-
The item to start with (for pagination purposes)
- $items_per_page : int
-
The number of items to show per page
- $sort : string
-
A string indicating how to sort the results
Return values
array<string|int, mixed> —An array of spider statistics info
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
logs()
See what spiders have been up to.
public
logs() : void
manageSearchEngineSettings()
Backward compatibility wrapper for the settings sub-action.
public
static manageSearchEngineSettings([bool $return_config = false ]) : void|array<string|int, mixed>
Parameters
- $return_config : bool = false
-
Whether to return the config_vars array.
Return values
void|array<string|int, mixed> —Returns nothing or returns the config_vars array.
recacheSpiderNames()
Recache spider names?
public
static recacheSpiderNames() : void
settings()
The settings page.
public
settings() : void
spiderLogs()
Backward compatibility wrapper for the logs sub-action.
public
static spiderLogs() : void
spiderStats()
Backward compatibility wrapper for the stats sub-action.
public
static spiderStats() : void
stats()
Show the spider statistics.
public
stats() : void
view()
View a list of all the spiders we know about.
public
view() : void
viewSpiders()
Backward compatibility wrapper for the spiders sub-action.
public
static viewSpiders() : void
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed