Open Journal Systems  3.3.0
Core Class Reference

Public Member Functions

 _checkBaseUrl ($baseUrl, $url)
 
 _getBaseUrlAndPath ($url)
 
 removeBaseUrl ($url)
 

Static Public Member Functions

static _botFileListCacheMiss ($cache)
 
static checkGeneralPHPModule ($moduleName)
 
static cleanFileVar ($var)
 
static getArgs ($urlInfo, $isPathInfo, $userVars=array())
 
static getBaseDir ()
 
static getContextPaths ($urlInfo, $isPathInfo, $contextList=null, $contextDepth=null, $userVars=array())
 
static getCurrentDate ($ts=null)
 
static getOp ($urlInfo, $isPathInfo, $userVars=array())
 
static getPage ($urlInfo, $isPathInfo, $userVars=array())
 
static isUserAgentBot ($userAgent, $botRegexpsFile=COUNTER_USER_AGENTS_FILE)
 
static isWindows ()
 
static microtime ()
 

Static Public Attributes

static $botRegexps = array()
 

Detailed Description

Class containing system-wide functions.

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

Member Function Documentation

◆ _botFileListCacheMiss()

static Core::_botFileListCacheMiss (   $cache)
static

Bot list file cache miss fallback.

Parameters
$cacheFileCache
Returns
array:

Definition at line 391 of file Core.inc.php.

References $botRegexps, and Registry\get().

◆ _checkBaseUrl()

Core::_checkBaseUrl (   $baseUrl,
  $url 
)

Check if the passed base url is part of the passed url, based on the context base url configuration. Both parameters can represent full url (host plus path) or just the path, but they have to be consistent.

Parameters
$baseUrlstring Full base url or just it's path info.
$urlstring Full url or just it's path info.
Returns
boolean

Definition at line 350 of file Core.inc.php.

References Config\getContextBaseUrls().

Referenced by _getBaseUrlAndPath().

◆ _getBaseUrlAndPath()

Core::_getBaseUrlAndPath (   $url)

Try to get the base url and, if configuration is set to use base url override, context path for the passed url.

Parameters
$urlstring
Returns
array With two elements, base url and context path.

Definition at line 286 of file Core.inc.php.

References _checkBaseUrl(), Config\getContextBaseUrls(), and Config\getVar().

Referenced by removeBaseUrl().

◆ checkGeneralPHPModule()

static Core::checkGeneralPHPModule (   $moduleName)
static

Checks to see if a PHP module is enabled.

Parameters
$moduleNamestring
Returns
boolean

Definition at line 89 of file Core.inc.php.

◆ cleanFileVar()

static Core::cleanFileVar (   $var)
static

Sanitize a value to be used in a file path. Removes any characters except alphanumeric characters, underscores, and dashes.

Parameters
$varstring
Returns
string

Definition at line 54 of file Core.inc.php.

References PKPString\regexp_replace().

Referenced by customAutoload(), getContextPaths(), APIRouter\getEntity(), getOp(), getPage(), and APIRouter\getVersion().

◆ getArgs()

static Core::getArgs (   $urlInfo,
  $isPathInfo,
  $userVars = array() 
)
static

Get the arguments present into the passed url information (not GET/POST arguments, only arguments appended to the URL separated by "/"). It expects that urls were built using the system.

Parameters
$urlInfostring Full url or just path info.
$isPathInfoboolean Tell if the passed url info string is a path info or not.
$userVarsarray (optional) Pass GET variables if needed (for testing only).
Returns
array

Definition at line 221 of file Core.inc.php.

◆ getBaseDir()

◆ getContextPaths()

static Core::getContextPaths (   $urlInfo,
  $isPathInfo,
  $contextList = null,
  $contextDepth = null,
  $userVars = array() 
)
static

Get context paths present into the passed url information.

Parameters
$urlInfostring Full url or just path info.
$isPathInfoboolean Whether the passed url info string is a path info or not.
$contextListarray (optional)
$contextDepthint (optional)
$userVarsarray (optional) Pass GET variables if needed (for testing only).
Returns
array

Definition at line 137 of file Core.inc.php.

References $application, cleanFileVar(), and PKPApplication\get().

Referenced by PKPRouter\getRequestedContextPaths().

◆ getCurrentDate()

static Core::getCurrentDate (   $ts = null)
static

Return the current date in ISO (YYYY-MM-DD HH:MM:SS) format.

Parameters
$tsint optional, use specified timestamp instead of current time
Returns
string

Definition at line 63 of file Core.inc.php.

