Beispiel #1
0
 /**
  * Processes the POST data from the previous state.
  * @param AdminState $st The next state to be populated with the POST data
  * from the previous state.
  */
 private function processPost($st)
 {
     $state = $st;
     if (isset($_POST['Uninstall'])) {
         $this->uninstall();
         $state->render();
     } else {
         if (isset($_POST["Next"])) {
             if ($_POST["Next"] == "Delete") {
                 LongTailFramework::setConfig($_POST[LONGTAIL_KEY . "config"]);
                 LongTailFramework::deleteConfig();
                 $configs = LongTailFramework::getConfigs();
                 if ($configs && count($configs) >= 2 && $_POST[LONGTAIL_KEY . "config"] == get_option($_POST[LONGTAIL_KEY . "default"])) {
                     update_option(LONGTAIL_KEY . "default", $configs[1]);
                 } else {
                     if (!$configs || count($configs) == 1) {
                         update_option(LONGTAIL_KEY . "default", "Out-of-the-Box");
                     }
                 }
                 $state = new PlayerState($_POST[LONGTAIL_KEY . "config"]);
                 $del_player = $_POST[LONGTAIL_KEY . "config"];
                 $this->feedback_message("The '{$del_player}' Player was successfully deleted.");
                 $state->render();
             } else {
                 if ($_POST["Next"] == "Create Custom Player") {
                     $_POST[LONGTAIL_KEY . "new_player"] = "Custom Player";
                 }
                 $state->getNextState()->render();
             }
         } else {
             if (isset($_POST["Previous"])) {
                 $state->getPreviousState()->render();
             } else {
                 if (isset($_POST["Cancel"])) {
                     $state->getCancelState()->render();
                 } else {
                     if (isset($_POST["Save"])) {
                         $config = $_POST[LONGTAIL_KEY . "config"];
                         LongTailFramework::setConfig($config);
                         $save_values = $this->processSubmit();
                         $success = LongTailFramework::saveConfig($this->convertToXML($save_values), esc_html($_POST[LONGTAIL_KEY . "new_player"]));
                         $configs = LongTailFramework::getConfigs();
                         if ($configs && count($configs) == 2) {
                             update_option(LONGTAIL_KEY . "default", $_POST[LONGTAIL_KEY . "config"] ? $_POST[LONGTAIL_KEY . "config"] : $_POST[LONGTAIL_KEY . "new_player"]);
                             update_option(LONGTAIL_KEY . "ootb", false);
                         }
                         $save_player = $_POST[LONGTAIL_KEY . "new_player"] ? $_POST[LONGTAIL_KEY . "new_player"] : $config;
                         if ($success) {
                             $this->feedback_message("The '{$save_player}' Player was successfully saved.");
                         } else {
                             $this->error_message("The '{$save_player}' failed to save.  Please make sure the " . LongTailFramework::getConfigPath() . " exists and is writable.  " . JW_FILE_PERMISSIONS);
                         }
                         $state->getSaveState()->render();
                     } else {
                         if (isset($_POST[LONGTAIL_KEY . "default"])) {
                             update_option(LONGTAIL_KEY . "default", $_POST[LONGTAIL_KEY . "default"]);
                         }
                         if (isset($_POST[LONGTAIL_KEY . "show_archive"])) {
                             update_option(LONGTAIL_KEY . "show_archive", true);
                         } else {
                             if (!empty($_POST)) {
                                 update_option(LONGTAIL_KEY . "show_archive", false);
                             }
                         }
                         LongTailFramework::setConfig($_POST[LONGTAIL_KEY . "config"]);
                         $state->render();
                     }
                 }
             }
         }
     }
 }
    /**
     * @see AdminState::render()
     */
    public function render()
    {
        $players = LongTailFramework::getConfigs();
        if (!$players) {
            $this->infoMessage("If you wish to create custom players please make sure the " . JWPLAYER_FILES_DIR . "/configs/" . " directory exists and is writable.  This directory is necessary for creating custom players.  " . JW_FILE_PERMISSIONS);
        }
        ?>
    <div class="wrap">

      <script type="text/javascript">

        function updateHandler(button) {
          button.form.submit();
        }

        function selectionHandler(button) {
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
        }

        function copyHandler(button) {
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", "") + "_copy");
        }

        function deleteHandler(button) {
          var result = confirm("Are you sure wish to delete the Player?");
          if (result) {
            selectionHandler(button);
            return true;
          }
          return false;
        }

      </script>

      <h2>JW Player Setup</h2>
      <p><span><?php 
        echo JW_SETUP_DESC;
        ?>
</span><p>
      <?php 
        if (file_exists(LongTailFramework::getPrimaryPlayerPath())) {
            ?>
        <form name="<?php 
            echo LONGTAIL_KEY . "upgrade_form";
            ?>
" method="post" action="admin.php?page=jwplayer-update">
          <?php 
            $version = get_option(LONGTAIL_KEY . "version");
            ?>
          <?php 
            $alternate = get_option(LONGTAIL_KEY . "player_location_enable");
            ?>
          <?php 
            $location = get_option(LONGTAIL_KEY . "player_location");
            ?>
            <div id="poststuff">
              <div id="post-body">
                <div id="post-body-content">
                  <div class="stuffbox">
                    <h3 class="hndle"><span>JW Player Version</span></h3>
                    <div class="inside" style="margin: 15px;">
                      <table>
                        <tr valign="top">
                          <td>
                            <div>
                            <?php 
            if (isset($version) && !empty($version) && !$alternate) {
                ?>
                              <p><span><?php 
                echo "<strong>Current Player:</strong> JW Player " . $version;
                ?>
</span></p>
                              <?php 
                if (!strstr($version, "Licensed")) {
                    ?>
                                <p><span><?php 
                    echo JW_LICENSED;
                    ?>
</span></p>
                                <p><input class="button-secondary" type="submit" name="Update_Player" value="Click Here to Upgrade" /></p>
                              <?php 
                }
                ?>
                            <?php 
            } else {
                if ($alternate) {
                    ?>
                              <p><span><?php 
                    echo "<strong>Current Player:</strong> Version Unknown";
                    ?>
</span></p>
                              <p><span>The player is being loaded from an alternate location (<strong><?php 
                    echo $location;
                    ?>
</strong>) and is not being managed by the plugin.</span></p>
                            <?php 
                } else {
                    ?>
                              <p><span><?php 
                    echo "<strong>Current Player:</strong> Version Unknown";
                    ?>
</span></p>
                              <p><input class="button-secondary" type="submit" name="Update_Player" value="Click Here to Reinstall" /></p>
                            <?php 
                }
            }
            ?>
                          </div>
                        </td>
                      </tr>
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </form>
      <?php 
        } else {
            if (file_exists(LongTailFramework::getSecondaryPlayerPath())) {
                ?>
        <form name="<?php 
                echo LONGTAIL_KEY . "upgrade_form";
                ?>
" method="post" action="admin.php?page=jwplayer-update">
          <span><?php 
                echo "<strong>Current Player:</strong> Version Unknown ";
                ?>
</span>
          <input class="button-secondary" type="submit" name="Update_Player" value="Click Here to Reinstall" />
        </form>
      <?php 
            }
        }
        ?>
      <form name="<?php 
        echo LONGTAIL_KEY . "form";
        ?>
" method="post" action="">
      <div id="poststuff">
        <div id="post-body">
          <div id="post-body-content">
            <div class="stuffbox">
              <h3 class="hndle"><span>Manage Players</span></h3>
              <div class="inside" style="margin: 15px;">
                <table style="width: 100%;">
                  <tr valign="top">
                    <td>
                      <div>
                        <p><span><?php 
        echo JW_SETUP_EDIT_PLAYERS;
        ?>
</span></p>
                          <table class="widefat" cellspacing="0">
                            <thead>
                              <tr>
                                <th class="manage-column column-name" style="text-shadow: none;">Default</th>
                                <th class="manage-column column-name">Players</th>
                                <th class="manage-column column-name">Control Bar</th>
                                <th class="manage-column column-name">Skin</th>
                                <th class="manage-column column-name">Dock</th>
                                <th class="manage-column column-name">Autostart</th>
                                <th class="manage-column column-name">Height</th>
                                <th class="manage-column column-name">Width</th>
                                <th class="manage-column column-name" style="text-shadow: none;">Actions</th>
                              </tr>
                            </thead>
                            <tbody>
                              <tr>
                                <td style="vertical-align: middle">
                                  <input onchange="updateHandler(this);" type="radio" id="<?php 
        echo LONGTAIL_KEY . "default_Out-of-the-Box";
        ?>
" name="<?php 
        echo LONGTAIL_KEY . "default";
        ?>
" value="Out-of-the-Box" <?php 
        checked("Out-of-the-Box", get_option(LONGTAIL_KEY . "default"));
        ?>
/>
                                </td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "Out-of-the-Box";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "bottom";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "default";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "false";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "false";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "300";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "400";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><input class="button-secondary action" id="<?php 
        echo LONGTAIL_KEY . "player_Out-of-the-Box";
        ?>
" type="submit" name="Next" value="Copy" onclick="copyHandler(this)"/></td>
                              </tr>
                              <?php 
        $alternate = false;
        ?>
                              <?php 
        if ($players) {
            ?>
                                <?php 
            foreach ($players as $player) {
                ?>
                                  <?php 
                if ($player != "New Player") {
                    ?>
                                    <?php 
                    $alternate = !$alternate;
                    ?>
                                    <?php 
                    LongTailFramework::setConfig($player);
                    ?>
                                    <?php 
                    $details = LongTailFramework::getPlayerFlashVars(LongTailFramework::BASIC);
                    ?>
                                    <tr <?php 
                    if ($alternate) {
                        echo "class=\"alternate\"";
                    }
                    ?>
 >
                                      <td style="vertical-align: middle;">
                                        <input onchange="updateHandler(this);" type="radio" id="<?php 
                    echo LONGTAIL_KEY . "default_" . $player;
                    ?>
" name="<?php 
                    echo LONGTAIL_KEY . "default";
                    ?>
" value="<?php 
                    echo $player;
                    ?>
" <?php 
                    checked($player, get_option(LONGTAIL_KEY . "default"));
                    ?>
/>
                                      </td>
                                      <td style="vertical-align: middle;"><span><?php 
                    echo $player;
                    ?>
</span></td>
                                      <?php 
                    foreach (array_keys($details) as $detail) {
                        ?>
                                        <?php 
                        foreach ($details[$detail] as $fvar) {
                            ?>
                                          <td style="vertical-align: middle;"><span><?php 
                            echo $fvar->getDefaultValue() ? $fvar->getDefaultValue() : "default";
                            ?>
</span></td>
                                        <?php 
                        }
                        ?>
                                      <?php 
                    }
                    ?>
                                      <td>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="Copy" onclick="copyHandler(this)"/>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="Edit" onclick="selectionHandler(this)"/>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="Delete" onclick="return deleteHandler(this)"/>
                                      </td>
                                    </tr>
                                  <?php 
                }
                ?>
                                <?php 
            }
            ?>
                              <?php 
        }
        ?>
                            </tbody>
                          </table>
                          <br/>
                          <input class="button-secondary action" type="submit" name="Next" value="Create Custom Player"/>
                          <input id="<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
" type="hidden" name="<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
" value=""/>
                          <input id="<?php 
        echo LONGTAIL_KEY . "player";
        ?>
" type="hidden" name="<?php 
        echo LONGTAIL_KEY . "config";
        ?>
" value=""/>
                          <input type="hidden" name="<?php 
        echo LONGTAIL_KEY . "state";
        ?>
" value=<?php 
        echo PlayerState::getID();
        ?>
 />
                        </div>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
    <?php 
    }
