示例#1
0
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;
}
示例#2
0
 /**
  * Processes the final submission of the wizard to be saved as a player
  * configuration.
  * @return Array The array of configuration options to be saved.
  */
 private function processSubmit()
 {
     $data = LongTailFramework::getConfigValues();
     $plugins = array();
     foreach ($_POST as $name => $value) {
         if (strstr($name, LONGTAIL_KEY . "player_")) {
             $val = esc_html($value);
             $new_val = $val;
             $new_name = str_replace(LONGTAIL_KEY . "player_", "", $name);
             if ($new_name == "skin") {
                 if ($new_val != "[Default]") {
                     $skins = LongTailFramework::getSkins();
                     $new_val = LongTailFramework::getSkinURL() . $val . "." . $skins[$val];
                     $data[$new_name] = $new_val;
                 }
             } else {
                 if ($new_name == "flashvars") {
                     $this->parseFlashvarString($new_val, $data);
                 } else {
                     if (!empty($new_val)) {
                         $data[$new_name] = $new_val;
                     } else {
                         unset($data[$new_name]);
                     }
                 }
             }
         } else {
             if (strstr($name, LONGTAIL_KEY . "plugin_") && strstr($name, "_enable")) {
                 $plugins[str_replace("_enable", "", str_replace(LONGTAIL_KEY . "plugin_", "", $name))] = esc_html($value);
                 //Process the plugin flashvars.
             } else {
                 if (strstr($name, LONGTAIL_KEY . "plugin_") && !empty($value)) {
                     $plugin_key = preg_replace("/_/", ".", str_replace(LONGTAIL_KEY . "plugin_", "", $name), 1);
                     $found = false;
                     foreach (array_keys($plugins) as $repo) {
                         $key = explode(".", $plugin_key);
                         if (strstr($repo, $key[0]) && $plugins[$repo]) {
                             $data[$plugin_key] = esc_html($value);
                             $found = true;
                             break;
                         }
                     }
                     if (!$found) {
                         unset($data[$plugin_key]);
                     }
                 }
             }
         }
     }
     $active_plugins = array();
     //Build final list of plugins to be used for this Player.
     foreach ($plugins as $name => $enabled) {
         if ($enabled) {
             $active_plugins[] = $name;
         }
     }
     $plugin_string = implode(",", $active_plugins);
     if (!empty($plugins)) {
         $data["plugins"] = $plugin_string;
     }
     if ($data["plugins"] == "" || empty($data["plugins"])) {
         unset($data["plugins"]);
     }
     return $data;
 }
 /**
  * Generates the list of flashvars supported by this version of the player along with
  * their defaults.
  * @return A structured array of the flashvars.
  */
 private static function loadPlayerFlashVars()
 {
     $f_vars = array();
     //Load the player xml file.
     $xml = simplexml_load_file(LongTailFramework::$dir . "/player.xml");
     $config_file = LongTailFramework::$current_config_values;
     $config_values = LongTailFramework::getConfigValues();
     //Process the flashvars in the player xml file.
     foreach ($xml->flashvars as $flash_vars) {
         $f_var = array();
         $f_var_section = (string) $flash_vars["section"];
         $f_var_advanced = (string) $flash_vars["type"];
         //Ignore the flashvars categorized as "None."
         if ($f_var_advanced != "None") {
             foreach ($flash_vars as $flash_var) {
                 $default = (string) $flash_var->{"default"};
                 //If the config file was loaded and has an entry for the current flashvar
                 //use the value in the config file.
                 if ($config_file && $config_file->{$flash_var->name}) {
                     unset($config_values[(string) $flash_var->name]);
                     $default = (string) $config_file->{$flash_var->name};
                     $default = str_replace(LongTailFramework::getSkinURL(), "", $default);
                     $default = preg_replace("/(\\.swf|\\.zip)/", "", $default);
                 }
                 $values = (array) $flash_var->select;
                 $val = $values["option"];
                 $type = (string) $flash_var["type"];
                 //Load the possible values for the skin flashvar.
                 if ($flash_var->name == "skin") {
                     $type = "select";
                     $val = array_keys(LongTailFramework::getSkins());
                 }
                 $temp_var = new FlashVar((string) $flash_var->name, $default, (string) $flash_var->description, $val, $type);
                 $f_var[(string) $flash_var->name] = $temp_var;
             }
             $f_vars[$f_var_advanced][$f_var_section] = $f_var;
         }
     }
     unset($config_values["plugins"]);
     unset($config_values["ltas.cc"]);
     LongTailFramework::getPlugins($config_values);
     if ($config_values) {
         LongTailFramework::$loaded_additional_flash_vars = LongTailFramework::flattenAdditionalFlashVars($config_values);
     }
     LongTailFramework::$loaded_flash_vars = $f_vars;
 }
示例#4
0
    /**
     * @see AdminState::render()
     */
    public function render()
    {
        $plugins = LongTailFramework::getPlugins();
        $configValues = LongTailFramework::getConfigValues();
        $pluginString = explode(",", $configValues["plugins"]);
        $pluginList = array();
        foreach ($pluginString as $pluginStr) {
            $pluginList[$pluginStr] = $pluginStr;
        }
        ?>
    <div class="wrap">

      <script type="text/javascript">
        jQuery(function () {
          jQuery('#tabs').tabs();
          removeAllTabs();
          jQuery("<?php 
        echo "#" . LONGTAIL_KEY . "plugin_selector_tab";
        ?>
").css("display", "block");
          <?php 
        foreach ($plugins as $plugin) {
            ?>
            <?php 
            if ($plugin->isEnabled()) {
                ?>
              jQuery("<?php 
                echo "#" . LONGTAIL_KEY . "plugin_" . $plugin->getRepository() . "_tab";
                ?>
").css("display", "block");
            <?php 
            }
            ?>
          <?php 
        }
        ?>
          jQuery("#tabs").css("display", "block");
          jQuery(":checkbox").change(function() {
            var name = "#" + jQuery(this)[0].name.replace("enable", "tab");
            var hidden = jQuery(this)[0].name + "_hidden";
            if(jQuery(this)[0].checked) {
              jQuery(name).css("display", "block");
              jQuery(name).val(true);
            } else {
              jQuery(name).css("display", "none");
              jQuery(name).val(false);
            }
          })
        });

        function removeAllTabs() {
          jQuery("#tabNavigation").children().css("display","none");
        }
      </script>

      <form name="<?php 
        echo LONGTAIL_KEY . "form";
        ?>
" method="post" action="">
        <?php 
        parent::getBreadcrumbBar();
        ?>
        <?php 
        $this->selectedPlayer();
        ?>
        <p/>
        <div id="tabs">

          <ul id="tabNavigation">
            <?php 
        $id = LONGTAIL_KEY . "plugin_selector";
        ?>
            <li id="<?php 
        echo $id . "_tab";
        ?>
"><a href="<?php 
        echo "#" . $id;
        ?>
">Plugin Selector</a></li>
            <?php 
        foreach ($plugins as $plugin) {
            ?>
              <?php 
            $id = LONGTAIL_KEY . "plugin_" . $plugin->getRepository();
            ?>
              <li id="<?php 
            echo $id . "_tab";
            ?>
"><a href="<?php 
            echo "#" . $id;
            ?>
"><?php 
            echo $plugin->getTitle();
            ?>
</a></li>
            <?php 
        }
        ?>
          </ul>

          <div id="<?php 
        echo LONGTAIL_KEY . "plugin_selector";
        ?>
">
            <table class="form-table">
              <?php 
        foreach ($plugins as $plugin) {
            ?>
                <?php 
            $name = LONGTAIL_KEY . "plugin_" . $plugin->getRepository() . "_" . "enable";
            ?>
                <?php 
            $value = isset($_POST[$name]) ? $_POST[$name] : $plugin->isEnabled();
            ?>
                <?php 
            unset($_POST[$name]);
            ?>
                <tr valign="top">
                  <th>Enable <?php 
            echo $plugin->getTitle();
            ?>
:</th>
                  <td>
                    <input name="<?php 
            echo $name;
            ?>
" type="checkbox" value="1" <?php 
            checked(true, $value);
            ?>
 />
                    <input name="<?php 
            echo $name . "_hidden";
            ?>
" type="hidden" value="0"/>
                    <span class="description"><?php 
            echo $plugin->getDescription() . "  <a href=" . $plugin->getPage() . JW_PLAYER_GA_VARS . " target=_blank>Learn more...</a>";
            ?>
</span>
                  </td>
                </tr>
                <tr>
                  <td colspan="2"></td>
                </tr>
              <?php 
        }
        ?>
            </table>
          </div>

          <?php 
        foreach ($plugins as $plugin) {
            ?>
            <?php 
            unset($pluginList[$plugin->getRepository()]);
            ?>
            <div id="<?php 
            echo LONGTAIL_KEY . "plugin_" . $plugin->getRepository();
            ?>
">
              <table class="form-table">
                <?php 
            foreach (array_keys($plugin->getFlashVars()) as $plugin_flash_vars) {
                ?>
                  <?php 
                $p_vars = $plugin->getFlashVars();
                ?>
                  <?php 
                foreach ($p_vars[$plugin_flash_vars] as $plugin_flash_var) {
                    ?>
                    <tr valign="top">
                      <?php 
                    $name = LONGTAIL_KEY . "plugin_" . $plugin->getPluginPrefix() . "_" . $plugin_flash_var->getName();
                    ?>
                      <?php 
                    $value = isset($_POST[$name]) ? $_POST[$name] : $plugin_flash_var->getDefaultValue();
                    ?>
                      <?php 
                    unset($_POST[$name]);
                    ?>
                      <th><?php 
                    echo $plugin->getPluginPrefix() . "." . $plugin_flash_var->getName();
                    ?>
:</th>
                      <td>
                        <?php 
                    if ($plugin_flash_var->getType() == FlashVar::SELECT) {
                        ?>
                          <select size="1" name="<?php 
                        echo $name;
                        ?>
">
                            <?php 
                        foreach ($plugin_flash_var->getValues() as $val) {
                            ?>
                              <option value="<?php 
                            echo $val;
                            ?>
" <?php 
                            selected($val, $value);
                            ?>
>
                                <?php 
                            echo htmlentities($val);
                            ?>
                              </option>
                            <?php 
                        }
                        ?>
                          </select>
                        <?php 
                    } else {
                        ?>
                        <input type="text" value="<?php 
                        echo $value;
                        ?>
" name="<?php 
                        echo $name;
                        ?>
" />
                        <?php 
                    }
                    ?>
                        <span class="description"><?php 
                    echo $plugin_flash_var->getDescription();
                    ?>
</span>
                      </td>
                    </tr>
                  <?php 
                }
                ?>
                <?php 
            }
            ?>
              </table>
            </div>
          <?php 
        }
        ?>
        </div>

        <?php 
        $this->getFooter($pluginList);
        ?>
        <?php 
        $this->buttonBar(PluginState::getID(), true, false);
        ?>

      </form>
    </div>
  <?php 
    }
示例#5
0
function generate_embed_code($atts)
{
    $version = version_compare(get_option(LONGTAIL_KEY . "version"), "5.3", ">=");
    $embedder = file_exists(LongTailFramework::getEmbedderPath());
    if (!$embedder && !$version && preg_match("/iP(od|hone|ad)/i", $_SERVER["HTTP_USER_AGENT"])) {
        $youtube_pattern = "/youtube.com\\/watch\\?v=([0-9a-zA-Z_-]*)/i";
        $loaded_config = LongTailFramework::getConfigValues();
        $width = isset($atts["width"]) ? $atts["width"] : $loaded_config["width"];
        $height = isset($atts["height"]) ? $atts["height"] : $loaded_config["height"];
        $output = "";
        if (preg_match($youtube_pattern, $atts["file"], $match)) {
            $output = '<object width="' . $width . '" height="' . $height . '"><param name="movie" value="http://www.youtube.com/v/' . $match[1] . '&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $match[1] . '&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' . $width . '" height="' . $height . '"></embed></object>';
        } else {
            $output = '<video src="' . $atts["file"] . '" width="' . $width . '" height="' . $height . '" controls="controls"></video>';
        }
        return $output;
    } else {
        if (get_option(LONGTAIL_KEY . "player_location_enable")) {
            $swf = LongTailFramework::generateSWFObject($atts, $embedder, get_option(LONGTAIL_KEY . "player_location"));
        } else {
            $swf = LongTailFramework::generateSWFObject($atts, $embedder);
        }
        if (!get_option(LONGTAIL_KEY . "use_head_js")) {
            insert_embedder($embedder);
        }
        return $swf->generateEmbedScript();
    }
}