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
190
190
191
191
## Scheme
192
192
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 `
194
194
195
195
``` php
196
196
$autolink->addScheme('skype')
@@ -208,7 +208,7 @@ $autolink->setLinkBuilder(function($url, $attribs)
208
208
{
209
209
$attribs['src'] = htmlspecialchars($url);
210
210
211
- return (string) \Windwalker\Html\HtmlElement('img', null, $attribs);
211
+ return (string) new \Windwalker\Html\HtmlElement('img', null, $attribs);
212
212
});
213
213
```
214
214
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ public function convert($text, $attribs = array())
78
78
$ regex ,
79
79
function ($ matches ) use ($ self , $ attribs )
80
80
{
81
- preg_match ('/[a-zA-Z]*\=\"(.*)\" / ' , $ matches [0 ], $ inElements );
81
+ preg_match ('/[a-zA-Z]*\=\"(.*)/ ' , $ matches [0 ], $ inElements );
82
82
83
83
if (!$ inElements )
84
84
{
@@ -101,19 +101,21 @@ function($matches) use ($self, $attribs)
101
101
*/
102
102
public function convertEmail ($ text , $ attribs = array ())
103
103
{
104
+ $ self = $ this ;
105
+
104
106
$ regex = "/(([a-zA-Z]*= \")*\S+@\S+\.\S+)/ " ;
105
107
106
108
return preg_replace_callback (
107
109
$ regex ,
108
- function ($ matches ) use ($ attribs )
110
+ function ($ matches ) use ($ self , $ attribs )
109
111
{
110
- preg_match ('/[a-zA-Z]*\=\"(.*)\" / ' , $ matches [0 ], $ inElements );
112
+ preg_match ('/[a-zA-Z]*\=\"(.*)/ ' , $ matches [0 ], $ inElements );
111
113
112
114
if (!$ inElements )
113
115
{
114
116
$ attribs ['href ' ] = 'mailto: ' . htmlspecialchars ($ matches [0 ]);
115
117
116
- return $ this ->buildLink ($ matches [0 ], $ attribs );
118
+ return $ self ->buildLink ($ matches [0 ], $ attribs );
117
119
}
118
120
119
121
return $ matches [0 ];
You can’t perform that action at this time.
0 commit comments