"2.1", //array of config options "swf_width" => "550", "swf_height" => "400", "swf_align" => "", "swf_version" => "9.0.0", "swf_expressInstall" => get_settings('siteurl')."/wp-content/plugins/wp-al-swfobject/expressInstall.swf", "swf_flashvars" => "", "swf_params" => "", "swf_bgcolor" => "", "swf_wmode" => "", "swf_menu" => "", "swf_quality" => "", "swf_fullscreen" => "false", "swf_allowScriptAccess" => "", "swf_attributes" => "" ); // Define General Options add_option("swfobject_version", $wp_al_swfobject_params["swfobject_version"], 'File version of SWFObject.'); add_option("swf_width", $wp_al_swfobject_params["swf_width"], 'Width for Flash Movie.'); add_option("swf_height", $wp_al_swfobject_params["swf_height"], 'Height for Flash Movie.'); add_option("swf_align", $wp_al_swfobject_params["swf_align"], 'Align for Flash Movie.'); add_option("swf_version", $wp_al_swfobject_params["swf_version"], 'Version of Flash Player.'); add_option("swf_expressInstall", $wp_al_swfobject_params["swf_expressInstall"], 'swf expressInstall'); add_option("swf_flashvars", $wp_al_swfobject_params["swf_flashvars"], 'swf flashvars'); add_option("swf_params", $wp_al_swfobject_params["swf_params"], 'swf params'); add_option("swf_bgcolor", $wp_al_swfobject_params["swf_bgcolor"], 'Background Color for Flash Movie.'); add_option("swf_wmode", $wp_al_swfobject_params["swf_wmode"], 'WMode for Flash Movie.'); add_option("swf_menu", $wp_al_swfobject_params["swf_menu"], 'Option for Activate menu for Flash Movie.'); add_option("swf_quality", $wp_al_swfobject_params["swf_quality"], 'Default quality for Flash Movie.'); add_option("swf_fullscreen", $wp_al_swfobject_params["swf_fullscreen"], 'If Allow Fullscreen mode for Flash Movie.'); add_option("swf_allowScriptAccess", $wp_al_swfobject_params["swf_allowScriptAccess"], 'swf AllowScriptAccess'); add_option("swf_attributes", $wp_al_swfobject_params["swf_attributes"], 'swf attributes'); function wp_al_swfobject_get_config() { // get config options into array var global $wp_al_swfobject_params; static $config; if ( empty($config) ) { foreach( $wp_al_swfobject_params as $option => $default) { $config[$option] = get_option($option); } } return $config; } /************************************************** * add SWFObject to header ***************************************************/ function wp_al_swfobject_add_header() { $wp_al_swfobject_config = wp_al_swfobject_get_config(); $js = get_settings('siteurl')."/wp-content/plugins/wp-al-swfobject/".$wp_al_swfobject_config['swfobject_version']."/swfobject.js"; echo "\n"; echo "\n\n"; } /************************************************** * extract swf ***************************************************/ function wp_al_swfobject_parse($text) { //regexp for find swfs // [embedSWF] url ,width ,height ,align ,version ,express ,flashvars ,params ,attributes [/embedSWF] return preg_replace_callback('|\[embedSWF\]\s*(.+?)\s*(,\s*(\d+)\s*(,\s*(\d+)\s*(,\s*(.*?)\s*(,\s*([^,\s]*?)\s*(,\s*([^,\s]*?)\s*(,\s*[{]\s*(.*?)\s*[}]\s*(,\s*[{]\s*(.*?)\s*[}]\s*(,\s*[{]\s*(.*?)\s*[}]\s*)?)?)?)?)?)?)?)?\[/embedSWF\]|i', 'wp_al_swfobject_embed', $text); } /************************************************** * echo ***************************************************/ function wp_al_swfobject_echo($text) { echo wp_al_swfobject_parse($text); } /************************************************** * embed swf ***************************************************/ function wp_al_swfobject_embed($match) { global $wp_al_swfobject_random; global $wp_al_swfobject_number; $wp_al_swfobject_config = wp_al_swfobject_get_config(); $wp_al_swfobject_number++; //normalize variables $swf_url = $match[1]; $swf_width = ($match[3] != "") ? $match[3] : $wp_al_swfobject_config['swf_width']; $swf_height = ($match[5] != "") ? $match[5] : $wp_al_swfobject_config['swf_height']; $swf_align = ($match[7] != "") ? $match[7] : $wp_al_swfobject_config['swf_align']; $swf_version = ($match[9] != "") ? $match[9] : $wp_al_swfobject_config['swf_version']; $swf_express = ($match[11] != "") ? $match[11] : $wp_al_swfobject_config['swf_expressInstall']; $swf_flashvars = ($match[13] != "") ? $match[13] : ""; $swf_params = ($match[15] != "") ? $match[15] : ""; $swf_attributes = ($match[17] != "") ? $match[17] : ""; $swf_sp_params = array(); if ($wp_al_swfobject_config['swf_bgcolor'] != "") array_push($swf_sp_params, "bgcolor: \"".$wp_al_swfobject_config['swf_bgcolor']."\""); if ($wp_al_swfobject_config['swf_wmode'] != "") array_push($swf_sp_params, "wmode: \"".$wp_al_swfobject_config['swf_wmode']."\""); if ($wp_al_swfobject_config['swf_menu'] != "") array_push($swf_sp_params, "menu: \"".$wp_al_swfobject_config['swf_menu']."\""); if ($wp_al_swfobject_config['swf_quality'] != "") array_push($swf_sp_params, "quality: \"".$wp_al_swfobject_config['swf_quality']."\""); if ($wp_al_swfobject_config['swf_fullscreen'] == "true") array_push($swf_sp_params, "allowFullScreen: \"".$wp_al_swfobject_config['swf_fullscreen']."\""); if ($wp_al_swfobject_config['swf_allowScriptAccess']!= "") array_push($swf_sp_params, "allowScriptAccess: \"".$wp_al_swfobject_config['swf_allowScriptAccess']."\""); $merged_flashvars = wp_al_swfobject_merge_object( array($wp_al_swfobject_config['swf_flashvars'] , $swf_flashvars ) ); $merged_sp_params = wp_al_swfobject_merge_object( array(implode(",",$swf_sp_params) , $wp_al_swfobject_config['swf_params']) ); $merged_params = wp_al_swfobject_merge_object( array($merged_sp_params , $swf_params ) ); $merged_attributes = wp_al_swfobject_merge_object( array($wp_al_swfobject_config['swf_attributes'], $swf_attributes ) ); $swf_content = "swf".$wp_al_swfobject_random.$wp_al_swfobject_number; //content div switch ($swf_align) { case "center"; $swf_align_css = "margin: auto; margin-right: auto; "; break; case "left"; $swf_align_css = "margin-right: auto; "; break; case "right"; $swf_align_css = "margin-left: auto; "; break; default: $swf_align_css = ""; break; } $swf_alt = "This movie requires Flash Player ".$swf_version; //generate code $code = "
".$swf_alt."
\n"; switch ($wp_al_swfobject_config['swfobject_version']) { case "1.5": //SWFObject 1.5 code $code .= "\n"; break; case "2.0": case "2.1": case "2.2": //SWFObject 2.x code $code .= "\n"; break; } return $code; } /************************************************** * merge no-bracket objects to one no-bracket object * array('a:"1", b:"2"', 'a:"3", c:"4"') -> 'a:"3", b:"2", c:"4"' ***************************************************/ function wp_al_swfobject_merge_object($obj_ary) { $joined = array(); $n = count($obj_ary); if ($n == 0) return ""; if ($n == 1) return $obj_ary[0]; for ($i = 0; $i < $n; ++$i) { $o = $obj_ary[$i]; $o = preg_replace("/’|′|”|″/", "\"", $o); //ad hoc preg_match("/\s*(.*)\s*/", stripslashes($o), $match); $pairs = preg_split("/\s*,\s*/", $match[1]); foreach($pairs as $v) { if (strcmp($v, "") == 0) continue; $pair = preg_split("/\s*:\s*/", $v); $joined[$pair[0]] = $pair[1]; } } while(list($key, $value) = each($joined)) { $result .= $key.":".$value.","; } $result = substr($result, 0, strlen($result) - 1); return $result; } /************************************************** * create flashvars and params code for SWFObject 1.5 ***************************************************/ function wp_al_swfobject_create_1_5_optional_code($obj, $method) { $pairs = split(",", $obj); foreach($pairs as $v) { if(strcmp($v, "") == 0) continue; $pair = split(":", $v); if (strcmp(substr($pair[1], 0 , 1), "\"") == 0) $pair[1] = substr($pair[1], 1, strlen($pair[1]) - 1); if (strcmp(substr($pair[1], strlen($pair[1]) - 1, 1), "\"") == 0) $pair[1] = substr($pair[1], 0, strlen($pair[1]) - 1); $code .= "\tso.".$method."(\"".$pair[0]."\", \"".$pair[1]."\");\n"; } return $code; } /************************************************** * options page ***************************************************/ function wp_al_swfobject_options_page() { // update general options global $wp_al_swfobject_version; global $wp_al_swfobject_params; if (isset($_POST['swf_update'])) { check_admin_referer(); foreach( $wp_al_swfobject_params as $option => $default ) { $swf_param = trim($_POST[$option]); if ($swf_param == "") { $swf_param = $default; } update_option($option, $swf_param); } echo "

