예제 #1
0
 /**
  * Set the doc root variables if not already set
  *
  * @return string
  */
 public static function document_root()
 {
     if (empty(self::$document_root)) {
         $theme_root = self::theme_root();
         $theme_root_uri = self::theme_root_uri();
         $uri_parts = parse_url($theme_root_uri);
         $path_length = strlen($uri_parts['path']);
         self::$document_root = substr_replace($theme_root, '', $path_length * -1);
         self::$document_root_length = strlen(self::$document_root);
     }
     return self::$document_root;
 }
예제 #2
0
 /**
  * Set the doc root variables if not already set
  *
  * @return string
  */
 public static function document_root()
 {
     if (empty(self::$document_root)) {
         if (isset($_SERVER['DOCUMENT_ROOT'])) {
             self::$document_root = realpath($_SERVER['DOCUMENT_ROOT']);
         } else {
             $theme_root = get_theme_root();
             $theme_root_uri = get_theme_root_uri();
             $uri_parts = parse_url($theme_root_uri);
             $path_length = strlen($uri_parts['path']);
             $document_root = substr_replace($theme_root, '', -$path_length);
             self::$document_root = realpath($document_root);
         }
         self::$document_root_length = strlen(self::$document_root);
     }
     return self::$document_root;
 }