*/ 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('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('plugin_settings', 'addon/oembed/oembed.php', 'oembed_settings'); unregister_hook('plugin_settings_post', 'addon/oembed/oembed.php', 'oembed_settings_post'); } function oembed_settings_post($a,$b){ if(! local_user()) return; if (x($_POST,'oembed-submit')){ set_pconfig(local_user(), 'oembed', 'use_for_youtube', (x($_POST,'oembed_use_for_youtube')? intval($_POST['oembed_use_for_youtube']):0)); info( t('OEmbed settings updated') . EOL); } } function oembed_settings(&$a,&$o) { if(! local_user()) return; $uofy = intval(get_pconfig(local_user(), 'oembed', 'use_for_youtube' )); $t = file_get_contents( dirname(__file__). "/settings.tpl" ); $o .= replace_macros($t, array( '$submit' => t('Submit'), '$title' => "OEmbed", '$useoembed' => array('oembed_use_for_youtube', t('Use OEmbed for YouTube videos'), $uofy, ""), )); } function oembed_hook_page_header($a, &$b){ $a->page['htmlhead'] .= sprintf('', $a->get_baseurl()); } function oembed_hook_jot_tool($a, &$b) { $b .= '