WP-Al-SWFObjectの設定を更新しました。

"; } $wp_al_swfobject_config = wp_al_swfobject_get_config(); ?>

WP-Al-SWFObject

version

Select version of SWFObject.
Width" /> x Height" />
Align for Flash Movies into Post.
" /> Enter number of flash version required for flash player.
" /> Enter the path to express-install-swf. It is displayed when the player doesn’t meet the requirement.
{} Describe the flashvars (the variable that html passes swf
(ex. name1:"value1", name2,"value2").
{} Describe the parameters when swf is embedded is described by flashvars and the same format.
Describe the supplementary setting of params
※When the same variable identifier is set by the item of params, it becomes invalid.
bgcolor: " /> Enter HEX number for background color for swf(ex. #FFFFFF).
wmode: Select wmode for movie, by defaul is window.
menu: Select option for show/hide menu.
quality: Select quality for flash movie, by default is high.
allowFullScreen: Allow Fullscreen (You must have version >= 9.0.28.0 of Flash Player).
allowScriptAccess: Select the connection mode between html and swf(You must have version >= 9.0.115.0 of Flash Player).
{} The attributes on html when swf is embedded is described by flashvars and the same format.

* The item in [embedSWF]...[/embedSWF] tag is given to priority when the same variable as the item in [embedSWF]...[/embedSWF] tag is set.

* It returns to an initial value when the blank is specified for each item.

More Information and Support

Check our links for updates and comment there if you have any problems / questions / suggestions.