diff --git a/addon/oembed/oembed.php b/addon/oembed/oembed.php index caf4f58373..f1fb279867 100644 --- a/addon/oembed/oembed.php +++ b/addon/oembed/oembed.php @@ -10,26 +10,58 @@ require_once('include/oembed.php'); function oembed_install() { - register_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool'); - register_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header'); + register_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool'); + register_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header'); + register_hook('plugin_settings', 'addon/oembed/oembed.php', 'oembed_settings'); + register_hook('plugin_settings_post', 'addon/oembed/oembed.php', 'oembed_settings_post'); } function oembed_uninstall() { - unregister_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool'); - unregister_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header'); + unregister_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool'); + unregister_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header'); } +function oembed_settings_post(){ + if(! local_user()) + return; + if (isset($_POST['oembed-submit'])){ + set_pconfig(local_user(), 'oembed', 'use_for_youtube', (isset($_POST['oembed_use_for_youtube'])?1:0)); + notice( t('OEmbed settings updated') . EOL); + } +} + +function oembed_settings(&$a,&$o) { + if(! local_user()) + return; + $uofy = get_pconfig(local_user(), 'oembed', 'use_for_youtube' ); + + $o .='