aboutsummaryrefslogtreecommitdiffstats
path: root/addon/oembed
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-05-23 10:37:09 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-05-23 10:37:09 +0200
commit7c5a7a94d4d224d23f7c922b86a60a6ffe53fc9f (patch)
tree86a9a1a233ec5e09b6734b916fff834e295a3fde /addon/oembed
parent453a0cff3875ca1cb3587b1fa83ad5b0439faae3 (diff)
downloadvolse-hubzilla-7c5a7a94d4d224d23f7c922b86a60a6ffe53fc9f.tar.gz
volse-hubzilla-7c5a7a94d4d224d23f7c922b86a60a6ffe53fc9f.tar.bz2
volse-hubzilla-7c5a7a94d4d224d23f7c922b86a60a6ffe53fc9f.zip
Add oembed user option for use oembed instead of standard yotube embedding.
Remove global option and parse_url use of oembed.
Diffstat (limited to 'addon/oembed')
-rw-r--r--addon/oembed/oembed.php54
1 files changed, 43 insertions, 11 deletions
diff --git a/addon/oembed/oembed.php b/addon/oembed/oembed.php
index caf4f5837..f1fb27986 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 .='<h3 class="settings-heading">OEmbed</h3>';
+ $o.='
+ <div id="settings-username-wrapper">
+ <label for="oembed_use_for_youtube">'
+ .t('Use OEmbed for YouTube videos: ')
+ .'</label><input type="checkbox" id="oembed_use_for_youtube" name="oembed_use_for_youtube"'
+ . ($uofy==1?'checked="true"':'')
+ .'>
+ </div>
+ <div id="settings-username-end"></div>
+ <div class="settings-submit-wrapper">
+ <input type="submit" value="'.t('Submit').'" class="settings-submit" name="oembed-submit">
+ </div>';
+}
+
+
function oembed_hook_page_header($a, &$b){
- $a->page['htmlhead'] .= sprintf('<script src="%s/oembed/oembed.js"></script>', $a->get_baseurl());
+ $a->page['htmlhead'] .= sprintf('<script src="%s/oembed/oembed.js"></script>', $a->get_baseurl());
}
function oembed_hook_jot_tool($a, &$b) {
- $b .= '
- <div class="tool-wrapper" style="display: $visitor;" >
- <img class="tool-link" src="addon/oembed/oembed.png" alt="Embed" title="Embed" onclick="oembed();" />
- </div>
- ';
+ $b .= '
+ <div class="tool-wrapper" style="display: $visitor;" >
+ <img class="tool-link" src="addon/oembed/oembed.png" alt="Embed" title="Embed" onclick="oembed();" />
+ </div>
+ ';
}
@@ -59,4 +91,4 @@ function oembed_init(&$a) {
}
-?> \ No newline at end of file
+?>