本文整理汇总了PHP中rex::getProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP rex::getProperty方法的具体用法?PHP rex::getProperty怎么用?PHP rex::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex
的用法示例。
在下文中一共展示了rex::getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rex_getUrl
/**
* Gibt eine Url zu einem Artikel zurück.
*
* @param int|null $id
* @param int|null $clang SprachId des Artikels
* @param array $params Array von Parametern
* @param string $separator
*
* @return string
*
* @package redaxo\structure
*/
function rex_getUrl($id = null, $clang = null, array $params = [], $separator = '&')
{
$id = (int) $id;
$clang = (int) $clang;
// ----- get id
if ($id == 0) {
$id = rex::getProperty('article_id');
}
// ----- get clang
// Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
// Die rexExtension muss selbst entscheiden was sie damit macht
if (!rex_clang::exists($clang) && (rex_clang::count() > 1 || rex_extension::isRegistered('URL_REWRITE'))) {
$clang = rex_clang::getCurrentId();
}
// ----- EXTENSION POINT
$url = rex_extension::registerPoint(new rex_extension_point('URL_REWRITE', '', ['id' => $id, 'clang' => $clang, 'params' => $params, 'separator' => $separator]));
if ($url == '') {
if (rex_clang::count() > 1) {
$clang = $separator . 'clang=' . $clang;
} else {
$clang = '';
}
$params = rex_string::buildQuery($params, $separator);
$params = $params ? $separator . $params : '';
$url = rex_url::frontendController() . '?article_id=' . $id . $clang . $params;
}
return $url;
}
示例2: rex_getUrl
/**
* Gibt eine Url zu einem Artikel zurück.
*
* @param string $_id
* @param int|string $_clang SprachId des Artikels
* @param array|string $_params Array von Parametern
* @param bool $escape Flag whether the argument separator "&" should be escaped (&)
*
* @return string
*
* @package redaxo\structure
*/
function rex_getUrl($_id = '', $_clang = '', $_params = '', $escape = true)
{
$id = (int) $_id;
$clang = (int) $_clang;
// ----- get id
if ($id == 0) {
$id = rex::getProperty('article_id');
}
// ----- get clang
// Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
// Die rexExtension muss selbst entscheiden was sie damit macht
if ($_clang === '' && (rex_clang::count() > 1 || rex_extension::isRegistered('URL_REWRITE'))) {
$clang = rex_clang::getCurrentId();
}
// ----- get params
$param_string = rex_param_string($_params, $escape ? '&' : '&');
$name = 'NoName';
if ($id != 0) {
$ooa = rex_article::get($id, $clang);
if ($ooa) {
$name = rex_parse_article_name($ooa->getName());
}
}
// ----- EXTENSION POINT
$url = rex_extension::registerPoint(new rex_extension_point('URL_REWRITE', '', ['id' => $id, 'name' => $name, 'clang' => $clang, 'params' => $param_string, 'escape' => $escape]));
if ($url == '') {
$_clang = '';
if (rex_clang::count() > 1) {
$_clang .= ($escape ? '&' : '&') . 'clang=' . $clang;
}
$url = rex_url::frontendController() . '?article_id=' . $id . $_clang . $param_string;
}
return $url;
}
示例3: factory
/**
* Factory method.
*
* @param string $host Host name
* @param int $port Port number
* @param bool $ssl SSL flag
*
* @return static Socket instance
*
* @see rex_socket::factoryUrl()
*/
public static function factory($host, $port = 80, $ssl = false)
{
if (get_called_class() === __CLASS__ && ($proxy = rex::getProperty('socket_proxy'))) {
return rex_socket_proxy::factoryUrl($proxy)->setDestination($host, $port, $ssl);
}
return new static($host, $port, $ssl);
}
示例4: testGetServer
public function testGetServer()
{
$origServer = rex::getProperty('server');
rex::setProperty('server', 'http://www.redaxo.org');
$this->assertEquals('http://www.redaxo.org/', rex::getServer());
$this->assertEquals('https://www.redaxo.org/', rex::getServer('https'));
$this->assertEquals('www.redaxo.org/', rex::getServer(''));
rex::setProperty('server', $origServer);
}
示例5: registerPoint
/**
* Extends rex_extension::registerPoint() with FirePHP logging.
*/
public static function registerPoint(rex_extension_point $extensionPoint)
{
$coreTimer = rex::getProperty('timer');
$absDur = $coreTimer->getFormattedDelta();
// start timer for this extensionPoint
$timer = new rex_timer();
$res = parent::registerPoint($extensionPoint);
$epDur = $timer->getFormattedDelta();
$memory = rex_formatter::bytes(memory_get_usage(true), [3]);
self::$log[] = ['type' => 'EP', 'ep' => $extensionPoint->getName(), 'started' => $absDur, 'duration' => $epDur, 'memory' => $memory, 'subject' => $extensionPoint->getSubject(), 'params' => $extensionPoint->getParams(), 'read_only' => $extensionPoint->isReadonly(), 'result' => $res, 'timer' => $epDur];
return $res;
}
示例6: getField
public function getField()
{
$field = new rex_form_select_element();
$field->setAttribute('class', 'form-control');
$field->setLabel(rex_i18n::msg('system_setting_default_template_id'));
$select = $field->getSelect();
$select->setSize(1);
$select->setSelected(rex::getProperty('default_template_id'));
$templates = rex_template::getTemplatesForCategory(0);
if (empty($templates)) {
$select->addOption(rex_i18n::msg('option_no_template'), 0);
} else {
$select->addArrayOptions($templates);
}
return $field;
}
示例7: selectDB
/**
* Stellt die Verbindung zur Datenbank her.
*/
protected function selectDB($DBID)
{
$this->DBID = $DBID;
try {
if (!isset(self::$pdo[$DBID])) {
$dbconfig = rex::getProperty('db');
$conn = self::createConnection($dbconfig[$DBID]['host'], $dbconfig[$DBID]['name'], $dbconfig[$DBID]['login'], $dbconfig[$DBID]['password'], $dbconfig[$DBID]['persistent']);
self::$pdo[$DBID] = $conn;
// ggf. Strict Mode abschalten
$this->setQuery('SET SQL_MODE=""');
// set encoding
$this->setQuery('SET NAMES utf8');
}
} catch (PDOException $e) {
throw new rex_sql_exception('Could not connect to database', $e);
}
}
示例8: rex_request
*/
rex_perm::register('moveArticle[]', null, rex_perm::OPTIONS);
rex_perm::register('moveCategory[]', null, rex_perm::OPTIONS);
rex_perm::register('copyArticle[]', null, rex_perm::OPTIONS);
rex_perm::register('copyContent[]', null, rex_perm::OPTIONS);
rex_perm::register('publishArticle[]', null, rex_perm::OPTIONS);
rex_perm::register('publishCategory[]', null, rex_perm::OPTIONS);
rex_perm::register('article2startarticle[]', null, rex_perm::OPTIONS);
rex_perm::register('article2category[]', null, rex_perm::OPTIONS);
rex_complex_perm::register('structure', 'rex_structure_perm');
require_once __DIR__ . '/functions/function_rex_url.php';
if (rex_request('article_id', 'int') == 0) {
rex::setProperty('article_id', rex::getProperty('start_article_id'));
} else {
$article_id = rex_request('article_id', 'int');
$article_id = rex_article::get($article_id) ? $article_id : rex::getProperty('notfound_article_id');
rex::setProperty('article_id', $article_id);
}
if (rex::isBackend() && rex::getUser()) {
rex_view::addJsFile($this->getAssetsUrl('linkmap.js'));
rex_extension::register('PAGE_SIDEBAR', function () {
$category_id = rex_request('category_id', 'int');
$article_id = rex_request('article_id', 'int');
$clang = rex_request('clang', 'int');
$ctype = rex_request('ctype', 'int');
$category_id = rex_category::get($category_id) ? $category_id : 0;
$article_id = rex_article::get($article_id) ? $article_id : 0;
$clang = rex_clang::exists($clang) ? $clang : rex_clang::getStartId();
// TODO - CHECK PERM
$context = new rex_context(['page' => 'structure', 'category_id' => $category_id, 'article_id' => $article_id, 'clang' => $clang, 'ctype' => $ctype]);
// check if a new category was folded
示例9: checkPagePermissions
public static function checkPagePermissions(rex_user $user)
{
$check = function (rex_be_page $page) use(&$check, $user) {
if (!$page->checkPermission($user)) {
return false;
}
$subpages = $page->getSubpages();
foreach ($subpages as $key => $subpage) {
if (!$check($subpage)) {
unset($subpages[$key]);
}
}
$page->setSubpages($subpages);
return true;
};
foreach (self::$pages as $key => $page) {
if (!$check($page)) {
unset(self::$pages[$key]);
}
}
self::$pageObject = null;
$page = self::getCurrentPageObject();
// --- page pruefen und benoetigte rechte checken
if (!$page) {
// --- fallback zur user startpage -> rechte checken
$page = self::getPageObject($user->getStartPage());
if (!$page) {
// --- fallback zur system startpage -> rechte checken
$page = self::getPageObject(rex::getProperty('start_page'));
if (!$page) {
// --- fallback zur profile page
$page = self::getPageObject('profile');
}
}
rex_response::setStatus(rex_response::HTTP_NOT_FOUND);
rex_response::sendRedirect($page->getHref());
}
if ($page !== ($leaf = $page->getFirstSubpagesLeaf())) {
rex_response::setStatus(rex_response::HTTP_MOVED_PERMANENTLY);
$url = $leaf->hasHref() ? $leaf->getHref() : rex_context::restore()->getUrl(['page' => $leaf->getFullKey()], false);
rex_response::sendRedirect($url);
}
}
示例10: sendContent
/**
* Sends content to the client.
*
* @param string $content Content
* @param string $contentType Content type
* @param int $lastModified HTTP Last-Modified Timestamp
* @param string $etag HTTP Cachekey to identify the cache
*/
public static function sendContent($content, $contentType = null, $lastModified = null, $etag = null)
{
if (!self::$sentContentType) {
self::sendContentType($contentType);
}
if (!self::$sentCacheControl) {
self::sendCacheControl();
}
$environment = rex::isBackend() ? 'backend' : 'frontend';
if (self::$httpStatus == self::HTTP_OK && (false === strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') || false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome'))) {
// ----- Last-Modified
if (!self::$sentLastModified && (rex::getProperty('use_last_modified') === true || rex::getProperty('use_last_modified') === $environment)) {
self::sendLastModified($lastModified);
}
// ----- ETAG
if (!self::$sentEtag && (rex::getProperty('use_etag') === true || rex::getProperty('use_etag') === $environment)) {
self::sendEtag($etag ?: self::md5($content));
}
}
// ----- GZIP
if (rex::getProperty('use_gzip') === true || rex::getProperty('use_gzip') === $environment) {
$content = self::sendGzip($content);
}
self::cleanOutputBuffers();
header('HTTP/1.1 ' . self::$httpStatus);
// content length schicken, damit der browser einen ladebalken anzeigen kann
header('Content-Length: ' . rex_string::size($content));
echo $content;
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
}
}
示例11: rex_system_setting_default_template_id
if (rex_be_controller::getCurrentPagePart(1) == 'content') {
rex_be_controller::getPageObject('structure')->setIsActive(true);
}
});
if (rex_be_controller::getCurrentPagePart(1) == 'system') {
rex_system_setting::register(new rex_system_setting_default_template_id());
}
rex_extension::register('CLANG_DELETED', function (rex_extension_point $ep) {
$del = rex_sql::factory();
$del->setQuery('delete from ' . rex::getTablePrefix() . "article_slice where clang_id='" . $ep->getParam('clang')->getId() . "'");
});
} else {
rex_extension::register('FE_OUTPUT', function (rex_extension_point $ep) {
$content = $ep->getSubject();
$article = new rex_article_content();
$article->setCLang(rex_clang::getCurrentId());
if ($article->setArticleId(rex::getProperty('article_id'))) {
$content .= $article->getArticleTemplate();
} else {
$content .= 'Kein Startartikel selektiert / No starting Article selected. Please click here to enter <a href="' . rex_url::backendController() . '">redaxo</a>';
rex_response::sendPage($content);
exit;
}
$art_id = $article->getArticleId();
if ($art_id == rex::getProperty('notfound_article_id') && $art_id != rex::getProperty('start_article_id')) {
rex_response::setStatus(rex_response::HTTP_NOT_FOUND);
}
// ----- inhalt ausgeben
rex_response::sendPage($content, $article->getValue('updatedate'));
});
}
示例12: isNotFoundArticle
/**
* Returns true if this Article is the not found article.
*
* @return bool
*/
public function isNotFoundArticle()
{
return $this->id == rex::getProperty('notfound_article_id');
}
示例13: _setActivePath
private function _setActivePath()
{
$article_id = rex::getProperty('article_id');
if ($OOArt = rex_article::get($article_id)) {
$path = trim($OOArt->getPath(), '|');
$this->path = [];
if ($path != '') {
$this->path = explode('|', $path);
}
$this->current_article_id = $article_id;
$this->current_category_id = $OOArt->getCategoryId();
return true;
}
return false;
}
示例14: array_merge
require_once rex_path::core('functions/function_rex_other.php');
// ----------------- VERSION
rex::setProperty('version', '5.0.0-alpha7');
$cacheFile = rex_path::cache('config.yml.cache');
$configFile = rex_path::data('config.yml');
if (file_exists($cacheFile) && file_exists($configFile) && filemtime($cacheFile) >= filemtime($configFile)) {
$config = rex_file::getCache($cacheFile);
} else {
$config = array_merge(rex_file::getConfig(rex_path::core('default.config.yml')), rex_file::getConfig($configFile));
rex_file::putCache($cacheFile, $config);
}
foreach ($config as $key => $value) {
if (in_array($key, ['fileperm', 'dirperm'])) {
$value = octdec($value);
}
rex::setProperty($key, $value);
}
date_default_timezone_set(rex::getProperty('timezone', 'Europe/Berlin'));
if (!rex::isSetup()) {
rex_error_handler::register();
}
// ----------------- REX PERMS
rex_complex_perm::register('clang', 'rex_clang_perm');
// ----- SET CLANG
if (!rex::isSetup()) {
rex_clang::setCurrentId(rex_request('clang', 'int', rex_clang::getStartId()));
}
if (isset($REX['LOAD_PAGE']) && $REX['LOAD_PAGE']) {
unset($REX);
require rex_path::core(rex::isBackend() ? 'backend.php' : 'frontend.php');
}
示例15: setUp
protected function setUp()
{
$this->proxy = rex::getProperty('socket_proxy');
rex::setProperty('socket_proxy', null);
}