From 570a22de7425e2a486b02e3b43a4b4b1ece552af Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sun, 22 May 2011 21:56:47 +0200 Subject: update oembed plugin. embed preview in editor --- addon/oembed/oembed.php | 55 +++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'addon/oembed/oembed.php') diff --git a/addon/oembed/oembed.php b/addon/oembed/oembed.php index d9b205a3a..45f533cc5 100644 --- a/addon/oembed/oembed.php +++ b/addon/oembed/oembed.php @@ -6,7 +6,9 @@ * http://www.oembed.com/ * */ - + +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'); @@ -18,32 +20,7 @@ function oembed_uninstall() { } function oembed_hook_page_header($a, &$b){ - - if(($a->module !== 'network') && ($a->module !== 'profile')) - return; - - $b .= ' - '; - - $b .= ' -
  - - -
Paste a link from 5min.com, Amazon Product Image, blip.tv, Clikthrough, CollegeHumor Video, - Daily Show with Jon Stewart, Dailymotion, dotSUB.com, Flickr Photos, Funny or Die Video, - Google Video, Hulu, Kinomap, LiveJournal UserPic, Metacafe, National Film Board of Canada, - Phodroid Photos, Photobucket, Qik Video, Revision3, Scribd, SlideShare, TwitPic, Twitter Status, - Viddler Video, Vimeo, Wikipedia, Wordpress.com, XKCD Comic, YFrog, YouTube
-
- '; + $a->page['htmlhead'] .= sprintf('', $a->get_baseurl()); } @@ -56,6 +33,30 @@ function oembed_hook_jot_tool($a, &$b) { } +function oembed_module() { + return; +} +function oembed_init(&$a) { + if ($a->argv[1]=='oembed.js'){ + $tpl = file_get_contents('addon/oembed/oembed.js'); + echo replace_macros($tpl, array( + '$oembed_message' => t('URL to embed:'), + )); + } + + if ($a->argv[1]=='b2h'){ + $url = array( "", trim(hex2bin($_GET['url']))); + echo "".oembed_replacecb($url).""; + } + + if ($a->argv[1]=='h2b'){ + $text = trim(hex2bin($_GET['text'])); + echo oembed_html2bbcode($text); + } + + killme(); + +} ?> \ No newline at end of file -- cgit v1.2.3