function uploadAsset($clientAsset) { $ooyala = get_option('ooyala'); // Build our request to create the new asset. $asset = new stdClass(); $properties = array('asset_id'); foreach ($properties as $property) { if (!isset($clientAsset->{$property})) { http500("The {$property} is missing from from the asset."); } $asset->{$property} = $clientAsset->{$property}; } try { $api = new OoyalaApi($ooyala['api_key'], $ooyala['api_secret']); $uploading_urls = $api->get("assets/" . $asset->asset_id . "/uploading_urls"); return $uploading_urls; } catch (Exception $e) { http500($e->getMessage()); } }
public function render_options_page() { $options = get_option('ooyala'); if (isset($options['api_key'], $options['api_secret'])) { try { $api = new OoyalaApi($options['api_key'], $options['api_secret']); $players = $api->get("players"); } catch (Exception $e) { $players = array(); } if ($players && !empty($players->items)) { $options['players'] = array(); foreach ($players->items as $player) { $options['players'][] = $player->id; } } if ($players) { $options['players'] = array(); foreach ($players->items as $player) { $options['players'][] = $player->id; } if (empty($options['player_id'])) { $options['player_id'] = $options['players'][0]; } } update_option('ooyala', $options); } ?> <style type="text/css" media="screen"> #icon-ooyala { background: transparent url(<?php echo esc_url(plugins_url('img/ooyala-icon.png', __FILE__)); ?> ) no-repeat; } </style> <div class="wrap"> <?php screen_icon('ooyala'); ?> <h2><?php esc_html_e('Ooyala Settings', 'ooyalavideo'); ?> </h2> <form method="post" action="options.php"> <?php settings_fields('ooyala_settings'); do_settings_sections('ooyala-options'); submit_button(); ?> </form> </div><?php }