Skip to content

Commit

Permalink
Fix compatibility with DW Greebo
Browse files Browse the repository at this point in the history
Property $lang in plugins starting from Greebo is protected,
so plugins relying on refnotes_localization (namely on
getByPrefix() method) have to provide an accessor for that.
  • Loading branch information
dwp-forge committed May 1, 2018
1 parent 45e6ff1 commit dec23e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

////////////////////////////////////////////////////////////////////////////////////////////////////
class action_plugin_refnotes extends DokuWiki_Action_Plugin {
use refnotes_localization_plugin;

private $afterParserHandlerDone;
private $beforeAjaxCallUnknown;
Expand Down
1 change: 1 addition & 0 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

////////////////////////////////////////////////////////////////////////////////////////////////////
class admin_plugin_refnotes extends DokuWiki_Admin_Plugin {
use refnotes_localization_plugin;

private $html;
private $locale;
Expand Down
14 changes: 13 additions & 1 deletion locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
* @author Mykola Ostrovskyy <spambox03@mail.ru>
*/

/**
* Plugins that rely on refnotes_localization should use this trait.
*/
trait refnotes_localization_plugin {
/**
*
*/
public function getRawLang() {
return $this->lang;
}
}

class refnotes_localization {

private static $instance = NULL;
Expand Down Expand Up @@ -69,7 +81,7 @@ public function getByPrefix($prefix, $strip = true) {

$result = array();

foreach ($this->plugin->lang as $key => $value) {
foreach ($this->plugin->getRawLang() as $key => $value) {
if (preg_match($pattern, $key, $match) == 1) {
$result[$match[1]] = $value;
}
Expand Down
1 change: 1 addition & 0 deletions syntax/references.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

////////////////////////////////////////////////////////////////////////////////////////////////////
class syntax_plugin_refnotes_references extends DokuWiki_Syntax_Plugin {
use refnotes_localization_plugin;

private $mode;
private $entryPattern;
Expand Down

0 comments on commit dec23e5

Please sign in to comment.