From 5ab3f10bedaf1af2b66181260d520d3be616b00a Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 27 Jan 2022 21:37:19 +0100 Subject: [PATCH 01/12] auto code cleanup --- lang/en/lang.php | 2 +- syntax.php | 117 +++++++++++++++++++++++++---------------------- 2 files changed, 63 insertions(+), 56 deletions(-) diff --git a/lang/en/lang.php b/lang/en/lang.php index 05d73b9..c351969 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -1,5 +1,5 @@ */ // must be run within Dokuwiki -if(!defined('DOKU_INC')) die(); +if (!defined('DOKU_INC')) die(); -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); -require_once(DOKU_PLUGIN.'syntax.php'); +if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); +require_once(DOKU_PLUGIN . 'syntax.php'); -class syntax_plugin_xref extends DokuWiki_Syntax_Plugin { +class syntax_plugin_xref extends DokuWiki_Syntax_Plugin +{ var $dir = ''; var $web = ''; - function syntax_plugin_xref(){ - $this->dir = rtrim($this->getConf('dir'),'/'); - $this->web = rtrim($this->getConf('web'),'/'); + function syntax_plugin_xref() + { + $this->dir = rtrim($this->getConf('dir'), '/'); + $this->web = rtrim($this->getConf('web'), '/'); } /** * What kind of syntax are we? */ - function getType(){ + function getType() + { return 'substition'; } /** * What about paragraphs? */ - function getPType(){ + function getPType() + { return 'normal'; } /** * Where to sort in? */ - function getSort(){ + function getSort() + { return 150; } - /** * Connect pattern to lexer */ - function connectTo($mode) { - $this->Lexer->addSpecialPattern('\[\[xref>.+?\]\]',$mode,'plugin_xref'); + function connectTo($mode) + { + $this->Lexer->addSpecialPattern('\[\[xref>.+?\]\]', $mode, 'plugin_xref'); } - /** * Handle the match */ - function handle($match, $state, $pos, Doku_Handler $handler){ - $match = trim(substr($match,7,-2)); + function handle($match, $state, $pos, Doku_Handler $handler) + { + $match = trim(substr($match, 7, -2)); - list($link,$name) = explode('|',$match,2); - list($link,$anchor) = explode('#',$link,2); - if(!$name) $name = $link; - if($anchor) $anchor = "#".$anchor; + list($link, $name) = explode('|', $match, 2); + list($link, $anchor) = explode('#', $link, 2); + if (!$name) $name = $link; + if ($anchor) $anchor = "#" . $anchor; $first = 0; - if($link[0] == '$') $first = 4; - $found = $this->_find($link,$first); + if ($link[0] == '$') $first = 4; + $found = $this->_find($link, $first); - return array($link,$found,$name,$anchor); + return array($link, $found, $name, $anchor); } /** * Create output */ - function render($format, Doku_Renderer $R, $data) { + function render($format, Doku_Renderer $R, $data) + { global $conf; - if($format != 'xhtml') return false; + if ($format != 'xhtml') return false; //prepare for formating $link['target'] = $conf['target']['extern']; - $link['style'] = ''; - $link['pre'] = ''; - $link['suf'] = ''; - $link['more'] = ''; - $link['class'] = 'xref_plugin'; - $link['name'] = hsc($data[2]); - - if(!$data[1]){ - $link['url'] = $this->web; + $link['style'] = ''; + $link['pre'] = ''; + $link['suf'] = ''; + $link['more'] = ''; + $link['class'] = 'xref_plugin'; + $link['name'] = hsc($data[2]); + + if (!$data[1]) { + $link['url'] = $this->web; $link['title'] = $this->getLang('unknown'); $link['class'] .= ' xref_plugin_err'; - }else{ - $link['url'] = $this->web.'/'.$data[1].hsc($data[3]); - $link['title'] = sprintf($this->getLang('view'),hsc($data[0])); + } else { + $link['url'] = $this->web . '/' . $data[1] . hsc($data[3]); + $link['title'] = sprintf($this->getLang('view'), hsc($data[0])); } $R->doc .= $R->_formatLink($link); @@ -101,32 +107,33 @@ function render($format, Doku_Renderer $R, $data) { * * @param int $first - defines which type should be searched first for the name */ - function _find($name,$first=0){ + function _find($name, $first = 0) + { $paths = array( - 0 => '_functions', - 1 => '_classes', - 2 => '_constants', - 3 => '_tables', - 4 => '_variables' - ); - - $clean = preg_replace('/[^\w\-_]+/','',$name); + 0 => '_functions', + 1 => '_classes', + 2 => '_constants', + 3 => '_tables', + 4 => '_variables', + ); + + $clean = preg_replace('/[^\w\-_]+/', '', $name); $small = strtolower($clean); $path = $paths[$first]; unset($paths[$first]); - do{ - $check = $path.'/'.$clean.'.html'; - if(@file_exists($this->dir.'/'.$check)) return $check; - $check = $path.'/'.$small.'.html'; - if(@file_exists($this->dir.'/'.$check)) return $check; + do { + $check = $path . '/' . $clean . '.html'; + if (@file_exists($this->dir . '/' . $check)) return $check; + $check = $path . '/' . $small . '.html'; + if (@file_exists($this->dir . '/' . $check)) return $check; $path = array_shift($paths); - }while($path); + } while ($path); // still here? might be a file reference - $clean = preg_replace('/\.\.+/','.',$name); - if(@file_exists($this->dir.'/'.$clean.'.html')){ - return $clean.'.html'; + $clean = preg_replace('/\.\.+/', '.', $name); + if (@file_exists($this->dir . '/' . $clean . '.html')) { + return $clean . '.html'; } return ''; From 7746fe8fdd47d33e1ed3823e7c98ea1e3121795f Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 27 Jan 2022 21:46:08 +0100 Subject: [PATCH 02/12] more cleanup --- syntax.php | 53 +++++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/syntax.php b/syntax.php index d7c0bef..e4fdab6 100644 --- a/syntax.php +++ b/syntax.php @@ -3,60 +3,45 @@ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Andreas Gohr */ -// must be run within Dokuwiki -if (!defined('DOKU_INC')) die(); - -if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); -require_once(DOKU_PLUGIN . 'syntax.php'); class syntax_plugin_xref extends DokuWiki_Syntax_Plugin { - var $dir = ''; - var $web = ''; + protected $dir = ''; + protected $web = ''; - function syntax_plugin_xref() + public function __construct() { $this->dir = rtrim($this->getConf('dir'), '/'); $this->web = rtrim($this->getConf('web'), '/'); } - /** - * What kind of syntax are we? - */ - function getType() + /** @inheritdoc */ + public function getType() { return 'substition'; } - /** - * What about paragraphs? - */ - function getPType() + /** @inheritdoc */ + public function getPType() { return 'normal'; } - /** - * Where to sort in? - */ - function getSort() + /** @inheritdoc */ + public function getSort() { return 150; } - /** - * Connect pattern to lexer - */ - function connectTo($mode) + /** @inheritdoc */ + public function connectTo($mode) { $this->Lexer->addSpecialPattern('\[\[xref>.+?\]\]', $mode, 'plugin_xref'); } - /** - * Handle the match - */ - function handle($match, $state, $pos, Doku_Handler $handler) + /** @inheritdoc */ + public function handle($match, $state, $pos, Doku_Handler $handler) { $match = trim(substr($match, 7, -2)); @@ -67,15 +52,13 @@ function handle($match, $state, $pos, Doku_Handler $handler) $first = 0; if ($link[0] == '$') $first = 4; - $found = $this->_find($link, $first); + $found = $this->find($link, $first); return array($link, $found, $name, $anchor); } - /** - * Create output - */ - function render($format, Doku_Renderer $R, $data) + /** @inheritdoc */ + public function render($format, Doku_Renderer $R, $data) { global $conf; if ($format != 'xhtml') return false; @@ -107,7 +90,7 @@ function render($format, Doku_Renderer $R, $data) * * @param int $first - defines which type should be searched first for the name */ - function _find($name, $first = 0) + protected function find($name, $first = 0) { $paths = array( 0 => '_functions', @@ -140,5 +123,3 @@ function _find($name, $first = 0) } } - -//Setup VIM: ex: et ts=4 enc=utf-8 : From d4a11906f9835a31d350a4bd6d056ff687a71365 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 27 Jan 2022 23:12:27 +0100 Subject: [PATCH 03/12] new mechanisms to reference Grok instead of phprxref This implements a mechanism that transforms our current references into search terms understood by Grok. Using the API we can even check if there's any hits (ideally it should be exactly one) --- .github/workflows/phpTestLinux.yml | 52 +++++++++ Grok.php | 72 +++++++++++++ Heuristics.php | 164 +++++++++++++++++++++++++++++ _test/GeneralTest.php | 86 +++++++++++++++ _test/GrokTest.php | 45 ++++++++ _test/HeuristicsTest.php | 51 +++++++++ 6 files changed, 470 insertions(+) create mode 100644 .github/workflows/phpTestLinux.yml create mode 100644 Grok.php create mode 100644 Heuristics.php create mode 100644 _test/GeneralTest.php create mode 100644 _test/GrokTest.php create mode 100644 _test/HeuristicsTest.php diff --git a/.github/workflows/phpTestLinux.yml b/.github/workflows/phpTestLinux.yml new file mode 100644 index 0000000..3eeea18 --- /dev/null +++ b/.github/workflows/phpTestLinux.yml @@ -0,0 +1,52 @@ +name: PHP Tests on Linux + +on: [push, pull_request] + +jobs: + testLinux: + name: PHP ${{ matrix.php-versions }} DokuWiki ${{ matrix.dokuwiki-branch }} + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0'] + dokuwiki-branch: [ 'master', 'stable'] + exclude: + - dokuwiki-branch: 'stable' + php-versions: '8.0' + fail-fast: false + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, PDO, pdo_sqlite, bz2 + + - name: Setup problem matchers + run: | + echo ::add-matcher::${{ runner.tool_cache }}/php.json + echo ::add-matcher::${{ runner.tool_cache }}/phpunit.json + + - name: Download DokuWiki Test-setup + run: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh + + - name: Run DokuWiki Test-setup + env: + CI_SERVER: 1 + DOKUWIKI: ${{ matrix.dokuwiki-branch }} + run: sh travis.sh + + - name: Setup PHPUnit + run: | + php _test/fetchphpunit.php + cd _test + + - name: Run PHPUnit + run: | + cd _test + php phpunit.phar --verbose --stderr --group plugin_xref diff --git a/Grok.php b/Grok.php new file mode 100644 index 0000000..c002f9a --- /dev/null +++ b/Grok.php @@ -0,0 +1,72 @@ +def = $heuristic->getDef(); + $this->path = $heuristic->getPath(); + $this->baseUrl = rtrim($baseUrl, '/'); + } + + /** + * Return the URL that leads to the search interface + * + * @return string + */ + public function getSearchUrl() + { + $url = $this->baseUrl . '/search?'; + $param = [ + 'project' => 'dokuwiki', + 'defs' => $this->def, + 'path' => $this->path, + ]; + $url .= buildURLparams($param, '&'); + return $url; + } + + /** + * Return the URL that allows to query the API + * + * @return string + */ + public function getAPIUrl() + { + $url = $this->baseUrl . '/api/v1/search?'; + $param = [ + 'projects' => 'dokuwiki', + 'def' => $this->def, + 'path' => $this->path, + ]; + $url .= buildURLparams($param, '&'); + return $url; + } + + /** + * Return the number of results to expect + * + * @return false|int false on errors + */ + public function getResultCount() + { + $http = new DokuHTTPClient(); + $http->timeout = 5; + $json = $http->get($this->getAPIUrl()); + if (!$json) return false; + $data = json_decode($json, true); + if (!$data) return false; + if (!isset($data['resultCount'])) return false; + return $data['resultCount']; + } +} diff --git a/Heuristics.php b/Heuristics.php new file mode 100644 index 0000000..f9d4662 --- /dev/null +++ b/Heuristics.php @@ -0,0 +1,164 @@ +checkHash($reference); + if ($reference !== '') $reference = $this->checkFilename($reference); + if ($reference !== '') $reference = $this->checkNamespace($reference); + if ($reference !== '') $reference = $this->checkClassPrefix($reference); + if ($reference !== '') $reference = $this->checkVariable($reference); + if ($reference !== '') $reference = $this->checkFunction($reference); + if ($reference !== '') $reference = $this->checkPSRClass($reference); + if ($reference !== '') $this->def = $reference; + } + + /** + * @return string + */ + public function getDef() + { + return trim(preg_replace('/[^\w]+/', '', $this->def)); + } + + /** + * @return string + */ + public function getPath() + { + return trim(preg_replace('/[^\w.]+/', ' ', $this->path)); + } + + /** + * Handle things in the form path#symbol + * + * @param string $reference + * @return string + */ + protected function checkHash($reference) + { + if (strpos($reference, '#') === false) return $reference; + list($this->path, $this->def) = explode('#', $reference, 2); + return ''; + } + + /** + * Known file extension? + * + * @param string $reference + * @return mixed|string + */ + protected function checkFilename($reference) + { + if (preg_match('/\.(php|js|css|html)$/', $reference)) { + $this->def = ''; + $this->path = $reference; + return ''; + } + return $reference; + } + + /** + * Namespaces are paths + * + * @param string $reference + * @return string + */ + protected function checkNamespace($reference) + { + if (strpos($reference, '\\') === false) return $reference; + + $parts = explode('\\', $reference); + $parts = array_filter($parts); + $reference = array_pop($parts); // last part may be more than a class + + // our classes are in inc + if($parts[0] == 'dokuwiki') $parts[0] = 'inc'; + + $this->path = join(' ', $parts); + + return $reference; + } + + /** + * Is there something called on a class? + */ + protected function checkClassPrefix($reference) + { + if ( + strpos($reference, '::') === false && + strpos($reference, '->') === false + ) { + return $reference; + } + list($class, $reference) = preg_split('/(::|->)/', $reference, 2); + + $this->path .= ' ' . $class; + $this->def = $reference; + return ''; + } + + /** + * Clearly a variable + * + * @param string $reference + * @return string + */ + protected function checkVariable($reference) + { + if ($reference[0] == '$') { + $this->def = $reference; + return ''; + } + return $reference; + } + + /** + * It's a function + * + * @param string $reference + * @return string + */ + protected function checkFunction($reference) + { + if (substr($reference, -2) == '()') { + $this->def = $reference; + return ''; + } + return $reference; + } + + /** + * Upercase followed by lowercase letter, must be a class + * + * Those are in their own files, so add it to the path + * @param $reference + * @return mixed|string + */ + protected function checkPSRClass($reference) + { + if (preg_match('/^[A-Z][a-z]/', $reference)) { + $this->def = $reference; + $this->path .= ' ' . $reference; + return ''; + } + return $reference; + } +} diff --git a/_test/GeneralTest.php b/_test/GeneralTest.php new file mode 100644 index 0000000..a30d92e --- /dev/null +++ b/_test/GeneralTest.php @@ -0,0 +1,86 @@ +assertFileExists($file); + + $info = confToHash($file); + + $this->assertArrayHasKey('base', $info); + $this->assertArrayHasKey('author', $info); + $this->assertArrayHasKey('email', $info); + $this->assertArrayHasKey('date', $info); + $this->assertArrayHasKey('name', $info); + $this->assertArrayHasKey('desc', $info); + $this->assertArrayHasKey('url', $info); + + $this->assertEquals('xref', $info['base']); + $this->assertRegExp('/^https?:\/\//', $info['url']); + $this->assertTrue(mail_isvalid($info['email'])); + $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); + $this->assertTrue(false !== strtotime($info['date'])); + } + + /** + * Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in + * conf/metadata.php. + */ + public function testPluginConf(): void + { + $conf_file = __DIR__ . '/../conf/default.php'; + $meta_file = __DIR__ . '/../conf/metadata.php'; + + if (!file_exists($conf_file) && !file_exists($meta_file)) { + self::markTestSkipped('No config files exist -> skipping test'); + } + + if (file_exists($conf_file)) { + include($conf_file); + } + if (file_exists($meta_file)) { + include($meta_file); + } + + $this->assertEquals( + gettype($conf), + gettype($meta), + 'Both ' . DOKU_PLUGIN . 'xref/conf/default.php and ' . DOKU_PLUGIN . 'xref/conf/metadata.php have to exist and contain the same keys.' + ); + + if ($conf !== null && $meta !== null) { + foreach ($conf as $key => $value) { + $this->assertArrayHasKey( + $key, + $meta, + 'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'xref/conf/metadata.php' + ); + } + + foreach ($meta as $key => $value) { + $this->assertArrayHasKey( + $key, + $conf, + 'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'xref/conf/default.php' + ); + } + } + + } +} diff --git a/_test/GrokTest.php b/_test/GrokTest.php new file mode 100644 index 0000000..c26e76f --- /dev/null +++ b/_test/GrokTest.php @@ -0,0 +1,45 @@ +getLabel()'], + ['AbstractItem::getLabel()'], + ['AbstractItem->getLabel()'], + ['AbstractItem'], + ]; + } + + /** + * @dataProvider provideData + * @param string $reference + */ + public function testResultCount($reference) + { + $grok = new Grok($reference); + $this->assertEquals(1, $grok->getResultCount(), $grok->getSearchUrl()); + } +} diff --git a/_test/HeuristicsTest.php b/_test/HeuristicsTest.php new file mode 100644 index 0000000..f81aeae --- /dev/null +++ b/_test/HeuristicsTest.php @@ -0,0 +1,51 @@ +getLabel()', 'getLabel', 'inc Menu Item AbstractItem'], + ['AbstractItem::getLabel()', 'getLabel', 'AbstractItem'], + ['AbstractItem->getLabel()', 'getLabel', 'AbstractItem'], + ['$INFO', 'INFO', ''], + ['foobar()', 'foobar', ''], + ['FooBar()', 'FooBar', ''], + ['AbstractItem', 'AbstractItem', 'AbstractItem'], + ['abstractItem', 'abstractItem', ''], + ]; + } + + /** + * @dataProvider provideData + * @param string $reference + * @param string $expDef + * @param string $expPath + */ + public function testHeuristics($reference, $expDef, $expPath) + { + $heur = new Heuristics($reference); + + $this->assertEquals($expDef, $heur->getDef(), 'definition is wrong'); + $this->assertEquals($expPath, $heur->getPath(), 'path is wrong'); + } +} From 4463a3c415e9939a5cd5bc293072ccaee3d440a4 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 27 Jan 2022 23:54:28 +0100 Subject: [PATCH 04/12] integrate new Grok based xref into the syntax --- Grok.php | 4 ++ _test/GrokTest.php | 7 ++++ conf/default.php | 9 +++++ conf/metadata.php | 4 +- lang/en/lang.php | 1 + lang/en/settings.php | 3 +- style.css | 11 ------ style.less | 8 ++++ syntax.php | 88 +++++++++++++------------------------------ xref.png | Bin 481 -> 0 bytes xref.svg | 1 + 11 files changed, 59 insertions(+), 77 deletions(-) create mode 100644 conf/default.php delete mode 100644 style.css create mode 100644 style.less delete mode 100644 xref.png create mode 100644 xref.svg diff --git a/Grok.php b/Grok.php index c002f9a..4549e83 100644 --- a/Grok.php +++ b/Grok.php @@ -26,6 +26,8 @@ public function __construct($reference, $baseUrl = 'https://codesearch.dokuwiki. */ public function getSearchUrl() { + if($this->def === '' && $this->path === '') return $this->baseUrl; + $url = $this->baseUrl . '/search?'; $param = [ 'project' => 'dokuwiki', @@ -60,6 +62,8 @@ public function getAPIUrl() */ public function getResultCount() { + if($this->def === '' && $this->path === '') return 0; + $http = new DokuHTTPClient(); $http->timeout = 5; $json = $http->get($this->getAPIUrl()); diff --git a/_test/GrokTest.php b/_test/GrokTest.php index c26e76f..195322e 100644 --- a/_test/GrokTest.php +++ b/_test/GrokTest.php @@ -42,4 +42,11 @@ public function testResultCount($reference) $grok = new Grok($reference); $this->assertEquals(1, $grok->getResultCount(), $grok->getSearchUrl()); } + + public function testEmptyData() + { + $grok = new Grok('', 'https://testurl/'); + $this->assertEquals('https://testurl', $grok->getSearchUrl()); + $this->assertSame(0, $grok->getResultCount()); + } } diff --git a/conf/default.php b/conf/default.php new file mode 100644 index 0000000..7aa6f0f --- /dev/null +++ b/conf/default.php @@ -0,0 +1,9 @@ + + */ + +$conf['grokbaseurl'] = 'https://codesearch.dokuwiki.org'; + diff --git a/conf/metadata.php b/conf/metadata.php index 2480181..c93651e 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -1,5 +1,3 @@ find($link, $first); - - return array($link, $found, $name, $anchor); + return array($reference, $name); } /** @inheritdoc */ @@ -63,63 +59,33 @@ public function render($format, Doku_Renderer $R, $data) global $conf; if ($format != 'xhtml') return false; - //prepare for formating - $link['target'] = $conf['target']['extern']; - $link['style'] = ''; - $link['pre'] = ''; - $link['suf'] = ''; - $link['more'] = ''; - $link['class'] = 'xref_plugin'; - $link['name'] = hsc($data[2]); - - if (!$data[1]) { - $link['url'] = $this->web; + list($reference, $name) = $data; + $grok = new \dokuwiki\plugin\xref\Grok($reference, $this->getConf('grokbaseurl')); + $count = $grok->getResultCount(); + + $link = [ + 'target' => $conf['target']['extern'], + 'style' => '', + 'pre' => '', + 'suf' => '', + 'more' => '', + 'class' => 'interwiki plugin_xref', + 'name' => hsc($name), + 'url' => $grok->getSearchUrl(), + 'title' => sprintf($this->getLang('view'), hsc($reference)), + ]; + + if ($count === false || $count === 0) { $link['title'] = $this->getLang('unknown'); - $link['class'] .= ' xref_plugin_err'; - } else { - $link['url'] = $this->web . '/' . $data[1] . hsc($data[3]); - $link['title'] = sprintf($this->getLang('view'), hsc($data[0])); + $link['class'] .= ' plugin_xref_err'; } - $R->doc .= $R->_formatLink($link); - return true; - } - - /** - * Try to find the given name in the xref directory - * - * @param int $first - defines which type should be searched first for the name - */ - protected function find($name, $first = 0) - { - $paths = array( - 0 => '_functions', - 1 => '_classes', - 2 => '_constants', - 3 => '_tables', - 4 => '_variables', - ); - - $clean = preg_replace('/[^\w\-_]+/', '', $name); - $small = strtolower($clean); - - $path = $paths[$first]; - unset($paths[$first]); - do { - $check = $path . '/' . $clean . '.html'; - if (@file_exists($this->dir . '/' . $check)) return $check; - $check = $path . '/' . $small . '.html'; - if (@file_exists($this->dir . '/' . $check)) return $check; - $path = array_shift($paths); - } while ($path); - - // still here? might be a file reference - $clean = preg_replace('/\.\.+/', '.', $name); - if (@file_exists($this->dir . '/' . $clean . '.html')) { - return $clean . '.html'; + if ($count > 1) { + $link['title'] = sprintf($this->getLang('search'), hsc($reference)); } - return ''; + $R->doc .= $R->_formatLink($link); + return true; } } diff --git a/xref.png b/xref.png deleted file mode 100644 index 7a7eb53388e6991a979c93f6ead8bb9b3b2a18ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmV<70UrK|P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iOV& z4iE$_jd00Ci1L_t(I%cYaeD}+%L#((#1P!@^>7D^Vr)|7;evRATZ;U7>em9nyC zq3{pbS;&f=Eequ<3)zvz)RdXmd+&KHUh~e3#K@_;y667RbDn#Slf-`_2e7z(u?+MA zlfVc_2#1L%azqZy3=0&Ra=IVvX&c4F%G{7c5(``ByZU2n9$ZOMssNY**gwl>(tc`e zX`+Lh$3mR7fT_E3+27d$fOFqJzI}=TD3z1u3?QksQuXdRZpb`^;Hm&qt|G0`uwc{z z9Kihg31u@(aI`VQUX3STJ&*+eq7;zQUP=jL!(HS{K1&|#YN From c2ebea5aadf5ab709e6095536df4d7fbd76992f9 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 27 Jan 2022 23:55:16 +0100 Subject: [PATCH 05/12] remove patch for phpxref --- phpxref-0.7-javascriptfix.patch | 47 --------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 phpxref-0.7-javascriptfix.patch diff --git a/phpxref-0.7-javascriptfix.patch b/phpxref-0.7-javascriptfix.patch deleted file mode 100644 index 318763c..0000000 --- a/phpxref-0.7-javascriptfix.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- phpxref.pl.orig 2008-10-03 17:19:27.000000000 +0200 -+++ phpxref.pl 2008-10-03 17:39:07.000000000 +0200 -@@ -1657,7 +1657,7 @@ - $newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'}; - $newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'}; - $newheader =~ s/__RELROOT__/..\//g; -- $newheader.=javascript_header(1, '_variables', "index.$ext", "logVariable('$varname');"); -+ $newheader.=javascript_header(1, '_variables', $var_ids{$varname}.".$ext", "logVariable('$varname');"); - print $VARINDEX $newheader; - print $VARINDEX &navtoggle_html('../'); - print $VARINDEX "[Top level directory]
\n"; -@@ -1782,7 +1782,7 @@ - $newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'}; - $newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'}; - $newheader =~ s/__RELROOT__/..\//g; -- $newheader.=javascript_header(1, '_functions', "index.$ext", "logFunction('$funcname');"); -+ $newheader.=javascript_header(1, '_functions', $func_ids{$funcname}.".$ext", "logFunction('$funcname');"); - print $FUNCINDEX $newheader; - print $FUNCINDEX &navtoggle_html('../'); - print $FUNCINDEX "[Top level directory]
\n"; -@@ -1925,7 +1925,7 @@ - $newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'}; - $newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'}; - $newheader =~ s/__RELROOT__/..\//g; -- $newheader.=javascript_header(1, '_classes', "index.$ext", "logClass('$classname');"); -+ $newheader.=javascript_header(1, '_classes', $class_ids{$classname}.".$ext", "logClass('$classname');"); - print $CLASSINDEX $newheader; - print $CLASSINDEX &navtoggle_html('../'); - print $CLASSINDEX "[Top level directory]
\n"; -@@ -2025,7 +2025,7 @@ - $newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'}; - $newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'}; - $newheader =~ s/__RELROOT__/..\//g; -- $newheader.=javascript_header(1, '_constants', "index.$ext", "logConstant('$constname');"); -+ $newheader.=javascript_header(1, '_constants', $constname.".$ext", "logConstant('$constname');"); - print $CONSTINDEX $newheader; - print $CONSTINDEX &navtoggle_html('../'); - print $CONSTINDEX "[Top level directory]
\n"; -@@ -2123,7 +2123,7 @@ - $newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'}; - $newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'}; - $newheader =~ s/__RELROOT__/..\//g; -- $newheader.=javascript_header(1, '_tables', "index.$ext"); -+ $newheader.=javascript_header(1, '_tables', "$tablenameid.$ext"); - print $TABLEINDEX $newheader; - print $TABLEINDEX &navtoggle_html('../'); - print $TABLEINDEX &javascript_search(1); From e7268f9e09e23b9dc4b2fdfceadb3fd294aeb6da Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 28 Jan 2022 12:42:08 +0100 Subject: [PATCH 06/12] remove obsolete config member vars --- syntax.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/syntax.php b/syntax.php index 3cd19b9..ef2a34a 100644 --- a/syntax.php +++ b/syntax.php @@ -1,4 +1,7 @@ @@ -7,15 +10,6 @@ class syntax_plugin_xref extends DokuWiki_Syntax_Plugin { - protected $dir = ''; - protected $web = ''; - - public function __construct() - { - $this->dir = rtrim($this->getConf('dir'), '/'); - $this->web = rtrim($this->getConf('web'), '/'); - } - /** @inheritdoc */ public function getType() { @@ -60,7 +54,7 @@ public function render($format, Doku_Renderer $R, $data) if ($format != 'xhtml') return false; list($reference, $name) = $data; - $grok = new \dokuwiki\plugin\xref\Grok($reference, $this->getConf('grokbaseurl')); + $grok = new Grok($reference, $this->getConf('grokbaseurl')); $count = $grok->getResultCount(); $link = [ From 0ee2b63bef1b866c383be790792e5dfee4c3a5e8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 7 Aug 2023 17:44:54 +0200 Subject: [PATCH 07/12] Update lang/en/lang.php Co-authored-by: Gerrit Uitslag --- lang/en/lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/en/lang.php b/lang/en/lang.php index d536e7a..3af3aab 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -1,6 +1,6 @@ Date: Mon, 7 Aug 2023 17:45:10 +0200 Subject: [PATCH 08/12] Update lang/en/lang.php Co-authored-by: Gerrit Uitslag --- lang/en/lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/en/lang.php b/lang/en/lang.php index 3af3aab..2d0f617 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -2,5 +2,5 @@ $lang['unknown'] = 'unknown cross reference'; $lang['view'] = 'view definition for %s'; -$lang['search'] = 'search cross reference for %s'; +$lang['search'] = 'search definitions for %s'; From 4bd0aa8f4c4efed30d07d274ac178f106737d57a Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 7 Aug 2023 17:45:21 +0200 Subject: [PATCH 09/12] Update lang/en/lang.php Co-authored-by: Gerrit Uitslag --- lang/en/lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/en/lang.php b/lang/en/lang.php index 2d0f617..42555cd 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -1,6 +1,6 @@ Date: Mon, 7 Aug 2023 17:47:35 +0200 Subject: [PATCH 10/12] Update _test/HeuristicsTest.php Co-authored-by: Gerrit Uitslag --- _test/HeuristicsTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_test/HeuristicsTest.php b/_test/HeuristicsTest.php index f81aeae..863a0da 100644 --- a/_test/HeuristicsTest.php +++ b/_test/HeuristicsTest.php @@ -30,6 +30,10 @@ public function provideData() ['$INFO', 'INFO', ''], ['foobar()', 'foobar', ''], ['FooBar()', 'FooBar', ''], + ['foobar(\'a\', 5)', 'foobar', ''], + ['FooBar(\'a\', 5)', 'FooBar', ''], + ['foobar($test, $more)', 'foobar', ''], + ['FooBar($test, $more)', 'FooBar', ''], ['AbstractItem', 'AbstractItem', 'AbstractItem'], ['abstractItem', 'abstractItem', ''], ]; From 909488694c6278f0619e3967517fea994d14781d Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 7 Aug 2023 17:47:56 +0200 Subject: [PATCH 11/12] Update Heuristics.php Co-authored-by: Gerrit Uitslag --- Heuristics.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Heuristics.php b/Heuristics.php index f9d4662..9e301c7 100644 --- a/Heuristics.php +++ b/Heuristics.php @@ -142,6 +142,11 @@ protected function checkFunction($reference) $this->def = $reference; return ''; } + if (preg_match('/\(.+?\)$/', $reference)) { + [$reference, /* $arguments */] = explode('(', $reference, 2); + $this->def = $reference; + return ''; + } return $reference; } From f6d355979bcb3807f09fd9ed46d5ce3c29f75965 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 7 Aug 2023 17:53:45 +0200 Subject: [PATCH 12/12] some automatic cleanup --- .gitattributes | 2 + Grok.php | 4 +- Heuristics.php | 2 +- LICENSE | 339 +++++++++++++++++++++++++++++++++++++++ _test/GrokTest.php | 2 +- _test/HeuristicsTest.php | 2 +- conf/default.php | 2 +- deleted.files | 5 + style.less | 4 +- syntax.php | 1 - 10 files changed, 354 insertions(+), 9 deletions(-) create mode 100644 .gitattributes create mode 100644 LICENSE create mode 100644 deleted.files diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..050b5e0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/.* export-ignore +/_test export-ignore diff --git a/Grok.php b/Grok.php index 4549e83..8873ad2 100644 --- a/Grok.php +++ b/Grok.php @@ -26,7 +26,7 @@ public function __construct($reference, $baseUrl = 'https://codesearch.dokuwiki. */ public function getSearchUrl() { - if($this->def === '' && $this->path === '') return $this->baseUrl; + if ($this->def === '' && $this->path === '') return $this->baseUrl; $url = $this->baseUrl . '/search?'; $param = [ @@ -62,7 +62,7 @@ public function getAPIUrl() */ public function getResultCount() { - if($this->def === '' && $this->path === '') return 0; + if ($this->def === '' && $this->path === '') return 0; $http = new DokuHTTPClient(); $http->timeout = 5; diff --git a/Heuristics.php b/Heuristics.php index 9e301c7..addfafb 100644 --- a/Heuristics.php +++ b/Heuristics.php @@ -90,7 +90,7 @@ protected function checkNamespace($reference) $reference = array_pop($parts); // last part may be more than a class // our classes are in inc - if($parts[0] == 'dokuwiki') $parts[0] = 'inc'; + if ($parts[0] == 'dokuwiki') $parts[0] = 'inc'; $this->path = join(' ', $parts); diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/_test/GrokTest.php b/_test/GrokTest.php index 195322e..dd04ddd 100644 --- a/_test/GrokTest.php +++ b/_test/GrokTest.php @@ -15,7 +15,7 @@ class GrokTest extends DokuWikiTest { /** - * @return \string[][] + * @return string[][] * @see testResultCount */ public function provideData() diff --git a/_test/HeuristicsTest.php b/_test/HeuristicsTest.php index 863a0da..87a6def 100644 --- a/_test/HeuristicsTest.php +++ b/_test/HeuristicsTest.php @@ -14,7 +14,7 @@ class HeuristicsTest extends DokuWikiTest { /** - * @return \string[][] + * @return string[][] * @see testHeuristics */ public function provideData() diff --git a/conf/default.php b/conf/default.php index 7aa6f0f..f0af015 100644 --- a/conf/default.php +++ b/conf/default.php @@ -5,5 +5,5 @@ * @author Andreas Gohr */ -$conf['grokbaseurl'] = 'https://codesearch.dokuwiki.org'; +$conf['grokbaseurl'] = 'https://codesearch.dokuwiki.org'; diff --git a/deleted.files b/deleted.files new file mode 100644 index 0000000..a78772a --- /dev/null +++ b/deleted.files @@ -0,0 +1,5 @@ +# This is a list of files that were present in previous releases +# but were removed later. They should not exist in your installation. +phpxref-0.7-javascriptfix.patch +style.css +xref.png diff --git a/style.less b/style.less index 4b35f62..d80f5a6 100644 --- a/style.less +++ b/style.less @@ -1,8 +1,8 @@ .dokuwiki a.plugin_xref { - background-image: url(xref.svg); + background-image: url(xref.svg); } .dokuwiki a.plugin_xref_err { - border-bottom: dashed 1px __missing__ !important; + border-bottom: dashed 1px __missing__ !important; } diff --git a/syntax.php b/syntax.php index ef2a34a..994ac44 100644 --- a/syntax.php +++ b/syntax.php @@ -6,7 +6,6 @@ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Andreas Gohr */ - class syntax_plugin_xref extends DokuWiki_Syntax_Plugin {