function jwplayer_wp_head() { global $post; if (!(is_single() || is_page()) || !get_option(LONGTAIL_KEY . "facebook")) return; $config_values = array(); $attachment = null; $settings = array(); $meta_header_id = get_post_meta($post->ID, LONGTAIL_KEY . "fb_headers_id", true); $meta_header_config = get_post_meta($post->ID, LONGTAIL_KEY . "fb_headers_config", true); if (empty($meta_header_id)) { return; } else if (is_numeric($meta_header_id)) { $attachment = get_post($meta_header_id); $title = $attachment->post_title; $description = $attachment->post_content; $thumbnail = get_post_meta($meta_header_id, LONGTAIL_KEY . "thumbnail_url", true); if (!isset($thumbnail) || $thumbnail == null || $thumbnail == "") { $image_id = get_post_meta($meta_header_id, LONGTAIL_KEY . "thumbnail", true); if (isset($image_id)) { $image_attachment = get_post($image_id); $thumbnail = !empty($image_attachment) ? $image_attachment->guid : ""; } } $settings[] = "file=" . $attachment->guid; } else { $title = $post->post_title; $description = $post->post_excerpt; $thumbnail = ""; $settings[] = "file=$meta_header_id"; } if (!empty($meta_header_config) && $meta_header_config != "") { LongTailFramework::setConfig($meta_header_config); } else { LongTailFramework::setConfig(get_option(LONGTAIL_KEY . "default")); } $config_values = LongTailFramework::getConfigValues(); $width = isset($config_values["width"]) ? $config_values["width"] : ""; $height = isset($config_values["height"]) ? $config_values["height"] : ""; foreach ($config_values as $key => $value) { $settings[] = "$key=$value"; } $settings_string = htmlspecialchars(implode("&", $settings)); $facebook_url = LongTailFramework::getPlayerURL(); if ($settings_string) $facebook_url .= "?$settings_string"; $output = ""; $output .= "<meta property='og:type' content='movie' />"; $output .= "<meta property='og:video:width' content='$width' />"; $output .= "<meta property='og:video:height' content='$height' />"; $output .= "<meta property='og:video:type' content='application/x-shockwave-flash' />"; $output .= "<meta property='og:title' content='" . htmlspecialchars($title) . "' />"; $output .= "<meta property='og:description' content='" . htmlspecialchars($description) . "' />"; $output .= "<meta property='og:image' content='$thumbnail' />"; $output .= "<meta property='og:video' content='$facebook_url' />"; echo $output; }
private function init() { //Set the config flashvar to the Player configuration path if ($this->conf != "") { $this->fvars["config"] = $this->conf; } $events = array(); $modeAttrs = array(); //Populate the values used for the embed process. $this->config["jwplayer"]["files"][$this->id] = array("flashplayer" => $this->path, "width" => $this->dim["width"], "height" => $this->dim["height"], "controlbar" => $this->dim["controlbar"], "wmode" => $this->dim["wmode"]); foreach ($this->fvars as $key => $value) { if (isset(self::$events[$key])) { $events[$key] = urldecode(html_entity_decode($value)); } else { if ($key == "html5_file" || $key == "download_file") { $modeAttrs[$key] = $value; } else { $this->config["jwplayer"]["files"][$this->id][$key] = $value; } } } $this->config["jwplayer"]["files"][$this->id]["events"] = $events; if (!empty($modeAttrs)) { $modes = array(); $mode = new stdClass(); $mode->type = "flash"; $mode->src = LongTailFramework::getPlayerURL(); $modes[] = $mode; foreach ($modeAttrs as $key => $value) { $mode = new stdClass(); $mode->config = new stdClass(); $mode->config->file = $value; $mode->config->streamer = ""; $mode->config->provider = ""; if ($key == "html5_file") { $mode->type = "html5"; } else { $mode->type = "download"; } $modes[] = $mode; } $this->config["jwplayer"]["files"][$this->id]["modes"] = $modes; } }
/** * Generates the SWFObjectConfig object which acts as a wrapper for the SWFObject javascript library. * @param array $flashVars The array of flashVars to be used in the embedding * @return SWFObjectConfig The configured SWFObjectConfig object to be used for embedding */ public static function generateSWFObject($flash_vars, $useJWEmbedder = false) { if ($useJWEmbedder) { return new JWEmbedderConfig(LongTailFramework::$div_id++, LongTailFramework::getPlayerURL(), LongTailFramework::getConfigURL(), LongTailFramework::getEmbedParameters(), $flash_vars); } return new SWFObjectConfig(LongTailFramework::$div_id++, LongTailFramework::getPlayerURL(), LongTailFramework::getConfigURL(), LongTailFramework::getEmbedParameters(), $flash_vars); }
function create_mode_block($atts) { $modes = array(); $playerMode = get_option(LONGTAIL_KEY . "player_mode", true); $flashMode = new stdClass(); $flashMode->type = "flash"; $flashMode->src = LongTailFramework::getPlayerURL(); $html5Mode = new stdClass(); $html5Mode->type = "html5"; $html5Mode->config = new stdClass(); $html5Mode->config->streamer = ""; $html5Mode->config->provider = ""; if (array_key_exists("html5_file", $atts)) { $html5Mode->config->file = $atts["html5_file"]; } $downloadMode = new stdClass(); $downloadMode->type = "download"; $downloadMode->config = new stdClass(); $downloadMode->config->streamer = ""; $downloadMode->config->provider = ""; if (array_key_exists("download_file", $atts)) { $downloadMode->config->file = $atts["download_file"]; } if ($playerMode == "html5") { $modes[] = $html5Mode; $modes[] = $flashMode; } else { $modes[] = $flashMode; $modes[] = $html5Mode; } $modes[] = $downloadMode; return $modes; }
/** * Generates the SWFObjectConfig object which acts as a wrapper for the SWFObject javascript library. * @param $flash_vars * @param bool $useJWEmbedder * @param string $customLocation * * @internal param array $flashVars The array of flashVars to be used in the embedding * @return SWFObjectConfig The configured SWFObjectConfig object to be used for embedding */ public static function generateSWFObject($flash_vars, $useJWEmbedder = false, $customLocation = "") { $playerLocation = $customLocation ? $customLocation . "player.swf" : LongTailFramework::getPlayerURL(); if ($useJWEmbedder) { return new JWEmbedderConfig(LongTailFramework::$div_id++, $playerLocation, LongTailFramework::getConfigURL(), LongTailFramework::getEmbedParameters(), $flash_vars, LongTailFramework::$current_config); } return new SWFObjectConfig(LongTailFramework::$div_id++, $playerLocation, LongTailFramework::getConfigURL(), LongTailFramework::getEmbedParameters(), $flash_vars, LongTailFramework::$current_config); }
function generateModeString(&$atts, $id) { $html5 = $atts["html5_file"]; if (!isset($html5) || $html5 == null || $html5 == "") { $html5 = get_post_meta($id, LONGTAIL_KEY . "html5_file", true); } if (!isset($html5) || $html5 == null || $html5 == "") { $html5_id = get_post_meta($id, LONGTAIL_KEY . "html5_file_selector", true); if (isset($html5_id)) { $html5_attachment = get_post($html5_id); $html5 = $html5_attachment->guid; } } $download = $atts["download_file"]; if (!isset($download) || $download == null || $download == "") { $download = get_post_meta($id, LONGTAIL_KEY . "download_file", true); } if (!isset($download) || $download == null || $download == "") { $download_id = get_post_meta($id, LONGTAIL_KEY . "download_file_selector", true); if (isset($download_id)) { $download_attachment = get_post($download_id); $download = $download_attachment->guid; } } if (isset($html5) || isset($download)) { $mode = "[{type: \"flash\", src: \"" . LongTailFramework::getPlayerURL() . "\"}"; if (isset($html5)) { $mode .= ", {type: \"html5\", config: {\"file\": \"{$html5}\", \"streamer\": \"\", \"provider\": \"\"}}"; } if (isset($download)) { $mode .= ", {type: \"download\", config: {\"file\": \"{$download}\", \"streamer\": \"\", \"provider\": \"\"}}"; } $mode .= "]"; $atts["modes"] = $mode; } }