Open Journal Systems  3.3.0
APIHandler Class Reference
Inheritance diagram for APIHandler:
PKPHandler IssueHandler PKPAnnouncementHandler PKPBackendPaymentsSettingsHandler PKPBackendSubmissionsHandler PKPContextHandler PKPEmailTemplateHandler PKPSiteHandler PKPStatsEditorialHandler PKPStatsPublicationHandler PKPStatsUserHandler PKPSubmissionHandler PKPTemporaryFilesHandler PKPUploadPublicFileHandler PKPUserHandler PKPVocabHandler

Public Member Functions

 __construct ()
 
 convertStringsToSchema ($schema, $params)
 
 getApp ()
 
 getEndpointPattern ()
 
 getEndpoints ()
 
 getEntityId ($parameterName)
 
 getParameter ($parameterName, $default=null)
 
 getRequest ()
 
 getSlimRequest ()
 
 setSlimRequest ($slimRequest)
 
 setupEndpoints ()
 
- Public Member Functions inherited from PKPHandler
 addPolicy ($authorizationPolicy, $addToTop=false)
 
 addRoleAssignment ($roleIds, $operations)
 
 authorize ($request, &$args, $roleAssignments)
 
 getApiToken ()
 
getAuthorizedContext ()
 
getAuthorizedContextObject ($assocType)
 
getDispatcher ()
 
 getFirstUserContext ($user, $contexts)
 
 getId ()
 
 getLastAuthorizationMessage ()
 
 getRoleAssignment ($roleId)
 
 getRoleAssignments ()
 
 getSiteRedirectContext ($request)
 
 getTargetContext ($request, &$contextsCount=null)
 
 index ($args, $request)
 
 initialize ($request)
 
 markRoleAssignmentsChecked ()
 
 requireSSL ()
 
 setApiToken ($apiToken)
 
 setDispatcher ($dispatcher)
 
 setEnforceRestrictedSite ($enforceRestrictedSite)
 
 setId ($id)
 
 setupTemplate ($request)
 
 validate ($requiredContexts=null, $request=null)
 

Protected Member Functions

 _validateStatDates ($params, $dateStartParam='dateStart', $dateEndParam='dateEnd')
 

Protected Attributes

 $_app
 
 $_endpoints = array()
 
 $_handlerPath = null
 
 $_pathPattern
 
 $_request
 
 $_slimRequest = null
 
- Protected Attributes inherited from PKPHandler
 $_apiToken = null
 

Additional Inherited Members

- Static Public Member Functions inherited from PKPHandler
static getPageParamName ($rangeName)
 
static getRangeInfo ($request, $rangeName, $contextData=null)
 
static hashPageContext ($request, $contextData=array())
 
- Data Fields inherited from PKPHandler
 $_authorizationDecisionManager
 
 $_checks = array()
 
 $_dispatcher
 
 $_enforceRestrictedSite = true
 
 $_id
 
 $_isBackendPage = false
 
 $_roleAssignments = array()
 
 $_roleAssignmentsChecked = false
 

Detailed Description

Base request API handler.

Definition at line 22 of file APIHandler.inc.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ _validateStatDates()

APIHandler::_validateStatDates (   $params,
  $dateStartParam = 'dateStart',
  $dateEndParam = 'dateEnd' 
)
protected

A helper method to validate start and end date params for stats API handlers

  1. Checks the date formats
  2. Ensures a start date is not earlier than STATISTICS_EARLIEST_DATE
  3. Ensures an end date is no later than yesterday
  4. Ensures the start date is not later than the end date
Parameters
array$paramsThe params to validate
string$dateStartParamWhere the find the start date in the array of params
string$dateEndParamWhere to find the end date in the array of params
Returns
boolean|string True if they validate, or a string which contains the locale key of an error message.

Definition at line 396 of file APIHandler.inc.php.

References ValidatorFactory\make().

Referenced by PKPStatsUserHandler\get(), PKPStatsEditorialHandler\get(), PKPStatsPublicationHandler\get(), PKPStatsPublicationHandler\getAbstract(), PKPStatsPublicationHandler\getGalley(), PKPStatsPublicationHandler\getMany(), PKPStatsPublicationHandler\getManyAbstract(), and PKPStatsPublicationHandler\getManyGalley().

◆ convertStringsToSchema()

APIHandler::convertStringsToSchema (   $schema,
  $params 
)

Convert string values in boolean, integer and number parameters to their appropriate type when the string is in a recognizable format.

Converted booleans: False: "0", "false". True: "true", "1" Converted integers: Anything that passes ctype_digit() Converted floats: Anything that passes is_numeric()

Empty strings will be converted to null.

Parameters
$schemastring One of the SCHEMA_... constants
$paramsarray Key/value parameters to be validated
Returns
array Converted parameters

Definition at line 281 of file APIHandler.inc.php.

References PKPServices\get().

Referenced by PKPAnnouncementHandler\add(), PKPEmailTemplateHandler\add(), PKPContextHandler\add(), PKPSubmissionHandler\add(), PKPSubmissionHandler\addPublication(), PKPSiteHandler\edit(), PKPAnnouncementHandler\edit(), PKPEmailTemplateHandler\edit(), PKPContextHandler\edit(), PKPSubmissionHandler\edit(), and PKPSubmissionHandler\editPublication().

◆ getApp()

APIHandler::getApp ( )

Get the Slim application.

Returns
App

Definition at line 174 of file APIHandler.inc.php.

References $_app.

Referenced by __construct(), and setupEndpoints().

◆ getEndpointPattern()

◆ getEndpoints()

APIHandler::getEndpoints ( )

Returns the list of endpoints

Returns
array

Definition at line 231 of file APIHandler.inc.php.

References $_endpoints.

Referenced by setupEndpoints().

◆ getEntityId()

APIHandler::getEntityId (   $parameterName)

Get the entity ID for a specified parameter name. (Parameter names are generally defined in authorization policies

Returns
int|string?

Definition at line 200 of file APIHandler.inc.php.

◆ getParameter()

APIHandler::getParameter (   $parameterName,
  $default = null 
)

Fetches parameter value

Parameters
string$parameterName
mixed$default
Returns
mixed

Definition at line 243 of file APIHandler.inc.php.

References getSlimRequest().

◆ getRequest()

APIHandler::getRequest ( )

Return PKP request object

Returns
PKPRequest

Definition at line 149 of file APIHandler.inc.php.

References $_request.

Referenced by PKPStatsPublicationHandler\_processAllowedParams(), PKPStatsPublicationHandler\_processSearchPhrase(), PKPAnnouncementHandler\add(), PKPEmailTemplateHandler\add(), PKPContextHandler\add(), PKPSubmissionHandler\add(), PKPSubmissionHandler\addPublication(), PKPBackendSubmissionsHandler\delete(), PKPAnnouncementHandler\delete(), PKPEmailTemplateHandler\delete(), PKPSubmissionHandler\delete(), PKPContextHandler\delete(), PKPSubmissionHandler\deletePublication(), PKPBackendPaymentsSettingsHandler\edit(), PKPSiteHandler\edit(), PKPAnnouncementHandler\edit(), PKPEmailTemplateHandler\edit(), PKPContextHandler\edit(), PKPSubmissionHandler\edit(), PKPSubmissionHandler\editPublication(), PKPSiteHandler\editTheme(), PKPContextHandler\editTheme(), PKPStatsUserHandler\get(), PKPStatsEditorialHandler\get(), PKPSiteHandler\get(), PKPAnnouncementHandler\get(), PKPUserHandler\get(), PKPEmailTemplateHandler\get(), PKPContextHandler\get(), IssueHandler\get(), PKPStatsPublicationHandler\get(), PKPStatsPublicationHandler\getAbstract(), PKPStatsEditorialHandler\getAverages(), IssueHandler\getCurrent(), PKPStatsPublicationHandler\getGalley(), PKPUserHandler\getMany(), PKPBackendSubmissionsHandler\getMany(), IssueHandler\getMany(), PKPEmailTemplateHandler\getMany(), PKPContextHandler\getMany(), PKPStatsPublicationHandler\getMany(), PKPAnnouncementHandler\getMany(), PKPStatsPublicationHandler\getManyAbstract(), PKPStatsPublicationHandler\getManyGalley(), PKPSubmissionHandler\getPublication(), PKPSubmissionHandler\getPublications(), PKPUserHandler\getReviewers(), PKPSiteHandler\getTheme(), PKPContextHandler\getTheme(), PKPSubmissionHandler\publishPublication(), PKPEmailTemplateHandler\restoreDefaults(), PKPSubmissionHandler\unpublishPublication(), PKPUploadPublicFileHandler\uploadFile(), PKPTemporaryFilesHandler\uploadFile(), and PKPSubmissionHandler\versionPublication().

◆ getSlimRequest()

APIHandler::getSlimRequest ( )

Return Slim request object

Returns
SlimRequest|null

Definition at line 158 of file APIHandler.inc.php.

References $_slimRequest.

Referenced by IssueHandler\authorize(), PKPStatsPublicationHandler\authorize(), PKPSubmissionHandler\authorize(), and getParameter().

◆ setSlimRequest()

APIHandler::setSlimRequest (   $slimRequest)

Set Slim request object

Definition at line 166 of file APIHandler.inc.php.

◆ setupEndpoints()

APIHandler::setupEndpoints ( )

setup endpoints

Definition at line 208 of file APIHandler.inc.php.

References PKPHandler\addRoleAssignment(), HookRegistry\call(), getApp(), and getEndpoints().

Referenced by __construct().

Field Documentation

◆ $_app

APIHandler::$_app
protected

Definition at line 23 of file APIHandler.inc.php.

Referenced by getApp().

◆ $_endpoints

APIHandler::$_endpoints = array()
protected

Definition at line 25 of file APIHandler.inc.php.

Referenced by getEndpoints().

◆ $_handlerPath

string APIHandler::$_handlerPath = null
protected

The unique endpoint string for this handler

Definition at line 38 of file APIHandler.inc.php.

Referenced by getEndpointPattern().

◆ $_pathPattern

string APIHandler::$_pathPattern
protected

The endpoint pattern for this handler

Definition at line 32 of file APIHandler.inc.php.

Referenced by getEndpointPattern().

◆ $_request

APIHandler::$_request
protected

Definition at line 24 of file APIHandler.inc.php.

Referenced by getRequest().

◆ $_slimRequest

APIHandler::$_slimRequest = null
protected

Definition at line 26 of file APIHandler.inc.php.

Referenced by getSlimRequest().


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