code/Extensions/SSGuru_ContentController.php
public function Content()
    {
        $content = $this->owner->Content;

        // Internal links.
        $matches = array();
        preg_match_all('/<a.*href="\[file_link,id=([0-9]+)\].*".*>.*<\/a>/U', $content, $matches);

        for ($i = 0; $i < count($matches[0]); $i++) {
            $file = DataObject::get_by_id('File', $matches[1][$i]);
            if ($file) {
                $size     = $file->getSize();
                $ext     = strtoupper($file->getExtension());
                $newLink = $matches[0][$i] . "<span class='fileExt'> [$ext, $size]</span>";
                $content = str_replace($matches[0][$i], $newLink, $content);
            }
        }

        // and now external links
        $pattern     = '/<a href=\"(h[^\"]*)\">(.*)<\/a>/iU';
        $replacement = '<a href="$1" class="external">$2</a>';
        $result         = preg_replace($pattern, $replacement, $content, -1);
        return $result;
    }
public function Content()
    {
        $content = $this->owner->Content;

        // Internal links.
        $matches = array();
        preg_match_all('/<a.*href="\[file_link,id=([0-9]+)\].*".*>.*<\/a>/U', $content, $matches);

        for ($i = 0; $i < count($matches[0]); $i++) {
            $file = DataObject::get_by_id('File', $matches[1][$i]);
            if ($file) {
                $size     = $file->getSize();
                $ext     = strtoupper($file->getExtension());
                $newLink = $matches[0][$i] . "<span class='fileExt'> [$ext, $size]</span>";
                $content = str_replace($matches[0][$i], $newLink, $content);
            }
        }

        // and now external links
        $pattern     = '/<a href=\"(h[^\"]*)\">(.*)<\/a>/iU';
        $replacement = '<a href="$1" class="external">$2</a>';
        $result         = preg_replace($pattern, $replacement, $content, -1);
        return $result;
    }
public function Content ( ) { $ content = $ this -> owner -> Content ; // Internal links. $ matches = array ( ) ; preg_match_all ( '/<a.*href="\[file_link,id=([0-9]+)\].*".*>.*<\/a>/U' , $ content , $ matches ) ; for ( $ i = 0 ; $ i < count ( $ matches [ 0 ] ) ; $ i ++ ) { $ file = DataObject :: get_by_id ( 'File' , $ matches [ 1 ] [ $ i ] ) ; if ( $ file ) { $ size = $ file -> getSize ( ) ; $ ext = strtoupper ( $ file -> getExtension ( ) ) ; $ newLink = $ matches [ 0 ] [ $ i ] . "<span class='fileExt'> [$ext, $size]</span>" ; $ content = str_replace ( $ matches [ 0 ] [ $ i ] , $ newLink , $ content ) ; } } // and now external links $ pattern = '/<a href=\"(h[^\"]*)\">(.*)<\/a>/iU' ; $ replacement = '<a href="$1" class="external">$2</a>' ; $ result = preg_replace ( $ pattern , $ replacement , $ content , - 1 ) ; return $ result ; }
Give external links the external class, and affix size and type prefixes to files.

@return String
Give external links the external class and affix size and type prefixes to files .