-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtextile.module
More file actions
47 lines (39 loc) · 1.05 KB
/
textile.module
File metadata and controls
47 lines (39 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @file
* The textile module allows input of Textile shorthand.
*/
/**
* Implements hook_libraries_info().
*/
function textile_libraries_info() {
$libraries['textile'] = array(
'name' => 'textile',
'vendor url' => 'https://github.com/zdia/textile',
'download url' => 'https://github.com/zdia/textile/archive/master.zip',
'version arguments' => array(
'file' => 'classTextile.php',
'pattern' => '@(?i:protected \$ver \= \')([0-9\.]+)@',
'lines' => 500,
),
'files' => array(
'php' => array(
'classTextile.php',
),
),
);
return $libraries;
}
function _textile_match_process($matches) {
static $textile = NULL;
if (is_null($textile)) {
if (!empty($matches)) {
libraries_load('textile');
}
$textile = new Textile();
// $textile->hu is the string that preceeds all relative URLs.
$url = Drupal::url('<front>');
$textile->hu = (substr($url, -1) == '/' ? $url : "$url/");
}
return is_null($textile) ? $matches[1] : $textile->TextileThis($matches[1]);
}