Beispiel #3
0
 /**
  * Processes the POST data from the previous state.
  * @param AdminState $st The next state to be populated with the POST data
  * from the previous state.
  * @param $form
  * @param $form_state
  *
  */
 private function processPost($st, &$form, &$form_state)
 {
     $state = $st;
     if (isset($_POST["Next"])) {
         if ($_POST["Next"] == "Delete") {
             LongTailFramework::setConfig($form_state["storage"][LONGTAIL_KEY . "config"]);
             LongTailFramework::deleteConfig();
             $configs = LongTailFramework::getConfigs();
             if ($configs && count($configs) >= 2 && $_POST[LONGTAIL_KEY . "config"] == variable_get($form_state["storage"][LONGTAIL_KEY . "default"], "")) {
                 variable_set(LONGTAIL_KEY . "default", $configs[1]);
             } else {
                 if (!$configs || count($configs) == 1) {
                     variable_set(LONGTAIL_KEY . "default", "Out-of-the-Box");
                 }
             }
             $state = new PlayerState($form_state["storage"][LONGTAIL_KEY . "config"]);
             $del_player = $form_state["storage"][LONGTAIL_KEY . "config"];
             drupal_set_message("The '{$del_player}' Player was successfully deleted.");
             $state->render($form, $form_state);
         } else {
             if ($_POST["Next"] == "Create Custom Player") {
                 $form_state["storage"][LONGTAIL_KEY . "new_player"] = "Custom Player";
             }
             $state->getNextState()->render($form, $form_state);
         }
     } else {
         if (isset($_POST["Previous"])) {
             $state->getPreviousState()->render($form, $form_state);
         } else {
             if (isset($_POST["Cancel"])) {
                 unset($form_state["storage"]);
                 $state->getCancelState()->render($form, $form_state);
             } else {
                 if (isset($_POST["Save"]) && isset($form_state["storage"])) {
                     $config = $form_state["storage"][LONGTAIL_KEY . "config"];
                     $save_player = $form_state["storage"][LONGTAIL_KEY . "new_player"] ? $form_state["storage"][LONGTAIL_KEY . "new_player"] : $config;
                     LongTailFramework::setConfig($config);
                     $save_values = $this->processSubmit($form_state);
                     $success = LongTailFramework::saveConfig($this->convertToXML($save_values), check_plain($save_player));
                     $configs = LongTailFramework::getConfigs();
                     if ($configs && count($configs) == 2) {
                         variable_set(LONGTAIL_KEY . "ootb", false);
                     }
                     if ($success) {
                         drupal_set_message(t("The '{$save_player}' Player was successfully saved."));
                     } else {
                         drupal_set_message(t("The '{$save_player}' failed to save.  Please make sure the " . JWPLAYER_FILES_DIR . "/configs/ directory exists and is writable."), "error");
                     }
                     unset($form_state["storage"]);
                     $state->getSaveState()->render($form, $form_state);
                 } else {
                     if (isset($form_state["storage"][LONGTAIL_KEY . "default"])) {
                         variable_set(LONGTAIL_KEY . "default", $form_state["storage"][LONGTAIL_KEY . "default"]);
                     }
                     LongTailFramework::setConfig($form_state["storage"][LONGTAIL_KEY . "config"]);
                     $state->render($form, $form_state);
                 }
             }
         }
     }
 }
