RomanL 4 anos atrás
pai
commit
03d5372069

+ 2 - 2
embed.php

@@ -12,9 +12,9 @@ require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
 bx_import('BxDolEmbed');
 
 if (bx_get('a') == 'get_link'){
-    $sLink = bx_get('l');
+    $sLink = trim(bx_get('l'));
 
     $oEmbed = BxDolEmbed::getObjectInstance();
     if ($oEmbed)
-        echoJson(['code' => $oEmbed->getLinkHTML($sLink), 'js' => strip_tags($oEmbed->addProcessLinkMethod())]);
+        echoJson(['code' => $oEmbed->getLinkHTML($sLink), 'js' => strip_tags($oEmbed->addProcessLinkMethod()), 'link' => $sLink]);
 }

+ 13 - 6
inc/js/classes/BxDolPage.js

@@ -30,15 +30,22 @@ BxDolPage.prototype.init = function() {
         });
     }
     // process embeds
-    $(".bx-embed-link").each(function( index ) {
-        $obj =  $(this);
-        $.getJSON(sUrlRoot + '/embed.php?', {a: 'get_link', l: $(this).attr('source')}, function(aData){ 
-            $obj.html(aData.code);
-            bx_embed_link();
-        });
+    $(".bx-embed-link").each(function() {
+        $(this).html($(this).attr('source'));
+        $.getJSON(sUrlRoot + '/embed.php?', {a: 'get_link', l: $(this).attr('source')}, $this.embededCallback($(this)));
     });
 };
 
+BxDolPage.prototype.embededCallback = function(item)
+{
+    return function(oData) {
+        item.html(oData.code)
+        if (item.find('a').length > 0){
+            bx_embed_link(item.find('a')[0]);
+        }
+    };
+ }
+
 BxDolPage.prototype.showHelp = function(oLink, iBlockId)
 {
     var oData = this._getDefaultParams();

+ 4 - 4
inc/js/editor.quill.js

@@ -18,7 +18,10 @@ function bx_editor_init(oEditor, oParams){
                         sLink = $(oPopup).find("input[type = 'text']").val()
                         $.getJSON(oParams.root_url + 'embed.php?', {a: 'get_link', l: sLink}, function(aData){
                             oEditor.insertEmbed(100, 'embed-link', {source: sLink, inlinecode : aData.code});
-                            bx_embed_link();
+                            if ($(oParams.selector).next().next().find('.bx-embed-link a[href="' + aData.link + '"]').length > 0)
+                                bx_embed_link($(oParams.selector).next().next().find('.bx-embed-link a[href="' + aData.link + '"]')[0]);
+                            else
+                                bx_embed_link();
                         });
                     });
                 },
@@ -55,7 +58,6 @@ function bx_editor_init(oEditor, oParams){
             }
             
             format(name, value) {
-                console.log('format'+name+"!"+value)
                 if (name === 'href' || name === 'title') {
                     if (value) {
                         this.domNode.setAttribute(name, value);
@@ -72,7 +74,6 @@ function bx_editor_init(oEditor, oParams){
             };
                 
             static formats(node) {
-                console.log(node+"x");
                 let format = {};
                 if (node.hasAttribute('href')) {
                     format.href = node.getAttribute('href');
@@ -184,7 +185,6 @@ function bx_editor_init(oEditor, oParams){
                     })
                     .catch(error => {
                         reject("Upload failed");
-                        console.error("Error:", error);
                     });
                 });
             }

+ 2 - 2
inc/utils.inc.php

@@ -571,7 +571,7 @@ function clear_xss($val)
 {
     // HTML Purifier plugin
     global $oHtmlPurifier;
-    if (!isset($oHtmlPurifier) /*&& !$GLOBALS['logged']['admin']*/) {
+    if (!isset($oHtmlPurifier) && !$GLOBALS['logged']['admin']) {
         HTMLPurifier_Bootstrap::registerAutoload();
 
         $oConfig = HTMLPurifier_Config::createDefault();
@@ -628,7 +628,7 @@ function clear_xss($val)
         $oHtmlPurifier = new HTMLPurifier($oConfig);
     }
 
-    //if (!$GLOBALS['logged']['admin'])
+    if (!$GLOBALS['logged']['admin'])
         $val = $oHtmlPurifier->purify($val);
 
     bx_alert('system', 'clear_xss', 0, 0, array('oHtmlPurifier' => $oHtmlPurifier, 'return_data' => &$val));

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -634,6 +634,7 @@
 	<string name="_adm_dbd_txt_c_clear_css"><![CDATA[Clear CSS cache]]></string>
         <string name="_adm_dbd_txt_c_less"><![CDATA[LESS]]></string>
         <string name="_adm_dbd_txt_c_clear_less"><![CDATA[Clear LESS cache]]></string>
+    <string name="_adm_dbd_txt_c_clear_purifier"><![CDATA[Clear all Purifier cache]]></string>
 	<string name="_adm_dbd_txt_c_js"><![CDATA[JavaScript]]></string>
 	<string name="_adm_dbd_txt_c_clear_js"><![CDATA[Clear JavaScript cache]]></string>
         <string name="_adm_dbd_txt_c_clear_custom"><![CDATA[Clear Custom cache]]></string>