Skip to content

Commit

Permalink
Add preview mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr-w committed Aug 18, 2024
1 parent 45e475f commit 37362c2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lang/de_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ maintenance_allowed_yrewrite_domains_label = Liste erlaubter YRewrite-Domains
maintenance_allowed_yrewrite_domains_notice = YRewrite-Domains eintragen, die nicht gesperrt werden sollen.

maintenance_copy_url_title = URL kopieren

maintenance_preview_title = Vorschau
4 changes: 4 additions & 0 deletions package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ page:
backend:
title: translate:maintenance_backend_title
icon: rex-icon fa-user-gear
preview:
title: translate:maintenance_preview_title
icon: rex-icon fa-eye
hidden: true
help:
title: translate:maintenance_docs_title
subPath: README.md
Expand Down
10 changes: 10 additions & 0 deletions pages/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,16 @@


<?php
/* Vorschau des Wartungsmodus */
$preview = '<a target="_blank" href="' . rex_url::backendPage('maintenance/preview') . '" class="btn btn-primary">' . rex_i18n::msg('maintenance_preview') . '</a>';

Check warning on line 140 in pages/frontend.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'rex_url'

Check warning on line 140 in pages/frontend.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'rex_i18n'

$fragment = new rex_fragment();
$fragment->setVar('class', 'info', false);
$fragment->setVar('title', rex_i18n::msg('maintenance_preview_title'), false);

Check warning on line 144 in pages/frontend.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'rex_i18n'
$fragment->setVar('body', $preview, false);
echo $fragment->parse('core/page/section.php');

/* Kopieren der URL für den Wartungsmodus */
$copy = '<ul class="list-group">';
$url = '' . rex::getServer() . '?maintenance_secret=' . rex_config::get('maintenance', 'maintenance_secret');
$copy .= '<li class="list-group-item"><label for="maintenance-mode-url">REDAXO config.yml</label>
Expand Down Expand Up @@ -172,6 +181,7 @@
$fragment->setVar('title', rex_i18n::msg('maintenance_copy_url_title'), false);
$fragment->setVar('body', $copy, false);
echo $fragment->parse('core/page/section.php');

?>
</div>
</div>
7 changes: 7 additions & 0 deletions pages/preview.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

ob_clean();

$fragment = new rex_fragment();

Check warning on line 5 in pages/preview.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'rex_fragment'
echo $fragment->parse('maintenance/frontend.php');
exit;

0 comments on commit 37362c2

Please sign in to comment.