PMA\libraries\URL::getCommonRaw PHP Method

getCommonRaw() public static method

$params['myparam'] = 'myvalue'; $params['db'] = 'mysql'; $params['table'] = 'rights'; note the missing ? echo 'script.php' . URL::getCommon($params); produces with cookies enabled: script.php?myparam=myvalue&db=mysql&table=rights with cookies disabled: script.php?server=1&lang=en&myparam=myvalue&db=mysql &table=rights note the missing ? echo 'script.php' . URL::getCommon(); produces with cookies enabled: script.php with cookies disabled: script.php?server=1&lang=en
public static getCommonRaw ( mixed $params = [], string $divider = '?' ) : string
$params mixed optional, Contains an associative array with url params
$divider string optional character to use instead of '?'
return string string with URL parameters
    public static function getCommonRaw($params = array(), $divider = '?')
    {
        $separator = URL::getArgSeparator();
        // avoid overwriting when creating navi panel links to servers
        if (isset($GLOBALS['server']) && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault'] && !isset($params['server']) && !defined('PMA_SETUP')) {
            $params['server'] = $GLOBALS['server'];
        }
        if (empty($_COOKIE['pma_lang']) && !empty($GLOBALS['lang'])) {
            $params['lang'] = $GLOBALS['lang'];
        }
        if (empty($_COOKIE['pma_collation_connection']) && !empty($GLOBALS['collation_connection'])) {
            $params['collation_connection'] = $GLOBALS['collation_connection'];
        }
        return $divider . http_build_query($params, null, $separator);
    }

Usage Example

Example #1
0
 /**
  * Test for URL::getCommon with alternate divider
  *
  * @return void
  */
 public function testWithAlternateDivider()
 {
     $GLOBALS['server'] = 'x';
     $GLOBALS['collation_connection'] = 'x';
     $GLOBALS['cfg']['ServerDefault'] = 'y';
     $separator = URL::getArgSeparator();
     $expected = 'server=x' . $separator . 'lang=en' . $separator . 'collation_connection=x';
     $expected = '#ABC#db=db' . $separator . 'table=table' . $separator . $expected;
     $this->assertEquals($expected, URL::getCommonRaw(array('db' => 'db', 'table' => 'table'), '#ABC#'));
 }
All Usage Examples Of PMA\libraries\URL::getCommonRaw