Textpattern | PHP Cross Reference | Content Management Systems |
Description: Constants.
1 <?php 2 3 /* 4 * Textpattern Content Management System 5 * https://textpattern.com/ 6 * 7 * Copyright (C) 2020 The Textpattern Development Team 8 * 9 * This file is part of Textpattern. 10 * 11 * Textpattern is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation, version 2. 14 * 15 * Textpattern is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with Textpattern. If not, see <https://www.gnu.org/licenses/>. 22 */ 23 24 /** 25 * Constants. 26 */ 27 28 if (!defined('TXP_DEBUG')) { 29 /** 30 * If set to "1", dumps debug log to the temp directory. 31 * 32 * This constant can be overridden from the config.php. 33 * 34 * @package Debug 35 * @example 36 * define('TXP_DEBUG', 1); 37 */ 38 39 define('TXP_DEBUG', 0); 40 } 41 42 /** 43 * Comment spam status. 44 * 45 * @package Comment 46 */ 47 48 define('SPAM', -1); 49 50 /** 51 * Comment moderate status. 52 * 53 * @package Comment 54 */ 55 56 define('MODERATE', 0); 57 58 /** 59 * Comment spam status. 60 * 61 * @package Comment 62 */ 63 64 define('VISIBLE', 1); 65 66 /** 67 * Comment reload status. 68 * 69 * @package Comment 70 */ 71 72 define('RELOAD', -99); 73 74 if (!defined('HELP_URL')) { 75 /** 76 * The location where help documentation is fetched. 77 * 78 * This constant can be overridden from the config.php. 79 * 80 * @example 81 * define('HELP_URL', 'https://rpc.example.com/help/'); 82 */ 83 84 define('HELP_URL', 'https://rpc.textpattern.com/help/'); 85 } 86 87 /** 88 * Do not format text. 89 * 90 * @var string 91 * @package Textfilter 92 */ 93 94 define('LEAVE_TEXT_UNTOUCHED', '0'); 95 96 /** 97 * Format text with Textile. 98 * 99 * @var string 100 * @package Textfilter 101 */ 102 103 define('USE_TEXTILE', '1'); 104 105 /** 106 * Replace line breaks with HTML <br /> tag. 107 * 108 * @var string 109 * @package Textfilter 110 */ 111 112 define('CONVERT_LINEBREAKS', '2'); 113 114 /** 115 * System is Windows if TRUE. 116 * 117 * @package System 118 */ 119 120 define('IS_WIN', strpos(strtoupper(PHP_OS), 'WIN') === 0); 121 122 /** 123 * Directory separator character. 124 * 125 * @package File 126 */ 127 128 define('DS', defined('DIRECTORY_SEPARATOR') ? DIRECTORY_SEPARATOR : (IS_WIN ? '\\' : '/')); 129 130 /** 131 * Magic quotes GPC, TRUE if on. 132 * 133 * @package Network 134 * @deprecated in 4.8.0 135 */ 136 137 define('MAGIC_QUOTES_GPC', false); 138 139 if (!defined('REGEXP_UTF8')) { 140 /** 141 * TRUE if the system supports UTF-8 regex patterns. 142 * 143 * This constant can be overridden from the config.php in case UTF-8 regex 144 * patterns cause issues. 145 * 146 * @package System 147 * @example 148 * define('REGEXP_UTF8', false); 149 */ 150 151 define('REGEXP_UTF8', @preg_match('@\pL@u', 'q')); 152 } 153 154 /** 155 * Permlink URL mode. 156 * 157 * @package URL 158 * @deprecated ? 159 */ 160 161 define('PERMLINKURL', 0); 162 163 /** 164 * Pagelink URL mode. 165 * 166 * @package URL 167 * @deprecated ? 168 */ 169 170 define('PAGELINKURL', 1); 171 172 if (!defined('EXTRA_MEMORY')) { 173 /** 174 * Allocated extra memory. 175 * 176 * Used when creating thumbnails for instance. 177 * 178 * This constant can be overridden from the config.php. 179 * 180 * @package System 181 * @example 182 * define('EXTRA_MEMORY', '64M'); 183 */ 184 185 define('EXTRA_MEMORY', '32M'); 186 } 187 188 /** 189 * PHP is run as CGI. 190 * 191 * @package System 192 */ 193 194 define('IS_CGI', strpos(PHP_SAPI, 'cgi') === 0); 195 196 /** 197 * PHP is run as FCGI. 198 * 199 * @package System 200 */ 201 202 define('IS_FASTCGI', IS_CGI and empty($_SERVER['FCGI_ROLE']) and empty($_ENV['FCGI_ROLE'])); 203 204 /** 205 * PHP is run as Apache module. 206 * 207 * @package System 208 */ 209 210 define('IS_APACHE', !IS_CGI and strpos(PHP_SAPI, 'apache') === 0); 211 212 /** 213 * Preference is user-private. 214 * 215 * @package Pref 216 * @see set_pref() 217 */ 218 219 define('PREF_PRIVATE', true); 220 221 /** 222 * Preference is global. 223 * 224 * @package Pref 225 * @see set_pref() 226 */ 227 228 define('PREF_GLOBAL', false); 229 230 /** 231 * Preference type is basic. 232 * 233 * @package Pref 234 * @deprecated in 4.6.0 235 * @see PREF_CORE 236 * @see set_pref() 237 */ 238 239 define('PREF_BASIC', 0); 240 241 /** 242 * Preference type is a core setting. 243 * 244 * @package Pref 245 * @see set_pref() 246 */ 247 248 define('PREF_CORE', 0); 249 250 /** 251 * Preference type is advanced. 252 * 253 * @package Pref 254 * @deprecated in 4.6.0 255 * @see PREF_CORE 256 * @see PREF_PLUGIN 257 * @see set_pref() 258 */ 259 260 define('PREF_ADVANCED', 1); 261 262 /** 263 * Preference type is a plugin or third party setting. 264 * 265 * @package Pref 266 * @see set_pref() 267 */ 268 269 define('PREF_PLUGIN', 1); 270 271 /** 272 * Preference type is hidden. 273 * 274 * @package Pref 275 * @see set_pref() 276 */ 277 278 define('PREF_HIDDEN', 2); 279 280 /** 281 * Plugin flag: has an options page. 282 */ 283 284 define('PLUGIN_HAS_PREFS', 0x0001); 285 286 /** 287 * Plugin flag: offers lifecycle callbacks. 288 */ 289 290 define('PLUGIN_LIFECYCLE_NOTIFY', 0x0002); 291 292 /** 293 * Reserved bits for use by Textpattern core. 294 */ 295 296 define('PLUGIN_RESERVED_FLAGS', 0x0fff); 297 298 /** 299 * Plugin storage directory. 300 */ 301 302 define('PLUGINPATH', txpath.DS.'plugins'); 303 304 if (!defined('LOG_REFERER_PROTOCOLS')) { 305 /** 306 * Sets accepted protocols for HTTP referrer header. 307 * 308 * This constant can be overridden from the config.php. 309 * 310 * @package Log 311 * @since 4.6.0 312 * @example 313 * define('LOG_REFERER_PROTOCOLS', 'http'); 314 */ 315 316 define('LOG_REFERER_PROTOCOLS', 'http, https'); 317 } 318 319 if (!defined('PASSWORD_LENGTH')) { 320 /** 321 * Password default length, in characters. 322 * 323 * This constant can be overridden from the config.php. 324 * 325 * @package User 326 * @example 327 * define('PASSWORD_LENGTH', 14); 328 */ 329 330 define('PASSWORD_LENGTH', 16); 331 } 332 333 if (!defined('PASSWORD_COMPLEXITY')) { 334 /** 335 * Password iteration strength count. 336 * 337 * This constant can be overridden from the config.php. 338 * 339 * @package User 340 * @example 341 * define('PASSWORD_COMPLEXITY', 2); 342 */ 343 344 define('PASSWORD_COMPLEXITY', 8); 345 } 346 347 if (!defined('PASSWORD_PORTABILITY')) { 348 /** 349 * Passwords are created portable if TRUE. 350 * 351 * This constant can be overridden from the config.php. 352 * 353 * @package User 354 * @example 355 * define('PASSWORD_PORTABILITY', false); 356 */ 357 358 define('PASSWORD_PORTABILITY', true); 359 } 360 361 if (!defined('PASSWORD_SYMBOLS')) { 362 /** 363 * Symbols used in auto-generated passwords. 364 * 365 * This constant can be overridden from the config.php. 366 * 367 * @package User 368 * @since 4.6.0 369 * @see generate_password() 370 * @example 371 * define('PASSWORD_SYMBOLS', '23456789ABCDEFGHJKLMNPQRSTUYXZabcdefghijkmnopqrstuvwxyz_?!-@$%^*;:'); 372 */ 373 374 define('PASSWORD_SYMBOLS', '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz_-!?.'); 375 } 376 377 if (!defined('HASHING_ALGORITHM')) { 378 /** 379 * Algorithm to use for hashing passwords/reset requests. 380 * 381 * This constant can be overridden from the config.php. 382 * 383 * @package User 384 * @since 4.6.0 385 * @see PHP's hash_algos() function 386 * @example 387 * define('HASHING_ALGORITHM', 'whirlpool'); 388 */ 389 390 define('HASHING_ALGORITHM', 'ripemd256'); 391 } 392 393 if (!defined('SALT_LENGTH')) { 394 /** 395 * Length of salt/selector hashes. 396 * 397 * This constant can be overridden from the config.php. 398 * 399 * @package User 400 * @since 4.6.0 401 * @example 402 * define('SALT_LENGTH', '80'); 403 */ 404 405 define('SALT_LENGTH', '64'); 406 } 407 408 if (!defined('RESET_EXPIRY_MINUTES')) { 409 /** 410 * Length of time (in minutes) that a password reset request remains valid. 411 * 412 * This constant can be overridden from the config.php. 413 * Values under 60 may fall foul of DST changeover times, but meh. 414 * 415 * @package User 416 * @since 4.6.0 417 * @example 418 * define('RESET_EXPIRY_MINUTES', '120'); 419 */ 420 421 define('RESET_EXPIRY_MINUTES', '90'); 422 } 423 424 if (!defined('RESET_RATE_LIMIT_MINUTES')) { 425 /** 426 * Minutes during which multiple user-submitted password reset requests are ignored. 427 * 428 * This constant can be overridden from the config.php. 429 * 430 * @package User 431 * @since 4.6.0 432 * @example 433 * define('RESET_RATE_LIMIT_MINUTES', '15'); 434 */ 435 436 define('RESET_RATE_LIMIT_MINUTES', '5'); 437 } 438 439 if (!defined('ACTIVATION_EXPIRY_HOURS')) { 440 /** 441 * Length of time (in hours) that a password activation (new account) link remains valid. 442 * 443 * This constant can be overridden from the config.php. 444 * 445 * @package User 446 * @since 4.6.0 447 * @example 448 * define('ACTIVATION_EXPIRY_HOURS', '48'); 449 */ 450 451 define('ACTIVATION_EXPIRY_HOURS', '168'); 452 } 453 454 if (!defined('LOGIN_COOKIE_HTTP_ONLY')) { 455 /** 456 * If TRUE, login cookie is set just for HTTP. 457 * 458 * This constant can be overridden from the config.php. 459 * 460 * @package CSRF 461 * @example 462 * define('LOGIN_COOKIE_HTTP_ONLY', false); 463 */ 464 465 define('LOGIN_COOKIE_HTTP_ONLY', true); 466 } 467 468 if (!defined('X_FRAME_OPTIONS')) { 469 /** 470 * Sets X-Frame-Options HTTP header's value. 471 * 472 * This is used to prevent framing of authenticated pages. 473 * 474 * This constant can be overridden from the config.php. 475 * 476 * @package CSRF 477 * @example 478 * define('X_FRAME_OPTIONS', 'DENY'); 479 */ 480 481 define('X_FRAME_OPTIONS', 'SAMEORIGIN'); 482 } 483 484 if (!defined('CONTENT_SECURITY_POLICY')) { 485 /** 486 * Sets Content-Security-Policy HTTP header's value. 487 * 488 * This constant can be overridden from the config.php. 489 * 490 * @since 4.7.0 491 * @package CSRF 492 */ 493 494 define('CONTENT_SECURITY_POLICY', "frame-ancestors 'self'"); 495 } 496 497 if (!defined('AJAX_TIMEOUT')) { 498 /** 499 * AJAX timeout in seconds. 500 * 501 * This constant can be overridden from the config.php. 502 * 503 * @package Ajax 504 * @example 505 * define('AJAX_TIMEOUT', 10); 506 */ 507 508 define('AJAX_TIMEOUT', max(30000, 1000 * @ini_get('max_execution_time'))); 509 } 510 511 /** 512 * Render on initial synchronous page load. 513 * 514 * @since 4.5.0 515 * @package Ajax 516 */ 517 518 define('PARTIAL_STATIC', 0); 519 520 /** 521 * Render as HTML partial on every page load. 522 * 523 * @since 4.5.0 524 * @package Ajax 525 */ 526 527 define('PARTIAL_VOLATILE', 1); 528 529 /** 530 * Render as an element's jQuery.val() on every page load. 531 * 532 * @since 4.5.0 533 * @package Ajax 534 */ 535 536 define('PARTIAL_VOLATILE_VALUE', 2); 537 538 /** 539 * Draft article status ID. 540 * 541 * @package Article 542 */ 543 544 define('STATUS_DRAFT', 1); 545 546 /** 547 * Hidden article status ID. 548 * 549 * @package Article 550 */ 551 552 define('STATUS_HIDDEN', 2); 553 554 /** 555 * Pending article status ID. 556 * 557 * @package Article 558 */ 559 560 define('STATUS_PENDING', 3); 561 562 /** 563 * Live article status ID. 564 * 565 * @package Article 566 */ 567 568 define('STATUS_LIVE', 4); 569 570 /** 571 * Sticky article status ID. 572 * 573 * @package Article 574 */ 575 576 define('STATUS_STICKY', 5); 577 578 if (!defined('WRITE_RECENT_ARTICLES_COUNT')) { 579 /** 580 * Number of recent articles displayed on the Write panel. 581 * 582 * This constant can be overridden from the config.php. 583 * 584 * @package Admin\Article 585 * @since 4.6.0 586 * @example 587 * define('WRITE_RECENT_ARTICLES_COUNT', 5); 588 */ 589 590 define('WRITE_RECENT_ARTICLES_COUNT', 10); 591 } 592 593 /** 594 * Input size extra large. 595 * 596 * @since 4.5.0 597 * @package Form 598 */ 599 600 define('INPUT_XLARGE', 96); 601 602 /** 603 * Input size large. 604 * 605 * @since 4.5.0 606 * @package Form 607 */ 608 609 define('INPUT_LARGE', 64); 610 611 /** 612 * Input size regular. 613 * 614 * @since 4.5.0 615 * @package Form 616 */ 617 618 define('INPUT_REGULAR', 32); 619 620 /** 621 * Input size medium. 622 * 623 * @since 4.5.0 624 * @package Form 625 */ 626 627 define('INPUT_MEDIUM', 16); 628 629 /** 630 * Input size small. 631 * 632 * @since 4.5.0 633 * @package Form 634 */ 635 636 define('INPUT_SMALL', 8); 637 638 /** 639 * Input size extra small. 640 * 641 * @since 4.5.0 642 * @package Form 643 */ 644 645 define('INPUT_XSMALL', 4); 646 647 /** 648 * Input size tiny. 649 * 650 * @since 4.5.0 651 * @package Form 652 */ 653 654 define('INPUT_TINY', 2); 655 656 /** 657 * Textarea height large. 658 * 659 * @since 4.6.0 660 * @package Form 661 */ 662 663 define('TEXTAREA_HEIGHT_LARGE', 32); 664 665 /** 666 * Textarea height regular. 667 * 668 * @since 4.6.0 669 * @package Form 670 */ 671 672 define('TEXTAREA_HEIGHT_REGULAR', 16); 673 674 /** 675 * Textarea height medium. 676 * 677 * @since 4.6.0 678 * @package Form 679 */ 680 681 define('TEXTAREA_HEIGHT_MEDIUM', 8); 682 683 /** 684 * Textarea height small. 685 * 686 * @since 4.6.0 687 * @package Form 688 */ 689 690 define('TEXTAREA_HEIGHT_SMALL', 4); 691 692 /** 693 * Required PHP version. 694 * 695 * @since 4.5.0 696 * @package System 697 */ 698 699 define('REQUIRED_PHP_VERSION', '5.5.0'); 700 701 /** 702 * File integrity status good. 703 * 704 * @since 4.6.0 705 * @package Debug 706 * @see check_file_integrity() 707 */ 708 709 define('INTEGRITY_GOOD', 1); 710 711 /** 712 * File integrity status modified. 713 * 714 * @since 4.6.0 715 * @package Debug 716 * @see check_file_integrity() 717 */ 718 719 define('INTEGRITY_MODIFIED', 2); 720 721 /** 722 * File integrity not readable. 723 * 724 * @since 4.6.0 725 * @package Debug 726 * @see check_file_integrity() 727 */ 728 729 define('INTEGRITY_NOT_READABLE', 3); 730 731 /** 732 * File integrity file missing. 733 * 734 * @since 4.6.0 735 * @package Debug 736 * @see check_file_integrity() 737 */ 738 739 define('INTEGRITY_MISSING', 4); 740 741 /** 742 * File integrity not a file. 743 * 744 * @since 4.6.0 745 * @package Debug 746 * @see check_file_integrity() 747 */ 748 749 define('INTEGRITY_NOT_FILE', 5); 750 751 /** 752 * Return integrity status. 753 * 754 * @since 4.6.0 755 * @package Debug 756 * @see check_file_integrity() 757 */ 758 759 define('INTEGRITY_STATUS', 0x1); 760 761 /** 762 * Return integrity MD5 hashes. 763 * 764 * @since 4.6.0 765 * @package Debug 766 * @see check_file_integrity() 767 */ 768 769 define('INTEGRITY_MD5', 0x2); 770 771 /** 772 * Return full paths. 773 * 774 * @since 4.6.0 775 * @package Debug 776 * @see check_file_integrity() 777 */ 778 779 define('INTEGRITY_REALPATH', 0x4); 780 781 /** 782 * Return a digest. 783 * 784 * @since 4.6.0 785 * @package Debug 786 * @see check_file_integrity() 787 */ 788 789 define('INTEGRITY_DIGEST', 0x8); 790 791 /** 792 * Return a parsed checksum file's contents. 793 * 794 * @since 4.6.0 795 * @package Debug 796 * @see check_file_integrity() 797 */ 798 799 define('INTEGRITY_TABLE', 0x10); 800 801 /** 802 * Link to an external script. 803 * 804 * @since 4.6.0 805 * @package HTML 806 * @see script_js() 807 */ 808 809 define('TEXTPATTERN_SCRIPT_URL', 0x1); 810 811 /** 812 * Attach version number to script URL if stable. 813 * 814 * The install is considered as a 'stable' if the version number doesn't contain 815 * a '-dev' tag. 816 * 817 * @since 4.6.0 818 * @package HTML 819 * @see script_js() 820 */ 821 822 define('TEXTPATTERN_SCRIPT_ATTACH_VERSION', 0x2); 823 824 /** 825 * The localised string is owned by the core system. 826 * 827 * The string will be updated from the remote language server. 828 * 829 * @since 4.6.0 830 * @package L10n 831 */ 832 833 define('TEXTPATTERN_LANG_OWNER_SYSTEM', ''); 834 835 /** 836 * The localised string is owned by the individual site. 837 * 838 * @since 4.6.0 839 * @package L10n 840 */ 841 842 define('TEXTPATTERN_LANG_OWNER_SITE', 'site'); 843 844 if (!defined('TEXTPATTERN_DEFAULT_LANG')) { 845 /** 846 * The default/fallback language identifier. 847 * 848 * @since 4.7.0 849 * @package L10n 850 */ 851 852 define('TEXTPATTERN_DEFAULT_LANG', 'en'); 853 } 854 855 /** 856 * Language flags; 857 * 858 * @since 4.7.0 859 * @package L10n 860 */ 861 define('TEXTPATTERN_LANG_ACTIVE', 0x1); 862 define('TEXTPATTERN_LANG_INSTALLED', 0x2); 863 define('TEXTPATTERN_LANG_AVAILABLE', 0x4); 864 865 /** 866 * Strip empty values. 867 * 868 * @since 4.6.0 869 * @package HTML 870 * @see join_atts(), do_list_unique() 871 */ 872 873 define('TEXTPATTERN_STRIP_NONE', 0); 874 define('TEXTPATTERN_STRIP_EMPTY', 0x1); 875 define('TEXTPATTERN_STRIP_EMPTY_STRING', 0x2); 876 define('TEXTPATTERN_STRIP_TXP', 0x4); 877 878 /** 879 * Sends an adaptive announcement. 880 * 881 * The rendered message type is based on the context mode. 882 * 883 * @since 4.6.0 884 * @package Announce 885 * @see announce() 886 */ 887 888 define('TEXTPATTERN_ANNOUNCE_ADAPTIVE', 0x1); 889 890 /** 891 * Sends a modal announcement. 892 * 893 * The announcement is instructed to be rendered as soon as possible, as a modal 894 * alert window. 895 * 896 * @since 4.6.0 897 * @package Announce 898 * @see announce() 899 */ 900 901 define('TEXTPATTERN_ANNOUNCE_MODAL', 0x2); 902 903 /** 904 * Sends an asynchronous announcement. 905 * 906 * @since 4.6.0 907 * @package Announce 908 * @see announce() 909 */ 910 911 define('TEXTPATTERN_ANNOUNCE_ASYNC', 0x4); 912 913 /** 914 * Sends a synchronous announcement. 915 * 916 * @since 4.6.0 917 * @package Announce 918 * @see announce() 919 */ 920 921 define('TEXTPATTERN_ANNOUNCE_REGULAR', 0x8); 922 923 /** 924 * Define the default JSON option for json_encode() 925 * 926 * @since 4.7.0 927 */ 928 929 define('TEXTPATTERN_JSON', JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 930 931 /** 932 * A tab character. 933 * 934 * @var string 935 */ 936 937 define("t", "\t"); 938 939 /** 940 * A line feed. 941 * 942 * @var string 943 */ 944 945 define("n", "\n"); 946 947 /** 948 * A self-closing HTML line-break tag. 949 * 950 * @var string 951 */ 952 953 define("br", "<br />"); 954 955 /** 956 * A non-breaking space as a HTML entity. 957 * 958 * @var string 959 */ 960 961 define("sp", " "); 962 963 /** 964 * An ampersand as a HTML entity. 965 * 966 * @var string 967 */ 968 969 define("a", "&");
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title