]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
authorEvan Prodromou <evan@status.net>
Mon, 3 Oct 2011 13:14:17 +0000 (09:14 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 3 Oct 2011 13:14:17 +0000 (09:14 -0400)
lib/default.php
lib/oembedhelper.php
plugins/LinkPreview/linkpreview.js
plugins/LinkPreview/linkpreview.min.js
plugins/LinkPreview/oembedproxyaction.php
tests/oEmbedTest.php

index 673c94769a89d90070c456f4fe6183becb69a55d..0f321efe0e2eefad83e456270425699b680dd870 100644 (file)
@@ -277,7 +277,7 @@ $default =
               'allow_tagging' => array('all' => true), // equivalent to array('local' => true, 'remote' => true)
               'desclimit' => null),
         'oembed' =>
-        array('endpoint' => 'http://oohembed.com/oohembed/',
+        array('endpoint' => 'https://noembed.com/embed/',
               'order' => array('built-in', 'well-known', 'service', 'discovery'),
         ),
         'search' =>
@@ -352,6 +352,5 @@ $default =
         array('cache' => true), // whether to cache the router object. Defaults to true, turn off for devel
         'discovery' =>
           array('cors' => false), // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
-       'performance' => array('high' => false), // disable some features for higher performance; default false
-       'oldschool' => array('enabled' => false) // enable users to use old-style UI
+        'performance' => array('high' => false) // disable some features for higher performance; default false
     );
index 6d8064e660502298525ecfb205d40f0c6a41ed25..903f80c581a03b92a17ec5f2a698809d9c307cab 100644 (file)
@@ -61,7 +61,7 @@ class oEmbedHelper
      * Some known hosts are whitelisted with API endpoints where we
      * know they exist but autodiscovery data isn't available.
      * If autodiscovery links are missing and we don't recognize the
-     * host, we'll pass it to oohembed.com's public service which
+     * host, we'll pass it to noembed.com's public service which
      * will either proxy or fake info on a lot of sites.
      *
      * A few hosts are blacklisted due to known problems with oohembed,
@@ -94,7 +94,7 @@ class oEmbedHelper
             case 'built-in':
                 common_log(LOG_INFO, 'Considering built-in oEmbed methods...');
                 // Blacklist: systems with no oEmbed API of their own, which are
