Procházet zdrojové kódy

#1135 Embedly re-integration

Alex Trofimov před 8 roky
rodič
revize
79797e46d1

+ 1 - 15
inc/classes/BxDolTemplate.php

@@ -480,23 +480,9 @@ class BxDolTemplate extends BxDolFactory implements iBxDolSingleton
             '_copyright'
             '_copyright'
         ));
         ));
 
 
-        //--- Load Embed.ly if Key and Pattern are available ---//
-        $bEmbedly = !empty(getParam('sys_embedly_api_key'));
-        if($bEmbedly) {
-            $this->addJsSystem(array(
-            	'jquery.embedly.min.js',
-            ));
-
-            $this->addJsOption(array(
-            	'sys_embedly_api_key',
-            	'sys_embedly_api_pattern',
-            ));
-        }
-
         //--- Load Iframely if Key is available and Embed.ly is disabled ---//
         //--- Load Iframely if Key is available and Embed.ly is disabled ---//
         $sIframely = getParam('sys_iframely_api_key');
         $sIframely = getParam('sys_iframely_api_key');
-        $bIframely = !$bEmbedly && !empty($sIframely);
-        if($bIframely) {
+        if(!empty($sIframely)) {
             $this->addJsSystem(array(
             $this->addJsSystem(array(
                 bx_proto() . '://cdn.iframe.ly/embed.js?key=' . md5($sIframely)
                 bx_proto() . '://cdn.iframe.ly/embed.js?key=' . md5($sIframely)
             ));
             ));

+ 1 - 28
inc/js/jquery.dolConverLinks.js

@@ -1,7 +1,5 @@
 (function( $ ){
 (function( $ ){
 	$.fn.dolConverLinks = function(options) {
 	$.fn.dolConverLinks = function(options) {
-		if(bx_get_param('sys_embedly_api_key') != '')
-			return this.dolEmbedly(options);
 
 
 		if(bx_get_param('sys_iframely_api_key') != '')
 		if(bx_get_param('sys_iframely_api_key') != '')
 			return this.dolIframely(options);
 			return this.dolIframely(options);
@@ -9,35 +7,10 @@
 		return this;
 		return this;
 	};
 	};
 
 
-	$.fn.dolIframely = function(options) {        
+	$.fn.dolIframely = function(options) {
 		return this.each(function() {
 		return this.each(function() {
 			iframely.load($(this).get(0));
 			iframely.load($(this).get(0));
 		});
 		});
 	};
 	};
 
 
-	$.fn.dolEmbedly = function(options) {
-        var o = $.extend({}, {'max-width':900}, options);
-		var sEmbedlyKey = bx_get_param('sys_embedly_api_key');
-		var sEmbedlyPattern = bx_get_param('sys_embedly_api_pattern');
-		if(!sEmbedlyKey)
-			return this;
-
-        var eBox = $(this).parent();
-        var iMaxWidth = eBox.size() ? eBox.innerWidth() : $(window).width() - 70;
-        if (iMaxWidth > o['max-width']) 
-        	iMaxWidth = o['max-width'];
-
-        var oParams = {
-            key: sEmbedlyKey,
-            query: {maxwidth: iMaxWidth}
-        };
-
-    	// only videos/sound/images are supported, to generate own list goto http://embed.ly/tools/generator
-        if(sEmbedlyPattern != '')
-        	oParams.urlRe = new RegExp(sEmbedlyPattern, 'i');
-
-		return this.each(function() {
-			$(this).embedly(oParams);
-		});
-	};
 })( jQuery );
 })( jQuery );

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
install/sql/system.sql


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 5
plugins_public/jquery.embedly.min.js


+ 19 - 0
template/embedly.html

@@ -0,0 +1,19 @@
+<script>
+(function(w, d){
+    var id='embedly-platform', n = 'script';
+    if (!d.getElementById(id)){
+        w.embedly = w.embedly || function() {(w.embedly.q = w.embedly.q || []).push(arguments);};
+        var e = d.createElement(n); e.id = id; e.async=1;
+        e.src = ('https:' === document.location.protocol ? 'https' : 'http') + '://cdn.embedly.com/widgets/platform.js';
+        var s = d.getElementsByTagName(n)[0];
+        s.parentNode.insertBefore(e, s);
+    }
+})(window, document);
+<bx_if:key>
+$(document).ready(function () {
+    embedly("defaults", {
+        cards: {key: '__key__'}
+    });
+});
+</bx_if:key>
+</script>

+ 16 - 0
template/scripts/BxBaseFunctions.php

@@ -608,6 +608,22 @@ class BxBaseFunctions extends BxDolFactory implements iBxDolSingleton
 
 
         return $sContent;
         return $sContent;
     }
     }
+
+    protected function getInjFooterEmbedly() 
+    {
+        $sKey = getParam('sys_embedly_api_key');
+
+        // TODO: remove this condition when this code is moved to the separate module
+        if (empty($sKey))
+            return '';
+        
+        return $this->_oTemplate->parseHtmlByName('embedly.html', array(
+            'bx_if:key' => array (
+                'condition' => !empty($sKey),
+                'content' => array('key' => $sKey),
+            )
+        ));
+    }
 }
 }
 
 
 /** @} */
 /** @} */

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů