本文整理汇总了PHP中rex_url类的典型用法代码示例。如果您正苦于以下问题:PHP rex_url类的具体用法?PHP rex_url怎么用?PHP rex_url使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rex_url类的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: showForm
public static function showForm()
{
$article_id = rex_request('article_id', 'int');
$clang = rex_get('clang');
$ctype = rex_get('ctype');
$_SESSION[__CLASS__]['active'] = 1;
// Alle OBs schließen
while (@ob_end_clean()) {
}
header("Location: " . rex_url::backendController() . '?article_id=' . $article_id . '&clang=' . $clang . '&page=content/edit&ctype=' . $ctype);
exit;
}
示例4: handleException
/**
* Handles the given Exception.
*
* @param Throwable|Exception $exception The Exception to handle
* @param bool $showTrace
*/
public static function handleException($exception, $showTrace = true)
{
rex_logger::logException($exception);
while (ob_get_level()) {
ob_end_clean();
}
$status = rex_response::HTTP_INTERNAL_ERROR;
if ($exception instanceof rex_http_exception && $exception->getHttpCode()) {
$status = $exception->getHttpCode();
}
rex_response::setStatus($status);
if (rex::isSetup() || rex::isDebugMode() || ($user = rex_backend_login::createUser()) && $user->isAdmin()) {
// TODO add a beautiful error page with usefull debugging info
$buf = '';
$buf .= '<pre>';
$buf .= '"' . get_class($exception) . '" thrown in ' . $exception->getFile() . ' on line ' . $exception->getLine() . "\n";
if ($exception->getMessage()) {
$buf .= '<b>' . ($exception instanceof ErrorException ? self::getErrorType($exception->getSeverity()) . ': ' : '') . $exception->getMessage() . "</b>\n";
}
$cause = $exception->getPrevious();
while ($cause) {
$buf .= "\n";
$buf .= 'caused by ' . get_class($cause) . ' in ' . $cause->getFile() . ' on line ' . $cause->getLine() . "\n";
if ($cause->getMessage()) {
$buf .= '<b>' . ($cause instanceof ErrorException ? self::getErrorType($cause->getSeverity()) . ': ' : '') . $cause->getMessage() . "</b>\n";
}
$cause = $cause->getPrevious();
}
if ($showTrace) {
$buf .= "\n";
$buf .= $exception->getTraceAsString();
}
if (!rex::isSetup() && rex::isBackend() && !rex::isSafeMode()) {
$buf .= "\n\n";
$buf .= '<a href="' . rex_url::backendPage('packages', ['safemode' => 1]) . '">activate safe mode</a>';
}
$buf .= '</pre>';
} else {
// TODO small error page, without debug infos
$buf = 'Oooops, an internal error occured!';
}
rex_response::sendContent($buf);
exit;
}
示例5: execute
public function execute()
{
if (!rex::getUser()->isAdmin()) {
throw new rex_api_exception('You do not have the permission!');
}
$addonkey = rex_request('addonkey', 'string');
$upload = rex_request('upload', [['upload_file', 'bool'], ['oldversion', 'string'], ['redaxo', 'array[string]'], ['description', 'string'], ['status', 'int'], ['replace_assets', 'bool'], ['ignore_tests', 'bool']]);
$file = [];
$archive = null;
$file['version'] = $upload['upload_file'] ? rex_addon::get($addonkey)->getVersion() : $upload['oldversion'];
$file['redaxo_versions'] = $upload['redaxo'];
$file['description'] = $upload['description'];
$file['status'] = $upload['status'];
try {
if ($upload['upload_file']) {
$archive = rex_path::addonCache('install', md5($addonkey . time()) . '.zip');
$exclude = [];
if ($upload['replace_assets']) {
$exclude[] = 'assets';
}
if ($upload['ignore_tests']) {
$exclude[] = 'tests';
}
rex_install_archive::copyDirToArchive(rex_path::addon($addonkey), $archive, null, $exclude);
if ($upload['replace_assets']) {
rex_install_archive::copyDirToArchive(rex_url::addonAssets($addonkey), $archive, $addonkey . '/assets');
}
$file['checksum'] = md5_file($archive);
}
rex_install_webservice::post(rex_install_packages::getPath('?package=' . $addonkey . '&file_id=' . rex_request('file', 'int', 0)), ['file' => $file], $archive);
} catch (rex_functional_exception $e) {
throw new rex_api_exception($e->getMessage());
}
if ($archive) {
rex_file::delete($archive);
}
unset($_REQUEST['addonkey']);
unset($_REQUEST['file']);
rex_install_packages::deleteCache();
return new rex_api_result(true, rex_i18n::msg('install_info_addon_uploaded', $addonkey));
}
示例6: execute
public function execute()
{
if (!rex::getUser()->isAdmin()) {
throw new rex_api_exception('You do not have the permission!');
}
$this->addonkey = rex_request('addonkey', 'string');
$function = static::GET_PACKAGES_FUNCTION;
$packages = rex_install_packages::$function();
$this->fileId = rex_request('file', 'int');
if (!isset($packages[$this->addonkey]['files'][$this->fileId])) {
return null;
}
$this->file = $packages[$this->addonkey]['files'][$this->fileId];
$this->checkPreConditions();
try {
$archivefile = rex_install_webservice::getArchive($this->file['path']);
} catch (rex_functional_exception $e) {
throw new rex_api_exception($e->getMessage());
}
$message = '';
$this->archive = $archivefile;
if ($this->file['checksum'] != md5_file($archivefile)) {
$message = rex_i18n::msg('install_warning_zip_wrong_checksum');
} elseif (!$this->isCorrectFormat($archivefile)) {
$message = rex_i18n::msg('install_warning_zip_wrong_format');
} elseif (is_string($msg = $this->doAction())) {
$message = $msg;
}
rex_file::delete($archivefile);
if ($message) {
$message = rex_i18n::msg('install_warning_addon_not_' . static::VERB, $this->addonkey) . '<br />' . $message;
$success = false;
} else {
$message = rex_i18n::msg('install_info_addon_' . static::VERB, $this->addonkey) . (static::SHOW_LINK ? ' <a href="' . rex_url::backendPage('packages') . '">' . rex_i18n::msg('install_to_addon_page') . '</a>' : '');
$success = true;
unset($_REQUEST['addonkey']);
}
return new rex_api_result($success, $message);
}
示例7: foreach
<th class="rex-table-width-5">' . rex_i18n::msg('backup_filesize') . '</th>
<th class="rex-table-width-5">' . rex_i18n::msg('backup_createdate') . '</th>
<th class="rex-table-action" colspan="3">' . rex_i18n::msg('backup_function') . '</th>
</tr>
</thead>
<tbody>';
$dir = rex_backup::getDir();
$folder = rex_backup::getBackupFiles('.tar.gz');
foreach ($folder as $file) {
$filepath = $dir . '/' . $file;
$filec = date('d.m.Y H:i', filemtime($filepath));
$filesize = rex_file::formattedSize($filepath);
$content .= '<tr>
<td class="rex-table-icon"><i class="rex-icon rex-icon-file-archive"></i></td>
<td data-title="' . rex_i18n::msg('backup_filename') . '">' . $file . '</td>
<td data-title="' . rex_i18n::msg('backup_filesize') . '">' . $filesize . '</td>
<td data-title="' . rex_i18n::msg('backup_createdate') . '">' . $filec . '</td>
<td class="rex-table-action"><a href="' . rex_url::currentBackendPage(['function' => 'fileimport', 'impname' => $file]) . '" title="' . rex_i18n::msg('backup_import_file') . '" data-confirm="' . rex_i18n::msg('backup_proceed_file_import') . '"><i class="rex-icon rex-icon-import"></i> ' . rex_i18n::msg('backup_to_import') . '</a></td>
<td class="rex-table-action"><a href="' . rex_url::currentBackendPage(['function' => 'download', 'impname' => $file]) . '" title="' . rex_i18n::msg('backup_download_file') . '"><i class="rex-icon rex-icon-download"></i> ' . rex_i18n::msg('backup_download') . '</a></td>
<td class="rex-table-action"><a href="' . rex_url::currentBackendPage(['function' => 'delete', 'impname' => $file]) . '" title="' . rex_i18n::msg('backup_delete_file') . '" data-confirm="' . rex_i18n::msg('backup_delete') . ' ?"><i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg('backup_delete') . '</a></td>
</tr>';
}
$content .= '
</tbody>
</table>
';
$fragment = new rex_fragment();
$fragment->setVar('title', rex_i18n::msg('backup_export_file_caption'), false);
$fragment->setVar('content', $content, false);
$content = $fragment->parse('core/page/section.php');
echo $content;
示例8: foreach
if ($cronjob instanceof rex_cronjob) {
$cronjobs[$class] = $cronjob;
$select->addOption($cronjob->getTypeName(), $class);
}
}
if ($func == 'add') {
$select->setSelected('rex_cronjob_phpcode');
}
$activeType = $field->getValue();
if ($func != 'add' && !in_array($activeType, $types)) {
if (!$activeType && !$field->getValue()) {
$warning = rex_i18n::rawMsg('cronjob_not_found');
} else {
$warning = rex_i18n::rawMsg('cronjob_type_not_found', $field->getValue(), $activeType);
}
rex_response::sendRedirect(rex_url::currentBackendPage([rex_request('list', 'string') . '_warning' => $warning], false));
}
$form->addFieldset($this->i18n('type_parameters'));
$fieldContainer = $form->addContainerField('parameters');
$fieldContainer->setAttribute('style', 'display: none');
$fieldContainer->setMultiple(false);
$fieldContainer->setActive($activeType);
$env_js = '';
$visible = [];
foreach ($cronjobs as $group => $cronjob) {
$disabled = [];
$envs = (array) $cronjob->getEnvironments();
if (!in_array('frontend', $envs)) {
$disabled[] = 0;
}
if (!in_array('backend', $envs)) {
示例9: foreach
<th class="rex-table-icon"></th>
<th>' . rex_i18n::msg('cronjob_log_date') . '</th>
<th>' . rex_i18n::msg('cronjob_name') . '</th>
<th>' . rex_i18n::msg('cronjob_log_message') . '</th>
</tr>
</thead>
<tbody>';
if ($file = new rex_log_file($this->getDataPath('cronjob.log'))) {
foreach (new LimitIterator($file, 0, 30) as $entry) {
/* @var rex_log_entry $entry */
$data = $entry->getData();
$class = trim($data[0]) == 'ERROR' ? 'rex-state-error' : 'rex-state-success';
if ($data[1] == '--') {
$icon = '<i class="rex-icon rex-icon-cronjob" title="' . rex_i18n::msg('cronjob_not_editable') . '"></i>';
} else {
$icon = '<a href="' . rex_url::backendPage('cronjob', ['list' => 'cronjobs', 'func' => 'edit', 'oid' => $data[1]]) . '" title="' . rex_i18n::msg('cronjob_edit') . '"><i class="rex-icon rex-icon-cronjob"></i></a>';
}
$content .= '
<tr class="' . $class . '">
<td class="rex-table-icon">' . $icon . '</td>
<td data-title="' . rex_i18n::msg('cronjob_log_date') . '">' . $entry->getTimestamp('%d.%m.%Y %H:%M:%S') . '</td>
<td data-title="' . rex_i18n::msg('cronjob_name') . '">' . htmlspecialchars($data[2]) . '</td>
<td data-title="' . rex_i18n::msg('cronjob_log_message') . '">' . $data[3] . '</td>
</tr>';
}
}
$content .= '
</tbody>
</table>';
$fragment = new rex_fragment();
$fragment->setVar('content', $content, false);
示例10: rex_metainfo_extensions_handler
/**
* Bindet ggf extensions ein.
*
* @param rex_extension_point $ep
*/
function rex_metainfo_extensions_handler(rex_extension_point $ep)
{
$page = $ep->getSubject();
$mainpage = rex_be_controller::getCurrentPagePart(1);
$mypage = 'metainfo';
// additional javascripts
if ($mainpage == 'metainfo' || $page == 'content/metainfo' || $page == 'structure') {
rex_view::addJsFile(rex_url::addonAssets($mypage, 'metainfo.js'));
}
// include extensions
$curDir = __DIR__ . '/..';
if ($page == 'structure') {
require_once $curDir . '/lib/handler/category_handler.php';
} elseif ($mainpage == 'mediapool') {
require_once $curDir . '/lib/handler/media_handler.php';
} elseif ($mainpage == 'content') {
require_once $curDir . '/extensions/extension_content_sidebar.php';
} elseif ($page == 'backup') {
require_once $curDir . '/extensions/extension_cleanup.php';
}
}
示例11: foreach
// Variable definiert und vorbelegt wenn nicht existent
$KAToutARR = [];
// Variable definiert und vorbelegt wenn nicht existent
$navigation = [];
$object_id = $article_id > 0 ? $article_id : $category_id;
$object = rex_article::get($object_id, $clang);
if ($object) {
$tree = $object->getParentTree();
if (!$object->isStartarticle()) {
$tree[] = $object;
}
foreach ($tree as $parent) {
$id = $parent->getId();
if (rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($id)) {
$n = [];
$n['title'] = str_replace(' ', ' ', htmlspecialchars($parent->getName()));
if ($parent->isStartarticle()) {
$n['href'] = rex_url::backendPage('structure', ['category_id' => $id, 'clang' => $clang]);
}
$navigation[] = $n;
}
}
}
$title = '<a href="' . rex_url::backendPage('structure', ['category_id' => 0, 'clang' => $clang]) . '"><i class="rex-icon rex-icon-sitestartarticle"></i> ' . rex_i18n::msg('homepage') . '</a>';
$fragment = new rex_fragment();
$fragment->setVar('id', 'rex-js-structure-breadcrumb', false);
$fragment->setVar('title', $title, false);
$fragment->setVar('items', $navigation, false);
echo $fragment->parse('core/navigations/breadcrumb.php');
unset($fragment);
unset($navigation);
示例12: foreach
foreach (rex_system_setting::getAll() as $setting) {
$field = $setting->getField();
if (!$field instanceof rex_form_element) {
throw new rex_exception(get_class($setting) . '::getField() must return a rex_form_element!');
}
$field->setAttribute('name', 'settings[' . $setting->getKey() . ']');
$elements .= $field->get();
}
$content[] = $elements;
$fragment = new rex_fragment();
$fragment->setVar('content', $content, false);
$content = $fragment->parse('core/page/grid.php');
$formElements = [];
$n = [];
$n['field'] = '<button class="btn btn-save rex-form-aligned" type="submit" name="sendit"' . rex::getAccesskey(rex_i18n::msg('system_update'), 'save') . '>' . rex_i18n::msg('system_update') . '</button>';
$formElements[] = $n;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$buttons = $fragment->parse('core/form/submit.php');
$fragment = new rex_fragment();
$fragment->setVar('class', 'edit', false);
$fragment->setVar('title', rex_i18n::msg('system_settings'));
$fragment->setVar('body', $content, false);
$fragment->setVar('buttons', $buttons, false);
$content = $fragment->parse('core/page/section.php');
$content = '
<form id="rex-form-system-setup" action="' . rex_url::currentBackendPage() . '" method="post">
<input type="hidden" name="func" value="updateinfos" />
' . $content . '
</form>';
echo $content;
示例13: rex_set_session
}
$gc = rex_sql::factory();
$gc->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'media_category WHERE id=?', [$rex_file_category]);
if ($gc->getRows() != 1) {
$rex_file_category = 0;
$rex_file_category_name = rex_i18n::msg('pool_kats_no');
} else {
$rex_file_category_name = $gc->getValue('name');
}
rex_set_session('media[rex_file_category]', $rex_file_category);
// -------------- PERMS
$PERMALL = rex::getUser()->getComplexPerm('media')->hasCategoryPerm(0);
// -------------- Header
$subline = rex_be_controller::getPageObject('mediapool')->getSubpages();
foreach ($subline as $sp) {
$sp->setHref(rex_url::backendPage($sp->getFullKey(), $arg_url, false));
}
echo rex_view::title(rex_i18n::msg('pool_media'), $subline);
// -------------- Messages
if ($success != '') {
echo rex_view::info($success);
$success = '';
}
if ($error != '') {
echo rex_view::error($error);
$error = '';
}
// -------------- Javascripts
?>
<script type="text/javascript">
<!--
示例14: rex_request
* @package redaxo\yrewrite
*
* @var rex_addon $this
*/
$func = rex_request('func', 'string');
if ($func != '') {
if ($func == 'htaccess') {
rex_yrewrite::copyHtaccess();
echo rex_view::success($this->i18n('htaccess_hasbeenset'));
}
}
$content = '
<h3>' . $this->i18n('htaccess_set') . '</h3>
<p>' . rex_i18n::rawMsg('yrewrite_htaccess_info') . '</p>
<p><a class="btn btn-primary" href="' . rex_url::currentBackendPage(['func' => 'htaccess']) . '">' . $this->i18n('yrewrite_htaccess_set') . '</a></p>
<h3>' . $this->i18n('info_headline') . '</h3>
<p>' . rex_i18n::rawMsg('yrewrite_info_text') . '</p>
<h3>' . $this->i18n('info_seo') . '</h3>
<p>' . rex_i18n::rawMsg('yrewrite_info_seo_text') . '
<br /><br />' . highlight_string('<?php
$seo = new rex_yrewrite_seo();
echo $seo->getTitleTag();
echo $seo->getDescriptionTag();
echo $seo->getRobotsTag();
echo $seo->getHreflangTags();
?>', true) . '
示例15: clangSwitchAsDropdown
/**
* Returns a clang switch.
*
* @param rex_context $context
*
* @return string
*/
public static function clangSwitchAsDropdown(rex_context $context)
{
if (rex_clang::count() == 1) {
return '';
}
$button_label = '';
$items = [];
foreach (rex_clang::getAll() as $id => $clang) {
if (rex::getUser()->getComplexPerm('clang')->hasPerm($id)) {
$item = [];
$item['title'] = rex_i18n::translate($clang->getName());
$item['href'] = $context->getUrl(['clang' => $id]);
if ($id == $context->getParam('clang')) {
$item['active'] = true;
$button_label = rex_i18n::translate($clang->getName());
}
$items[] = $item;
}
}
$fragment = new rex_fragment();
$fragment->setVar('class', 'rex-language');
$fragment->setVar('button_prefix', rex_i18n::msg('language'));
$fragment->setVar('button_label', $button_label);
$fragment->setVar('header', rex_i18n::msg('clang_select'));
$fragment->setVar('items', $items, false);
if (rex::getUser()->isAdmin()) {
$fragment->setVar('footer', '<a href="' . rex_url::backendPage('system/lang') . '"><i class="fa fa-flag"></i> ' . rex_i18n::msg('languages_edit') . '</a>', false);
}
return $fragment->parse('core/dropdowns/dropdown.php');
}