Open Journal Systems
3.3.0
|
Data Fields | |
$_currentUsageEvent | |
$_dataPrivacyOn | |
$_optedOut | |
$_saltpath | |
Data Fields inherited from Plugin | |
$pluginCategory | |
$pluginPath | |
$request | |
Protected Member Functions | |
getDownloadFinishedEventHooks () | |
Protected Member Functions inherited from Plugin | |
_registerTemplateResource ($inCore=false) | |
Provide usage statistics to data objects.
Definition at line 18 of file UsageStatsPlugin.inc.php.
UsageStatsPlugin::__construct | ( | ) |
Constructor.
Reimplemented from Plugin.
Definition at line 47 of file UsageStatsPlugin.inc.php.
References $application, and PKPApplication\get().
UsageStatsPlugin::_downloadStatsCacheMiss | ( | $cache, | |
$pubObjectId | |||
) |
Callback to fill cache with data, if empty.
$cache | FileCache |
$pubObjectId | int |
Definition at line 883 of file UsageStatsPlugin.inc.php.
References $application, PKPApplication\get(), and getReportPlugin().
UsageStatsPlugin::_getDownloadStats | ( | $pubObjectId | ) |
Get prepared download statistics from the DB
$pubObjectId | integer |
Definition at line 788 of file UsageStatsPlugin.inc.php.
References CacheManager\getManager(), and Application\getRepresentationDAO().
Referenced by getAllDownloadsStats().
UsageStatsPlugin::_getPluginSetting | ( | $context, | |
$name | |||
) |
Get context wide setting. If the context or the setting does not exist, get the site wide setting.
$context | Context |
$name | Setting name |
Definition at line 916 of file UsageStatsPlugin.inc.php.
References DAORegistry\getDAO(), and Plugin\getSetting().
Referenced by loadJavascript().
UsageStatsPlugin::_hashIp | ( | $ip, | |
$salt | |||
) |
Hash (SHA256) the given IP using the given SALT.
NB: This implementation was taken from OA-S directly. See http://sourceforge.net/p/openaccessstati/code-0/3/tree/trunk/logfile-parser/lib/logutils.php We just do not implement the PHP4 part as OJS dropped PHP4 support.
$ip | string |
$salt | string |
Definition at line 773 of file UsageStatsPlugin.inc.php.
Referenced by _writeUsageEventInLogFile().
UsageStatsPlugin::_writeUsageEventInLogFile | ( | $usageEvent | ) |
$usageEvent | array = compact( 'time', 'pubObject', 'assocType', 'canonicalUrl', 'mimeType', 'identifiers', 'docSize', 'downloadSuccess', 'serviceUri', 'ip', 'host', 'user', 'roles', 'userAgent', 'referrer', 'classification') |
Definition at line 669 of file UsageStatsPlugin.inc.php.
References _hashIp(), getSaltpath(), getUsageEventCurrentDayLogName(), getUsageEventLogsPath(), and validateSaltpath().
Referenced by logUsageEvent().
UsageStatsPlugin::addJavascriptData | ( | $data, | |
$pubObjectType, | |||
$pubObjectId, | |||
$contexts | |||
) |
Add a data set to the script data output
$data | array JS data to pass to the scripts |
$pubObjectType | string The type of object this data is for |
$pubObjectId | string The id of the object this data is for |
$contexts | string|array Contexts in which to load the scripts. |
Definition at line 497 of file UsageStatsPlugin.inc.php.
References Plugin\$request, PKPApplication\get(), and PKPTemplateManager\getManager().
Referenced by displayReaderArticleGraph(), displayReaderMonographGraph(), and displayReaderPreprintGraph().
UsageStatsPlugin::callbackLoadHandler | ( | $hookName, | |
$args | |||
) |
$hookName | string |
$args | array [ @option string page @option string op @option string handler file ] |
Definition at line 282 of file UsageStatsPlugin.inc.php.
References $op, LazyLoadPlugin\getName(), and Plugin\getPluginPath().
UsageStatsPlugin::callbackParseCronTab | ( | $hookName, | |
$args | |||
) |
$hookName | string |
$args | array [ @option array Task files paths ] |
Definition at line 305 of file UsageStatsPlugin.inc.php.
References Plugin\getEnabled(), Plugin\getPluginPath(), and Config\getVar().
UsageStatsPlugin::displayReaderArticleGraph | ( | $hookName, | |
$params | |||
) |
Add chart to article view page
Hooked to Templates::Article::Main
$hookName | string |
$params | array [ @option Smarty @option string HTML output to return ] |
Definition at line 542 of file UsageStatsPlugin.inc.php.
References addJavascriptData(), getAllDownloadsStats(), DAORegistry\getDAO(), Plugin\getSetting(), getTemplate(), and loadJavascript().
UsageStatsPlugin::displayReaderMonographGraph | ( | $hookName, | |
$params | |||
) |
Add chart to book view page
Hooked to Templates::Catalog::Book::Main
$hookName | string |
$params | arrayarray [ @option Smarty @option string HTML output to return ] |
Definition at line 584 of file UsageStatsPlugin.inc.php.
References addJavascriptData(), getAllDownloadsStats(), DAORegistry\getDAO(), Plugin\getSetting(), getTemplate(), and loadJavascript().
UsageStatsPlugin::displayReaderPreprintGraph | ( | $hookName, | |
$params | |||
) |
Add chart to preprint view page
Hooked to Templates::Preprint::Main
$hookName | string |
$params | array [ @option Smarty @option string HTML output to return ] |
Definition at line 626 of file UsageStatsPlugin.inc.php.
References addJavascriptData(), getAllDownloadsStats(), DAORegistry\getDAO(), Plugin\getSetting(), getTemplate(), and loadJavascript().
UsageStatsPlugin::displayReaderStatistics | ( | ) |
Register assets and output hooks to display statistics on the reader frontend.
Definition at line 149 of file UsageStatsPlugin.inc.php.
References $application, PKPApplication\get(), and HookRegistry\register().
Referenced by register().
UsageStatsPlugin::getActions | ( | $request, | |
$verb | |||
) |
Get a list of link actions for plugin management.
request | PKPRequest |
$actionArgs | array The list of action args to be included in request URLs. |
Reimplemented from Plugin.
Definition at line 249 of file UsageStatsPlugin.inc.php.
References Plugin\$request, getDisplayName(), Plugin\getEnabled(), and LazyLoadPlugin\getName().
UsageStatsPlugin::getAllDownloadsStats | ( | $pubObjectId, | |
$stats = array() |
|||
) |
Retrieve the allDownloads
dataset from the download stats
$pubObjectId | int ID of the object to get stats for |
$stats | array Optionally pass in stats that have already been fetched from _getDownloadStats(). |
allDownloads
dataset Definition at line 861 of file UsageStatsPlugin.inc.php.
References _getDownloadStats().
Referenced by displayReaderArticleGraph(), displayReaderMonographGraph(), and displayReaderPreprintGraph().
UsageStatsPlugin::getDescription | ( | ) |
Get a description of this plugin.
Reimplemented from Plugin.
Definition at line 188 of file UsageStatsPlugin.inc.php.
UsageStatsPlugin::getDisplayName | ( | ) |
Get the display name for this plugin.
Reimplemented from Plugin.
Definition at line 181 of file UsageStatsPlugin.inc.php.
Referenced by getActions().
|
protected |
Get all hooks that define the finished file download.
Definition at line 333 of file UsageStatsPlugin.inc.php.
References $application, and PKPApplication\get().
Referenced by logUsageEvent().
UsageStatsPlugin::getFilesPath | ( | ) |
Get the plugin's files path.
Definition at line 417 of file UsageStatsPlugin.inc.php.
Referenced by getUsageEventLogsPath().
& UsageStatsPlugin::getGeoLocationTool | ( | ) |
Get the geolocation tool to process geo localization data.
Definition at line 398 of file UsageStatsPlugin.inc.php.
References $tool.
UsageStatsPlugin::getInstallMigration | ( | ) |
Get the installation migration for this plugin.
Reimplemented from Plugin.
Definition at line 209 of file UsageStatsPlugin.inc.php.
UsageStatsPlugin::getInstallSitePluginSettingsFile | ( | ) |
Get the filename of the settings data for this plugin to install when the system is installed (i.e. site-level plugin settings). Subclasses using default settings should override this.
Reimplemented from Plugin.
Definition at line 202 of file UsageStatsPlugin.inc.php.
References Plugin\getPluginPath().
UsageStatsPlugin::getReportPlugin | ( | ) |
Get the report plugin object that implements the metric type details.
Definition at line 76 of file UsageStatsPlugin.inc.php.
References $application, and PKPApplication\get().
Referenced by _downloadStatsCacheMiss(), and register().
UsageStatsPlugin::getSaltpath | ( | ) |
Get the path to the salt file.
Definition at line 174 of file UsageStatsPlugin.inc.php.
References $_saltpath.
Referenced by _writeUsageEventInLogFile().
UsageStatsPlugin::getTemplate | ( | $args, | |
$template, | |||
$smarty | |||
) |
Fetch a template with the requested params
$args | array Variables to assign to the template |
$template | string Template file name |
$smarty | object Smarty template object |
Definition at line 527 of file UsageStatsPlugin.inc.php.
References Plugin\getTemplateResource().
Referenced by displayReaderArticleGraph(), displayReaderMonographGraph(), and displayReaderPreprintGraph().
UsageStatsPlugin::getUsageEventCurrentDayLogName | ( | ) |
Get current day usage event log name.
Definition at line 436 of file UsageStatsPlugin.inc.php.
Referenced by _writeUsageEventInLogFile().
UsageStatsPlugin::getUsageEventLogsPath | ( | ) |
Get the plugin's usage event logs path.
Definition at line 428 of file UsageStatsPlugin.inc.php.
References getFilesPath().
Referenced by _writeUsageEventInLogFile().
UsageStatsPlugin::isSitePlugin | ( | ) |
Site-wide plugins should override this function to return true.
Reimplemented from Plugin.
Definition at line 195 of file UsageStatsPlugin.inc.php.
UsageStatsPlugin::loadJavascript | ( | $contexts | ) |
Load the JavaScript assets and pass data to the scripts
$contexts | string|array Contexts in which to load the scripts. |
Definition at line 446 of file UsageStatsPlugin.inc.php.
References Plugin\$request, _getPluginSetting(), PKPApplication\get(), PKPTemplateManager\getManager(), and Plugin\getPluginPath().
Referenced by displayReaderArticleGraph(), displayReaderMonographGraph(), and displayReaderPreprintGraph().
UsageStatsPlugin::logUsageEvent | ( | $hookName, | |
$args | |||
) |
Log the usage event into a file.
$hookName | string |
$args | array [ @option string hook name @option array usage event = compact( 'time', 'pubObject', 'assocType', 'canonicalUrl', 'mimeType', 'identifiers', 'docSize', 'downloadSuccess', 'serviceUri', 'ip', 'host', 'user', 'roles', 'userAgent', 'referrer', 'classification') ] |
Definition at line 364 of file UsageStatsPlugin.inc.php.
References $_currentUsageEvent, _writeUsageEventInLogFile(), and getDownloadFinishedEventHooks().
UsageStatsPlugin::manage | ( | $args, | |
$request | |||
) |
Perform a management function.
$args | array |
$request | PKPRequest |
Reimplemented from Plugin.
Definition at line 217 of file UsageStatsPlugin.inc.php.
References Plugin\$request.
UsageStatsPlugin::register | ( | $category, | |
$path, | |||
$mainContextId = null |
|||
) |
Load and initialize the plug-in and register plugin hooks.
For backwards compatibility this method will be called whenever the plug-in's category is being loaded. If, however, registerOn() returns an array then this method will only be called when the plug-in is enabled and an entry in the result set of registerOn() matches the current request operation. An empty array matches all request operations.
$category | String Name of category plugin was registered to |
$path | String The path the plugin was found in |
$mainContextId | integer To identify if the plugin is enabled we need a context. This context is usually taken from the request but sometimes there is no context in the request (e.g. when executing CLI commands). Then the main context can be given as an explicit ID. |
Reimplemented from LazyLoadPlugin.
Definition at line 101 of file UsageStatsPlugin.inc.php.
References Plugin\$request, Plugin\_registerTemplateResource(), displayReaderStatistics(), PKPApplication\get(), Plugin\getEnabled(), Plugin\getPluginPath(), getReportPlugin(), Plugin\getSetting(), Config\getVar(), PluginRegistry\register(), and HookRegistry\register().
UsageStatsPlugin::validateSaltpath | ( | $saltpath | ) |
Validate that the path of the salt file exists and is writable.
$saltpath | string |
Definition at line 318 of file UsageStatsPlugin.inc.php.
Referenced by _writeUsageEventInLogFile().
$_currentUsageEvent UsageStatsPlugin::$_currentUsageEvent |
$_dataPrivacyOn UsageStatsPlugin::$_dataPrivacyOn |
boolean
Definition at line 30 of file UsageStatsPlugin.inc.php.
$_optedOut UsageStatsPlugin::$_optedOut |
boolean
Definition at line 36 of file UsageStatsPlugin.inc.php.
$_saltpath UsageStatsPlugin::$_saltpath |