Skip to content

Commit

Permalink
Update new code to use PMA_Util
Browse files Browse the repository at this point in the history
  • Loading branch information
roccivic committed Oct 30, 2012
1 parent 16a060e commit 5b0b9e4
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 138 deletions.
9 changes: 2 additions & 7 deletions libraries/Header.class.php
Expand Up @@ -101,10 +101,6 @@ class PMA_Header
* @var bool
*/
private $_headerIsSent;
/**
* @var object A reference to the common functions object
*/
private $_commonFunctions;

/**
* Creates a new class instance
Expand All @@ -113,7 +109,6 @@ class PMA_Header
*/
public function __construct()
{
$this->_commonFunctions = PMA_commonFunctions::getInstance();
$this->_isEnabled = true;
$this->_isAjax = false;
$this->_bodyId = '';
Expand Down Expand Up @@ -207,10 +202,10 @@ public function getJsParams()
'token' => $_SESSION[' PMA_token '],
'text_dir' => $GLOBALS['text_dir'],
'pma_absolute_uri' => $GLOBALS['cfg']['PmaAbsoluteUri'],
'pma_text_default_tab' => $this->_commonFunctions->getTitleForTarget(
'pma_text_default_tab' => PMA_Util::getTitleForTarget(
$GLOBALS['cfg']['DefaultTabTable']
),
'pma_text_left_default_tab' => $this->_commonFunctions->getTitleForTarget(
'pma_text_left_default_tab' => PMA_Util::getTitleForTarget(
$GLOBALS['cfg']['NavigationTreeDefaultTabTable']
)
);
Expand Down
11 changes: 4 additions & 7 deletions libraries/navigation/NavigationHeader.class.php
Expand Up @@ -17,16 +17,13 @@
*/
class PMA_NavigationHeader
{
private $_commonFunctions;
/**
* Renders the navigation
*
* @return void
*/
public function getDisplay()
{
$this->_commonFunctions = PMA_CommonFunctions::getInstance();

if (empty($GLOBALS['url_query'])) {
$GLOBALS['url_query'] = PMA_generate_common_url();
}
Expand Down Expand Up @@ -56,7 +53,7 @@ public function getDisplay()
$buffer .= $this->_links();
$buffer .= $this->_serverChoice();
$buffer .= $this->_recent();
$buffer .= $this->_commonFunctions->getImage(
$buffer .= PMA_Util::getImage(
'ajax_clock_small.gif',
__('Loading'),
array('style' => 'visibility: hidden;', 'class' => 'throbber')
Expand Down Expand Up @@ -150,7 +147,7 @@ private function _getLink(
}
$retval .= ' title="' . $text . '">';
if ($showIcon) {
$retval .= $this->_commonFunctions->getImage(
$retval .= PMA_Util::getImage(
$icon,
$text
);
Expand Down Expand Up @@ -226,15 +223,15 @@ private function _links()
'documentation'
);
if ($showIcon) {
$retval .= $this->_commonFunctions->showMySQLDocu('', '', true);
$retval .= PMA_Util::showMySQLDocu('', '', true);
}
if ($showText) {
// PMA_showMySQLDocu always spits out an icon,
// we just replace it with some perl regexp.
$link = preg_replace(
'/<img[^>]+>/i',
__('Documentation'),
$this->_commonFunctions->showMySQLDocu('', '', true)
PMA_Util::showMySQLDocu('', '', true)
);
$retval .= $link;
$retval .= '<br />';
Expand Down
21 changes: 7 additions & 14 deletions libraries/navigation/NavigationTree.class.php
Expand Up @@ -81,20 +81,13 @@ class PMA_NavigationTree
*/
private $_searchClause2 = '';

/**
* @var object A reference to the common functions object
*/
private $_commonFunctions;

/**
* Initialises the class
*
* @return void
*/
public function __construct()
{
$this->_commonFunctions = PMA_commonFunctions::getInstance();

// Save the position at which we are in the database list
if (isset($_REQUEST['pos'])) {
$this->_pos = (int) $_REQUEST['pos'];
Expand Down Expand Up @@ -172,7 +165,7 @@ private function _getNavigationDbPos()
$query,
(int)$GLOBALS['cfg']['MaxNavigationItems'],
(int)$GLOBALS['cfg']['MaxNavigationItems'],
PMA_CommonFunctions::getInstance()->sqlAddSlashes($GLOBALS['db'])
PMA_Util::sqlAddSlashes($GLOBALS['db'])
)
);
}
Expand Down Expand Up @@ -584,7 +577,7 @@ public function groupNode($node)
$groups[$key]->separator_depth = $node->separator_depth - 1;
$groups[$key]->icon = '';
if ($GLOBALS['cfg']['NavigationBarIconic']) {
$groups[$key]->icon = $this->_commonFunctions->getImage(
$groups[$key]->icon = PMA_Util::getImage(
'b_group.png'
);
}
Expand Down Expand Up @@ -815,7 +808,7 @@ private function _renderNode($node, $recursive = -1, $class = '')
if (strpos($class, 'last') === false) {
$retval .= "<b></b>";
}
$icon = $this->_commonFunctions->getImage('b_plus.png');
$icon = PMA_Util::getImage('b_plus.png');
$match = 1;
foreach ($this->_aPath as $path) {
$match = 1;
Expand All @@ -828,7 +821,7 @@ private function _renderNode($node, $recursive = -1, $class = '')
if ($match) {
$loaded = ' loaded';
if (! $node->is_group) {
$icon = $this->_commonFunctions->getImage(
$icon = PMA_Util::getImage(
'b_minus.png'
);
}
Expand All @@ -846,7 +839,7 @@ private function _renderNode($node, $recursive = -1, $class = '')
}
if ($match) {
$loaded = ' loaded';
$icon = $this->_commonFunctions->getImage('b_minus.png');
$icon = PMA_Util::getImage('b_minus.png');
break;
}
}
Expand Down Expand Up @@ -1075,7 +1068,7 @@ private function _getPageSelector($node)
{
$retval = '';
if ($node === $this->_tree) {
$retval .= PMA_commonFunctions::getInstance()->getListNavigator(
$retval .= PMA_Util::getListNavigator(
$this->_tree->getPresence('databases', $this->_searchClause),
$this->_pos,
array('server' => $GLOBALS['server']),
Expand Down Expand Up @@ -1107,7 +1100,7 @@ private function _getPageSelector($node)
$node->real_name,
$this->_searchClause2
);
$retval .= $this->_commonFunctions->getListNavigator(
$retval .= PMA_Util::getListNavigator(
$num,
$pos,
$_url_params,
Expand Down
12 changes: 3 additions & 9 deletions libraries/navigation/Nodes/Node.class.php
Expand Up @@ -112,11 +112,6 @@ class Node
*/
public $pos3 = 0;

/**
* @var object A reference to the common functions object
*/
protected $_commonFunctions;

/**
* Initialises the class by setting the mandatory variables
*
Expand All @@ -129,7 +124,6 @@ class Node
*/
public function __construct($name, $type = Node::OBJECT, $is_group = false)
{
$this->_commonFunctions = PMA_commonFunctions::getInstance();
if (! empty($name)) {
$this->name = $name;
$this->real_name = $name;
Expand Down Expand Up @@ -369,7 +363,7 @@ public function getData($type, $pos, $searchClause = '')
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
if (! empty($searchClause)) {
$query .= "WHERE `SCHEMA_NAME` LIKE '%";
$query .= $this->_commonFunctions->sqlAddSlashes(
$query .= PMA_Util::sqlAddSlashes(
$searchClause, true
);
$query .= "%' ";
Expand Down Expand Up @@ -407,7 +401,7 @@ public function getPresence($type = '', $searchClause = '')
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
if (! empty($searchClause)) {
$query .= "WHERE `SCHEMA_NAME` LIKE '%";
$query .= $this->_commonFunctions->sqlAddSlashes(
$query .= PMA_Util::sqlAddSlashes(
$searchClause, true
);
$query .= "%' ";
Expand All @@ -417,7 +411,7 @@ public function getPresence($type = '', $searchClause = '')
$query = "SHOW DATABASES ";
if (! empty($searchClause)) {
$query .= "LIKE '%";
$query .= $this->_commonFunctions->sqlAddSlashes(
$query .= PMA_Util::sqlAddSlashes(
$searchClause, true
);
$query .= "%' ";
Expand Down
8 changes: 4 additions & 4 deletions libraries/navigation/Nodes/Node_Column.class.php
Expand Up @@ -29,7 +29,7 @@ class Node_Column extends Node
public function __construct($name, $type = Node::OBJECT, $is_group = false)
{
parent::__construct($name, $type, $is_group);
$this->icon = $this->_commonFunctions->getImage('pause.png', '');
$this->icon = PMA_Util::getImage('pause.png', '');
$this->links = array(
'text' => 'tbl_alter.php?server=' . $GLOBALS['server']
. '&amp;db=%3$s&amp;table=%2$s&amp;field=%1$s'
Expand All @@ -48,13 +48,13 @@ public function __construct($name, $type = Node::OBJECT, $is_group = false)
*/
public function getComment()
{
$db = $this->_commonFunctions->sqlAddSlashes(
$db = PMA_Util::sqlAddSlashes(
$this->realParent()->realParent()->real_name
);
$table = $this->_commonFunctions->sqlAddSlashes(
$table = PMA_Util::sqlAddSlashes(
$this->realParent()->real_name
);
$column = $this->_commonFunctions->sqlAddSlashes(
$column = PMA_Util::sqlAddSlashes(
$this->real_name
);
$query = "SELECT `COLUMN_COMMENT` ";
Expand Down
4 changes: 2 additions & 2 deletions libraries/navigation/Nodes/Node_Column_Container.class.php
Expand Up @@ -24,7 +24,7 @@ class Node_Column_Container extends Node
public function __construct()
{
parent::__construct(__('Columns'), Node::CONTAINER);
$this->icon = $this->_commonFunctions->getImage('pause.png', '');
$this->icon = PMA_Util::getImage('pause.png', '');
$this->links = array(
'text' => 'tbl_structure.php?server=' . $GLOBALS['server']
. '&amp;db=%2$s&amp;table=%1$s'
Expand All @@ -37,7 +37,7 @@ public function __construct()

$new = PMA_NodeFactory::getInstance('Node', __('New'));
$new->isNew = true;
$new->icon = $this->_commonFunctions->getImage('b_column_add.png', '');
$new->icon = PMA_Util::getImage('b_column_add.png', '');
$new->links = array(
'text' => 'tbl_addfield.php?server=' . $GLOBALS['server']
. '&amp;db=%3$s&amp;table=%2$s'
Expand Down

0 comments on commit 5b0b9e4

Please sign in to comment.