public function shortCode($text)
    {
        $patterns = [
            '/\[(FIGURE)[\s+](.+)\]/',
            '/\[(BASEURL)\]/',
            '/\[(RELURL)\]/',
            '/\[(ASSET)\]/',
        ];

        return preg_replace_callback(
            $patterns,
            function ($matches) {
                switch ($matches[1]) {

                    case 'FIGURE':
                        return CTextFilter::shortCodeFigure($matches[2]);
                        break;

                    case 'BASEURL':
                        return CTextFilter::shortCodeBaseurl();
                        break;

                    case 'RELURL':
                        return CTextFilter::shortCodeRelurl();
                        break;

                    case 'ASSET':
                        return CTextFilter::shortCodeAsset();
                        break;

                    default:
                        return "{$matches[1]} is unknown shortcode.";
                }
            },
            $text
        );
    }
public function shortCode($text)
    {
        $patterns = [
            '/\[(FIGURE)[\s+](.+)\]/',
            '/\[(BASEURL)\]/',
            '/\[(RELURL)\]/',
            '/\[(ASSET)\]/',
        ];

        return preg_replace_callback(
            $patterns,
            function ($matches) {
                switch ($matches[1]) {

                    case 'FIGURE':
                        return CTextFilter::shortCodeFigure($matches[2]);
                        break;

                    case 'BASEURL':
                        return CTextFilter::shortCodeBaseurl();
                        break;

                    case 'RELURL':
                        return CTextFilter::shortCodeRelurl();
                        break;

                    case 'ASSET':
                        return CTextFilter::shortCodeAsset();
                        break;

                    default:
                        return "{$matches[1]} is unknown shortcode.";
                }
            },
            $text
        );
    }
public function shortCode ( $ text ) { $ patterns = [ '/\[(FIGURE)[\s+](.+)\]/' , '/\[(BASEURL)\]/' , '/\[(RELURL)\]/' , '/\[(ASSET)\]/' , ] ; return preg_replace_callback ( $ patterns , function ( $ matches ) { switch ( $ matches [ 1 ] ) { case 'FIGURE' : return CTextFilter :: shortCodeFigure ( $ matches [ 2 ] ) ; break ; case 'BASEURL' : return CTextFilter :: shortCodeBaseurl ( ) ; break ; case 'RELURL' : return CTextFilter :: shortCodeRelurl ( ) ; break ; case 'ASSET' : return CTextFilter :: shortCodeAsset ( ) ; break ; default : return "{$matches[1]} is unknown shortcode." ; } } , $ text ) ; }
Shortcode to to quicker format text as HTML.

@param string $text text to be converted.

@return string the formatted text.
Shortcode to to quicker format text as HTML .