Skip to content

Commit

Permalink
Remove font size feature
Browse files Browse the repository at this point in the history
phpmyadmin#13919
Signed-off-by: Saksham Gupta <shucon01@gmail.com>
  • Loading branch information
shucon committed Jan 11, 2018
1 parent 367f49b commit 48a0ac1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 123 deletions.
14 changes: 0 additions & 14 deletions index.php
Expand Up @@ -66,17 +66,6 @@
exit;
}

// user selected font size
if (isset($_POST['set_fontsize']) && preg_match('/^[0-9.]+(px|em|pt|\%)$/', $_POST['set_fontsize'])) {
$GLOBALS['PMA_Config']->setUserValue(
null,
'FontSize',
$_POST['set_fontsize'],
'82%'
);
header('Location: index.php' . Url::getCommonRaw());
exit();
}
// if user selected a theme
if (isset($_POST['set_theme'])) {
$tmanager = ThemeManager::getInstance();
Expand Down Expand Up @@ -294,9 +283,6 @@
, ThemeManager::getInstance()->getHtmlSelectBox();
echo '</li>';
}
echo '<li id="li_select_fontsize">';
echo Config::getFontsizeForm();
echo '</li>';

echo '</ul>';

Expand Down
44 changes: 0 additions & 44 deletions libraries/classes/Config.php
Expand Up @@ -1429,50 +1429,6 @@ protected static function getFontsizeOptions($current_size = '82%')
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
*
Expand Down
65 changes: 0 additions & 65 deletions test/classes/ConfigTest.php
Expand Up @@ -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');
$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
*
Expand Down

0 comments on commit 48a0ac1

Please sign in to comment.