File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ Output
190190
191191## Scheme
192192
193- You can add new scheme to convert URL begin with it, foe example: ` vnc://example.com `
193+ You can add new scheme to convert URL begin with it, for example: ` vnc://example.com `
194194
195195``` php
196196$autolink->addScheme('skype')
@@ -208,7 +208,7 @@ $autolink->setLinkBuilder(function($url, $attribs)
208208{
209209 $attribs['src'] = htmlspecialchars($url);
210210
211- return (string) \Windwalker\Html\HtmlElement('img', null, $attribs);
211+ return (string) new \Windwalker\Html\HtmlElement('img', null, $attribs);
212212});
213213```
214214
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ public function convert($text, $attribs = array())
7878 $ regex ,
7979 function ($ matches ) use ($ self , $ attribs )
8080 {
81- preg_match ('/[a-zA-Z]*\=\"(.*)\" / ' , $ matches [0 ], $ inElements );
81+ preg_match ('/[a-zA-Z]*\=\"(.*)/ ' , $ matches [0 ], $ inElements );
8282
8383 if (!$ inElements )
8484 {
@@ -101,19 +101,21 @@ function($matches) use ($self, $attribs)
101101 */
102102 public function convertEmail ($ text , $ attribs = array ())
103103 {
104+ $ self = $ this ;
105+
104106 $ regex = "/(([a-zA-Z]*= \")*\S+@\S+\.\S+)/ " ;
105107
106108 return preg_replace_callback (
107109 $ regex ,
108- function ($ matches ) use ($ attribs )
110+ function ($ matches ) use ($ self , $ attribs )
109111 {
110- preg_match ('/[a-zA-Z]*\=\"(.*)\" / ' , $ matches [0 ], $ inElements );
112+ preg_match ('/[a-zA-Z]*\=\"(.*)/ ' , $ matches [0 ], $ inElements );
111113
112114 if (!$ inElements )
113115 {
114116 $ attribs ['href ' ] = 'mailto: ' . htmlspecialchars ($ matches [0 ]);
115117
116- return $ this ->buildLink ($ matches [0 ], $ attribs );
118+ return $ self ->buildLink ($ matches [0 ], $ attribs );
117119 }
118120
119121 return $ matches [0 ];
You can’t perform that action at this time.
0 commit comments