Beispiel #4
0
    /**
     * @see AdminState::render()
     */
    public function render()
    {
        $players = LongTailFramework::getConfigs();
        if (!$players) {
            $this->infoMessage(sprintf(__("If you wish to create custom players please make sure the %s/configs/" . " directory exists and is writable.  This directory is necessary for creating custom players.  ", 'jw-player-plugin-for-wordpress') . JW_FILE_PERMISSIONS, JWPLAYER_FILES_DIR));
        }
        ?>
    <div class="wrap">

      <script type="text/javascript">

        function updateHandler(button) {
          button.form.submit();
        }

        function selectionHandler(button) {
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
        }

        function copyHandler(button) {
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", "") + "_copy");
        }

        function deleteHandler(button) {
          var result = confirm(__("Are you sure wish to delete the Player?", 'jw-player-plugin-for-wordpress'));
          if (result) {
            selectionHandler(button);
            return true;
          }
          return false;
        }

      </script>

      <h2>JW Player Setup</h2>
      <p><span><?php 
        echo JW_SETUP_EDIT_PLAYERS;
        ?>
</span><p>
      <?php 
        /* Please upgrade to JWP6! if (file_exists(LongTailFramework::getPrimaryPlayerPath())) { ?>
             <form name="<?php echo LONGTAIL_KEY . "upgrade_form" ?>" method="post" action="admin.php?page=jwplayer-update">
               <?php $version = get_option(LONGTAIL_KEY . "version"); ?>
               <?php $alternate = get_option(LONGTAIL_KEY . "player_location_enable"); ?>
               <?php $location = get_option(LONGTAIL_KEY . "player_location"); ?>
               <?php $jwPlayer = file_exists(LongTailFramework::getPlayerPath()); ?>
               <?php $jwEmbedder = file_exists(LongTailFramework::getEmbedderPath()); ?>
                 <div id="poststuff">
                   <div id="post-body">
                     <div id="post-body-content">
                       <div class="stuffbox">
                         <h3 class="hndle"><span><?php _e("JW Player Status", 'jw-player-plugin-for-wordpress'); ?></span></h3>
                         <div class="inside" style="margin: 15px;">
                           <table>
                             <tr valign="top">
                               <td>
                                 <div>
                                 <?php if (!$alternate) { ?>
                                   <p>
                                     <span><strong>JW Player:</strong> <?php echo $jwPlayer ? __("Installed", 'jw-player-plugin-for-wordpress') : __("Not detected", 'jw-player-plugin-for-wordpress'); echo $version && $jwPlayer ? " (JW Player $version)" : ""; ?></span>
                                   </p>
                                   <p><span><strong>JW Embedder:</strong></span> <?php echo $jwEmbedder ? __("Installed", 'jw-player-plugin-for-wordpress') : __("Not detected (SWFObject will be used instead)", 'jw-player-plugin-for-wordpress'); ?></p>
                                   <?php if (!strstr($version, "Licensed")) { ?>
                                     <p><span><strong><?php _e("Please Note:", 'jw-player-plugin-for-wordpress');?></strong> <?php _e("The JW Player Plugin for WordPress does not yet support JW Player 6.  We are working quickly to update the plugin over the next few weeks. By early 2013, you will be able to use WordPress with JW Player 6.  For now, we recommend sticking with JW Player 5. Please stay tuned!", 'jw-player-plugin-for-wordpress'); ?></span></p>
                                     <p><strong><?php _e("Supported Versions:", 'jw-player-plugin-for-wordpress'); ?></strong></p>
                                     <table style="border: 1px solid gray;">
                                       <tr>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.0</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.1</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.2</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.3</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.4</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.5</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.6</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.7</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.8</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.9</td>
                                         <td style="border: 1px solid gray; width: 30px; text-align: center">5.10</td>
                                       </tr>
                                     </table>
                                     <p><em><?php _e("If you have already purchased a commercial upgrade for JW6, we can either process a refund, or you can keep your commercial license until the plugin is updated.  We apologize for the inconvenience.");?></em></p>
                                   <?php } ?>
                                 <?php } else if ($alternate) { ?>
                                   <p><span><?php echo "<strong>" . __("Current Player", 'jw-player-plugin-for-wordpress') . ":</strong> " . __("Version Unknown", 'jw-player-plugin-for-wordpress'); ?></span></p>
                                   <p><span><?php printf(__("The player is being loaded from an alternate location (<strong>%s</strong>) and is not being managed by the plugin.", 'jw-player-plugin-for-wordpress'), $location); ?></span></p>
                                 <?php } else { ?>
                                   <p><span><?php _e("<strong>Current Player:</strong> Version Unknown", 'jw-player-plugin-for-wordpress'); ?></span></p>
                                   <p><input class="button-secondary" type="submit" name="Update_Player" value="<?php _e("Click Here to Reinstall", 'jw-player-plugin-for-wordpress'); ?>" /></p>
                                 <?php } ?>
                               </div>
                             </td>
                           </tr>
                         </table>
                       </div>
                     </div>
                   </div>
                 </div>
               </div>
             </form>
           <?php } else if (file_exists(LongTailFramework::getSecondaryPlayerPath())) { ?>
             <form name="<?php echo LONGTAIL_KEY . "upgrade_form" ?>" method="post" action="admin.php?page=jwplayer-update">
               <span><?php _e("<strong>Current Player:</strong> Version Unknown ", 'jw-player-plugin-for-wordpress'); ?></span>
               <input class="button-secondary" type="submit" name="Update_Player" value="<?php _e("Click Here to Reinstall", 'jw-player-plugin-for-wordpress'); ?>" />
             </form>
           <?php } */
        ?>
      <form name="<?php 
        echo LONGTAIL_KEY . "form";
        ?>
" method="post" action="">
      <div id="poststuff">
        <div id="post-body">
          <div id="post-body-content">
            <div class="stuffbox">
              <h3 class="hndle"><span>Manage Players</span></h3>
              <div class="inside" style="margin: 15px;">
                <table style="width: 100%;">
                  <tr valign="top">
                    <td>
                      <div>
                          <table class="widefat" cellspacing="0">
                            <thead>
                              <tr>
                                <th class="manage-column column-name" style="text-shadow: none;">Default</th>
                                <th class="manage-column column-name">Players</th>
                                <th class="manage-column column-name">Control Bar</th>
                                <th class="manage-column column-name">Skin</th>
                                <th class="manage-column column-name">Dock</th>
                                <th class="manage-column column-name">Autostart</th>
                                <th class="manage-column column-name">Height</th>
                                <th class="manage-column column-name">Width</th>
                                <th class="manage-column column-name" style="text-shadow: none;">Actions</th>
                              </tr>
                            </thead>
                            <tbody>
                              <tr>
                                <td style="vertical-align: middle">
                                  <input onchange="updateHandler(this);" type="radio" id="<?php 
        echo LONGTAIL_KEY . "default_Out-of-the-Box";
        ?>
" name="<?php 
        echo LONGTAIL_KEY . "default";
        ?>
" value="<?php 
        _e("Out-of-the-Box", 'jw-player-plugin-for-wordpress');
        ?>
 <?php 
        checked("Out-of-the-Box", get_option(LONGTAIL_KEY . "default"));
        ?>
"/>
                                </td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "Out-of-the-Box";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "bottom";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "default";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "false";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "false";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "300";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "400";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><input class="button-secondary action" id="<?php 
        echo LONGTAIL_KEY . "player_Out-of-the-Box";
        ?>
" type="submit" name="Next" value="<?php 
        _e("Copy", 'jw-player-plugin-for-wordpress');
        ?>
" onclick="copyHandler(this)"/></td>
                              </tr>
                              <?php 
        $alternate = false;
        ?>
                              <?php 
        if ($players) {
            ?>
                                <?php 
            foreach ($players as $player) {
                ?>
                                  <?php 
                if ($player != __("New Player", 'jw-player-plugin-for-wordpress')) {
                    ?>
                                    <?php 
                    $alternate = !$alternate;
                    ?>
                                    <?php 
                    LongTailFramework::setConfig($player);
                    ?>
                                    <?php 
                    $details = LongTailFramework::getPlayerFlashVars(LongTailFramework::BASIC);
                    ?>
                                    <tr <?php 
                    if ($alternate) {
                        echo "class=\"alternate\"";
                    }
                    ?>
 >
                                      <td style="vertical-align: middle;">
                                        <input onchange="updateHandler(this);" type="radio" id="<?php 
                    echo LONGTAIL_KEY . "default_" . $player;
                    ?>
" name="<?php 
                    echo LONGTAIL_KEY . "default";
                    ?>
" value="<?php 
                    echo $player;
                    ?>
" <?php 
                    checked($player, get_option(LONGTAIL_KEY . "default"));
                    ?>
/>
                                      </td>
                                      <td style="vertical-align: middle;"><span><?php 
                    echo $player;
                    ?>
</span></td>
                                      <?php 
                    foreach (array_keys($details) as $detail) {
                        ?>
                                        <?php 
                        foreach ($details[$detail] as $fvar) {
                            ?>
                                          <td style="vertical-align: middle;"><span><?php 
                            echo $fvar->getDefaultValue() ? $fvar->getDefaultValue() : "default";
                            ?>
</span></td>
                                        <?php 
                        }
                        ?>
                                      <?php 
                    }
                    ?>
                                      <td>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="<?php 
                    _e("Copy", 'jw-player-plugin-for-wordpress');
                    ?>
" onclick="copyHandler(this)"/>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="<?php 
                    _e("Edit", 'jw-player-plugin-for-wordpress');
                    ?>
" onclick="selectionHandler(this)"/>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="<?php 
                    _e("Delete", 'jw-player-plugin-for-wordpress');
                    ?>
" onclick="return deleteHandler(this)"/>
                                      </td>
                                    </tr>
                                  <?php 
                }
                ?>
                                <?php 
            }
            ?>
                              <?php 
        }
        ?>
                            </tbody>
                          </table>
                          <br/>
                          <input class="button-secondary action" type="submit" name="Next" value="<?php 
        _e("Create Custom Player", 'jw-player-plugin-for-wordpress');
        ?>
"/>
                          <input id="<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
" type="hidden" name="<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
" value=""/>
                          <input id="<?php 
        echo LONGTAIL_KEY . "player";
        ?>
" type="hidden" name="<?php 
        echo LONGTAIL_KEY . "config";
        ?>
" value=""/>
                          <input type="hidden" name="<?php 
        echo LONGTAIL_KEY . "state";
        ?>
" value=<?php 
        echo PlayerState::getID();
        ?>
 />
                        </div>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
    <?php 
    }
