Merge branch 'master' into revisionHandle3
[dokuwiki.git] / inc / deprecated.php
blob2050373447d875f98a8f4d2bf054cccec664e807
1 <?php
2 // phpcs:ignoreFile -- this file violates PSR2 by definition
3 /**
4 * These classes and functions are deprecated and will be removed in future releases
5 */
7 use dokuwiki\Debug\DebugHelper;
8 use dokuwiki\Subscriptions\BulkSubscriptionSender;
9 use dokuwiki\Subscriptions\MediaSubscriptionSender;
10 use dokuwiki\Subscriptions\PageSubscriptionSender;
11 use dokuwiki\Subscriptions\RegistrationSubscriptionSender;
12 use dokuwiki\Subscriptions\SubscriberManager;
14 /**
15 * @inheritdoc
16 * @deprecated 2018-05-07
18 class RemoteAccessDeniedException extends \dokuwiki\Remote\AccessDeniedException
20 /** @inheritdoc */
21 public function __construct($message = "", $code = 0, Throwable $previous = null)
23 dbg_deprecated(\dokuwiki\Remote\AccessDeniedException::class);
24 parent::__construct($message, $code, $previous);
29 /**
30 * @inheritdoc
31 * @deprecated 2018-05-07
33 class RemoteException extends \dokuwiki\Remote\RemoteException
35 /** @inheritdoc */
36 public function __construct($message = "", $code = 0, Throwable $previous = null)
38 dbg_deprecated(\dokuwiki\Remote\RemoteException::class);
39 parent::__construct($message, $code, $previous);
44 /**
45 * Escapes regex characters other than (, ) and /
47 * @param string $str
48 * @return string
49 * @deprecated 2018-05-04
51 function Doku_Lexer_Escape($str)
53 dbg_deprecated('\\dokuwiki\\Parsing\\Lexer\\Lexer::escape()');
54 return \dokuwiki\Parsing\Lexer\Lexer::escape($str);
57 /**
58 * @inheritdoc
59 * @deprecated 2018-06-01
61 class setting extends \dokuwiki\plugin\config\core\Setting\Setting
63 /** @inheritdoc */
64 public function __construct($key, array $params = null)
66 dbg_deprecated(\dokuwiki\plugin\config\core\Setting\Setting::class);
67 parent::__construct($key, $params);
71 /**
72 * @inheritdoc
73 * @deprecated 2018-06-01
75 class setting_authtype extends \dokuwiki\plugin\config\core\Setting\SettingAuthtype
77 /** @inheritdoc */
78 public function __construct($key, array $params = null)
80 dbg_deprecated(\dokuwiki\plugin\config\core\Setting\SettingAuthtype::class);
81 parent::__construct($key, $params);
85 /**
86 * @inheritdoc
87 * @deprecated 2018-06-01
89 class setting_string extends \dokuwiki\plugin\config\core\Setting\SettingString
91 /** @inheritdoc */
92 public function __construct($key, array $params = null)
94 dbg_deprecated(\dokuwiki\plugin\config\core\Setting\SettingString::class);
95 parent::__construct($key, $params);
99 /**
100 * @inheritdoc
101 * @deprecated 2018-06-15
103 class PageChangelog extends \dokuwiki\ChangeLog\PageChangeLog
105 /** @inheritdoc */
106 public function __construct($id, $chunk_size = 8192)
108 dbg_deprecated(\dokuwiki\ChangeLog\PageChangeLog::class);
109 parent::__construct($id, $chunk_size);
114 * @inheritdoc
115 * @deprecated 2018-06-15
117 class MediaChangelog extends \dokuwiki\ChangeLog\MediaChangeLog
119 /** @inheritdoc */
120 public function __construct($id, $chunk_size = 8192)
122 dbg_deprecated(\dokuwiki\ChangeLog\MediaChangeLog::class);
123 parent::__construct($id, $chunk_size);
127 /** Behavior switch for JSON::decode() */
128 define('JSON_LOOSE_TYPE', 16);
130 /** Behavior switch for JSON::decode() */
131 define('JSON_STRICT_TYPE', 0);
134 * Encode/Decode JSON
135 * @deprecated 2018-07-27
137 class JSON
139 protected $use = 0;
142 * @param int $use JSON_*_TYPE flag
143 * @deprecated 2018-07-27
145 public function __construct($use = JSON_STRICT_TYPE)
147 $this->use = $use;
151 * Encode given structure to JSON
153 * @param mixed $var
154 * @return string
155 * @deprecated 2018-07-27
157 public function encode($var)
159 dbg_deprecated('json_encode');
160 return json_encode($var);
164 * Alias for encode()
165 * @param $var
166 * @return string
167 * @deprecated 2018-07-27
169 public function enc($var) {
170 return $this->encode($var);
174 * Decode given string from JSON
176 * @param string $str
177 * @return mixed
178 * @deprecated 2018-07-27
180 public function decode($str)
182 dbg_deprecated('json_encode');
183 return json_decode($str, ($this->use == JSON_LOOSE_TYPE));
187 * Alias for decode
189 * @param $str
190 * @return mixed
191 * @deprecated 2018-07-27
193 public function dec($str) {
194 return $this->decode($str);
199 * @inheritdoc
200 * @deprecated 2019-02-19
202 class Input extends \dokuwiki\Input\Input {
204 * @inheritdoc
205 * @deprecated 2019-02-19
207 public function __construct()
209 dbg_deprecated(\dokuwiki\Input\Input::class);
210 parent::__construct();
215 * @inheritdoc
216 * @deprecated 2019-02-19
218 class PostInput extends \dokuwiki\Input\Post {
220 * @inheritdoc
221 * @deprecated 2019-02-19
223 public function __construct()
225 dbg_deprecated(\dokuwiki\Input\Post::class);
226 parent::__construct();
231 * @inheritdoc
232 * @deprecated 2019-02-19
234 class GetInput extends \dokuwiki\Input\Get {
236 * @inheritdoc
237 * @deprecated 2019-02-19
239 public function __construct()
241 dbg_deprecated(\dokuwiki\Input\Get::class);
242 parent::__construct();
247 * @inheritdoc
248 * @deprecated 2019-02-19
250 class ServerInput extends \dokuwiki\Input\Server {
252 * @inheritdoc
253 * @deprecated 2019-02-19
255 public function __construct()
257 dbg_deprecated(\dokuwiki\Input\Server::class);
258 parent::__construct();
263 * @inheritdoc
264 * @deprecated 2019-03-06
266 class PassHash extends \dokuwiki\PassHash {
268 * @inheritdoc
269 * @deprecated 2019-03-06
271 public function __construct()
273 dbg_deprecated(\dokuwiki\PassHash::class);
278 * @deprecated since 2019-03-17 use \dokuwiki\HTTP\HTTPClientException instead!
280 class HTTPClientException extends \dokuwiki\HTTP\HTTPClientException {
283 * @inheritdoc
284 * @deprecated 2019-03-17
286 public function __construct($message = '', $code = 0, $previous = null)
288 DebugHelper::dbgDeprecatedFunction(dokuwiki\HTTP\HTTPClientException::class);
289 parent::__construct($message, $code, $previous);
294 * @deprecated since 2019-03-17 use \dokuwiki\HTTP\HTTPClient instead!
296 class HTTPClient extends \dokuwiki\HTTP\HTTPClient {
299 * @inheritdoc
300 * @deprecated 2019-03-17
302 public function __construct()
304 DebugHelper::dbgDeprecatedFunction(dokuwiki\HTTP\HTTPClient::class);
305 parent::__construct();
310 * @deprecated since 2019-03-17 use \dokuwiki\HTTP\DokuHTTPClient instead!
312 class DokuHTTPClient extends \dokuwiki\HTTP\DokuHTTPClient
316 * @inheritdoc
317 * @deprecated 2019-03-17
319 public function __construct()
321 DebugHelper::dbgDeprecatedFunction(dokuwiki\HTTP\DokuHTTPClient::class);
322 parent::__construct();
327 * function wrapper to process (create, trigger and destroy) an event
329 * @param string $name name for the event
330 * @param mixed $data event data
331 * @param callback $action (optional, default=NULL) default action, a php callback function
332 * @param bool $canPreventDefault (optional, default=true) can hooks prevent the default action
334 * @return mixed the event results value after all event processing is complete
335 * by default this is the return value of the default action however
336 * it can be set or modified by event handler hooks
337 * @deprecated 2018-06-15
339 function trigger_event($name, &$data, $action=null, $canPreventDefault=true) {
340 dbg_deprecated('\dokuwiki\Extension\Event::createAndTrigger');
341 return \dokuwiki\Extension\Event::createAndTrigger($name, $data, $action, $canPreventDefault);
345 * @inheritdoc
346 * @deprecated 2018-06-15
348 class Doku_Plugin_Controller extends \dokuwiki\Extension\PluginController {
349 /** @inheritdoc */
350 public function __construct()
352 dbg_deprecated(\dokuwiki\Extension\PluginController::class);
353 parent::__construct();
359 * Class for handling (email) subscriptions
361 * @author Adrian Lang <lang@cosmocode.de>
362 * @author Andreas Gohr <andi@splitbrain.org>
363 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
365 * @deprecated 2019-04-22 Use the classes in the \dokuwiki\Subscriptions namespace instead!
367 class Subscription {
370 * Check if subscription system is enabled
372 * @return bool
374 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::isenabled
376 public function isenabled() {
377 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::isenabled');
378 $subscriberManager = new SubscriberManager();
379 return $subscriberManager->isenabled();
383 * Recursively search for matching subscriptions
385 * This function searches all relevant subscription files for a page or
386 * namespace.
388 * @author Adrian Lang <lang@cosmocode.de>
390 * @param string $page The target object’s (namespace or page) id
391 * @param string|array $user
392 * @param string|array $style
393 * @param string|array $data
394 * @return array
396 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::subscribers
398 public function subscribers($page, $user = null, $style = null, $data = null) {
399 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::subscribers');
400 $manager = new SubscriberManager();
401 return $manager->subscribers($page, $user, $style, $data);
405 * Adds a new subscription for the given page or namespace
407 * This will automatically overwrite any existent subscription for the given user on this
408 * *exact* page or namespace. It will *not* modify any subscription that may exist in higher namespaces.
410 * @param string $id The target page or namespace, specified by id; Namespaces
411 * are identified by appending a colon.
412 * @param string $user
413 * @param string $style
414 * @param string $data
415 * @throws Exception when user or style is empty
416 * @return bool
418 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::add
420 public function add($id, $user, $style, $data = '') {
421 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::add');
422 $manager = new SubscriberManager();
423 return $manager->add($id, $user, $style, $data);
427 * Removes a subscription for the given page or namespace
429 * This removes all subscriptions matching the given criteria on the given page or
430 * namespace. It will *not* modify any subscriptions that may exist in higher
431 * namespaces.
433 * @param string $id The target object’s (namespace or page) id
434 * @param string|array $user
435 * @param string|array $style
436 * @param string|array $data
437 * @return bool
439 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::remove
441 public function remove($id, $user = null, $style = null, $data = null) {
442 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::remove');
443 $manager = new SubscriberManager();
444 return $manager->remove($id, $user, $style, $data);
448 * Get data for $INFO['subscribed']
450 * $INFO['subscribed'] is either false if no subscription for the current page
451 * and user is in effect. Else it contains an array of arrays with the fields
452 * “target”, “style”, and optionally “data”.
454 * @param string $id Page ID, defaults to global $ID
455 * @param string $user User, defaults to $_SERVER['REMOTE_USER']
456 * @return array|false
457 * @author Adrian Lang <lang@cosmocode.de>
459 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::userSubscription
461 public function user_subscription($id = '', $user = '') {
462 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::userSubscription');
463 $manager = new SubscriberManager();
464 return $manager->userSubscription($id, $user);
468 * Send digest and list subscriptions
470 * This sends mails to all subscribers that have a subscription for namespaces above
471 * the given page if the needed $conf['subscribe_time'] has passed already.
473 * This function is called form lib/exe/indexer.php
475 * @param string $page
476 * @return int number of sent mails
478 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\BulkSubscriptionSender::sendBulk
480 public function send_bulk($page) {
481 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\BulkSubscriptionSender::sendBulk');
482 $subscriptionSender = new BulkSubscriptionSender();
483 return $subscriptionSender->sendBulk($page);
487 * Send the diff for some page change
489 * @param string $subscriber_mail The target mail address
490 * @param string $template Mail template ('subscr_digest', 'subscr_single', 'mailtext', ...)
491 * @param string $id Page for which the notification is
492 * @param int|null $rev Old revision if any
493 * @param string $summary Change summary if any
494 * @return bool true if successfully sent
496 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\PageSubscriptionSender::sendPageDiff
498 public function send_diff($subscriber_mail, $template, $id, $rev = null, $summary = '') {
499 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\PageSubscriptionSender::sendPageDiff');
500 $subscriptionSender = new PageSubscriptionSender();
501 return $subscriptionSender->sendPageDiff($subscriber_mail, $template, $id, $rev, $summary);
505 * Send the diff for some media change
507 * @fixme this should embed thumbnails of images in HTML version
509 * @param string $subscriber_mail The target mail address
510 * @param string $template Mail template ('uploadmail', ...)
511 * @param string $id Media file for which the notification is
512 * @param int|bool $rev Old revision if any
514 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\MediaSubscriptionSender::sendMediaDiff
516 public function send_media_diff($subscriber_mail, $template, $id, $rev = false) {
517 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\MediaSubscriptionSender::sendMediaDiff');
518 $subscriptionSender = new MediaSubscriptionSender();
519 return $subscriptionSender->sendMediaDiff($subscriber_mail, $template, $id, $rev);
523 * Send a notify mail on new registration
525 * @author Andreas Gohr <andi@splitbrain.org>
527 * @param string $login login name of the new user
528 * @param string $fullname full name of the new user
529 * @param string $email email address of the new user
530 * @return bool true if a mail was sent
532 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\RegistrationSubscriptionSender::sendRegister
534 public function send_register($login, $fullname, $email) {
535 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\RegistrationSubscriptionSender::sendRegister');
536 $subscriptionSender = new RegistrationSubscriptionSender();
537 return $subscriptionSender->sendRegister($login, $fullname, $email);
542 * Default callback for COMMON_NOTIFY_ADDRESSLIST
544 * Aggregates all email addresses of user who have subscribed the given page with 'every' style
546 * @author Steven Danz <steven-danz@kc.rr.com>
547 * @author Adrian Lang <lang@cosmocode.de>
549 * @todo move the whole functionality into this class, trigger SUBSCRIPTION_NOTIFY_ADDRESSLIST instead,
550 * use an array for the addresses within it
552 * @param array &$data Containing the entries:
553 * - $id (the page id),
554 * - $self (whether the author should be notified,
555 * - $addresslist (current email address list)
556 * - $replacements (array of additional string substitutions, @KEY@ to be replaced by value)
558 * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::notifyAddresses
560 public function notifyaddresses(&$data) {
561 DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::notifyAddresses');
562 $manager = new SubscriberManager();
563 $manager->notifyAddresses($data);
568 * @deprecated 2019-12-29 use \dokuwiki\Search\Indexer
570 class Doku_Indexer extends \dokuwiki\Search\Indexer {};