/** * The handler for replacing the [jwplayer] shortcode. * @global undefined $wpdb Reference to the WordPress database. * @param array $atts The parsed attributes. * @return string The script to replace the tag. */ function jwplayer_handler($atts) { $version = version_compare(get_option(LONGTAIL_KEY . "version"), "5.3", ">="); $embedder = file_exists(LongTailFramework::getEmbedderPath()); $test = $atts; global $wpdb; $config = ""; $default = get_option(LONGTAIL_KEY . "default"); $image = ""; if (LongTailFramework::configExists($atts["config"])) { $config = $atts["config"]; } else { if (LongTailFramework::configExists($default)) { $config = $default; } else { unset($atts["config"]); } } if (isset($atts["mediaid"])) { resolve_media_id($atts); } if (empty($image)) { $image = $atts["image"]; } if (isset($atts["playlistid"])) { $id = $atts["playlistid"]; if (is_numeric($id)) { $playlist = get_post($id); } if ($playlist) { if ($version && $embedder) { $atts["file"] = get_option('siteurl') . '/' . 'index.php?xspf=true&id=' . $id; } else { $atts["file"] = urlencode(get_option('siteurl') . '/' . 'index.php?xspf=true&id=' . $id); } } else { return __("[PLAYLIST not found]"); } unset($atts["playlistid"]); } if (is_feed() || get_option(LONGTAIL_KEY . "show_archive") && (is_archive() || is_search())) { $out = ''; // remove media file from RSS feed if (!empty($image)) { $loaded_config = LongTailFramework::getConfigValues(); $width = isset($atts["width"]) ? $atts["width"] : $loaded_config["width"]; $height = isset($atts["height"]) ? $atts["height"] : $loaded_config["height"]; $out .= '<br /><img src="' . $image . '" width="' . $width . '" height="' . $height . '" alt="media" /><br />' . "\n"; } return $out; } return generate_embed_code($config, $atts); }
/** * The handler for replacing the [jwplayer] shortcode. * @param array $atts The parsed attributes. * @return string The script to replace the tag. */ function jwplayer_handler($atts) { $embedder = file_exists(LongTailFramework::getEmbedderPath()); $config = ""; $default = get_option(LONGTAIL_KEY . "default"); $image = ""; if (isset($atts["config"]) && LongTailFramework::configExists($atts["config"])) { $config = $atts["config"]; } else { if (LongTailFramework::configExists($default)) { $config = $default; } else { unset($atts["config"]); } } LongTailFramework::setConfig($config); if (isset($atts["mediaid"])) { resolve_media_id($atts); } if (!array_key_exists("file", $atts)) { $atts["file"] = isset($atts["html5_file"]) ? $atts["html5_file"] : ""; } if (empty($image)) { $image = isset($atts["image"]) ? $atts["image"] : ""; } if ($embedder) { $atts["modes"] = create_mode_block($atts); } if (isset($atts["playlistid"])) { $id = $atts["playlistid"]; $playlist = ""; if (is_numeric($id)) { $playlist = get_post($id); } if ($playlist) { if ($embedder) { $atts["playlist"] = generate_playlist($id); } else { $atts["file"] = urlencode(get_option('siteurl') . '/' . 'index.php?xspf=true&id=' . $id); } } else { return __("[PLAYLIST not found]", 'jw-player-plugin-for-wordpress'); } unset($atts["playlistid"]); } $loaded_config = LongTailFramework::getConfigValues(true); $atts = array_merge($loaded_config, $atts); unset($atts["config"]); unset($atts["html5_file"]); unset($atts["download_file"]); if (is_feed()) { $out = ''; // remove media file from RSS feed if (!empty($image)) { $width = isset($atts["width"]) ? $atts["width"] : $loaded_config["width"]; $height = isset($atts["height"]) ? $atts["height"] : $loaded_config["height"]; $out .= '<br /><img src="' . $image . '" width="' . $width . '" height="' . $height . '" alt="media" /><br />' . "\n"; } return $out; } return generate_embed_code($atts); }