Commit Graph

88 Commits

Author SHA1 Message Date
Andreas Gohr 697ca7e2e1 fixed plugin name output on load error 2020-08-13 20:32:17 +02:00
Andreas Gohr ffa84f8121 better exception handling on plugin loading
Now all important places where plugins are loaded are guarded by a
try/except. We're catching Throwables here to be able to catch stuff
like syntax errors early on (otherwise they will only be caught by our
ErrorConverter much too late). This means that this change requires PHP
7.0 minimum!
2020-08-12 17:42:26 +02:00
Andreas Gohr 46028c4c32 Move defines to their own file
As described in
https://github.com/dwp-forge/columns/issues/5#issuecomment-638467603
sometime the Lexer constants have not been (auto)loaded when a syntax plugin
is invoked (I'm not sure why).

In general PSR2 discourages a mix of main code and function/class setup
with the call to define() being considered main code.

This patch moves these the define calls to a separate new file, solving
both of the above problems.

These are not all our defines. Instead I focused on the ones that are
ENUM-like.

In the future we should think about what defines can be replaced by
class constants and what other define() calls should be moved.
2020-06-04 08:22:16 +02:00
Andreas Gohr 68f88d34de Use type safe comparisons in loader 2019-05-20 08:43:30 +02:00
Andreas Gohr 0aace2b961 Remove obsolete include
Subscriptions are autoloaded now
2019-05-20 08:42:58 +02:00
Andreas Gohr 820934dc5d Merge branch 'psr2-pluginredux' into psr2
* psr2-pluginredux:
  Minor optimizations in PluginController
  Snake to Camel case fixes inn PluginController
  Fix snake->camel case, doc blocks
  minor code simplification
  snake to camel case fixes in EventHandler
  Move list of plugin types to plugin controller constant
  Avoid accessing the evet system before it's intialized
  Avoid processing events before the Event System is intiialized
  isEnabled instead of isDisabled
  removed get_directory() method from PluginController
  fix type hints
  moved plugin controller to Extension namespace
  removed deleted file from autoloader
  deprecated trigger_event() in favor of a static method on Event
  First go at moving the plugin classes into their own namespace
2019-05-19 11:09:54 +02:00
Michael Große 451969ab75
🚚 Move Subscription class to deprecated.php
This class has been replaced by the classes in the
dokuwiki/Subscriptions namespace.
2019-04-22 21:36:07 +02:00
Andreas Gohr 1935a89170 Move list of plugin types to plugin controller constant
There is no need to have them in a global variable.
2019-04-21 19:31:27 +02:00
Andreas Gohr 3a7140a158 moved plugin controller to Extension namespace 2019-04-20 21:55:27 +02:00
Andreas Gohr c630f65948 removed deleted file from autoloader 2019-04-20 21:48:53 +02:00
Andreas Gohr e1d9dcc8b4 First go at moving the plugin classes into their own namespace 2019-04-20 21:33:23 +02:00
Michael Große 60b9af73d5
Move deprecated HTTPClient classes to deprecated.php 2019-03-17 13:36:47 +01:00
Andreas Gohr c3cc6e05f5 PSR2 adjustments for the PassHash class
I opted for ignoring the camel case funtion check not because the public hash_*
methods are widely used but because I find this style actually cleaner
in this case where the method name is auto-built from the hash type
name.
2019-03-06 20:22:43 +01:00
Andreas Gohr ccc4c71ca8 adjusted the Input clases for PSR2
They are now in their own namespace.
2019-02-19 20:39:13 +01:00
Andreas Gohr d443762baf deprecated JSON class
JSON is natively supported since years. This makes
2145bd4c56 obsolete again.
2018-07-27 15:10:49 +02:00
Andreas Gohr 4cdb684284 started a dedicated file for deprecated stuff 2018-05-07 22:26:05 +02:00
Andreas Gohr dd87735d91 PSR-2 compatibility for the remote API libs 2018-05-07 22:21:39 +02:00
Andreas Gohr de226116e9 adjusted the Lexer for PSR-2 2018-05-04 11:13:46 +02:00
Andreas Gohr d2778ca9d5 correctly autoload the parser stuff 2018-04-27 21:33:14 +02:00
Andreas Gohr a087da71ea fixed broken tests
I also introduced an auto loaded namespace for the tests.
2018-04-27 21:31:06 +02:00
Andreas Gohr 64159a61e9 line lengths shortened
This makes sure all files use line lenghts shorter than 120 characters.

This is a quick fix. It might not always be the nicest change.
2018-04-27 19:07:43 +02:00
Andreas Gohr 874fc8d335
Merge pull request #2168 from splitbrain/cli
New CLI Plugin Type
2018-04-05 09:58:15 +02:00
Gerrit Uitslag 8cbb9bb84a remove old class reference
files were deleted by fa2c560da3
2017-12-24 13:32:56 +01:00
Andreas Gohr 39bceb982d Change plugin functionality into a trait
This allows for using the functionality in class hierarchies that can
not inherit from DokuWiki_Plugin.
2017-11-10 16:39:07 +01:00
Andreas Gohr 7c6a857aa2 Merge branch 'master' into actionrefactor
* master: (65 commits)
  updated composer dependencies
  Release preparation
  translation update
  do not disclose email or IP addresses of users through RSS
  small fix
  Make default encapsulation more readable and less duplicate.
  Replace htmlspecialchars to hsc in core
  Add the preview-bool for the cache file.
  Add htmlspecialchars when showing $DATE_AT
  #2021 broken links to W3C validators also dokuwiki and php are on https
  made bin/wantedpage.php more flexible
  doc abbreviation
  Fix PHP Notices: Reduce error log noise
  Create valid empty options
  translation update
  doc fix
  translation update
  using $options->getCmd to retrieve show-pages parameter
  added option to wantedpages.php to show or not show pages where broken links occur
  show pages where broken links occur: page_id => broken_link
  ...
2017-08-15 18:24:51 +02:00
Andreas Gohr 0ed9c2e284 Merge branch 'master' into lesserphp
* master: (70 commits)
  Release preparation
  translation update
  do not disclose email or IP addresses of users through RSS
  small fix
  Make default encapsulation more readable and less duplicate.
  Replace htmlspecialchars to hsc in core
  Add the preview-bool for the cache file.
  Add htmlspecialchars when showing $DATE_AT
  #2021 broken links to W3C validators also dokuwiki and php are on https
  made bin/wantedpage.php more flexible
  doc abbreviation
  Fix PHP Notices: Reduce error log noise
  Create valid empty options
  translation update
  doc fix
  translation update
  using $options->getCmd to retrieve show-pages parameter
  added option to wantedpages.php to show or not show pages where broken links occur
  show pages where broken links occur: page_id => broken_link
  clean extension names. fixes #2042
  ...
2017-08-15 18:03:29 +02:00
Andreas Gohr 3d4e333534 moved EmailAdressValidator to composer install #1970 2017-05-26 21:37:21 +02:00
Andreas Gohr 572dd708be use composer based library for feed creator #1970 2017-05-18 22:38:19 +02:00
Andreas Gohr fa3b6716ec Merge branch 'master' into actionrefactor
* master:
  fix error in config manager caused by changes visibility
  Continue if there are no attributes
  avoid dependency tests being marked as risky
  replaced some more each calls
  remove deprecated each() call
  test constructors need to call parent constructor
  use dataprovider in password tests
  removed deprecated blowfish class
  replace some var keywords
  translation update
  PassHash.class.php: in case of brcrypt, use the most recent variant $2y$
  translation update
  Fix Typo in remote API (#1938)
  translation update
  translation update
  translation update
  use 403 response on bad logins. closes #1937
2017-05-13 09:05:51 +02:00
Andreas Gohr 51c795946d replace LESS compiler with lesserphp
This is a better maintained fork of lessphp. It seems to be fully
compatible, so this is more or less a drop in replacement.
2017-05-12 16:06:42 +02:00
Andreas Gohr bb8df023ce removed deprecated blowfish class 2017-05-12 15:23:16 +02:00
Andreas Gohr b16ddc6e47 do not blindly assume classes in our own namespace exist 2017-03-31 11:56:35 +02:00
Takamura f50a239b3b I supplemented the existing comments on the methods in which there was not enough information to the standard phpDoc. 2017-03-31 09:33:33 +02:00
Andreas Gohr f83f0fd074 support autoloading for templates
similar to what is possible for plugins, templates can now autoload
namespaced classes, too. the namespace is
dokuwiki\template\<templatename>
2017-02-05 07:15:05 +01:00
Andreas Gohr 114248c73b Merge branch 'master' into phpseclib
* master: (54 commits)
  updated geshi
  authpdo - use type safe comparison on passwords. fixes #1765
  removed unneeded files from random_compat
  Use cryptographically secure pseudo random number generator (CSPRNG)
  translation update
  translation update
  translation update
  translation update
  translation update
  or maybe I only now figured out the right travis config :-/
  disable 7.1 testing completely
  allow 7.1 failures until it's released #1682
  DE translation for key 'protected'
  Use 'Benachrichtigung' instead of 'Notifikation'
  Fix spelling of some terms (lower to upper case)
  DE translation for key: addUser_error_missing_pass
  DE translation for keys: update_name, update_mail
  translation update
  translation update
  Implemented interwiki substitution for external images (issue #1614).
  ...
2016-11-30 16:07:46 +01:00
Florian Rathgeber b368386f9b Autoload IXR_Error class #1704 2016-10-01 13:00:31 +01:00
Andreas Gohr 59419fd022 Use composer installed phpseclib
We used to ship only parts of phpseclib in inc/phpseclib which made it a
little tricky to update. This replaces the library with a composer
installed version, making the rest of the library available to plugin
authors. It might fix a problem with PHP 7.1 as reported in #1682
(unconfirmed)
2016-09-06 12:12:46 +02:00
Andreas Gohr b00eb8174c fixed wrong namespace length
as pointed out in
b89dfc20f1 (r60392099)
2016-04-20 16:32:09 +02:00
Andreas Gohr b89dfc20f1 vendor prefix plugin namespace
As suggested by @micgro42 the plugin namespace should use a vendor
prefix to avoid name clashes when DokuWiki is integrated with other
software.
2016-04-18 19:01:12 +02:00
Andreas Gohr 600fb65eac autoload plugin namespace
This introduces an autoloader for namespaces starting with plugin\*

This way, plugins can easily have additional classes auto loaded without
needing to register their own loader. A plugin\*\test\* namespace will
automatically be mapped to the _test directory of the plugin.
2016-04-14 23:54:58 +02:00
Andreas Gohr ce9492633d autoloader needs return, plugins should be required not included 2015-11-27 10:02:02 +01:00
David Stone b20eed15a3 fix error 2015-10-17 21:52:32 -06:00
David Stone 8a58013ef5 Optimizations to autoloader
Autoloader should return true if it can handle the class so other registered autoloader don't execute.
require is faster than require_once and should be safe to use since the autoloader won't run if the class already exists
2015-10-17 20:45:41 -06:00
Andreas Gohr 8909ab7629 Merge pull request #1265 from splitbrain/form2
Form 2
2015-08-03 18:47:19 +02:00
Andreas Gohr 0b55591d7a deprecation of Archive libs 2015-07-31 13:02:08 +02:00
Andreas Gohr 41d51802a4 switched geshi higlighter to composer based repository 2015-05-15 16:26:00 +02:00
Andreas Gohr e7a32b1767 added autoloading for namespaced classes 2015-05-08 16:27:17 +02:00
Andreas Gohr 79e7937762 Remove error supression for file_exists()
In an older version of PHP a file_exists() call would issue a warning
when the file did not exist. This was fixed in later PHP releases. Since
we require PHP 5.3 now, there's no need to supress any error here
anymore. This might even give a minor performance boost.
2015-01-07 10:47:45 +01:00
Andreas Gohr 496e3a6f34 completely new base for CLI scripts
This introduces an abstract base class that command line tools need to
inherit from. It provides a simple framework for registering accepted
command line options and provides commonly needed things like help
output and colored text.

Existing CLI scripts still need to be converted.
2014-03-17 23:03:53 +01:00
Christopher Smith 2ada8709d3 add renderers to autolader 2014-02-25 20:32:56 +00:00