本文整理汇总了PHP中strtolower_codesafe函数的典型用法代码示例。如果您正苦于以下问题:PHP strtolower_codesafe函数的具体用法?PHP strtolower_codesafe怎么用?PHP strtolower_codesafe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strtolower_codesafe函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getName
/**
* @see Plugin::getName()
*/
function getName()
{
// Lazy load enabled plug-ins always use the plugin's class name
// as plug-in name. Legacy plug-ins will override this method so
// this implementation is backwards compatible.
// NB: strtolower was required for PHP4 compatibility.
return strtolower_codesafe(get_class($this));
}
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:11,代码来源:LazyLoadPlugin.inc.php
示例2: _handleOcsUrl
function _handleOcsUrl($matchArray)
{
$url = $matchArray[2];
$anchor = null;
if (($i = strpos($url, '#')) !== false) {
$anchor = substr($url, $i + 1);
$url = substr($url, 0, $i);
}
$urlParts = explode('/', $url);
if (isset($urlParts[0])) {
switch (strtolower_codesafe($urlParts[0])) {
case 'conference':
$url = Request::url(isset($urlParts[1]) ? $urlParts[1] : Request::getRequestedConferencePath(), null, null, null, null, null, $anchor);
break;
case 'paper':
if (isset($urlParts[1])) {
$url = Request::url(null, null, 'paper', 'view', $urlParts[1], null, $anchor);
}
break;
case 'schedConf':
if (isset($urlParts[1])) {
$schedConfDao = DAORegistry::getDAO('SchedConfDAO');
$conferenceDao = DAORegistry::getDAO('ConferenceDAO');
$thisSchedConf =& $schedConfDao->getByPath($urlParts[1]);
if (!$thisSchedConf) {
break;
}
$thisConference =& $conferenceDao->getById($thisSchedConf->getConferenceId());
$url = Request::url($thisConference->getPath(), $thisSchedConf->getPath(), null, null, null, null, $anchor);
} else {
$url = Request::url(null, null, 'schedConfs', 'current', null, null, $anchor);
}
break;
case 'suppfile':
if (isset($urlParts[1]) && isset($urlParts[2])) {
$url = Request::url(null, null, 'paper', 'downloadSuppFile', array($urlParts[1], $urlParts[2]), null, $anchor);
}
break;
case 'sitepublic':
array_shift($urlParts);
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$url = Request::getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath() . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
break;
case 'public':
array_shift($urlParts);
$schedConf =& Request::getSchedConf();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$url = Request::getBaseUrl() . '/' . $publicFileManager->getSchedConfFilesPath($schedConf->getId()) . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
break;
}
}
return $matchArray[1] . $url . $matchArray[3];
}
开发者ID:artkuo,项目名称:ocs,代码行数:55,代码来源:PaperHTMLGalley.inc.php
示例3: register
/**
* @copydoc Plugin::register()
*/
function register($category, $path)
{
if (!parent::register($category, $path)) {
return false;
}
// Enable storage of additional fields.
foreach ($this->_getDAOs() as $daoName) {
HookRegistry::register(strtolower_codesafe($daoName) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
}
return true;
}
开发者ID:RogerAKemp,项目名称:ojs,代码行数:14,代码来源:PubIdPlugin.inc.php
示例4: register
/**
* @see Plugin::register()
*/
function register($category, $path)
{
$success = parent::register($category, $path);
if ($success) {
// Enable storage of additional fields.
foreach ($this->_getDAOs() as $daoName) {
HookRegistry::register(strtolower_codesafe($daoName) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
}
}
return $success;
}
开发者ID:utlib,项目名称:ojs,代码行数:14,代码来源:PubIdPlugin.inc.php
示例5: register
/**
* @see PKPPlugin::register()
*/
function register($category, $path)
{
$success = parent::register($category, $path);
if ($success) {
// Enable storage of additional fields.
foreach ($this->_getDAOs() as $daoName) {
HookRegistry::register(strtolower_codesafe($daoName) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
}
// Exclude issue articles
HookRegistry::register('Editor::IssueManagementHandler::editIssue', array($this, 'editIssue'));
}
return $success;
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:16,代码来源:PubIdPlugin.inc.php
示例6: _handleOjsUrl
function _handleOjsUrl($matchArray)
{
$url = $matchArray[2];
$anchor = null;
if (($i = strpos($url, '#')) !== false) {
$anchor = substr($url, $i + 1);
$url = substr($url, 0, $i);
}
$urlParts = explode('/', $url);
if (isset($urlParts[0])) {
switch (strtolower_codesafe($urlParts[0])) {
case 'journal':
$url = Request::url(isset($urlParts[1]) ? $urlParts[1] : Request::getRequestedJournalPath(), null, null, null, null, $anchor);
break;
case 'article':
if (isset($urlParts[1])) {
$url = Request::url(null, 'article', 'view', $urlParts[1], null, $anchor);
}
break;
case 'issue':
if (isset($urlParts[1])) {
$url = Request::url(null, 'issue', 'view', $urlParts[1], null, $anchor);
} else {
$url = Request::url(null, 'issue', 'current', null, null, $anchor);
}
break;
case 'suppfile':
if (isset($urlParts[1]) && isset($urlParts[2])) {
$url = Request::url(null, 'article', 'downloadSuppFile', array($urlParts[1], $urlParts[2]), null, $anchor);
}
break;
case 'sitepublic':
array_shift($urlParts);
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$url = Request::getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath() . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
break;
case 'public':
array_shift($urlParts);
$journal =& Request::getJournal();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$url = Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
break;
}
}
return $matchArray[1] . $url . $matchArray[3];
}
开发者ID:yuricampos,项目名称:ojs,代码行数:48,代码来源:ArticleHTMLGalley.inc.php
示例7: fixFilenames
/**
* Fix broken submission filenames (bug #8461)
* @param $upgrade Upgrade
* @param $params array
* @param $dryrun boolean True iff only a dry run (displaying rather than executing changes) should be done.
* @return boolean
*/
function fixFilenames($upgrade, $params, $dryrun = false)
{
$pressDao = DAORegistry::getDAO('PressDAO');
$submissionDao = DAORegistry::getDAO('MonographDAO');
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
DAORegistry::getDAO('GenreDAO');
// Load constants
$siteDao = DAORegistry::getDAO('SiteDAO');
/* @var $siteDao SiteDAO */
$site = $siteDao->getSite();
$adminEmail = $site->getLocalizedContactEmail();
import('lib.pkp.classes.file.SubmissionFileManager');
$contexts = $pressDao->getAll();
while ($context = $contexts->next()) {
$submissions = $submissionDao->getByPressId($context->getId());
while ($submission = $submissions->next()) {
$submissionFileManager = new SubmissionFileManager($context->getId(), $submission->getId());
$submissionFiles = $submissionFileDao->getBySubmissionId($submission->getId());
foreach ($submissionFiles as $submissionFile) {
$generatedFilename = $submissionFile->getServerFileName();
$basePath = $submissionFileManager->getBasePath() . $submissionFile->_fileStageToPath($submissionFile->getFileStage()) . '/';
$globPattern = $submissionFile->getSubmissionId() . '-' . '*' . '-' . $submissionFile->getFileId() . '-' . $submissionFile->getRevision() . '-' . $submissionFile->getFileStage() . '-' . date('Ymd', strtotime($submissionFile->getDateUploaded())) . '.' . strtolower_codesafe($submissionFile->getExtension());
$matchedResults = glob($basePath . $globPattern);
if (count($matchedResults) > 1) {
error_log("Duplicate potential files for \"{$globPattern}\"!", 1, $adminEmail);
continue;
}
if (count($matchedResults) == 1) {
// 1 result matched.
$discoveredFilename = array_shift($matchedResults);
if ($dryrun) {
echo "Need to rename \"{$discoveredFilename}\" to \"{$generatedFilename}\".\n";
} else {
rename($discoveredFilename, $basePath . $generatedFilename);
}
} else {
// 0 results matched.
error_log("Unable to find a match for \"{$globPattern}\".\n", 1, $adminEmail);
continue;
}
}
}
}
return true;
}
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:52,代码来源:Upgrade.inc.php
示例8: init
/**
* Perform initialization required for the string wrapper library.
* @return null
*/
static function init()
{
$clientCharset = strtolower_codesafe(Config::getVar('i18n', 'client_charset'));
// Check if mbstring is installed (requires PHP >= 4.3.0)
if (String::hasMBString()) {
// mbstring routines are available
define('ENABLE_MBSTRING', true);
// Set up required ini settings for mbstring
// FIXME Do any other mbstring settings need to be set?
mb_internal_encoding($clientCharset);
mb_substitute_character('63');
// question mark
}
// Define modifier to be used in regexp_* routines
// FIXME Should non-UTF-8 encodings be supported with mbstring?
if ($clientCharset == 'utf-8' && String::hasPCREUTF8()) {
define('PCRE_UTF8', 'u');
} else {
define('PCRE_UTF8', '');
}
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:25,代码来源:String.inc.php
示例9: register
/**
* @copydoc Plugin::register()
*/
function register($category, $path)
{
if (!parent::register($category, $path)) {
return false;
}
if ($this->getEnabled()) {
// Enable storage of additional fields.
foreach ($this->getDAOs() as $publicObjectType => $dao) {
HookRegistry::register(strtolower_codesafe(get_class($dao)) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
if (strtolower_codesafe(get_class($dao)) == 'submissionfiledao') {
// if it is a file, consider all file delegates
$fileDAOdelegates = $this->getFileDAODelegates();
foreach ($fileDAOdelegates as $fileDAOdelegate) {
HookRegistry::register(strtolower_codesafe($fileDAOdelegate) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
}
}
}
}
$this->addLocaleData();
return true;
}
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:24,代码来源:PKPPubIdPlugin.inc.php
示例10: getLocaleFieldNames
/**
* Get locale field names. Like getAdditionalFieldNames, but for
* localized (multilingual) fields.
* @see getAdditionalFieldNames
* @return array Array of string field names.
*/
function getLocaleFieldNames()
{
$returner = array();
// Call hooks based on the calling entity, assuming
// this method is only called by a subclass. Results
// in hook calls named e.g. "sessiondao::getLocaleFieldNames"
// (class names lowercase)
HookRegistry::call(strtolower_codesafe(get_class($this)) . '::getLocaleFieldNames', array($this, &$returner));
return $returner;
}
开发者ID:doana,项目名称:pkp-lib,代码行数:16,代码来源:DAO.inc.php
示例11: _castToGenre
/**
* Make sure that the genre of the file and its file
* implementation are compatible.
*
* NB: In the case of a downcast this means that not all data in the
* object will be saved to the database. It is the UI's responsibility
* to inform users about potential loss of data if they change to
* a genre that permits less meta-data than the prior genre!
*
* @param $submissionFile SubmissionFile
* @return SubmissionFile The same file in a compatible implementation.
*/
private function _castToGenre($submissionFile)
{
// Find the required target implementation.
$targetImplementation = strtolower_codesafe($this->_getFileImplementationForGenreId($submissionFile->getGenreId()));
// If the current implementation of the updated object
// is the same as the target implementation, skip cast.
if (is_a($submissionFile, $targetImplementation)) {
return $submissionFile;
}
// The updated file has to be upcast by manually
// instantiating the target object and copying data
// to the target.
$targetDaoDelegate = $this->_getDaoDelegate($targetImplementation);
$targetFile = $targetDaoDelegate->newDataObject();
$targetFile = $submissionFile->upcastTo($targetFile);
return $targetFile;
}
开发者ID:energylevels,项目名称:pkp-lib,代码行数:29,代码来源:PKPSubmissionFileDAO.inc.php
示例12: glue_url
function glue_url($parsed)
{
// Thanks to php dot net at NOSPAM dot juamei dot com
// See http://www.php.net/manual/en/function.parse-url.php
if (!is_array($parsed)) {
return false;
}
$uri = isset($parsed['scheme']) ? $parsed['scheme'] . ':' . (strtolower_codesafe($parsed['scheme']) == 'mailto' ? '' : '//') : '';
$uri .= isset($parsed['user']) ? $parsed['user'] . ($parsed['pass'] ? ':' . $parsed['pass'] : '') . '@' : '';
$uri .= isset($parsed['host']) ? $parsed['host'] : '';
$uri .= isset($parsed['port']) ? ':' . $parsed['port'] : '';
$uri .= isset($parsed['path']) ? $parsed['path'] : '';
$uri .= isset($parsed['query']) ? '?' . $parsed['query'] : '';
$uri .= isset($parsed['fragment']) ? '#' . $parsed['fragment'] : '';
return $uri;
}
开发者ID:doana,项目名称:pkp-lib,代码行数:16,代码来源:HTTPFileWrapper.inc.php
示例13: readUserDateVars
/**
* Adds specified user date variables to input data.
* @param $vars array the names of the date variables to read
*/
function readUserDateVars($vars)
{
// Call hooks based on the calling entity, assuming
// this method is only called by a subclass. Results
// in hook calls named e.g. "papergalleyform::readUserDateVars"
// Note that class and function names are always lower
// case.
HookRegistry::call(strtolower_codesafe(get_class($this) . '::readUserDateVars'), array($this, &$vars));
foreach ($vars as $k) {
$this->setData($k, Request::getUserDateVar($k));
}
}
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:16,代码来源:Form.inc.php
示例14: checkMetadataPage
/**
* Check DOI input and display on a single metadata page.
* @param $objectType string
* @param $editable boolean whether the DOI Suffix field should be editable.
* @param $expectedDoi string
*/
private function checkMetadataPage($objectType, $editable = false, $expectedDoi = null, $objectId = 1, $isPreview = false)
{
try {
$objectType = strtolower_codesafe($objectType);
$metadataPage = "metadata-{$objectType}";
$url = $this->getUrl($metadataPage, $objectId);
$this->verifyAndOpen($url);
$doiText = $this->getText($this->pages[$metadataPage]['doi']);
if ($editable) {
if (!is_null($expectedDoi)) {
$this->assertValue($this->pages[$metadataPage]['doiInput'], $expectedDoi);
}
} else {
$this->assertElementNotPresent($this->pages[$metadataPage]['doiInput']);
if (!is_null($expectedDoi)) {
$this->assertContains("DOI {$expectedDoi}", $doiText);
}
}
if ($isPreview) {
$this->assertContains('What you see is a preview', $doiText);
}
} catch (Exception $e) {
throw $this->improveException($e, $objectType);
}
}
开发者ID:mosvits,项目名称:ojs,代码行数:31,代码来源:FunctionalDoiPubIdPluginTestCase.php
示例15: migrateSubmissionFilePaths
/**
* For 3.0.0 upgrade. Migrates submission files to new paths.
*/
function migrateSubmissionFilePaths()
{
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
import('lib.pkp.classes.submission.SubmissionFile');
$genreDao = DAORegistry::getDAO('GenreDAO');
$journalDao = DAORegistry::getDAO('JournalDAO');
$submissionFile = new SubmissionFile();
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
$articleFilesResult = $submissionFileDao->retrieve('SELECT af.*, s.submission_id, s.context_id FROM article_files_migration af, submissions s WHERE af.article_id = s.submission_id');
$filesDir = Config::getVar('files', 'files_dir') . '/journals/';
while (!$articleFilesResult->EOF) {
$row = $articleFilesResult->GetRowAssoc(false);
// Assemble the old file path.
$oldFilePath = $filesDir . $row['context_id'] . '/articles/' . $row['submission_id'] . '/';
if (isset($row['type'])) {
// pre 2.4 upgrade.
$oldFilePath .= $row['type'];
} else {
// post 2.4, we have file_stage instead.
switch ($row['file_stage']) {
case 1:
$oldFilePath .= 'submission/original';
break;
case 2:
$oldFilePath .= 'submission/review';
break;
case 3:
$oldFilePath .= 'submission/editor';
break;
case 4:
$oldFilePath .= 'submission/copyedit';
break;
case 5:
$oldFilePath .= 'submission/layout';
break;
case 6:
$oldFilePath .= 'supp';
break;
case 7:
$oldFilePath .= 'public';
break;
case 8:
$oldFilePath .= 'note';
break;
case 9:
$oldFilePath .= 'attachment';
break;
}
}
$oldFilePath .= '/' . $row['file_name'];
if (file_exists($oldFilePath)) {
// sanity check.
$newFilePath = $filesDir . $row['context_id'] . '/articles/' . $row['submission_id'] . '/';
// Since we cannot be sure that we had a file_stage column before, query the new submission_files table.
$submissionFileResult = $submissionFileDao->retrieve('SELECT genre_id, file_stage, date_uploaded, original_file_name
FROM submission_files WHERE file_id = ? and revision = ?', array($row['file_id'], $row['revision']));
$submissionFileRow = $submissionFileResult->GetRowAssoc(false);
$newFilePath .= $submissionFile->_fileStageToPath($submissionFileRow['file_stage']);
$genre = $genreDao->getById($submissionFileRow['genre_id']);
// pull in the primary locale for this journal without loading the whole object.
$localeResult = $journalDao->retrieve('SELECT primary_locale FROM journals WHERE journal_id = ?', array($row['context_id']));
$localeRow = $localeResult->GetRowAssoc(false);
$newFilePath .= '/' . $row['submission_id'] . '-' . $genre->getDesignation() . '_' . $genre->getName($localeRow['primary_locale']) . '-' . $row['file_id'] . '-' . $row['revision'] . '-' . $submissionFileRow['file_stage'] . '-' . date('Ymd', strtotime($submissionFileRow['date_uploaded'])) . '.' . strtolower_codesafe($fileManager->parseFileExtension($submissionFileRow['original_file_name']));
$fileManager->copyFile($oldFilePath, $newFilePath);
if (file_exists($newFilePath)) {
$fileManager->deleteFile($oldFilePath);
}
}
$articleFilesResult->MoveNext();
unset($localeResult);
unset($submissionFileResult);
unset($localeRow);
unset($submissionFileRow);
}
return true;
}
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:80,代码来源:Upgrade.inc.php
示例16: getProtocol
/**
* Get the protocol used for the request (HTTP or HTTPS).
* @return string
*/
function getProtocol()
{
$_this =& PKPRequest::_checkThis();
if (!isset($_this->_protocol)) {
$_this->_protocol = !isset($_SERVER['HTTPS']) || strtolower_codesafe($_SERVER['HTTPS']) != 'on' ? 'http' : 'https';
HookRegistry::call('Request::getProtocol', array(&$_this->_protocol));
}
return $_this->_protocol;
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:13,代码来源:PKPRequest.inc.php
示例17: smartyFBVElement
/**
* Base form element.
* @param $params array
* @param $smarty object-
*/
function smartyFBVElement($params, &$smarty, $content = null)
{
if (!isset($params['type'])) {
$smarty->trigger_error('FBV: Element type not set');
}
if (!isset($params['id'])) {
$smarty->trigger_error('FBV: Element ID not set');
}
// Set up the element template
$smarty->assign('FBV_id', $params['id']);
$smarty->assign('FBV_class', isset($params['class']) ? $params['class'] : null);
$smarty->assign('FBV_required', isset($params['required']) ? $params['required'] : false);
$smarty->assign('FBV_layoutInfo', $this->_getLayoutInfo($params));
$smarty->assign('FBV_label', isset($params['label']) ? $params['label'] : null);
$smarty->assign('FBV_for', isset($params['for']) ? $params['for'] : null);
$smarty->assign('FBV_tabIndex', isset($params['tabIndex']) ? $params['tabIndex'] : null);
$smarty->assign('FBV_translate', isset($params['translate']) ? $params['translate'] : true);
$smarty->assign('FBV_keepLabelHtml', isset($params['keepLabelHtml']) ? $params['keepLabelHtml'] : false);
// Unset these parameters so they don't get assigned twice
unset($params['class']);
// Find fields that the form class has marked as required and add the 'required' class to them
$params = $this->_addClientSideValidation($params);
$smarty->assign('FBV_validation', isset($params['validation']) ? $params['validation'] : null);
// Set up the specific field's template
switch (strtolower_codesafe($params['type'])) {
case 'autocomplete':
$content = $this->_smartyFBVAutocompleteInput($params, $smarty);
break;
case 'button':
case 'submit':
$content = $this->_smartyFBVButton($params, $smarty);
break;
case 'checkbox':
$content = $this->_smartyFBVCheckbox($params, $smarty);
unset($params['label']);
break;
case 'checkboxgroup':
$content = $this->_smartyFBVCheckboxGroup($params, $smarty);
unset($params['label']);
break;
case 'file':
$content = $this->_smartyFBVFileInput($params, $smarty);
break;
case 'hidden':
$content = $this->_smartyFBVHiddenInput($params, $smarty);
break;
case 'keyword':
$content = $this->_smartyFBVKeywordInput($params, $smarty);
break;
case 'interests':
$content = $this->_smartyFBVInterestsInput($params, $smarty);
break;
case 'link':
$content = $this->_smartyFBVLink($params, $smarty);
break;
case 'radio':
$content = $this->_smartyFBVRadioButton($params, $smarty);
unset($params['label']);
break;
case 'rangeslider':
$content = $this->_smartyFBVRangeSlider($params, $smarty);
break;
case 'select':
$content = $this->_smartyFBVSelect($params, $smarty);
break;
case 'text':
$content = $this->_smartyFBVTextInput($params, $smarty);
break;
case 'textarea':
$content = $this->_smartyFBVTextArea($params, $smarty);
break;
default:
assert(false);
}
unset($params['type']);
$parent = $smarty->_tag_stack[count($smarty->_tag_stack) - 1];
$group = false;
if ($parent) {
$form = $this->getForm();
if (isset($form) && isset($form->errorFields[$params['id']])) {
array_push($form->formSectionErrors, $form->errorsArray[$params['id']]);
}
if (isset($parent[1]['group']) && $parent[1]['group']) {
$group = true;
}
}
return $content;
}
开发者ID:jack-cade-inc,项目名称:pkp-lib,代码行数:93,代码来源:FormBuilderVocabulary.inc.php
示例18: _generateFileName
/**
* Generate the unique filename for this submission file.
* @return string
*/
function _generateFileName()
{
// Generate a human readable time stamp.
$timestamp = date('Ymd', strtotime($this->getDateUploaded()));
// Make the file name unique across all files and file revisions.
// Also make sure that files can be ordered sensibly by file name.
return $this->getSubmissionId() . '-' . $this->getGenreId() . '-' . $this->getFileId() . '-' . $this->getRevision() . '-' . $this->getFileStage() . '-' . $timestamp . '.' . strtolower_codesafe($this->getExtension());
}
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:12,代码来源:SubmissionFile.inc.php
示例19: route
/**
* @see PKPRouter::route()
*/
function route(&$request)
{
// Determine the requested page and operation
$page = $this->getRequestedPage($request);
$op = $this->getRequestedOp($request);
// If the application has not yet been installed we only
// allow installer pages to be displayed.
if (!Config::getVar('general', 'installed')) {
define('SESSION_DISABLE_INIT', 1);
if (!in_array($page, $this->getInstallationPages())) {
// A non-installation page was called although
// the system is not yet installed. Redirect to
// the installation page.
$redirectMethod = array($request, 'redirect');
// The correct redirection for the installer page
// depends on the context depth of this application.
$application =& $this->getApplication();
$contextDepth = $application->getContextDepth();
// The context will be filled with all nulls
$redirectArguments = array_pad(array('install'), -$contextDepth - 1, null);
// Call request's redirect method
call_user_func_array($redirectMethod, $redirectArguments);
}
}
// Determine the page index file. This file contains the
// logic to resolve a page to a specific handler class.
$sourceFile = sprintf('pages/%s/index.php', $page);
// If a hook has been registered to handle this page, give it the
// opportunity to load required resources and set HANDLER_CLASS.
if (!HookRegistry::call('LoadHandler', array(&$page, &$op, &$sourceFile))) {
if (file_exists($sourceFile)) {
require './' . $sourceFile;
} elseif (file_exists('lib/pkp/' . $sourceFile)) {
require './lib/pkp/' . $sourceFile;
} elseif (empty($page)) {
require ROUTER_DEFAULT_PAGE;
} else {
$dispatcher =& $this->getDispatcher();
$dispatcher->handle404();
}
}
if (!defined('SESSION_DISABLE_INIT')) {
// Initialize session
$sessionManager =& SessionManager::getManager();
}
// Call the selected handler's index operation if
// no operation was defined in the request.
if (empty($op)) {
$op = ROUTER_DEFAULT_OP;
}
// Redirect to 404 if the operation doesn't exist
// for the handler.
$methods = array();
if (defined('HANDLER_CLASS')) {
$methods = array_map('strtolower_codesafe', get_class_methods(HANDLER_CLASS));
}
if (!in_array(strtolower_codesafe($op), $methods)) {
$dispatcher =& $this->getDispatcher();
$dispatcher->handle404();
}
// Instantiate the handler class
$HandlerClass = HANDLER_CLASS;
$handler = new $HandlerClass($request);
// Authorize and initialize the request but don't call the
// validate() method on page handlers.
// FIXME: We should call the validate() method for page
// requests also (last param = true in the below method
// call) once we've made sure that all validate() calls can
// be removed from handler operations without damage (i.e.
// they don't depend on actions being performed before the
// call to validate().
$args = $this->getRequestedArgs($request);
$serviceEndpoint = array($handler, $op);
$this->_authorizeInitializeAndCallRequest($serviceEndpoint, $request, $args, false);
}
开发者ID:yuricampos,项目名称:ojs,代码行数:78,代码来源:PKPPageRouter.inc.php
示例20: _smartyFBVButton
/**
* Form button.
* parameters: label (or value), disabled (optional), type (optional)
* @param $params array
* @param $smarty object
*/
function _smartyFBVButton($params, &$smarty)
{
// accept 'value' param, but the 'label' param is preferred
if (isset($params['value'])) {
$value = $params['value'];
$params['label'] = isset($params['label']) ? $params['label'] : $value;
unset($params['value']);
}
// the type of this button. the default value is 'button' (but could be 'submit')
$params['type'] = isset($params['type']) ? strtolower_codesafe($params['type']) : 'button';
$params['disabled'] = isset($params['disabled']) ? $params['disabled'] : false;
$buttonParams = '';
$smarty->clear_assign(array('FBV_label', 'FBV_type', 'FBV_disabled'));
foreach ($params as $key => $value) {
switch ($key) {
case 'label':
$smarty->assign('FBV_label', $value);
break;
case 'type':
$smarty->assign('FBV_type', $value);
break;
case 'disabled':
$smarty->assign('FBV_disabled', $params['disabled']);
break;
default:
$buttonParams .= htmlspecialchars($key, ENT_QUOTES, LOCALE_ENCODING) . '="' . htmlspecialchars($value, ENT_QUOTES, LOCALE_ENCODING) . '" ';
}
}
$smarty->assign('FBV_buttonParams', $buttonParams);
return $smarty->fetch('form/button.tpl');
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:37,代码来源:FormBuilderVocabulary.inc.php
注:本文中的strtolower_codesafe函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论