本文整理汇总了PHP中strtolower_codesafe函数的典型用法代码示例。如果您正苦于以下问题:PHP strtolower_codesafe函数的具体用法?PHP strtolower_codesafe怎么用?PHP strtolower_codesafe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strtolower_codesafe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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];
}
示例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;
}
示例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;
}
示例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;
}
示例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];
}
示例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;
}
示例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', '');
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
}
示例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);
}
}
示例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;
}