Skip to content

Commit

Permalink
Merge branch 'release/1.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sommerregen committed Jul 12, 2018
2 parents 1526ad6 + 760d3f6 commit a2f108f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.6.1
## 07/12/2018

3. [](#bugfix)
* Fixed parsing tags other than links [#24](https://github.com/Sommerregen/grav-plugin-external-links/pull/24) (Fix loading of a href element)

# v1.6.0
## 02/22/2018

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using Grav External Links Plugin in any way.
MIT LICENSE
-----------

Copyright (c) 2017 Benjamin Regler, https://github.com/sommerregen/grav-plugin-external-links
Copyright (c) 2017+ Benjamin Regler, https://github.com/sommerregen/grav-plugin-external-links

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [![Grav External Links Plugin](assets/logo.png)][project]

[![Release](https://img.shields.io/github/release/sommerregen/grav-plugin-external-links.svg)][project] [![Issues](https://img.shields.io/github/issues/sommerregen/grav-plugin-external-links.svg)][issues] [![Dual license](https://img.shields.io/badge/dual%20license-MIT%2FGPL-blue.svg)](LICENSE "License") <span style="float:right;">[![Flattr](https://api.flattr.com/button/flattr-badge-large.png)][flattr] [![PayPal](https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)][paypal]</span>
[![Release](https://img.shields.io/github/release/sommerregen/grav-plugin-external-links.svg)][project] [![Issues](https://img.shields.io/github/issues/sommerregen/grav-plugin-external-links.svg)][issues] [![Dual license](https://img.shields.io/badge/dual%20license-MIT%2FGPL-blue.svg)](LICENSE "License")

> This plugin adds small icons to external and mailto links, informing users the link will take them to a new site or open their email client.
Expand Down Expand Up @@ -172,12 +172,6 @@ After that please note:
* Feature requests are more likely to get attention if you include a clearly described use case.
* If you wish to submit a pull request, please make again sure that your request match the [guidelines for contributing](docs/CONTRIBUTING.md) and that you keep track of adding unit tests for any new or changed functionality.
### Support and donations
If you like my project, feel free to support me via [![Flattr](https://api.flattr.com/button/flattr-badge-large.png)][flattr] or by sending me some bitcoins to [**1HQdy5aBzNKNvqspiLvcmzigCq7doGfLM4**][bitcoin].
Thanks!
## License
Copyright (c) 2017+ [Benjamin Regler][github]. See also the list of [contributors] who participated in this project.
Expand All @@ -189,10 +183,6 @@ Copyright (c) 2017+ [Benjamin Regler][github]. See also the list of [contributor
[github]: https://github.com/sommerregen/ "GitHub account from Benjamin Regler"
[gpl-license]: http://opensource.org/licenses/GPL-3.0 "GPLv3 license"
[mit-license]: http://www.opensource.org/licenses/mit-license.php "MIT license"
[flattr]: https://flattr.com/submit/auto?user_id=Sommerregen&url=https://github.com/sommerregen/grav-plugin-external-links "Flatter my GitHub project"
[paypal]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SYFNP82USG3RN "Donate for my GitHub project using PayPal"
[bitcoin]: bitcoin:1HQdy5aBzNKNvqspiLvcmzigCq7doGfLM4?label=GitHub%20project "Donate for my GitHub project using BitCoin"
[gnu]: https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/License_icon-gpl-88x31.svg/88px-License_icon-gpl-88x31.svg.png "GNU license - Some rights reserved"
[project]: https://github.com/sommerregen/grav-plugin-external-links
Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'External Links'
version: '1.6.0'
version: '1.6.1'
description: 'This plugin adds small icons to external and mailto links, informing users the link will take them to a new site or open their email client.'
icon: 'external-link'
author:
Expand Down
9 changes: 7 additions & 2 deletions classes/ExternalLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@ class ExternalLinks
public function render($content, $options = [], $page = null)
{
// Get all <a> tags and process them
$content = preg_replace_callback('~<a[^>]*>.*?</a>~i',
$content = preg_replace_callback('~<a(?:\s[^>]*)?>.*?</a>~i',
function($match) use ($options, $page) {
// Load PHP built-in DOMDocument class
if (($dom = $this->loadDOMDocument($match[0])) === null) {
return $match[0];
}

$a = $dom->getElementsByTagName('a')->item(0);
// Check that there is really a link tag
$a = $dom->getElementsByTagName('a');
if ($a->length == 0) {
return $match[0];
}
$a = $a->item(0);

// Process links with non-empty href attribute
$href = $a->getAttribute('href');
Expand Down
6 changes: 3 additions & 3 deletions external_links.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* External Links v1.6.0
* External Links v1.6.1
*
* This plugin adds small icons to external and mailto links, informing
* users the link will take them to a new site or open their email client.
Expand All @@ -9,10 +9,10 @@
* http://benjamin-regler.de/license/
*
* @package External Links
* @version 1.6.0
* @version 1.6.1
* @link <https://github.com/sommerregen/grav-plugin-external-links>
* @author Benjamin Regler <[email protected]>
* @copyright 2017, Benjamin Regler
* @copyright 2017+, Benjamin Regler
* @license <http://opensource.org/licenses/MIT> MIT
* @license <http://opensource.org/licenses/GPL-3.0> GPLv3
*/
Expand Down

0 comments on commit a2f108f

Please sign in to comment.