Permalink
Browse files

Use PMA_Header class in themes.php

  • Loading branch information...
1 parent 372335a commit 54d47b89db2bcb2641f59f9ca1941698cb13b549 @roccivic roccivic committed May 23, 2012
Showing with 36 additions and 17 deletions.
  1. +31 −5 libraries/Header.class.php
  2. +5 −12 themes.php
View
36 libraries/Header.class.php
@@ -25,11 +25,17 @@ class PMA_Header {
private $_scripts;
private $_menu;
private $_userprefs_offer_import;
+ private $_title;
+ private $_bodyId;
+ private $_menuEnabled;
public $headerIsSent;
private function __construct()
{
+ $this->_bodyId = '';
+ $this->_title = 'phpMyAdmin';
$this->_menu = PMA_Menu::getInstance();
+ $this->_menuEnabled = true;
$this->_scripts = new PMA_Scripts();
$this->headerIsSent = false;
// if database storage for user preferences is transient,
@@ -56,6 +62,21 @@ public function getScripts()
return $this->_scripts;
}
+ public function setBodyId($id)
+ {
+ $this->_bodyId = htmlspecialchars($id);
+ }
+
+ public function setTitle($title)
+ {
+ $this->_title = htmlspecialchars($title);
+ }
+
+ public function disableMenu()
+ {
+ $this->_menuEnabled = false;
+ }
+
public function display()
{
echo $this->getDisplay();
@@ -97,7 +118,7 @@ public function getDisplay()
if (! defined('PMA_DISPLAY_HEADING')) {
define('PMA_DISPLAY_HEADING', 1);
}
- if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
+ if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0 && $this->_menuEnabled) {
$retval .= $this->_menu->getDisplay();
}
$retval .= $this->_addRecentTable(
@@ -177,18 +198,23 @@ private function _getLinkTags()
private function _getTitleTag()
{
$retval = "<title>";
- if (empty($GLOBALS['page_title'])) {
- $retval .= 'phpMyAdmin';
- } else {
+ if (! empty($GLOBALS['page_title'])) {
$retval .= htmlspecialchars($GLOBALS['page_title']);
+ } else {
+ $retval .= $this->_title;
}
$retval .= "</title>";
return $retval;
}
private function _getBodyStart()
{
- return "</head><body>";
+ $retval = "</head><body";
+ if (! empty($this->_bodyId)) {
+ $retval .= " id='" . $this->_bodyId . "'";
+ }
+ $retval .= ">";
+ return $retval;
}
private function _getWarnings()
View
17 themes.php
@@ -10,20 +10,13 @@
*/
require './libraries/common.inc.php';
-/* Theme Select */
-$path_to_themes = $cfg['ThemePath'] . '/';
+$header = PMA_Header::getInstance();
+$header->setBodyId('bodythemes');
+$header->setTitle('phpMyAdmin - ' . __('Theme'));
+$header->disableMenu();
+$header->display();
-/* set language and charset */
-require './libraries/header_http.inc.php';
-
-/* HTML header */
-$page_title = 'phpMyAdmin - ' . __('Theme');
-require './libraries/header_meta_style.inc.php';
-require './libraries/header_scripts.inc.php';
?>
-</head>
-
-<body id="bodythemes">
<h1>phpMyAdmin - <?php echo __('Theme'); ?></h1>
<p><a href="<?php echo PMA_linkURL('http://www.phpmyadmin.net/home_page/themes.php'); ?>#pma_<?php echo preg_replace('/([0-9]*)\.([0-9]*)\..*/', '\1_\2', PMA_VERSION); ?>" class="_blank"><?php echo __('Get more themes!'); ?></a></p>
<?php

0 comments on commit 54d47b8

Please sign in to comment.