@@ -15,12 +15,12 @@ class syntax_plugin_latexcaption_caption extends \dokuwiki\Extension\SyntaxPlugi
15
15
* Static variables set to keep track when scope is left.
16
16
*/
17
17
private static $ _types = array ('figure ' , 'table ' ,'codeblock ' ,'fileblock ' );
18
- private static $ _type = '' ;
19
- private static $ _incaption = false ;
20
- private static $ _label = '' ;
21
- private static $ _opts = array ();
22
- private static $ _parOpts = array ();
23
- private static $ _nested = false ;
18
+ private $ _type = '' ;
19
+ private $ _incaption = false ;
20
+ private $ _label = '' ;
21
+ private $ _opts = array ();
22
+ private $ _parOpts = array ();
23
+ private $ _nested = false ;
24
24
25
25
/** @var $helper helper_plugin_latexcaption */
26
26
var $ helper = null ;
@@ -91,14 +91,14 @@ public function handle($match, $state, $pos, Doku_Handler $handler){
91
91
$ opts = (!empty ($ opts ) ? explode (' ' , $ opts ) : ['noalign ' ,]);
92
92
93
93
// Set dynamic class counter variable
94
- $ type_counter_def = '$ _ ' .$ type .'_count ' ;
94
+ $ type_counter_def = '_ ' .$ type .'_count ' ;
95
95
96
96
// Increment the counter of relevant type
97
97
// Store the type in class for caption match to determine what html tag to use
98
98
// This is ok since we will never have nested figures and more than one caption
99
- $ this :: $ _type = $ type ;
100
- $ this :: $ _label = $ label ;
101
- $ this :: $ _opts = $ opts ;
99
+ $ this -> _type = $ type ;
100
+ $ this -> _label = $ label ;
101
+ $ this -> _opts = $ opts ;
102
102
$ this ->{$ type_counter_def } = (!isset ($ this ->{$ type_counter_def }) ? 1 : $ this ->{$ type_counter_def }+1 );
103
103
104
104
// save params to class variables (cached for use in render)
@@ -110,16 +110,16 @@ public function handle($match, $state, $pos, Doku_Handler $handler){
110
110
// Check if we are counting a subtype to store parent in array for references
111
111
if ($ this ->isSubType ($ type )) {
112
112
$ partype = $ this ->getParType ($ type );
113
- $ parcount = $ this ->{'$ _ ' .$ partype .'_count ' };
113
+ $ parcount = $ this ->{'_ ' .$ partype .'_count ' };
114
114
}
115
115
$ caption_count [$ label ] = array ($ type , $ type_counter , $ parcount );
116
116
}
117
117
118
118
//Save parent options for use later
119
119
if (!$ this ->isSubType ($ type )){
120
- $ this :: $ _parOpts = $ opts ;
120
+ $ this -> _parOpts = $ opts ;
121
121
} else {
122
- $ this :: $ _nested = true ;
122
+ $ this -> _nested = true ;
123
123
}
124
124
125
125
// Set the params
@@ -133,15 +133,15 @@ public function handle($match, $state, $pos, Doku_Handler $handler){
133
133
if ($ state == DOKU_LEXER_MATCHED ){
134
134
// Case of caption.
135
135
// Toggle the incaption flag
136
- $ this :: $ _incaption = !$ this :: $ _incaption ;
137
- $ type = $ this :: $ _type ;
138
- $ params ['label ' ] = $ this :: $ _label ;
136
+ $ this -> _incaption = !$ this -> _incaption ;
137
+ $ type = $ this -> _type ;
138
+ $ params ['label ' ] = $ this -> _label ;
139
139
$ params ['xhtml ' ]['captagtype ' ] = (in_array ($ type , ['figure ' , 'subfigure ' ]) ? 'figcaption ' : 'div ' );
140
- $ params ['incaption ' ] = $ this :: $ _incaption ;
141
- $ params ['type_counter ' ] = $ this ->{'$ _ ' .$ type .'_count ' };
140
+ $ params ['incaption ' ] = $ this -> _incaption ;
141
+ $ params ['type_counter ' ] = $ this ->{'_ ' .$ type .'_count ' };
142
142
$ params ['type ' ] = $ type ;
143
143
// Decide what caption options to send to renderer
144
- $ params ['opts ' ] = ($ this :: $ _nested ? $ this :: $ _opts : $ this :: $ _parOpts );
144
+ $ params ['opts ' ] = ($ this -> _nested ? $ this -> _opts : $ this -> _parOpts );
145
145
146
146
147
147
return array ($ state , $ match , $ pos , $ params );
@@ -150,16 +150,16 @@ public function handle($match, $state, $pos, Doku_Handler $handler){
150
150
return array ($ state , $ match , $ pos , $ params );
151
151
}
152
152
if ($ state == DOKU_LEXER_EXIT ){
153
- $ type = $ this :: $ _type ;
153
+ $ type = $ this -> _type ;
154
154
155
155
if (substr ($ type , 0 , 3 ) == 'sub ' ) {
156
156
// Change environment back to non sub type
157
- $ this :: $ _type = substr ($ type , 3 );
158
- $ this :: $ _nested = false ;
157
+ $ this -> _type = substr ($ type , 3 );
158
+ $ this -> _nested = false ;
159
159
}
160
160
else {
161
161
// reset subtype counter
162
- $ this ->{'$ _sub ' .$ type .'_count ' } = 0 ;
162
+ $ this ->{'_sub ' .$ type .'_count ' } = 0 ;
163
163
}
164
164
$ params ['type ' ] = $ type ;
165
165
$ params ['xhtml ' ]['tagtype ' ] = (in_array ($ type , ['figure ' , 'subfigure ' ]) ? 'figure ' : 'div ' );
@@ -181,7 +181,7 @@ public function handle($match, $state, $pos, Doku_Handler $handler){
181
181
}
182
182
183
183
// Update the counter. offset by 1 since counter is incremented on caption enter
184
- $ this ->{'$ _ ' .$ type .'_count ' } = $ num -1 ;
184
+ $ this ->{'_ ' .$ type .'_count ' } = $ num -1 ;
185
185
186
186
return true ;
187
187
}
0 commit comments