'; } 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'] = '
'; $defaults['posthtml'] = '
'; $defaults['playerurl'] = 'https://media.dreamhost.com/mediaplayer.swf'; $defaults['videourl'] = 'http://www.yoursite.com/media.flv'; $defaults['width'] = '320'; $defaults['height'] = '240'; $defaults['autostart'] = 'n'; $defaults['xhtmlvalid'] = 'n'; $options = get_option('rmnlFLVsettings'); if (!is_array($options)){ $options = $defaults; update_option('rmnlFLVsettings', $options); } return $options; } function wpflv_options_page(){ if ($_POST['wpflv']){ $_POST['wpflv']['prehtml'] = stripslashes($_POST['wpflv']['prehtml']); $_POST['wpflv']['posthtml'] = stripslashes($_POST['wpflv']['posthtml']); update_option('rmnlFLVsettings', $_POST['wpflv']); $message = '

Options saved.

'; } $o = wpflv_get_options(); $qtyes = ($o['quicktags'] == 'y') ? ' checked="checked"' : ''; $qtno = ($o['quicktags'] == 'y') ? '' : ' checked="checked"'; $asyes = ($o['autostart'] == 'true') ? ' checked="checked"' : ''; $asno = ($o['autostart'] == 'true') ? '' : ' checked="checked"'; $xvyes = ($o['xhtmlvalid'] == 'y') ? ' checked="checked"' : ''; $xvno = ($o['xhtmlvalid'] == 'y') ? '' : ' checked="checked"'; echo <<

WP-FLV Options

{$message}
Required WP-FLV setting

To make this plugin actually do anything it is required that you set the option below correctly.

(Full) URL to flvplayer.swf

Optional WP-FLV settings

To make optimal use of the WP-FLV plugin you can set the options below.

Use Quicktag to insert FLV yes
no
Default URL to video files
Default movie size (W x H) x
Autostart movies (consider bandwidth!) yes
no
Insert XHTML valid code? yes
no
(X)HTML to be placed before each player
(X)HTML to be placed after each player

EOT; } if(strpos($_SERVER['REQUEST_URI'], 'post.php') || strpos($_SERVER['REQUEST_URI'], 'page-new.php') ) { add_action('admin_footer', 'flvAddQuicktag'); function flvAddQuickTag(){ $o = wpflv_get_options(); if($o['quicktags'] == 'y'){ echo << EOT; } } } ?>