← WordPress

Duvida plugin featured video + embed...

Lida 3156 vezes

Offline

LCDVLLuis 
Membro
Mensagens 72 Gostos 0
Troféus totais: 25
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 50 Posts

Boas, criei o http://www.1sthumour.com/
E tenho um problemazinho
Eu uso na sidebar um plugin que me vai buscar no post videos e depois os coloca a rodar na sidebar...
O plugin é o http://pressography.com/plugins/featured-video/

O meu problema é que ja fui ao painel de admin
e dizer em que categorias pesquisar os videos tudo bem...
Mas eu pa por os videos com aquelas bordas que podem ver aqui:
http://www.1sthumour.com/jill-and-kevin-wedding-casamento-e-divorcio/
Eu usei o codigo embed...
E o plugin usa este codigo
[youtube:url to your video] (e.g. [youtube:]) or taggged [googlevideo:url] (e.g. [googlevideo:http://video.google.com/googleplayer.swf?docid=8577255250907450469])

Eu com o embed ele não me vai buscar os videos so funciona e ja testei utilizador como o plugin diz..
Mas assim fico sem puder uzar aquelas bordas XPTO´s que o youtube tem...

Sabem de alguma maneira de usar o plugin com o codigo embed do youtube sem ser com ex:
[youtube:url to your video]
Offline

LCDVLLuis 
Membro
Mensagens 72 Gostos 0
Troféus totais: 25
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 50 Posts

Pessoal podem ajudar?
Offline

Roberto Francisco 
Membro
Mensagens 669 Gostos 1
Feedback +3

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Eu já trabalhei com este plugin mas nunca lhe meti vídeos...

O que me parece é que o plugin não interpreta as tags de formatação logo não mostra o vídeo.

Se meteres só o link do vídeo o que é que te aparece?
Offline

LCDVLLuis 
Membro
Mensagens 72 Gostos 0
Troféus totais: 25
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 50 Posts

Pois mas eu pretendo usar com o embed porque com o embed tenho acesso aquele quadro a volta do video aqueles personalizados...
Só se houver outro plugin, esse até vinha com o próprio theme...
Offline

João Godinho 
Membro
Mensagens 1755 Gostos 2
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Mas no plugin deve vir o codigo do video com o php nos campos para modificar o video, tenta modificá-lo.

Não sei se me fiz entender.
Offline

LCDVLLuis 
Membro
Mensagens 72 Gostos 0
Troféus totais: 25
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 50 Posts

Não percebo nada disto o plugin é apenas isto:
Preciso é que seja o embed do youtube completo em vez do [youtube: LINK] do plugin
Código: [Seleccione]
<?php

/*

Plugin Name: Featured Video

Plugin URI: http://pressography.com/plugins/featured-video/

Description: Plugin/Widget to automatically feature your YouTube or Google video in the sidebar

Date: January 14, 2008

Author: Pressography

Author URI: http://www.pressography.com

Version: 1.2



Based on code from Paul Bain's EasyTube plugin at

http://www.ejump.co.uk/wordpress/easytube-plugin-for-wordpress/

*/



/*

Author: Pressography

Website: http://www.Pressography.com

Copyright 2008 Premier MicroSolutions, LLC All Rights Reserved.



This software is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



If you make any changes to this plugin, please let me know - I'm

always looking for better features and uses for my stuff!

*/



global $wpdb$table_prefix;

if (isset(
$wpdb->prefix)) {

    
$prefix $wpdb->prefix;

} else {

    
$prefix $table_prefix;

}



function 
vsf_show_favorite() {      

    
$options get_option('vsf_options');   

    echo 
$options['video'];

}



add_action('publish_post','vsf_get_latest_video');

add_action('edit_post','vsf_get_latest_video');

add_action('delete_post','vsf_get_latest_video');



add_filter('the_content','vsf_tube_content');

add_filter('the_content','vsf_googlevideo_content');



function 
vsf_show_video(){

    
$options get_option('vsf_options');

    echo 
'<div class="featuredvideo">' $options['video'] . "</div>";

}                           



function 
vsf_get_latest_video($postid) {

    global 
$vsf_table$wpdb$prefix;

    

    
$options get_option('vsf_options');

    
$vid '';

                                          

    if (
$options['category'] != '') {

        
$catsql='AND (';

        foreach (
explode(",",$options['category']) as $cat) {

           
$catsql .= "{$prefix}term_taxonomy.term_id = {$cat} OR ";

        }

        
$catsql substr($catsql,0,-4) . ")";

        
$sql "SELECT distinct ID, post_title, post_date, post_content                          

            FROM 
{$prefix}posts, {$prefix}term_relationships, {$prefix}term_taxonomy

            WHERE 
{$prefix}posts.ID = {$prefix}term_relationships.object_id

            AND 
{$prefix}term_relationships.term_taxonomy_id = {$prefix}term_taxonomy.term_taxonomy_id

            AND 
{$prefix}term_taxonomy.taxonomy = 'category'

            
{$catsql}

            AND post_status = 'publish' 

            AND post_type != 'page'"


        
$posts = (array)$wpdb->get_results($sql);

        

        
$regex '/\[(youtube:|googlevideo:)(.*?)]/i';

        foreach (
$posts as $post) {            

            if (
$vid == '') {                                  

                if (
preg_match($regex$post->post_content$matches) > 0) { 

                    
$parts explode(" "$matches[2]);     

                        

                    
$vidpart explode('=',$parts[0],2);

                    
$vidpart $vidpart[1];               

                    

                    
$type explode(':',$matches[0],2);

                    

                    if (
$type[0]  == "[googlevideo"

                        
$vid '<object class="embed" width="'$options['width'] .'" height="'$options['height'] .'" type="application/x-shockwave-flash" data="http://video.google.com/googleplayer.swf?docId='.$vidpart.'&autoplay='.$options['autoplay'].'"><param name="wmode" value="transparent" /<param name="movie" value="http://video.google.com/googleplayer.swf?docId='.$vidpart.'&autoplay='.$options['autoplay'].'" /><embed style="width:'$options['width'] .'px; height:'$options['height'] .'px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId='.$vidpart.'&autoplay='.$options['autoplay'].'&hl=en" flashvars=""> </embed><em>You need to have flashplayer enabled to watch this Google video</em></object>';

                    else if (
$type[0] == "[youtube"

                        
$vid '<object class="embed" width="'$options['width'] .'" height="'$options['height'] .'" type="application/x-shockwave-flash" data="http://www.youtube.com/v/'.$vidpart.'&autoplay='.$options['autoplay'].'"><param name="wmode" value="transparent" /><param name="movie" value="http://www.youtube.com/v/'.$vidpart.'&autoplay='.$options['autoplay'].'" /><embed src="http://www.youtube.com/v/'.$vidpart.'&autoplay='.$options['autoplay'].'" type="application/x-shockwave-flash" wmode="transparent" width="'$options['width'] .'" height="'$options['height'] .'"></embed><em>You need to a flashplayer enabled browser to view this YouTube video</em></object>';            

                    

                    if (
$options['link'] != '')

                        
$vid .= '<div class="link"><a href="'.get_permalink($post->ID).'">'.$options['link'].'</a></div>';

                }

            }

        }

    }

    if (
$vid == '') {

        
$vid '<p>There is no video to display just yet</p>';

    }

    

    
$options['video']=$vid;

    
update_option('vsf_options',$options);

}                                                          



function 
vsf_tube_content($content) {

    
$regex '/\[youtube:(.*?)]/i';

preg_match_all$regex$content$matches );

for($x=0$x<count($matches[0]); $x++)

{

$parts explode(" "$matches[1][$x]);

if(count($parts) > 1)

{

$videxplode('=',$parts[0],2);

$vid $vid[1];

$width $parts[1];

if(count($parts) > 2)

{

$height $parts[2];

}

else

{

$height "";

}

$replace '<object class="embed" width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://www.youtube.com/v/'.$vid.'"><param name="movie" value="http://www.youtube.com/v/'.$vid.'" /><param name="wmode" value="transparent" /><em>You need to a flashplayer enabled browser to view this YouTube video</em></object>';

}

else

{

$videxplode('=',$matches[1][$x]);

$vid $vid[1];

$replace '<object class="embed" width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/'.$vid.'"><param name="wmode" value="transparent" /><param name="movie" value="http://www.youtube.com/v/'.$vid.'" /><em>You need to a flashplayer enabled browser to view this YouTube video</em></object>';

}

        
$content str_replace($matches[0][$x], $replace$content);

}

return $content;

}



function 
vsf_googlevideo_content($content)

{

    
$regex '/\[googlevideo:(.*?)]/i';

preg_match_all$regex$content$matches );

for($x=0$x<count($matches[0]); $x++)

{

$parts explode(" "$matches[1][$x]);

if(count($parts) > 1)

{

$videxplode('=',$parts[0]);

$vid $vid[1];

$width $parts[1];

if(count($parts) > 2)

{

$height $parts[2];

}

else

{

$height "";

}

$replace '<object class="embed" width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://video.google.com/googleplayer.swf?docId='.$vid.'">v<param name="movie" value="http://video.google.com/googleplayer.swf?docId='.$vid.'" /><em>You need to have flashplayer enabled to watch this Google video</em></object>';

}

else

{

$videxplode('=',$matches[1][$x]);

$vid $vid[1];

$replace '<object class="embed" width="425" height="350" type="application/x-shockwave-flash" data="http://video.google.com/googleplayer.swf?docId='.$vid.'"><param name="wmode" value="transparent" /<param name="movie" value="http://video.google.com/googleplayer.swf?docId='.$vid.'" /><em>You need to have flashplayer enabled to watch this Google video</em></object>';

}

$content str_replace($matches[0][$x], $replace$content);

}

return $content;

}



//=============================================

// Adds The Necessary Table

//=============================================

function vsf_install() {     

    global 
$vsf_table$wpdb;

    
$options '';

    
$options get_option('vsf_options');

    if(
$options == '') {

        
//Not installed, add the necessary default options

        
$options['video'] = '<p>There is no video to display just yet</p>';

        
$options['height'] = '250';

        
$options['width'] = '300';

        
$options['category'] = '0';

        
$options['link'] = '';

        
$options['autoplay'] = '0';

        
update_option('vsf_options'$options);

    }

    
//else, the table is already there - do nothing

}                



//=============================================

    // Displays The Options Panel

    //=============================================

    
function vsf_options_panel() {

        global 
$vsf_table;

        
$error '';

        

        
vsf_install();

        
$options get_option('vsf_options');

            

        if (isset(
$_POST['info_update'])) {

            
//Strip the slashes

                
if (get_magic_quotes_gpc()) {

                   function 
vsf_stripslashes_deep($value)

                   {

                       
$value is_array($value) ?

                                   
array_map('vsf_stripslashes_deep'$value) :

                                   
stripslashes($value);

                       return 
$value;

                   }

        

                   
$_POST array_map('vsf_stripslashes_deep'$_POST);

                   
$_GET array_map('vsf_stripslashes_deep'$_GET);

                   
$_COOKIE array_map('vsf_stripslashes_deep'$_COOKIE);

                }                             

                

            if (
$_POST['categoryid'] != '') {

                
$cats implode(",",$_POST['categoryid']);   

            } else {

                
$cats "";

            }

            

            
$options['height'] = $_POST['height']; 

            
$options['width'] = $_POST['width'];

            
$options['category']=  $cats;

            
$options['link'] = $_POST['link'];

            
$options['autoplay'] = $_POST['autoplay'];  

                

            
update_option('vsf_options'$options);

            

            
//Fire vsf_get_latest_video function because of the update

            
vsf_get_latest_video(0);

                                                                                                      

            if (
$error != ''

                echo 
'<div class="error"><p style="color: red"><strong>' $error '</strong></p></div>';

            else

                echo 
'<div class="updated"><p><strong>Your settings have been saved.</strong></p></div>';

        }                                                                          

        

        echo 
'<div class="wrap">';

                echo 
'<form method="post" action="">';

                echo 
'<input type="hidden" name="info_update" value="1" />';



        
//General Options

        
echo '<table width=100%><tr><td width=50% valign=top>';

        echo 
'<h2>Settings</h2>';

        echo 
'<table width=100%>';

        echo 
'<tr><td width="65%">';

        echo 
'Default Video Height:</td><td><input type="text" name="height" value="' $options['height'] . '" /></td></tr>'

        echo 
'<tr><td width="65%">';

        echo 
'Default Video Width:</td><td><input type="text" name="width" value="' $options['width'] . '" /></td></tr>';

        echo 
'<tr><td width="65%">';

        echo 
'Link Text:<br/><small>Leave blank to remove the link</small></td><td><input type="text" name="link" value="' $options['link'] . '" /></td></tr>';

        echo 
'<tr><td width="65%">Play The Video When The Page Loads?</td><td><select name="autoplay">';

        if (
$options['autoplay'] == 1) {

            echo 
'<option value="1" selected="selected">Yes</option><option value="0">No</option>';

        } else {

            echo 
'<option value="1">Yes</option><option value="0" selected="selected">No</option>';

        }

        echo 
"</select></td></tr></table>";



        
//Categories                 

        
echo '</td><td width=50% valign=top>';

        echo 
'<h2>Favorite Categories</h2>';

        echo 
'<p>Check the categories that you want the plugin to search through to find the most recently posted video.</p>';

        echo 
'<table>';

        echo 
'<tr><td></td><th>Category</th></tr>';

        
$categories get_categories('hide_empty=0'); 

        
$i=0;

        foreach (
$categories as $cat) {

            echo 
'<tr>';

            echo 
'<td><input type="checkbox" name="categoryid['.$i.']" value="'.$cat->cat_ID.'" ';

            if (
strpos(" ,".$options['category'].",",",".$cat->cat_ID.",") > 0) { //Add the ",". and ."," to each to make sure we get ,1, instead of 11, - and the space, to make sure the first category found is >0

                
echo 'CHECKED';   

            }

            echo 
" /></td>";

            echo 
'<td>'.$cat->cat_name.'</td>';

            echo 
'</tr>';        

            
$i++;

        }

        echo 
'</table>';

        echo 
'</td></tr><tr><td colspan=2>';

        echo 
'<div class="submit" style="text-align: right"><input type="submit" value="Update &raquo;" /></div>';

        echo 
'</td></tr></table>';

            

        echo 
'</form>';

        echo 
'</div>';

    }



    
//=============================================

    // Adds the Rating Dominator subpanel to the 

    // admin options panel

    //=============================================

    
function vsf_add_options_subpanel() {

        if (
function_exists('add_options_page')) {

            
add_options_page('Featured Video''Featured Video'10basename(__FILE__), 'vsf_options_panel');

        }

    }

    

    
add_action('admin_menu''vsf_add_options_subpanel');



    
//===================================

    // Widget Code

    //===================================   

    
function vsf_widget_register() {                                    

        if ( 
function_exists('register_sidebar_widget') ) {

            function 
vsf_do_widget($args) {

                
$options get_option('widget_vsf');

                

                
extract($args);

                echo 
$before_widget $before_title $options['title'] . $after_title;

                
vsf_show_favorite();

                echo 
$after_widget;

            }                                                                             

            function 
vsf_widget_control() {            

                if(!
$options get_option('widget_vsf')) $options = array('title'=>'Featured Video');   

                if ( 
$_POST["vsf-submit"] ) {

                    
$options['title'] = strip_tags(stripslashes($_POST["vsf-title"]));

                }                           

                
update_option('widget_vsf'$options);

                
$title htmlspecialchars($options['title'], ENT_QUOTES);

            
?>


                        <p><label for="vsf-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="vsf-title" name="vsf-title" type="text" value="<?php echo $title?>" /></label></p>

                        <p>You can edit the rest of the values under the Options > Featured Video page <a href="/wp-admin/options-general.php?page=videosidebar.php">here</a></p>

                        <input type="hidden" id="vsf-submit" name="vsf-submit" value="1" />

            <?php

            
}

            
register_sidebar_widget('Featured Video','vsf_do_widget');

            
register_widget_control('Featured Video''vsf_widget_control'300125'vsf');

        }

    }    

    
add_action('plugins_loaded''vsf_widget_register');

?>



Offline

Roberto Francisco 
Membro
Mensagens 669 Gostos 1
Feedback +3

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Mas no plugin deve vir o codigo do video com o php nos campos para modificar o video, tenta modificá-lo.

Não sei se me fiz entender.

O que pode fazer é abrir os ficheiros do plugin e modificar o design, pelo admin penso que não dá!
Offline

LCDVLLuis 
Membro
Mensagens 72 Gostos 0
Troféus totais: 25
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 50 Posts

O unico codigo que existe é aquele... Se der pa alterar é nesse codigo todo que pus.. Mas eu não sei fazer isso.. Alguem entende disso?
Offline

Jerson 
Elite
Mensagens 2401 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Usas wordpress? Utiliza o código de embed do Youtube, mas muda para o modo html e insere o código.
Offline

LCDVLLuis 
Membro
Mensagens 72 Gostos 0
Troféus totais: 25
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 50 Posts

Como faço isso=?