本文整理汇总了PHP中rex_url类的典型用法代码示例。如果您正苦于以下问题:PHP rex_url类的具体用法?PHP rex_url怎么用?PHP rex_url使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rex_url类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:alsahh,项目名称:redaxo,代码行数:40,代码来源:function_rex_url.php
示例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;
}
开发者ID:skerbis,项目名称:redaxo,代码行数:46,代码来源:function_rex_url.php
示例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;
}
开发者ID:nilsology,项目名称:slice_ui,代码行数:12,代码来源:slice_footer.php
示例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;
}
开发者ID:DECAF,项目名称:redaxo,代码行数:50,代码来源:error_handler.php
示例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));
}
开发者ID:staabm,项目名称:redaxo,代码行数:41,代码来源:api_package_upload.php
示例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);
}
开发者ID:eaCe,项目名称:redaxo,代码行数:39,代码来源:api_package_download.php
示例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;
开发者ID:alsahh,项目名称:redaxo,代码行数:31,代码来源:import.server.php
示例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)) {
开发者ID:VIEWSION,项目名称:redaxo,代码行数:31,代码来源:cronjobs.php
示例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);
开发者ID:staabm,项目名称:redaxo,代码行数:31,代码来源:log.php
示例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';
}
}
开发者ID:staabm,项目名称:redaxo,代码行数:26,代码来源:function_metainfo.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);
开发者ID:staabm,项目名称:redaxo,代码行数:31,代码来源:function_rex_category.php
示例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;
开发者ID:staabm,项目名称:redaxo,代码行数:31,代码来源:system.settings.php
示例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">
<!--
开发者ID:DECAF,项目名称:redaxo,代码行数:31,代码来源:index.php
示例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) . '
开发者ID:VIEWSION,项目名称:redaxo_yrewrite,代码行数:31,代码来源:setup.php
示例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');
}
开发者ID:DECAF,项目名称:redaxo,代码行数:37,代码来源:view.php
示例16: show_form_info
public static function show_form_info($media)
{
$file_id = rex_request('file_id', 'int');
echo '
<style>
.helper-tool, .helper-tool * {
box-sizing:border-box;
}
.helper-tool {
padding:12px;
border:1px solid #fcfcfc;
}
.helper-tool input {
position:relative;
width:100%;
}
/* !HELPER TOOL TARGETING SYSTEM */
.focuspoint img {
transition: all 500ms ease-in-out;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
}
/* !HELPER TOOL TARGETING SYSTEM */
.helper-tool-target {
position: relative;
display: inline-block;
overflow: hidden;
margin-bottom:1em;
}
.helper-tool-target img {
position: relative;
display: block;
max-width: 100%;
height:auto;
}
.helper-tool-target img.target-overlay, .helper-tool-target img.reticle {
position: absolute;
top: 0;
left: 0;
}
.helper-tool-target img.target-overlay {
top: 0 !important;
left: 0 !important;
cursor:pointer;
opacity: 0.0;
}
.helper-tool-target img.reticle {
width: 102px;
height: 102px;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
transition: all 500ms ease-in-out;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
}
</style>
';
$vars = rex_sql::factory()->getArray('select * from rex_media where id=' . $file_id);
$saved_css_data = explode(",", $vars[0]['med_focuspoint_css'], 2);
$css_x = '';
$css_y = '';
if (count($saved_css_data) == 2) {
$css_x = $saved_css_data[0];
$css_y = $saved_css_data[1];
}
echo '
<style>
.helper-tool-target img.target-overlay, .helper-tool-target img.reticle {
top: ' . $css_y . ';
left: ' . $css_x . ';
}
</style>
';
$filename = $vars[0]['filename'];
$dateiart = substr($filename, -3);
if ($dateiart == 'jpg' or $dateiart == 'png' or $dateiart == 'gif') {
$html = '<div class="rex-mediapool-detail-image col-sm-4"><div id="fwidth" class="helper-tool-target"><img class="helper-tool-img" src="index.php?rex_media_type=rex_mediapool_maximized&rex_media_file=' . rex_url::media($filename) . '" ><img class="reticle" src="./../assets/addons/focuspoint/focuspoint-target.png"><img class="target-overlay" src="index.php?rex_media_type=rex_mediapool_maximized&rex_media_file=' . rex_url::media($filename) . '" ></div></div>';
echo "\n <script>\n \$(document).on('ready pjax:success',function(){\n \$('.panel-body .col-sm-4').replaceWith('{$html}');\n\n \$('img').click(function(e){\n\n var imageW = \$(this).width();\n var imageH = \$(this).height();\n\n //Calculate FocusPoint coordinates\n var offsetX = e.pageX - \$(this).offset().left;\n var offsetY = e.pageY - \$(this).offset().top;\n var focusX = (offsetX/imageW - .5)*2;\n var focusY = (offsetY/imageH - .5)*-2;\n\n //Calculate CSS Percentages\n var percentageX = (offsetX/imageW)*100;\n var percentageY = (offsetY/imageH)*100;\n var backgroundPositionCSS = percentageX.toFixed(0) + '%, ' + percentageY.toFixed(0) + '%';\n\n \$('#Focuspoint_Data' ).val(focusX.toFixed(2) + ',' + focusY.toFixed(2));\n \$('#Focuspoint_CSS' ).val(backgroundPositionCSS);\n\n \$('.reticle').css({\n 'top':percentageY+'%',\n 'left':percentageX+'%'\n });\n\n\n // window.alert('FocusX:' + focusX.toFixed(2) + ', FocusY:' + focusY.toFixed(2) + ' (For CSS version: ' + backgroundPositionCSS + ')');\n\n });\n\n });\n\n </script>\n ";
}
}
开发者ID:olien,项目名称:rex5_focuspoint,代码行数:88,代码来源:class.rex_focuspoint.inc.php
示例17: getAssetsUrl
/**
* {@inheritdoc}
*/
public function getAssetsUrl($file = '')
{
return rex_url::addonAssets($this->getName(), $file);
}
开发者ID:staabm,项目名称:redaxo,代码行数:7,代码来源:addon.php
示例18:
break;
case 'nachteaser':
$bildpos = 'unter dem Teasertext';
break;
}
$outback .= '
<div class="form-group">
<label class="col-sm-3 control-label">Position</label>
<div class="col-sm-9">' . $bildpos . '</div>
</div>' . PHP_EOL;
$outback .= '
<div class="form-group">
<label class="col-sm-3 control-label">Bild</label>
<div class="col-sm-9">
' . $filename . '<br/>
<img src="' . rex_url::frontendController() . '?rex_media_type=rex_mediabutton_preview&rex_media_file=' . $filename . '" />
</div>
</div>' . PHP_EOL;
if ($value['alt']) {
$outback .= '
<div class="form-group">
<label class="col-sm-3 control-label">Alternativtext</label>
<div class="col-sm-9">' . $value['alt'] . '</div>
</div>' . PHP_EOL;
} else {
$outback .= '
<div class="form-group ">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9 warning">
ACHTUNG:<br/>Es wurde kein Alt-Text für das Bild angegeben.
</div>
开发者ID:darwin26,项目名称:REX5-Modulsammlung,代码行数:31,代码来源:rex5_modul_ausgabe.php
示例19: toImage
/**
* @param array $params
*
* @return string
*/
public function toImage(array $params = [])
{
if (!$this->isImage()) {
return '';
}
$filename = rex_url::media($this->getFileName());
$title = $this->getTitle();
if (!isset($params['alt'])) {
if ($title != '') {
$params['alt'] = htmlspecialchars($title);
}
}
if (!isset($params['title'])) {
if ($title != '') {
$params['title'] = htmlspecialchars($title);
}
}
rex_extension::registerPoint(new rex_extension_point('MEDIA_TOIMAGE', '', ['filename' => &$filename, 'params' => &$params]));
$additional = '';
foreach ($params as $name => $value) {
$additional .= ' ' . $name . '="' . $value . '"';
}
return sprintf('<img src="%s"%s />', $filename, $additional);
}
开发者ID:DECAF,项目名称:redaxo,代码行数:29,代码来源:media.php
示例20: rex_mediapool_Mediaform
/**
* Ausgabe des Medienpool Formulars.
*/
function rex_mediapool_Mediaform($form_title, $button_title, $rex_file_category, $file_chooser, $close_form)
{
global $ftitle, $warning, $info;
$s = '';
$cats_sel = new rex_media_category_select();
$cats_sel->setStyle('class="form-control"');
$cats_sel->setSize(1);
$cats_sel->setName('rex_file_category');
$cats_sel->setId('rex-mediapool-category');
$cats_sel->addOption(rex_i18n::msg('pool_kats_no'), '0');
$cats_sel->setAttribute('onchange', 'this.form.submit()');
$cats_sel->setSelected($rex_file_category);
if (isset($warning)) {
if (is_array($warning)) {
if (count($warning) > 0) {
$s .= rex_view::error(implode('<br />', $warning));
}
} elseif ($warning != '') {
$s .= rex_view::error($warning);
}
$warning = '';
}
if (isset($info)) {
if (is_array($info)) {
if (count($info) > 0) {
$s .= rex_view::success(implode('<br />', $info));
}
} elseif ($info != '') {
$s .= rex_view::success($info);
}
$info = '';
}
if (!isset($ftitle)) {
$ftitle = '';
}
$arg_fields = '';
foreach (rex_request('args', 'array') as $arg_name => $arg_value) {
$arg_fields .= '<input type="hidden" name="args[' . $arg_name . ']" value="' . $arg_value . '" />' . "\n";
}
$opener_input_field = rex_request('opener_input_field', 'string');
if ($opener_input_field != '') {
$arg_fields .= '<input type="hidden" name="opener_input_field" value="' . htmlspecialchars($opener_input_field) . '" />' . "\n";
}
$add_submit = '';
if ($close_form && $opener_input_field != '') {
$add_submit = '<button class="btn btn-save" type="submit" name="saveandexit" value="' . rex_i18n::msg('pool_file_upload_get') . '"' . rex::getAccesskey(rex_i18n::msg('pool_file_upload_get'), 'save') . '>' . rex_i18n::msg('pool_file_upload_get') . '</button>';
}
$panel = '';
$formElements = [];
$e = [];
$e['label'] = '<label for="rex-mediapool-title">' . rex_i18n::msg('pool_file_title') . '</label>';
$e['field'] = '<input class="form-control" type="text" id="rex-mediapool-title" name="ftitle" value="' . htmlspecialchars($ftitle) . '" />';
$formElements[] = $e;
$e = [];
$e['label'] = '<label for="rex-mediapool-category">' . rex_i18n::msg('pool_file_category') . '</label>';
$e['field'] = $cats_sel->get();
$formElements[] = $e;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$panel .= $fragment->parse('core/form/form.php');
$panel .= rex_extension::registerPoint(new rex_extension_point('MEDIA_FORM_ADD', ''));
if ($file_chooser) {
$e = [];
$e['label'] = '<label for="rex-mediapool-choose-file">' . rex_i18n::msg('pool_file_file') . '</label>';
$e['field'] = '<input id="rex-mediapool-choose-file" type="file" name="file_new" />';
$e['note'] = '<h3>' . rex_i18n::msg('phpini_settings') . '</h3>
<dl class="dl-horizontal">
' . (rex_ini_get('file_uploads') == 0 ? '<dt><span class="text-warning">' . rex_i18n::msg('pool_upload') . '</span></dt><dd><span class="text-warning">' . rex_i18n::msg('pool_upload_disabled') . '</span></dd>' : '') . '
<dt>' . rex_i18n::msg('pool_max_uploadsize') . ':</dt><dd>' . rex_formatter::bytes(rex_ini_get('upload_max_filesize')) . '</dd>
<dt>' . rex_i18n::msg('pool_max_uploadtime') . ':</dt><dd>' . rex_ini_get('max_input_time') . 's</dd>
</dl>';
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$panel .= $fragment->parse('core/form/form.php');
}
$formElements = [];
$e = [];
$e['field'] = '<button class="btn btn-save" type="submit" name="save" value="' . $button_title . '"' . rex::getAccesskey($button_title, 'save') . '>' . $button_title . '</button>';
$formElements[] = $e;
$e = [];
$e['field'] = $add_submit;
$formElements[] = $e;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$buttons = $fragment->parse('core/form/submit.php');
$fragment = new rex_fragment();
$fragment->setVar('title', $form_title, false);
$fragment->setVar('body', $panel, false);
$fragment->setVar('buttons', $buttons, false);
$content = $fragment->parse('core/page/section.php');
$s .= ' <form action="' . rex_url::currentBackendPage() . '" method="post" enctype="multipart/form-data">
<fieldset>
<input type="hidden" name="media_method" value="add_file" />
' . $arg_fields . '
' . $content . '
</fieldset>
';
//.........这里部分代码省略.........
开发者ID:skerbis,项目名称:redaxo,代码行数:101,代码来源:function_rex_mediapool.php
注:本文中的rex_url类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论