среда, 20 мая 2015 г.

Установка Uppod на DLE 10.4

$ cd /var/www/river.ru
$ vi engine/classes/parce.class.php

найти:
 $source = preg_replace_callback( "#\[media=([^\]]+)\]#i", array( &$this, 'build_media'), $source );

ниже вставить:
 $source = preg_replace( "#\[uppod=([^\]]+)\]#ies", "\$this->build_uppod('\\1')", $source );

найти:
 $txt = preg_replace( "#<!--dle_media_begin:(.+?)-->(.+?)<!--dle_media_end-->#is", '[media=\\1]', $txt );

ниже вставить:
 $txt = preg_replace( "#<!--dle_uppod_begin:(.+?)-->(.+?)<!--dle_uppod_end-->#is", '[uppod=\\1]', $txt );

найти:
 function build_url( $matches=array() ) {

выше вставить:
 function build_uppod($url) {
        global $config;
        if (!count($this->video_config)) {
            include (ENGINE_DIR . '/data/videoconfig.php');
            $this->video_config = $video_config;
        }

        $get_size = explode( ",", trim( $url ) );
        $sizes = array();

        if (count($get_size) == 2)  {
            $url = $get_size[1];
            $sizes = explode('x', trim( $get_size[0]));
            $width = intval($sizes[0]) > 0 ? intval($sizes[0]) : $this->video_config['width'];
            $height = intval($sizes[1]) > 0 ? intval($sizes[1]) : $this->video_config['height'];

            if (substr($sizes[0], - 1, 1 ) == '%') $width = $width."%";
            if (substr($sizes[1], - 1, 1 ) == '%') $height = $height."%";

        } else {
            $width = $this->video_config['width'];
            $height = $this->video_config['height'];
        }
   
        if($url == '') return;

        $option = explode('|', trim($url));

        $url = $this->clear_url($option[0]);

        $type = explode(".", $url);
        $type = strtolower(end($type));

        $decode_url = $url;

        if($option[1] != '') {           
            $option[1] = htmlspecialchars(strip_tags( stripslashes($option[1])), ENT_QUOTES, $config['charset']);
            $decode_url = $url.'|'.$option[1];   
        }
        if ($option[2] != '') {           
            $option[2] = htmlspecialchars(strip_tags( stripslashes($option[2])), ENT_QUOTES, $config['charset']);
            $decode_url = $url.'|'.$option[1].'|'.$option[2];   
        }

        $uppod_size = '';
        if ( count($sizes) == 2 ) {
            $decode_url = $width.'x'.$height.','.$decode_url;
            $uppod_size = 'style="width:'.$width.'px; height:'.$height.'px;"';
        }
       
        $preview = '';       
        if ($this->video_config['preview']) $preview = '&amp;poster={THEME}/uppod/preview.png';
        if ($this->video_config['startframe']) $preview = '';
        if($option[2] != '') $preview = '&amp;poster='.$option[2];

        $uppod_name = 'Noname';
        if($option[1] != '') $uppod_name = $option[1];

        $id_player = md5( microtime() );

        $player_type = '<param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" />';
        $style_type = 'style_video';

        if($type == 'ogg' or $type == 'mp3' or $type == 'aac') {
            $player_type = '';
            $style_type = 'style_audio';
            $preview = '';
        }
       
        return '<!--dle_uppod_begin:'.$decode_url.'-->
                <object class="uppod_'.$style_type.'" id="uppod_video_'.$id_player.'" uid="uppod_video_'.$id_player.'" type="application/x-shockwave-flash" data="{THEME}/uppod/uppod.swf" '.$uppod_size.'>
                    <param name="bgcolor" value="#000000" />
                    '.$player_type.'
                    <param name="movie" value="{THEME}/uppod/uppod.swf" />
                    <param name="flashvars" value="comment='.$uppod_name.'&amp;st={THEME}/uppod/'.$style_type.'.txt&amp;file='.$url.$preview.'" />
                </object>
                <!--dle_uppod_end-->';
   
    }

$ vi engine/ajax/upload.php

найти:
 if ( mode == "video" ) $('#imgparam3').html('<input id="playurl" name="playurl" value="[video={$video_config['width']}x{$video_config['height']},'+$(this).attr('href')+']" style="width:420px;" class="edit bk" />');
if ( mode == "audio" ) $('#imgparam3').html('<input id="playurl" name="playurl" value="[audio={$video_config['audio_width']},'+$(this).attr('href')+']" style="width:420px;" class="edit bk" />');

заменить на:
 if ( mode == "video" ) $('#imgparam3').html('<input id="playurl" name="playurl" value="[uppod='+$(this).attr('href')+']" style="width:420px;" class="edit bk" />');          
if ( mode == "audio" ) $('#imgparam3').html('<input id="playurl" name="playurl" value="[uppod='+$(this).attr('href')+']" style="width:420px;" class="edit bk" />');

в стилях шаблона прописать: 
.uppod_style_video {
  width: 500px;
  height: 375px;
}
.uppod_style_audio {
    width: 300px;
    height: 35px;
}

Комментариев нет:

Отправить комментарий