aboutsummaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
Diffstat (limited to 'addon')
-rw-r--r--addon/oembed/oembed.js12
-rw-r--r--addon/oembed/oembed.php107
-rw-r--r--addon/widgets/widgets.php7
3 files changed, 79 insertions, 47 deletions
diff --git a/addon/oembed/oembed.js b/addon/oembed/oembed.js
index 54547a86e..f8e957413 100644
--- a/addon/oembed/oembed.js
+++ b/addon/oembed/oembed.js
@@ -1,10 +1,6 @@
function oembed(){
- $("#oembed").toggleClass('hide');
-}
-
-function oembed_do(){
- embed = "[embed]"+$('#oembed_url').attr('value')+"[/embed]";
-
- tinyMCE.execCommand('mceInsertRawHTML',false,embed);
- oembed();
+ var reply = prompt("$oembed_message:");
+ if(reply && reply.length) {
+ tinyMCE.execCommand('mceInsertRawHTML',false, "[embed]"+reply+"[/embed]" );
+ }
}
diff --git a/addon/oembed/oembed.php b/addon/oembed/oembed.php
index d9b205a3a..f1fb27986 100644
--- a/addon/oembed/oembed.php
+++ b/addon/oembed/oembed.php
@@ -6,56 +6,89 @@
* 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');
+ 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){
- if(($a->module !== 'network') && ($a->module !== 'profile'))
- return;
-
- $b .= '<script src="addon/oembed/oembed.js"></script>
- <style>#oembed.hide { display: none }
- #oembed {
- display:block; position: absolute; width: 300px; height:200px;
- background-color:#fff; color: #000;
- border:2px solid #8888FF; padding: 1em;
- top: 200px; left: 400px; z-index:2000;
- }
- #oembed_url { width: 100%; margin-bottom:3px;}
- </style>';
-
- $b .= '
- <div id="oembed" class="hide"><input id="oembed_url">&nbsp;
- <input type="button" value="Embed" onclick="oembed_do()" style="float:left;">
- <a onclick="oembed(); return false;" style="float:right;"><img onmouseout="imgdull(this);" onmouseover="imgbright(this);" class="wall-item-delete-icon" src="images/b_drophide.gif" style="width: 16px; height: 16px;"></a>
- <div style="clear:both">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</div>
- </div>
- ';
+function oembed_hook_page_header($a, &$b){
+ $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>
+ ';
}
+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
+?>
diff --git a/addon/widgets/widgets.php b/addon/widgets/widgets.php
index 6bd7a73d1..af17d9e9a 100644
--- a/addon/widgets/widgets.php
+++ b/addon/widgets/widgets.php
@@ -7,12 +7,15 @@
function widgets_install() {
- // we need some hooks, for the configuration and for sending tweets
register_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings');
register_hook('plugin_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post');
-
logger("installed widgets");
}
+function widgets_uninstall() {
+ unregister_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings');
+ unregister_hook('plugin_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post');
+}
+
function widgets_settings_post(){