Skip to content

Commit

Permalink
Remove phpmyadmin.css.php
Browse files Browse the repository at this point in the history
Loads theme.css directly

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
  • Loading branch information
MauricioFauth committed Sep 29, 2018
1 parent 6bb5bc2 commit ca61385
Show file tree
Hide file tree
Showing 15 changed files with 556 additions and 700 deletions.
25 changes: 0 additions & 25 deletions libraries/classes/Theme.php
Expand Up @@ -357,31 +357,6 @@ public function getImgPath($file = null, $fallback = null)
return './themes/' . ThemeManager::FALLBACK_THEME . '/img/' . $file;
}

/**
* load css (send to stdout, normally the browser)
*
* @return bool
* @access public
*/
public function loadCss()
{
$success = true;

$file = $GLOBALS['text_dir'] === 'rtl' ? '/css/theme-rtl.css' : '/css/theme.css';
$path = $this->getPath() . $file;
$fallback = './themes/' . ThemeManager::FALLBACK_THEME . $file;

if (is_readable($path)) {
include $path;
} elseif (is_readable($fallback)) {
include $fallback;
} else {
$success = false;
}

return $success;
}

/**
* Renders the preview for this theme
*
Expand Down
36 changes: 0 additions & 36 deletions libraries/classes/ThemeManager.php
Expand Up @@ -382,42 +382,6 @@ public function getPrintPreviews()
return $retval;
}

/**
* returns Theme object for fall back theme
*
* @return Theme fall back theme
* @access public
*/
public function getFallBackTheme()
{
if (isset($this->themes[self::FALLBACK_THEME])) {
return $this->themes[self::FALLBACK_THEME];
}

return false;
}

/**
* prints css data
*
* @return bool
* @access public
*/
public function printCss()
{
if ($this->theme->loadCss()) {
return true;
}

// if loading css for this theme failed, try default theme css
$fallback_theme = $this->getFallBackTheme();
if ($fallback_theme && $fallback_theme->loadCss()) {
return true;
}

return false;
}

/**
* Theme initialization
*
Expand Down
36 changes: 0 additions & 36 deletions phpmyadmin.css.php

This file was deleted.

4 changes: 2 additions & 2 deletions templates/header/header.twig
Expand Up @@ -19,8 +19,8 @@
<link rel="stylesheet" type="text/css" href="{{ base_dir }}js/vendor/codemirror/lib/codemirror.css?{{ version }}">
<link rel="stylesheet" type="text/css" href="{{ base_dir }}js/vendor/codemirror/addon/hint/show-hint.css?{{ version }}">
<link rel="stylesheet" type="text/css" href="{{ base_dir }}js/vendor/codemirror/addon/lint/lint.css?{{ version }}">
<link rel="stylesheet" type="text/css" href="{{ base_dir }}phpmyadmin.css.php?nocache={{ unique_value }}{{ text_dir }}
{{- server is not empty ? '&server=' ~ server }}">
<link rel="stylesheet" type="text/css" href="{{ theme_path }}/css/theme{{ text_dir == 'rtl' ? '-rtl' }}.css?{{ version }}&nocache=
{{- unique_value }}{{ text_dir }}{% if server is not empty %}&server={{ server }}{% endif %}">
<link rel="stylesheet" type="text/css" href="{{ theme_path }}/css/printview.css?{{ version }}" media="print" id="printcss">
{% endif %}
{{ title|raw }}
Expand Down
14 changes: 0 additions & 14 deletions test/classes/ThemeManagerTest.php
Expand Up @@ -107,18 +107,4 @@ public function testGetPrintPreviews()
$this->assertContains('pmahomme', $preview);
$this->assertContains('set_theme=pmahomme', $preview);
}

/**
* Test for getFallBackTheme
*
* @return void
*/
public function testGetFallBackTheme()
{
$tm = new ThemeManager();
$this->assertInstanceOf(
'PhpMyAdmin\Theme',
$tm->getFallBackTheme()
);
}
}
33 changes: 0 additions & 33 deletions test/classes/ThemeTest.php
Expand Up @@ -130,39 +130,6 @@ public function testLoad()
$this->assertNotNull($newTheme);
}

