mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
Moved functions out of boot.php into class
- z_root() => $a->getBaseURL() - absurl() => removed because no usage - is_ajax() => $a->isAjax() - current_load() => System::currentLoad() - argc() => $a->argc - argv($x) => $a->getArgumentValue($x)
This commit is contained in:
parent
14e7686df4
commit
2c541afd47
8 changed files with 66 additions and 90 deletions
78
boot.php
78
boot.php
|
@ -475,44 +475,6 @@ function defaults() {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the baseurl.
|
||||
*
|
||||
* @see System::baseUrl()
|
||||
*
|
||||
* @return string
|
||||
* @TODO Function is deprecated and only used in some addons
|
||||
*/
|
||||
function z_root()
|
||||
{
|
||||
return System::baseUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return absolut URL for given $path.
|
||||
*
|
||||
* @param string $path given path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function absurl($path)
|
||||
{
|
||||
if (strpos($path, '/') === 0) {
|
||||
return z_path() . $path;
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if request was an AJAX (xmlhttprequest) request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_ajax()
|
||||
{
|
||||
return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if request was an AJAX (xmlhttprequest) request.
|
||||
*
|
||||
|
@ -1175,46 +1137,6 @@ function validate_include(&$file)
|
|||
return $valid;
|
||||
}
|
||||
|
||||
function current_load()
|
||||
{
|
||||
if (!function_exists('sys_getloadavg')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$load_arr = sys_getloadavg();
|
||||
|
||||
if (!is_array($load_arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return max($load_arr[0], $load_arr[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get c-style args
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function argc()
|
||||
{
|
||||
return get_app()->argc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the value of a argv key
|
||||
*
|
||||
* @param int $x argv key
|
||||
* @return string Value of the argv key
|
||||
*/
|
||||
function argv($x)
|
||||
{
|
||||
if (array_key_exists($x, get_app()->argv)) {
|
||||
return get_app()->argv[$x];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the data which is needed for infinite scroll
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue