本文整理汇总了PHP中rex_extension::isRegistered方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_extension::isRegistered方法的具体用法?PHP rex_extension::isRegistered怎么用?PHP rex_extension::isRegistered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_extension
的用法示例。
在下文中一共展示了rex_extension::isRegistered方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testIsRegistered
public function testIsRegistered()
{
$EP = 'TEST_IS_REGISTERED';
$this->assertFalse(rex_extension::isRegistered($EP), 'isRegistered() returns false for non-registered extension points');
rex_extension::register($EP, function () {
});
$this->assertTrue(rex_extension::isRegistered($EP), 'isRegistered() returns true for registered extension points');
}
示例4: rex_be_add_page
/**
* Menupunkt nur einbinden, falls ein Plugin sich angemeldet hat
* via BE_STYLE_PAGE_CONTENT inhalt auszugeben.
*
* @package redaxo\be-style
*/
function rex_be_add_page()
{
if (rex_extension::isRegistered('BE_STYLE_PAGE_CONTENT')) {
rex_addon::get('be_style')->setProperty('name', 'Backend Style');
}
}
示例5: 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);
//.........这里部分代码省略.........
示例6: sendPage
/**
* Sends a page to client.
*
* The page content can be modified by the Extension Point OUTPUT_FILTER
*
* @param string $content Content of page
* @param int $lastModified HTTP Last-Modified Timestamp
*/
public static function sendPage($content, $lastModified = null)
{
// ----- EXTENSION POINT
$content = rex_extension::registerPoint(new rex_extension_point('OUTPUT_FILTER', $content));
$hasShutdownExtension = rex_extension::isRegistered('RESPONSE_SHUTDOWN');
if ($hasShutdownExtension) {
header('Connection: close');
}
self::sendContent($content, null, $lastModified);
// ----- EXTENSION POINT - (read only)
if ($hasShutdownExtension) {
// unlock session
session_write_close();
rex_extension::registerPoint(new rex_extension_point('RESPONSE_SHUTDOWN', $content, [], true));
}
}
示例7: ob_get_contents
<?php
/**
* @package redaxo5
*/
if (rex::isSetup()) {
rex_response::sendRedirect(rex_url::backendController());
}
// ----- INCLUDE ADDONS
include_once rex_path::core('packages.php');
// ----- caching end für output filter
$CONTENT = ob_get_contents();
ob_end_clean();
// trigger api functions
rex_api_function::handleCall();
if (rex_extension::isRegistered('FE_OUTPUT')) {
// ----- EXTENSION POINT
rex_extension::registerPoint(new rex_extension_point('FE_OUTPUT', $CONTENT));
} else {
// ----- inhalt ausgeben
rex_response::sendPage($CONTENT);
}
示例8: function
/**
* Backendstyle Addon.
*
* @author jan.kristinus[at]redaxo[dot]de Jan Kristinus
* @author <a href="http://www.yakamara.de">www.yakamara.de</a>
* @author markus[dot]staab[at]redaxo[dot]de Markus Staab
* @author <a href="http://www.redaxo.org">www.redaxo.org</a>
*
* @package redaxo5
*/
$mypage = 'be_style';
/* Addon Parameter */
if (rex::isBackend()) {
rex_extension::register('PACKAGES_INCLUDED', function () {
if (rex_extension::isRegistered('BE_STYLE_PAGE_CONTENT')) {
rex_addon::get('be_style')->setProperty('name', 'Backend Style');
}
});
rex_extension::register('PACKAGES_INCLUDED', function () {
if (rex::getUser() && $this->getProperty('compile')) {
$compiler = new rex_scss_compiler();
$scss_files = rex_extension::registerPoint(new rex_extension_point('BE_STYLE_SCSS_FILES', [$this->getPath('scss/master.scss')]));
$compiler->setScssFile($scss_files);
//$compiler->setScssFile($this->getPath('scss/master.scss'));
// Compile in backend assets dir
$compiler->setCssFile($this->getPath('assets/css/styles.css'));
$compiler->compile();
// Compiled file to copy in frontend assets dir
rex_file::copy($this->getPath('assets/css/styles.css'), $this->getAssetsPath('css/styles.css'));
}