Beispiel #5
0
 /**
  * @see AdminState::render()
  * @param $form
  * @param $form_state
  */
 public function render(&$form, $form_state)
 {
     drupal_add_js("admin/settings/jwplayermodule/adminjs", "module", "header", FALSE, FALSE);
     $form["Version"] = array("#description" => JW_SETUP_DESC, "#type" => "fieldset", "#title" => "JW Player Version");
     $form["Version"]["Current"] = array("#type" => "item");
     $version = variable_get(LONGTAIL_KEY . "version", "");
     if (isset($version) && !empty($version)) {
         $value = "<p><strong>Current Player</strong>: JW Player " . $version . "</p>";
         $upgrade = "";
         if (!strstr($version, "Licensed")) {
             $value .= "<p>" . JW_LICENSED . "</p>";
             $upgrade = "Click Here to Upgrade";
         }
     } else {
         $value = "<p><strong>Current Player: Version Unknown</strong></p>";
         $upgrade = "Click Here to Reinstall";
     }
     $form["Version"]["Current"]["#value"] = $value;
     $form["Version"]["Upgrade"] = array("#type" => "item", "#name" => "Update_Player", "#value" => "<a href='" . base_path() . "admin/settings/jwplayermodule/upgrade'>{$upgrade}</a>");
     $form["Manage"] = array("#description" => JW_SETUP_EDIT_PLAYERS, "#type" => "fieldset", "#title" => "Manage Players");
     $form["Manage"]["Players"] = array();
     $this->renderDefaultPlayer($form);
     $this->renderPlayers($form);
     $form["Manage"]["Create"] = array("#type" => "submit", "#name" => "Next", "#value" => t("Create Custom Player"));
     $form["Manage"]["Hidden"][LONGTAIL_KEY . "new_player"] = array("#type" => "hidden", "#id" => LONGTAIL_KEY . "new_player", "#name" => LONGTAIL_KEY . "new_player");
     $form["Manage"]["Hidden"][LONGTAIL_KEY . "config"] = array("#type" => "hidden", "#id" => LONGTAIL_KEY . "player", "#name" => LONGTAIL_KEY . "config");
     $form["Manage"]["Hidden"][LONGTAIL_KEY . "state"] = array("#type" => "hidden", "#value" => PlayerState::getID(), "#name" => LONGTAIL_KEY . "state");
 }
    /**
     * @see AdminState::render()
     */
    public function render()
    {
        $players = LongTailFramework::getConfigs();
        if (!$players) {
            $this->infoMessage("If you wish to create custom players please make sure the uploads/jw-player-plugin-for-wordpress/configs directory exists and is writable.  This directory is necessary for creating custom players.  " . JW_FILE_PERMISSIONS);
        }
        ?>
    <div class="wrap">

      <script type="text/javascript">

        function updateHandler(button) {
          button.form.submit();
        }

        function selectionHandler(button) {
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
        }

        function copyHandler(button) {
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", ""));
          var field = document.getElementById("<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
");
          field.setAttribute("value", button.id.replace("<?php 
        echo LONGTAIL_KEY . "player_";
        ?>
", "") + "_copy");
        }

        function deleteHandler(button) {
          var result = confirm("Are you sure wish to delete the Player?");
          if (result) {
            selectionHandler(button);
            return true;
          }
          return false;
        }

      </script>

      <h2>JW Player Setup</h2>
      <p><span><?php 
        echo JW_SETUP_DESC;
        ?>
</span><p>
      <?php 
        if (file_exists(LongTailFramework::getPrimaryPlayerPath())) {
            ?>
        <form name="<?php 
            echo LONGTAIL_KEY . "upgrade_form";
            ?>
" method="post" action="admin.php?page=jwplayer-update">
          <?php 
            $version = get_option(LONGTAIL_KEY . "version");
            ?>
          <?php 
            if (isset($version) && !empty($version)) {
                ?>
            <div id="poststuff">
              <div id="post-body">
                <div id="post-body-content">
                  <div class="stuffbox">
                    <h3 class="hndle"><span>JW Player Version</span></h3>
                    <div class="inside" style="margin: 15px;">
                      <table>
                        <tr valign="top">
                          <td>
                            <div>
                              <p><span><?php 
                echo "<strong>Current Player:</strong> JW Player " . $version;
                ?>
</span></p>
                              <?php 
                if (!strstr($version, "Licensed")) {
                    ?>
                                <p><span><?php 
                    echo JW_LICENSED;
                    ?>
</span></p>
                                <p><input class="button-secondary" type="submit" name="Update_Player" value="Click Here to Upgrade" /></p>
                              <?php 
                }
                ?>
                            </div>
                          </td>
                        </tr>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          <?php 
            } else {
                ?>
            <span><?php 
                echo "<strong>Current Player:</strong> Version Unknown";
                ?>
</span>
            <input class="button-secondary" type="submit" name="Update_Player" value="Click Here to Reinstall" />
          <?php 
            }
            ?>
        </form>
      <?php 
        } else {
            if (file_exists(LongTailFramework::getSecondaryPlayerPath())) {
                ?>
        <form name="<?php 
                echo LONGTAIL_KEY . "upgrade_form";
                ?>
" method="post" action="admin.php?page=jwplayer-update">
          <span><?php 
                echo "<strong>Current Player:</strong> Version Unknown ";
                ?>
</span>
          <input class="button-secondary" type="submit" name="Update_Player" value="Click Here to Reinstall" />
        </form>
      <?php 
            }
        }
        ?>
      <form name="<?php 
        echo LONGTAIL_KEY . "form";
        ?>
" method="post" action="">
      <div id="poststuff">
        <div id="post-body">
          <div id="post-body-content">
            <div class="stuffbox">
              <h3 class="hndle"><span>Manage Players</span></h3>
              <div class="inside" style="margin: 15px;">
                <table style="width: 100%;">
                  <tr valign="top">
                    <td>
                      <div>
                        <p><span><?php 
        echo JW_SETUP_EDIT_PLAYERS;
        ?>
</span></p>
                          <table class="widefat" cellspacing="0">
                            <thead>
                              <tr>
                                <th class="manage-column column-name">Default</th>
                                <th class="manage-column column-name">Players</th>
                                <th class="manage-column column-name">Control Bar</th>
                                <th class="manage-column column-name">Skin</th>
                                <th class="manage-column column-name">Dock</th>
                                <th class="manage-column column-name">Autostart</th>
                                <th class="manage-column column-name">Height</th>
                                <th class="manage-column column-name">Width</th>
                                <th class="manage-column column-name">Actions</th>
                              </tr>
                            </thead>
                            <tbody>
                              <tr>
                                <td style="vertical-align: middle">
                                  <input onchange="updateHandler(this);" type="radio" id="<?php 
        echo LONGTAIL_KEY . "default_Out-of-the-Box";
        ?>
" name="<?php 
        echo LONGTAIL_KEY . "default";
        ?>
" value="Out-of-the-Box" <?php 
        checked("Out-of-the-Box", get_option(LONGTAIL_KEY . "default"));
        ?>
/>
                                </td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "Out-of-the-Box";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "bottom";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "default";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "false";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "false";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "300";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><span><?php 
        echo "400";
        ?>
</span></td>
                                <td style="vertical-align: middle;"><input class="button-secondary action" id="<?php 
        echo LONGTAIL_KEY . "player_Out-of-the-Box";
        ?>
" type="submit" name="Next" value="Copy" onclick="copyHandler(this)"/></td>
                              </tr>
                              <?php 
        $alternate = false;
        ?>
                              <?php 
        if ($players) {
            ?>
                                <?php 
            foreach ($players as $player) {
                ?>
                                  <?php 
                if ($player != "New Player") {
                    ?>
                                    <?php 
                    $alternate = !$alternate;
                    ?>
                                    <?php 
                    LongTailFramework::setConfig($player);
                    ?>
                                    <?php 
                    $details = LongTailFramework::getPlayerFlashVars(LongTailFramework::BASIC);
                    ?>
                                    <tr <?php 
                    if ($alternate) {
                        echo "class=\"alternate\"";
                    }
                    ?>
 >
                                      <td style="vertical-align: middle;">
                                        <input onchange="updateHandler(this);" type="radio" id="<?php 
                    echo LONGTAIL_KEY . "default_" . $player;
                    ?>
" name="<?php 
                    echo LONGTAIL_KEY . "default";
                    ?>
" value="<?php 
                    echo $player;
                    ?>
" <?php 
                    checked($player, get_option(LONGTAIL_KEY . "default"));
                    ?>
/>
                                      </td>
                                      <td style="vertical-align: middle;"><span><?php 
                    echo $player;
                    ?>
</span></td>
                                      <?php 
                    foreach (array_keys($details) as $detail) {
                        ?>
                                        <?php 
                        foreach ($details[$detail] as $fvar) {
                            ?>
                                          <td style="vertical-align: middle;"><span><?php 
                            echo $fvar->getDefaultValue() ? $fvar->getDefaultValue() : "default";
                            ?>
</span></td>
                                        <?php 
                        }
                        ?>
                                      <?php 
                    }
                    ?>
                                      <td>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="Copy" onclick="copyHandler(this)"/>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="Edit" onclick="selectionHandler(this)"/>
                                        <input class="button-secondary action" id="<?php 
                    echo LONGTAIL_KEY . "player_" . $player;
                    ?>
" type="submit" name="Next" value="Delete" onclick="return deleteHandler(this)"/>
                                      </td>
                                    </tr>
                                  <?php 
                }
                ?>
                                <?php 
            }
            ?>
                              <?php 
        }
        ?>
                            </tbody>
                          </table>
                          <br/>
                          <input class="button-secondary action" type="submit" name="Next" value="Create Custom Player"/>
                          <div style="display: inline-block; float: right;">
                            <label for="<?php 
        echo LONGTAIL_KEY . "show_archive";
        ?>
">Show players on category and search pages</label>
                            <input id="<?php 
        echo LONGTAIL_KEY . "show_archive";
        ?>
" type="checkbox" name="<?php 
        echo LONGTAIL_KEY . "show_archive";
        ?>
" onclick="form.submit();" <?php 
        checked(true, get_option(LONGTAIL_KEY . "show_archive"));
        ?>
/>
                          </div>
                          <input id="<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
" type="hidden" name="<?php 
        echo LONGTAIL_KEY . "new_player";
        ?>
" value=""/>
                          <input id="<?php 
        echo LONGTAIL_KEY . "player";
        ?>
" type="hidden" name="<?php 
        echo LONGTAIL_KEY . "config";
        ?>
" value=""/>
                          <input type="hidden" name="<?php 
        echo LONGTAIL_KEY . "state";
        ?>
" value=<?php 
        echo PlayerState::getID();
        ?>
 />
                        </div>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div id="poststuff">
          <div id="post-body">
            <div id="post-body-content">
              <div class="stuffbox">
                <h3 class="hndle"><span>JW Player Plugin for WordPress Uninstall</span></h3>
                <div class="inside" style="margin: 15px;">
                  <table>
                    <tr valign="top">
                      <td>
                        <div>
                          <p><?php 
        _e('To fully remove the plugin, click the Uninstall button.  Deactivating without uninstalling will not remove the data created by the plugin.');
        ?>
</p>
                        </div>
                        <p><font color="red"><strong><?php 
        _e('WARNING:');
        ?>
</strong><br />
                        <?php 
        _e('This cannot be undone.  Since this is deleting data from your database, it is recommended that you create a backup.');
        ?>
</font></p>
                        <div align="left">
                          <input type="submit" name="Uninstall" class="button-secondary delete" value="<?php 
        _e('Uninstall plugin');
        ?>
" onclick="return confirm('<?php 
        _e('You are about to Uninstall this plugin from WordPress.\\nThis action is not reversible.\\n\\nChoose [Cancel] to Stop, [OK] to Uninstall.\\n');
        ?>
');"/>
                        </div>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
    <?php 
    }