Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/lib/constants.php - 909 lines - 16834 bytes - Text - Print

Description: Constants.

   1  <?php
   2  
   3  /*

   4   * Textpattern Content Management System

   5   * http://textpattern.com

   6   *

   7   * Copyright (C) 2016 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 <http://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('RPC_SERVER')) {
  75      /**

  76       * RPC server location.

  77       *

  78       * This constant can be overridden from the config.php.

  79       *

  80       * @example

  81       * define('RPC_SERVER', 'http://rpc.example.com');

  82       */
  83  
  84      define('RPC_SERVER', 'http://rpc.textpattern.com');
  85  }
  86  
  87  if (!defined('HELP_URL')) {
  88      /**

  89       * The location where help documentation is fetched.

  90       *

  91       * This constant can be overridden from the config.php.

  92       *

  93       * @example

  94       * define('HELP_URL', 'http://rpc.example.com/help/');

  95       */
  96  
  97      define('HELP_URL', 'http://rpc.textpattern.com/help/');
  98  }
  99  
 100  /**

 101   * Do not format text.

 102   *

 103   * @var     string

 104   * @package Textfilter

 105   */
 106  
 107  define('LEAVE_TEXT_UNTOUCHED', '0');
 108  
 109  /**

 110   * Format text with Textile.

 111   *

 112   * @var     string

 113   * @package Textfilter

 114   */
 115  
 116  define('USE_TEXTILE', '1');
 117  
 118  /**

 119   * Replace line breaks with HTML &lt;br /&gt; tag.

 120   *

 121   * @var     string

 122   * @package Textfilter

 123   */
 124  
 125  define('CONVERT_LINEBREAKS', '2');
 126  
 127  /**

 128   * System is Windows if TRUE.

 129   *

 130   * @package System

 131   */
 132  
 133  define('IS_WIN', strpos(strtoupper(PHP_OS), 'WIN') === 0);
 134  
 135  /**

 136   * Directory separator character.

 137   *

 138   * @package File

 139   */
 140  
 141  define('DS', defined('DIRECTORY_SEPARATOR') ? DIRECTORY_SEPARATOR : (IS_WIN ? '\\' : '/'));
 142  
 143  /**

 144   * Magic quotes GPC, TRUE if on.

 145   *

 146   * @package Network

 147   */
 148  
 149  define('MAGIC_QUOTES_GPC', false);
 150  
 151  if (!defined('REGEXP_UTF8')) {
 152      /**

 153       * TRUE if the system supports UTF-8 regex patterns.

 154       *

 155       * This constant can be overridden from the config.php in case UTF-8 regex

 156       * patterns cause issues.

 157       *

 158       * @package System

 159       * @example

 160       * define('REGEXP_UTF8', false);

 161       */
 162  
 163      define('REGEXP_UTF8', @preg_match('@\pL@u', 'q'));
 164  }
 165  
 166  /**

 167   * Permlink URL mode.

 168   *

 169   * @package    URL

 170   * @deprecated ?

 171   */
 172  
 173  define('PERMLINKURL', 0);
 174  
 175  /**

 176   * Pagelink URL mode.

 177   *

 178   * @package    URL

 179   * @deprecated ?

 180   */
 181  
 182  define('PAGELINKURL', 1);
 183  
 184  if (!defined('EXTRA_MEMORY')) {
 185      /**

 186       * Allocated extra memory.

 187       *

 188       * Used when creating thumbnails for instance.

 189       *

 190       * This constant can be overridden from the config.php.

 191       *

 192       * @package System

 193       * @example

 194       * define('EXTRA_MEMORY', '64M');

 195       */
 196  
 197      define('EXTRA_MEMORY', '32M');
 198  }
 199  
 200  /**

 201   * PHP is run as CGI.

 202   *

 203   * @package System

 204   */
 205  
 206  define('IS_CGI', strpos(PHP_SAPI, 'cgi') === 0);
 207  
 208  /**

 209   * PHP is run as FCGI.

 210   *

 211   * @package System

 212   */
 213  
 214  define('IS_FASTCGI', IS_CGI and empty($_SERVER['FCGI_ROLE']) and empty($_ENV['FCGI_ROLE']));
 215  
 216  /**

 217   * PHP is run as Apache module.

 218   *

 219   * @package System

 220   */
 221  
 222  define('IS_APACHE', !IS_CGI and strpos(PHP_SAPI, 'apache') === 0);
 223  
 224  /**

 225   * Preference is user-private.

 226   *

 227   * @package Pref

 228   * @see     set_pref()

 229   */
 230  
 231  define('PREF_PRIVATE', true);
 232  
 233  /**

 234   * Preference is global.

 235   *

 236   * @package Pref

 237   * @see     set_pref()

 238   */
 239  
 240  define('PREF_GLOBAL', false);
 241  
 242  /**

 243   * Preference type is basic.

 244   *

 245   * @package    Pref

 246   * @deprecated in 4.6.0

 247   * @see        PREF_CORE

 248   * @see        set_pref()

 249   */
 250  
 251  define('PREF_BASIC', 0);
 252  
 253  /**

 254   * Preference type is a core setting.

 255   *

 256   * @package Pref

 257   * @see     set_pref()

 258   */
 259  
 260  define('PREF_CORE', 0);
 261  
 262  /**

 263   * Preference type is advanced.

 264   *

 265   * @package    Pref

 266   * @deprecated in 4.6.0

 267   * @see        PREF_CORE

 268   * @see        PREF_PLUGIN

 269   * @see        set_pref()

 270   */
 271  
 272  define('PREF_ADVANCED', 1);
 273  
 274  /**

 275   * Preference type is a plugin or third party setting.

 276   *

 277   * @package Pref

 278   * @see     set_pref()

 279   */
 280  
 281  define('PREF_PLUGIN', 1);
 282  
 283  /**

 284   * Preference type is hidden.

 285   *

 286   * @package Pref

 287   * @see     set_pref()

 288   */
 289  
 290  define('PREF_HIDDEN', 2);
 291  
 292  /**

 293   * Plugin flag: has an options page.

 294   */
 295  
 296  define('PLUGIN_HAS_PREFS', 0x0001);
 297  
 298  /**

 299   * Plugin flag: offers lifecycle callbacks.

 300   */
 301  
 302  define('PLUGIN_LIFECYCLE_NOTIFY', 0x0002);
 303  
 304  /**

 305   * Reserved bits for use by Textpattern core.

 306   */
 307  
 308  define('PLUGIN_RESERVED_FLAGS', 0x0fff);
 309  
 310  if (!defined('LOG_REFERER_PROTOCOLS')) {
 311      /**

 312       * Sets accepted protocols for HTTP referrer header.

 313       *

 314       * This constant can be overridden from the config.php.

 315       *

 316       * @package Log

 317       * @since   4.6.0

 318       * @example

 319       * define('LOG_REFERER_PROTOCOLS', 'http');

 320       */
 321  
 322      define('LOG_REFERER_PROTOCOLS', 'http, https');
 323  }
 324  
 325  if (!defined('PASSWORD_LENGTH')) {
 326      /**

 327       * Password default length, in characters.

 328       *

 329       * This constant can be overridden from the config.php.

 330       *

 331       * @package User

 332       * @example

 333       * define('PASSWORD_LENGTH', 14);

 334       */
 335  
 336      define('PASSWORD_LENGTH', 16);
 337  }
 338  
 339  if (!defined('PASSWORD_COMPLEXITY')) {
 340      /**

 341       * Password iteration strength count.

 342       *

 343       * This constant can be overridden from the config.php.

 344       *

 345       * @package User

 346       * @example

 347       * define('PASSWORD_COMPLEXITY', 2);

 348       */
 349  
 350      define('PASSWORD_COMPLEXITY', 8);
 351  }
 352  
 353  if (!defined('PASSWORD_PORTABILITY')) {
 354      /**

 355       * Passwords are created portable if TRUE.

 356       *

 357       * This constant can be overridden from the config.php.

 358       *

 359       * @package User

 360       * @example

 361       * define('PASSWORD_PORTABILITY', false);

 362       */
 363  
 364      define('PASSWORD_PORTABILITY', true);
 365  }
 366  
 367  if (!defined('PASSWORD_SYMBOLS')) {
 368      /**

 369       * Symbols used in auto-generated passwords.

 370       *

 371       * This constant can be overridden from the config.php.

 372       *

 373       * @package User

 374       * @since   4.6.0

 375       * @see     generate_password()

 376       * @example

 377       * define('PASSWORD_SYMBOLS', '23456789ABCDEFGHJKLMNPQRSTUYXZabcdefghijkmnopqrstuvwxyz_?!-@$%^*;:');

 378       */
 379  
 380      define('PASSWORD_SYMBOLS', '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz_-!?.');
 381  }
 382  
 383  if (!defined('HASHING_ALGORITHM')) {
 384      /**

 385       * Algorithm to use for hashing passwords/reset requests.

 386       *

 387       * This constant can be overridden from the config.php.

 388       *

 389       * @package User

 390       * @since   4.6.0

 391       * @see     PHP's hash_algos() function

 392       * @example

 393       * define('HASHING_ALGORITHM', 'whirlpool');

 394       */
 395  
 396      define('HASHING_ALGORITHM', 'ripemd256');
 397  }
 398  
 399  if (!defined('SALT_LENGTH')) {
 400      /**

 401       * Length of salt/selector hashes.

 402       *

 403       * This constant can be overridden from the config.php.

 404       *

 405       * @package User

 406       * @since   4.6.0

 407       * @example

 408       * define('SALT_LENGTH', '80');

 409       */
 410  
 411      define('SALT_LENGTH', '64');
 412  }
 413  
 414  if (!defined('RESET_EXPIRY_MINUTES')) {
 415      /**

 416       * Length of time (in minutes) that a password reset request remains valid.

 417       *

 418       * This constant can be overridden from the config.php.

 419       * Values under 60 may fall foul of DST changeover times, but meh.

 420       *

 421       * @package User

 422       * @since   4.6.0

 423       * @example

 424       * define('RESET_EXPIRY_MINUTES', '120');

 425       */
 426  
 427      define('RESET_EXPIRY_MINUTES', '90');
 428  }
 429  
 430  if (!defined('RESET_RATE_LIMIT_MINUTES')) {
 431      /**

 432       * Minutes during which multiple user-submitted password reset requests are ignored.

 433       *

 434       * This constant can be overridden from the config.php.

 435       *

 436       * @package User

 437       * @since   4.6.0

 438       * @example

 439       * define('RESET_RATE_LIMIT_MINUTES', '15');

 440       */
 441  
 442      define('RESET_RATE_LIMIT_MINUTES', '5');
 443  }
 444  
 445  if (!defined('ACTIVATION_EXPIRY_HOURS')) {
 446      /**

 447       * Length of time (in hours) that a password activation (new account) link remains valid.

 448       *

 449       * This constant can be overridden from the config.php.

 450       *

 451       * @package User

 452       * @since   4.6.0

 453       * @example

 454       * define('ACTIVATION_EXPIRY_HOURS', '48');

 455       */
 456  
 457      define('ACTIVATION_EXPIRY_HOURS', '168');
 458  }
 459  
 460  if (!defined('LOGIN_COOKIE_HTTP_ONLY')) {
 461      /**

 462       * If TRUE, login cookie is set just for HTTP.

 463       *

 464       * This constant can be overridden from the config.php.

 465       *

 466       * @package CSRF

 467       * @example

 468       * define('LOGIN_COOKIE_HTTP_ONLY', false);

 469       */
 470  
 471      define('LOGIN_COOKIE_HTTP_ONLY', true);
 472  }
 473  
 474  if (!defined('X_FRAME_OPTIONS')) {
 475      /**

 476       * Sets X-Frame-Options HTTP header's value.

 477       *

 478       * This is used to prevent framing of authenticated pages.

 479       *

 480       * This constant can be overridden from the config.php.

 481       *

 482       * @package CSRF

 483       * @example

 484       * define('X_FRAME_OPTIONS', 'DENY');

 485       */
 486  
 487      define('X_FRAME_OPTIONS', 'SAMEORIGIN');
 488  }
 489  
 490  if (!defined('X_UA_COMPATIBLE')) {
 491      /**

 492       * Sets X-UA-Compatible HTTP header's value.

 493       *

 494       * This constant can be overridden from the config.php.

 495       *

 496       * @since   4.6.0

 497       * @package HTML

 498       * @example

 499       * define('X_UA_COMPATIBLE', 'ie=ie9');

 500       */
 501  
 502      define('X_UA_COMPATIBLE', 'ie=edge');
 503  }
 504  
 505  if (!defined('AJAX_TIMEOUT')) {
 506      /**

 507       * AJAX timeout in seconds.

 508       *

 509       * This constant can be overridden from the config.php.

 510       *

 511       * @package Ajax

 512       * @example

 513       * define('AJAX_TIMEOUT', 10);

 514       */
 515  
 516      define('AJAX_TIMEOUT', max(30000, 1000 * @ini_get('max_execution_time')));
 517  }
 518  
 519  /**

 520   * Render on initial synchronous page load.

 521   *

 522   * @since   4.5.0

 523   * @package Ajax

 524   */
 525  
 526  define('PARTIAL_STATIC', 0);
 527  
 528  /**

 529   * Render as HTML partial on every page load.

 530   *

 531   * @since   4.5.0

 532   * @package Ajax

 533   */
 534  
 535  define('PARTIAL_VOLATILE', 1);
 536  
 537  /**

 538   * Render as an element's jQuery.val() on every page load.

 539   *

 540   * @since   4.5.0

 541   * @package Ajax

 542   */
 543  
 544  define('PARTIAL_VOLATILE_VALUE', 2);
 545  
 546  /**

 547   * Draft article status ID.

 548   *

 549   * @package Article

 550   */
 551  
 552  define('STATUS_DRAFT', 1);
 553  
 554  /**

 555   * Hidden article status ID.

 556   *

 557   * @package Article

 558   */
 559  
 560  define('STATUS_HIDDEN', 2);
 561  
 562  /**

 563   * Pending article status ID.

 564   *

 565   * @package Article

 566   */
 567  
 568  define('STATUS_PENDING', 3);
 569  
 570  /**

 571   * Live article status ID.

 572   *

 573   * @package Article

 574   */
 575  
 576  define('STATUS_LIVE', 4);
 577  
 578  /**

 579   * Sticky article status ID.

 580   *

 581   * @package Article

 582   */
 583  
 584  define('STATUS_STICKY', 5);
 585  
 586  if (!defined('WRITE_RECENT_ARTICLES_COUNT')) {
 587      /**

 588       * Number of recent articles displayed on the Write panel.

 589       *

 590       * This constant can be overridden from the config.php.

 591       *

 592       * @package Admin\Article

 593       * @since   4.6.0

 594       * @example

 595       * define('WRITE_RECENT_ARTICLES_COUNT', 5);

 596       */
 597  
 598      define('WRITE_RECENT_ARTICLES_COUNT', 10);
 599  }
 600  
 601  /**

 602   * Input size extra large.

 603   *

 604   * @since   4.5.0

 605   * @package Form

 606   */
 607  
 608  define('INPUT_XLARGE', 96);
 609  
 610  /**

 611   * Input size large.

 612   *

 613   * @since   4.5.0

 614   * @package Form

 615   */
 616  
 617  define('INPUT_LARGE', 64);
 618  
 619  /**

 620   * Input size regular.

 621   *

 622   * @since   4.5.0

 623   * @package Form

 624   */
 625  
 626  define('INPUT_REGULAR', 32);
 627  
 628  /**

 629   * Input size medium.

 630   *

 631   * @since   4.5.0

 632   * @package Form

 633   */
 634  
 635  define('INPUT_MEDIUM', 16);
 636  
 637  /**

 638   * Input size small.

 639   *

 640   * @since   4.5.0

 641   * @package Form

 642   */
 643  
 644  define('INPUT_SMALL', 8);
 645  
 646  /**

 647   * Input size extra small.

 648   *

 649   * @since   4.5.0

 650   * @package Form

 651   */
 652  
 653  define('INPUT_XSMALL', 4);
 654  
 655  /**

 656   * Input size tiny.

 657   *

 658   * @since   4.5.0

 659   * @package Form

 660   */
 661  
 662  define('INPUT_TINY', 2);
 663  
 664  /**

 665   * Textarea height large.

 666   *

 667   * @since   4.6.0

 668   * @package Form

 669   */
 670  
 671  define('TEXTAREA_HEIGHT_LARGE', 32);
 672  
 673  /**

 674   * Textarea height regular.

 675   *

 676   * @since   4.6.0

 677   * @package Form

 678   */
 679  
 680  define('TEXTAREA_HEIGHT_REGULAR', 16);
 681  
 682  /**

 683   * Textarea height medium.

 684   *

 685   * @since   4.6.0

 686   * @package Form

 687   */
 688  
 689  define('TEXTAREA_HEIGHT_MEDIUM', 8);
 690  
 691  /**

 692   * Textarea height small.

 693   *

 694   * @since   4.6.0

 695   * @package Form

 696   */
 697  
 698  define('TEXTAREA_HEIGHT_SMALL', 4);
 699  
 700  /**

 701   * Required PHP version.

 702   *

 703   * @since   4.5.0

 704   * @package System

 705   */
 706  
 707  define('REQUIRED_PHP_VERSION', '5.3.3');
 708  
 709  /**

 710   * File integrity status good.

 711   *

 712   * @since   4.6.0

 713   * @package Debug

 714   * @see     check_file_integrity()

 715   */
 716  
 717  define('INTEGRITY_GOOD', 1);
 718  
 719  /**

 720   * File integrity status modified.

 721   *

 722   * @since   4.6.0

 723   * @package Debug

 724   * @see     check_file_integrity()

 725   */
 726  
 727  define('INTEGRITY_MODIFIED', 2);
 728  
 729  /**

 730   * File integrity not readable.

 731   *

 732   * @since   4.6.0

 733   * @package Debug

 734   * @see     check_file_integrity()

 735   */
 736  
 737  define('INTEGRITY_NOT_READABLE', 3);
 738  
 739  /**

 740   * File integrity file missing.

 741   *

 742   * @since   4.6.0

 743   * @package Debug

 744   * @see     check_file_integrity()

 745   */
 746  
 747  define('INTEGRITY_MISSING', 4);
 748  
 749  /**

 750   * File integrity not a file.

 751   *

 752   * @since   4.6.0

 753   * @package Debug

 754   * @see     check_file_integrity()

 755   */
 756  
 757  define('INTEGRITY_NOT_FILE', 5);
 758  
 759  /**

 760   * Return integrity status.

 761   *

 762   * @since   4.6.0

 763   * @package Debug

 764   * @see     check_file_integrity()

 765   */
 766  
 767  define('INTEGRITY_STATUS', 0x1);
 768  
 769  /**

 770   * Return integrity MD5 hashes.

 771   *

 772   * @since   4.6.0

 773   * @package Debug

 774   * @see     check_file_integrity()

 775   */
 776  
 777  define('INTEGRITY_MD5', 0x2);
 778  
 779  /**

 780   * Return full paths.

 781   *

 782   * @since   4.6.0

 783   * @package Debug

 784   * @see     check_file_integrity()

 785   */
 786  
 787  define('INTEGRITY_REALPATH', 0x4);
 788  
 789  /**

 790   * Return a digest.

 791   *

 792   * @since   4.6.0

 793   * @package Debug

 794   * @see     check_file_integrity()

 795   */
 796  
 797  define('INTEGRITY_DIGEST', 0x8);
 798  
 799  /**

 800   * Return a parsed checksum file's contents.

 801   *

 802   * @since   4.6.0

 803   * @package Debug

 804   * @see     check_file_integrity()

 805   */
 806  
 807  define('INTEGRITY_TABLE', 0x10);
 808  
 809  /**

 810   * Link to an external script.

 811   *

 812   * @since   4.6.0

 813   * @package HTML

 814   * @see     script_js()

 815   */
 816  
 817  define('TEXTPATTERN_SCRIPT_URL', 0x1);
 818  
 819  /**

 820   * Attach version number to script URL if stable.

 821   *

 822   * The install is considered as a 'stable' if the version number doesn't contain

 823   * a '-dev' tag.

 824   *

 825   * @since   4.6.0

 826   * @package HTML

 827   * @see     script_js()

 828   */
 829  
 830  define('TEXTPATTERN_SCRIPT_ATTACH_VERSION', 0x2);
 831  
 832  /**

 833   * The localised string is owned by the core system.

 834   *

 835   * The string will be updated from the remote language server.

 836   *

 837   * @since   4.6.0

 838   * @package L10n

 839   */
 840  
 841  define('TEXTPATTERN_LANG_OWNER_SYSTEM', '');
 842  
 843  /**

 844   * The localised string is owned by the individual site.

 845   *

 846   * The string will not be updated from the remote language server.

 847   *

 848   * @since   4.6.0

 849   * @package L10n

 850   */
 851  
 852  define('TEXTPATTERN_LANG_OWNER_SITE', 'site');
 853  
 854  /**

 855   * Strip empty values.

 856   *

 857   * @since   4.6.0

 858   * @package HTML

 859   * @see     join_atts(), do_list_unique()

 860   */
 861  
 862  define('TEXTPATTERN_STRIP_NONE',         0);
 863  define('TEXTPATTERN_STRIP_EMPTY',        0x1);
 864  define('TEXTPATTERN_STRIP_EMPTY_STRING', 0x2);
 865  
 866  /**

 867   * Sends an adaptive announcement.

 868   *

 869   * The rendered message type is based on the context mode.

 870   *

 871   * @since   4.6.0

 872   * @package Announce

 873   * @see     announce()

 874   */
 875  
 876  define('TEXTPATTERN_ANNOUNCE_ADAPTIVE', 0x1);
 877  
 878  /**

 879   * Sends a modal announcement.

 880   *

 881   * The announcement is instructed to be rendered as soon as possible, as a modal

 882   * alert window.

 883   *

 884   * @since   4.6.0

 885   * @package Announce

 886   * @see     announce()

 887   */
 888  
 889  define('TEXTPATTERN_ANNOUNCE_MODAL', 0x2);
 890  
 891  /**

 892   * Sends an asynchronous announcement.

 893   *

 894   * @since   4.6.0

 895   * @package Announce

 896   * @see     announce()

 897   */
 898  
 899  define('TEXTPATTERN_ANNOUNCE_ASYNC', 0x4);
 900  
 901  /**

 902   * Sends a synchronous announcement.

 903   *

 904   * @since   4.6.0

 905   * @package Announce

 906   * @see     announce()

 907   */
 908  
 909  define('TEXTPATTERN_ANNOUNCE_REGULAR', 0x8);

title

Description

title

Description

title

Description

title

title

Body