PHP Class PKPUsageStatsPlugin, pkp-lib

Inheritance: extends GenericPlugin
显示文件 Open project: pkp/pkp-lib Class Usage Examples

Public Properties

Property Type Description
$_currentUsageEvent array
$_dataPrivacyOn boolean
$_optedOut boolean
$_saltpath string

Public Methods

Method Description
__construct ( ) Constructor.
_downloadStatsCacheMiss ( $cache, $pubObjectId ) : array Callback to fill cache with data, if empty.
_getColor ( $num ) : string Return a color RGB code to be used in the graph.
_getDownloadStats ( $pubObjectId ) : array Get prepared download statistics from the DB
_hashIp ( $ip, $salt ) : string | boolean Hash (SHA256) the given IP using the given SALT.
_writeUsageEventInLogFile ( $usageEvent )
addJavascriptData ( $data, $pubObjectType, $pubObjectId, $contexts ) : null Add a data set to the script data output
callbackLoadCategory ( $hookName, $args )
callbackLoadHandler ( $hookName, $args )
callbackParseCronTab ( $hookName, $args )
getActions ( $request, $verb )
getAllDownloadsStats ( $pubObjectId, $stats = [] ) Retrieve the allDownloads dataset from the download stats
getDescription ( )
getDisplayName ( )
getFilesPath ( ) : string Get the plugin's files path.
getGeoLocationTool ( ) : mixed Get the geolocation tool to process geo localization data.
getInstallSchemaFile ( )
getInstallSitePluginSettingsFile ( )
getReportPlugin ( ) Get the report plugin object that implements the metric type details.
getSaltpath ( ) : string Get the path to the salt file.
getTemplate ( $args, $template, $smarty ) : string Fetch a template with the requested params
getTemplatePath ( $inCore = false )
getUsageEventCurrentDayLogName ( ) : string Get current day usage event log name.
getUsageEventLogsPath ( ) : string Get the plugin's usage event logs path.
isSitePlugin ( )
loadJavascript ( $contexts ) : null Load the JavaScript assets and pass data to the scripts
logUsageEvent ( $hookName, $args ) : boolean Log the usage event into a file.
manage ( $args, $request )
register ( $category, $path )
statisticsDisplayCallback ( $hookName, $params ) : boolean Adds/renders the submission level metrics markup, if any stats.
templateManagerCallback ( $hookName, $params ) Template manager hook callback.
validateSaltpath ( $saltpath ) : boolean Validate that the path of the salt file exists and is writable.

Method Details

__construct() public method

Constructor.
public __construct ( )

_downloadStatsCacheMiss() public method

Callback to fill cache with data, if empty.
public _downloadStatsCacheMiss ( $cache, $pubObjectId ) : array
$cache FileCache
$pubObjectId int
return array

_getColor() public method

Return a color RGB code to be used in the graph.
public _getColor ( $num ) : string
$num integer
return string

_getDownloadStats() public method

Get prepared download statistics from the DB
public _getDownloadStats ( $pubObjectId ) : array
$pubObjectId integer
return array

_hashIp() public method

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.
public _hashIp ( $ip, $salt ) : string | boolean
$ip string
$salt string
return string | boolean The hashed IP or boolean false if something went wrong.

_writeUsageEventInLogFile() public method

public _writeUsageEventInLogFile ( $usageEvent )
$usageEvent array

addJavascriptData() public method

Add a data set to the script data output
public addJavascriptData ( $data, $pubObjectType, $pubObjectId, $contexts ) : null
$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.
return null

callbackLoadCategory() public method

See also: PluginRegistry::loadCategory()
public callbackLoadCategory ( $hookName, $args )

callbackLoadHandler() public method

See also: PKPPageRouter::route()
public callbackLoadHandler ( $hookName, $args )

callbackParseCronTab() public method

See also: AcronPlugin::parseCronTab()
public callbackParseCronTab ( $hookName, $args )

getActions() public method

See also: Plugin::getActions()
public getActions ( $request, $verb )

getAllDownloadsStats() public method

Retrieve the allDownloads dataset from the download stats
public getAllDownloadsStats ( $pubObjectId, $stats = [] )
$pubObjectId int ID of the object to get stats for
$stats array Optionally pass in stats that have already been fetched from _getDownloadStats().

getDescription() public method

See also: PKPPlugin::getDescription()
public getDescription ( )

getDisplayName() public method

See also: PKPPlugin::getDisplayName()
public getDisplayName ( )

getFilesPath() public method

Get the plugin's files path.
public getFilesPath ( ) : string
return string

getGeoLocationTool() public method

Get the geolocation tool to process geo localization data.
public getGeoLocationTool ( ) : mixed
return mixed GeoLocationTool object or null

getInstallSchemaFile() public method

getInstallSitePluginSettingsFile() public method

See also: PKPPlugin::getInstallSitePluginSettingsFile()

getReportPlugin() public method

Get the report plugin object that implements the metric type details.
public getReportPlugin ( )

getSaltpath() public method

Get the path to the salt file.
public getSaltpath ( ) : string
return string

getTemplate() public method

Fetch a template with the requested params
public getTemplate ( $args, $template, $smarty ) : string
$args array Variables to assign to the template
$template array Template file name
$smarty object Smarty template object
return string

getTemplatePath() public method

public getTemplatePath ( $inCore = false )

getUsageEventCurrentDayLogName() public method

Get current day usage event log name.

getUsageEventLogsPath() public method

Get the plugin's usage event logs path.
public getUsageEventLogsPath ( ) : string
return string

isSitePlugin() public method

See also: PKPPlugin::isSitePlugin()
public isSitePlugin ( )

loadJavascript() public method

Load the JavaScript assets and pass data to the scripts
public loadJavascript ( $contexts ) : null
$contexts string|array Contexts in which to load the scripts.
return null

logUsageEvent() public method

Log the usage event into a file.
public logUsageEvent ( $hookName, $args ) : boolean
$hookName string
$args array
return boolean

manage() public method

See also: PKPPlugin::manage()
public manage ( $args, $request )

register() public method

See also: LazyLoadPlugin::register()
public register ( $category, $path )

statisticsDisplayCallback() public method

This is temporarily unused. When backend display of statistics is implemented it may be useful.
public statisticsDisplayCallback ( $hookName, $params ) : boolean
$hookName string
$params
return boolean

templateManagerCallback() public method

Add ditional header data: JS and CSS for statistics display This is temporarily unused. When backend display of statistics is implemented in my be of use.
public templateManagerCallback ( $hookName, $params )
$hookName string
$params array

validateSaltpath() public method

Validate that the path of the salt file exists and is writable.
public validateSaltpath ( $saltpath ) : boolean
$saltpath string
return boolean

Property Details

$_currentUsageEvent public_oe property

array
public $_currentUsageEvent

$_dataPrivacyOn public_oe property

boolean
public $_dataPrivacyOn

$_optedOut public_oe property

boolean
public $_optedOut

$_saltpath public_oe property

string
public $_saltpath