Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Open popup windows so they are not blocked (see #4243)

  • Loading branch information...
commit 82c302f5cb2274b0e1aeeb8f505405b99baa7ef9 1 parent 0dc3000
@leofeyer leofeyer authored
View
4 system/config/constants.php
@@ -59,8 +59,8 @@
* <a href="index.html"<?php echo LINK_NEW_WINDOW_BLUR; ?>>Home</a>
*/
define('LINK_BLUR', ' onclick="this.blur()"');
-define('LINK_NEW_WINDOW', ' onclick="window.open(this.href);return false"');
-define('LINK_NEW_WINDOW_BLUR', ' onclick="this.blur();window.open(this.href);return false"');
+define('LINK_NEW_WINDOW', ' onclick="return !window.open(this.href)"');
+define('LINK_NEW_WINDOW_BLUR', ' onclick="this.blur();return !window.open(this.href)"');
/**
View
4 system/library/Contao/Controller.php
@@ -3041,7 +3041,7 @@ public static function addImageToTemplate($objTemplate, $arrItem, $intMaxWidth=n
}
else
{
- $objTemplate->attributes = ($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"';
+ $objTemplate->attributes = ($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
}
}
@@ -3286,7 +3286,7 @@ protected function getDatePickerString()
*
* @deprecated Use String::parseSimpleTokens() instead
*/
- public static function parseSimpleTokens($strBuffer, $arrData)
+ protected function parseSimpleTokens($strBuffer, $arrData)
{
return String::parseSimpleTokens($strBuffer, $arrData);
}
View
2  system/library/Contao/String.php
@@ -384,7 +384,7 @@ public static function toXhtml($strString)
'<u>' => '<span style="text-decoration:underline">',
'</u>' => '</span>',
' target="_self"' => '',
- ' target="_blank"' => ' onclick="window.open(this.href);return false"'
+ ' target="_blank"' => ' onclick="return !window.open(this.href)"'
);
$strString = preg_replace(array_keys($arrPregReplace), array_values($arrPregReplace), $strString);
View
2  system/modules/calendar/classes/Events.php
@@ -273,7 +273,7 @@ protected function addEvent($objEvents, $intStart, $intEnd, $strUrl, $intBegin,
// Override the link target
if ($objEvents->source == 'external' && $objEvents->target)
{
- $arrEvent['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"';
+ $arrEvent['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
// Clean the RTE output
View
2  system/modules/core/elements/ContentHyperlink.php
@@ -135,7 +135,7 @@ protected function compile()
// Override the link target
if ($this->target)
{
- $this->Template->target = ($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"';
+ $this->Template->target = ($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
}
}
View
4 system/modules/core/modules/Module.php
@@ -300,7 +300,7 @@ protected function renderNavigation($pid, $level=1)
// Override the link target
if ($objSubpages->type == 'redirect' && $objSubpages->target)
{
- $row['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"';
+ $row['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
$items[] = $row;
@@ -333,7 +333,7 @@ protected function renderNavigation($pid, $level=1)
// Override the link target
if ($objSubpages->type == 'redirect' && $objSubpages->target)
{
- $row['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"';
+ $row['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
$items[] = $row;
View
4 system/modules/core/modules/ModuleCustomnav.php
@@ -173,7 +173,7 @@ protected function compile()
// Override the link target
if ($arrPage['type'] == 'redirect' && $arrPage['target'])
{
- $row['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"';
+ $row['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
$items[] = $row;
@@ -198,7 +198,7 @@ protected function compile()
// Override the link target
if ($arrPage['type'] == 'redirect' && $arrPage['target'])
{
- $row['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"';
+ $row['target'] = ($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
$items[] = $row;
View
2  system/modules/listing/modules/ModuleListing.php
@@ -427,7 +427,7 @@ protected function formatValue($k, $value, $blnListSingle=false)
elseif ($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['eval']['rgxp'] == 'url' && preg_match('@^(https?://|ftp://)@i', $value))
{
global $objPage;
- $value = '<a href="' . $value . '"' . (($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"') . '>' . $value . '</a>';
+ $value = '<a href="' . $value . '"' . (($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"') . '>' . $value . '</a>';
}
// E-mail addresses
View
2  system/modules/news/modules/ModuleNews.php
@@ -406,7 +406,7 @@ protected function generateLink($strLink, $objArticle, $blnAddArchive=false, $bl
return sprintf('<a href="%s" title="%s"%s>%s</a>',
$objArticle->url,
specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $objArticle->url)),
- ($objArticle->target ? (($objPage->outputFormat == 'xhtml') ? ' onclick="window.open(this.href);return false"' : ' target="_blank"') : ''),
+ ($objArticle->target ? (($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"') : ''),
$strLink);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.