-                // either missing from or broken on oohembed.com's proxy.
+                // either missing from or broken on noembed.com's proxy.
                 // we know how to look data up in another way...
                 if (array_key_exists($host, self::$functionMap)) {
                     common_log(LOG_INFO, 'We have a built-in method for ' . $host);
index 132c4c8d77f272617ed37ff235a220c24494a209..e6e98bdb4d9ba01f3e5f6458b8f2f794263cf98f 100644 (file)
@@ -7,7 +7,7 @@
      * Quickie wrapper around ooembed JSON lookup
      */
     var oEmbed = {
-        api: 'http://oohembed.com/oohembed',
+        api: 'https://noembed.com/embed',
         width: 100,
         height: 75,
         cache: {},
index ea28f6bfee2977a7d512a3aa68c24f56e080e7de..99af83913e06d7d696d235e1267c598fbc6917ce 100644 (file)
@@ -1 +1 @@
-(function(){var b={api:"http://oohembed.com/oohembed",width:100,height:75,cache:{},callbacks:{},lookup:function(d,e){if(typeof b.cache[d]=="object"){e(b.cache[d])}else{if(typeof b.callbacks[d]=="undefined"){b.callbacks[d]=[e];b.rawLookup(d,function(h){b.cache[d]=h;var g=b.callbacks[d];b.callbacks[d]=undefined;for(var f=0;f<g.length;f++){g[f](h)}})}else{b.callbacks[d].push(e)}}},rawLookup:function(d,f){var e={url:d,format:"json",maxwidth:b.width,maxheight:b.height,token:$("#token").val()};$.ajax({url:b.api,data:e,dataType:"json",success:function(g,h){f(g)},error:function(h,i,g){f(null)}})}};SN.Init.LinkPreview=function(d){if(d.api){b.api=d.api}if(d.width){b.width=d.width}if(d.height){b.height=d.height}};var c=SN.U.Counter;SN.U.Counter=function(d){var e=d.data("LinkPreview");if(e){e.previewLinks(d.find(".notice_data-text:first").val())}return c(d)};var a=SN.Init.NoticeFormSetup;SN.Init.NoticeFormSetup=function(d){a(d);d.bind("reset",function(){e.clear()});var e={links:[],state:[],refresh:[],findLinks:function(i){var g=/(?:^| )(https?:\/\/.+?\/.+?)(?= |$)/mg;var f=[];var h;while((h=g.exec(i))!==null){f.push(h[1])}return f},ensureArea:function(){if(d.find(".link-preview").length<1){d.append('<div class="notice-status link-preview thumbnails"></div>')}},prepLinkPreview:function(g){var h="link-preview-"+g;var f=e.links[g];e.refresh[g]=false;e.markLoading(g);b.lookup(f,function(l){var i=null;var j=100;if(l&&typeof l.thumbnail_url=="string"){i=l.thumbnail_url;if(typeof l.thumbnail_width!=="undefined"){if(l.thumbnail_width<j){j=l.thumbnail_width}}}else{if(l&&l.type=="photo"&&typeof l.url=="string"){i=l.url;if(typeof l.width!=="undefined"){if(l.width<j){j=l.width}}}}if(i){e.ensureArea();var k=$('<span class="inline-attachment"><a><img/></a></span>');k.find("a").attr("href",f).attr("target","_blank").last().find("img").attr("src",i).attr("width",j).attr("title",l.title||l.url||f);d.find("."+h).empty().append(k)}else{e.clearLink(g)}if(e.refresh[g]){e.prepLinkPreview(g)}else{e.markDone(g)}})},previewLinks:function(j){var h;var f=e.links;var g=e.findLinks(j);e.links=g;for(h=0;h<f.length&&h<g.length;h++){if(g[h]!=f[h]){if(e.state[h]=="loading"){e.refresh[h]=true}else{e.prepLinkPreview(h)}}}if(g.length>f.length){for(h=f.length;h<g.length;h++){e.addPreviewArea(h);e.prepLinkPreview(h)}}else{if(f.length>g.length){for(h=g.length;h<f.length;h++){e.clearLink(h)}}}if(g.length==0){e.clear()}},addPreviewArea:function(f){e.ensureArea();var g="link-preview-"+f;if(d.find("."+g).length<1){d.find(".link-preview").append('<span class="'+g+'"></span>')}},clearLink:function(f){var g="link-preview-"+f;d.find("."+g).html("")},markLoading:function(f){e.state[f]="loading";var g="link-preview-"+f;d.find("."+g).attr("style","opacity: 0.5")},markDone:function(f){e.state[f]="done";var g="link-preview-"+f;d.find("."+g).removeAttr("style")},clear:function(){e.links=[];d.find(".link-preview").remove()}};d.data("LinkPreview",e)}})();
\ No newline at end of file
+(function(){var b={api:"https://noembed.com/embed",width:100,height:75,cache:{},callbacks:{},lookup:function(d,e){if(typeof b.cache[d]=="object"){e(b.cache[d])}else{if(typeof b.callbacks[d]=="undefined"){b.callbacks[d]=[e];b.rawLookup(d,function(h){b.cache[d]=h;var g=b.callbacks[d];b.callbacks[d]=undefined;for(var f=0;f<g.length;f++){g[f](h)}})}else{b.callbacks[d].push(e)}}},rawLookup:function(d,f){var e={url:d,format:"json",maxwidth:b.width,maxheight:b.height,token:$("#token").val()};$.ajax({url:b.api,data:e,dataType:"json",success:function(g,h){f(g)},error:function(h,i,g){f(null)}})}};SN.Init.LinkPreview=function(d){if(d.api){b.api=d.api}if(d.width){b.width=d.width}if(d.height){b.height=d.height}};var c=SN.U.Counter;SN.U.Counter=function(d){var e=d.data("LinkPreview");if(e){e.previewLinks(d.find(".notice_data-text:first").val())}return c(d)};var a=SN.Init.NoticeFormSetup;SN.Init.NoticeFormSetup=function(d){a(d);d.bind("reset",function(){e.clear()});var e={links:[],state:[],refresh:[],findLinks:function(i){var g=/(?:^| )(https?:\/\/.+?\/.+?)(?= |$)/mg;var f=[];var h;while((h=g.exec(i))!==null){f.push(h[1])}return f},ensureArea:function(){if(d.find(".link-preview").length<1){d.append('<div class="notice-status link-preview thumbnails"></div>')}},prepLinkPreview:function(g){var h="link-preview-"+g;var f=e.links[g];e.refresh[g]=false;e.markLoading(g);b.lookup(f,function(l){var i=null;var j=100;if(l&&typeof l.thumbnail_url=="string"){i=l.thumbnail_url;if(typeof l.thumbnail_width!=="undefined"){if(l.thumbnail_width<j){j=l.thumbnail_width}}}else{if(l&&l.type=="photo"&&typeof l.url=="string"){i=l.url;if(typeof l.width!=="undefined"){if(l.width<j){j=l.width}}}}if(i){e.ensureArea();var k=$('<span class="inline-attachment"><a><img/></a></span>');k.find("a").attr("href",f).attr("target","_blank").last().find("img").attr("src",i).attr("width",j).attr("title",l.title||l.url||f);d.find("."+h).empty().append(k)}else{e.clearLink(g)}if(e.refresh[g]){e.prepLinkPreview(g)}else{e.markDone(g)}})},previewLinks:function(j){var h;var f=e.links;var g=e.findLinks(j);e.links=g;for(h=0;h<f.length&&h<g.length;h++){if(g[h]!=f[h]){if(e.state[h]=="loading"){e.refresh[h]=true}else{e.prepLinkPreview(h)}}}if(g.length>f.length){for(h=f.length;h<g.length;h++){e.addPreviewArea(h);e.prepLinkPreview(h)}}else{if(f.length>g.length){for(h=g.length;h<f.length;h++){e.clearLink(h)}}}if(g.length==0){e.clear()}},addPreviewArea:function(f){e.ensureArea();var g="link-preview-"+f;if(d.find("."+g).length<1){d.find(".link-preview").append('<span class="'+g+'"></span>')}},clearLink:function(f){var g="link-preview-"+f;d.find("."+g).html("")},markLoading:function(f){e.state[f]="loading";var g="link-preview-"+f;d.find("."+g).attr("style","opacity: 0.5")},markDone:function(f){e.state[f]="done";var g="link-preview-"+f;d.find("."+g).removeAttr("style")},clear:function(){e.links=[];d.find(".link-preview").remove()}};d.data("LinkPreview",e)}})();
\ No newline at end of file
index fd2f46f5fcae8af536bc51fa7cf37b8a54e950f3..7e54aca57067de6bce92a0e4d76f7f85c22181a5 100644 (file)
@@ -35,7 +35,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  *
  * This class provides an interface for our JS-side code to pull info on
  * links from other sites, using either native oEmbed, our own custom
- * handlers, or the oohEmbed.com offsite proxy service as configured.
+ * handlers, or the noembed.com offsite proxy service as configured.
  *
  * @category  oEmbed
  * @package   StatusNet
index b5e441c42fc02dc0c770c6f066e5276d5d7a33bb..1f1d5f826cba25f4899f7a6605d5596d96d9712b 100644 (file)
@@ -15,22 +15,22 @@ class oEmbedTest extends PHPUnit_Framework_TestCase
 
     public function setup()
     {
-        $this->old_oohembed = common_config('oohembed', 'endpoint');
+        $this->old_ohembed = common_config('ohembed', 'endpoint');
     }
 
     public function tearDown()
     {
-        $GLOBALS['config']['oohembed']['endpoint'] = $this->old_oohembed;
+        $GLOBALS['config']['oembed']['endpoint'] = $this->old_ohembed;
     }
 
     /**
-     * Test with oohembed DISABLED.
+     * Test with ohembed DISABLED.
      *
      * @dataProvider discoverableSources
      */
     public function testoEmbed($url, $expectedType)
     {
-        $GLOBALS['config']['oohembed']['endpoint'] = false;
+        $GLOBALS['config']['oembed']['endpoint'] = false;
         $this->_doTest($url, $expectedType);
     }
 
@@ -39,14 +39,14 @@ class oEmbedTest extends PHPUnit_Framework_TestCase
      *
      * @dataProvider fallbackSources
      */
-    public function testoohEmbed($url, $expectedType)
+    public function testnoEmbed($url, $expectedType)
     {
-        $GLOBALS['config']['oohembed']['endpoint'] = $this->_endpoint();
+        $GLOBALS['config']['oembed']['endpoint'] = $this->_endpoint();
         $this->_doTest($url, $expectedType);
     }
 
     /**
-     * Get default oohembed endpoint.
+     * Get default oembed endpoint.
      *
      * @return string
      */
@@ -55,7 +55,7 @@ class oEmbedTest extends PHPUnit_Framework_TestCase
         $default = array();
         $_server = 'localhost'; $_path = '';
         require INSTALLDIR . '/lib/default.php';
-        return $default['oohembed']['endpoint'];
+        return $default['oembed']['endpoint'];
     }
 
     /**
@@ -113,7 +113,6 @@ class oEmbedTest extends PHPUnit_Framework_TestCase
     static public function discoverableSources()
     {
         $sources = array(
-            array('http://identi.ca/attachment/34437400', 'photo'),
 
             array('http://www.youtube.com/watch?v=eUgLR232Cnw', 'video'),
             array('http://vimeo.com/9283184', 'video'),
@@ -125,16 +124,20 @@ class oEmbedTest extends PHPUnit_Framework_TestCase
     }
 
     /**
-     * Sample oEmbed targets that can be found via oohembed.com.
+     * Sample oEmbed targets that can be found via noembed.com.
      * Includes also discoverableSources() output.
      *
      * @return array
      */
     static public function fallbackSources()
     {
+
         $sources = array(
-            array('http://en.wikipedia.org/wiki/File:Wiki.png', 'link'), // @fixme in future there may be a native provider -- will change to 'photo'
+            array('https://github.com/git/git/commit/85e9c7e1d42849c5c3084a9da748608468310c0e', 'Github Commit'), // @fixme in future there may be a native provider -- will change to 'photo'
         );
+
+        $sources = array();
+
         return array_merge(self::discoverableSources(), $sources);
     }
 }