Skip to content

Commit

Permalink
Move query parser CSS generating to theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed May 29, 2012
1 parent 962c523 commit e316c37
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 56 deletions.
57 changes: 56 additions & 1 deletion libraries/Theme.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,61 @@ public function getImgPath()
return $this->img_path;
}

/**
* Builds a CSS rule used for html formatted SQL queries
*
* @param string $classname The class name
* @param string $property The property name
* @param string $value The property value
*
* @return string The CSS rule
*
* @access public
*
* @see PMA_SQP_buildCssData()
*/
public function SQP_buildCssRule($classname, $property, $value)
{
$str = '.' . $classname . ' {';
if ($value != '') {
$str .= $property . ': ' . $value . ';';
}
$str .= '}' . "\n";

return $str;
} // end of the "PMA_SQP_buildCssRule()" function


/**
* Builds CSS rules used for html formatted SQL queries
*
* @return string The CSS rules set
*
* @access public
*
* @global array The current PMA configuration
*
* @see PMA_SQP_buildCssRule()
*/
public function SQP_buildCssData()
{
global $cfg;

$css_string = '';
foreach ($cfg['SQP']['fmtColor'] AS $key => $col) {
$css_string .= $this->SQP_buildCssRule('syntax_' . $key, 'color', $col);
}

for ($i = 0; $i < 8; $i++) {
$css_string .= $this->SQP_buildCssRule(
'syntax_indent' . $i, 'margin-left',
($i * $cfg['SQP']['fmtInd']) . $cfg['SQP']['fmtIndUnit']
);
}

return $css_string;
} // end of the "PMA_SQP_buildCssData()" function

/**
* load css (send to stdout, normally the browser)
*
Expand All @@ -320,7 +375,7 @@ public function loadCss()
{
$success = true;

echo PMA_SQP_buildCssData();
echo $this->SQP_buildCssData();

if ($GLOBALS['text_dir'] === 'ltr') {
$right = 'right';
Expand Down
55 changes: 0 additions & 55 deletions libraries/sqlparser.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2702,61 +2702,6 @@ function PMA_SQP_formatHtml(
} // end of the "PMA_SQP_formatHtml()" function
}

/**
* Builds a CSS rule used for html formatted SQL queries
*
* @param string $classname The class name
* @param string $property The property name
* @param string $value The property value
*
* @return string The CSS rule
*
* @access public
*
* @see PMA_SQP_buildCssData()
*/
function PMA_SQP_buildCssRule($classname, $property, $value)
{
$str = '.' . $classname . ' {';
if ($value != '') {
$str .= $property . ': ' . $value . ';';
}
$str .= '}' . "\n";

return $str;
} // end of the "PMA_SQP_buildCssRule()" function


/**
* Builds CSS rules used for html formatted SQL queries
*
* @return string The CSS rules set
*
* @access public
*
* @global array The current PMA configuration
*
* @see PMA_SQP_buildCssRule()
*/
function PMA_SQP_buildCssData()
{
global $cfg;

$css_string = '';
foreach ($cfg['SQP']['fmtColor'] AS $key => $col) {
$css_string .= PMA_SQP_buildCssRule('syntax_' . $key, 'color', $col);
}

for ($i = 0; $i < 8; $i++) {
$css_string .= PMA_SQP_buildCssRule(
'syntax_indent' . $i, 'margin-left',
($i * $cfg['SQP']['fmtInd']) . $cfg['SQP']['fmtIndUnit']
);
}

return $css_string;
} // end of the "PMA_SQP_buildCssData()" function

if (! defined('PMA_MINIMUM_COMMON')) {
/**
* Gets SQL queries with no format
Expand Down

0 comments on commit e316c37

Please sign in to comment.