Display video using info from youtube API
@param string $content
@param array $options
@return string
184083
public function display($content, $options = [])
    {
        if (!empty($content)) {
            $videoInfo = $this->_cache($content);
            if (!($videoInfo || empty($options['alwaysRender']))) {
                return 'Video does not exist, it may have been removed from youtube';
            }
            return $this->_renderDisplayView($options, $videoInfo);
        } else {
            return '';
        }
    }
1371809
private static function parseHeaderContent($content)
    {
        $parts = explode(';', $content);
        $headerValue = array_shift($parts);
        $options = array();
        // Parse options
        foreach ($parts as $part) {
            if (false === empty($part)) {
                $partSplit = explode('=', $part, 2);
                if (2 === count($partSplit)) {
                    list ($key, $value) = $partSplit;
                    if ('*' === substr($key, -1)) {
                        // RFC 5987
                        $key = substr($key, 0, -1);
                        if (preg_match(
                            "/(?P<charset>[\w!#$%&+^_`{}~-]+)'(?P<language>[\w-]*)'(?P<value>.*)$/",
                            $value,
                            $matches
                        )) {
                            $value = mb_convert_encoding(
                                rawurldecode($matches['value']),
                                'utf-8',
                                $matches['charset']
                            );
                        }
                    }
                    $options[trim($key)] = trim($value, ' "');
                } else {
                    // Bogus option
                    $options[$partSplit[0]] = '';
                }
            }
        }

        return array($headerValue, $options);
    }
1102143
public function filter($content, array $options = array())
    {
        $metadata = $this->property->getMetadata();

        $mediaElement = $metadata->offsetExists('media')
            ? $metadata->get('media')->getReferencedElement()
            : null;

        if ($mediaElement === null) {
            return null;
        }

        if ($mediaElement instanceof ImageReferencedElement) {
            return $this->handleImageElement($mediaElement);
        } elseif ($mediaElement instanceof MediaReferencedElement) {
            return $this->handleMediaElement($mediaElement);
        } else {
            return null;
        }
    }
1126939
public function renderForContent(ContentInfo $contentInfo, Request $request, array $options = array())
    {
        return $this->doRender(
            $options + array(
                'shortname' => $this->shortName,
                'identifier' => $contentInfo->id,
                // TODO: Use translated name
                'title' => $contentInfo->name,
                'count' => $this->count,
            )
        );
    }
1312726
public static function minify($content, array $options = [])
    {
        $compressor = new Minifier();

        if (array_key_exists('remove_important_comments', $options)) {
            $compressor->removeImportantComments($options['remove_important_comments']);
        }

        if (array_key_exists('keep_source_map_comment', $options)) {
            $compressor->keepSourceMapComment($options['keep_source_map_comment']);
        }

        return $compressor->run($content);
    }
1304193
public function table($content, $options = array())
    {
        if ('text' == $this->getType()) {
            return $content;
        }

        if (false === $options) {
            return $this->config('templates.tableend');
        }

        $tag = 'table';
        if (is_null($content)) {
            $tag = 'tablestart';
        }

        $templater = $this->templater();
        return $templater->format('table', [
        'attrs' => $templater->formatAttributes($this->_mergeAttributes($options, $this->config('attributes.table'))),
        'content' => $content
        ]);
    }
1375063
public function get_formatted_content($options = array()) {
        $this->obtain_view_data();
        if (empty($this->content)) {
            return '';
        }
        if ($this->contentisformatted) {
            return $this->content;
        }

        // Improve filter performance by preloading filter setttings for all
        // activities on the course (this does nothing if called multiple
        // times)
        filter_preload_activities($this->get_modinfo());

        $options = (array)$options;
        if (!isset($options['context'])) {
            $options['context'] = $this->get_context();
        }
        return format_text($this->content, FORMAT_HTML, $options);
    }
357035
public static function a($href, $content = '', $title = '', $target = '', $options = [])
    {
        $a_tag_tpl = '<a href="%s" title="%s" target="%s"%s>%s</a>';
        return sprintf($a_tag_tpl, $href, $title, $target, self::assembleTagOptions($options), $content);
    }
763550
public static function renderElement($type, $content, $options = [])
    {
        $tag = ArrayHelper::remove($options, 'tag', 'div');

        $class = ArrayHelper::remove($options, 'class');
        Html::addCssClass($options, 'ui ' . $class . ' ' . $type);

        return Html::tag($tag, $content, $options);
    }
352837
public function write($content, $options = 448) : void
    {
        $json = json_encode($content, $options) . ($options & JSON_PRETTY_PRINT ? "\n" : '');
        parent::write($json);
    }
980969
public function channelsVideo($channel, $options = null)
    {
        $availableOptions = ['limit', 'offset', 'broadcasts', 'hls'];

        $query = [];

        //  Filter the available options
        foreach ($availableOptions as $option) {

            if (isset($options[ $option ])) {

                $query[ $option ] = $options[ $option ];
            }
        }

        $parameters = $this->getDefaultHeaders();
        $parameters[ 'query' ] = $query;

        $response = $this->client->get('/kraken/channels/' . $channel . '/videos', $parameters);

        return $response->json();
    }
6840
public function render($video, $options = array()) {
        $helper = $this->_getSpecializedHelper($video);
        return $helper->render($video, $options);
    }
736697
private function formatRequest($content, array $options)
    {
        $docOptions = ['type', 'language', 'content', 'gcsContentUri'];
        $options += [
            'encodingType' => 'UTF8',
            'type' => 'PLAIN_TEXT',
            'detectGcsUri' => true
        ];

        if ($content instanceof StorageObject) {
            $options['gcsContentUri'] = $content->gcsUri();
        } elseif ($options['detectGcsUri'] && substr($content, 0, 5) === 'gs://') {
            $options['gcsContentUri'] = $content;
        } else {
            $options['content'] = $content;
        }

        unset($options['detectGcsUri']);

        foreach ($options as $option => $value) {
            if (in_array($option, $docOptions)) {
                $options['document'][$option] = $value;
                unset($options[$option]);
            }
        }

        return $options;
    }
1315846
public static function modalFooter($content, $htmlOptions = array())
    {
        self::addCssClass('modal-footer', $htmlOptions);
        return self::tag('div', $htmlOptions, $content);
    }
267426
protected function renderTextareaWidget($content, array $options = [])
    {
        $options = array_replace([
            'html' => false,
        ], $options);

        return $this->renderBlock('show_widget_textarea', [
            'content' => $content,
            'options' => $options,
        ]);
    }
1126430
public function youtube($id, array $options = [])
    {
        $options = optionsParser($options, [
            'allowfullscreen' => 'allowfullscreen',
            'height' => 480,
            'ratio' => '16by9',
            'width' => 640,
        ]);

        return self::iframe(sprintf('https://www.youtube.com/embed/%s', $id), $options->toArray());
    }
410773
protected function renderTinymceWidget($content, array $options = [])
    {
        $height = isset($options['height']) ? intval($options['height']) : 0;
        if (0 >= $height) {
            $height = 250;
        }
        return $this->renderBlock('show_widget_tinymce', [
            'height' => $height,
            'route' => $content
        ]);
    }