Skip to content

Commit

Permalink
Add Target function
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels Nübel committed Jun 4, 2018
1 parent 0b3c023 commit bcef840
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
14 changes: 12 additions & 2 deletions kickgdpr.php
Expand Up @@ -158,6 +158,7 @@ public function onBeforeCompileHead()
$expiryDays = $this->params->get('expiryDays', 365);
$customcode = $this->params->get('customcode', false);
$customcss = $this->params->get('customcss', false);
$target = $this->params->get('target', '_blank');

$message = $this->_prepareMessageText($message);

Expand All @@ -173,8 +174,14 @@ public function onBeforeCompileHead()
{
$href = $lang_link->link;
$link_url = $lang_link->link_url;
$target = $lang_link->link_url_target;
$href = (isset($href) && '' != $href) ? JRoute::_("index.php?Itemid={$href}") : false;
$href = (isset($link_url) && '' != $link_url && !$href) ? $link_url : $href;

if ($target == "")
{
$target = '_blank';
}
}
}
}
Expand Down Expand Up @@ -226,6 +233,9 @@ public function onBeforeCompileHead()
$js[] = ' "cookie": {';
$js[] = ' "expiryDays": ' . (int) $expiryDays;
$js[] = ' },';
$js[] = ' "elements": {';
$js[] = ' "messagelink": \'<span id="cookieconsent:desc" class="cc-message">{{message}} <a aria-label="learn more about cookies" role=button tabindex="0" class="cc-link" href="' . JText::_($href) . '" target="' . $target . '">{{link}}</a></span>\'';
$js[] = ' },';
$js[] = ' onInitialise: function (status) {';
$js[] = ' handleCookies(status);';
$js[] = ' },';
Expand Down Expand Up @@ -321,7 +331,7 @@ public function onBeforeCompileHead()
$js[] = ' ' . $trigger_content;
$js[] = ' // End Plugin Trigger Code';
}
// $js[] = 'PUT your Code here';
// $js[] = 'PUT your Code here';

if ($type != '' && ($type == 'opt-out' || $type == 'opt-in'))
{
Expand Down Expand Up @@ -422,7 +432,7 @@ protected function _prepareMessageText($message)
}

/**
* Plugin Trigger
* Plugin Trigger
*
* @param string $cookieConsentCode
*/
Expand Down
2 changes: 1 addition & 1 deletion kickgdpr.xml
Expand Up @@ -7,7 +7,7 @@
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
<authorEmail>info@kicktemp.com</authorEmail>
<authorUrl>www.kicktemp.com</authorUrl>
<version>2.2.4</version>
<version>2.3.0</version>
<description>PLG_SYSTEM_KICKGDPR_XML_DESCRIPTION</description>
<files>
<folder>language</folder>
Expand Down
7 changes: 3 additions & 4 deletions langlinks.xml
Expand Up @@ -23,12 +23,11 @@
/>
<field name="link_url_target"
type="list"
default="0"
default="_blank"
label="PLG_SYSTEM_KICKGDPR_LEARNMORE_LINK_URL_TARGET_LABEL"
description="PLG_SYSTEM_KICKGDPR_LEARNMORE_LINK_URL_TARGET_DESC">
<option value="">JSELECT</option>
<option value="0">PLG_SYSTEM_KICKGDPR_LEARNMORE_LINK_URL_TARGET_NEW</option>
<option value="1">PLG_SYSTEM_KICKGDPR_LEARNMORE_LINK_URL_TARGET_SAME</option>
<option value="_blank">PLG_SYSTEM_KICKGDPR_LEARNMORE_LINK_URL_TARGET_NEW</option>
<option value="_self">PLG_SYSTEM_KICKGDPR_LEARNMORE_LINK_URL_TARGET_SAME</option>
</field>
</fieldset>
</form>
4 changes: 2 additions & 2 deletions update.xml
Expand Up @@ -7,10 +7,10 @@
<type>plugin</type>
<folder>system</folder>
<client>0</client>
<version>2.2.4</version>
<version>2.3.0</version>
<infourl title="KickGDPR Plugin">https://github.com/nielsnuebel/kickgdpr/</infourl>
<downloads>
<downloadurl type="upgrade" format="zip">https://github.com/nielsnuebel/kickgdpr/archive/2.2.4.zip</downloadurl>
<downloadurl type="upgrade" format="zip">https://github.com/nielsnuebel/kickgdpr/archive/2.3.0.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
Expand Down

0 comments on commit bcef840

Please sign in to comment.