Skip to content

skeeks-semenov/yii2-link-activation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conversion of inactive links in the text

SkeekS blog

A small extension to convert active links in the text to active (clickable). It can convert html or text, it is possible to convert on the client (js) as well as on the backend (php).

Небольшое расширение для преобразования неактивных ссылок в тексте в активные (кликабельные). Может преобразовывать html или текст, возможно преобразовывать на клиенте (js) а так же на бэкенде (php).

Latest Stable Version Total Downloads

Installation

$ composer require skeeks/yii2-link-activation "^0.0.3"

Or add this to your composer.json file:

{
    "require": {
        "skeeks/yii2-link-activation": "^0.0.3"
    }
}

Client replace (on js)

<?
\skeeks\yii2\linkActivation\assets\TextHandlerAsset::register($this);
$this->registerJs(<<<JS
new sx.classes.LinkActivation(".description");
JS
);
?>
<div class="description">
Какой то текст со ссылками https://test.ru,
https://google.ru/search
Все ссылки будут автоматически https://cms.skeeks.com/blog/releases/2-zapusk-sayta-dlya-skeeks-cms определены в этом тексте и станут кликабельными
</div>

Backend replace

<?
    $handler = new \skeeks\yii2\linkActivation\TextHandler();
    $handler->short_link_max_length = 45;
    echo $handler->replace($yourText);
?>
<?= (new \skeeks\yii2\linkActivation\TextHandler())->replace($yourText); ?>

Screenshot

SkeekS blog

Video

Video

Links


skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com