3 * @file src/Core/System.php
5 namespace Friendica\Core;
10 * @file include/Core/System.php
12 * @brief Contains the class with system relevant stuff
17 * @brief System methods
24 * @brief Initializes the static class variable
27 private static function init()
31 if (!is_object(self::$a)) {
37 * @brief Retrieves the Friendica instance base URL
39 * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN
40 * @return string Friendica server base URL
42 public static function baseUrl($ssl = false)
45 return self::$a->get_baseurl($ssl);
49 * @brief Removes the baseurl from an url. This avoids some mixed content problems.
51 * @param string $orig_url The url to be cleaned
53 * @return string The cleaned url
55 public static function removedBaseUrl($orig_url)
58 return self::$a->remove_baseurl($orig_url);
62 * @brief Returns a string with a callstack. Can be used for logging.
63 * @param integer $depth optional, default 4
66 public static function callstack($depth = 4)
68 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
70 // We remove the first two items from the list since they contain data that we don't need.
76 $previous = array('class' => '', 'function' => '');
78 // The ignore list contains all functions that are only wrapper functions
79 $ignore = array('get_config', 'get_pconfig', 'set_config', 'set_pconfig', 'fetch_url', 'probe_url');
81 while ($func = array_pop($trace)) {
82 if (!empty($func['class'])) {
83 // Don't show multiple calls from the same function (mostly used for "dba" class)
84 if (($previous['class'] != $func['class']) && ($previous['function'] != 'q')) {
85 $classparts = explode("\\", $func['class']);
86 $callstack[] = array_pop($classparts).'::'.$func['function'];
89 } elseif (!in_array($func['function'], $ignore)) {
90 $callstack[] = $func['function'];
95 $callstack2 = array();
96 while ((count($callstack2) < $depth) && (count($callstack) > 0)) {
97 $callstack2[] = array_pop($callstack);
100 return implode(', ', $callstack2);
103 /// @todo Move the following functions from boot.php
105 function get_guid($size = 16, $prefix = "")
108 function local_user()
109 function public_contact()
110 function remote_user()
113 function is_site_admin()
114 function random_digits($digits)
115 function get_server()
116 function get_temppath()
117 function get_cachefile($file, $writemode = true)
118 function get_itemcachepath()
119 function get_spoolpath()
120 function current_load()