Esempio n. 1
0
 /**
  * Render the flash player
  */
 function render($mode, &$R, $data)
 {
     if ($mode != 'xhtml') {
         return false;
     }
     if (is_null($data)) {
         return false;
     }
     if ($data['align'] == 0) {
         $align = 'none';
     }
     if ($data['align'] == 1) {
         $align = 'right';
     }
     if ($data['align'] == 2) {
         $align = 'left';
     }
     if ($data['align'] == 3) {
         $align = 'center';
     }
     if ($data['title']) {
         $title = ' title="' . hsc($data['title']) . '"';
     }
     if (is_a($R, 'renderer_plugin_dw2pdf')) {
         // Output for PDF renderer
         $R->doc .= '<div class="vshare__' . $align . '"
                          width="' . $data['width'] . '"
                          height="' . $data['height'] . '">';
         $R->doc .= '<a href="' . $data['url'] . '" class="vshare">';
         $R->doc .= '<img src="' . DOKU_BASE . 'lib/plugins/vshare/video.png" />';
         $R->doc .= '</a>';
         $R->doc .= '<br />';
         $R->doc .= '<a href="' . $data['url'] . '" class="vshare">';
         $R->doc .= $data['title'] ? hsc($data['title']) : 'Video';
         $R->doc .= '</a>';
         $R->doc .= '</div>';
     } else {
         // Normal output
         if ($data['type'] == 'flash') {
             // embed flash
             $R->doc .= '<div class="vshare__' . $align . '"' . $title . '>';
             $R->doc .= html_flashobject($data['url'], $data['width'], $data['height'], $data['vars'], $data['vars']);
             $R->doc .= '</div>';
         } else {
             // embed iframe
             $R->doc .= '<iframe ';
             $R->doc .= buildAttributes(array('src' => $data['url'], 'height' => $data['height'], 'width' => $data['width'], 'class' => 'vshare__' . $align, 'allowfullscreen' => '', 'frameborder' => 0, 'scrolling' => 'no'));
             $R->doc .= '>' . hsc($data['title']) . '</iframe>';
         }
     }
 }
Esempio n. 2
0
 /**
  * Renders internal and external media
  *
  * @author Andreas Gohr <*****@*****.**>
  * @param string $src       media ID
  * @param string $title     descriptive text
  * @param string $align     left|center|right
  * @param int    $width     width of media in pixel
  * @param int    $height    height of media in pixel
  * @param string $cache     cache|recache|nocache
  * @param bool   $render    should the media be embedded inline or just linked
  * @return string
  */
 function _media($src, $title = null, $align = null, $width = null, $height = null, $cache = null, $render = true)
 {
     $ret = '';
     list($ext, $mime) = mimetype($src);
     if (substr($mime, 0, 5) == 'image') {
         // first get the $title
         if (!is_null($title)) {
             $title = $this->_xmlEntities($title);
         } elseif ($ext == 'jpg' || $ext == 'jpeg') {
             //try to use the caption from IPTC/EXIF
             require_once DOKU_INC . 'inc/JpegMeta.php';
             $jpeg = new JpegMeta(mediaFN($src));
             if ($jpeg !== false) {
                 $cap = $jpeg->getTitle();
             }
             if (!empty($cap)) {
                 $title = $this->_xmlEntities($cap);
             }
         }
         if (!$render) {
             // if the picture is not supposed to be rendered
             // return the title of the picture
             if (!$title) {
                 // just show the sourcename
                 $title = $this->_xmlEntities(utf8_basename(noNS($src)));
             }
             return $title;
         }
         //add image tag
         $ret .= '<img src="' . ml($src, array('w' => $width, 'h' => $height, 'cache' => $cache, 'rev' => $this->_getLastMediaRevisionAt($src))) . '"';
         $ret .= ' class="media' . $align . '"';
         if ($title) {
             $ret .= ' title="' . $title . '"';
             $ret .= ' alt="' . $title . '"';
         } else {
             $ret .= ' alt=""';
         }
         if (!is_null($width)) {
             $ret .= ' width="' . $this->_xmlEntities($width) . '"';
         }
         if (!is_null($height)) {
             $ret .= ' height="' . $this->_xmlEntities($height) . '"';
         }
         $ret .= ' />';
     } elseif (media_supportedav($mime, 'video') || media_supportedav($mime, 'audio')) {
         // first get the $title
         $title = !is_null($title) ? $this->_xmlEntities($title) : false;
         if (!$render) {
             // if the file is not supposed to be rendered
             // return the title of the file (just the sourcename if there is no title)
             return $title ? $title : $this->_xmlEntities(utf8_basename(noNS($src)));
         }
         $att = array();
         $att['class'] = "media{$align}";
         if ($title) {
             $att['title'] = $title;
         }
         if (media_supportedav($mime, 'video')) {
             //add video
             $ret .= $this->_video($src, $width, $height, $att);
         }
         if (media_supportedav($mime, 'audio')) {
             //add audio
             $ret .= $this->_audio($src, $att);
         }
     } elseif ($mime == 'application/x-shockwave-flash') {
         if (!$render) {
             // if the flash is not supposed to be rendered
             // return the title of the flash
             if (!$title) {
                 // just show the sourcename
                 $title = utf8_basename(noNS($src));
             }
             return $this->_xmlEntities($title);
         }
         $att = array();
         $att['class'] = "media{$align}";
         if ($align == 'right') {
             $att['align'] = 'right';
         }
         if ($align == 'left') {
             $att['align'] = 'left';
         }
         $ret .= html_flashobject(ml($src, array('cache' => $cache), true, '&'), $width, $height, array('quality' => 'high'), null, $att, $this->_xmlEntities($title));
     } elseif ($title) {
         // well at least we have a title to display
         $ret .= $this->_xmlEntities($title);
     } else {
         // just show the sourcename
         $ret .= $this->_xmlEntities(utf8_basename(noNS($src)));
     }
     return $ret;
 }
