Open Journal Systems
3.3.0
|
Go to the source code of this file.
Functions | |
arrayClean ($array) | |
checkPhpVersion ($version) | |
customAutoload ($rootPath, $prefix, $class) | |
if(!function_exists('import')) | fatalError ($reason) |
& | instantiate ($fullyQualifiedClassName, $expectedTypes=null, $expectedPackages=null, $expectedMethods=null, $constructorArg=null) |
lcfirst_codesafe ($str) | |
stripAssocArray ($values) | |
strtolower_codesafe ($str) | |
strtoupper_codesafe ($str) | |
ucfirst_codesafe ($str) | |
Contains definitions for common functions used system-wide. Any frequently-used functions that cannot be put into an appropriate class should be added here.
Copyright (c) 2014-2020 Simon Fraser University Copyright (c) 2000-2020 John Willinsky Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
Definition in file functions.inc.php.
arrayClean | ( | $array | ) |
Remove empty elements from an array
$array | array |
Definition at line 250 of file functions.inc.php.
checkPhpVersion | ( | $version | ) |
Check to see if the server meets a minimum version requirement for PHP.
$version | Name of version (see version_compare documentation) |
Definition at line 132 of file functions.inc.php.
Referenced by RuntimeEnvironment\isCompatible().
customAutoload | ( | $rootPath, | |
$prefix, | |||
$class | |||
) |
Helper function to define custom autoloader
string | $rootPath | |
string | $prefix | |
string | $class |
Definition at line 322 of file functions.inc.php.
References Core\cleanFileVar(), and strtolower_codesafe().
Referenced by PKPApplication\__construct().
if (!function_exists( 'import')) fatalError | ( | $reason | ) |
Emulate a Java-style import statement. Simply includes the associated PHP file (using require_once so multiple calls to include the same file have no effect).
$class | string the complete name of the class to be imported (e.g. 'lib.pkp.classes.core.Core') Wrapper around die() to pretty-print an error message with an optional stack trace. |
Definition at line 32 of file functions.inc.php.
References $application, Registry\get(), and Config\getVar().
Referenced by PromoteForm\__construct(), SendReviewsForm\__construct(), XSLTransformationFilter\__construct(), EditLibraryFileForm\__construct(), PKPSubmissionFilesUploadBaseForm\__construct(), TypeDescription\__construct(), PKPApplication\__construct(), UserGroupForm\_assignStagesToUserGroup(), TextureHandler\_buildManifestXMLFromDocument(), FilterDAO\_fromRow(), ReportGeneratorHandler\_getReportGeneratorForm(), PluginGalleryGridHandler\_getSpecifiedPlugin(), Dispatcher\_instantiateRouter(), SubmissionFileManager\_instantiateSubmissionFile(), FilterDAO\_newDataObject(), PKPAcronPlugin\_parseCrontab(), MarkupConversionHelper\_processHtmlMediaFiles(), CompositeFilter\_resolveCompositeSettingName(), ScheduledTask\addExecutionLogEntry(), PKP\components\forms\FormComponent\addGroup(), PKP\components\forms\FormComponent\addPage(), PersistableFilter\addSetting(), SubmissionFileDAO\assignRevisionToReviewRound(), PKPUserHandler\authorizationDenied(), UserGroupGridHandler\authorize(), PKP\Services\PKPSchemaService\coerce(), PKPPublicationDAO\deleteAllPubIds(), ListbuilderHandler\deleteEntry(), InformationCenterHandler\deleteNote(), Dispatcher\dispatch(), PubObjectsExportPlugin\display(), ImportExportPlugin\displayXMLValidationErrors(), FileApiHandler\downloadAllFiles(), SubmissionFileManager\downloadById(), FileApiHandler\downloadFile(), TextureHandler\editor(), SubmissionFilesUploadConfirmationForm\execute(), PromoteForm\execute(), SendReviewsForm\execute(), ReviewFormElementForm\execute(), PKPAuthorForm\execute(), ReviewerForm\execute(), Filter\execute(), QuickSubmitPlugin\executeCLI(), ScheduledTaskTool\executeTask(), PKPUserImportExportPlugin\exportUsers(), MarkupBatchGatewayPlugin\fetch(), MarkupGatewayPlugin\fetch(), PKPSubmissionFilesUploadBaseForm\fetch(), GridHandler\fetchCell(), AuthorDashboardReviewRoundTabHandler\fetchReviewRoundInfo(), OJSPaymentManager\fulfillQueuedPayment(), PKPCatalogHandler\fullSize(), PKP\Services\PKPSchemaService\get(), PKP\components\forms\Field\getConfig(), VersionDAO\getCurrentVersion(), DAORegistry\getDAO(), GridHandler\getDataElementFromRequest(), PKPSubmissionFilesUploadBaseForm\getSubmissionFiles(), Dispatcher\handle404(), UserXmlPKPUserFilter\handleChildElement(), NativeXmlUserGroupFilter\handleElement(), FileInformationCenterHandler\initialize(), PKPFileUploadWizardHandler\initialize(), ListbuilderHandler\insertEntry(), VersionDAO\insertVersion(), instantiate(), TextureHandler\json(), QueryNoteFilesGridDataProvider\loadData(), MarkupHandler\media(), TextureHandler\media(), FileManager\mkdirtree(), FileLoader\moveFile(), UserXmlPKPUserFilter\parseUser(), NavigationMenuItemHandler\preview(), Config\reloadData(), PKPLocale\requireComponents(), PKPReviewerHandler\saveDeclineReview(), PKPReviewerHandler\saveStep(), XmlWebService\setReturnType(), PKPReviewerHandler\step(), PKPCatalogHandler\thumbnail(), ReviewFormElementsGridHandler\updateReviewFormElement(), UserApiHandler\updateUserMessageState(), QuickSubmitPlugin\usage(), StaticPagesHandler\view(), and ArticleHandler\view().
& instantiate | ( | $fullyQualifiedClassName, | |
$expectedTypes = null , |
|||
$expectedPackages = null , |
|||
$expectedMethods = null , |
|||
$constructorArg = null |
|||
) |
Instantiates an object for a given fully qualified class name after executing several checks on the class.
The checks prevent certain vulnerabilities when instantiating classes generically.
NB: We currently only support one constructor argument. If we need arbitrary arguments later we can do that via func_get_args() which allows us to handle an arbitrary number of optional constructor arguments. The $constructorArg parameter needs to be last in the parameter list to be forward compatible with this potential use case.
$fullyQualifiedClassName | string |
$expectedTypes | string|array the class must conform to at least one of the given types. |
$expectedPackages | string|array the class must be part of at least one of the given packages. |
$expectedMethods | string|array names of methods that must all be present for the requested class. |
$constructorArg | mixed constructor argument |
Definition at line 165 of file functions.inc.php.
References fatalError().
Referenced by PluginRegistry\_instantiatePlugin(), Dispatcher\_instantiateRouter(), FilterDAO\_newDataObject(), FilterDAO\configureObject(), ScheduledTaskTool\executeTask(), DAORegistry\getDAO(), MetadataDataObjectAdapter\getMetadataSchema(), MetadataDescription\getMetadataSchema(), PKPComponentRouter\getRpcServiceEndpoint(), MetadataDataObjectAdapter\instantiateDataObject(), and TypeDescriptionFactory\instantiateTypeDescription().
lcfirst_codesafe | ( | $str | ) |
Perform a code-safe lcfirst, i.e. one that doesn't behave differently based on different locales. (tr_TR, I'm looking at you.)
$str | string Input string |
Definition at line 300 of file functions.inc.php.
References strtolower_codesafe().
stripAssocArray | ( | $values | ) |
Recursively strip HTML from a (multidimensional) array.
$values | array |
Definition at line 263 of file functions.inc.php.
Referenced by Dc11SchemaArticleAdapter\_addLocalizedElements(), OAIMetadataFormat_RFC1807\toXml(), OAIMetadataFormat_MARC21\toXml(), and OAIMetadataFormat_MARC\toXml().
strtolower_codesafe | ( | $str | ) |
Perform a code-safe strtolower, i.e. one that doesn't behave differently based on different locales. (tr_TR, I'm looking at you.)
$str | string Input string |
Definition at line 280 of file functions.inc.php.
Referenced by DAO\__construct(), Form\__construct(), URNPubIdPlugin\_calculateCheckNo(), SubmissionFile\_generateFileName(), HtmlArticleGalleyPlugin\_handleOjsUrl(), LensGalleyPlugin\_handleOjsUrl(), PKPComponentRouter\_validateServiceEndpointParts(), PKPString\camelize(), customAutoload(), PluginSettingsDAO\deleteSetting(), PluginSettingsDAO\deleteSettingsByPlugin(), Form\execute(), Filter\execute(), Form\fetch(), DAO\getAdditionalFieldNames(), Form\getLocaleFieldNames(), DAO\getLocaleFieldNames(), LazyLoadPlugin\getName(), PKPNotificationSettingsForm\getNotificationSettingCategories(), PKPNotificationSettingsForm\getNotificationSettingsMap(), PluginSettingsDAO\getPluginSettings(), PKPRequest\getProtocol(), PluginSettingsDAO\getSetting(), PKPString\init(), Form\initData(), GridHandler\initFeatures(), SubmissionFileDAO\insertObject(), Core\isWindows(), lcfirst_codesafe(), Form\readUserVars(), PKPPubIdPlugin\register(), PubObjectsExportPlugin\register(), DAO\retrieve(), DAO\retrieveCached(), DAO\retrieveLimit(), DAO\retrieveRange(), PluginSettingsDAO\settingExists(), FormBuilderVocabulary\smartyFBVElement(), PKPString\uncamelize(), DAO\update(), SubmissionFileDAO\updateObject(), PluginSettingsDAO\updateSetting(), and Form\validate().
strtoupper_codesafe | ( | $str | ) |
Perform a code-safe strtoupper, i.e. one that doesn't behave differently based on different locales. (tr_TR, I'm looking at you.)
$str | string Input string |
Definition at line 290 of file functions.inc.php.
Referenced by ucfirst_codesafe().
ucfirst_codesafe | ( | $str | ) |
Perform a code-safe ucfirst, i.e. one that doesn't behave differently based on different locales. (tr_TR, I'm looking at you.)
$str | string Input string |
Definition at line 310 of file functions.inc.php.
References strtoupper_codesafe().
Referenced by PKPString\uncamelize().