SproutCMS

This is the code documentation for the SproutCMS project

source of /config/_bootstrap_config.php

The PHP timezone will be set to this value using date_default_timezone_set

If set to an empty value then the timzone will not be set, which may cause
warnings if the server config has not set the timezone.
  1. <?php
  2.  
  3. /**
  4.  * Methods for determining the details of the very initial environment,
  5.  * prior to the rest of the system coming up
  6.  */
  7. class BootstrapConfig
  8. {
  9.  
  10. /**
  11.   * The PHP timezone will be set to this value using date_default_timezone_set
  12.   *
  13.   * If set to an empty value then the timzone will not be set, which may cause
  14.   * warnings if the server config has not set the timezone.
  15.   */
  16. const TIMEZONE = 'Australia/Adelaide';
  17.  
  18.  
  19. /**
  20.   * Turns on the debug mode for origin cleanup, which outputs the redirect
  21.   * which would occur, but doesn't actually perform the redirect
  22.   */
  23. const ORIGIN_CLEANUP_DEBUG = false;
  24.  
  25.  
  26. /**
  27.   * Specify what the protocol and/or hostname which should be for requests
  28.   * If this doesn't match the current values, then a 301 redirect will occur
  29.   *
  30.   * Default version of this method does nothing, but commented-out examples
  31.   * for common adjustments are included
  32.   *
  33.   * @param string $proto Current request protocol, either 'http' or 'https'
  34.   * @param string $hostname Current request hostname, e.g. 'example.com'
  35.   * @return array New values for $proto and $hostname vars.
  36.   * If these are different from the incoming values, then a redirect will occur
  37.   * First element is protocol, second element is hostname
  38.   * Example: ['https', 'www.example.com']
  39.   */
  40. public static function originCleanup($proto, $hostname)
  41. {
  42. // On test-server, don't change anything
  43. if (!IN_PRODUCTION) {
  44. return [$proto, $hostname];
  45. }
  46.  
  47. // Force https for all traffic
  48. ////$proto = 'https';
  49.  
  50. // Force specific domain name
  51. ////$hostname = 'www.example.com';
  52.  
  53. // If hostname does not begin with www. then append this
  54. ////if (strpos($hostname, 'www.') !== 0) {
  55. //// $hostname = 'www.' . $hostname;
  56. ////}
  57.  
  58. // If hostname begins with www. then strip this off
  59. ////if (strpos($hostname, 'www.') === 0) {
  60. //// $hostname = substr($hostname, 4);
  61. ////}
  62.  
  63. return [$proto, $hostname];
  64. }
  65.  
  66. }
  67.