Esempio n. 3
0
 /**
  * Renders internal and external media
  *
  * @author Andreas Gohr <*****@*****.**>
  */
 function _media($src, $title = NULL, $align = NULL, $width = NULL, $height = NULL, $cache = NULL, $render = true)
 {
     $ret = '';
     list($ext, $mime, $dl) = mimetype($src);
     if (substr($mime, 0, 5) == 'image') {
         // first get the $title
         if (!is_null($title)) {
             $title = $this->_xmlEntities($title);
         } elseif ($ext == 'jpg' || $ext == 'jpeg') {
             //try to use the caption from IPTC/EXIF
             require_once DOKU_INC . 'inc/JpegMeta.php';
             $jpeg = new JpegMeta(mediaFN($src));
             if ($jpeg !== false) {
                 $cap = $jpeg->getTitle();
             }
             if ($cap) {
                 $title = $this->_xmlEntities($cap);
             }
         }
         if (!$render) {
             // if the picture is not supposed to be rendered
             // return the title of the picture
             if (!$title) {
                 // just show the sourcename
                 $title = $this->_xmlEntities(basename(noNS($src)));
             }
             return $title;
         }
         //add image tag
         $ret .= '<img src="' . ml($src, array('w' => $width, 'h' => $height, 'cache' => $cache)) . '"';
         $ret .= ' class="media' . $align . '"';
         // make left/right alignment for no-CSS view work (feeds)
         if ($align == 'right') {
             $ret .= ' align="right"';
         }
         if ($align == 'left') {
             $ret .= ' align="left"';
         }
         if ($title) {
             $ret .= ' title="' . $title . '"';
             $ret .= ' alt="' . $title . '"';
         } else {
             $ret .= ' alt=""';
         }
         if (!is_null($width)) {
             $ret .= ' width="' . $this->_xmlEntities($width) . '"';
         }
         if (!is_null($height)) {
             $ret .= ' height="' . $this->_xmlEntities($height) . '"';
         }
         $ret .= ' />';
     } elseif ($mime == 'application/x-shockwave-flash') {
         if (!$render) {
             // if the flash is not supposed to be rendered
             // return the title of the flash
             if (!$title) {
                 // just show the sourcename
                 $title = basename(noNS($src));
             }
             return $this->_xmlEntities($title);
         }
         $att = array();
         $att['class'] = "media{$align}";
         if ($align == 'right') {
             $att['align'] = 'right';
         }
         if ($align == 'left') {
             $att['align'] = 'left';
         }
         $ret .= html_flashobject(ml($src, array('cache' => $cache), true, '&'), $width, $height, array('quality' => 'high'), null, $att, $this->_xmlEntities($title));
     } elseif ($title) {
         // well at least we have a title to display
         $ret .= $this->_xmlEntities($title);
     } else {
         // just show the sourcename
         $ret .= $this->_xmlEntities(basename(noNS($src)));
     }
     return $ret;
 }
 /**
  * Create output
  */
 function render($mode, Doku_Renderer $R, $data)
 {
     if ($mode != 'xhtml') {
         return false;
     }
     $att = array();
     $att['class'] = 'media' . $data['align'];
     if ($data['align'] == 'right') {
         $att['align'] = 'right';
     }
     if ($data['align'] == 'left') {
         $att['align'] = 'left';
     }
     $params = array('skin_url' => DOKU_REL . 'lib/plugins/jukebox/skins/' . $data['skin'] . '/', 'playlist_url' => DOKU_REL . 'lib/plugins/jukebox/list.php?ns=' . $data['ns'] . '&t=', 'mainurl' => 'http://www.dokuwiki.org/plugin:jukebox', 'infourl' => 'http://www.dokuwiki.org/plugin:jukebox', 'autoload' => 'true', 'findImage' => 'true', 'useId3' => 'true');
     if ($data['shuffle']) {
         $params['shuffle'] = 'true';
     }
     if ($data['autoplay']) {
         $params['autoplay'] = 'true';
     }
     if ($data['repeat']) {
         $params['repeat'] = 'true';
     }
     $swf = DOKU_REL . 'lib/plugins/jukebox/xspf_jukebox.swf';
     $R->doc .= html_flashobject($swf, $data['width'], $data['height'], null, $params, $att);
     return true;
 }
