
Преобразование неактивных ссылок в тексте
skeeks/yii2-link-activation
Небольшое расширение для преобразования неактивных ссылок в тексте в активные (кликабельные). Может преобразовывать html или текст, возможно преобразовывать на клиенте (js) а так же на бэкенде (php).
-
Семенов Александр
- /
- Other
- /
- 4 years ago
- /
- /
- 14514
- /
- 0
Publication time: Sunday, April 7, 2019 (4 years ago)
Created by: Семенов Александр Сергеевич
Category: Other
Current version:
Jan 1, 1970, 3:00:00 AM (53 years ago)
Packagist: skeeks/yii2-link-activation
: https://github.com/skeeks-semenov/yii2-link-activation
:
Type of: Компонент
Небольшое расширение для преобразования неактивных ссылок в тексте в активные (кликабельные). Может преобразовывать html или текст, возможно преобразовывать на клиенте (js) а так же на бэкенде (php).
Conversion of inactive links in the text
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).
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
Video
Links
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com
-
Семенов Александр
- /
- Apr 7, 2019
- /
- Developers / programmers
- /
- 0
- /
- 13000
How to convert inactive links in the text to active (clickable)?
A very frequent task in order to provide your users with high-quality and convenient site functionality is the conversion of links in plain text or html. After all, when you give your users something to write independently on the site (for example, comments), then of course you try to protect them from html code. But if they do not use it, then they cannot select links according to the html rules. And it needs to be done for them.
For projects on the yii2 framework, I wrote a small extension: https://cms.skeeks.com/marketplace/components/tools/other/396-preobrazovanie-neaktivnyh-ssylok-v-tekste
CHANGELOG
0.0.3
- Can be used
0.0.2
- -
0.0.1
- -
dev-master — Jan 1, 1970, 3:00:00 AM (53 years ago)
1.0.0 — Jan 1, 1970, 3:00:00 AM (53 years ago)
0.0.3 — Jan 1, 1970, 3:00:00 AM (53 years ago)
0.0.2 — Jan 1, 1970, 3:00:00 AM (53 years ago)
0.0.1 — Jan 1, 1970, 3:00:00 AM (53 years ago)
Стандартная установка:
Добавьте composer.json файл вашего проекта:
"skeeks/yii2-link-activation": "*"
Запустите обновление зависимостей
All Comments (0)