'AFC Plug System ver 2.0 +', 'uri'=>'http://www.afcomponents.com/ext/wp/afc-plug-system/', 'func'=>'afc_plug_system', 'ver'=>'2.0' ); $missing_plugins = array(); foreach ($required_plugins as $plugin){ if (!function_exists($plugin['func']) && !class_exists($plugin['func'])){ $missing_plugins[] = $plugin; }elseif( $plugin['func']() < $plugin['ver'] ) { // check version $missing_plugins[] = $plugin; // plugin exists but version is missing } } return $missing_plugins; } function afc_flv_player_reqs_failed() { $missing_plugins = afc_flv_player_reqs(); if(!empty($missing_plugins) && count($missing_plugins)) { $this_plug_dir = '/afc-flv-player/'; add_menu_page('AFC FLV-Player', 'AFC FLV-Player', 9, $this_plug_dir.'menu_pages/requirements.php'); } } /* * Returns stored data associated with afc flv-player plugin */ function afc_flvp_get_options( $reset = 0) { //values used by default $def_opts = array( 'component_uri' => get_bloginfo('url').'/wp-content/plugins/afc-flv-player/component.swf', 'base_uri' => get_bloginfo('url').'/wp-content/uploads/', 'comp_tag' => 'flv', 'width' => 360, 'height' => 270, 'quicktag' => 1, 'autostart' => 0, 'bgcolor' => '0xFFFFFF', 'alt_movie_title' => 'Advanced Flash Components (www.afcomponents.com)', ); $options = $reset ? 0 : get_option('afc_flvp_options'); if (!is_array($options)){ $options = $def_opts; update_option('afc_flvp_options', $options); } return $options; } /* * Transform meta-tag into actual HTML tags */ function afc_flvp_the_content($content) { $o = afc_flvp_get_options(); $req_opts = array('height','width','autostart','title'); //open template $flv_code = file_get_contents(dirname(__FILE__).'/menu_pages/player_html.tpl'); $flv_code = str_replace('{COMPONENT_URI}',$o['component_uri'],$flv_code); preg_match_all ('!<'.(trim($o['comp_tag']) ? strtolower($o['comp_tag']) : 'flv').'([^>]*)[ ]*[/]*>!i', $content, $_matches); //locate tag if(isset($_matches[1])) { foreach($_matches[1] as $k1=>$flv_tag) { $flv_code_cur = $flv_code; preg_match_all('!(href|width|height|autostart|title|bgcolor)="([^"]*)"!i',$flv_tag,$attribs); //now create an array containing all transmitted via tag vars $flv_vars = array(); foreach($attribs[1] as $k2=>$att_name) { $flv_vars[$att_name] = $attribs[2][$k2]; } //now make sure that parameters not present are obtained from defaults foreach($req_opts as $opt_name) { if(!isset($flv_vars[$opt_name])) { $flv_vars[$opt_name] = ($o[$opt_name]=='y')?'true':$o[$opt_name]; $flv_vars[$opt_name] = $flv_vars[$opt_name]=='n'?'false':$flv_vars[$opt_name]; } } //do replace foreach($flv_vars as $att_name=>$att_value) { $flv_code_cur = str_replace('{'.strtoupper($att_name).'}', $att_value.'', $flv_code_cur); } $content = str_replace($_matches[0][$k1],$flv_code_cur,$content); } } return $content; } // adds up quicktag button functionality function afc_flvp_quicktag_button($content) { $o = afc_flvp_get_options(); if($o['quicktag']) { require_once(dirname(__FILE__).'/menu_pages/quicktag_button.php'); } return $content; } ?>