Esempio n. 5
0
 /**
  * Renders internal and external media with exif info at bottom of each JPEG image
  *
  * @author Andreas Gohr <*****@*****.**>
  * @param string $src       media ID
  * @param string $title     descriptive text
  * @param string $align     left|center|right
  * @param int    $width     width of media in pixel
  * @param int    $height    height of media in pixel
  * @param string $cache     cache|recache|nocache
  * @param bool   $render    should the media be embedded inline or just linked
  * @return string
  */
 function _media($src, $title = null, $align = null, $width = null, $height = null, $cache = null, $render = true)
 {
     $ret = '';
     list($ext, $mime) = mimetype($src);
     if (substr($mime, 0, 5) == 'image') {
         // first get the $title
         if (!is_null($title)) {
             $title = $this->_xmlEntities($title);
         } elseif ($ext == 'jpg' || $ext == 'jpeg') {
             //try to use the caption from IPTC/EXIF
             require_once DOKU_INC . 'lib/plugins/colorbox/JpegMetaGPS.php';
             $jpeg = new JpegMetaGPS(mediaFN($src));
             if ($jpeg !== false) {
                 $cap = $jpeg->getTitle();
             }
             if (!empty($cap)) {
                 $title = $this->_xmlEntities($cap);
             }
         }
         if (!$render) {
             // if the picture is not supposed to be rendered
             // return the title of the picture
             if (!$title) {
                 // just show the sourcename
                 $title = $this->_xmlEntities(utf8_basename(noNS($src)));
             }
             return $title;
         }
         //add image tag
         if (($ext == 'jpg' || $ext == 'jpeg') && !$width && !strpos($src, 'wiki:dokuwiki')) {
             // force to scale image to 680px
             $ret .= '<img src="' . ml($src, array('w' => "680", 'h' => $height, 'cache' => $cache, 'rev' => $this->_getLastMediaRevisionAt($src))) . '"';
         } else {
             $ret .= '<img src="' . ml($src, array('w' => $width, 'h' => $height, 'cache' => $cache, 'rev' => $this->_getLastMediaRevisionAt($src))) . '"';
         }
         $ret .= ' class="media' . $align . '"';
         if ($title) {
             $ret .= ' title="' . $title . '"';
             $ret .= ' alt="' . $title . '"';
         } else {
             $ret .= ' alt=""';
         }
         if (!is_null($width)) {
             $ret .= ' width="' . $this->_xmlEntities($width) . '"';
         }
         if (!is_null($height)) {
             $ret .= ' height="' . $this->_xmlEntities($height) . '"';
         }
         // add exif and gps info at the bottom of each image
         if ($ext == 'jpg' || $ext == 'jpeg') {
             //try to use the caption from IPTC/EXIF
             if (!$jepg) {
                 require_once DOKU_INC . 'lib/plugins/colorbox/JpegMetaGPS.php';
                 $jpeg = new JpegMetaGPS(mediaFN($src));
             }
             if ($jpeg !== false) {
                 $infoshort = $jpeg->getShortExifInfo();
                 $info = $jpeg->getExifInfo();
                 $gpslink = $jpeg->getGPSInfo();
                 $ret .= ' exif="' . implode(';', array_map(function ($v, $k) {
                     if ($v) {
                         return strtolower($k) . ':' . $v . '';
                     }
                 }, $infoshort, array_keys($infoshort))) . '"';
                 if ($gpslink) {
                     $ret .= ' map="' . $gpslink . '"';
                 }
                 $ret .= ' token="' . media_get_token($src, "1360", $height) . '"';
                 $ret .= '/></a>';
                 $ret .= '<div class="exiftitle">' . $title . '</div>';
                 $ret .= '<div class="exif">';
                 $ret .= implode(', ', array_map(function ($v, $k) {
                     return $k . '=' . $v;
                 }, $info, array_keys($info)));
                 if ($gpslink) {
                     $ret .= ' <a href=' . $gpslink . '>Google GPS Location';
                 }
                 $ret .= ' </a></div>';
                 $ret .= '<a>';
             }
         }
         //
     } elseif (media_supportedav($mime, 'video') || media_supportedav($mime, 'audio')) {
         // first get the $title
         $title = !is_null($title) ? $this->_xmlEntities($title) : false;
         if (!$render) {
             // if the file is not supposed to be rendered
             // return the title of the file (just the sourcename if there is no title)
             return $title ? $title : $this->_xmlEntities(utf8_basename(noNS($src)));
         }
         $att = array();
         $att['class'] = "media{$align}";
         if ($title) {
             $att['title'] = $title;
         }
         if (media_supportedav($mime, 'video')) {
             //add video
             $ret .= $this->_video($src, $width, $height, $att);
         }
         if (media_supportedav($mime, 'audio')) {
             //add audio
             $ret .= $this->_audio($src, $att);
         }
     } elseif ($mime == 'application/x-shockwave-flash') {
         if (!$render) {
             // if the flash is not supposed to be rendered
             // return the title of the flash
             if (!$title) {
                 // just show the sourcename
                 $title = utf8_basename(noNS($src));
             }
             return $this->_xmlEntities($title);
         }
         $att = array();
         $att['class'] = "media{$align}";
         if ($align == 'right') {
             $att['align'] = 'right';
         }
         if ($align == 'left') {
             $att['align'] = 'left';
         }
         $ret .= html_flashobject(ml($src, array('cache' => $cache), true, '&'), $width, $height, array('quality' => 'high'), null, $att, $this->_xmlEntities($title));
     } elseif ($title) {
         // well at least we have a title to display
         $ret .= $this->_xmlEntities($title);
     } else {
         // just show the sourcename
         $ret .= $this->_xmlEntities(utf8_basename(noNS($src)));
     }
     return $ret;
 }
