diff options
35 files changed, 497 insertions, 383 deletions
diff --git a/.github/workflows/phpCS.yml b/.github/workflows/phpCS.yml index 2699db6cd..fd46c4682 100644 --- a/.github/workflows/phpCS.yml +++ b/.github/workflows/phpCS.yml @@ -1,6 +1,6 @@ name: PHP Code Style -on: [push] +on: [push, pull_request] jobs: phpcs: @@ -19,4 +19,4 @@ jobs: run: wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar - name: run PHP codesniffer - run: php phpcs.phar -v --standard=_test/phpcs.xml + run: php phpcs.phar -v --standard=_test/phpcs_MigrationAdjustments.xml diff --git a/_test/phpcs.xml b/_test/phpcs.xml index 6e78784c8..8f0d4dd24 100644 --- a/_test/phpcs.xml +++ b/_test/phpcs.xml @@ -34,88 +34,13 @@ <exclude-pattern>*/inc/cli.php</exclude-pattern> <exclude-pattern>*/inc/parser/*</exclude-pattern> - <!-- rules on top of PSR-2 --> + <!-- rules on top of PSR-12 --> <rule ref="PSR12"> - <!-- the following rule is not in PSR-2 and breaks the guardian pattern --> + <!-- This rule breaks the single line guard pattern that we prefer to keep using --> <exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed"/> <!-- we have lots of legacy classes without name spaces --> <exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/> - - <!-- Rules with automatic fixes that we want to adhere to, but currently don't --> - <exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/> - <exclude name="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma"/> - <exclude name="Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma"/> - <exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"/> - <exclude name="Generic.PHP.LowerCaseKeyword.Found"/> - <exclude name="Generic.PHP.LowerCaseConstant.Found"/> - <exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/> - <exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/> - <exclude name="Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterDecrement"/> - <exclude name="Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement"/> - - <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis"/> - <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/> - <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/> - <exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/> - <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceBeforeArrow"/> - <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceAfterArrow"/> - <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpacingBeforeAs"/> - <exclude name="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterSecond"/> - <exclude name="Squiz.ControlStructures.ForLoopDeclaration.NoSpaceAfterSecond"/> - <exclude name="Squiz.ControlStructures.ForLoopDeclaration.NoSpaceAfterFirst"/> - <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg"/> - <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterEquals"/> - <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterReference"/> - <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose"/> - <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals"/> - <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/> - <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace"/> - <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine"/> - <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/> - <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/> - <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/> - <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.Indent"/> - <exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"/> - - <exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/> - <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/> - <exclude name="PSR2.Classes.PropertyDeclaration.StaticBeforeVisibility"/> - <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/> - <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/> - <exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed"/> - <exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/> - <exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakNotNewLine"/> - <exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE"/> - <exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonDEFAULT"/> - <exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE"/> - <exclude name="PSR2.Files.EndFileNewline.TooMany"/> - <exclude name="PSR2.Files.EndFileNewline.NoneFound"/> - <exclude name="PSR2.Methods.FunctionCallSignature.Indent"/> - <exclude name="PSR2.Methods.FunctionCallSignature.EmptyLine"/> - <exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket"/> - <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket"/> - <exclude name="PSR2.Methods.FunctionCallSignature.CloseBracketLine"/> - <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket"/> - <exclude name="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket"/> - <exclude name="PSR2.Methods.FunctionCallSignature.MultipleArguments"/> - <exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose"/> - <exclude name="PSR2.Methods.MethodDeclaration.StaticBeforeVisibility"/> - <exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/> - <exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/> - - <exclude name="PSR12.Classes.ClassInstantiation.MissingParentheses"/> - <exclude name="PSR12.ControlStructures.BooleanOperatorPlacement.FoundMixed"/> - <exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine"/> - <exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisLine"/> - <exclude name="PSR12.ControlStructures.ControlStructureSpacing.LineIndent"/> - <exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/> - <exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/> - <exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/> - <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceBefore"/> - <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceAfter"/> - - <exclude name="PSR12.Properties.ConstantVisibility.NotFound"/> </rule> <!-- disable some rules for certain paths, for legacy support --> @@ -152,25 +77,4 @@ <exclude-pattern>*/inc/Extension/PluginInterface.php</exclude-pattern> <exclude-pattern>*/inc/Extension/PluginTrait.php</exclude-pattern> </rule> - - <!-- for now we mix declarations and execution here (mostly for defines) --> - <rule ref="PSR1.Files.SideEffects"> - <exclude-pattern>*/index.php</exclude-pattern> - <exclude-pattern>*/inc/parserutils.php</exclude-pattern> - <exclude-pattern>*/inc/mail.php</exclude-pattern> - <exclude-pattern>*/inc/init.php</exclude-pattern> - <exclude-pattern>*/inc/farm.php</exclude-pattern> - <exclude-pattern>*/inc/fulltext.php</exclude-pattern> - <exclude-pattern>*/inc/pluginutils.php</exclude-pattern> - <exclude-pattern>*/inc/indexer.php</exclude-pattern> - <exclude-pattern>*/inc/Mailer.class.php</exclude-pattern> - <exclude-pattern>*/doku.php</exclude-pattern> - <exclude-pattern>*/install.php</exclude-pattern> - <exclude-pattern>*/inc/utf8.php</exclude-pattern> - <exclude-pattern>*/feed.php</exclude-pattern> - <exclude-pattern>*/inc/load.php</exclude-pattern> - <exclude-pattern>*/bin/*.php</exclude-pattern> - <exclude-pattern>*/lib/exe/*.php</exclude-pattern> - </rule> - </ruleset> diff --git a/_test/phpcs_MigrationAdjustments.xml b/_test/phpcs_MigrationAdjustments.xml new file mode 100644 index 000000000..d9d11832b --- /dev/null +++ b/_test/phpcs_MigrationAdjustments.xml @@ -0,0 +1,103 @@ +<?xml version="1.0"?> +<ruleset name="Migration Adjustments for the DokuWiki Coding Standard Standard" namespace="DokuWiki\CS\Standard"> + <description>These are exceptions to the Coding Standard used for DokuWiki that are intended to be removed over time.</description> + + <!-- rules on top of PSR-12 --> + <rule ref="./phpcs.xml"> + <!-- Rules with automatic fixes that we want to adhere to, but currently don't --> + <exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/> + <exclude name="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma"/> + <exclude name="Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma"/> + <exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"/> + <exclude name="Generic.PHP.LowerCaseKeyword.Found"/> + <exclude name="Generic.PHP.LowerCaseConstant.Found"/> + <exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/> + <exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/> + <exclude name="Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterDecrement"/> + <exclude name="Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement"/> + + <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis"/> + <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/> + <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/> + <exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/> + <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceBeforeArrow"/> + <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceAfterArrow"/> + <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpacingBeforeAs"/> + <exclude name="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterSecond"/> + <exclude name="Squiz.ControlStructures.ForLoopDeclaration.NoSpaceAfterSecond"/> + <exclude name="Squiz.ControlStructures.ForLoopDeclaration.NoSpaceAfterFirst"/> + <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg"/> + <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterEquals"/> + <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterReference"/> + <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose"/> + <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals"/> + <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/> + <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace"/> + <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine"/> + <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/> + <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/> + <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/> + <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.Indent"/> + <exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"/> + + <exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/> + <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/> + <exclude name="PSR2.Classes.PropertyDeclaration.StaticBeforeVisibility"/> + <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/> + <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/> + <exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed"/> + <exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/> + <exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakNotNewLine"/> + <exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE"/> + <exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonDEFAULT"/> + <exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE"/> + <exclude name="PSR2.Files.EndFileNewline.TooMany"/> + <exclude name="PSR2.Files.EndFileNewline.NoneFound"/> + <exclude name="PSR2.Methods.FunctionCallSignature.Indent"/> + <exclude name="PSR2.Methods.FunctionCallSignature.EmptyLine"/> + <exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket"/> + <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket"/> + <exclude name="PSR2.Methods.FunctionCallSignature.CloseBracketLine"/> + <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket"/> + <exclude name="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket"/> + <exclude name="PSR2.Methods.FunctionCallSignature.MultipleArguments"/> + <exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose"/> + <exclude name="PSR2.Methods.MethodDeclaration.StaticBeforeVisibility"/> + <exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/> + <exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/> + + <exclude name="PSR12.Classes.ClassInstantiation.MissingParentheses"/> + <exclude name="PSR12.ControlStructures.BooleanOperatorPlacement.FoundMixed"/> + <exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine"/> + <exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisLine"/> + <exclude name="PSR12.ControlStructures.ControlStructureSpacing.LineIndent"/> + <exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/> + <exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/> + <exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/> + <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceBefore"/> + <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceAfter"/> + + <exclude name="PSR12.Properties.ConstantVisibility.NotFound"/> + </rule> + + <!-- for now we mix declarations and execution here (mostly for defines) --> + <rule ref="PSR1.Files.SideEffects"> + <exclude-pattern>*/index.php</exclude-pattern> + <exclude-pattern>*/inc/parserutils.php</exclude-pattern> + <exclude-pattern>*/inc/mail.php</exclude-pattern> + <exclude-pattern>*/inc/init.php</exclude-pattern> + <exclude-pattern>*/inc/farm.php</exclude-pattern> + <exclude-pattern>*/inc/fulltext.php</exclude-pattern> + <exclude-pattern>*/inc/pluginutils.php</exclude-pattern> + <exclude-pattern>*/inc/indexer.php</exclude-pattern> + <exclude-pattern>*/inc/Mailer.class.php</exclude-pattern> + <exclude-pattern>*/doku.php</exclude-pattern> + <exclude-pattern>*/install.php</exclude-pattern> + <exclude-pattern>*/inc/utf8.php</exclude-pattern> + <exclude-pattern>*/feed.php</exclude-pattern> + <exclude-pattern>*/inc/load.php</exclude-pattern> + <exclude-pattern>*/bin/*.php</exclude-pattern> + <exclude-pattern>*/lib/exe/*.php</exclude-pattern> + </rule> + +</ruleset> diff --git a/inc/Cache/Cache.php b/inc/Cache/Cache.php index ab64da5cb..af82e6bf6 100644 --- a/inc/Cache/Cache.php +++ b/inc/Cache/Cache.php @@ -78,9 +78,13 @@ class Cache $this->depends = $depends; $this->addDependencies(); - if ($this->_event) { - return $this->stats(Event::createAndTrigger( - $this->_event, $this, array($this, 'makeDefaultCacheDecision')) + if ($this->getEvent()) { + return $this->stats( + Event::createAndTrigger( + $this->getEvent(), + $this, + array($this, 'makeDefaultCacheDecision') + ) ); } @@ -105,7 +109,6 @@ class Cache */ public function makeDefaultCacheDecision() { - if ($this->_nocache) { return false; } // caching turned off @@ -170,7 +173,7 @@ class Cache return false; } - return io_savefile($this->cache, $data); + return io_saveFile($this->cache, $data); } /** diff --git a/inc/Cache/CacheInstructions.php b/inc/Cache/CacheInstructions.php index 3c4786105..acd02abae 100644 --- a/inc/Cache/CacheInstructions.php +++ b/inc/Cache/CacheInstructions.php @@ -41,6 +41,6 @@ class CacheInstructions extends \dokuwiki\Cache\CacheParser return false; } - return io_savefile($this->cache, serialize($instructions)); + return io_saveFile($this->cache, serialize($instructions)); } } diff --git a/inc/html.php b/inc/html.php index 1287cb4e9..1f494d46b 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1940,7 +1940,7 @@ function html_edit(){ if ($wr) { // sets changed to true when previewed - echo '<script type="text/javascript">/*<![CDATA[*/'. NL; + echo '<script>/*<![CDATA[*/'. NL; echo 'textChanged = ' . ($mod ? 'true' : 'false'); echo '/*!]]>*/</script>' . NL; } ?> diff --git a/inc/lang/no/lang.php b/inc/lang/no/lang.php index 2cb6839fa..0b4cd8629 100644 --- a/inc/lang/no/lang.php +++ b/inc/lang/no/lang.php @@ -3,8 +3,8 @@ /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * - * @author Rut Kristin Aanestad <dark@met.no> * @author Torgeir Blesvik <bletor@banenor.no> + * @author Rut Kristin Aanestad <dark@met.no> * @author ThorPrestboen <thor.erling.prestboen@gmail.com> * @author Christian McKenna <mckchr@banenor.no> * @author Reidar Mosvold <Reidar.Mosvold@hit.no> @@ -90,6 +90,7 @@ $lang['minoredit'] = 'Mindre endringer'; $lang['draftdate'] = 'Kladd autolagret'; $lang['nosecedit'] = 'Siden er i mellomtiden endret, seksjonsinfo har blitt foreldet - lastet full side istedet.'; $lang['searchcreatepage'] = 'Hvis du ikke fant det du søkte etter kan du lage eller endre siden %s.'; +$lang['js']['search_toggle_tools'] = 'Søkeverktøy'; $lang['js']['willexpire'] = 'Din redigeringslås for dette dokumentet kommer snart til å utløpe.\nFor å unngå versjonskonflikter bør du forhåndsvise dokumentet ditt for å forlenge redigeringslåsen.'; $lang['js']['notsavedyet'] = 'Ulagrede endringer vil gå tapt! Vil du fortsette?'; diff --git a/inc/template.php b/inc/template.php index 011df63fe..798fea52e 100644 --- a/inc/template.php +++ b/inc/template.php @@ -332,7 +332,7 @@ function tpl_metaheaders($alt = true) { // load stylesheets $head['link'][] = array( - 'rel' => 'stylesheet', 'type'=> 'text/css', + 'rel' => 'stylesheet', 'href'=> DOKU_BASE.'lib/exe/css.php?t='.rawurlencode($conf['template']).'&tseed='.$tseed ); @@ -342,13 +342,12 @@ function tpl_metaheaders($alt = true) { } jsinfo(); $script .= 'var JSINFO = ' . json_encode($JSINFO).';'; - $head['script'][] = array('type'=> 'text/javascript', '_data'=> $script); + $head['script'][] = array('_data'=> $script); // load jquery $jquery = getCdnUrls(); foreach($jquery as $src) { $head['script'][] = array( - 'type' => 'text/javascript', 'charset' => 'utf-8', '_data' => '', 'src' => $src, @@ -357,7 +356,7 @@ function tpl_metaheaders($alt = true) { // load our javascript dispatcher $head['script'][] = array( - 'type'=> 'text/javascript', 'charset'=> 'utf-8', '_data'=> '', + 'charset'=> 'utf-8', '_data'=> '', 'src' => DOKU_BASE.'lib/exe/js.php'.'?t='.rawurlencode($conf['template']).'&tseed='.$tseed, ) + ($conf['defer_js'] ? [ 'defer' => 'defer'] : []); @@ -960,6 +959,7 @@ function tpl_pagetitle($id = null, $ret = false) { // page functions case 'edit' : + case 'preview' : $page_title = "✎ ".$name; break; diff --git a/install.php b/install.php index 407c2c364..55dac2570 100644 --- a/install.php +++ b/install.php @@ -46,7 +46,7 @@ header('Content-Type: text/html; charset=utf-8'); <head> <meta charset="utf-8" /> <title><?php echo $lang['i_installer']?></title> - <style type="text/css"> + <style> body { width: 90%; margin: 0 auto; font: 84% Verdana, Helvetica, Arial, sans-serif; } img { border: none } br.cl { clear:both; } @@ -56,7 +56,7 @@ header('Content-Type: text/html; charset=utf-8'); select.text, input.text { width: 30em; margin: 0 0.5em; } a {text-decoration: none} </style> - <script type="text/javascript"> + <script> function acltoggle(){ var cb = document.getElementById('acl'); var fs = document.getElementById('acldep'); diff --git a/lib/images/fileicons/index.php b/lib/images/fileicons/index.php index 8ec577593..d1f233e48 100644 --- a/lib/images/fileicons/index.php +++ b/lib/images/fileicons/index.php @@ -3,7 +3,7 @@ <head> <title>Filetype icons</title> - <style type="text/css"> + <style> body { background-color: #ccc; font-family: Arial; diff --git a/lib/images/smileys/index.php b/lib/images/smileys/index.php index c9c74872f..574966628 100644 --- a/lib/images/smileys/index.php +++ b/lib/images/smileys/index.php @@ -3,7 +3,7 @@ <head> <title>Smileys</title> - <style type="text/css"> + <style> body { background-color: #ccc; font-family: Arial; diff --git a/lib/plugins/acl/script.js b/lib/plugins/acl/script.js index 86badffdd..95621a255 100644 --- a/lib/plugins/acl/script.js +++ b/lib/plugins/acl/script.js @@ -15,8 +15,8 @@ var dw_acl = { return; } - jQuery('#acl__user select').change(dw_acl.userselhandler); - jQuery('#acl__user button').click(dw_acl.loadinfo); + jQuery('#acl__user select').on('change', dw_acl.userselhandler); + jQuery('#acl__user button').on('click', dw_acl.loadinfo); $tree = jQuery('#acl__tree'); $tree.dw_tree({toggle_selector: 'img', diff --git a/lib/plugins/config/lang/no/lang.php b/lib/plugins/config/lang/no/lang.php index 093af8016..a20415f0e 100644 --- a/lib/plugins/config/lang/no/lang.php +++ b/lib/plugins/config/lang/no/lang.php @@ -3,8 +3,8 @@ /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * - * @author Rut Kristin Aanestad <dark@met.no> * @author Torgeir Blesvik <bletor@banenor.no> + * @author Rut Kristin Aanestad <dark@met.no> * @author ThorPrestboen <thor.erling.prestboen@gmail.com> * @author Christian McKenna <mckchr@banenor.no> * @author Thomas Nygreen <nygreen@gmail.com> diff --git a/lib/plugins/extension/action.php b/lib/plugins/extension/action.php index 3255f24b0..3bb044825 100644 --- a/lib/plugins/extension/action.php +++ b/lib/plugins/extension/action.php @@ -16,7 +16,6 @@ class action_plugin_extension extends DokuWiki_Action_Plugin */ public function register(Doku_Event_Handler $controller) { - $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'info'); } @@ -26,7 +25,7 @@ class action_plugin_extension extends DokuWiki_Action_Plugin * @param Doku_Event $event * @param $param */ - public function info(Doku_Event &$event, $param) + public function info(Doku_Event $event, $param) { global $USERINFO; global $INPUT; @@ -69,7 +68,7 @@ class action_plugin_extension extends DokuWiki_Action_Plugin ); header('Content-Type: application/json'); - json_encode($return); + echo json_encode($return); break; case 'info': diff --git a/lib/plugins/extension/admin.php b/lib/plugins/extension/admin.php index 421b7138f..ded688a9b 100644 --- a/lib/plugins/extension/admin.php +++ b/lib/plugins/extension/admin.php @@ -51,9 +51,11 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin /* @var helper_plugin_extension_repository $repository */ $repository = $this->loadHelper('extension_repository'); - if(!$repository->hasAccess(!$INPUT->bool('purge'))) { - $url = $this->gui->tabURL('', array('purge' => 1)); - msg($this->getLang('repo_error').' [<a href="'.$url.'">'.$this->getLang('repo_retry').'</a>]', -1); + if (!$repository->hasAccess(!$INPUT->bool('purge'))) { + $url = $this->gui->tabURL('', ['purge' => 1], '&'); + msg($this->getLang('repo_error'). + ' [<a href="'.$url.'">'.$this->getLang('repo_retry').'</a>]', -1 + ); } if (!in_array('ssl', stream_get_transports())) { @@ -75,12 +77,9 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin $extension->setExtension($extname); $installed = $extension->installOrUpdate(); foreach ($installed as $ext => $info) { - msg( - sprintf( - $this->getLang('msg_' . $info['type'] . '_' . $info['action'] . '_success'), - $info['base'] - ), - 1 + msg(sprintf( + $this->getLang('msg_'.$info['type'].'_'.$info['action'].'_success'), + $info['base']), 1 ); } break; @@ -88,20 +87,14 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin $extension->setExtension($extname); $status = $extension->uninstall(); if ($status) { - msg( - sprintf( - $this->getLang('msg_delete_success'), - hsc($extension->getDisplayName()) - ), - 1 + msg(sprintf( + $this->getLang('msg_delete_success'), + hsc($extension->getDisplayName())), 1 ); } else { - msg( - sprintf( - $this->getLang('msg_delete_failed'), - hsc($extension->getDisplayName()) - ), - -1 + msg(sprintf( + $this->getLang('msg_delete_failed'), + hsc($extension->getDisplayName())), -1 ); } break; @@ -111,7 +104,10 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin if ($status !== true) { msg($status, -1); } else { - msg(sprintf($this->getLang('msg_enabled'), hsc($extension->getDisplayName())), 1); + msg(sprintf( + $this->getLang('msg_enabled'), + hsc($extension->getDisplayName())), 1 + ); } break; case 'disable': @@ -120,29 +116,38 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin if ($status !== true) { msg($status, -1); } else { - msg(sprintf($this->getLang('msg_disabled'), hsc($extension->getDisplayName())), 1); + msg(sprintf( + $this->getLang('msg_disabled'), + hsc($extension->getDisplayName())), 1 + ); } break; } } } - send_redirect($this->gui->tabURL('', array(), '&', true)); + send_redirect($this->gui->tabURL('', [], '&', true)); } elseif ($INPUT->post->str('installurl') && checkSecurityToken()) { $installed = $extension->installFromURL($INPUT->post->str('installurl')); foreach ($installed as $ext => $info) { - msg(sprintf($this->getLang('msg_'.$info['type'].'_'.$info['action'].'_success'), $info['base']), 1); + msg(sprintf( + $this->getLang('msg_'.$info['type'].'_'.$info['action'].'_success'), + $info['base']), 1 + ); } - send_redirect($this->gui->tabURL('', array(), '&', true)); + send_redirect($this->gui->tabURL('', [], '&', true)); } elseif (isset($_FILES['installfile']) && checkSecurityToken()) { $installed = $extension->installFromUpload('installfile'); foreach ($installed as $ext => $info) { - msg(sprintf($this->getLang('msg_'.$info['type'].'_'.$info['action'].'_success'), $info['base']), 1); + msg(sprintf( + $this->getLang('msg_'.$info['type'].'_'.$info['action'].'_success'), + $info['base']), 1 + ); } - send_redirect($this->gui->tabURL('', array(), '&', true)); + send_redirect($this->gui->tabURL('', [], '&', true)); } } catch (Exception $e) { msg($e->getMessage(), -1); - send_redirect($this->gui->tabURL('', array(), '&', true)); + send_redirect($this->gui->tabURL('', [], '&', true)); } } @@ -151,8 +156,8 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin */ public function html() { - ptln('<h1>'.$this->getLang('menu').'</h1>'); - ptln('<div id="extension__manager">'); + echo '<h1>'.$this->getLang('menu').'</h1>'.DOKU_LF; + echo '<div id="extension__manager">'.DOKU_LF; $this->gui->tabNavigation(); @@ -171,7 +176,7 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin $this->gui->tabPlugins(); } - ptln('</div>'); + echo '</div>'.DOKU_LF; } } diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index f5846b75f..3e7087eba 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -126,11 +126,11 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin return in_array( $this->id, array( - 'authad', 'authldap', 'authmysql', 'authpdo', - 'authpgsql', 'authplain', 'acl', 'info', 'extension', - 'revert', 'popularity', 'config', 'safefnrecode', 'styling', - 'testing', 'template:dokuwiki' - ) + 'authad', 'authldap', 'authpdo', 'authplain', + 'acl', 'config', 'extension', 'info', 'popularity', 'revert', + 'safefnrecode', 'styling', 'testing', 'usermanager', + 'template:dokuwiki', + ) ); } @@ -306,7 +306,8 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin public function getURL() { if (!empty($this->localInfo['url'])) return $this->localInfo['url']; - return 'https://www.dokuwiki.org/'.($this->isTemplate() ? 'template' : 'plugin').':'.$this->getBase(); + return 'https://www.dokuwiki.org/'. + ($this->isTemplate() ? 'template' : 'plugin').':'.$this->getBase(); } /** @@ -772,8 +773,8 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin if (is_readable($infopath)) { $this->localInfo = confToHash($infopath); } elseif (!$this->isTemplate() && $this->isEnabled()) { - $path = $this->getInstallDir().'/'; - $plugin = null; + $path = $this->getInstallDir().'/'; + $plugin = null; foreach (PluginController::PLUGIN_TYPES as $type) { if (file_exists($path.$type.'.php')) { @@ -895,7 +896,8 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin * @param string $defaultName fallback for name of download * @return bool|string if failed false, otherwise true or the name of the file in the given dir */ - protected function downloadToFile($url,$file,$defaultName=''){ + protected function downloadToFile($url, $file, $defaultName = '') + { global $conf; $http = new DokuHTTPClient(); $http->max_bodysize = 0; @@ -909,10 +911,10 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin $name = ''; if (isset($http->resp_headers['content-disposition'])) { $content_disposition = $http->resp_headers['content-disposition']; - $match=array(); + $match = array(); if (is_string($content_disposition) && - preg_match('/attachment;\s*filename\s*=\s*"([^"]*)"/i', $content_disposition, $match)) { - + preg_match('/attachment;\s*filename\s*=\s*"([^"]*)"/i', $content_disposition, $match) + ) { $name = \dokuwiki\Utf8\PhpString::basename($match[1]); } @@ -927,10 +929,10 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin $fileexists = file_exists($file); $fp = @fopen($file,"w"); - if(!$fp) return false; - fwrite($fp,$data); + if (!$fp) return false; + fwrite($fp, $data); fclose($fp); - if(!$fileexists and $conf['fperm']) chmod($file, $conf['fperm']); + if (!$fileexists and $conf['fperm']) chmod($file, $conf['fperm']); return $name; } @@ -964,7 +966,9 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin // download if (!$file = $this->downloadToFile($url, $tmp.'/', $file)) { io_rmdir($tmp, true); - throw new Exception(sprintf($this->getLang('error_download'), '<bdi>'.hsc($url).'</bdi>')); + throw new Exception(sprintf($this->getLang('error_download'), + '<bdi>'.hsc($url).'</bdi>') + ); } return $tmp.'/'.$file; @@ -1055,7 +1059,9 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin 'action' => $action ); } else { - throw new Exception(sprintf($this->getLang('error_copy').DOKU_LF, '<bdi>'.$item['base'].'</bdi>')); + throw new Exception(sprintf($this->getLang('error_copy').DOKU_LF, + '<bdi>'.$item['base'].'</bdi>') + ); } } @@ -1129,13 +1135,13 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin // files where found but no info.txt - use old method if ($found_files) { - $info = array(); - $info['tmp'] = $this_dir; + $info = array(); + $info['tmp'] = $this_dir; // does this look like a template or should we use the default type? if ($found_template_parts >= 2) { - $info['type'] = 'template'; + $info['type'] = 'template'; } else { - $info['type'] = $default_type; + $info['type'] = $default_type; } $result['old'][] = $info; @@ -1187,7 +1193,8 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin return true; } - // the only case when we don't get one of the recognized archive types is when the archive file can't be read + // the only case when we don't get one of the recognized archive types is + // when the archive file can't be read throw new Exception($this->getLang('error_decompress').' Couldn\'t read archive file'); } diff --git a/lib/plugins/extension/helper/gui.php b/lib/plugins/extension/helper/gui.php index 9d6783202..d02c02a89 100644 --- a/lib/plugins/extension/helper/gui.php +++ b/lib/plugins/extension/helper/gui.php @@ -6,14 +6,13 @@ * @author Andreas Gohr <andi@splitbrain.org> */ -use dokuwiki\Extension\PluginController; +use dokuwiki\Form\Form; /** * Class helper_plugin_extension_list takes care of the overall GUI */ class helper_plugin_extension_gui extends DokuWiki_Plugin { - protected $tabs = array('plugins', 'templates', 'search', 'install'); /** @var string the extension that should have an open info window FIXME currently broken */ @@ -44,13 +43,19 @@ class helper_plugin_extension_gui extends DokuWiki_Plugin $extension = $this->loadHelper('extension_extension'); /* @var helper_plugin_extension_list $list */ $list = $this->loadHelper('extension_list'); + + $form = new Form([ + 'action' => $this->tabURL('', [], '&'), + 'id' => 'extension__list', + ]); $list->startForm(); foreach ($pluginlist as $name) { $extension->setExtension($name); $list->addRow($extension, $extension->getID() == $this->infoFor); } $list->endForm(); - $list->render(); + $form->addHTML($list->render(true)); + echo $form->toHTML(); } /** @@ -71,13 +76,19 @@ class helper_plugin_extension_gui extends DokuWiki_Plugin $extension = $this->loadHelper('extension_extension'); /* @var helper_plugin_extension_list $list */ $list = $this->loadHelper('extension_list'); + + $form = new Form([ + 'action' => $this->tabURL('', [], '&'), + 'id' => 'extension__list', + ]); $list->startForm(); foreach ($tpllist as $name) { $extension->setExtension("template:$name"); $list->addRow($extension, $extension->getID() == $this->infoFor); } $list->endForm(); - $list->render(); + $form->addHTML($list->render(true)); + echo $form->toHTML(); } /** @@ -90,10 +101,18 @@ class helper_plugin_extension_gui extends DokuWiki_Plugin echo $this->locale_xhtml('intro_search'); echo '</div>'; - $form = new Doku_Form(array('action' => $this->tabURL('', array(), '&'), 'class' => 'search')); - $form->addElement(form_makeTextField('q', $INPUT->str('q'), $this->getLang('search_for'))); - $form->addElement(form_makeButton('submit', '', $this->getLang('search'))); - $form->printForm(); + $form = new Form([ + 'action' => $this->tabURL('', [], '&'), + 'class' => 'search', + ]); + $form->addTagOpen('div')->addClass('no'); + $form->addTextInput('q', $this->getLang('search_for')) + ->addClass('edit') + ->val($INPUT->str('q')); + $form->addButton('submit', $this->getLang('search')) + ->attrs(['type' => 'submit', 'title' => $this->getLang('search')]); + $form->addTagClose('div'); + echo $form->toHTML(); if (!$INPUT->bool('q')) return; @@ -105,6 +124,11 @@ class helper_plugin_extension_gui extends DokuWiki_Plugin $extension = $this->loadHelper('extension_extension'); /* @var helper_plugin_extension_list $list */ $list = $this->loadHelper('extension_list'); + + $form = new Form([ + 'action' => $this->tabURL('', [], '&'), + 'id' => 'extension__list', + ]); $list->startForm(); if ($result) { foreach ($result as $name) { @@ -115,7 +139,8 @@ class helper_plugin_extension_gui extends DokuWiki_Plugin $list->nothingFound(); } $list->endForm(); - $list->render(); + $form->addHTML($list->render(true)); + echo $form->toHTML(); } /** @@ -127,17 +152,24 @@ class helper_plugin_extension_gui extends DokuWiki_Plugin echo $this->locale_xhtml('intro_install'); echo '</div>'; - $form = new Doku_Form( - array( - 'action' => $this->tabURL('', array(), '&'), + $form = new Form([ + 'action' => $this->tabURL('', [], '&'), 'enctype' => 'multipart/form-data', - 'class' => 'install' - ) - ); - $form->addElement(form_makeTextField('installurl', '', $this->getLang('install_url'), '', 'block')); - $form->addElement(form_makeFileField('installfile', $this->getLang('install_upload'), '', 'block')); - $form->addElement(form_makeButton('submit', '', $this->getLang('btn_install'))); - $form->printForm(); + 'class' => 'install', + ]); + $form->addTagOpen('div')->addClass('no'); + $form->addTextInput('installurl', $this->getLang('install_url')) + ->addClass('block') + ->attrs(['type' => 'url']); + $form->addTag('br'); + $form->addTextInput('installfile', $this->getLang('install_upload')) + ->addClass('block') + ->attrs(['type' => 'file']); + $form->addTag('br'); + $form->addButton('', $this->getLang('btn_install')) + ->attrs(['type' => 'submit', 'title' => $this->getLang('btn_install')]); + $form->addTagClose('div'); + echo $form->toHTML(); } /** @@ -183,7 +215,7 @@ class helper_plugin_extension_gui extends DokuWiki_Plugin * @param bool $absolute create absolute URLs? * @return string */ - public function tabURL($tab = '', $params = array(), $sep = '&', $absolute = false) + public function tabURL($tab = '', $params = [], $sep = '&', $absolute = false) { global $ID; global $INPUT; diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php index d895941cb..647575b10 100644 --- a/lib/plugins/extension/helper/list.php +++ b/lib/plugins/extension/helper/list.php @@ -30,13 +30,6 @@ class helper_plugin_extension_list extends DokuWiki_Plugin */ public function startForm() { - $this->form .= '<form id="extension__list" accept-charset="utf-8" method="post" action="">'; - $hidden = array( - 'do'=>'admin', - 'page'=>'extension', - 'sectok'=>getSecurityToken() - ); - $this->addHidden($hidden); $this->form .= '<ul class="extensionList">'; } @@ -96,7 +89,6 @@ class helper_plugin_extension_list extends DokuWiki_Plugin public function endForm() { $this->form .= '</ul>'; - $this->form .= '</form>'.DOKU_LF; } /** @@ -110,9 +102,12 @@ class helper_plugin_extension_list extends DokuWiki_Plugin /** * Print the form + * + * @param bool $returnonly whether to return html or print */ - public function render() + public function render($returnonly = false) { + if ($returnonly) return $this->form; echo $this->form; } @@ -153,13 +148,30 @@ class helper_plugin_extension_list extends DokuWiki_Plugin */ public function makeHomepageLink(helper_plugin_extension_extension $extension) { - $text = $this->getLang('homepage_link'); - $url = hsc($extension->getURL()); - return '<a href="'.$url.'" title="'.$url.'" class ="urlextern">'.$text.'</a> '; + global $conf; + $url = $extension->getURL(); + if (strtolower(parse_url($url, PHP_URL_HOST)) == 'www.dokuwiki.org') { + $linktype = 'interwiki'; + } else { + $linktype = 'extern'; + } + $param = array( + 'href' => $url, + 'title' => $url, + 'class' => ($linktype == 'extern') ? 'urlextern' : 'interwiki iw_doku', + 'target' => $conf['target'][$linktype], + 'rel' => ($linktype == 'extern') ? 'noopener' : '', + ); + if ($linktype == 'extern' && $conf['relnofollow']) { + $param['rel'] = implode(' ', [$param['rel'], 'ugc nofollow']); + } + $html = ' <a '. buildAttributes($param, true).'>'. + $this->getLang('homepage_link').'</a>'; + return $html; } /** - * Generate the class name for the row of the extensio + * Generate the class name for the row of the extension * * @param helper_plugin_extension_extension $extension The extension object * @return string The class name @@ -190,14 +202,18 @@ class helper_plugin_extension_list extends DokuWiki_Plugin $mailid = $extension->getEmailID(); if ($mailid) { $url = $this->gui->tabURL('search', array('q' => 'authorid:'.$mailid)); - return '<bdi><a href="'.$url.'" class="author" title="'.$this->getLang('author_hint').'" >'. - '<img src="//www.gravatar.com/avatar/'.$mailid.'?s=20&d=mm" width="20" height="20" alt="" /> '. - hsc($extension->getAuthor()).'</a></bdi>'; + $html = '<a href="'.$url.'" class="author" title="'.$this->getLang('author_hint').'" >'. + '<img src="//www.gravatar.com/avatar/'.$mailid. + '?s=20&d=mm" width="20" height="20" alt="" /> '. + hsc($extension->getAuthor()).'</a>'; } else { - return '<bdi><span class="author">'.hsc($extension->getAuthor()).'</span></bdi>'; + $html = '<span class="author">'.hsc($extension->getAuthor()).'</span>'; } + $html = '<bdi>'.$html.'</bdi>'; + } else { + $html = '<em class="author">'.$this->getLang('unknown_author').'</em>'.DOKU_LF; } - return "<em class=\"author\">".$this->getLang('unknown_author')."</em>".DOKU_LF; + return $html; } /** @@ -227,7 +243,8 @@ class helper_plugin_extension_list extends DokuWiki_Plugin $img = '<img alt="" width="120" height="70" src="'.DOKU_BASE. 'lib/plugins/extension/images/plugin.png" />'; } - return '<div class="screenshot" >'.$img.'<span></span></div>'.DOKU_LF; + $html = '<div class="screenshot" >'.$img.'<span></span></div>'.DOKU_LF; + return $html; } /** @@ -239,33 +256,33 @@ class helper_plugin_extension_list extends DokuWiki_Plugin */ public function makeLegend(helper_plugin_extension_extension $extension, $showinfo = false) { - $return = '<div>'; - $return .= '<h2>'; - $return .= sprintf( + $html = '<div>'; + $html .= '<h2>'; + $html .= sprintf( $this->getLang('extensionby'), '<bdi>'.hsc($extension->getDisplayName()).'</bdi>', $this->makeAuthor($extension) ); - $return .= '</h2>'.DOKU_LF; + $html .= '</h2>'.DOKU_LF; - $return .= $this->makeScreenshot($extension); + $html .= $this->makeScreenshot($extension); $popularity = $extension->getPopularity(); if ($popularity !== false && !$extension->isBundled()) { $popularityText = sprintf($this->getLang('popularity'), round($popularity*100, 2)); - $return .= '<div class="popularity" title="'.$popularityText.'">'. + $html .= '<div class="popularity" title="'.$popularityText.'">'. '<div style="width: '.($popularity * 100).'%;">'. '<span class="a11y">'.$popularityText.'</span>'. '</div></div>'.DOKU_LF; } if ($extension->getDescription()) { - $return .= '<p><bdi>'; - $return .= hsc($extension->getDescription()).' '; - $return .= '</bdi></p>'.DOKU_LF; + $html .= '<p><bdi>'; + $html .= hsc($extension->getDescription()).' '; + $html .= '</bdi></p>'.DOKU_LF; } - $return .= $this->makeLinkbar($extension); + $html .= $this->makeLinkbar($extension); if ($showinfo) { $url = $this->gui->tabURL(''); @@ -274,16 +291,16 @@ class helper_plugin_extension_list extends DokuWiki_Plugin $url = $this->gui->tabURL('', array('info' => $extension->getID())); $class = ''; } - $return .= ' <a href="'.$url.'#extensionplugin__'.$extension->getID(). + $html .= ' <a href="'.$url.'#extensionplugin__'.$extension->getID(). '" class="info '.$class.'" title="'.$this->getLang('btn_info'). '" data-extid="'.$extension->getID().'">'.$this->getLang('btn_info').'</a>'; if ($showinfo) { - $return .= $this->makeInfo($extension); + $html .= $this->makeInfo($extension); } - $return .= $this->makeNoticeArea($extension); - $return .= '</div>'.DOKU_LF; - return $return; + $html .= $this->makeNoticeArea($extension); + $html .= '</div>'.DOKU_LF; + return $html; } /** @@ -294,29 +311,46 @@ class helper_plugin_extension_list extends DokuWiki_Plugin */ public function makeLinkbar(helper_plugin_extension_extension $extension) { - $return = '<div class="linkbar">'; - $return .= $this->makeHomepageLink($extension); - if ($extension->getBugtrackerURL()) { - $return .= ' <a href="'.hsc($extension->getBugtrackerURL()). - '" title="'.hsc($extension->getBugtrackerURL()).'" class ="bugs">'. - $this->getLang('bugs_features').'</a> '; + global $conf; + $html = '<div class="linkbar">'; + $html .= $this->makeHomepageLink($extension); + + $bugtrackerURL = $extension->getBugtrackerURL(); + if ($bugtrackerURL) { + if (strtolower(parse_url($bugtrackerURL, PHP_URL_HOST)) == 'www.dokuwiki.org') { + $linktype = 'interwiki'; + } else { + $linktype = 'extern'; + } + $param = array( + 'href' => $bugtrackerURL, + 'title' => $bugtrackerURL, + 'class' => 'bugs', + 'target' => $conf['target'][$linktype], + 'rel' => ($linktype == 'extern') ? 'noopener' : '', + ); + if ($conf['relnofollow']) { + $param['rel'] = implode(' ', [$param['rel'], 'ugc nofollow']); + } + $html .= ' <a '.buildAttributes($param, true).'>'. + $this->getLang('bugs_features').'</a>'; } if ($extension->getTags()) { $first = true; - $return .= '<span class="tags">'.$this->getLang('tags').' '; + $html .= ' <span class="tags">'.$this->getLang('tags').' '; foreach ($extension->getTags() as $tag) { if (!$first) { - $return .= ', '; + $html .= ', '; } else { $first = false; } - $url = $this->gui->tabURL('search', array('q' => 'tag:'.$tag)); - $return .= '<bdi><a href="'.$url.'">'.hsc($tag).'</a></bdi>'; + $url = $this->gui->tabURL('search', ['q' => 'tag:'.$tag]); + $html .= '<bdi><a href="'.$url.'">'.hsc($tag).'</a></bdi>'; } - $return .= '</span>'; + $html .= '</span>'; } - $return .= '</div>'.DOKU_LF; - return $return; + $html .= '</div>'.DOKU_LF; + return $html; } /** @@ -327,10 +361,10 @@ class helper_plugin_extension_list extends DokuWiki_Plugin */ public function makeNoticeArea(helper_plugin_extension_extension $extension) { - $return = ''; + $html = ''; $missing_dependencies = $extension->getMissingDependencies(); if (!empty($missing_dependencies)) { - $return .= '<div class="msg error">' . + $html .= '<div class="msg error">' . sprintf( $this->getLang('missing_dependency'), '<bdi>' . implode(', ', $missing_dependencies) . '</bdi>' @@ -338,7 +372,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin '</div>'; } if ($extension->isInWrongFolder()) { - $return .= '<div class="msg error">' . + $html .= '<div class="msg error">' . sprintf( $this->getLang('wrong_folder'), '<bdi>' . hsc($extension->getInstallName()) . '</bdi>', @@ -347,22 +381,22 @@ class helper_plugin_extension_list extends DokuWiki_Plugin '</div>'; } if (($securityissue = $extension->getSecurityIssue()) !== false) { - $return .= '<div class="msg error">'. + $html .= '<div class="msg error">'. sprintf($this->getLang('security_issue'), '<bdi>'.hsc($securityissue).'</bdi>'). '</div>'; } if (($securitywarning = $extension->getSecurityWarning()) !== false) { - $return .= '<div class="msg notify">'. + $html .= '<div class="msg notify">'. sprintf($this->getLang('security_warning'), '<bdi>'.hsc($securitywarning).'</bdi>'). '</div>'; } if ($extension->updateAvailable()) { - $return .= '<div class="msg notify">'. + $html .= '<div class="msg notify">'. sprintf($this->getLang('update_available'), hsc($extension->getLastUpdate())). '</div>'; } if ($extension->hasDownloadURLChanged()) { - $return .= '<div class="msg notify">' . + $html .= '<div class="msg notify">' . sprintf( $this->getLang('url_change'), '<bdi>' . hsc($extension->getDownloadURL()) . '</bdi>', @@ -370,7 +404,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin ) . '</div>'; } - return $return.DOKU_LF; + return $html.DOKU_LF; } /** @@ -392,7 +426,8 @@ class helper_plugin_extension_list extends DokuWiki_Plugin $name = shorten($base, $long, 55); - return '<a href="'.hsc($url).'" class="urlextern">'.hsc($name).'</a>'; + $html = '<a href="'.hsc($url).'" class="urlextern">'.hsc($name).'</a>'; + return $html; } /** @@ -404,88 +439,98 @@ class helper_plugin_extension_list extends DokuWiki_Plugin public function makeInfo(helper_plugin_extension_extension $extension) { $default = $this->getLang('unknown'); - $return = '<dl class="details">'; + $html = '<dl class="details">'; - $return .= '<dt>'.$this->getLang('status').'</dt>'; - $return .= '<dd>'.$this->makeStatus($extension).'</dd>'; + $html .= '<dt>'.$this->getLang('status').'</dt>'; + $html .= '<dd>'.$this->makeStatus($extension).'</dd>'; if ($extension->getDonationURL()) { - $return .= '<dt>'.$this->getLang('donate').'</dt>'; - $return .= '<dd>'; - $return .= '<a href="'.$extension->getDonationURL().'" class="donate">'. + $html .= '<dt>'.$this->getLang('donate').'</dt>'; + $html .= '<dd>'; + $html .= '<a href="'.$extension->getDonationURL().'" class="donate">'. $this->getLang('donate_action').'</a>'; - $return .= '</dd>'; + $html .= '</dd>'; } if (!$extension->isBundled()) { - $return .= '<dt>'.$this->getLang('downloadurl').'</dt>'; - $return .= '<dd><bdi>'; - $return .= ($extension->getDownloadURL() ? $this->shortlink($extension->getDownloadURL()) : $default); - $return .= '</bdi></dd>'; - - $return .= '<dt>'.$this->getLang('repository').'</dt>'; - $return .= '<dd><bdi>'; - $return .= ($extension->getSourcerepoURL() ? $this->shortlink($extension->getSourcerepoURL()) : $default); - $return .= '</bdi></dd>'; + $html .= '<dt>'.$this->getLang('downloadurl').'</dt>'; + $html .= '<dd><bdi>'; + $html .= ($extension->getDownloadURL() + ? $this->shortlink($extension->getDownloadURL()) + : $default); + $html .= '</bdi></dd>'; + + $html .= '<dt>'.$this->getLang('repository').'</dt>'; + $html .= '<dd><bdi>'; + $html .= ($extension->getSourcerepoURL() + ? $this->shortlink($extension->getSourcerepoURL()) + : $default); + $html .= '</bdi></dd>'; } if ($extension->isInstalled()) { if ($extension->getInstalledVersion()) { - $return .= '<dt>'.$this->getLang('installed_version').'</dt>'; - $return .= '<dd>'; - $return .= hsc($extension->getInstalledVersion()); - $return .= '</dd>'; + $html .= '<dt>'.$this->getLang('installed_version').'</dt>'; + $html .= '<dd>'; + $html .= hsc($extension->getInstalledVersion()); + $html .= '</dd>'; } if (!$extension->isBundled()) { - $return .= '<dt>'.$this->getLang('install_date').'</dt>'; - $return .= '<dd>'; - $return .= ($extension->getUpdateDate() ? hsc($extension->getUpdateDate()) : $this->getLang('unknown')); - $return .= '</dd>'; + $html .= '<dt>'.$this->getLang('install_date').'</dt>'; + $html .= '<dd>'; + $html .= ($extension->getUpdateDate() + ? hsc($extension->getUpdateDate()) + : $this->getLang('unknown')); + $html .= '</dd>'; } } if (!$extension->isInstalled() || $extension->updateAvailable()) { - $return .= '<dt>'.$this->getLang('available_version').'</dt>'; - $return .= '<dd>'; - $return .= ($extension->getLastUpdate() ? hsc($extension->getLastUpdate()) : $this->getLang('unknown')); - $return .= '</dd>'; + $html .= '<dt>'.$this->getLang('available_version').'</dt>'; + $html .= '<dd>'; + $html .= ($extension->getLastUpdate() + ? hsc($extension->getLastUpdate()) + : $this->getLang('unknown')); + $html .= '</dd>'; } - $return .= '<dt>'.$this->getLang('provides').'</dt>'; - $return .= '<dd><bdi>'; - $return .= ($extension->getTypes() ? hsc(implode(', ', $extension->getTypes())) : $default); - $return .= '</bdi></dd>'; + $html .= '<dt>'.$this->getLang('provides').'</dt>'; + $html .= '<dd><bdi>'; + $html .= ($extension->getTypes() + ? hsc(implode(', ', $extension->getTypes())) + : $default); + $html .= '</bdi></dd>'; if (!$extension->isBundled() && $extension->getCompatibleVersions()) { - $return .= '<dt>'.$this->getLang('compatible').'</dt>'; - $return .= '<dd>'; + $html .= '<dt>'.$this->getLang('compatible').'</dt>'; + $html .= '<dd>'; foreach ($extension->getCompatibleVersions() as $date => $version) { - $return .= '<bdi>'.$version['label'].' ('.$date.')</bdi>, '; + $html .= '<bdi>'.$version['label'].' ('.$date.')</bdi>, '; } - $return = rtrim($return, ', '); - $return .= '</dd>'; + $html = rtrim($html, ', '); + $html .= '</dd>'; } if ($extension->getDependencies()) { - $return .= '<dt>'.$this->getLang('depends').'</dt>'; - $return .= '<dd>'; - $return .= $this->makeLinkList($extension->getDependencies()); - $return .= '</dd>'; + $html .= '<dt>'.$this->getLang('depends').'</dt>'; + $html .= '<dd>'; + $html .= $this->makeLinkList($extension->getDependencies()); + $html .= '</dd>'; } if ($extension->getSimilarExtensions()) { - $return .= '<dt>'.$this->getLang('similar').'</dt>'; - $return .= '<dd>'; - $return .= $this->makeLinkList($extension->getSimilarExtensions()); - $return .= '</dd>'; + $html .= '<dt>'.$this->getLang('similar').'</dt>'; + $html .= '<dd>'; + $html .= $this->makeLinkList($extension->getSimilarExtensions()); + $html .= '</dd>'; } if ($extension->getConflicts()) { - $return .= '<dt>'.$this->getLang('conflicts').'</dt>'; - $return .= '<dd>'; - $return .= $this->makeLinkList($extension->getConflicts()); - $return .= '</dd>'; + $html .= '<dt>'.$this->getLang('conflicts').'</dt>'; + $html .= '<dd>'; + $html .= $this->makeLinkList($extension->getConflicts()); + $html .= '</dd>'; } - $return .= '</dl>'.DOKU_LF; - return $return; + $html .= '</dl>'.DOKU_LF; + return $html; } /** @@ -496,12 +541,13 @@ class helper_plugin_extension_list extends DokuWiki_Plugin */ public function makeLinkList($ext) { - $return = ''; + $html = ''; foreach ($ext as $link) { - $return .= '<bdi><a href="'. - $this->gui->tabURL('search', array('q'=>'ext:'.$link)).'">'.hsc($link).'</a></bdi>, '; + $html .= '<bdi><a href="'. + $this->gui->tabURL('search', array('q'=>'ext:'.$link)).'">'. + hsc($link).'</a></bdi>, '; } - return rtrim($return, ', '); + return rtrim($html, ', '); } /** @@ -513,19 +559,19 @@ class helper_plugin_extension_list extends DokuWiki_Plugin public function makeActions(helper_plugin_extension_extension $extension) { global $conf; - $return = ''; + $html = ''; $errors = ''; if ($extension->isInstalled()) { if (($canmod = $extension->canModify()) === true) { if (!$extension->isProtected()) { - $return .= $this->makeAction('uninstall', $extension); + $html .= $this->makeAction('uninstall', $extension); } if ($extension->getDownloadURL()) { if ($extension->updateAvailable()) { - $return .= $this->makeAction('update', $extension); + $html .= $this->makeAction('update', $extension); } else { - $return .= $this->makeAction('reinstall', $extension); + $html .= $this->makeAction('reinstall', $extension); } } } else { @@ -534,9 +580,9 @@ class helper_plugin_extension_list extends DokuWiki_Plugin if (!$extension->isProtected() && !$extension->isTemplate()) { // no enable/disable for templates if ($extension->isEnabled()) { - $return .= $this->makeAction('disable', $extension); + $html .= $this->makeAction('disable', $extension); } else { - $return .= $this->makeAction('enable', $extension); + $html .= $this->makeAction('enable', $extension); } } @@ -553,7 +599,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin } else { if (($canmod = $extension->canModify()) === true) { if ($extension->getDownloadURL()) { - $return .= $this->makeAction('install', $extension); + $html .= $this->makeAction('install', $extension); } } else { $errors .= '<div class="permerror">'.$this->getLang($canmod).'</div>'; @@ -561,13 +607,13 @@ class helper_plugin_extension_list extends DokuWiki_Plugin } if (!$extension->isInstalled() && $extension->getDownloadURL()) { - $return .= ' <span class="version">'.$this->getLang('available_version').' '; - $return .= ($extension->getLastUpdate() + $html .= ' <span class="version">'.$this->getLang('available_version').' '; + $html .= ($extension->getLastUpdate() ? hsc($extension->getLastUpdate()) : $this->getLang('unknown')).'</span>'; } - return $return.' '.$errors.DOKU_LF; + return $html.' '.$errors.DOKU_LF; } /** @@ -591,8 +637,9 @@ class helper_plugin_extension_list extends DokuWiki_Plugin $classes = 'button '.$action; $name = 'fn['.$action.']['.hsc($extension->getID()).']'; - return '<button class="'.$classes.'" name="'.$name.'" type="submit" '.$title.'>'. + $html = '<button class="'.$classes.'" name="'.$name.'" type="submit" '.$title.'>'. $this->getLang('btn_'.$action).'</button> '; + return $html; } /** @@ -605,7 +652,6 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $status = array(); - if ($extension->isInstalled()) { $status[] = $this->getLang('status_installed'); if ($extension->isProtected()) { @@ -620,7 +666,9 @@ class helper_plugin_extension_list extends DokuWiki_Plugin } if (!$extension->canModify()) $status[] = $this->getLang('status_unmodifiable'); if ($extension->isBundled()) $status[] = $this->getLang('status_bundled'); - $status[] = $extension->isTemplate() ? $this->getLang('status_template') : $this->getLang('status_plugin'); - return join(', ', $status); + $status[] = $extension->isTemplate() + ? $this->getLang('status_template') + : $this->getLang('status_plugin'); + return implode(', ', $status); } } diff --git a/lib/plugins/extension/script.js b/lib/plugins/extension/script.js index 8627db420..7c915808e 100644 --- a/lib/plugins/extension/script.js +++ b/lib/plugins/extension/script.js @@ -5,7 +5,7 @@ jQuery(function(){ /** * Confirm uninstalling */ - $extmgr.find('button.uninstall').click(function(e){ + $extmgr.find('button.uninstall').on('click', function(e){ if(!window.confirm(LANG.plugins.extension.reallydel)){ e.preventDefault(); return false; @@ -17,7 +17,7 @@ jQuery(function(){ * very simple lightbox * @link http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/super-simple-lightbox-with-css-and-jquery/ */ - $extmgr.find('a.extension_screenshot').click(function(e) { + $extmgr.find('a.extension_screenshot').on('click', function(e) { e.preventDefault(); //Get clicked link href @@ -29,7 +29,7 @@ jQuery(function(){ $lightbox = jQuery('<div id="plugin__extensionlightbox"><p>Click to close</p><div></div></div>') .appendTo(jQuery('body')) .hide() - .click(function(){ + .on('click', function(){ $lightbox.hide(); }); } @@ -46,7 +46,7 @@ jQuery(function(){ /** * Enable/Disable extension via AJAX */ - $extmgr.find('button.disable, button.enable').click(function (e) { + $extmgr.find('button.disable, button.enable').on('click', function (e) { e.preventDefault(); var $btn = jQuery(this); @@ -85,7 +85,7 @@ jQuery(function(){ /** * AJAX detail infos */ - $extmgr.find('a.info').click(function(e){ + $extmgr.find('a.info').on('click', function(e){ e.preventDefault(); var $link = jQuery(this); @@ -129,12 +129,12 @@ jQuery(function(){ var $label = jQuery( '<label></label>' ) .appendTo($displayOpts); var $input = jQuery( '<input />', { type: 'checkbox', name: chkName }) - .change(displayOptionsHandler) + .on('change', displayOptionsHandler) .appendTo($label); var previous = DokuCookie.getValue('ext_'+chkName); if(typeof previous === "undefined" || previous == '1') { - $input.click(); + $input.trigger('click'); } jQuery( '<span/>' ) diff --git a/lib/plugins/revert/lang/no/lang.php b/lib/plugins/revert/lang/no/lang.php index 942d54a94..3e65a94b5 100644 --- a/lib/plugins/revert/lang/no/lang.php +++ b/lib/plugins/revert/lang/no/lang.php @@ -3,8 +3,8 @@ /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * - * @author Rut Kristin Aanestad <dark@met.no> * @author Torgeir Blesvik <bletor@banenor.no> + * @author Rut Kristin Aanestad <dark@met.no> * @author ThorPrestboen <thor.erling.prestboen@gmail.com> * @author Christian McKenna <mckchr@banenor.no> * @author Thomas Nygreen <nygreen@gmail.com> diff --git a/lib/plugins/styling/script.js b/lib/plugins/styling/script.js index 3859190c7..909e999b8 100644 --- a/lib/plugins/styling/script.js +++ b/lib/plugins/styling/script.js @@ -64,7 +64,7 @@ jQuery(function () { var $btn = jQuery('<button>' + LANG.plugins.styling.popup + '</button>'); $form.prepend($btn); - $btn.click(function (e) { + $btn.on('click', function (e) { var windowFeatures = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=false,width=500,height=500"; window.open(DOKU_BASE + 'lib/plugins/styling/popup.php', 'styling_popup', windowFeatures); e.preventDefault(); diff --git a/lib/plugins/usermanager/_test/csv_import.test.php b/lib/plugins/usermanager/_test/csv_import.test.php index 6047a9342..13034a012 100644 --- a/lib/plugins/usermanager/_test/csv_import.test.php +++ b/lib/plugins/usermanager/_test/csv_import.test.php @@ -14,13 +14,14 @@ require_once(dirname(__FILE__).'/mocks.class.php'); * * At present, users imported in individual tests remain in the user list for subsequent tests */ -class plugin_usermanager_csv_import_test extends DokuWikiTest { - +class plugin_usermanager_csv_import_test extends DokuWikiTest +{ private $old_files; protected $usermanager; protected $importfile; - function setUp() { + public function setUp() + { $this->importfile = tempnam(TMP_DIR, 'csv'); $this->old_files = $_FILES; @@ -38,16 +39,18 @@ class plugin_usermanager_csv_import_test extends DokuWikiTest { parent::setUp(); } - function tearDown() { + public function tearDown() + { $_FILES = $this->old_files; parent::tearDown(); } - function doImportTest($importCsv, $expectedResult, $expectedNewUsers, $expectedFailures) { + public function doImportTest($importCsv, $expectedResult, $expectedNewUsers, $expectedFailures) + { global $auth; $before_users = $auth->retrieveUsers(); - io_savefile($this->importfile, $importCsv); + io_saveFile($this->importfile, $importCsv); $result = $this->usermanager->tryImport(); $after_users = $auth->retrieveUsers(); @@ -69,7 +72,8 @@ class plugin_usermanager_csv_import_test extends DokuWikiTest { $this->assertEquals($expectedFailures, $this->usermanager->getImportFailures()); // failures as expected } - function test_cantImport(){ + public function test_cantImport() + { global $auth; $oldauth = $auth; @@ -85,7 +89,8 @@ importuser,"Ford Prefect",ford@example.com,user $auth = $oldauth; } - function test_import() { + public function test_import() + { $csv = 'User,"Real Name",Email,Groups importuser,"Ford Prefect",ford@example.com,user '; @@ -100,7 +105,8 @@ importuser,"Ford Prefect",ford@example.com,user $this->doImportTest($csv, true, $expected, array()); } - function test_importExisting() { + public function test_importExisting() + { $csv = 'User,"Real Name",Email,Groups importuser,"Ford Prefect",ford@example.com,user '; @@ -120,7 +126,8 @@ importuser,"Ford Prefect",ford@example.com,user $this->doImportTest($csv, true, array(), $failures); } - function test_importUtf8() { + public function test_importUtf8() + { $csv = 'User,"Real Name",Email,Groups importutf8,"Førd Prefect",ford@example.com,user '; @@ -138,7 +145,8 @@ importutf8,"Førd Prefect",ford@example.com,user /** * utf8: u+00F8 (ø) <=> 0xF8 :iso-8859-1 */ - function test_importIso8859() { + public function test_importIso8859() + { $csv = 'User,"Real Name",Email,Groups importiso8859,"F'.chr(0xF8).'rd Prefect",ford@example.com,user '; @@ -153,14 +161,16 @@ importiso8859,"F'.chr(0xF8).'rd Prefect",ford@example.com,user $this->doImportTest($csv, true, $expected, array()); } - private function stripPasswords($array){ + private function stripPasswords($array) + { foreach ($array as $user => $data) { unset($array[$user]['pass']); } return $array; } - private function countPasswords($array){ + private function countPasswords($array) + { $count = 0; foreach ($array as $user => $data) { if (!empty($data['pass'])) { @@ -169,6 +179,4 @@ importiso8859,"F'.chr(0xF8).'rd Prefect",ford@example.com,user } return $count; } - } - diff --git a/lib/plugins/usermanager/script.js b/lib/plugins/usermanager/script.js index de013242b..3b7ad0964 100644 --- a/lib/plugins/usermanager/script.js +++ b/lib/plugins/usermanager/script.js @@ -2,7 +2,7 @@ * Add JavaScript confirmation to the User Delete button */ jQuery(function(){ - jQuery('#usrmgr__del').click(function(){ + jQuery('#usrmgr__del').on('click', function(){ return confirm(LANG.del_confirm); }); }); diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index da8eec7e7..f9aad3d02 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -85,14 +85,14 @@ var dw_behaviour = { * Looks for an element with the ID focus__this at sets focus to it */ focusMarker: function(){ - jQuery('#focus__this').focus(); + jQuery('#focus__this').trigger('focus'); }, /** * Remove all search highlighting when clicking on a highlighted term */ removeHighlightOnClick: function(){ - jQuery('span.search_hit').click( + jQuery('span.search_hit').on('click', function(e){ jQuery(e.target).removeClass('search_hit', 1000); } @@ -110,7 +110,7 @@ var dw_behaviour = { */ quickSelect: function(){ jQuery('select.quickselect') - .change(function(e){ e.target.form.submit(); }) + .on('change', function(e){ e.target.form.submit(); }) .closest('form').find(':button').not('.show').hide(); }, @@ -146,7 +146,7 @@ var dw_behaviour = { $digest = $form.find("input[name='sub_style'][value='digest']"); $form.find("input[name='sub_target']") - .click( + .on('click', function () { var $this = jQuery(this), show_list; if (!$this.prop('checked')) { @@ -161,7 +161,7 @@ var dw_behaviour = { } ) .filter(':checked') - .click(); + .trigger('click'); }, /** @@ -177,15 +177,15 @@ var dw_behaviour = { var $button = jQuery('button', $revisions); if($checked.length < 2) { - $all.removeAttr('disabled'); - $button.attr('disabled', true); + $all.prop('disabled', false); + $button.prop('disabled', true); } else { - $all.attr('disabled', true); - $button.removeAttr('disabled'); + $all.prop('disabled', true); + $button.prop('disabled', false); $checked.each(function(i) { - jQuery(this).removeAttr('disabled'); + jQuery(this).prop('disabled', false); if(i>1) { - jQuery(this).attr('checked', false); + jQuery(this).prop('checked', false); } }); } diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index 87490d9eb..f53a6d4ae 100644 --- a/lib/scripts/edit.js +++ b/lib/scripts/edit.js @@ -238,7 +238,7 @@ jQuery(function () { sel.start = 0; sel.end = 0; DWsetSelection(sel); - $edit_text.focus(); + $edit_text.trigger('focus'); doku_edit_text_content = $edit_text.val(); } @@ -260,13 +260,13 @@ jQuery(function () { window.onunload = deleteDraft; // reset change memory var on submit - jQuery('#edbtn__save').click( + jQuery('#edbtn__save').on('click', function() { window.onbeforeunload = ''; textChanged = false; } ); - jQuery('#edbtn__preview').click( + jQuery('#edbtn__preview').on('click', function() { window.onbeforeunload = ''; textChanged = false; @@ -275,8 +275,7 @@ jQuery(function () { ); var $summary = jQuery('#edit__summary'); - $summary.change(doku_summaryCheck); - $summary.keyup(doku_summaryCheck); + $summary.on('change keyup', doku_summaryCheck); if (textChanged) doku_summaryCheck(); }); diff --git a/lib/scripts/editor.js b/lib/scripts/editor.js index c9cb312b0..0df556172 100644 --- a/lib/scripts/editor.js +++ b/lib/scripts/editor.js @@ -60,7 +60,7 @@ var dw_editor = { jQuery(document.createElement('img')) .attr('src', DOKU_BASE+'lib/images/' + img[0] + '.gif') .attr('alt', '') - .click(img[1]) + .on('click', img[1]) .appendTo($ctl); }); }, @@ -140,7 +140,7 @@ var dw_editor = { if((e.keyCode == 13 || e.keyCode == 10) && e.ctrlKey) { // Ctrl-Enter (With Chrome workaround) // Submit current edit - jQuery('#edbtn__save').click(); + jQuery('#edbtn__save').trigger('click'); e.preventDefault(); // prevent enter key return false; }else if(e.keyCode == 13){ // Enter diff --git a/lib/scripts/fileuploaderextended.js b/lib/scripts/fileuploaderextended.js index ba2aa3ea5..b7f9f5f30 100644 --- a/lib/scripts/fileuploaderextended.js +++ b/lib/scripts/fileuploaderextended.js @@ -149,7 +149,7 @@ qq.extend(qq.FileUploaderExtended.prototype, { self._handler._options.onUpload(); jQuery(".qq-upload-name-input").each(function (i) { - jQuery(this).attr('disabled', 'disabled'); + jQuery(this).prop('disabled', true); }); }); }, diff --git a/lib/scripts/linkwiz.js b/lib/scripts/linkwiz.js index da1e072a1..d82ca9681 100644 --- a/lib/scripts/linkwiz.js +++ b/lib/scripts/linkwiz.js @@ -57,7 +57,7 @@ var dw_linkwiz = { } // attach event handlers - jQuery('#link__wiz .ui-dialog-titlebar-close').click(dw_linkwiz.hide); + jQuery('#link__wiz .ui-dialog-titlebar-close').on('click', dw_linkwiz.hide); dw_linkwiz.$entry.keyup(dw_linkwiz.onEntry); jQuery(dw_linkwiz.result).on('click', 'a', dw_linkwiz.onResultClick); }, diff --git a/lib/scripts/media.js b/lib/scripts/media.js index e61cedeee..6f36d3b2e 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -107,7 +107,7 @@ var dw_mediamanager = { dw_mediamanager.update_resizable(); dw_mediamanager.layout_width = $page.width(); - jQuery(window).resize(dw_mediamanager.window_resize); + jQuery(window).on('resize', dw_mediamanager.window_resize); }, init_options: function () { @@ -194,7 +194,7 @@ var dw_mediamanager = { .addClass('button') .attr('id', "media__" + opt.id + "btn" + (i + 1)) .attr('title', LANG['media' + text]) - .click(bind(dw_mediamanager.setOpt, opt.id)); + .on('click', bind(dw_mediamanager.setOpt, opt.id)); $img = jQuery(document.createElement('img')) .attr('src', DOKU_BASE + 'lib/images/media_' + opt.id + '_' + text + '.png'); @@ -735,7 +735,7 @@ var dw_mediamanager = { // remove old callback from the insert button and set the new one. var $sendbtn = jQuery('#media__sendbtn'); - $sendbtn.off().click(bind(dw_mediamanager.insert, id)); + $sendbtn.off().on('click', bind(dw_mediamanager.insert, id)); dw_mediamanager.unforbid('ext'); if (ext === '.swf') { @@ -801,7 +801,7 @@ var dw_mediamanager = { $box = jQuery(document.createElement('input')) .attr('type', 'checkbox') .attr('id', 'media__' + opt[0]) - .click(bind(dw_mediamanager.toggleOption, opt[0])); + .on('click', bind(dw_mediamanager.toggleOption, opt[0])); if (DokuCookie.getValue(opt[0])) { $box.prop('checked', true); diff --git a/lib/scripts/page.js b/lib/scripts/page.js index 2332af4de..284c2038b 100644 --- a/lib/scripts/page.js +++ b/lib/scripts/page.js @@ -9,7 +9,7 @@ dw_page = { */ init: function(){ dw_page.sectionHighlight(); - jQuery('a.fn_top').mouseover(dw_page.footnoteDisplay); + jQuery('a.fn_top').on('mouseover', dw_page.footnoteDisplay); dw_page.makeToggle('#dw__toc h3','#dw__toc > div'); }, @@ -20,7 +20,7 @@ dw_page = { */ sectionHighlight: function() { jQuery('form.btn_secedit') - .mouseover(function(){ + .on('mouseover', function(){ var $tgt = jQuery(this).parent(), nr = $tgt.attr('class').match(/(\s+|^)editbutton_(\d+)(\s+|$)/)[2], $highlight = jQuery(), // holder for elements in the section to be highlighted @@ -36,7 +36,7 @@ dw_page = { // and move the elements to be highlighted inside the section highlight wrapper $highlight.detach().appendTo($highlightWrap); }) - .mouseout(function(){ + .on('mouseout', function(){ // find the section highlight wrapper... var $highlightWrap = jQuery('.section_highlight'); // ...move its children in front of it (as siblings)... @@ -63,7 +63,7 @@ dw_page = { .attr('id', popup_id) .addClass('insitu-footnote JSpopup') .attr('aria-hidden', 'true') - .mouseleave(function () {jQuery(this).hide().attr('aria-hidden', 'true');}) + .on('mouseleave', function () {jQuery(this).hide().attr('aria-hidden', 'true');}) .attr('role', 'tooltip'); jQuery('.dokuwiki:first').append($fndiv); } @@ -179,7 +179,7 @@ dw_page = { // click function $handle.css('cursor','pointer') - .click($handle[0].setState) + .on('click', $handle[0].setState) .prepend($clicky); // initial state diff --git a/lib/scripts/qsearch.js b/lib/scripts/qsearch.js index 18e51506c..f95515b93 100644 --- a/lib/scripts/qsearch.js +++ b/lib/scripts/qsearch.js @@ -57,7 +57,7 @@ jQuery.fn.dw_qsearch = function (overrides) { ); }; - dw_qsearch.$inObj.keyup( + dw_qsearch.$inObj.on('keyup', function () { if (dw_qsearch.timer) { window.clearTimeout(dw_qsearch.timer); @@ -68,7 +68,7 @@ jQuery.fn.dw_qsearch = function (overrides) { ); // attach eventhandler to output field - dw_qsearch.$outObj.click(dw_qsearch.clear_results); + dw_qsearch.$outObj.on('click', dw_qsearch.clear_results); }, /** diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 97edef0b7..0e03dcf37 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -26,5 +26,5 @@ function closePopups(){ } jQuery(function () { - jQuery(document).click(closePopups); + jQuery(document).on('click', closePopups); }); diff --git a/lib/scripts/search.js b/lib/scripts/search.js index 540165255..111dca99a 100644 --- a/lib/scripts/search.js +++ b/lib/scripts/search.js @@ -30,7 +30,7 @@ jQuery(function () { }); if (DokuCookie.getValue('sa') === 'on') { - $toggleAssistanceButton.click(); + $toggleAssistanceButton.trigger('click'); } $searchForm.find('.advancedOptions .toggle div.current').on('click', function () { diff --git a/lib/tpl/dokuwiki/script.js b/lib/tpl/dokuwiki/script.js index 5a68e8b9c..88dae9023 100644 --- a/lib/tpl/dokuwiki/script.js +++ b/lib/tpl/dokuwiki/script.js @@ -71,10 +71,15 @@ jQuery(function(){ ); // increase sidebar length to match content (desktop mode only) - var $sidebar = jQuery('.desktop #dokuwiki__aside'); - if($sidebar.length) { + var sidebar_height = jQuery('.desktop #dokuwiki__aside').height(); + var pagetool_height = jQuery('.desktop #dokuwiki__pagetools ul:first').height(); + // pagetools div has no height; ul has a height + var content_min = Math.max(sidebar_height || 0, pagetool_height || 0); + + var content_height = jQuery('#dokuwiki__content div.page').height(); + if(content_min && content_min > content_height) { var $content = jQuery('#dokuwiki__content div.page'); - $content.css('min-height', $sidebar.height()); + $content.css('min-height', content_min); } // blur when clicked diff --git a/lib/tpl/index.php b/lib/tpl/index.php index a3e9a8849..4d48d5127 100644 --- a/lib/tpl/index.php +++ b/lib/tpl/index.php @@ -18,7 +18,7 @@ require_once(DOKU_INC.'inc/init.php'); <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Template Replacements</title> - <style type="text/css"> + <style> body { background-color: #fff; color: #000; |