Jump to content

Создание хука под 4.7.20

Featured Replies

Posted
<?xml version="1.0" encoding="UTF-8"?>
<plugin name="Video" version_long="20000" version_human="1.0.0"><hooks><hook type="C" class="\IPS\custom_video_embed" filename="Video"><![CDATA[//<?php


class _VideoEmbedHook extends \IPS\Text\Parser
{
    public function parseStatic($value, $member, $settings, $area)
    {
        $value = parent::parseStatic($value, $member, $settings, $area);

        // Замена ссылок на плеер
        $value = preg_replace(
            '#https://site\.ru/video/([a-zA-Z0-9_-]+)#',
            '<iframe src="https://site\.ru/video/embed/$1" width="560" height="315" frameborder="0" allowfullscreen></iframe>',
            $value
        );

        return $value;
    }
}]]></plugin>

Что та не выходит, как верно сделать плагин. Который в постах будет находить и заменять необходимые вхождения в постах?

При установке, зависает. В целом в списке появляется, но не работает...

Не тот код, старый. Вопрос актуален

Какая структура xml будет верной, так чтобы заработало...

Edited by Zuldek199

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.