Skip to content

Commit

Permalink
Extract HTML from themes.php
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Apr 6, 2019
1 parent 57c8f11 commit 345bd29
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
7 changes: 7 additions & 0 deletions templates/themes.twig
@@ -0,0 +1,7 @@
<h1>phpMyAdmin - {% trans 'Theme' %}</h1>
<p>
<a href="{{ 'https://www.phpmyadmin.net/themes/'|link }}#pma_{{ version }}" rel="noopener noreferrer" target="_blank">
{% trans 'Get more themes!' %}
</a>
</p>
{{ previews|raw }}
26 changes: 11 additions & 15 deletions themes.php
Expand Up @@ -7,34 +7,30 @@
*/
declare(strict_types=1);

use PhpMyAdmin\Core;
use PhpMyAdmin\Template;
use PhpMyAdmin\ThemeManager;
use PhpMyAdmin\Response;

if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}

/**
* get some globals
*/
include ROOT_PATH . 'libraries/common.inc.php';

$template = new Template();

$response = Response::getInstance();
$response->getFooter()->setMinimal();
$header = $response->getHeader();
$header->setBodyId('bodythemes');
$header->setTitle('phpMyAdmin - ' . __('Theme'));
$header->disableMenuAndConsole();

$hash = '#pma_' . preg_replace('/([0-9]*)\.([0-9]*)\..*/', '\1_\2', PMA_VERSION);
$url = Core::linkURL('https://www.phpmyadmin.net/themes/') . $hash;
$output = '<h1>phpMyAdmin - ' . __('Theme') . '</h1>';
$output .= '<p>';
$output .= '<a href="' . $url . '" rel="noopener noreferrer" target="_blank">';
$output .= __('Get more themes!');
$output .= '</a>';
$output .= '</p>';
$output .= ThemeManager::getInstance()->getPrintPreviews();

$response->addHTML($output);
$response->addHTML($template->render('themes', [
'version' => preg_replace(
'/([0-9]*)\.([0-9]*)\..*/',
'\1_\2',
PMA_VERSION
),
'previews' => ThemeManager::getInstance()->getPrintPreviews(),
]));

0 comments on commit 345bd29

Please sign in to comment.