src/Templates/AbstractTemplate.php
public function preview(File $file)
    {
        $bbcode = $this->bbcode();

        return preg_replace_callback_array([
            '/\](?<find>.*)\[/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->base_name, $m[0]);
            },
            '/size=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->humanSize, $m[0]);
            },
            '/uuid=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->uuid, $m[0]);
            },
            '/url=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->url, $m[0]);
            },
        ], $bbcode);
    }
public function preview(File $file)
    {
        $bbcode = $this->bbcode();

        return preg_replace_callback_array([
            '/\](?<find>.*)\[/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->base_name, $m[0]);
            },
            '/size=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->humanSize, $m[0]);
            },
            '/uuid=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->uuid, $m[0]);
            },
            '/url=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->url, $m[0]);
            },
        ], $bbcode);
    }
public function preview ( File $ file ) { $ bbcode = $ this -> bbcode ( ) ; return preg_replace_callback_array ( [ '/\](?<find>.*)\[/' => function ( $ m ) use ( $ file ) { return str_replace ( $ m [ 'find' ] , $ file -> base_name , $ m [ 0 ] ) ; } , '/size=(?<find>{.*?})/' => function ( $ m ) use ( $ file ) { return str_replace ( $ m [ 'find' ] , $ file -> humanSize , $ m [ 0 ] ) ; } , '/uuid=(?<find>{.*?})/' => function ( $ m ) use ( $ file ) { return str_replace ( $ m [ 'find' ] , $ file -> uuid , $ m [ 0 ] ) ; } , '/url=(?<find>{.*?})/' => function ( $ m ) use ( $ file ) { return str_replace ( $ m [ 'find' ] , $ file -> url , $ m [ 0 ] ) ; } , ] , $ bbcode ) ; }
Generates a preview bbcode string.

@param File $file

@return string
Generates a preview bbcode string .