本文整理汇总了PHP中rex::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP rex::getVersion方法的具体用法?PHP rex::getVersion怎么用?PHP rex::getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex
的用法示例。
在下文中一共展示了rex::getVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replaceVars
static function replaceVars($template, $er = array())
{
$r = rex_extension::registerPoint(new rex_extension_point('YFORM_EMAIL_BEFORE_REPLACEVARS', ['template' => $template, 'search_replace' => $er, 'status' => false]));
$template = $r['template'];
$er = $r['search_replace'];
$status = $r['status'];
if ($status) {
return true;
}
$er['REX_SERVER'] = rex::getServer();
$er['REX_ERROR_EMAIL'] = rex::getErrorEmail();
$er['REX_SERVERNAME'] = rex::getServerName();
$er['REX_NOTFOUND_ARTICLE_ID'] = rex_article::getNotfoundArticleId();
$er['REX_ARTICLE_ID'] = rex_article::getCurrentId();
$template['body'] = rex_var::parse($template['body'], '', 'yform_email_template', $er);
$template['body_html'] = rex_var::parse($template['body_html'], '', 'yform_email_template', $er);
// rex_vars bug: sonst wird der Zeilenumbruch entfernt - wenn DATA_VAR am Ende einer Zeile
if (rex_string::versionCompare(rex::getVersion(), '5.0.1', '<')) {
$template['body'] = str_replace("?>\r", "?>\r\n\r", $template['body']);
$template['body'] = str_replace("?>\n", "?>\n\r\n", $template['body']);
$template['body_html'] = str_replace("?>\r", "?>\r\n\r", $template['body_html']);
$template['body_html'] = str_replace("?>\n", "?>\n\r\n", $template['body_html']);
}
$template['body'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body', $template['body']));
$template['body_html'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body_html', $template['body_html']));
return $template;
}
示例2: __construct
/**
* Constructor.
*
* @param string $host Host name
* @param int $port Port number
* @param bool $ssl SSL flag
*/
protected function __construct($host, $port = 80, $ssl = false)
{
$this->host = $host;
$this->port = $port;
$this->ssl = $ssl;
$this->addHeader('Host', $this->host);
$this->addHeader('User-Agent', 'REDAXO/' . rex::getVersion());
$this->addHeader('Connection', 'Close');
}
示例3: execute
public function execute()
{
include_once rex_path::addon('import_export', 'functions/function_import_export.php');
include_once rex_path::addon('import_export', 'functions/function_import_folder.php');
$filename = $this->getParam('filename', self::DEFAULT_FILENAME);
$filename = str_replace('%REX_SERVER', parse_url(rex::getServer(), PHP_URL_HOST), $filename);
$filename = str_replace('%REX_VERSION', rex::getVersion(), $filename);
$filename = strftime($filename);
$file = $filename;
$dir = getImportDir() . '/';
$ext = '.sql';
if (file_exists($dir . $file . $ext)) {
$i = 1;
while (file_exists($dir . $file . '_' . $i . $ext)) {
++$i;
}
$file = $file . '_' . $i;
}
if (rex_a1_export_db($dir . $file . $ext)) {
$message = $file . $ext . ' created';
if ($this->sendmail) {
if (!rex_addon::get('phpmailer')->isAvailable()) {
$this->setMessage($message . ', mail not sent (addon "phpmailer" isn\'t activated)');
return false;
}
$mail = new rex_mailer();
$mail->AddAddress($this->mailaddress);
$mail->Subject = rex_i18n::msg('im_export_mail_subject');
$mail->Body = rex_i18n::msg('im_export_mail_body', rex::getServerName());
$mail->AddAttachment($dir . $file . $ext, $filename . $ext);
if ($mail->Send()) {
$this->setMessage($message . ', mail sent');
return true;
}
$this->setMessage($message . ', mail not sent');
return false;
}
$this->setMessage($message);
return true;
}
$this->setMessage($file . $ext . ' not created');
return false;
}
示例4: updateFromPrevious
public static function updateFromPrevious()
{
// ----- vorhandenen seite updaten
$err_msg = '';
if ($err_msg == '') {
$version = rex::getVersion();
rex::setProperty('version', rex::getConfig('version'));
try {
include rex_path::core('update.php');
} catch (rex_functional_exception $e) {
$err_msg .= $e->getMessage();
} catch (rex_sql_exception $e) {
$err_msg .= 'SQL error: ' . $e->getMessage();
}
rex::setProperty('version', $version);
}
if ($err_msg == '') {
$err_msg .= self::installAddons();
}
return $err_msg;
}
示例5: checkRequirements
/**
* Checks whether the requirements are met.
*
* @return bool
*/
public function checkRequirements()
{
if (!$this->checkRedaxoRequirement(rex::getVersion())) {
return false;
}
$state = [];
$requirements = $this->package->getProperty('requires', []);
if (isset($requirements['php'])) {
if (!is_array($requirements['php'])) {
$requirements['php'] = ['version' => $requirements['php']];
}
if (isset($requirements['php']['version']) && !self::matchVersionConstraints(PHP_VERSION, $requirements['php']['version'])) {
$state[] = $this->i18n('requirement_error_php_version', PHP_VERSION, $requirements['php']['version']);
}
if (isset($requirements['php']['extensions']) && $requirements['php']['extensions']) {
$extensions = (array) $requirements['php']['extensions'];
foreach ($extensions as $reqExt) {
if (is_string($reqExt) && !extension_loaded($reqExt)) {
$state[] = $this->i18n('requirement_error_php_extension', $reqExt);
}
}
}
}
if (empty($state)) {
if (isset($requirements['packages']) && is_array($requirements['packages'])) {
foreach ($requirements['packages'] as $package => $_) {
if (!$this->checkPackageRequirement($package)) {
$state[] = $this->message;
}
}
}
}
if (empty($state)) {
return true;
}
$this->message = implode('<br />', $state);
return false;
}
示例6: function
<?php
if (rex_string::versionCompare(rex::getVersion(), '5.0.0-beta1', '<=')) {
rex_extension::register('RESPONSE_SHUTDOWN', function () {
rex_file::delete(rex_path::assets('jquery.min.js'));
rex_file::delete(rex_path::assets('jquery.min.map'));
rex_file::delete(rex_path::assets('jquery-pjax.min.js'));
rex_file::delete(rex_path::assets('jquery-ui.custom.min.js'));
rex_file::delete(rex_path::assets('jquery-ui.custom.txt'));
rex_file::delete(rex_path::assets('redaxo-logo.svg'));
rex_file::delete(rex_path::assets('sha1.js'));
rex_file::delete(rex_path::assets('standard.js'));
});
rex_dir::copy(__DIR__ . '/assets', rex_path::assets('core'));
rex_dir::create(rex_path::data('core'));
rename(rex_path::data('config.yml'), rex_path::data('core/config.yml'));
}
示例7: exportDb
/**
* Erstellt einen SQL Dump, der die aktuellen Datebankstruktur darstellt.
* Dieser wird in der Datei $filename gespeichert.
*
* @param string $filename
* @param array $tables
*
* @return bool TRUE wenn ein Dump erstellt wurde, sonst FALSE
*/
public static function exportDb($filename, array $tables = null)
{
$fp = @fopen($filename, 'w');
if (!$fp) {
return false;
}
$sql = rex_sql::factory();
$nl = "\n";
$insertSize = 5000;
// ----- EXTENSION POINT
rex_extension::registerPoint(new rex_extension_point('BACKUP_BEFORE_DB_EXPORT'));
// Versionsstempel hinzufügen
fwrite($fp, '## Redaxo Database Dump Version ' . rex::getVersion('%s') . $nl);
fwrite($fp, '## Prefix ' . rex::getTablePrefix() . $nl);
//fwrite($fp, '## charset '.rex_i18n::msg('htmlcharset').$nl.$nl);
fwrite($fp, '## charset utf-8' . $nl . $nl);
// fwrite($fp, '/*!40110 START TRANSACTION; */'.$nl);
if (is_null($tables)) {
$tables = [];
foreach (rex_sql::showTables(1, rex::getTablePrefix()) as $table) {
if ($table != rex::getTable('user') && substr($table, 0, strlen(rex::getTablePrefix() . rex::getTempPrefix())) != rex::getTablePrefix() . rex::getTempPrefix()) {
// Tabellen die mit rex_tmp_ beginnne, werden nicht exportiert!
$tables[] = $table;
}
}
}
foreach ($tables as $table) {
//---- export metadata
$create = rex_sql::showCreateTable($table);
fwrite($fp, 'DROP TABLE IF EXISTS `' . $table . '`;' . $nl);
fwrite($fp, $create . ';' . $nl);
$fields = $sql->getArray('SHOW FIELDS FROM `' . $table . '`');
foreach ($fields as &$field) {
if (preg_match('#^(bigint|int|smallint|mediumint|tinyint|timestamp)#i', $field['Type'])) {
$field = 'int';
} elseif (preg_match('#^(float|double|decimal)#', $field['Type'])) {
$field = 'double';
} elseif (preg_match('#^(char|varchar|text|longtext|mediumtext|tinytext)#', $field['Type'])) {
$field = 'string';
}
// else ?
}
//---- export tabledata
$start = 0;
$max = $insertSize;
do {
$array = $sql->getArray('SELECT * FROM `' . $table . '` LIMIT ' . $start . ',' . $max, [], PDO::FETCH_NUM);
$count = $sql->getRows();
if ($count > 0 && $start == 0) {
fwrite($fp, $nl . 'LOCK TABLES `' . $table . '` WRITE;');
fwrite($fp, $nl . '/*!40000 ALTER TABLE `' . $table . '` DISABLE KEYS */;');
} elseif ($count == 0) {
break;
}
$start += $max;
$values = [];
foreach ($array as $row) {
$record = [];
foreach ($fields as $idx => $type) {
$column = $row[$idx];
switch ($type) {
case 'int':
$record[] = intval($column);
break;
case 'double':
$record[] = sprintf('%.10F', (double) $column);
break;
case 'string':
default:
$record[] = $sql->escape($column, "'");
break;
}
}
$values[] = $nl . ' (' . implode(',', $record) . ')';
}
if (!empty($values)) {
fwrite($fp, $nl . 'INSERT INTO `' . $table . '` VALUES ' . implode(',', $values) . ';');
unset($values);
}
} while ($count >= $max);
if ($start > 0) {
fwrite($fp, $nl . '/*!40000 ALTER TABLE `' . $table . '` ENABLE KEYS */;');
fwrite($fp, $nl . 'UNLOCK TABLES;' . $nl . $nl);
}
}
fclose($fp);
$hasContent = true;
// Den Dateiinhalt geben wir nur dann weiter, wenn es unbedingt notwendig ist.
if (rex_extension::isRegistered('BACKUP_AFTER_DB_EXPORT')) {
$content = rex_file::get($filename);
$hashBefore = md5($content);
//.........这里部分代码省略.........
示例8: testGetVersion
public function testGetVersion()
{
$this->assertTrue(rex::getVersion() != '', 'a version string is returned');
$vers = rex::getVersion();
$versParts = explode('.', $vers);
$this->assertTrue($versParts[0] == 5, 'the major version is 5');
}
示例9: rex_request
// Für größere Exports den Speicher für PHP erhöhen.
if (rex_ini_get('memory_limit') < 67108864) {
@ini_set('memory_limit', '64M');
}
$success = '';
$error = '';
// ------------------------------ Requestvars
$function = rex_request('function', 'string');
$exportfilename = rex_post('exportfilename', 'string');
$exporttype = rex_post('exporttype', 'string');
$exportdl = rex_post('exportdl', 'boolean');
$EXPTABLES = rex_post('EXPTABLES', 'array');
$EXPDIR = rex_post('EXPDIR', 'array');
if ($exportfilename == '') {
$server = parse_url(rex::getServer(), PHP_URL_HOST);
$exportfilename = strtolower($server) . '_rex' . rex::getVersion() . '_' . date('Ymd_Hi');
}
if (rex_post('export', 'bool')) {
// ------------------------------ FUNC EXPORT
$exportfilename = strtolower($exportfilename);
$filename = preg_replace('@[^\\.a-z0-9_\\-]@', '', $exportfilename);
if ($filename != $exportfilename) {
$success = rex_i18n::msg('backup_filename_updated');
$exportfilename = $filename;
} else {
$hasContent = false;
$header = '';
$ext = $exporttype == 'sql' ? '.sql' : '.tar.gz';
$export_path = rex_backup::getDir() . '/';
if (file_exists($export_path . $filename . $ext)) {
$i = 1;
示例10: rex_fragment
<p>' . rex_i18n::msg('credits_developer') . '<br />
Yakamara Media GmbH & Co. KG, <a href="http://www.yakamara.de" onclick="window.open(this.href); return false;">www.yakamara.de</a>
</p>';
$content[] = '
<h3>Ralph Zumkeller <small>info@redaxo.org</small></h3>
<p>' . rex_i18n::msg('credits_designer') . '<br />
Yakamara Media GmbH & Co. KG, <a href="http://www.yakamara.de" onclick="window.open(this.href); return false;">www.yakamara.de</a>
</p>
<h3>Thomas Blum <small>thomas.blum@redaxo.org</small></h3>
<p>Yakamara Media GmbH & Co. KG, <a href="http://www.yakamara.de" onclick="window.open(this.href); return false;">www.yakamara.de</a></p>';
$fragment = new rex_fragment();
$fragment->setVar('content', $content, false);
$content = $fragment->parse('core/page/grid.php');
$fragment = new rex_fragment();
$fragment->setVar('title', 'REDAXO <small>' . rex::getVersion() . '</small>', false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
$content = '';
$content .= '
<table class="table table-hover">
<thead>
<tr>
<th class="rex-table-icon"> </th>
<th>' . rex_i18n::msg('credits_name') . '</th>
<th>' . rex_i18n::msg('credits_version') . '</th>
<th class="rex-table-slim">' . rex_i18n::msg('credits_help') . '</th>
<th>' . rex_i18n::msg('credits_author') . '</th>
<th>' . rex_i18n::msg('credits_supportpage') . '</th>
</tr>
示例11:
$error = rex_setup_importer::prepareEmptyDb();
if ($error != '') {
$errors[] = rex_view::error($error);
}
} else {
$errors[] = rex_view::error(rex_i18n::msg('error_undefined'));
}
if (count($errors) == 0 && $createdb !== '') {
$error = rex_setup_importer::verifyDbSchema();
if ($error != '') {
$errors[] = $error;
}
}
if (count($errors) == 0) {
rex_clang_service::generateCache();
rex::setConfig('version', rex::getVersion());
} else {
$step = 5;
}
}
if ($step > 5) {
if (!rex_setup_importer::verifyDbSchema() == '') {
$step = 5;
}
}
if ($step == 5) {
$tables_complete = rex_setup_importer::verifyDbSchema() == '' ? true : false;
$createdb = rex_post('createdb', 'int', '');
$headline = rex_view::title(rex_i18n::msg('setup_500'));
$content = '
<fieldset>
示例12: getPath
private static function getPath($path)
{
$path = strpos($path, '?') === false ? rtrim($path, '/') . '/?' : $path . '&';
$path .= 'rex_version=' . rex::getVersion();
$addon = rex_addon::get('install');
if ($addon->getConfig('api_login')) {
$path .= '&api_login=' . urlencode($addon->getConfig('api_login')) . '&api_key=' . urlencode($addon->getConfig('api_key'));
}
return $path;
}
示例13: foreach
<th>' . $this->i18n('available_versions') . '</th>
</tr>
</thead>
<tbody>';
if (!empty($coreVersions)) {
$availableVersions = [];
foreach ($coreVersions as $file) {
$availableVersions[] = $file['version'];
}
$url = rex_url::currentBackendPage(['core' => 1]);
$panel .= '
<tr>
<td class="rex-table-icon"><a href="' . $url . '"><i class="rex-icon rex-icon-package"></i></a></td>
<td data-title="' . $this->i18n('key') . '"><a href="' . $url . '">core</a></td>
<td data-title="' . $this->i18n('name') . '">REDAXO Core</td>
<td data-title="' . $this->i18n('existing_version') . '">' . rex::getVersion() . '</td>
<td data-title="' . $this->i18n('available_versions') . '">' . implode(', ', $availableVersions) . '</td>
</tr>';
}
foreach ($addons as $key => $addon) {
$availableVersions = [];
foreach ($addon['files'] as $file) {
$availableVersions[] = $file['version'];
}
$url = rex_url::currentBackendPage(['addonkey' => $key]);
$panel .= '
<tr>
<td class="rex-table-icon"><a href="' . $url . '"><i class="rex-icon rex-icon-package"></i></a></td>
<td data-title="' . $this->i18n('key') . '"><a href="' . $url . '">' . $key . '</a></td>
<td data-title="' . $this->i18n('name') . '">' . $addon['name'] . '</td>
<td data-title="' . $this->i18n('existing_version') . '">' . rex_addon::get($key)->getVersion() . '</td>
示例14: foreach
<th class="rex-version">' . $this->i18n('available_versions') . '</th>
</tr>
</thead>
<tbody>';
if (!empty($coreVersions)) {
$availableVersions = [];
foreach ($coreVersions as $file) {
$availableVersions[] = $file['version'];
}
$url = rex_url::currentBackendPage(['core' => 1]);
$panel .= '
<tr>
<td class="rex-slim"><a href="' . $url . '"><i class="rex-icon rex-icon-package"></i></a></td>
<td class="rex-key"><a href="' . $url . '">core</a></td>
<td class="rex-name">REDAXO Core</td>
<td class="rex-version">' . rex::getVersion() . '</td>
<td class="rex-version">' . implode(', ', $availableVersions) . '</td>
</tr>';
}
foreach ($addons as $key => $addon) {
$availableVersions = [];
foreach ($addon['files'] as $file) {
$availableVersions[] = $file['version'];
}
$url = rex_url::currentBackendPage(['addonkey' => $key]);
$panel .= '
<tr>
<td class="rex-slim"><a href="' . $url . '"><i class="rex-icon rex-icon-package"></i></a></td>
<td class="rex-key"><a href="' . $url . '">' . $key . '</a></td>
<td class="rex-name">' . $addon['name'] . '</td>
<td class="rex-version">' . rex_addon::get($key)->getVersion() . '</td>
示例15: checkRequirements
/**
* @param string $temppath
* @param string $version
* @param rex_addon[] $addons
*
* @throws rex_functional_exception
*/
private function checkRequirements($temppath, $version, array $addons)
{
// ---- update "version", "requires" and "conflicts" properties
$coreVersion = rex::getVersion();
rex::setProperty('version', $version);
$versions = new SplObjectStorage();
$requirements = new SplObjectStorage();
$conflicts = new SplObjectStorage();
foreach ($addons as $addonkey => $config) {
$addon = rex_addon::get($addonkey);
$addonPath = $temppath . 'addons/' . $addonkey . '/';
if (isset($config['requires'])) {
$requirements[$addon] = $addon->getProperty('requires');
$addon->setProperty('requires', $config['requires']);
}
if (isset($config['conflicts'])) {
$conflicts[$addon] = $addon->getProperty('conflicts');
$addon->setProperty('conflicts', $config['conflicts']);
}
$versions[$addon] = $addon->getVersion();
$addon->setProperty('version', $config['version']);
foreach ($addon->getAvailablePlugins() as $plugin) {
if (is_dir($addonPath . 'plugins/' . $plugin->getName())) {
$config = rex_file::getConfig($addonPath . 'plugins/' . $plugin->getName() . '/' . rex_package::FILE_PACKAGE);
if (isset($config['requires'])) {
$requirements[$plugin] = $plugin->getProperty('requires');
$plugin->setProperty('requires', $config['requires']);
}
if (isset($config['conflicts'])) {
$conflicts[$plugin] = $plugin->getProperty('conflicts');
$plugin->setProperty('conflicts', $config['conflicts']);
}
if (isset($config['version'])) {
$versions[$plugin] = $plugin->getProperty('version');
$plugin->setProperty('requires', $config['version']);
}
}
}
}
// ---- check requirements
$messages = [];
foreach (rex_package::getAvailablePackages() as $package) {
$manager = rex_package_manager::factory($package);
if (!$manager->checkRequirements()) {
$messages[] = $package->getPackageId() . ': ' . $manager->getMessage();
} elseif (!$manager->checkConflicts()) {
$messages[] = $package->getPackageId() . ': ' . $manager->getMessage();
}
}
// ---- reset "version", "requires" and "conflicts" properties
rex::setProperty('version', $coreVersion);
foreach ($versions as $package) {
$package->setProperty('version', $versions[$package]);
}
foreach ($requirements as $package) {
$package->setProperty('requires', $requirements[$package]);
}
foreach ($conflicts as $package) {
$package->setProperty('conflicts', $conflicts[$package]);
}
if (!empty($messages)) {
throw new rex_functional_exception(implode('<br />', $messages));
}
}