Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-10-01 22:40:19 +02:00
commit 5b83a124cb
4 changed files with 14 additions and 6 deletions

View File

@ -17,6 +17,8 @@ function PMA_checkLink($url)
$valid_starts = array(
'http://',
'https://',
'http%3A%2F%2F',
'https%3A%2F%2F',
);
if (defined('PMA_SETUP')) {
$valid_starts[] = '../Documentation.html';
@ -56,7 +58,7 @@ function PMA_replaceBBLink($found)
}
/* Construct url */
if (substr($found[1], 0, 4) == 'http') {
if (preg_match('/^https?:\/\//', $found[1])) {
$url = PMA_linkURL($found[1]);
} else {
$url = $found[1];

View File

@ -11,6 +11,8 @@
/*
* Include to test.
*/
require_once 'libraries/config.default.php';
require_once 'libraries/core.lib.php';
require_once 'libraries/common.lib.php';
require_once 'libraries/Theme.class.php';
@ -27,7 +29,7 @@ class PMA_showPHPDocu_test extends PHPUnit_Framework_TestCase
$target = "docu";
$lang = _pgettext('PHP documentation language', 'en');
$expected = '<a href="http://php.net/manual/' . $lang . '/' . $target
$expected = '<a href="./url.php?url=http%3A%2F%2Fphp.net%2Fmanual%2F' . $lang . '%2F' . $target
. '" target="documentation"><img src="themes/dot.gif" title="'
. __('Documentation') . '" alt="' . __('Documentation') . '" class="icon ic_b_help" /></a>';
@ -40,7 +42,7 @@ class PMA_showPHPDocu_test extends PHPUnit_Framework_TestCase
$target = "docu";
$lang = _pgettext('PHP documentation language', 'en');
$expected = '[<a href="http://php.net/manual/' . $lang . '/' . $target
$expected = '[<a href="./url.php?url=http%3A%2F%2Fphp.net%2Fmanual%2F' . $lang . '%2F' . $target
. '" target="documentation">' . __('Documentation') . '</a>]';
$this->assertEquals($expected, PMA_showPHPDocu($target));

View File

@ -26,7 +26,11 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase
public function testPMA_getPHPDocLink()
{
$lang = _pgettext('PHP documentation language', 'en');
$this->assertEquals(PMA_getPHPDocLink('function'), 'http://php.net/manual/' . $lang . '/function');
$this->assertEquals(
PMA_getPHPDocLink('function'),
'./url.php?url=http%3A%2F%2Fphp.net%2Fmanual%2F'
. $lang . '%2Ffunction&amp;server=99&amp;lang=en&amp;token=token'
);
}
public function providerLinkURL(){

View File

@ -24,7 +24,7 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
function testMissingExtentionFatal(){
$ext = 'php_ext';
$warn = 'The <a href="'.PMA_linkURL(PMA_getPHPDocLink('book.' . $ext . '.php')).'" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.';
$warn = 'The <a href="' . PMA_getPHPDocLink('book.' . $ext . '.php') . '" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.';
ob_start();
PMA_warnMissingExtension($ext, true);
@ -38,7 +38,7 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
$ext = 'php_ext';
$extra = 'Appended Extra String';
$warn = 'The <a href="'.PMA_linkURL(PMA_getPHPDocLink('book.' . $ext . '.php')).'" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.'.' '.$extra;
$warn = 'The <a href="' . PMA_getPHPDocLink('book.' . $ext . '.php') . '" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.'.' '.$extra;
ob_start();
PMA_warnMissingExtension($ext, true, $extra);