AntonLV 5 سال پیش
والد
کامیت
edeff4cfb3
2فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 1 1
      modules/boonex/timeline/classes/BxTimelineConfig.php
  2. 2 2
      modules/boonex/timeline/js/post.js

+ 1 - 1
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -314,7 +314,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         $this->_aPregPatterns = array(
             "meta_title" => "/<title>(.*)<\/title>/",
             "meta_description" => "/<meta[\s]+[^>]*?name[\s]?=[\s\"\']+description[\s\"\']+content[\s]?=[\s\"\']+(.*?)[\"\']+.*?>/",
-            "url" => "/(([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_!\(\)]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?/"
+            "url" => "/(([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%#\/\.\w\-_!\(\)]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?/"
         );
 
         $this->_aBriefCardsTags = array('a', 'b', 'i');

+ 2 - 2
modules/boonex/timeline/js/post.js

@@ -25,7 +25,7 @@ function BxTimelinePost(oOptions) {
 
     this._sPregTag = "(<([^>]+bx-tag[^>]+)>)";
     this._sPregMention = "(<([^>]+bx-mention[^>]+)>)";
-    this._sPregUrl = "(([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:\\/[\\+~%\\/\\.\\w\\-_!\\(\\)]*)?\\??(?:[\\-\\+=&;%@\\.\\w_]*)#?(?:[\\.\\!\\/\\w]*))?";
+    this._sPregUrl = "(([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:\\/[\\+~%#\\/\\.\\w\\-_!\\(\\)]*)?\\??(?:[\\-\\+=&;%@\\.\\w_]*)#?(?:[\\.\\!\\/\\w]*))?";
 
     var $this = this;
     if (typeof window.glOnInitEditor === 'undefined')
@@ -111,7 +111,7 @@ BxTimelinePost.prototype.initFormPost = function(sFormId)
 
         oExp = new RegExp($this._sPregUrl , "ig");
         while(aMatch = oExp.exec(sData)) {
-            var sUrl = aMatch[0];
+            var sUrl = aMatch[0].replace(/^[\s(&nbsp;)]+|[\s(&nbsp;)]+$/gm,'');
             if(!sUrl.length || $this._oAttachedLinks[sUrl] != undefined || ($this._iLimitAttachLinks != 0 && Object.keys($this._oAttachedLinks).length >= $this._iLimitAttachLinks))
                 continue;