本文整理汇总了PHP中checkPhpVersion函数的典型用法代码示例。如果您正苦于以下问题:PHP checkPhpVersion函数的具体用法?PHP checkPhpVersion怎么用?PHP checkPhpVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkPhpVersion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isCompatible
/**
* Checks whether the current runtime environment is
* compatible with the specified parameters.
* @return boolean
*/
function isCompatible()
{
// Check PHP version
if (!is_null($this->_phpVersionMin) && !checkPhpVersion($this->_phpVersionMin)) {
return false;
}
if (!is_null($this->_phpVersionMax) && version_compare(PHP_VERSION, $this->_phpVersionMax) === 1) {
return false;
}
// Check PHP extensions
foreach ($this->_phpExtensions as $requiredExtension) {
if (!extension_loaded($requiredExtension)) {
return false;
}
}
// Check external programs
foreach ($this->_externalPrograms as $requiredProgram) {
$externalProgram = Config::getVar('cli', $requiredProgram);
if (!file_exists($externalProgram)) {
return false;
}
if (function_exists('is_executable')) {
if (!is_executable($filename)) {
return false;
}
}
}
// Compatibility check was successful
return true;
}
示例2: display
/**
* Display the form
* @param $request Request
* @param $dispatcher Dispatcher
*/
function display($request, $dispatcher)
{
$templateMgr =& TemplateManager::getManager($request);
// Add extra style sheets required for ajax components
// FIXME: Must be removed after OMP->OJS backporting
$templateMgr->addStyleSheet($request->getBaseUrl() . '/styles/ojs.css');
// Add extra java script required for ajax components
// FIXME: Must be removed after OMP->OJS backporting
$templateMgr->addJavaScript('lib/pkp/js/grid-clickhandler.js');
$templateMgr->addJavaScript('lib/pkp/js/modal.js');
$templateMgr->addJavaScript('lib/pkp/js/lib/jquery/plugins/validate/jquery.validate.min.js');
$templateMgr->addJavaScript('lib/pkp/js/jqueryValidatorI18n.js');
import('classes.mail.MailTemplate');
$mail = new MailTemplate('SUBMISSION_ACK');
if ($mail->isEnabled()) {
$templateMgr->assign('submissionAckEnabled', true);
}
// Citation editor filter configuration
//
// 1) Check whether PHP5 is available.
if (!checkPhpVersion('5.0.0')) {
Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION));
$citationEditorError = 'submission.citations.editor.php5Required';
} else {
$citationEditorError = null;
}
$templateMgr->assign('citationEditorError', $citationEditorError);
if (!$citationEditorError) {
// 2) Add the filter grid URLs
$parserFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.ParserFilterGridHandler', 'fetchGrid');
$templateMgr->assign('parserFilterGridUrl', $parserFilterGridUrl);
$lookupFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.LookupFilterGridHandler', 'fetchGrid');
$templateMgr->assign('lookupFilterGridUrl', $lookupFilterGridUrl);
// 3) Create a list of all available citation output filters.
$router =& $request->getRouter();
$journal =& $router->getContext($request);
import('lib.pkp.classes.metadata.MetadataDescription');
$inputSample = new MetadataDescription('lib.pkp.classes.metadata.nlm.NlmCitationSchema', ASSOC_TYPE_CITATION);
$outputSample = 'any string';
$filterDao =& DAORegistry::getDAO('FilterDAO');
$metaCitationOutputFilterObjects =& $filterDao->getCompatibleObjects($inputSample, $outputSample, $journal->getId());
foreach ($metaCitationOutputFilterObjects as $metaCitationOutputFilterObject) {
$metaCitationOutputFilters[$metaCitationOutputFilterObject->getId()] = $metaCitationOutputFilterObject->getDisplayName();
}
$templateMgr->assign_by_ref('metaCitationOutputFilters', $metaCitationOutputFilters);
}
$currencyDao =& DAORegistry::getDAO('CurrencyDAO');
$currencies =& $currencyDao->getCurrencies();
$currenciesArray = array();
foreach ($currencies as $currency) {
$currenciesArray[$currency->getCodeAlpha()] = $currency->getName() . ' (' . $currency->getCodeAlpha() . ')';
}
$templateMgr->assign('currencies', $currenciesArray);
$originalSourceCurrencyAlpha = $journal->getSetting('sourceCurrency');
$originalSourceCurrency = $currencyDao->getCurrencyByAlphaCode($originalSourceCurrencyAlpha);
$templateMgr->assign('originalSourceCurrency', $originalSourceCurrency->getName() . ' (' . $originalSourceCurrencyAlpha . ')');
$proposalSourceDao =& DAORegistry::getDAO('ProposalSourceDAO');
$templateMgr->assign('countSources', $proposalSourceDao->countSources());
parent::display($request, $dispatcher);
}
示例3: isDownloadAvailable
/**
* Check to see whether the tar function exists and appears to be
* available for execution from PHP, and various other conditions that
* are required for locale downloading to be available.
* @return boolean
*/
function isDownloadAvailable()
{
// Check to see that proc_open is available
if (!function_exists('proc_open')) {
return false;
}
// Check to see that we're using at least PHP 4.3 for
// stream_set_blocking.
if (!checkPhpVersion('4.3.0')) {
return false;
}
// Check to see that tar can be executed
$fds = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$pipes = $process = null;
@($process = proc_open('tar --version', $fds, $pipes));
if (!is_resource($process)) {
return false;
}
fclose($pipes[0]);
// No input necessary
stream_get_contents($pipes[1]);
// Flush pipes. fflush seems to
stream_get_contents($pipes[2]);
// behave oddly, so it's avoided
fclose($pipes[1]);
fclose($pipes[2]);
if (proc_close($process) !== 0) {
return false;
}
// Check that we can write to a few locations
if (!is_file(LOCALE_REGISTRY_FILE) || !is_writable(LOCALE_REGISTRY_FILE)) {
return false;
}
return true;
}
示例4: setReturnType
/**
* Set the return type
* @param $returnType integer
*/
function setReturnType($returnType)
{
if ($returnType == XSL_TRANSFORMER_DOCTYPE_DOM) {
assert(checkPhpVersion('5.0.0') && extension_loaded('dom'));
}
$this->_returnType = $returnType;
}
示例5: XSLTransformer
/**
* Constructor.
* Initialize transformer and set parser options.
* @return boolean returns false if no XSLT processor could be created
*/
function XSLTransformer()
{
$this->externalCommand = Config::getVar('cli', 'xslt_command');
// Determine the appropriate XSLT processor for the system
if ($this->externalCommand) {
// check the external command to check for %xsl and %xml parameter substitution
if (strpos($this->externalCommand, '%xsl') === false) {
return false;
}
if (strpos($this->externalCommand, '%xml') === false) {
return false;
}
$this->processor = 'External';
} elseif (checkPhpVersion('5.0.0') && extension_loaded('xsl') && extension_loaded('dom')) {
// PHP5.x with XSL/DOM modules present
$this->processor = 'PHP5';
} elseif (checkPhpVersion('4.1.0') && extension_loaded('xslt')) {
// PHP4.x with XSLT module present
$this->processor = 'PHP4';
} else {
// no XSLT support
return false;
}
$this->errors = array();
}
示例6: supports
/**
* @see Filter::supports()
* @param $input mixed
* @param $output mixed
* @param $fromString boolean true if the filter accepts a string as input.
* @param $toString boolean true if the filter produces a string as output.
* @return boolean
*/
function supports(&$input, &$output, $fromString = false, $toString = false)
{
// Make sure that the filter registry has correctly
// checked the environment.
assert(checkPhpVersion('5.0.0'));
// Check the input
if ($fromString) {
if (!is_string($input)) {
return false;
}
} else {
if (!$this->isNlmCitationDescription($input)) {
return false;
}
// Check that the given publication type is supported by this filter
// If no publication type is given then we'll support the description
// by default.
$publicationType = $input->getStatement('[@publication-type]');
if (!empty($publicationType) && !in_array($publicationType, $this->getSupportedPublicationTypes())) {
return false;
}
}
// Check the output
if (is_null($output)) {
return true;
}
if ($toString) {
return is_string($output);
} else {
return $this->isNlmCitationDescription($output);
}
}
示例7: updateConference
/**
* Save changes to a conference's settings.
* @param $args array
* @param $request object
*/
function updateConference($args, &$request)
{
$this->validate();
$this->setupTemplate(true);
import('admin.form.ConferenceSiteSettingsForm');
if (checkPhpVersion('5.0.0')) {
// WARNING: This form needs $this in constructor
$settingsForm = new ConferenceSiteSettingsForm($request->getUserVar('conferenceId'));
} else {
$settingsForm =& new ConferenceSiteSettingsForm($request->getUserVar('conferenceId'));
}
$settingsForm->readInputData();
if ($settingsForm->validate()) {
PluginRegistry::loadCategory('blocks');
$settingsForm->execute();
import('notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationManager->createTrivialNotification('notification.notification', 'common.changesSaved');
$conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
$conference = $conferenceDao->getFreshestConference();
$conferenceId = $conference->getData('id');
$conferencePath = $conference->getData('path');
if ($settingsForm->getData('scheduleConf')) {
$request->redirect($conferencePath, null, 'manager', 'createSchedConf');
} else {
$request->redirect(null, null, null, 'conferences');
}
} else {
$settingsForm->display();
}
}
示例8: registerUser
/**
* Validate user registration information and register new user.
*/
function registerUser($args, &$request)
{
$this->validate();
$this->setupTemplate(true);
import('classes.user.form.RegistrationForm');
//%CBP% get registration criteria, if defined
$journal =& Request::getJournal();
$CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
$templateMgr =& TemplateManager::getManager();
$registrationCriteria = $CBPPlatformDao->getRegistrationCriteria($journal->getId());
$templateMgr->assign('registrationCriteria', $registrationCriteria);
if ($registrationCriteria != null) {
if (Request::getUserVar('registrationCriteria') == 1) {
$reason = null;
$templateMgr->assign('registrationCriteriaChecked', 1);
} else {
$reason = 1;
$templateMgr->assign('registrationCriteriaReqd', 1);
}
}
if (checkPhpVersion('5.0.0')) {
// WARNING: This form needs $this in constructor
$regForm = new RegistrationForm();
} else {
$regForm =& new RegistrationForm();
}
$regForm->readInputData();
if ($regForm->validate()) {
$regForm->execute();
if (Config::getVar('email', 'require_validation')) {
// Send them home; they need to deal with the
// registration email.
Request::redirect(null, 'index');
}
$reason = null;
if (Config::getVar('security', 'implicit_auth')) {
Validation::login('', '', $reason);
} else {
Validation::login($regForm->getData('username'), $regForm->getData('password'), $reason);
}
if ($reason !== null) {
$this->setupTemplate(true);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('pageTitle', 'user.login');
$templateMgr->assign('errorMsg', $reason == '' ? 'user.login.accountDisabled' : 'user.login.accountDisabledWithReason');
$templateMgr->assign('errorParams', array('reason' => $reason));
$templateMgr->assign('backLink', Request::url(null, 'login'));
$templateMgr->assign('backLinkLabel', 'user.login');
return $templateMgr->display('common/error.tpl');
}
if ($source = Request::getUserVar('source')) {
Request::redirectUrl($source);
} else {
Request::redirect(null, 'login');
}
} else {
$regForm->display();
}
}
示例9: getPhpVersion
function getPhpVersion()
{
$message = null;
if (!checkPhpVersion(PHP_NEEDED_MAJOR, PHP_NEEDED_MINOR, PHP_NEEDED_BUILD)) {
$message = "<span class=\"lz_index_error_cat\">PHP-Version:<br></span> <span class=\"lz_index_red\">" . str_replace("<!--version-->", PHP_NEEDED_MAJOR . "." . PHP_NEEDED_MINOR . "." . PHP_NEEDED_BUILD, "LiveZilla requires PHP <!--version--> or greater.<br>Installed version is " . @phpversion()) . ".</span>";
}
return $message;
}
示例10: setReturnType
/**
* Set the return type
* @param $returnType integer
*/
function setReturnType($returnType)
{
if ($returnType == XSL_TRANSFORMER_DOCTYPE_DOM) {
if (!checkPhpVersion('5.0.0') || !extension_loaded('dom')) {
fatalError('This system does not meet minimum requirements!');
}
}
$this->_returnType = $returnType;
}
示例11: getPhpVersion
function getPhpVersion()
{
global $LZLANG;
$message = null;
if (!checkPhpVersion(PHP_NEEDED_MAJOR, PHP_NEEDED_MINOR, PHP_NEEDED_BUILD)) {
$message = "<span class=\"lz_index_error_cat\">PHP-Version:<br></span> <span class=\"lz_index_red\">" . str_replace("<!--version-->", PHP_NEEDED_MAJOR . "." . PHP_NEEDED_MINOR . "." . PHP_NEEDED_BUILD, $LZLANG["index_phpversion_needed"]) . "</span>";
}
return $message;
}
示例12: ZendSearchSettingsForm
/**
* Constructor
*/
function ZendSearchSettingsForm()
{
$plugin =& PluginRegistry::getPlugin('generic', 'ZendSearchPlugin');
parent::Form($plugin->getTemplatePath() . 'zendSearchSettingsForm.tpl');
$this->addCheck(new FormValidatorPost($this));
if (!checkPhpVersion('5.0.0') && $this->readUserVars(array('solrUrl')) == '') {
$this->addCheck(new FormValidator($this, 'solrUrl', 'required', 'plugins.generic.zendSearch.solrMustExist'));
}
$this->addCheck(new FormValidatorUrl($this, 'solrUrl', 'optional', 'plugins.generic.zendSearch.solrUrl.invalid'));
}
示例13: registerUser
/**
* Validate user registration information and register new user.
* @param $args array
* @param $request PKPRequest
*/
function registerUser($args, &$request)
{
$this->validate($request);
$this->setupTemplate($request, true);
import('classes.user.form.RegistrationForm');
if (checkPhpVersion('5.0.0')) {
// WARNING: This form needs $this in constructor
$regForm = new RegistrationForm();
} else {
$regForm =& new RegistrationForm();
}
$regForm->readInputData();
if ($regForm->validate()) {
$regForm->execute();
$reason = null;
if (Config::getVar('security', 'implicit_auth')) {
Validation::login('', '', $reason);
} else {
Validation::login($regForm->getData('username'), $regForm->getData('password'), $reason);
}
if (!Validation::isLoggedIn()) {
if (Config::getVar('email', 'require_validation')) {
// Inform the user that they need to deal with the
// registration email.
$this->setupTemplate($request, true);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('pageTitle', 'user.register.emailValidation');
$templateMgr->assign('errorMsg', 'user.register.emailValidationDescription');
$templateMgr->assign('backLink', $request->url(null, 'login'));
$templateMgr->assign('backLinkLabel', 'user.login');
return $templateMgr->display('common/error.tpl');
}
}
if ($reason !== null) {
$this->setupTemplate($request, true);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('pageTitle', 'user.login');
$templateMgr->assign('errorMsg', $reason == '' ? 'user.login.accountDisabled' : 'user.login.accountDisabledWithReason');
$templateMgr->assign('errorParams', array('reason' => $reason));
$templateMgr->assign('backLink', $request->url(null, 'login'));
$templateMgr->assign('backLinkLabel', 'user.login');
return $templateMgr->display('common/error.tpl');
}
if ($source = $request->getUserVar('source')) {
$request->redirectUrl($source);
} else {
$request->redirect(null, 'login');
}
} else {
$regForm->display();
}
}
示例14: trans
/**
* Transcode a string
* @param $string string String to transcode
* @return string Result of transcoding
*/
function trans($string)
{
// detect existence of encoding conversion libraries
$mbstring = function_exists('mb_convert_encoding');
$iconv = function_exists('iconv');
// don't do work unless we have to
if (strtolower($this->fromEncoding) == strtolower($this->toEncoding)) {
return $string;
}
// 'HTML-ENTITIES' is not a valid encoding for iconv, so transcode manually
if ($this->toEncoding == 'HTML-ENTITIES' && !$mbstring) {
// NB: old PHP versions may have issues with htmlentities()
if (checkPhpVersion('5.2.3')) {
// don't double encode added in PHP 5.2.3
return htmlentities($string, ENT_COMPAT, $this->fromEncoding, false);
} else {
return htmlentities($string, ENT_COMPAT, $this->fromEncoding);
}
} elseif ($this->fromEncoding == 'HTML-ENTITIES' && !$mbstring) {
// NB: old PHP versions may have issues with html_entity_decode()
if (checkPhpVersion('4.3.0')) {
// multibyte character handling added in PHP 5.0.0
return html_entity_decode($string, ENT_COMPAT, $this->toEncoding);
} else {
// use built-in transcoding to UTF8
$string = String::html2utf($string);
// make another pass to target encoding
$this->fromEncoding = 'UTF-8';
return $this->trans($string);
}
// Special cases for transliteration ("down-sampling")
} elseif ($this->translit && $iconv) {
// use the iconv library to transliterate
return iconv($this->fromEncoding, $this->toEncoding . '//TRANSLIT', $string);
} elseif ($this->translit && $this->fromEncoding == "UTF-8" && $this->toEncoding == "ASCII") {
// use the utf2ascii library
require_once './lib/pkp/lib/phputf8/utf8_to_ascii.php';
return utf8_to_ascii($string);
} elseif ($mbstring) {
// use the mbstring library to transcode
return mb_convert_encoding($string, $this->toEncoding, $this->fromEncoding);
} elseif ($iconv) {
// use the iconv library to transcode
return iconv($this->fromEncoding, $this->toEncoding . '//IGNORE', $string);
} else {
// fail gracefully by returning the original string unchanged
return $string;
}
}
示例15: readParams
/**
* Read installation parameters from stdin.
* FIXME: May want to implement an abstract "CLIForm" class handling input/validation.
* FIXME: Use readline if available?
*/
function readParams()
{
if (checkPhpVersion('5.0.0')) {
// WARNING: This form needs $this in constructor
$installForm = new InstallForm();
} else {
$installForm =& new InstallForm();
}
// Locale Settings
$this->printTitle('installer.localeSettings');
$this->readParamOptions('locale', 'locale.primary', $installForm->supportedLocales, 'en_US');
$this->readParamOptions('additionalLocales', 'installer.additionalLocales', $installForm->supportedLocales, '', true);
$this->readParamOptions('clientCharset', 'installer.clientCharset', $installForm->supportedClientCharsets, 'utf-8');
$this->readParamOptions('connectionCharset', 'installer.connectionCharset', $installForm->supportedConnectionCharsets, '');
$this->readParamOptions('databaseCharset', 'installer.databaseCharset', $installForm->supportedDatabaseCharsets, '');
// File Settings
$this->printTitle('installer.fileSettings');
$this->readParam('filesDir', 'installer.filesDir');
$this->readParamBoolean('skipFilesDir', 'installer.skipFilesDir');
// Security Settings
$this->printTitle('installer.securitySettings');
$this->readParamOptions('encryption', 'installer.encryption', $installForm->supportedEncryptionAlgorithms, 'md5');
// Administrator Account
$this->printTitle('installer.administratorAccount');
$this->readParam('adminUsername', 'user.username');
@`/bin/stty -echo`;
do {
$this->readParam('adminPassword', 'user.password');
printf("\n");
$this->readParam('adminPassword2', 'user.register.repeatPassword');
printf("\n");
} while ($this->params['adminPassword'] != $this->params['adminPassword2']);
@`/bin/stty echo`;
$this->readParam('adminEmail', 'user.email');
// Database Settings
$this->printTitle('installer.databaseSettings');
$this->readParamOptions('databaseDriver', 'installer.databaseDriver', $installForm->checkDBDrivers());
$this->readParam('databaseHost', 'installer.databaseHost', '');
$this->readParam('databaseUsername', 'installer.databaseUsername', '');
$this->readParam('databasePassword', 'installer.databasePassword', '');
$this->readParam('databaseName', 'installer.databaseName');
$this->readParamBoolean('createDatabase', 'installer.createDatabase', 'Y');
// Miscellaneous Settings
$this->printTitle('installer.miscSettings');
$this->readParam('oaiRepositoryId', 'installer.oaiRepositoryId');
printf("\n*** ");
}