Esempio n. 6
0
 /**
  * Render the flash player
  */
 function render($mode, Doku_Renderer $R, $data)
 {
     if ($mode != 'xhtml') {
         return false;
     }
     if (is_null($data)) {
         return false;
     }
     if ($data['align'] == 0) {
         $align = 'none';
     }
     if ($data['align'] == 1) {
         $align = 'right';
     }
     if ($data['align'] == 2) {
         $align = 'left';
     }
     if ($data['align'] == 3) {
         $align = 'center';
     }
     if ($data['title']) {
         $title = ' title="' . hsc($data['title']) . '"';
     }
     if (is_a($R, 'renderer_plugin_dw2pdf')) {
         // Output for PDF renderer
         $R->doc .= '<div class="vshare__' . $align . '"
                          width="' . $data['width'] . '"
                          height="' . $data['height'] . '">';
         $R->doc .= '<a href="' . $data['url'] . '" class="vshare">';
         $R->doc .= '<img src="' . DOKU_BASE . 'lib/plugins/vshare/video.png" />';
         $R->doc .= '</a>';
         $R->doc .= '<br />';
         $R->doc .= '<a href="' . $data['url'] . '" class="vshare">';
         $R->doc .= $data['title'] ? hsc($data['title']) : 'Video';
         $R->doc .= '</a>';
         $R->doc .= '</div>';
     } else {
         // use redirector for HTTP embeds on SSL sites
         if (is_ssl() && substr($data['url'], 0, 7) == 'http://') {
             $data['url'] = DOKU_BASE . 'lib/plugins/vshare/redir.php' . '?url=' . rawurlencode($data['url']) . '&hash=' . md5(auth_cookiesalt() . 'vshare' . $data['url']);
         }
         // Normal output
         if ($data['type'] == 'flash') {
             // embed flash
             $R->doc .= '<div class="vshare__' . $align . '"' . $title . '>';
             $R->doc .= html_flashobject($data['url'], $data['width'], $data['height'], $data['vars'], $data['vars']);
             $R->doc .= '</div>';
         } else {
             // embed iframe
             $R->doc .= '<iframe ';
             $R->doc .= buildAttributes(array('src' => $data['url'], 'height' => $data['height'], 'width' => $data['width'], 'class' => 'vshare__' . $align, 'allowfullscreen' => '', 'frameborder' => 0, 'scrolling' => 'no'));
             $R->doc .= '>' . hsc($data['title']) . '</iframe>';
         }
     }
 }