Referenced by APP\components\forms\publication\PublishForm\__construct(), QueryNoteForm\__construct(), QueryForm\__construct(), MarkupConversionHelper\_addDependentImageToXmlDocument(), TextureHandler\_createDependentFile(), SubmissionFileManager\_instantiateSubmissionFile(), PKP\Services\PKPSiteService\_saveFileParam(), PKP\Services\PKPContextService\_saveFileParam(), PKP\Services\PKPPublicationService\_saveFileParam(), TextureHandler\_updateManuscriptFile(), RegistrationHandler\activateUser(), PKP\Services\PKPAnnouncementService\add(), PKP\Services\PKPSubmissionService\add(), ScheduledTask\addExecutionLogEntry(), MarkupConversionHelper\addFileToSubmissionGalley(), Installer\addPluginVersions(), EditorAction\addReviewer(), MarkupConversionHelper\addXmlDocumentToSubmissionFileList(), PKPUsageEventPlugin\buildUsageEvent(), ReviewerAction\confirmReview(), SubmissionFileManager\copyFileToFileStage(), AccessKeyManager\createKey(), AccessKeyDAO\deleteExpiredKeys(), PKPSubmissionSubmitStep4Form\execute(), CreateReviewerForm\execute(), ThankReviewerForm\execute(), PKPReviewerReviewStep3Form\execute(), ReviewReminderForm\execute(), RecommendationForm\execute(), RegistrationForm\execute(), CategoryForm\execute(), UserDetailsForm\execute(), QuickSubmitForm\execute(), ReviewerForm\execute(), PublishSubmissions\executeActions(), AnnouncementFeedGatewayPlugin\fetch(), Version\fromString(), IssueFileManager\fromTemporaryFile(), AccessKeyDAO\getAccessKey(), AccessKeyDAO\getAccessKeyByKeyHash(), AccessKeyDAO\getAccessKeyByUserId(), QuickSubmitForm\getIssueOptions(), PKP\Services\QueryBuilders\PKPSubmissionQueryBuilder\getQuery(), NativeXmlSubmissionFileFilter\handleRevisionElement(), TemporaryFileManager\handleUpload(), QueuedPaymentDAO\insertObject(), OJSCompletedPaymentDAO\insertObject(), NotificationDAO\insertObject(), NoteDAO\insertObject(), StageAssignmentDAO\insertObject(), VersionDAO\insertVersion(), IndividualSubscriptionDAO\isValidIndividualSubscription(), InstitutionalSubscriptionDAO\isValidInstitutionalSubscription(), PluginGridHandler\loadCategoryData(), SubmissionMailTemplate\log(), SubmissionFileLog\logEvent(), SubmissionLog\logEvent(), NotificationsGridHandler\markRead(), OrcidHandler\orcidVerify(), NativeXmlSubmissionFilter\populateObject(), PKP\Services\PKPPublicationService\publish(), IssueGridHandler\publishIssue(), EditorAction\recordDecision(), Validation\registerUserSession(), PKPReviewerGridHandler\reviewRead(), PKPReviewerReviewStep3Form\saveReviewForm(), PKPStageParticipantNotifyForm\sendMessage(), ReviewReminder\sendReminder(), PKPSubmissionSubmitStep1Form\setCommentsToEditor(), DataObjectTombstone\stampDateDeleted(), PKPSubmission\stampLastActivity(), PKPSubmission\stampModified(), Issue\stampModified(), PKPPublication\stampModified(), ReviewAssignment\stampModified(), TemporaryFileManager\submissionToTemporaryFile(), PKPReviewerGridHandler\unconsiderReview(), QueuedPaymentDAO\updateObject(), NoteDAO\updateObject(), StageAssignmentDAO\updateObject(), and PublicProfileForm\uploadProfileImage().

◆ getOp()

static Core::getOp (   $urlInfo,
  $isPathInfo,
  $userVars = array() 
)
static

Get the operation present into the passed url information. It expects that urls were built using the system.

Parameters
$urlInfostring Full url or just path info.
$isPathInfoboolean Tell if the passed url info string is a path info or not.
$userVarsarray (optional) Pass GET variables if needed (for testing only).
Returns
string

Definition at line 204 of file Core.inc.php.

References cleanFileVar().

◆ getPage()

static Core::getPage (   $urlInfo,
  $isPathInfo,
  $userVars = array() 
)
static

Get the page present into the passed url information. It expects that urls were built using the system.

Parameters
$urlInfostring Full url or just path info.
$isPathInfoboolean Tell if the passed url info string is a path info or not.
$userVarsarray (optional) Pass GET variables if needed (for testing only).
Returns
string

Definition at line 188 of file Core.inc.php.

References cleanFileVar().

◆ isUserAgentBot()

static Core::isUserAgentBot (   $userAgent,
  $botRegexpsFile = COUNTER_USER_AGENTS_FILE 
)
static

Check the passed user agent for a bot.

Parameters
$userAgentstring
$botRegexpsFilestring An alternative file with regular expressions to find bots inside user agent strings.
Returns
boolean

Definition at line 103 of file Core.inc.php.

References $botRegexps, CACHE_TYPE_FILE, CacheManager\getManager(), PKPString\regexp_match(), and Registry\set().

Referenced by PKPRequest\isBot(), and UsageStatsLoader\processFile().

◆ isWindows()

static Core::isWindows ( )
static

Check if the server platform is Windows.

Returns
boolean

Definition at line 80 of file Core.inc.php.

References strtolower_codesafe().

Referenced by InstallForm\initData().

◆ microtime()

static Core::microtime ( )
static

Return *nix timestamp with microseconds (in units of seconds).

Returns
float

Definition at line 71 of file Core.inc.php.

Referenced by PKPApplication\__construct(), DAO\retrieve(), DAO\retrieveCached(), DAO\retrieveLimit(), DAO\retrieveRange(), and DAO\update().

◆ removeBaseUrl()

Core::removeBaseUrl (   $url)

Remove base url from the passed url, if any. Also, if true, checks for the context path in url and if it's missing, tries to add it.

Parameters
$urlstring
Returns
string|bool The url without base url, false if it was not possible to remove it.

Definition at line 233 of file Core.inc.php.

References _getBaseUrlAndPath().

Referenced by CoreTest\testRemoveBaseUrl(), and CoreTest\testRemoveBaseUrlOverride().

Field Documentation

◆ $botRegexps

array Core::$botRegexps = array()
static

The regular expressions that will find a bot user agent

Definition at line 31 of file Core.inc.php.

Referenced by _botFileListCacheMiss(), and isUserAgentBot().


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