/**
* Test for Theme::loadCss
*
* @param string $theme Path to theme files
*
* @return void
*
* @dataProvider listThemes
*/
public function testLoadCss($theme)
{
$newTheme = Theme::load($theme);
ob_start();
$ret = $newTheme->loadCss();
$out = ob_get_contents();
ob_end_clean();
$this->assertTrue($ret);
$this->assertContains('.ic_b_bookmark', $out);
}

/**
* Data provider for Theme::loadCss test
*
* @return array with theme paths
*/
public function listThemes()
{
return [
['./themes/original'],
['./themes/pmahomme/'],
];
}

/**
* Test for Theme::load
*
Expand Down
62 changes: 31 additions & 31 deletions themes/metro/scss/_common.scss
Expand Up @@ -39,55 +39,55 @@ table {
@font-face {
font-family: 'IcoMoon';
src: local('');
src: url('./themes/metro/fonts/IcoMoon.eot');
src: url('./themes/metro/fonts/IcoMoon.eot?#iefix') format('embedded-opentype'),
url('./themes/metro/fonts/IcoMoon.svg#IcoMoon') format('svg'),
url('./themes/metro/fonts/IcoMoon.woff') format('woff'),
url('./themes/metro/fonts/IcoMoon.ttf') format('truetype');
src: url('../fonts/IcoMoon.eot');
src: url('../fonts/IcoMoon.eot?#iefix') format('embedded-opentype'),
url('../fonts/IcoMoon.svg#IcoMoon') format('svg'),
url('../fonts/IcoMoon.woff') format('woff'),
url('../fonts/IcoMoon.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'Open Sans';
src: local(''), local('Open Sans'), local('OpenSans');
src: url('./themes/metro/fonts/opensans-regular-webfont.eot');
src: url('./themes/metro/fonts/opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('./themes/metro/fonts/opensans-regular-webfont.woff') format('woff'),
url('./themes/metro/fonts/opensans-regular-webfont.ttf') format('truetype');
src: url('../fonts/opensans-regular-webfont.eot');
src: url('../fonts/opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/opensans-regular-webfont.woff') format('woff'),
url('../fonts/opensans-regular-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'Open Sans Light';
src: local(''), local('Open Sans Light'), local('OpenSans-Light');
src: url('./themes/metro/fonts/opensans-light-webfont.eot');
src: url('./themes/metro/fonts/opensans-light-webfont.eot?#iefix') format('embedded-opentype'),
url('./themes/metro/fonts/opensans-light-webfont.woff') format('woff'),
url('./themes/metro/fonts/opensans-light-webfont.ttf') format('truetype');
src: url('../fonts/opensans-light-webfont.eot');
src: url('../fonts/opensans-light-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/opensans-light-webfont.woff') format('woff'),
url('../fonts/opensans-light-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'Open Sans Bold';
src: local(''), local('Open Sans Bold'), local('OpenSans-Bold');
src: url('./themes/metro/fonts/opensans-bold-webfont.eot');
src: url('./themes/metro/fonts/opensans-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('./themes/metro/fonts/opensans-bold-webfont.woff') format('woff'),
url('./themes/metro/fonts/opensans-bold-webfont.ttf') format('truetype');
src: url('../fonts/opensans-bold-webfont.eot');
src: url('../fonts/opensans-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/opensans-bold-webfont.woff') format('woff'),
url('../fonts/opensans-bold-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'Open Sans Extrabold';
src: local(''), local('Open Sans Extrabold'), local('OpenSans-Extrabold');
src: url('./themes/metro/fonts/opensans-extrabold-webfont.eot');
src: url('./themes/metro/fonts/opensans-extrabold-webfont.eot?#iefix') format('embedded-opentype'),
url('./themes/metro/fonts/opensans-extrabold-webfont.woff') format('woff'),
url('./themes/metro/fonts/opensans-extrabold-webfont.ttf') format('truetype');
src: url('../fonts/opensans-extrabold-webfont.eot');
src: url('../fonts/opensans-extrabold-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/opensans-extrabold-webfont.woff') format('woff'),
url('../fonts/opensans-extrabold-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Expand Down Expand Up @@ -1145,7 +1145,7 @@ fieldset.caution li:before {
}

fieldset.caution li a:nth-child(2) img {
background: url('./themes/metro/img/s_info.png') !important;
background: url('../img/s_info.png') !important;
}

#tbl_maintenance li a {
Expand Down Expand Up @@ -2218,7 +2218,7 @@ input[type=date].invalid_value
display: inline;
left: 0;
right: 0;
background-image: url("themes/metro/img/ajax_clock_small.gif");
background-image: url("../img/ajax_clock_small.gif");
background-repeat: no-repeat;
background-position: 46%;
margin: 0;
Expand Down Expand Up @@ -2989,7 +2989,7 @@ form.append_fields_form .tblFooters {
}

.cPointer {
background: url("themes/metro/img/col_pointer.png");
background: url("../img/col_pointer.png");
height: 20px;
margin-#{$left}: -5px; /* must be minus half of its width */
margin-top: -10px;
Expand Down Expand Up @@ -3020,7 +3020,7 @@ form.append_fields_form .tblFooters {
}

