1<?php 2// phpcs:ignoreFile -- this file violates PSR-12 by definition 3/** 4 * These classes and functions are deprecated and will be removed in future releases 5 * 6 * Note: when adding to this file, please also add appropriate actions to _test/rector.php 7 */ 8 9use dokuwiki\Debug\DebugHelper; 10use dokuwiki\MailUtils; 11 12/** 13 * @deprecated since 2021-11-11 use \dokuwiki\Remote\IXR\Client instead! 14 */ 15class IXR_Client extends \dokuwiki\Remote\IXR\Client 16{ 17 /** 18 * @inheritdoc 19 * @deprecated 2021-11-11 20 */ 21 public function __construct($server, $path = false, $port = 80, $timeout = 15, $timeout_io = null) 22 { 23 DebugHelper::dbgDeprecatedFunction(dokuwiki\Remote\IXR\Client::class); 24 parent::__construct($server, $path, $port, $timeout, $timeout_io); 25 } 26} 27/** 28 * @deprecated since 2021-11-11 use \IXR\Client\ClientMulticall instead! 29 */ 30class IXR_ClientMulticall extends \IXR\Client\ClientMulticall 31{ 32 /** 33 * @inheritdoc 34 * @deprecated 2021-11-11 35 */ 36 public function __construct($server, $path = false, $port = 80) 37 { 38 DebugHelper::dbgDeprecatedFunction(IXR\Client\ClientMulticall::class); 39 parent::__construct($server, $path, $port); 40 } 41} 42/** 43 * @deprecated since 2021-11-11 use \IXR\Server\Server instead! 44 */ 45class IXR_Server extends \IXR\Server\Server 46{ 47 /** 48 * @inheritdoc 49 * @deprecated 2021-11-11 50 */ 51 public function __construct($callbacks = false, $data = false, $wait = false) 52 { 53 DebugHelper::dbgDeprecatedFunction(IXR\Server\Server::class); 54 parent::__construct($callbacks, $data, $wait); 55 } 56} 57/** 58 * @deprecated since 2021-11-11 use \IXR\Server\IntrospectionServer instead! 59 */ 60class IXR_IntrospectionServer extends \IXR\Server\IntrospectionServer 61{ 62 /** 63 * @inheritdoc 64 * @deprecated 2021-11-11 65 */ 66 public function __construct() 67 { 68 DebugHelper::dbgDeprecatedFunction(IXR\Server\IntrospectionServer::class); 69 parent::__construct(); 70 } 71} 72/** 73 * @deprecated since 2021-11-11 use \IXR\Request\Request instead! 74 */ 75class IXR_Request extends \IXR\Request\Request 76{ 77 /** 78 * @inheritdoc 79 * @deprecated 2021-11-11 80 */ 81 public function __construct($method, $args) 82 { 83 DebugHelper::dbgDeprecatedFunction(IXR\Request\Request::class); 84 parent::__construct($method, $args); 85 } 86} 87/** 88 * @deprecated since 2021-11-11 use \IXR\Message\Message instead! 89 */ 90class IXR_Message extends IXR\Message\Message 91{ 92 /** 93 * @inheritdoc 94 * @deprecated 2021-11-11 95 */ 96 public function __construct($message) 97 { 98 DebugHelper::dbgDeprecatedFunction(IXR\Message\Message::class); 99 parent::__construct($message); 100 } 101} 102/** 103 * @deprecated since 2021-11-11 use \IXR\Message\Error instead! 104 */ 105class IXR_Error extends \IXR\Message\Error 106{ 107 /** 108 * @inheritdoc 109 * @deprecated 2021-11-11 110 */ 111 public function __construct($code, $message) 112 { 113 DebugHelper::dbgDeprecatedFunction(IXR\Message\Error::class); 114 parent::__construct($code, $message); 115 } 116} 117/** 118 * @deprecated since 2021-11-11 use \IXR\DataType\Date instead! 119 */ 120class IXR_Date extends \IXR\DataType\Date 121{ 122 /** 123 * @inheritdoc 124 * @deprecated 2021-11-11 125 */ 126 public function __construct($time) 127 { 128 DebugHelper::dbgDeprecatedFunction(IXR\DataType\Date::class); 129 parent::__construct($time); 130 } 131} 132/** 133 * @deprecated since 2021-11-11 use \IXR\DataType\Base64 instead! 134 */ 135class IXR_Base64 extends \IXR\DataType\Base64 136{ 137 /** 138 * @inheritdoc 139 * @deprecated 2021-11-11 140 */ 141 public function __construct($data) 142 { 143 DebugHelper::dbgDeprecatedFunction(IXR\DataType\Base64::class); 144 parent::__construct($data); 145 } 146} 147/** 148 * @deprecated since 2021-11-11 use \IXR\DataType\Value instead! 149 */ 150class IXR_Value extends \IXR\DataType\Value 151{ 152 /** 153 * @inheritdoc 154 * @deprecated 2021-11-11 155 */ 156 public function __construct($data, $type = null) 157 { 158 DebugHelper::dbgDeprecatedFunction(IXR\DataType\Value::class); 159 parent::__construct($data, $type); 160 } 161} 162 163/** 164 * returns all available parser syntax modes in correct order 165 * 166 * @return array[] with for each plugin the array('sort' => sortnumber, 'mode' => mode string, 'obj' => plugin object) 167 * @author Andreas Gohr <andi@splitbrain.org> 168 * @deprecated 2026-04-16 use \dokuwiki\Parsing\ModeRegistry::getModes() instead 169 */ 170function p_get_parsermodes() 171{ 172 global $conf; 173 DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ModeRegistry::class . '::getModes()'); 174 return (new \dokuwiki\Parsing\ModeRegistry($conf['syntax']))->getModes(); 175} 176 177/** 178 * Callback function for usort 179 * 180 * @param array $a 181 * @param array $b 182 * @return int $a is lower/equal/higher than $b 183 * @author Andreas Gohr <andi@splitbrain.org> 184 * @deprecated 2026-04-16 use \dokuwiki\Parsing\ModeRegistry::sortModes() instead 185 */ 186function p_sort_modes($a, $b) 187{ 188 DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ModeRegistry::class . '::sortModes()'); 189 return \dokuwiki\Parsing\ModeRegistry::sortModes($a, $b); 190} 191 192/** 193 * print a newline terminated string 194 * 195 * You can give an indention as optional parameter 196 * 197 * @author Andreas Gohr <andi@splitbrain.org> 198 * 199 * @param string $string line of text 200 * @param int $indent number of spaces indention 201 * @deprecated 2023-08-31 use echo instead 202 */ 203function ptln($string, $indent = 0) 204{ 205 DebugHelper::dbgDeprecatedFunction('echo'); 206 echo str_repeat(' ', $indent) . "$string\n"; 207} 208 209/** 210 * Adds/updates the search index for the given page 211 * 212 * Locking is handled internally. 213 * 214 * @param string $page name of the page to index 215 * @param boolean $verbose print status messages 216 * @param boolean $force force reindexing even when the index is up to date 217 * @return string|boolean the function completed successfully 218 * 219 * @deprecated 2026-04-07 use Indexer class instead 220 */ 221function idx_addPage($page, $verbose = false, $force = false) 222{ 223 DebugHelper::dbgDeprecatedFunction('dokuwiki\Search\Indexer::addPage()'); 224 try { 225 (new dokuwiki\Search\Indexer())->addPage($page, $force); 226 return true; 227 } catch (\dokuwiki\Search\Exception\SearchException $e) { 228 return false; 229 } 230} 231 232/** 233 * Create an instance of the indexer. 234 * 235 * Returns a {@see dokuwiki\Search\LegacyIndexer} that preserves the legacy 236 * Doku_Indexer return contract (true|string on success/failure for the four 237 * mutating methods) so existing plugins keep working without try/catch. 238 * 239 * @return dokuwiki\Search\LegacyIndexer 240 * 241 * @deprecated 2026-04-07 use dokuwiki\Search\Indexer directly 242 */ 243function idx_get_indexer() 244{ 245 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Indexer::class); 246 return new dokuwiki\Search\LegacyIndexer(); 247} 248 249/** 250 * Read the list of words in an index (if it exists). 251 * 252 * @param string $idx 253 * @param string $suffix 254 * @return array 255 * 256 * @deprecated 2026-04-07 use Index classes directly 257 */ 258function idx_getIndex($idx, $suffix) 259{ 260 DebugHelper::dbgDeprecatedFunction('Index classes'); 261 global $conf; 262 $fn = $conf['indexdir'] . '/' . $idx . $suffix . '.idx'; 263 if (!file_exists($fn)) return []; 264 return file($fn); 265} 266 267/** 268 * Find tokens in the fulltext index 269 * 270 * @param array $words list of words to search for 271 * @return array list of pages found 272 * 273 * @deprecated 2026-04-07 use CollectionSearch on PageFulltextCollection instead 274 */ 275function idx_lookup(&$words) 276{ 277 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Collection\CollectionSearch::class); 278 return (new dokuwiki\Search\LegacyIndexer())->lookup($words); 279} 280 281/** 282 * Get the list of lengths indexed in the wiki. 283 * 284 * @return array 285 * 286 * @deprecated 2026-04-07 use PageFulltextCollection::getTokenIndexMaximum() instead 287 */ 288function idx_listIndexLengths() 289{ 290 DebugHelper::dbgDeprecatedFunction('PageFulltextCollection::getTokenIndexMaximum()'); 291 global $conf; 292 $idx = []; 293 $files = glob($conf['indexdir'] . '/i*.idx'); 294 if ($files) { 295 foreach ($files as $file) { 296 if (preg_match('/i(\d+)\.idx$/', $file, $match)) { 297 $idx[] = (int)$match[1]; 298 } 299 } 300 sort($idx); 301 } 302 return $idx; 303} 304 305/** 306 * Get the word lengths that have been indexed. 307 * 308 * @param array|int $filter 309 * @return array 310 * 311 * @deprecated 2026-04-07 use PageFulltextCollection::getTokenIndexMaximum() instead 312 */ 313function idx_indexLengths($filter) 314{ 315 DebugHelper::dbgDeprecatedFunction('PageFulltextCollection::getTokenIndexMaximum()'); 316 global $conf; 317 $idx = []; 318 if (is_array($filter)) { 319 $path = $conf['indexdir'] . "/i"; 320 foreach (array_keys($filter) as $key) { 321 if (file_exists($path . $key . '.idx')) 322 $idx[] = $key; 323 } 324 } else { 325 $lengths = idx_listIndexLengths(); 326 foreach ($lengths as $length) { 327 if ((int)$length >= (int)$filter) 328 $idx[] = $length; 329 } 330 } 331 return $idx; 332} 333 334/** 335 * Execute a fulltext search 336 * 337 * @param string $query search query 338 * @param array $highlight words to highlight 339 * @param string|null $sort sorting order 340 * @param int|string|null $after only show results after this date 341 * @param int|string|null $before only show results before this date 342 * @return array 343 * 344 * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::pageSearch() instead 345 */ 346function ft_pageSearch($query, &$highlight, $sort = null, $after = null, $before = null) 347{ 348 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::pageSearch()'); 349 if (!is_array($highlight)) $highlight = []; 350 return (new dokuwiki\Search\FulltextSearch())->pageSearch($query, $highlight, $sort, $after, $before); 351} 352 353/** 354 * Returns the backlinks for a given page 355 * 356 * @param string $id page id 357 * @param bool $ignore_perms 358 * @return string[] 359 * 360 * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::backlinks() instead 361 */ 362function ft_backlinks($id, $ignore_perms = false) 363{ 364 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::backlinks()'); 365 return (new dokuwiki\Search\MetadataSearch())->backlinks($id, $ignore_perms); 366} 367 368/** 369 * Returns the pages that use a given media file 370 * 371 * @param string $id media id 372 * @param bool $ignore_perms 373 * @return string[] 374 * 375 * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::mediause() instead 376 */ 377function ft_mediause($id, $ignore_perms = false) 378{ 379 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::mediause()'); 380 return (new dokuwiki\Search\MetadataSearch())->mediause($id, $ignore_perms); 381} 382 383/** 384 * Quicksearch for pagenames 385 * 386 * @param string $id page id 387 * @param bool $in_ns match namespace 388 * @param bool $in_title search in title 389 * @param int|string|null $after 390 * @param int|string|null $before 391 * @return string[] 392 * 393 * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::pageLookup() instead 394 */ 395function ft_pageLookup($id, $in_ns = false, $in_title = false, $after = null, $before = null) 396{ 397 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::pageLookup()'); 398 return (new dokuwiki\Search\MetadataSearch())->pageLookup($id, $in_ns, $in_title, $after, $before); 399} 400 401/** 402 * Creates a snippet extract 403 * 404 * @param string $id page id 405 * @param array $highlight words to highlight 406 * @return string 407 * 408 * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::snippet() instead 409 */ 410function ft_snippet($id, $highlight) 411{ 412 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::snippet()'); 413 return (new dokuwiki\Search\FulltextSearch())->snippet($id, $highlight); 414} 415 416/** 417 * Sort pages based on their namespace level first, then alphabetically 418 * 419 * @param string $a 420 * @param string $b 421 * @return int 422 * 423 * @deprecated 2026-04-07 use Utf8\Sort functions directly 424 */ 425function ft_pagesorter($a, $b) 426{ 427 DebugHelper::dbgDeprecatedFunction('Utf8\\Sort'); 428 $diff = substr_count($a, ':') - substr_count($b, ':'); 429 return $diff ?: dokuwiki\Utf8\Sort::strcmp($a, $b); 430} 431 432/** 433 * Wrap a search term in regex boundary checks 434 * 435 * @param string $term 436 * @return string 437 * 438 * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::snippetRePreprocess() instead 439 */ 440function ft_snippet_re_preprocess($term) 441{ 442 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::snippetRePreprocess()'); 443 return (new dokuwiki\Search\FulltextSearch())->snippetRePreprocess($term); 444} 445 446/** 447 * Parse a search query into its components 448 * 449 * @param mixed $Indexer ignored (legacy parameter) 450 * @param string $query search query 451 * @return array parsed query structure 452 * 453 * @deprecated 2026-04-07 use dokuwiki\Search\Query\QueryParser::convert() instead 454 */ 455function ft_queryParser($Indexer, $query) 456{ 457 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Query\QueryParser::class . '::convert()'); 458 return (new dokuwiki\Search\Query\QueryParser())->convert($query); 459} 460 461/** 462 * @deprecated 2026-04-16 use \dokuwiki\Parsing\ParserMode\Media::parseMedia() instead 463 */ 464function Doku_Handler_Parse_Media($match) 465{ 466 DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ParserMode\Media::class . '::parseMedia()'); 467 return \dokuwiki\Parsing\ParserMode\Media::parseMedia($match); 468} 469 470/** 471 * @deprecated 2026-05-06 use \dokuwiki\MailUtils::PREG_PATTERN_VALID_EMAIL instead! 472 */ 473if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', MailUtils::PREG_PATTERN_VALID_EMAIL); 474 475/** 476 * @deprecated 2026-05-06 use \dokuwiki\MailUtils::obfuscate() instead! 477 */ 478function obfuscate($email) 479{ 480 DebugHelper::dbgDeprecatedFunction(MailUtils::class . '::obfuscate'); 481 return MailUtils::obfuscate($email); 482} 483 484/** 485 * @deprecated 2026-05-06 use \dokuwiki\MailUtils::isValid() instead! 486 */ 487function mail_isvalid($email) 488{ 489 DebugHelper::dbgDeprecatedFunction(MailUtils::class . '::isValid'); 490 return MailUtils::isValid($email); 491} 492 493/** 494 * @deprecated 2026-05-06 use \dokuwiki\MailUtils::quotedPrintableEncode() instead! 495 */ 496function mail_quotedprintable_encode($sText, $maxlen = 74, $bEmulate_imap_8bit = true) 497{ 498 DebugHelper::dbgDeprecatedFunction(MailUtils::class . '::quotedPrintableEncode'); 499 return MailUtils::quotedPrintableEncode($sText, $maxlen, $bEmulate_imap_8bit); 500} 501