'300', 'width' => '400', 'alt' => '

'.__('The Flash plugin is required to view this object.', 'swfobj').'

', 'allowfullscreen' => 'false', 'required_player_version' => '8.0.0', 'express_install_swf' => get_bloginfo('wpurl').'/wp-content/plugins/swfobj/'.'expressInstall.swf' ); $saved_options = get_option($this->admin_options_saved); if (!empty($saved_options)) { foreach($saved_options as $key => $val) { $admin_options[$key] = $val; } } update_option($this->admin_options_saved, $admin_options); return $admin_options; } function init() { $this->get_options(); ?>

'."\n"; } // Add Javascript to end of page to register all swf objects. function swfobj_footer() { global $registered_objects; // register any swf files on the page if (count($registered_objects) > 0) { echo ' '."\n"; } } // [swfobj] shortcode handler function swfobj_func($atts, $content='') { global $registered_objects; $defaults = $this->get_options(); extract(shortcode_atts(array( 'src' => '', 'width' => $defaults['width'], 'height' => $defaults['height'], 'alt' => $defaults['alt'], 'allowfullscreen' => $defaults['allowfullscreen'], 'id' => 'swfobj_'.count($registered_objects), 'name' => false, 'class' => false, 'align' => false, 'required_player_version' => $defaults['required_player_version'], 'express_install_swf' => $defaults['express_install_swf'] /*, // these options are not yet supported * play * loop * menu * quality * scale * salign * wmode * bgcolor * base * swliveconnect * flashvars * devicefont [ http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_13331 ] * allowscriptaccess [ http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16494 ] and [ http://www.adobe.com/go/kb402975 ] * seamlesstabbing [ http://www.adobe.com/support/documentation/en/flashplayer/7/releasenotes.html ] * allownetworking [ http://livedocs.adobe.com/flash/9.0/main/00001079.html ] */ ), $atts)); // Add this object to the array so it will be registered in the header $registered_objects[] = array('id' => $id, 'required_player_version' => $required_player_version, 'express_install_swf' => $express_install_swf); $swfobj = ' '.(($allowfullscreen=='true')?' ':'').'

'.$alt.'

'; return $swfobj; } function swfobj_options_page() { $options = $this->get_options(); if ($_POST['options_update']) { // Update current options to the values submitted foreach ($options as $option => $value) { if (isset($_POST[$option])) { $options[$option] = $_POST[$option]; } } update_option($this->admin_options_saved, $options); ?>

false, 'class' => false, 'align' => false, */ ?>

     

'.$media_swfobj_title.''; } function media_upload_flash() { if ( isset($_POST['html-upload']) && !empty($_FILES) ) { // Upload File button was clicked $id = media_handle_upload('async-upload', $_REQUEST['post_id']); unset($_FILES); if ( is_wp_error($id) ) { $errors['upload_error'] = $id; $id = false; } } if ( !empty($_POST['insertonlybutton']) ) { $href = $_POST['insertonly']['href']; if ( !empty($href) && !strpos($href, '://') ) $href = "http://$href"; $title = attribute_escape($_POST['insertonly']['title']); if ( empty($title) ) $title = basename($href); if ( !empty($title) && !empty($href) ) $html = "[swfobj src='$href' title='$title']"; return media_send_to_editor($html); } if ( !empty($_POST) ) { $return = media_upload_form_handler(); if ( is_string($return) ) return $return; if ( is_array($return) ) $errors = $return; } if ( isset($_POST['save']) ) $errors['upload_notice'] = __('Saved.'); return wp_iframe( 'media_upload_type_form', 'flash', $errors, $id ); } function modify_post_mime_types($post_mime_types) { $post_mime_types['application/x-shockwave-flash'] = array(__('Flash', 'swfobj'), __('Manage Flash', 'swfobj'), __ngettext_noop('Flash (%s)', 'Flash (%s)', 'swfobj')); return $post_mime_types; } function modify_media_send_to_editor($html) { if ( isset($_POST['send']) ) { $keys = array_keys($_POST['send']); $send_id = (int) array_shift($keys); $flashobj = $_POST['attachments'][$send_id]; $url = $flashobj['url']; $title = stripslashes( htmlspecialchars ($flashobj['post_title'], ENT_QUOTES)); $alt = stripslashes( htmlspecialchars ($flashobj['post_content'], ENT_QUOTES)); $html = '[swfobj src="'.$url.'"'.( ($alt != '') ? ' alt="'.$alt.'"' : '' ).'] '; } return $html; } function flash_attachment_fields_to_edit($form_fields, $post) { if ( substr($post->post_mime_type, -5) == 'flash' ) { $form_fields['post_title']['required'] = true; unset( $form_fields['post_excerpt'] ); // $form_fields['post_excerpt']['label'] = __('Caption'); // $form_fields['post_excerpt']['helps'][] = __('Not currently used.'); // 'Alternate text, e.g. "The Mona Lisa"' $form_fields['post_content']['label'] = __('Alternate html'); $form_fields['post_content']['helps'][] = __('Displayed when Flash is unavailable, e.g. "<p>Cool Flash game.</p>"'); } return $form_fields; } } // end SwfObj class } if (class_exists("SwfObj")) { $swfobj = new SwfObj(); } function type_form_flash() { return '
*
*
' . __('Link text, e.g. "Lucy on YouTube"') . '
'; } //Initialize the admin panel if (!function_exists("swfobj_ap")) { function swfobj_ap() { global $swfobj; if (!isset($swfobj)) { return; } if (function_exists('add_options_page')) { add_options_page(__('SwfObj Default Settings', 'swfobj'), 'SwfObj', 8, basename(__FILE__), array(&$swfobj, 'swfobj_options_page')); } } } // Actions and Filters if (isset($swfobj)) { // Actions add_action('wp_head', array(&$swfobj, 'swfobj_header'), 100); add_action('wp_footer', array(&$swfobj, 'swfobj_footer'), 100); add_action('admin_menu', 'swfobj_ap', 100); add_action('activate_swfobj/swfobj.php', array(&$swfobj, 'init')); add_action('media_buttons', array(&$swfobj, 'addMediaButton'), 20); add_action('media_upload_flash', array(&$swfobj, 'media_upload_flash')); // Filters add_filter('post_mime_types', array(&$swfobj, 'modify_post_mime_types')); add_filter('async_upload_flash', 'get_media_item', 10, 2); add_filter('media_send_to_editor', array(&$swfobj, 'modify_media_send_to_editor')); add_filter('attachment_fields_to_edit', array(&$swfobj, 'flash_attachment_fields_to_edit'), 10, 2); // Shortcodes // check if shortcodes exist just so this plugin doesn't kill WordPress on versions < 2.5 if ( function_exists('add_shortcode') ) { add_shortcode('swfobj', array(&$swfobj, 'swfobj_func')); } } ?>