.coldrop {
background: url("themes/metro/img/col_drop.png");
background: url("../img/col_drop.png");
cursor: pointer;
height: 16px;
margin-#{$left}: .3em;
Expand Down Expand Up @@ -3169,12 +3169,12 @@ form.append_fields_form .tblFooters {
}

.cEdit .edit_box_posting {
background: #FFF url("themes/metro/img/ajax_clock_small.gif") no-repeat right center;
background: #FFF url("../img/ajax_clock_small.gif") no-repeat right center;
padding-#{$right}: 1.5em;
}

.cEdit .edit_area_loading {
background: #FFF url("themes/metro/img/ajax_clock_small.gif") no-repeat center;
background: #FFF url("../img/ajax_clock_small.gif") no-repeat center;
height: 10em;
}

Expand All @@ -3185,7 +3185,7 @@ form.append_fields_form .tblFooters {
}

.saving_edited_data {
background: url("themes/metro/img/ajax_clock_small.gif") no-repeat left;
background: url("../img/ajax_clock_small.gif") no-repeat left;
padding-#{$left}: 20px;
}

Expand Down Expand Up @@ -3810,7 +3810,7 @@ html.ie7 #pma_console .query_input {

span.drag_icon {
display: inline-block;
background-image: url('"themes/metro/img/s_sortable.png"');
background-image: url("../img/s_sortable.png");
background-position: center center;
background-repeat: no-repeat;
width: 1em;
Expand Down Expand Up @@ -3855,11 +3855,11 @@ th.header .sorticon {
}

th.headerSortUp .sorticon, th.headerSortDown:hover .sorticon {
background-image: url("themes/metro/img/s_desc.png");
background-image: url("../img/s_desc.png");
}

th.headerSortDown .sorticon, th.headerSortUp:hover .sorticon {
background-image: url("themes/metro/img/s_asc.png");
background-image: url("../img/s_asc.png");
}

/* end of styles of sortable tables */
Expand Down
10 changes: 5 additions & 5 deletions themes/metro/scss/_designer.scss
Expand Up @@ -308,7 +308,7 @@ a.M_butt:hover {
}

#layer_menu_sizer {
background-image: url("themes/metro/img/designer/resize.png");
background-image: url("../img/designer/resize.png");
cursor: ew-resize;
}

Expand All @@ -335,25 +335,25 @@ a.trigger {
#{$right}: 0;
color: #fff;
padding: 10px 40px 10px 15px;
background: #333 url("themes/metro/img/designer/plus.png") 85% 55% no-repeat;
background: #333 url("../img/designer/plus.png") 85% 55% no-repeat;
border: 1px solid #444;
display: block;
z-index: 102;
}

a.trigger:hover {
color: #080808;
background: #fff696 url("themes/metro/img/designer/plus.png") 85% 55% no-repeat;
background: #fff696 url("../img/designer/plus.png") 85% 55% no-repeat;
border: 1px solid #999;
}

a.active.trigger {
background: #222 url("themes/metro/img/designer/minus.png") 85% 55% no-repeat;
background: #222 url("../img/designer/minus.png") 85% 55% no-repeat;
z-index: 999;
}

a.active.trigger:hover {
background: #fff696 url("themes/metro/img/designer/minus.png") 85% 55% no-repeat;
background: #fff696 url("../img/designer/minus.png") 85% 55% no-repeat;
}

.toggle_container .block {
Expand Down

0 comments on commit ca61385

Please sign in to comment.