Esempio n. 7
0
 function render($mode, &$renderer, $data)
 {
     if ($mode != 'xhtml') {
         return false;
     }
     // prevent caching to ensure the included pages are always fresh
     $renderer->info['cache'] = false;
     // flash movie options, input filtering
     $options['width'] = (int) (is_numeric($data['width']) ? $data['width'] : $this->getConf('width'));
     $options['height'] = (int) (is_numeric($data['height']) ? $data['height'] : $this->getConf('height'));
     $options['tcolor'] = hsc(isset($data['tcolor']) ? $data['tcolor'] : $this->getConf('tcolor'));
     $options['tcolor2'] = hsc(isset($data['tcolor2']) ? $data['tcolor2'] : $this->getConf('tcolor2'));
     $options['hicolor'] = hsc(isset($data['hicolor']) ? $data['hicolor'] : $this->getConf('hicolor'));
     $options['bgcolor'] = hsc(isset($data['bgcolor']) ? $data['bgcolor'] : $this->getConf('bgcolor'));
     $options['speed'] = (int) (is_numeric($data['speed']) ? $data['speed'] : $this->getConf('speed'));
     $options['distr'] = hsc(isset($data['distr']) ? $data['distr'] : $this->getConf('distr'));
     $options['max'] = (int) (is_numeric($data['max']) ? $data['max'] : $this->getConf('max'));
     $options['show'] = $data['show'];
     if ($options['show'] == 'tag') {
         $options['show'] = 'tags';
     }
     if ($options['show'] == 'namespace') {
         $options['show'] = 'namespaces';
     }
     // get the tag cloud...
     $tagcloud = $this->_getTagXml($options);
     // add random seeds to so name and movie url to avoid collisions and force reloading (needed for IE)
     $movie = 'cumulus/tagcloud.swf';
     if (!file_exists(DOKU_PLUGIN . $movie)) {
         $renderer->doc .= $this->getLang('filenotfound');
         return true;
     }
     $movie = DOKU_BASE . 'lib/plugins/' . $movie . '?r=' . rand(0, 9999999);
     // write flash tag
     $params = array('allowScriptAccess' => 'always', 'bgcolor' => '#' . $options['bgcolor']);
     if ($this->getConf('trans')) {
         $params['wmode'] = 'transparent';
     }
     $flashvars = array('tcolor' => '0x' . $options['tcolor'], 'tcolor2' => '0x' . ($options['tcolor2'] == "" ? $options['tcolor'] : $options['tcolor2']), 'hicolor' => '0x' . ($options['hicolor'] == "" ? $options['tcolor'] : $options['hicolor']), 'tspeed' => (int) $options['speed'], 'distr' => $options['distr'] ? 'true' : 'false', 'mode' => 'tags', 'tagcloud' => '<tags>' . $tagcloud . '</tags>');
     if ($this->getConf('showtags')) {
         $alt = '<div id="cloud">';
     } else {
         $alt = '<div id="cloud" style="display:none;">';
     }
     $alt .= preg_replace('/style=".*?"/', '', urldecode($tagcloud));
     $alt .= '</div>' . DOKU_LF;
     $alt .= '<p>Download <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better for full experience.</p>' . DOKU_LF;
     $renderer->doc .= html_flashobject($movie, $options['width'], $options['height'], $params, $flashvars, null, $alt);
     return true;
 }
