15
15
16
16
// -----------------------------------------------------
17
17
18
- function extract_section ($ lines , $ section ) {
18
+ function extract_section ($ lines , $ section )
19
+ {
19
20
$ result = "" ;
20
21
21
22
$ start_delim = "# --- BEGIN PLUGIN $ section --- " ;
@@ -29,19 +30,22 @@ function extract_section($lines, $section) {
29
30
return join ("\n" , $ content );
30
31
}
31
32
32
- function compile_plugin ($ file ='' ) {
33
+ function compile_plugin ($ file = '' )
34
+ {
33
35
global $ plugin ;
34
36
35
- if (empty ($ file ))
37
+ if (empty ($ file )) {
36
38
$ file = $ _SERVER ['SCRIPT_FILENAME ' ];
39
+ }
37
40
38
41
if (!isset ($ plugin ['name ' ])) {
39
42
$ plugin ['name ' ] = basename ($ file , '.php ' );
40
43
}
41
44
42
45
// Read the contents of this file, and strip line ends.
43
46
$ content = file ($ file );
44
- for ($ i =0 ; $ i < count ($ content ); $ i ++) {
47
+
48
+ for ($ i = 0 ; $ i < count ($ content ); $ i ++) {
45
49
$ content [$ i ] = rtrim ($ content [$ i ]);
46
50
}
47
51
@@ -52,7 +56,10 @@ function compile_plugin($file='') {
52
56
$ plugin ['help_raw ' ] = $ plugin ['help ' ];
53
57
54
58
// This is for bc; and for help that needs to use it.
55
- if (defined ('txpath ' )) {
59
+ if (class_exists ('Textile ' )) {
60
+ $ textile = new Textile ();
61
+ $ plugin ['help ' ] = $ textile ->parse ($ plugin ['help ' ]);
62
+ } elseif (defined ('txpath ' )) {
56
63
global $ trace ;
57
64
58
65
include txpath.'/lib/txplib_misc.php ' ;
@@ -63,15 +70,13 @@ function compile_plugin($file='') {
63
70
64
71
$ loader = new \Textpattern \Loader (txpath.'/vendors ' );
65
72
$ loader ->register ();
73
+ $ loader = new \Textpattern \Loader (txpath.'/lib ' );
74
+ $ loader ->register ();
66
75
67
- require txpath.'/lib/classTextile.php ' ;
68
- } else {
69
- @include ('classTextile.php ' );
70
- }
71
-
72
- if (class_exists ('Textile ' )) {
73
- $ textile = new Textile ();
74
- $ plugin ['help ' ] = $ textile ->TextileThis ($ plugin ['help ' ]);
76
+ if (class_exists ('\Netcarver\Textile\Parser ' )) {
77
+ $ textile = new Netcarver \Textile \Parser ();
78
+ $ plugin ['help ' ] = $ textile ->parse ($ plugin ['help ' ]);
79
+ }
75
80
}
76
81
77
82
$ plugin ['md5 ' ] = md5 ( $ plugin ['code ' ] );
0 commit comments