Ejemplo n.º 1
0
 public static function fetchSWFWidgetCode($widget, $paramsArray, $width, $height, $bgcolor = "#FFFFFF")
 {
     global $CFG, $PAGE;
     $lm = new \filter_poodll\licensemanager();
     if (!$lm->validate_registrationkey($CFG->filter_poodll_registrationkey)) {
         return $lm->fetch_unregistered_content();
     }
     //get our module javascript all ready to go
     $jsmodule = array('name' => 'filter_poodll', 'fullpath' => '/filter/poodll/module.js', 'requires' => array('json'));
     $widgetopts = array();
     $widgetid = \html_writer::random_id('laszlobase');
     //'lzapp_' . rand(100000, 999999);
     $widgetopts['widgetjson'] = self::fetchSWFWidgetJSON($widget, $paramsArray, $width, $height, $bgcolor, $widgetid);
     $renderer = $PAGE->get_renderer('filter_poodll');
     return $renderer->fetchLazloEmbedCode($widgetopts, $widgetid, $jsmodule);
 }
Ejemplo n.º 2
0
/**
 * Replace mp4 or flv links with player
 *
 * @param  $link
 * @return string
 */
function filter_poodll_mp4flv_callback($link)
{
    global $CFG;
    $lm = new \filter_poodll\licensemanager();
    if (!$lm->validate_registrationkey($CFG->filter_poodll_registrationkey)) {
        return $lm->fetch_unregistered_content();
    }
    //clean up url
    $url = $link[1];
    $url = str_replace('&', '&', $url);
    $url = clean_param($url, PARAM_URL);
    //use default widths or explicit width/heights if they were passed in ie http://url.to.video.mp4?d=640x480
    if (empty($link[3]) or empty($link[4])) {
        $width = $CFG->filter_poodll_videowidth;
        $height = $CFG->filter_poodll_videoheight;
    } else {
        $width = $link[3];
        $height = $link[4];
    }
    //get the url and massage it a little
    $url = $link[1];
    $rawurl = str_replace('&', '&', $url);
    //test for presence of player selectors and serve up the correct player
    //determine the file extension
    $ext = substr($link[5], -3);
    $len = strlen($link[5]);
    if (strrpos($link[5], '.mini.' . $ext) === $len - 9) {
        $returnHtml = \filter_poodll\poodlltools::fetch_miniplayer('auto', $rawurl, 'http', '', 0, 0, true);
    } else {
        if (strrpos($link[2], '.once.' . $ext) === $len - 9) {
            $returnHtml = \filter_poodll\poodlltools::fetch_onceplayer('auto', $rawurl, 'http');
        } elseif (strrpos($link[5], '.word.' . $ext) === $len - 9) {
            $word = substr($link[5], 0, $len - 9);
            $returnHtml = \filter_poodll\poodlltools::fetch_wordplayer('auto', $rawurl, $word, 0, 'http', 0, 0, true);
        } elseif (strrpos($link[5], '.audio.' . $ext) === $len - 10) {
            $returnHtml = \filter_poodll\poodlltools::fetchSimpleAudioPlayer('auto', $rawurl, 'http', $CFG->filter_poodll_audiowidth, $CFG->filter_poodll_audioheight, false, 'Play');
        } elseif (strrpos($link[5], '.inlineword.' . $ext) === $len - 15) {
            $word = substr($link[5], 0, $len - 15);
            $returnHtml = \filter_poodll\poodlltools::fetch_wordplayer('js', $rawurl, $word, 0, 'http', 0, 0, true);
        } else {
            $returnHtml = \filter_poodll\poodlltools::fetchSimpleVideoPlayer('auto', $url, $width, $height, 'http', false, true, 'Play');
        }
    }
    return $returnHtml;
}