demi / safe-text
Hiding personal data(email, phone, etc.) from spam grabbing
Installs: 150
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 5
Forks: 2
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-10-27 22:16:44 UTC
README
Yii2 extension for hiding personal data(email, phone, etc.) from spam grabbing
Installation
Run
composer require "demi/safe-text" "~1.0"
Usage
Hide phone number:
<?= \demi\safeText\Widget::widget(['text' => '+555 478 24 75']) ?>
will be generated:
document.write(["5","7"," ","4","2"," ","8","7","4"," ","5","5","5","+"].reverse().join(''));
Hide email:
<?= \demi\safeText\Widget::widget([ 'url' => 'mailto:example@gmail.com', 'text' => 'example@gmail.com', ]) ?>
will be generated:
(function() { var a = document.createElement('a'); a.href = ["m","o","c",".","l","i","a","m","g","@","e","l","p","m","a","x","e",":","o","t","l","i","a","m"].reverse().join(''); var text = ["m","o","c",".","l","i","a","m","g","@","e","l","p","m","a","x","e"].reverse().join(''); var template = '{text}'; a.innerHTML = template.replace('{text}', text); document.write(a.outerHTML); }());
Options
All widget options
<?= \demi\safeText\Widget::widget([ 'url' => 'skype:girlfriend?chat', 'text' => 'girlfriend', 'linkTextTemplate' => '<i class="fa fa-skype"></i> {text}', 'linkOptions' => [ 'class' => 'skype-link', 'target' => '_blank', ], ]) ?>
will be generated:
(function() { var a = document.createElement('a'); a.href = ["t","a","h","c","?","d","n","e","i","r","f","l","r","i","g",":","e","p","y","k","s"].reverse().join(''); a.setAttribute('class', 'skype-link'); a.setAttribute('target', '_blank'); var text = ["d","n","e","i","r","f","l","r","i","g"].reverse().join(''); var template = '<i class="fa fa-skype"></i> {text}'; a.innerHTML = template.replace('{text}', text); document.write(a.outerHTML); }());