@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * Simple test to make sure the plugin.info.txt is in correct format |
| 28 | 28 | */ |
| 29 | 29 | public function test_plugininfo() { |
| 30 | - $file = __DIR__ . '/../plugin.info.txt'; |
|
| 30 | + $file = __DIR__.'/../plugin.info.txt'; |
|
| 31 | 31 | $this->assertFileExists($file); |
| 32 | 32 | |
| 33 | 33 | $info = confToHash($file); |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * copy data and add pages to the index. |
| 30 | 30 | */ |
| 31 | - public static function setUpBeforeClass(){ |
|
| 31 | + public static function setUpBeforeClass() { |
|
| 32 | 32 | parent::setUpBeforeClass(); |
| 33 | 33 | global $conf; |
| 34 | 34 | $conf['allowdebug'] = 1; |
| 35 | 35 | |
| 36 | - TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/data/'); |
|
| 36 | + TestUtils::rcopy(TMP_DIR, dirname(__FILE__).'/data/'); |
|
| 37 | 37 | |
| 38 | 38 | dbglog("\nset up class syntax_plugin_backlinks_test"); |
| 39 | 39 | } |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $verbose = false; |
| 54 | 54 | $force = false; |
| 55 | - foreach($data as $val) { |
|
| 55 | + foreach ($data as $val) { |
|
| 56 | 56 | idx_addPage($val['id'], $verbose, $force); |
| 57 | 57 | } |
| 58 | 58 | //idx_addPage('bob_ross_says', $verbose, $force); |
| 59 | 59 | //idx_addPage('link', $verbose, $force); |
| 60 | 60 | //idx_addPage('backlinks_syntax', $verbose, $force); |
| 61 | - if($conf['allowdebug']) { |
|
| 61 | + if ($conf['allowdebug']) { |
|
| 62 | 62 | touch(DOKU_TMP_DATA.'cache/debug.log'); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | global $conf; |
| 70 | 70 | // try to get the debug log after running the test, print and clear |
| 71 | - if($conf['allowdebug']) { |
|
| 71 | + if ($conf['allowdebug']) { |
|
| 72 | 72 | print "\n"; |
| 73 | 73 | readfile(DOKU_TMP_DATA.'cache/debug.log'); |
| 74 | 74 | unlink(DOKU_TMP_DATA.'cache/debug.log'); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | 'There should be 4 backlinks' |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - $lastlink = pq('a:last',$wikilinks); |
|
| 141 | - dbglog($lastlink->text(),"last backlink"); |
|
| 140 | + $lastlink = pq('a:last', $wikilinks); |
|
| 141 | + dbglog($lastlink->text(), "last backlink"); |
|
| 142 | 142 | $this->assertEquals( |
| 143 | 143 | $lastlink->text(), |
| 144 | 144 | 'A link to Bob Ross', |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * copy data and add pages to the index. |
| 30 | 30 | */ |
| 31 | - public static function setUpBeforeClass(){ |
|
| 31 | + public static function setUpBeforeClass() { |
|
| 32 | 32 | parent::setUpBeforeClass(); |
| 33 | 33 | global $conf; |
| 34 | 34 | $conf['allowdebug'] = 1; |
| 35 | 35 | |
| 36 | - TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/data/'); |
|
| 36 | + TestUtils::rcopy(TMP_DIR, dirname(__FILE__).'/data/'); |
|
| 37 | 37 | |
| 38 | 38 | dbglog("\nset up class syntax_plugin_backlinks_test"); |
| 39 | 39 | } |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $verbose = false; |
| 54 | 54 | $force = false; |
| 55 | - foreach($data as $val) { |
|
| 55 | + foreach ($data as $val) { |
|
| 56 | 56 | idx_addPage($val['id'], $verbose, $force); |
| 57 | 57 | } |
| 58 | 58 | //idx_addPage('bob_ross_says', $verbose, $force); |
| 59 | 59 | //idx_addPage('link', $verbose, $force); |
| 60 | 60 | //idx_addPage('backlinks_syntax', $verbose, $force); |
| 61 | - if($conf['allowdebug']) { |
|
| 61 | + if ($conf['allowdebug']) { |
|
| 62 | 62 | touch(DOKU_TMP_DATA.'cache/debug.log'); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | global $conf; |
| 70 | 70 | // try to get the debug log after running the test, print and clear |
| 71 | - if($conf['allowdebug']) { |
|
| 71 | + if ($conf['allowdebug']) { |
|
| 72 | 72 | print "\n"; |
| 73 | 73 | readfile(DOKU_TMP_DATA.'cache/debug.log'); |
| 74 | 74 | unlink(DOKU_TMP_DATA.'cache/debug.log'); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | 'There should be 4 backlinks' |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - $lastlink = pq('a:last',$wikilinks); |
|
| 141 | - dbglog($lastlink->text(),"last backlink"); |
|
| 140 | + $lastlink = pq('a:last', $wikilinks); |
|
| 141 | + dbglog($lastlink->text(), "last backlink"); |
|
| 142 | 142 | $this->assertEquals( |
| 143 | 143 | $lastlink->text(), |
| 144 | 144 | 'A link to Bob Ross', |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * copy data and add pages to the index. |
| 30 | 30 | */ |
| 31 | - public static function setUpBeforeClass(){ |
|
| 31 | + public static function setUpBeforeClass() { |
|
| 32 | 32 | parent::setUpBeforeClass(); |
| 33 | 33 | global $conf; |
| 34 | 34 | $conf['allowdebug'] = 1; |
| 35 | 35 | |
| 36 | - TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/data/'); |
|
| 36 | + TestUtils::rcopy(TMP_DIR, dirname(__FILE__).'/data/'); |
|
| 37 | 37 | |
| 38 | 38 | dbglog("\nset up class syntax_plugin_backlinks_test"); |
| 39 | 39 | } |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $verbose = false; |
| 54 | 54 | $force = false; |
| 55 | - foreach($data as $val) { |
|
| 55 | + foreach ($data as $val) { |
|
| 56 | 56 | idx_addPage($val['id'], $verbose, $force); |
| 57 | 57 | } |
| 58 | 58 | //idx_addPage('bob_ross_says', $verbose, $force); |
| 59 | 59 | //idx_addPage('link', $verbose, $force); |
| 60 | 60 | //idx_addPage('backlinks_syntax', $verbose, $force); |
| 61 | - if($conf['allowdebug']) { |
|
| 61 | + if ($conf['allowdebug']) { |
|
| 62 | 62 | touch(DOKU_TMP_DATA.'cache/debug.log'); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | global $conf; |
| 70 | 70 | // try to get the debug log after running the test, print and clear |
| 71 | - if($conf['allowdebug']) { |
|
| 71 | + if ($conf['allowdebug']) { |
|
| 72 | 72 | print "\n"; |
| 73 | 73 | readfile(DOKU_TMP_DATA.'cache/debug.log'); |
| 74 | 74 | unlink(DOKU_TMP_DATA.'cache/debug.log'); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | 'There should be 4 backlinks' |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - $lastlink = pq('a:last',$wikilinks); |
|
| 141 | - dbglog($lastlink->text(),"last backlink"); |
|
| 140 | + $lastlink = pq('a:last', $wikilinks); |
|
| 141 | + dbglog($lastlink->text(), "last backlink"); |
|
| 142 | 142 | $this->assertEquals( |
| 143 | 143 | $lastlink->text(), |
| 144 | 144 | 'A link to Bob Ross', |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * Needs to return one of the mode types defined in $PARSER_MODES in parser.php |
| 33 | 33 | * @see DokuWiki_Syntax_Plugin::getType() |
| 34 | 34 | */ |
| 35 | - function getType() { return 'substition'; } |
|
| 35 | + function getType() { return 'substition'; } |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @see DokuWiki_Syntax_Plugin::getPType() |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @see Doku_Parser_Mode::getSort() |
| 44 | 44 | */ |
| 45 | - function getSort() { return 304; } |
|
| 45 | + function getSort() { return 304; } |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Connect pattern to lexer. |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * Handler to prepare matched data for the rendering process. |
| 57 | 57 | * @see DokuWiki_Syntax_Plugin::handle() |
| 58 | 58 | */ |
| 59 | - function handle($match, $state, $pos, Doku_Handler $handler){ |
|
| 59 | + function handle($match, $state, $pos, Doku_Handler $handler) { |
|
| 60 | 60 | |
| 61 | 61 | // Take the id of the source |
| 62 | 62 | // It can be a rendering of a sidebar |
@@ -69,17 +69,17 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // strip {{backlinks> from start and }} from end |
| 72 | - $match = substr($match,12,-2); |
|
| 72 | + $match = substr($match, 12, -2); |
|
| 73 | 73 | |
| 74 | - if(strstr($match, "#")){ |
|
| 74 | + if (strstr($match, "#")) { |
|
| 75 | 75 | $includeNS = substr(strstr($match, "#", FALSE), 1); |
| 76 | - $match= strstr($match, "#", TRUE); |
|
| 76 | + $match = strstr($match, "#", TRUE); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $match = ($match == '.') ? $id : $match; |
| 80 | 80 | |
| 81 | - if(strstr($match,".:")) { |
|
| 82 | - resolve_pageid(getNS($id),$match,$exists); |
|
| 81 | + if (strstr($match, ".:")) { |
|
| 82 | + resolve_pageid(getNS($id), $match, $exists); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return (array($match, $includeNS)); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | function render($mode, Doku_Renderer $renderer, $data) { |
| 93 | 93 | global $lang; |
| 94 | 94 | |
| 95 | - if($mode == 'xhtml'){ |
|
| 95 | + if ($mode == 'xhtml') { |
|
| 96 | 96 | $renderer->info['cache'] = false; |
| 97 | 97 | |
| 98 | 98 | @require_once(DOKU_INC.'inc/fulltext.php'); |
@@ -100,19 +100,19 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | dbglog($backlinks, "backlinks: all backlinks to: $data[0]"); |
| 102 | 102 | |
| 103 | - $renderer->doc .= '<div id="plugin__backlinks">' . DW_LF; |
|
| 103 | + $renderer->doc .= '<div id="plugin__backlinks">'.DW_LF; |
|
| 104 | 104 | |
| 105 | 105 | $filterNS = $data[1]; |
| 106 | - if(!empty($backlinks) && !empty($filterNS)) { |
|
| 106 | + if (!empty($backlinks) && !empty($filterNS)) { |
|
| 107 | 107 | if (stripos($filterNS, "!", 0) === 0) { |
| 108 | 108 | $filterNS = substr($filterNS, 1); |
| 109 | 109 | dbglog($filterNS, "backlinks: exluding all of namespace: $filterNS"); |
| 110 | - $backlinks= array_filter($backlinks, function($ns) use($filterNS) { |
|
| 110 | + $backlinks = array_filter($backlinks, function($ns) use($filterNS) { |
|
| 111 | 111 | return stripos($ns, $filterNS, 0) !== 0; |
| 112 | 112 | }); |
| 113 | 113 | } else { |
| 114 | 114 | dbglog($filterNS, "backlinks: including namespace: $filterNS only"); |
| 115 | - $backlinks= array_filter($backlinks, function($ns) use($filterNS) { |
|
| 115 | + $backlinks = array_filter($backlinks, function($ns) use($filterNS) { |
|
| 116 | 116 | return stripos($ns, $filterNS, 0) === 0; |
| 117 | 117 | }); |
| 118 | 118 | } |
@@ -120,24 +120,24 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | dbglog($backlinks, "backlinks: all backlinks to be rendered"); |
| 122 | 122 | |
| 123 | - if(!empty($backlinks)) { |
|
| 123 | + if (!empty($backlinks)) { |
|
| 124 | 124 | |
| 125 | 125 | $renderer->doc .= '<ul class="idx">'; |
| 126 | 126 | |
| 127 | - foreach($backlinks as $backlink){ |
|
| 127 | + foreach ($backlinks as $backlink) { |
|
| 128 | 128 | $name = p_get_metadata($backlink, 'title'); |
| 129 | - if(empty($name)) $name = $backlink; |
|
| 129 | + if (empty($name)) $name = $backlink; |
|
| 130 | 130 | $renderer->doc .= '<li><div class="li">'; |
| 131 | 131 | $renderer->doc .= html_wikilink(':'.$backlink, $name); |
| 132 | - $renderer->doc .= '</div></li>' . DW_LF; |
|
| 132 | + $renderer->doc .= '</div></li>'.DW_LF; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $renderer->doc .= '</ul>' . DW_LF; |
|
| 135 | + $renderer->doc .= '</ul>'.DW_LF; |
|
| 136 | 136 | } else { |
| 137 | - $renderer->doc .= "<strong>Plugin Backlinks: " . $lang['nothingfound'] . "</strong>" . DW_LF; |
|
| 137 | + $renderer->doc .= "<strong>Plugin Backlinks: ".$lang['nothingfound']."</strong>".DW_LF; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $renderer->doc .= '</div>' . DW_LF; |
|
| 140 | + $renderer->doc .= '</div>'.DW_LF; |
|
| 141 | 141 | |
| 142 | 142 | return true; |
| 143 | 143 | } |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * copy data and add pages to the index. |
| 30 | 30 | */ |
| 31 | - public static function setUpBeforeClass(){ |
|
| 31 | + public static function setUpBeforeClass() { |
|
| 32 | 32 | parent::setUpBeforeClass(); |
| 33 | 33 | global $conf; |
| 34 | 34 | $conf['allowdebug'] = 1; |
| 35 | 35 | |
| 36 | - TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/data/'); |
|
| 36 | + TestUtils::rcopy(TMP_DIR, dirname(__FILE__).'/data/'); |
|
| 37 | 37 | |
| 38 | 38 | dbglog("\nset up class syntax_plugin_backlinks_test"); |
| 39 | 39 | } |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $verbose = false; |
| 54 | 54 | $force = false; |
| 55 | - foreach($data as $val) { |
|
| 55 | + foreach ($data as $val) { |
|
| 56 | 56 | idx_addPage($val['id'], $verbose, $force); |
| 57 | 57 | } |
| 58 | 58 | //idx_addPage('bob_ross_says', $verbose, $force); |
| 59 | 59 | //idx_addPage('link', $verbose, $force); |
| 60 | 60 | //idx_addPage('backlinks_syntax', $verbose, $force); |
| 61 | - if($conf['allowdebug']) { |
|
| 61 | + if ($conf['allowdebug']) { |
|
| 62 | 62 | touch(DOKU_TMP_DATA.'cache/debug.log'); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | global $conf; |
| 70 | 70 | // try to get the debug log after running the test, print and clear |
| 71 | - if($conf['allowdebug']) { |
|
| 71 | + if ($conf['allowdebug']) { |
|
| 72 | 72 | print "\n"; |
| 73 | 73 | readfile(DOKU_TMP_DATA.'cache/debug.log'); |
| 74 | 74 | unlink(DOKU_TMP_DATA.'cache/debug.log'); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | 'There should be 4 backlinks' |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - $lastlink = pq('a:last',$wikilinks); |
|
| 141 | - dbglog($lastlink->text(),"last backlink"); |
|
| 140 | + $lastlink = pq('a:last', $wikilinks); |
|
| 141 | + dbglog($lastlink->text(), "last backlink"); |
|
| 142 | 142 | $this->assertEquals( |
| 143 | 143 | $lastlink->text(), |
| 144 | 144 | 'A link to Bob Ross', |