Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Integrated themes.php with PMA_Response class

  • Loading branch information...
commit 234480cdae019acd2cc980a5126775601cb298ab 1 parent 07c7b29
@roccivic roccivic authored
View
46 libraries/Theme.class.php
@@ -429,35 +429,39 @@ public function loadCss()
}
/**
- * prints out the preview for this theme
+ * Renders the preview for this theme
*
- * @return void
+ * @return string
* @access public
*/
- public function printPreview()
+ public function getPrintPreview()
{
- echo '<div class="theme_preview">';
- echo '<h2>' . htmlspecialchars($this->getName())
- .' (' . htmlspecialchars($this->getVersion()) . ')</h2>';
- echo '<p>';
- echo '<a target="_top" class="take_theme" '
- .'name="' . htmlspecialchars($this->getId()) . '" '
- . 'href="index.php'. PMA_generate_common_url(
- array('set_theme' => $this->getId())
- ) . '">';
+ $url_params = array('set_theme' => $this->getId());
+ $url = 'index.php'. PMA_generate_common_url($url_params);
+
+ $retval = '<div class="theme_preview">';
+ $retval .= '<h2>';
+ $retval .= htmlspecialchars($this->getName());
+ $retval .= ' (' . htmlspecialchars($this->getVersion()) . ') ';
+ $retval .= '</h2>';
+ $retval .= '<p>';
+ $retval .= '<a target="_top" class="take_theme" ';
+ $retval .= 'name="' . htmlspecialchars($this->getId()) . '" ';
+ $retval .= 'href="' . $url . '">';
if (@file_exists($this->getPath() . '/screen.png')) {
// if screen exists then output
-
- echo '<img src="' . $this->getPath() . '/screen.png" border="1"'
- .' alt="' . htmlspecialchars($this->getName()) . '"'
- .' title="' . htmlspecialchars($this->getName()) . '" /><br />';
+ $retval .= '<img src="' . $this->getPath() . '/screen.png" border="1"';
+ $retval .= ' alt="' . htmlspecialchars($this->getName()) . '"';
+ $retval .= ' title="' . htmlspecialchars($this->getName()) . '" />';
+ $retval .= '<br />';
} else {
- echo __('No preview available.');
+ $retval .= __('No preview available.');
}
-
- echo '[ <strong>' . __('take it') . '</strong> ]</a>'
- .'</p>'
- .'</div>';
+ $retval .= '[ <strong>' . __('take it') . '</strong> ]';
+ $retval .= '</a>';
+ $retval .= '</p>';
+ $retval .= '</div>';
+ return $retval;
}
/**
View
10 libraries/Theme_Manager.class.php
@@ -400,16 +400,18 @@ public function makeBc()
}
/**
- * prints out preview for every theme
+ * Renders the previews for all themes
*
- * @return void
+ * @return string
* @access public
*/
- public function printPreviews()
+ public function getPrintPreviews()
{
+ $retval = '';
foreach ($this->themes as $each_theme) {
- $each_theme->printPreview();
+ $retval .= $each_theme->getPrintPreview();
} // end 'open themes'
+ return $retval;
}
/**
View
23 themes.php
@@ -10,17 +10,22 @@
*/
require './libraries/common.inc.php';
$response = PMA_Response::getInstance();
-$header = $response->getHeader();
+$response->getFooter()->setMinimal();
+$header = $response->getHeader();
$header->setBodyId('bodythemes');
$header->setTitle('phpMyAdmin - ' . __('Theme'));
$header->disableMenu();
-$header->display();
+
+$hash = '#pma_' . preg_replace('/([0-9]*)\.([0-9]*)\..*/', '\1_\2', PMA_VERSION);
+$url = PMA_linkURL('http://www.phpmyadmin.net/home_page/themes.php') . $hash;
+$output = '<h1>phpMyAdmin - ' . __('Theme') . '</h1>';
+$output .= '<p>';
+$output .= '<a href="' . $url . '" class="_blank">';
+$output .= __('Get more themes!');
+$output .= '</a>';
+$output .= '</p>';
+$output .= $_SESSION['PMA_Theme_Manager']->getPrintPreviews();
+
+$response->addHTML($output);
?>
-<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
-$_SESSION['PMA_Theme_Manager']->printPreviews();
-?>
-</body>
-</html>
Please sign in to comment.
Something went wrong with that request. Please try again.