Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
Core Class Reference

Public Member Functions

 _botFileListCacheMiss (&$cache)
 
 _checkBaseUrl ($baseUrl, $url)
 
 _filterBotRegexps (&$regexp)
 
 _getBaseUrlAndPath ($url)
 
 _getUrlComponents ($urlInfo, $isPathInfo, $offset, $varName= '', $userVars=array())
 
 _getUserVar ($url, $varName, $userVars=array())
 
 cleanFileVar ($var)
 
 cleanVar ($var)
 
 getArgs ($urlInfo, $isPathInfo, $userVars=array())
 
 getBaseDir ()
 
 getContextPaths ($urlInfo, $isPathInfo, $contextList=null, $contextDepth=null, $userVars=array())
 
 getCurrentDate ($ts=null)
 
 getOp ($urlInfo, $isPathInfo, $userVars=array())
 
 getPage ($urlInfo, $isPathInfo, $userVars=array())
 
 isUserAgentBot ($userAgent, $botRegexpsFile=USER_AGENTS_FILE)
 
 isWindows ()
 
 microtime ()
 
 removeBaseUrl ($url)
 
 serverPHPOS ()
 
 serverPHPVersion ()
 

Detailed Description

Class containing system-wide functions.

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

Member Function Documentation

Core::_botFileListCacheMiss ( $cache)

Bot list file cache miss fallback.

Parameters
$cacheFileCache
Returns
array:

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

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 377 of file Core.inc.php.

References Config\getContextBaseUrls().

Referenced by _getBaseUrlAndPath().

Core::_filterBotRegexps ( $regexp)

Filter the regular expressions to find bots, adding delimiters if necessary.

Parameters
$regexpstring

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

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 Base url and context path strings, false if not found or not the case.

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

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

Referenced by removeBaseUrl().

Core::_getUrlComponents (   $urlInfo,
  $isPathInfo,
  $offset,
  $varName = '',
  $userVars = array() 
)

Get url components (page, operation and args) based on the passed offset.

Parameters
$urlInfostring
$isPathInfostring
$offsetint
$varNamestring
$userVarsarray (optional) GET variables (only for testing).
Returns
mixed array|string|null

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

References _getUserVar(), cleanVar(), and PKPApplication\getApplication().

Referenced by getArgs(), getOp(), and getPage().

Core::_getUserVar (   $url,
  $varName,
  $userVars = array() 
)

Get passed variable value inside the passed url.

Parameters
$urlstring
$varNamestring
$userVarsarray
Returns
string|null

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

Referenced by _getUrlComponents(), and getContextPaths().

Core::cleanFileVar (   $var)

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 85 of file Core.inc.php.

References String\regexp_replace().

Referenced by getContextPaths(), getOp(), and getPage().

Core::cleanVar (   $var)

Sanitize a variable. Removes leading and trailing whitespace, normalizes all characters to UTF-8.

Parameters
$varstring
Returns
string

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

References Config\getVar(), String\html2utf(), String\utf8_bad_strip(), String\utf8_is_valid(), String\utf8_normalize(), and String\utf8_strip_ascii_ctrl().

Referenced by _getUrlComponents(), PKPRequest\cleanUserVar(), ArticleSearchIndex\filterKeywords(), Form\setData(), and OAIMetadataFormat_NLM\toXml().

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

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 252 of file Core.inc.php.

References _getUrlComponents().

Referenced by UsageStatsLoader\_getAssocFromUrl().

Core::getBaseDir ( )

Get the path to the base installation directory.

Returns
string

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

Referenced by PluginManagementHandler\_deletePlugin(), PluginManagementHandler\_installPlugin(), and PluginManagementHandler\_upgradePlugin().

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

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 168 of file Core.inc.php.

References _getUserVar(), cleanFileVar(), and PKPApplication\getApplication().

Referenced by UsageStatsLoader\_getAssocFromUrl(), and PKPRouter\getRequestedContextPaths().

Core::getCurrentDate (   $ts = null)

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 94 of file Core.inc.php.

