[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ -> deprecated.php (source)

   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   */
   6  
   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;
  13  
  14  /**
  15   * @inheritdoc
  16   * @deprecated 2018-05-07
  17   */
  18  class RemoteAccessDeniedException extends \dokuwiki\Remote\AccessDeniedException
  19  {
  20      /** @inheritdoc */
  21      public function __construct($message = "", $code = 0, Throwable $previous = null)
  22      {
  23          dbg_deprecated(\dokuwiki\Remote\AccessDeniedException::class);
  24          parent::__construct($message, $code, $previous);
  25      }
  26  
  27  }
  28  
  29  /**
  30   * @inheritdoc
  31   * @deprecated 2018-05-07
  32   */
  33  class RemoteException extends \dokuwiki\Remote\RemoteException
  34  {
  35      /** @inheritdoc */
  36      public function __construct($message = "", $code = 0, Throwable $previous = null)
  37      {
  38          dbg_deprecated(\dokuwiki\Remote\RemoteException::class);
  39          parent::__construct($message, $code, $previous);
  40      }
  41  
  42  }
  43  
  44  /**
  45   * Escapes regex characters other than (, ) and /
  46   *
  47   * @param string $str
  48   * @return string
  49   * @deprecated 2018-05-04
  50   */
  51  function Doku_Lexer_Escape($str)
  52  {
  53      dbg_deprecated('\\dokuwiki\\Parsing\\Lexer\\Lexer::escape()');
  54      return \dokuwiki\Parsing\Lexer\Lexer::escape($str);
  55  }
  56  
  57  /**
  58   * @inheritdoc
  59   * @deprecated 2018-06-01
  60   */
  61  class setting extends \dokuwiki\plugin\config\core\Setting\Setting
  62  {
  63      /** @inheritdoc */
  64      public function __construct($key, array $params = null)
  65      {
  66          dbg_deprecated(\dokuwiki\plugin\config\core\Setting\Setting::class);
  67          parent::__construct($key, $params);
  68      }
  69  }
  70  
  71  /**
  72   * @inheritdoc
  73   * @deprecated 2018-06-01
  74   */
  75  class setting_authtype extends \dokuwiki\plugin\config\core\Setting\SettingAuthtype
  76  {
  77      /** @inheritdoc */
  78      public function __construct($key, array $params = null)
  79      {
  80          dbg_deprecated(\dokuwiki\plugin\config\core\Setting\SettingAuthtype::class);
  81          parent::__construct($key, $params);
  82      }
  83  }
  84  
  85  /**
  86   * @inheritdoc
  87   * @deprecated 2018-06-01
  88   */
  89  class setting_string extends \dokuwiki\plugin\config\core\Setting\SettingString
  90  {
  91      /** @inheritdoc */
  92      public function __construct($key, array $params = null)
  93      {
  94          dbg_deprecated(\dokuwiki\plugin\config\core\Setting\SettingString::class);
  95          parent::__construct($key, $params);
  96      }
  97  }
  98  
  99  /**
 100   * @inheritdoc
 101   * @deprecated 2018-06-15
 102   */
 103  class PageChangelog extends \dokuwiki\ChangeLog\PageChangeLog
 104  {
 105      /** @inheritdoc */
 106      public function __construct($id, $chunk_size = 8192)
 107      {
 108          dbg_deprecated(\dokuwiki\ChangeLog\PageChangeLog::class);
 109          parent::__construct($id, $chunk_size);
 110      }
 111  }
 112  
 113  /**
 114   * @inheritdoc
 115   * @deprecated 2018-06-15
 116   */
 117  class MediaChangelog extends \dokuwiki\ChangeLog\MediaChangeLog
 118  {
 119      /** @inheritdoc */
 120      public function __construct($id, $chunk_size = 8192)
 121      {
 122          dbg_deprecated(\dokuwiki\ChangeLog\MediaChangeLog::class);
 123          parent::__construct($id, $chunk_size);
 124      }
 125  }
 126  
 127  /** Behavior switch for JSON::decode() */
 128  define('JSON_LOOSE_TYPE', 16);
 129  
 130  /** Behavior switch for JSON::decode() */
 131  define('JSON_STRICT_TYPE', 0);
 132  
 133  /**
 134   * Encode/Decode JSON
 135   * @deprecated 2018-07-27
 136   */
 137  class JSON
 138  {
 139      protected $use = 0;
 140  
 141      /**
 142       * @param int $use JSON_*_TYPE flag
 143       * @deprecated  2018-07-27
 144       */
 145      public function __construct($use = JSON_STRICT_TYPE)
 146      {
 147          $this->use = $use;
 148      }
 149  
 150      /**
 151       * Encode given structure to JSON
 152       *
 153       * @param mixed $var
 154       * @return string
 155       * @deprecated  2018-07-27
 156       */
 157      public function encode($var)
 158      {
 159          dbg_deprecated('json_encode');
 160          return json_encode($var);
 161      }
 162  
 163      /**
 164       * Alias for encode()
 165       * @param $var
 166       * @return string
 167       * @deprecated  2018-07-27
 168       */
 169      public function enc($var) {
 170          return $this->encode($var);
 171      }
 172  
 173      /**
 174       * Decode given string from JSON
 175       *
 176       * @param string $str
 177       * @return mixed
 178       * @deprecated  2018-07-27
 179       */
 180      public function decode($str)
 181      {
 182          dbg_deprecated('json_encode');
 183          return json_decode($str, ($this->use == JSON_LOOSE_TYPE));
 184      }
 185  
 186      /**
 187       * Alias for decode
 188       *
 189       * @param $str
 190       * @return mixed
 191       * @deprecated  2018-07-27
 192       */
 193      public function dec($str) {
 194          return $this->decode($str);
 195      }
 196  }
 197  
 198  /**
 199   * @inheritdoc
 200   * @deprecated 2019-02-19
 201   */
 202  class Input extends \dokuwiki\Input\Input {
 203      /**
 204       * @inheritdoc
 205       * @deprecated 2019-02-19
 206       */
 207      public function __construct()
 208      {
 209          dbg_deprecated(\dokuwiki\Input\Input::class);
 210          parent::__construct();
 211      }
 212  }
 213  
 214  /**
 215   * @inheritdoc
 216   * @deprecated 2019-02-19
 217   */
 218  class PostInput extends \dokuwiki\Input\Post {
 219      /**
 220       * @inheritdoc
 221       * @deprecated 2019-02-19
 222       */
 223      public function __construct()
 224      {
 225          dbg_deprecated(\dokuwiki\Input\Post::class);
 226          parent::__construct();
 227      }
 228  }
 229  
 230  /**
 231   * @inheritdoc
 232   * @deprecated 2019-02-19
 233   */
 234  class GetInput extends \dokuwiki\Input\Get {
 235      /**
 236       * @inheritdoc
 237       * @deprecated 2019-02-19
 238       */
 239      public function __construct()
 240      {
 241          dbg_deprecated(\dokuwiki\Input\Get::class);
 242          parent::__construct();
 243      }
 244  }
 245  
 246  /**
 247   * @inheritdoc
 248   * @deprecated 2019-02-19
 249   */
 250  class ServerInput extends \dokuwiki\Input\Server {
 251      /**
 252       * @inheritdoc
 253       * @deprecated 2019-02-19
 254       */
 255      public function __construct()
 256      {
 257          dbg_deprecated(\dokuwiki\Input\Server::class);
 258          parent::__construct();
 259      }
 260  }
 261  
 262  /**
 263   * @inheritdoc
 264   * @deprecated 2019-03-06
 265   */
 266  class PassHash extends \dokuwiki\PassHash {
 267      /**
 268       * @inheritdoc
 269       * @deprecated 2019-03-06
 270       */
 271      public function __construct()
 272      {
 273          dbg_deprecated(\dokuwiki\PassHash::class);
 274      }
 275  }
 276  
 277  /**
 278   * @deprecated since 2019-03-17 use \dokuwiki\HTTP\HTTPClientException instead!
 279   */
 280  class HTTPClientException extends \dokuwiki\HTTP\HTTPClientException {
 281  
 282      /**
 283       * @inheritdoc
 284       * @deprecated 2019-03-17
 285       */
 286      public function __construct($message = '', $code = 0, $previous = null)
 287      {
 288          DebugHelper::dbgDeprecatedFunction(dokuwiki\HTTP\HTTPClientException::class);
 289          parent::__construct($message, $code, $previous);
 290      }
 291  }
 292  
 293  /**
 294   * @deprecated since 2019-03-17 use \dokuwiki\HTTP\HTTPClient instead!
 295   */
 296  class HTTPClient extends \dokuwiki\HTTP\HTTPClient {
 297  
 298      /**
 299       * @inheritdoc
 300       * @deprecated 2019-03-17
 301       */
 302      public function __construct()
 303      {
 304          DebugHelper::dbgDeprecatedFunction(dokuwiki\HTTP\HTTPClient::class);
 305          parent::__construct();
 306      }
 307  }
 308  
 309  /**
 310   * @deprecated since 2019-03-17 use \dokuwiki\HTTP\DokuHTTPClient instead!
 311   */
 312  class DokuHTTPClient extends \dokuwiki\HTTP\DokuHTTPClient
 313  {
 314  
 315      /**
 316       * @inheritdoc
 317       * @deprecated 2019-03-17
 318       */
 319      public function __construct()
 320      {
 321          DebugHelper::dbgDeprecatedFunction(dokuwiki\HTTP\DokuHTTPClient::class);
 322          parent::__construct();
 323      }
 324  }
 325  
 326  /**
 327   * function wrapper to process (create, trigger and destroy) an event
 328   *
 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
 333   *
 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
 338   */
 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);
 342  }
 343  
 344  /**
 345   * @inheritdoc
 346   * @deprecated 2018-06-15
 347   */
 348  class Doku_Plugin_Controller extends \dokuwiki\Extension\PluginController {
 349      /** @inheritdoc */
 350      public function __construct()
 351      {
 352          dbg_deprecated(\dokuwiki\Extension\PluginController::class);
 353          parent::__construct();
 354      }
 355  }
 356  
 357  
 358  /**
 359   * Class for handling (email) subscriptions
 360   *
 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)
 364   *
 365   * @deprecated 2019-04-22 Use the classes in the \dokuwiki\Subscriptions namespace instead!
 366   */
 367  class Subscription {
 368  
 369      /**
 370       * Check if subscription system is enabled
 371       *
 372       * @return bool
 373       *
 374       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::isenabled
 375       */
 376      public function isenabled() {
 377          DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::isenabled');
 378          $subscriberManager = new SubscriberManager();
 379          return $subscriberManager->isenabled();
 380      }
 381  
 382      /**
 383       * Recursively search for matching subscriptions
 384       *
 385       * This function searches all relevant subscription files for a page or
 386       * namespace.
 387       *
 388       * @author Adrian Lang <lang@cosmocode.de>
 389       *
 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
 395       *
 396       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::subscribers
 397       */
 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);
 402      }
 403  
 404      /**
 405       * Adds a new subscription for the given page or namespace
 406       *
 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.
 409       *
 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
 417       *
 418       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::add
 419       */
 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);
 424      }
 425  
 426      /**
 427       * Removes a subscription for the given page or namespace
 428       *
 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.
 432       *
 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
 438       *
 439       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::remove
 440       */
 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);
 445      }
 446  
 447      /**
 448       * Get data for $INFO['subscribed']
 449       *
 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”.
 453       *
 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>
 458       *
 459       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::userSubscription
 460       */
 461      public function user_subscription($id = '', $user = '') {
 462          DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::userSubscription');
 463          $manager = new SubscriberManager();
 464          return $manager->userSubscription($id, $user);
 465      }
 466  
 467      /**
 468       * Send digest and list subscriptions
 469       *
 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.
 472       *
 473       * This function is called form lib/exe/indexer.php
 474       *
 475       * @param string $page
 476       * @return int number of sent mails
 477       *
 478       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\BulkSubscriptionSender::sendBulk
 479       */
 480      public function send_bulk($page) {
 481          DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\BulkSubscriptionSender::sendBulk');
 482          $subscriptionSender = new BulkSubscriptionSender();
 483          return $subscriptionSender->sendBulk($page);
 484      }
 485  
 486      /**
 487       * Send the diff for some page change
 488       *
 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
 495       *
 496       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\PageSubscriptionSender::sendPageDiff
 497       */
 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);
 502      }
 503  
 504      /**
 505       * Send the diff for some media change
 506       *
 507       * @fixme this should embed thumbnails of images in HTML version
 508       *
 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
 513       *
 514       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\MediaSubscriptionSender::sendMediaDiff
 515       */
 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);
 520      }
 521  
 522      /**
 523       * Send a notify mail on new registration
 524       *
 525       * @author Andreas Gohr <andi@splitbrain.org>
 526       *
 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
 531       *
 532       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\RegistrationSubscriptionSender::sendRegister
 533       */
 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);
 538      }
 539  
 540  
 541      /**
 542       * Default callback for COMMON_NOTIFY_ADDRESSLIST
 543       *
 544       * Aggregates all email addresses of user who have subscribed the given page with 'every' style
 545       *
 546       * @author Steven Danz <steven-danz@kc.rr.com>
 547       * @author Adrian Lang <lang@cosmocode.de>
 548       *
 549       * @todo move the whole functionality into this class, trigger SUBSCRIPTION_NOTIFY_ADDRESSLIST instead,
 550       *       use an array for the addresses within it
 551       *
 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)
 557       *
 558       * @deprecated 2019-04-20 \dokuwiki\Subscriptions\SubscriberManager::notifyAddresses
 559       */
 560      public function notifyaddresses(&$data) {
 561          DebugHelper::dbgDeprecatedFunction('\dokuwiki\Subscriptions\SubscriberManager::notifyAddresses');
 562          $manager = new SubscriberManager();
 563          $manager->notifyAddresses($data);
 564      }
 565  }