Skip to content
This repository was archived by the owner on Sep 24, 2022. It is now read-only.

Commit d43b0c3

Browse files
committed
Codesniffer autoformat
1 parent 18737e8 commit d43b0c3

File tree

166 files changed

+2109
-1892
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+2109
-1892
lines changed

Text/Wiki.php

Lines changed: 60 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
* @version Release: @package_version@
2929
* @link http://pear.php.net/package/Text_Wiki
3030
*/
31-
class Text_Wiki {
31+
class Text_Wiki
32+
{
3233

3334
/**
3435
*
@@ -41,7 +42,7 @@ class Text_Wiki {
4142
*/
4243

4344
public $rules = array(
44-
'Include',
45+
'Include',
4546
'Prefilter',
4647
'Delimiter',
4748
// 'Moduledelimiter',
@@ -53,11 +54,11 @@ class Text_Wiki {
5354
'Module',
5455
'Module654',
5556

56-
'Iftags',
57+
'Iftags',
5758

5859
'Comment',
5960
'Iframe',
60-
'Date',
61+
'Date',
6162
'Math',
6263

6364
'Concatlines',
@@ -335,17 +336,17 @@ class Text_Wiki {
335336
'render' => array()
336337
);
337338

338-
/**
339-
* Storage for temporary variables.
340-
*/
341-
public $store = array();
339+
/**
340+
* Storage for temporary variables.
341+
*/
342+
public $store = array();
342343

343-
public $vars = array();
344+
public $vars = array();
344345

345-
/**
346-
* Stores format while processing the source.
347-
*/
348-
public $currentFormat;
346+
/**
347+
* Stores format while processing the source.
348+
*/
349+
public $currentFormat;
349350

350351
/**
351352
*
@@ -384,7 +385,6 @@ function Text_Wiki($rules = null)
384385
'render',
385386
$this->fixPath(dirname(__FILE__)) . 'Wiki/Render/'
386387
);
387-
388388
}
389389

390390
/**
@@ -545,7 +545,6 @@ function getRenderConf($format, $rule, $key = null)
545545
// no
546546
return null;
547547
}
548-
549548
}
550549

551550
/**
@@ -685,7 +684,6 @@ function insertRule($name, $tgt = null)
685684
}
686685

687686
return true;
688-
689687
}
690688

691689
/**
@@ -806,7 +804,7 @@ function disableRule($name)
806804

807805
function transform($text, $format = 'Xhtml')
808806
{
809-
$this->currentFormat = $format;
807+
$this->currentFormat = $format;
810808
$this->parse($text);
811809
$out = $this->render($format);
812810
$this->currentFormat = null;
@@ -840,7 +838,6 @@ function parse($text)
840838
foreach ($this->rules as $name) {
841839
// do not parse the rules listed in $disable
842840
if (! in_array($name, $this->disable)) {
843-
844841
// load the parsing object
845842
$this->loadParseObj($name);
846843

@@ -850,7 +847,6 @@ function parse($text)
850847
$this->parseObj[$name]->parse();
851848
}
852849
}
853-
854850
}
855851
}
856852

@@ -886,7 +882,7 @@ function render($format = 'Xhtml')
886882
// load the format object, or crap out if we can't find it
887883
$result = $this->loadFormatObj($format);
888884
if ($this->isError($result)) {
889-
return $result;
885+
return $result;
890886
}
891887

892888
// pre-rendering activity
@@ -902,33 +898,25 @@ function render($format = 'Xhtml')
902898
// pass through the parsed source text character by character
903899
$k = strlen($this->source);
904900
for ($i = 0; $i < $k; $i++) {
905-
906901
// the current character
907902
$char = $this->source[$i];
908903

909904
// are alredy in a delimited section?
910905
if ($in_delim) {
911-
912906
// yes; are we ending the section?
913907
if ($char == $this->delim) {
914-
915908
// yes, get the replacement text for the delimited
916909
// token number and unset the flag.
917910
$key = (int)$key;
918911
$rule = $this->tokens[$key][0];
919912
$opts = $this->tokens[$key][1];
920913
$output .= $this->renderObj[$rule]->token($opts);
921914
$in_delim = false;
922-
923915
} else {
924-
925916
// no, add to the dlimited token key number
926917
$key .= $char;
927-
928918
}
929-
930919
} else {
931-
932920
// not currently in a delimited section.
933921
// are we starting into a delimited section?
934922
if ($char == $this->delim) {
@@ -948,18 +936,19 @@ function render($format = 'Xhtml')
948936
$output .= $this->formatObj[$format]->post();
949937
}
950938

951-
// this is a nasty hack... should be put somewhere else, e.g. Postfilter?
939+
// this is a nasty hack... should be put somewhere else, e.g. Postfilter?
952940
953-
// fix TOC tags within entries
954-
$d = utf8_encode("\xFC");
955-
$output = preg_replace_callback("/$d$d(.*?)$d$d/s", array($this, 'strip'), $output);
941+
// fix TOC tags within entries
942+
$d = utf8_encode("\xFC");
943+
$output = preg_replace_callback("/$d$d(.*?)$d$d/s", array($this, 'strip'), $output);
956944

957945
// return the rendered source text.
958946
return $output;
959947
}
960948

961-
public function strip($matches){
962-
return strip_tags($matches[1]);
949+
public function strip($matches)
950+
{
951+
return strip_tags($matches[1]);
963952
}
964953

965954
/**
@@ -1107,20 +1096,19 @@ function loadParseObj($rule)
11071096

11081097
$loc = $this->findFile('parse', $file);
11091098

1110-
if ($loc) {
1111-
// found the class
1112-
include_once $loc;
1113-
} else {
1114-
// can't find the class
1115-
$this->parseObj[$rule] = null;
1116-
// can't find the class
1117-
return $this->error(
1118-
"Parse rule '$rule' not found"
1119-
);
1120-
}
1099+
if ($loc) {
1100+
// found the class
1101+
include_once $loc;
1102+
} else {
1103+
// can't find the class
1104+
$this->parseObj[$rule] = null;
1105+
// can't find the class
1106+
return $this->error(
1107+
"Parse rule '$rule' not found"
1108+
);
1109+
}
11211110

11221111
$this->parseObj[$rule] = new $class($this);
1123-
11241112
}
11251113

11261114
/**
@@ -1142,15 +1130,15 @@ function loadRenderObj($format, $rule)
11421130

11431131
// load the class
11441132
$loc = $this->findFile('render', $file);
1145-
if ($loc) {
1146-
// found the class
1147-
include_once $loc;
1148-
} else {
1149-
// can't find the class
1150-
return $this->error(
1151-
"Render rule '$rule' in format '$format' not found"
1152-
);
1153-
}
1133+
if ($loc) {
1134+
// found the class
1135+
include_once $loc;
1136+
} else {
1137+
// can't find the class
1138+
return $this->error(
1139+
"Render rule '$rule' in format '$format' not found"
1140+
);
1141+
}
11541142

11551143
$this->renderObj[$rule] = new $class($this);
11561144
}
@@ -1172,15 +1160,15 @@ function loadFormatObj($format)
11721160
$class = "Text_Wiki_Render_$format";
11731161

11741162
$loc = $this->findFile('render', $file);
1175-
if ($loc) {
1176-
// found the class
1177-
include_once $loc;
1178-
} else {
1179-
// can't find the class
1180-
return $this->error(
1181-
"Rendering format class '$class' not found"
1182-
);
1183-
}
1163+
if ($loc) {
1164+
// found the class
1165+
include_once $loc;
1166+
} else {
1167+
// can't find the class
1168+
return $this->error(
1169+
"Rendering format class '$class' not found"
1170+
);
1171+
}
11841172

11851173
$this->formatObj[$format] = new $class($this);
11861174
}
@@ -1281,7 +1269,7 @@ function fixPath($path)
12811269
$len = strlen($this->_dirSep);
12821270

12831271
if (! empty($path) &&
1284-
substr($path, -1 * $len, $len) != $this->_dirSep) {
1272+
substr($path, -1 * $len, $len) != $this->_dirSep) {
12851273
return $path . $this->_dirSep;
12861274
} else {
12871275
return $path;
@@ -1302,12 +1290,12 @@ function fixPath($path)
13021290

13031291
function &error($message)
13041292
{
1305-
throw new ProcessException($message);
1306-
// FIX?
1307-
if (! class_exists('PEAR_Error')) {
1308-
include_once 'PEAR.php';
1309-
}
1310-
return PEAR::throwError($message);
1293+
throw new ProcessException($message);
1294+
// FIX?
1295+
if (! class_exists('PEAR_Error')) {
1296+
include_once 'PEAR.php';
1297+
}
1298+
return PEAR::throwError($message);
13111299
}
13121300

13131301
/**
@@ -1324,6 +1312,6 @@ function &error($message)
13241312

13251313
function isError(&$obj)
13261314
{
1327-
return is_a($obj, 'PEAR_Error');
1315+
return is_a($obj, 'PEAR_Error');
13281316
}
13291317
}

Text/Wiki/Parse.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
* @version Release: @package_version@
3838
* @link http://pear.php.net/package/Text_Wiki
3939
*/
40-
class Text_Wiki_Parse {
40+
class Text_Wiki_Parse
41+
{
4142

4243
/**
4344
*
@@ -117,12 +118,10 @@ function Text_Wiki_Parse(&$obj)
117118
// override config options for the rule if specified
118119
if (isset($this->wiki->parseConf[$this->rule]) &&
119120
is_array($this->wiki->parseConf[$this->rule])) {
120-
121121
$this->conf = array_merge(
122122
$this->conf,
123123
$this->wiki->parseConf[$this->rule]
124124
);
125-
126125
}
127126
}
128127

@@ -142,7 +141,7 @@ function Text_Wiki_Parse(&$obj)
142141

143142
function parse()
144143
{
145-
if($this->regex){
144+
if ($this->regex) {
146145
$this->wiki->source = preg_replace_callback(
147146
$this->regex,
148147
array(&$this, 'process'),
@@ -232,7 +231,6 @@ function getAttrs($text)
232231

233232
// loop through the sections
234233
foreach ($tmp as $i => $val) {
235-
236234
// first element is always the first key
237235
if ($i == 0) {
238236
$key = trim($val);
@@ -245,10 +243,8 @@ function getAttrs($text)
245243
$pos = strrpos($val, '"');
246244
$attrs[$key] = stripslashes(substr($val, 0, $pos));
247245
$key = trim(substr($val, $pos+1));
248-
249246
}
250247

251248
return $attrs;
252-
253249
}
254250
}

Text/Wiki/Parse/Default/Anchor.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
*
3434
*/
3535

36-
class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
36+
class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse
37+
{
3738

3839
/**
3940
*
@@ -45,7 +46,7 @@ class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
4546
* @var string
4647
*
4748
*/
48-
public $regex = '/' .
49+
public $regex = '/' .
4950
'(\[\[\#\s)' . # Two brackets, then hash
5051
'([-_A-Za-z0-9.%]+?)' . # Contents of anchor
5152
'(\]\])' . # Closing brackets
@@ -65,13 +66,16 @@ class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
6566
* the source text.
6667
*
6768
*/
68-
function process(&$matches) {
69+
function process(&$matches)
70+
{
6971

7072
$name = $matches[2];
7173

72-
$start = $this->wiki->addToken($this->rule,
73-
array(
74-
'name' => $name));
74+
$start = $this->wiki->addToken(
75+
$this->rule,
76+
array(
77+
'name' => $name)
78+
);
7579

7680
// done, place the script output directly in the source
7781
return $start;

0 commit comments

Comments
 (0)