Plugin Directory

Changeset 2925475


Ignore:
Timestamp:
06/13/2023 05:15:37 PM (3 years ago)
Author:
pluginsclub
Message:

<a href tags are now completelly excluded

Location:
ethereum-price-tooltip/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ethereum-price-tooltip/trunk/README.txt

    r2860657 r2925475  
    33Tags: cryptocurrency, ethereum, finance, bitcoin, eth, tooltip
    44Requires at least: 4.0
    5 Tested up to: 6.1
     5Tested up to: 6.2
    66Requires PHP: 5.4
    7 Stable tag: 1.1
    8 Donate link: https://plugins.club/wordpress/ethereum-price-tooltip/
     7Stable tag: 1.2
     8Donate link: https://plugins.club/free-wordpress-plugins/ethereum-price-tooltip/
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1414Plugin will find mentions of Ethereum in your texts and automatically add a tooltip to it with actual price in USD and EUR. No need to do any setting.
    1515
    16 ![screenshot](https://plugins.club/wp-content/uploads/2023/01/chrome_pWlFzBqkI6.png)
    17 
    18 For Bitcoin please use [Bitcoin price tooltip](https://wordpress.org/plugins/bitcoin-price-tooltip/)
     16For Bitcoin please use [Bitcoin price tooltip](https://wordpress.org/free-wordpress-plugins/bitcoin-price-tooltip/)
    1917
    2018== Screenshots ==
     
    2422== Changelog ==
    2523
     24= 1.2 =
     25<a href tags are now completelly excluded
     26
    2627= 1.1 =
    2728Replaced BitPay with CryptoCompare API
  • ethereum-price-tooltip/trunk/eth-price-tooltip.php

    r2850737 r2925475  
    33Plugin Name: Ethereum Price Tooltip
    44Description: Plugin will find mentions of Ethereum in your texts and automatically add a toltip to it with actual price in USD and EUR.
    5 Version: 1.1
     5Version: 1.2
    66Author: plugins.club
    7 Author URI: https://plugins.club/wordpress/ethereum-price-tooltip/
     7Author URI: https://plugins.club/free-wordpress-plugins/ethereum-price-tooltip/
    88*/
    99
     
    2020    $ethAnswerEUR = $json->EUR;
    2121
    22     for ($i = 0, $c = count($eth_in_text);$i < $c;$i++)
    23     {
    24         $the_content = preg_replace('#' . $eth_in_text[$i] . '#iu', '<span class="tooltip" data-tooltip="' . $ethAnswerUsd . ' USD / ' . $ethAnswerEUR . ' EUR">' . $eth_in_text[$i] . '</span>', $the_content);
     22    foreach ($eth_in_text as $keyword) {
     23        $pattern = '/(<a[^>]*>.*?<\/a>)|(?<!<\/a>|[\'"])(' . preg_quote($keyword, '/') . ')(?!<\/a>|\w|[\'"])/iu';
     24        $the_content = preg_replace($pattern, '$1<span class="tooltip" data-tooltip="' . $ethAnswerUsd . ' USD / ' . $ethAnswerEUR . ' EUR">$2</span>', $the_content);
    2525    }
    2626
    2727    return $the_content;
    2828}
     29
    2930
    3031function add_eth_tooltip_css()
Note: See TracChangeset for help on using the changeset viewer.