Embeding YouTube

I am sorry if this question is trivial, but I cannot find an answer on forum nor documentation.

I am using a widget class extending default CMarkdown. How do I prevent it from cutting off embed YouTube and Vimeo players? Of course – due to security reasons I do not want to disable purifier at all.

The only way I could figure it out was to extend the CMarkdown.processOutput() method.


class NMarkdown extends CMarkdown

{   

    public function processOutput($output)

    {

        $output=$this->transform($output);

        if($this->purifyOutput)

        {

            $output=$this->createHtmlPurifier()->purify($output);

        }

        COutputProcessor::processOutput($output);

    }

    

    protected function createHtmlPurifier()

    {

        $p = new CHtmlPurifier;

        $p->options = array(

            ...

        );

        return $p;

    }

}

I really think, that CMarkdown.createHtmlPurifier() method should be implemented in official Yii release.

I don’t understand the meaning of the code, I only know some time I upload youtube video, youtube supports this format, I have to use some software to upload video,such as Youtube Movie Maker( yahoo or google can search it),I don’t know if the youtube bug.