Esempio n. 8
0
/**
 * Print the media upload form if permissions are correct
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function media_uploadform($ns, $auth)
{
    global $lang;
    if ($auth < AUTH_UPLOAD) {
        return;
    }
    //fixme print info on missing permissions?
    // The default HTML upload form
    $form = new Doku_Form(array('id' => 'dw__upload', 'action' => DOKU_BASE . 'lib/exe/mediamanager.php', 'enctype' => 'multipart/form-data'));
    $form->addElement('<div class="upload">' . $lang['mediaupload'] . '</div>');
    $form->addElement(formSecurityToken());
    $form->addHidden('ns', hsc($ns));
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeFileField('upload', $lang['txt_upload'] . ':', 'upload__file'));
    $form->addElement(form_makeCloseTag('p'));
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeTextField('id', '', $lang['txt_filename'] . ':', 'upload__name'));
    $form->addElement(form_makeButton('submit', '', $lang['btn_upload']));
    $form->addElement(form_makeCloseTag('p'));
    if ($auth >= AUTH_DELETE) {
        $form->addElement(form_makeOpenTag('p'));
        $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check'));
        $form->addElement(form_makeCloseTag('p'));
    }
    html_form('upload', $form);
    // prepare flashvars for multiupload
    $opt = array('L_gridname' => $lang['mu_gridname'], 'L_gridsize' => $lang['mu_gridsize'], 'L_gridstat' => $lang['mu_gridstat'], 'L_namespace' => $lang['mu_namespace'], 'L_overwrite' => $lang['txt_overwrt'], 'L_browse' => $lang['mu_browse'], 'L_upload' => $lang['btn_upload'], 'L_toobig' => $lang['mu_toobig'], 'L_ready' => $lang['mu_ready'], 'L_done' => $lang['mu_done'], 'L_fail' => $lang['mu_fail'], 'L_authfail' => $lang['mu_authfail'], 'L_progress' => $lang['mu_progress'], 'L_filetypes' => $lang['mu_filetypes'], 'L_info' => $lang['mu_info'], 'L_lasterr' => $lang['mu_lasterr'], 'O_ns' => ":{$ns}", 'O_backend' => 'mediamanager.php?' . session_name() . '=' . session_id(), 'O_maxsize' => php_to_byte(ini_get('upload_max_filesize')), 'O_extensions' => join('|', array_keys(getMimeTypes())), 'O_overwrite' => $auth >= AUTH_DELETE, 'O_sectok' => getSecurityToken(), 'O_authtok' => auth_createToken());
    $var = buildURLparams($opt);
    // output the flash uploader
    ?>
        <div id="dw__flashupload" style="display:none">
        <div class="upload"><?php 
    echo $lang['mu_intro'];
    ?>
</div>
        <?php 
    echo html_flashobject('multipleUpload.swf', '500', '190', null, $opt);
    ?>
        </div>
        <?php 
}
 /**
  * Create output
  */
 function render($mode, Doku_Renderer $R, $data)
 {
     if ($mode != 'xhtml') {
         return false;
     }
     $att = array();
     $att['class'] = 'media' . $data['align'];
     if ($data['align'] == 'right') {
         $att['align'] = 'right';
     }
     if ($data['align'] == 'left') {
         $att['align'] = 'left';
     }
     $R->doc .= html_flashobject($data['swf'], $data['width'], $data['height'], $data['data'], $data['data'], $att);
     return true;
 }