Referenced by ObjectsForReviewEditorHandler\_assign(), UsageEventPlugin\_buildUsageEvent(), IssueFileManager\_handleUpload(), RegistrationHandler\activateUser(), Installer\addPluginVersions(), SectionEditorAction\addReviewer(), SectionEditorAction\addSubmissionNote(), TemporaryFileManager\articleToTemporaryFile(), BooksForReviewEditorHandler\assignBookForReviewAuthor(), EditorAction\assignEditor(), SectionEditorAction\cancelReview(), AuthorAction\completeAuthorCopyedit(), CopyeditorAction\completeCopyedit(), SectionEditorAction\completeCopyedit(), CopyeditorAction\completeFinalCopyedit(), SectionEditorAction\completeFinalCopyedit(), LayoutEditorAction\completeLayoutEditing(), LayoutEditorHandler\completeProofreader(), ReviewerAction\confirmReview(), SectionEditorAction\confirmReviewForReviewer(), ArticleFileManager\copyAndRenameFile(), CopyeditorAction\copyeditUnderway(), AuthorAction\copyeditUnderway(), AccessKeyManager\createKey(), AccessKeyDAO\deleteExpiredKeys(), SubmissionEditHandler\editorCompleteLayoutEditor(), SubmissionEditHandler\editorCompleteProofreader(), SubmissionEditHandler\editorInitiateLayoutEditor(), SubmissionEditHandler\editorInitiateProofreader(), EmailHandler\email(), AuthorAction\emailEditorDecisionComment(), SectionEditorAction\emailEditorDecisionComment(), ArticleInfoSender\execute(), PeerReviewCommentForm\execute(), ReferralForm\execute(), EditCommentForm\execute(), CommentForm\execute(), AuthorSubmitStep5Form\execute(), CreateReviewerForm\execute(), ObjectForReviewForm\execute(), ThesisForm\execute(), StudentThesisForm\execute(), RegistrationForm\execute(), QuickSubmitForm\execute(), UserManagementForm\execute(), BookForReviewForm\execute(), ThesisFeedGatewayPlugin\fetch(), AnnouncementFeedGatewayPlugin\fetch(), SubscriptionDAO\flagReminded(), Version\fromString(), OJSPaymentManager\fulfillQueuedPayment(), ArticleFileManager\generateDummyFile(), AccessKeyDAO\getAccessKey(), AccessKeyDAO\getAccessKeyByKeyHash(), AccessKeyDAO\getAccessKeyByUserId(), ArticleFileManager\handleCopy(), PKPTemporaryFileManager\handleUpload(), ArticleFileManager\handleUpload(), ArticleFileManager\handleWrite(), SectionEditorAction\initiateCopyedit(), CaptchaDAO\insertCaptcha(), CommentDAO\insertComment(), OJSCompletedPaymentDAO\insertCompletedPayment(), NotificationDAO\insertObject(), QueuedPaymentDAO\insertQueuedPayment(), SuppFileDAO\insertSuppFile(), PKPUserDAO\insertUser(), VersionDAO\insertVersion(), IndividualSubscriptionDAO\isValidIndividualSubscription(), InstitutionalSubscriptionDAO\isValidInstitutionalSubscription(), ReferralPlugin\logArticleRequest(), ArticleLog\logEmail(), ArticleLog\logEventHeadless(), Validation\login(), SectionEditorAction\notifyAuthorCopyedit(), SectionEditorAction\notifyCopyeditor(), SectionEditorAction\notifyFinalCopyedit(), SectionEditorAction\notifyLayoutEditor(), SubmissionEditHandler\notifyLayoutEditorProofreader(), SectionEditorAction\notifyReviewer(), IssueManagementHandler\notifyUsers(), ProofreaderAction\proofreadEmail(), ProofreaderAction\proofreadingUnderway(), IssueManagementHandler\publishIssue(), SectionEditorAction\rateReviewer(), SectionEditorAction\recordDecision(), ReviewerAction\recordRecommendation(), GiftDAO\redeemGift(), ShibAuthPlugin\registerUserFromShib(), SectionEditorAction\remindReviewer(), ObjectsForReviewAuthorHandler\requestObjectForReview(), SubmissionEditHandler\scheduleForPublication(), ObjectsForReviewReminder\sendReminder(), NotificationDAO\setDateRead(), SectionEditorAction\setReviewerRecommendation(), AuthorSubmitSuppFileForm\setSuppFileData(), SuppFileForm\setSuppFileData(), DataObjectTombstone\stampDateDeleted(), Issue\stampModified(), PKPReviewAssignment\stampModified(), Submission\stampModified(), Submission\stampStatusModified(), SubmissionLayoutHandler\submission(), SectionEditorAction\thankAuthorCopyedit(), SectionEditorAction\thankCopyeditor(), SectionEditorAction\thankFinalCopyedit(), SectionEditorAction\thankLayoutEditor(), SectionEditorAction\thankReviewer(), CommentDAO\updateComment(), PKPUserDAO\updateObject(), QueuedPaymentDAO\updateQueuedPayment(), SectionEditorAction\updateSubmissionNote(), JournalSetupStep5Form\uploadImage(), SectionEditorAction\uploadReviewForReviewer(), ExternalFeedSettingsForm\uploadStyleSheet(), JournalSetupStep5Form\uploadStyleSheet(), and SectionEditorHandler\validate().

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

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 235 of file Core.inc.php.

References _getUrlComponents(), and cleanFileVar().

Referenced by UsageStatsLoader\_getAssocFromUrl().

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

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 219 of file Core.inc.php.

References _getUrlComponents(), and cleanFileVar().

Referenced by UsageStatsLoader\_getAssocFromUrl().

Core::isUserAgentBot (   $userAgent,
  $botRegexpsFile = USER_AGENTS_FILE 
)

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 138 of file Core.inc.php.

References String\regexp_match().

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

Core::isWindows ( )

Check if the server platform is Windows.

Returns
boolean

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

References serverPHPOS().

Referenced by Mail\getAddressArrayString(), InstallForm\initData(), Mail\send(), and LucenePluginTest\testArticleIndexingProblem().

Core::microtime ( )

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

Returns
float

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

Referenced by DBConnection\logQuery(), DAO\retrieve(), DAO\retrieveCached(), DAO\retrieveLimit(), DAO\retrieveRange(), and DAO\update().

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
mixed string The url without base url, false if it was not possible to remove it.

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

References _getBaseUrlAndPath().

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

Core::serverPHPOS ( )

Get the operating system of the server.

Returns
string

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

Referenced by PKPApplication\buildErrorMessage(), isWindows(), and AdminFunctionsHandler\systemInfo().

Core::serverPHPVersion ( )

Get the version of PHP running on the server.

Returns
string

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

Referenced by PKPApplication\buildErrorMessage(), and AdminFunctionsHandler\systemInfo().


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