PHP Class PKPUsageStatsPlugin, pkp-lib

Inheritance: extends GenericPlugin
Afficher le fichier Open project: pkp/pkp-lib Class Usage Examples

Méthodes publiques

Свойство Type Description
$_currentUsageEvent array
$_dataPrivacyOn boolean
$_optedOut boolean
$_saltpath string

Méthodes publiques

Méthode 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 méthode

Constructor.
public __construct ( )

_downloadStatsCacheMiss() public méthode

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

_getColor() public méthode

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

_getDownloadStats() public méthode

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

_hashIp() public méthode

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
Résultat string | boolean The hashed IP or boolean false if something went wrong.

_writeUsageEventInLogFile() public méthode

public _writeUsageEventInLogFile ( $usageEvent )
$usageEvent array

addJavascriptData() public méthode

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.
Résultat null

callbackLoadCategory() public méthode

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

callbackLoadHandler() public méthode

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

callbackParseCronTab() public méthode

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

getActions() public méthode

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

getAllDownloadsStats() public méthode

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 méthode

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

getDisplayName() public méthode

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

getFilesPath() public méthode

Get the plugin's files path.
public getFilesPath ( ) : string
Résultat string

getGeoLocationTool() public méthode

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

getInstallSchemaFile() public méthode

getInstallSitePluginSettingsFile() public méthode

See also: PKPPlugin::getInstallSitePluginSettingsFile()

getReportPlugin() public méthode

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

getSaltpath() public méthode

Get the path to the salt file.
public getSaltpath ( ) : string
Résultat string

getTemplate() public méthode

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
Résultat string

getTemplatePath() public méthode

public getTemplatePath ( $inCore = false )

getUsageEventCurrentDayLogName() public méthode

Get current day usage event log name.

getUsageEventLogsPath() public méthode

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

isSitePlugin() public méthode

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

loadJavascript() public méthode

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

logUsageEvent() public méthode

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

manage() public méthode

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

register() public méthode

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

statisticsDisplayCallback() public méthode

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

templateManagerCallback() public méthode

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 méthode

Validate that the path of the salt file exists and is writable.
public validateSaltpath ( $saltpath ) : boolean
$saltpath string
Résultat 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