New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove font size feature #13925
Remove font size feature #13925
Changes from 22 commits
48a0ac1
2548e93
6e0e145
5e365d8
3bc4b68
8ab9d67
daf3019
4a5ae16
c92c013
419c8ea
311fbf5
eaecce2
607ed03
a1f24c3
3d0c48c
0fbc05f
517771e
d5487c2
3405e3a
b564539
67381f7
d420834
44e783c
2da7bdd
10635d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1186,18 +1186,12 @@ public function getSource() | |
* returns a unique value to force a CSS reload if either the config | ||
* or the theme changes | ||
* | ||
* @return int Summary of unix timestamps and fontsize, | ||
* @return int Summary of unix timestamps, | ||
* to be unique on theme parameters change | ||
*/ | ||
public function getThemeUniqueValue() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should update the doc for this method to reflect the changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't find anything related to this in the doc, please help. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm referring to the comment block just above the method. |
||
{ | ||
if (null !== $this->get('FontSize')) { | ||
$fontsize = intval($this->get('FontSize')); | ||
} else { | ||
$fontsize = 0; | ||
} | ||
return ( | ||
$fontsize + | ||
$this->source_mtime + | ||
$this->default_source_mtime + | ||
$this->get('user_preferences_mtime') + | ||
|
@@ -1370,112 +1364,6 @@ public function enableBc() | |
} | ||
} | ||
|
||
/** | ||
* returns options for font size selection | ||
* | ||
* @param string $current_size current selected font size with unit | ||
* | ||
* @return array selectable font sizes | ||
*/ | ||
protected static function getFontsizeOptions($current_size = '82%') | ||
{ | ||
$unit = preg_replace('/[0-9.]*/', '', $current_size); | ||
$value = preg_replace('/[^0-9.]*/', '', $current_size); | ||
|
||
$factors = array(); | ||
$options = array(); | ||
$options["$value"] = $value . $unit; | ||
|
||
if ($unit === '%') { | ||
$factors[] = 1; | ||
$factors[] = 5; | ||
$factors[] = 10; | ||
$options['100'] = '100%'; | ||
} elseif ($unit === 'em') { | ||
$factors[] = 0.05; | ||
$factors[] = 0.2; | ||
$factors[] = 1; | ||
} elseif ($unit === 'pt') { | ||
$factors[] = 0.5; | ||
$factors[] = 2; | ||
} elseif ($unit === 'px') { | ||
$factors[] = 1; | ||
$factors[] = 5; | ||
$factors[] = 10; | ||
} else { | ||
//unknown font size unit | ||
$factors[] = 0.05; | ||
$factors[] = 0.2; | ||
$factors[] = 1; | ||
$factors[] = 5; | ||
$factors[] = 10; | ||
} | ||
|
||
foreach ($factors as $key => $factor) { | ||
$option_inc = $value + $factor; | ||
$option_dec = $value - $factor; | ||
while (count($options) < 21) { | ||
$options["$option_inc"] = $option_inc . $unit; | ||
if ($option_dec > $factors[0]) { | ||
$options["$option_dec"] = $option_dec . $unit; | ||
} | ||
$option_inc += $factor; | ||
$option_dec -= $factor; | ||
if (isset($factors[$key + 1]) | ||
&& $option_inc >= $value + $factors[$key + 1] | ||
) { | ||
break; | ||
} | ||
} | ||
} | ||
ksort($options); | ||
return $options; | ||
} | ||
|
||
/** | ||
* returns html selectbox for font sizes | ||
* | ||
* @return string html selectbox | ||
*/ | ||
protected static function getFontsizeSelection() | ||
{ | ||
$current_size = $GLOBALS['PMA_Config']->get('FontSize'); | ||
// for the case when there is no config file (this is supported) | ||
if (empty($current_size)) { | ||
$current_size = '82%'; | ||
} | ||
$options = Config::getFontsizeOptions($current_size); | ||
|
||
$return = '<label for="select_fontsize">' . __('Font size') | ||
. ':</label>' . "\n" | ||
. '<select name="set_fontsize" id="select_fontsize"' | ||
. ' class="autosubmit">' . "\n"; | ||
foreach ($options as $option) { | ||
$return .= '<option value="' . $option . '"'; | ||
if ($option == $current_size) { | ||
$return .= ' selected="selected"'; | ||
} | ||
$return .= '>' . $option . '</option>' . "\n"; | ||
} | ||
$return .= '</select>'; | ||
|
||
return $return; | ||
} | ||
|
||
/** | ||
* return complete font size selection form | ||
* | ||
* @return string html selectbox | ||
*/ | ||
public static function getFontsizeForm() | ||
{ | ||
return '<form name="form_fontsize_selection" id="form_fontsize_selection"' | ||
. ' method="post" action="index.php" class="disableAjax">' . "\n" | ||
. Url::getHiddenInputs() . "\n" | ||
. Config::getFontsizeSelection() . "\n" | ||
. '</form>'; | ||
} | ||
|
||
/** | ||
* removes cookie | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,71 +80,6 @@ public function testCheckSystem() | |
$this->assertNotEmpty($this->object->get('PMA_MAJOR_VERSION')); | ||
} | ||
|
||
/** | ||
* Test for GetFontsizeForm | ||
* | ||
* @return void | ||
*/ | ||
public function testGetFontsizeForm() | ||
{ | ||
$this->assertContains( | ||
'<form name="form_fontsize_selection" id="form_fontsize_selection"', | ||
Config::getFontsizeForm() | ||
); | ||
|
||
$this->assertContains( | ||
'<label for="select_fontsize">', | ||
Config::getFontsizeForm() | ||
); | ||
|
||
//test getFontsizeOptions for "em" unit | ||
$fontsize = $GLOBALS['PMA_Config']->get('FontSize'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are more places where the FontSize setting is used with the Config class. |
||
$GLOBALS['PMA_Config']->set('FontSize', '10em'); | ||
$this->assertContains( | ||
'<option value="7em"', | ||
Config::getFontsizeForm() | ||
); | ||
$this->assertContains( | ||
'<option value="8em"', | ||
Config::getFontsizeForm() | ||
); | ||
|
||
//test getFontsizeOptions for "pt" unit | ||
$GLOBALS['PMA_Config']->set('FontSize', '10pt'); | ||
$this->assertContains( | ||
'<option value="2pt"', | ||
Config::getFontsizeForm() | ||
); | ||
$this->assertContains( | ||
'<option value="4pt"', | ||
Config::getFontsizeForm() | ||
); | ||
|
||
//test getFontsizeOptions for "px" unit | ||
$GLOBALS['PMA_Config']->set('FontSize', '10px'); | ||
$this->assertContains( | ||
'<option value="5px"', | ||
Config::getFontsizeForm() | ||
); | ||
$this->assertContains( | ||
'<option value="6px"', | ||
Config::getFontsizeForm() | ||
); | ||
|
||
//test getFontsizeOptions for unknown unit | ||
$GLOBALS['PMA_Config']->set('FontSize', '10abc'); | ||
$this->assertContains( | ||
'<option value="7abc"', | ||
Config::getFontsizeForm() | ||
); | ||
$this->assertContains( | ||
'<option value="8abc"', | ||
Config::getFontsizeForm() | ||
); | ||
//rollback the fontsize setting | ||
$GLOBALS['PMA_Config']->set('FontSize', $fontsize); | ||
} | ||
|
||
/** | ||
* Test for checkOutputCompression | ||
* | ||
|
@@ -822,15 +757,7 @@ public function testGetThemeUniqueValue() | |
$GLOBALS['PMA_Theme']->filesize_info | ||
); | ||
|
||
$this->object->set('FontSize', 10); | ||
$this->assertEquals(10 + $partial_sum, $this->object->getThemeUniqueValue()); | ||
|
||
$this->object->set('FontSize', 20); | ||
$this->assertEquals(20 + $partial_sum, $this->object->getThemeUniqueValue()); | ||
$this->object->set('FontSize', null); | ||
|
||
$this->assertEquals($partial_sum, $this->object->getThemeUniqueValue()); | ||
$this->object->set('FontSize', '82%'); | ||
|
||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
|
||
/* general tags */ | ||
html { | ||
font-size: <?php echo $theme->getFontSize(); ?> | ||
font-size: 82%; | ||
} | ||
|
||
input, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
/******************************************************************************/ | ||
/* general tags */ | ||
html { | ||
font-size: <?php echo $theme->getFontSize(); ?> | ||
font-size: 82%; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to keep the font-size property here. |
||
|
||
input, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be simply removed. See this example: 8cc6de4#diff-5a2f160c43a637ce34c72d79c769e4cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, got it! I'll fix it.