Settings'; array_unshift($links, $settings_link); } return $links; } // Add admin menu -- if (is_admin()) { add_action('admin_menu', 'oembed_providers_menu'); add_action('admin_init', 'oembed_providers_register'); } // Whitelist options -- function oembed_providers_register() { register_setting('oembed_providers_optiongroup', 'oembed_format'); register_setting('oembed_providers_optiongroup', 'oembed_provider'); register_setting('oembed_providers_optiongroup', 'oembed_example'); add_option('oembed_format', 'http://alm.plos.org/articles/*'); add_option('oembed_provider', 'http://alm.plos.org/oembed'); add_option('oembed_example', 'http://alm.plos.org/articles/10.1371/journal.pone.0103437'); } // Admin menu page details -- function oembed_providers_menu() { add_options_page('ALM oEmbed settings', 'ALM oEmbed', 'manage_options', 'oembed_providers', 'oembed_providers_options'); } // Add actual menu page -- function oembed_providers_options() { ?>

ALM oEmbed Settings

This is the settings page for the ALM oEmbed plugin. This plugin whitelists an additional oEmbed service beyond those included by default.

Whitelist the following oEmbed service:

Format
Provider
Example
"", "body" => $htmlcode); } else { $response = wp_remote_get($example); $message = wp_remote_retrieve_response_message($response); $body = wp_remote_retrieve_body($response); $json = json_decode($body); return array ( "status" => "Error: " . ($message == "OK" ? "URL wrong format" : $message), "body" => esc_attr($body)); } } ?>