This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/app/BBCode/TagBase.php

40 lines
691 B
PHP

<?php
/**
* Holds the tag base.
* @package Sakura
*/
namespace Sakura\BBCode;
use Sakura\User;
/**
* Interface for tags.
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class TagBase
{
/**
* The pattern to match.
* @var string
*/
public static $pattern = "";
/**
* The string to replace it with.
* @var string
*/
public static $replace = "";
/**
* Parses the bbcode.
* @param string $text
* @param User $poster
* @return string
*/
public static function parse(string $text, User $poster): string
{
return preg_replace(static::$pattern, static::$replace, $text);
}
}