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 DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ModeRegistry::class . '::getModes()'); 173 return \dokuwiki\Parsing\ModeRegistry::getInstance()->getModes(); 174} 175 176/** 177 * Callback function for usort 178 * 179 * @param array $a 180 * @param array $b 181 * @return int $a is lower/equal/higher than $b 182 * @author Andreas Gohr <andi@splitbrain.org> 183 * @deprecated 2026-04-16 use \dokuwiki\Parsing\ModeRegistry::sortModes() instead 184 */ 185function p_sort_modes($a, $b) 186{ 187 DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ModeRegistry::class . '::sortModes()'); 188 return \dokuwiki\Parsing\ModeRegistry::sortModes($a, $b); 189} 190 191/** 192 * print a newline terminated string 193 * 194 * You can give an indention as optional parameter 195 * 196 * @author Andreas Gohr <andi@splitbrain.org> 197 * 198 * @param string $string line of text 199 * @param int $indent number of spaces indention 200 * @deprecated 2023-08-31 use echo instead 201 */ 202function ptln($string, $indent = 0) 203{ 204 DebugHelper::dbgDeprecatedFunction('echo'); 205 echo str_repeat(' ', $indent) . "$string\n"; 206} 207 208/** 209 * Adds/updates the search index for the given page 210 * 211 * Locking is handled internally. 212 * 213 * @param string $page name of the page to index 214 * @param boolean $verbose ignored; status messages are no longer printed 215 * @param boolean $force force reindexing even when the index is up to date 216 * @return boolean true if the page was indexed, false if there was nothing to do or an error occurred 217 * 218 * @deprecated 2026-04-07 use Indexer class instead 219 */ 220function idx_addPage($page, $verbose = false, $force = false) 221{ 222 DebugHelper::dbgDeprecatedFunction('dokuwiki\Search\Indexer::addPage()'); 223 try { 224 return (new dokuwiki\Search\Indexer())->addPage($page, $force); 225 } catch (\dokuwiki\Search\Exception\SearchException $e) { 226 return false; 227 } 228} 229 230/** 231 * Create an instance of the indexer. 232 * 233 * Returns a {@see dokuwiki\Search\LegacyIndexer} that preserves the legacy 234 * Doku_Indexer return contract (true|string on success/failure for the four 235 * mutating methods) so existing plugins keep working without try/catch. 236 * 237 * @return dokuwiki\Search\LegacyIndexer 238 * 239 * @deprecated 2026-04-07 use dokuwiki\Search\Indexer directly 240 */ 241function idx_get_indexer() 242{ 243 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Indexer::class); 244 return new dokuwiki\Search\LegacyIndexer(); 245} 246 247/** 248 * Read the list of words in an index (if it exists). 249 * 250 * @param string $idx 251 * @param string $suffix 252 * @return array 253 * 254 * @deprecated 2026-04-07 use Index classes directly 255 */ 256function idx_getIndex($idx, $suffix) 257{ 258 DebugHelper::dbgDeprecatedFunction('Index classes'); 259 global $conf; 260 $fn = $conf['indexdir'] . '/' . $idx . $suffix . '.idx'; 261 if (!file_exists($fn)) return []; 262 return file($fn); 263} 264 265/** 266 * Find tokens in the fulltext index 267 * 268 * @param array $words list of words to search for 269 * @return array list of pages found 270 * 271 * @deprecated 2026-04-07 use CollectionSearch on PageFulltextCollection instead 272 */ 273function idx_lookup(&$words) 274{ 275 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Collection\CollectionSearch::class); 276 return (new dokuwiki\Search\LegacyIndexer())->lookup($words); 277} 278 279/** 280 * Get the list of lengths indexed in the wiki. 281 * 282 * @return array 283 * 284 * @deprecated 2026-04-07 use PageFulltextCollection::getTokenIndexMaximum() instead 285 */ 286function idx_listIndexLengths() 287{ 288 DebugHelper::dbgDeprecatedFunction('PageFulltextCollection::getTokenIndexMaximum()'); 289 global $conf; 290 $idx = []; 291 $files = glob($conf['indexdir'] . '/i*.idx'); 292 if ($files) { 293 foreach ($files as $file) { 294 if (preg_match('/i(\d+)\.idx$/', $file, $match)) { 295 $idx[] = (int)$match[1]; 296 } 297 } 298 sort($idx); 299 } 300 return $idx; 301} 302 303/** 304 * Get the word lengths that have been indexed. 305 * 306 * @param array|int $filter 307 * @return array 308 * 309 * @deprecated 2026-04-07 use PageFulltextCollection::getTokenIndexMaximum() instead 310 */ 311function idx_indexLengths($filter) 312{ 313 DebugHelper::dbgDeprecatedFunction('PageFulltextCollection::getTokenIndexMaximum()'); 314 global $conf; 315 $idx = []; 316 if (is_array($filter)) { 317 $path = $conf['indexdir'] . "/i"; 318 foreach (array_keys($filter) as $key) { 319 if (file_exists($path . $key . '.idx')) 320 $idx[] = $key; 321 } 322 } else { 323 $lengths = idx_listIndexLengths(); 324 foreach ($lengths as $length) { 325 if ((int)$length >= (int)$filter) 326 $idx[] = $length; 327 } 328 } 329 return $idx; 330} 331 332/** 333 * Execute a fulltext search 334 * 335 * @param string $query search query 336 * @param array $highlight words to highlight 337 * @param string|null $sort sorting order 338 * @param int|string|null $after only show results after this date 339 * @param int|string|null $before only show results before this date 340 * @return array 341 * 342 * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::pageSearch() instead 343 */ 344function ft_pageSearch($query, &$highlight, $sort = null, $after = null, $before = null) 345{ 346 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::pageSearch()'); 347 if (!is_array($highlight)) $highlight = []; 348 return (new dokuwiki\Search\FulltextSearch())->pageSearch($query, $highlight, $sort, $after, $before); 349} 350 351/** 352 * Returns the backlinks for a given page 353 * 354 * @param string $id page id 355 * @param bool $ignore_perms 356 * @return string[] 357 * 358 * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::backlinks() instead 359 */ 360function ft_backlinks($id, $ignore_perms = false) 361{ 362 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::backlinks()'); 363 return (new dokuwiki\Search\MetadataSearch())->backlinks($id, $ignore_perms); 364} 365 366/** 367 * Returns the pages that use a given media file 368 * 369 * @param string $id media id 370 * @param bool $ignore_perms 371 * @return string[] 372 * 373 * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::mediause() instead 374 */ 375function ft_mediause($id, $ignore_perms = false) 376{ 377 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::mediause()'); 378 return (new dokuwiki\Search\MetadataSearch())->mediause($id, $ignore_perms); 379} 380 381/** 382 * Quicksearch for pagenames 383 * 384 * @param string $id page id 385 * @param bool $in_ns match namespace 386 * @param bool $in_title search in title 387 * @param int|string|null $after 388 * @param int|string|null $before 389 * @return string[] 390 * 391 * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::pageLookup() instead 392 */ 393function ft_pageLookup($id, $in_ns = false, $in_title = false, $after = null, $before = null) 394{ 395 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::pageLookup()'); 396 return (new dokuwiki\Search\MetadataSearch())->pageLookup($id, $in_ns, $in_title, $after, $before); 397} 398 399/** 400 * Creates a snippet extract 401 * 402 * @param string $id page id 403 * @param array $highlight words to highlight 404 * @return string 405 * 406 * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::snippet() instead 407 */ 408function ft_snippet($id, $highlight) 409{ 410 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::snippet()'); 411 return (new dokuwiki\Search\FulltextSearch())->snippet($id, $highlight); 412} 413 414/** 415 * Sort pages based on their namespace level first, then alphabetically 416 * 417 * @param string $a 418 * @param string $b 419 * @return int 420 * 421 * @deprecated 2026-04-07 use Utf8\Sort functions directly 422 */ 423function ft_pagesorter($a, $b) 424{ 425 DebugHelper::dbgDeprecatedFunction('Utf8\\Sort'); 426 $diff = substr_count($a, ':') - substr_count($b, ':'); 427 return $diff ?: dokuwiki\Utf8\Sort::strcmp($a, $b); 428} 429 430/** 431 * Wrap a search term in regex boundary checks 432 * 433 * @param string $term 434 * @return string 435 * 436 * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::snippetRePreprocess() instead 437 */ 438function ft_snippet_re_preprocess($term) 439{ 440 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::snippetRePreprocess()'); 441 return (new dokuwiki\Search\FulltextSearch())->snippetRePreprocess($term); 442} 443 444/** 445 * Parse a search query into its components 446 * 447 * @param mixed $Indexer ignored (legacy parameter) 448 * @param string $query search query 449 * @return array parsed query structure 450 * 451 * @deprecated 2026-04-07 use dokuwiki\Search\Query\QueryParser::convert() instead 452 */ 453function ft_queryParser($Indexer, $query) 454{ 455 DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Query\QueryParser::class . '::convert()'); 456 return (new dokuwiki\Search\Query\QueryParser())->convert($query); 457} 458 459/** 460 * @deprecated 2026-04-16 use \dokuwiki\Parsing\ParserMode\Media::parseMedia() instead 461 */ 462function Doku_Handler_Parse_Media($match) 463{ 464 DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ParserMode\Media::class . '::parseMedia()'); 465 return \dokuwiki\Parsing\ParserMode\Media::parseMedia($match); 466} 467 468/** 469 * @deprecated 2026-05-06 use \dokuwiki\MailUtils::PREG_PATTERN_VALID_EMAIL instead! 470 */ 471if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', MailUtils::PREG_PATTERN_VALID_EMAIL); 472 473/** 474 * @deprecated 2026-05-06 use \dokuwiki\MailUtils::obfuscate() instead! 475 */ 476function obfuscate($email) 477{ 478 DebugHelper::dbgDeprecatedFunction(MailUtils::class . '::obfuscate'); 479 return MailUtils::obfuscate($email); 480} 481 482/** 483 * @deprecated 2026-05-06 use \dokuwiki\MailUtils::isValid() instead! 484 */ 485function mail_isvalid($email) 486{ 487 DebugHelper::dbgDeprecatedFunction(MailUtils::class . '::isValid'); 488 return MailUtils::isValid($email); 489} 490 491/** 492 * @deprecated 2026-05-06 use \dokuwiki\MailUtils::quotedPrintableEncode() instead! 493 */ 494function mail_quotedprintable_encode($sText, $maxlen = 74, $bEmulate_imap_8bit = true) 495{ 496 DebugHelper::dbgDeprecatedFunction(MailUtils::class . '::quotedPrintableEncode'); 497 return MailUtils::quotedPrintableEncode($sText, $maxlen, $bEmulate_imap_8bit); 498} 499