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

Public Member Functions

 _botFileListCacheMiss (&$cache)
 
 _filterBotRegexps (&$regexp)
 
 _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 ()
 
 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 261 of file Core.inc.php.

Core::_filterBotRegexps ( $regexp)

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

Parameters
$regexpstring

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

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 322 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 296 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 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(), PeerReviewCommentForm\execute(), ReferralForm\execute(), EditCommentForm\execute(), CommentForm\execute(), AuthorSubmitStep5Form\execute(), CreateReviewerForm\execute(), ThesisForm\execute(), StudentThesisForm\execute(), RegistrationForm\execute(), QuickSubmitForm\execute(), UserManagementForm\execute(), BookForReviewForm\execute(), ThesisFeedGatewayPlugin\fetch(), AnnouncementFeedGatewayPlugin\fetch(), 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(), SubmissionEditHandler\scheduleForPublication(), 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::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: