Posts Tagged WordPress

Enabling HTML5 for Blipblip.tv in WordPress plugin Video Sidebar Widgets

English Begin E

The problem

Visiting my blog from a tablet I noticed that theBlip.Tv videos I set in Video Sidebar Widgets were not shown. Doing a research I realized the plugin loaded the old flash-based player  instead of the HTML5 version, so videos coudn’t be played from mobile devices with not flash support, which are the majority of the handheld systems nowadays.

The solution

I just had to add some conditionals in files helper-functions.php and class-videosidebarwidget.php to consider the Blipblip.tv case and thus I added the HTM5 player. In particular, I added the following lines to helper-functions.php:

elseif($admin=="true"){
 if($source == "Blip"){
 echo "\n<iframe src=\"$value.html?p=1\" width=\"250\" height=\"250\" 
 frameborder=\"0\" allowfullscreen>
 </iframe> 
 
 <embed type=\"application/x-shockwave-flash\" src=\"http://a.blip.tv/api.swf#$v_id2\" 
 style=\"display:none\">
 </embed>\n\n"; 
 }else{ 
 // echo video in admin
 echo "\n<object width=\"212\" height=\"172\">\n";
 echo $flashvar;
 echo "<param name=\"allowfullscreen\" value=\"true\" />\n";
 echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
 echo "<param name=\"movie\" value=\"$value\" />\n";
 echo "<param name=\"wmode\" value=\"transparent\">\n";
 echo "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
 echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
 echo $flashvar2;
 echo "width=\"212\" height=\"172\">\n";
 echo "</embed>\n";
 echo "</object>\n\n";
 }
}else{

And in file class-videosidebarwidget.php I edited the below code:


case 'Blip': $rv_value = "http://blip.tv/play/$Embed_id"; $rv_flashvar = ""; $rv_flashvar2 = ""; $rv_cap = $Embed_cap;

And I added the following lines:

if($select_source == "Blip"){ 
 echo "\n<iframe align=\"left\" src=\"$rv_value.html?p=1\" width=\"$RV_width\" height=\"$RV_height\" 
 frameborder=\"0\" allowfullscreen>
 </iframe>
 
 <embed type=\"application/x-shockwave-flash\" src=\"http://a.blip.tv/api.swf#$Embed_id\" 
 style=\"display:none\">
 </embed>\n\n";
}else{
 echo "\n<object width=\"$RV_width\" height=\"$RV_height\">\n";
 echo $rv_flashvar;
 echo "<param name=\"allowfullscreen\" value=\"true\" />\n";
 echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
 echo "<param name=\"movie\" value=\"$rv_value\" />\n";
 echo "<param name=\"wmode\" value=\"transparent\">\n";
 echo "<embed src=\"$rv_value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
 echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
 echo $rv_flashvar2;
 echo "width=\"$RV_width\" height=\"$RV_height\">\n";
 echo "</embed>\n";
 echo "</object>\n\n";
 }
 if(!empty($rv_cap)){echo "<p class=\"VideoCaption\">$rv_cap</p>\n\n";};
 
 
 echo $after_widget;
 }

After these changes random HTM5 videos are loaded without problems.

Plugin support

By the way, I tried to contact the plugin developer to include these changes and he said he had not time for doing it. It a shame it’s not open-sourced so somebody else can maintain the code.


,

No Comments

Luis’ Blog now supports smartphones (Android, Apple, Others)

WPTouch OK

Due to I’m writing some post related to Android, and browsing some sites on Internet, I decided to do a research to offer the mobile version for smartphones. Just install the WPtouch plugin at the plugin manager and you will have the support enabled.

WPtouch and qTranslate

If your site has more than one language and you uses qTranslate, since version 1.9.10 WPtouch integrates with this plugin but in a very basic level, I mean, just with post links. If you have set other aspect on your site, then you have edit the scripts.

WPTouch mal

For example, I have set my site title in two languages, to make it parse it right I had to edit this file../wptouch/themes/core/core-functions.php, at line 122 as follow:

function wptouch_core_body_sitetitle() {
 $str = bnc_get_header_title();
 echo __(stripslashes($str));

 }

In other words, I had to add the __( ) invocation as explained at qTranslate’s forum

References

,

2 Comments

Sociable plugin hack for bit.ly

Sociable WordPress Plugin

I was testing some plugins for allowing my visitor to share my posts in social networks like Twitter ot Facebook and the one I liked it the most was Sociable. ButI realized it used awe.sw for shorten URLs with Twitter and Identi.ca, but awe.sw service is colapsed and they’re not longer inviting new people. Thus, I started to research some ways to make it work with Bit.ly and I found this post that explains exactly what I wanted to, however they use the file_get_contents function, which throws this error in my server:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /home/g/gallardo/web/wp-content/plugins/sociable/sociable.php on line 813

This is because the allow_url_fopen variable is not enabled in PHP. After asking my hosting provider, they recommended me to use cURL instead of file_get_contents,so I had to make some modifications to the sociable.php file, and I had to add a new one called sociable-bitly.php where all URLs are shorten with cURL.

I put both files into the sociable.3.5.2-hacked.zip zip, just in case somebody needs it. But be aware, it’s not the whole plugin, I just put these file to be copied into the /sociable folder in the official plugin.  Another thing to keep in mind is that you have to edit the sociable-bitly.php with your Bit.ly login and API Key information in the following lines:

$bitlylogin = 'yourbitlylogin';
$bitlyapikey= 'yourbitlyapikey';

Other things can be done with this plugin, for instance all awe.se code can be removed, the Bit.ly input files can be added to the setting panel, or it can be integrated with tinyurl. I hope next official version comes with some of these features.

References:

,

2 Comments

Automatic full backup on cPanel

logo_cpanelYesterday I had some issues with the WordPress 2.8 update and, supposedly,  qtranslate (a plugin to support several languages). The thing is I could restore WordPress 2.7.1 from an old backup, but I realized it dated from a month ago…bad, bad. I decided to do a research on automatic full-backup with cpanel and I came across the Automatic cPanel backup (domain & MySQL) with cron & PHP post by Justin Cook .This is a php script to perform the cPanel‘s full backup request with ftp redirection to a remote host. Due to I don’t have an ftp server, I changed some lines to make the backup locally, so I could get those backups from cPanel full-backup tool. Here’s what I did:

PHP Script

You can download the script from Github here.

Cron jobs

In order to have the backup made every 15 days just save the above script as fullbackup.php and set cron in cPanel‘s tool as shown next:

cron-cpanel-web

References

,

17 Comments

Multilingual WordPress posts

Translating WordPress

As you can, see some of my posts have an English and Spanish version that is loaded according to your browser’s default language or by clicking on your language flag from the right sidebar. You might think it’s some kind of auto-translate function provided by Google or Yahoo’s Babel Fish, but it’s not.

Read the rest of this entry »

,

No Comments