diff options
-rw-r--r-- | boot.php | 52 | ||||
-rw-r--r-- | include/observer.php | 60 |
2 files changed, 61 insertions, 51 deletions
@@ -49,6 +49,7 @@ require_once('include/text.php'); require_once('include/datetime.php'); require_once('include/language.php'); require_once('include/nav.php'); +require_once('include/observer.php'); require_once('include/permissions.php'); require_once('include/features.php'); require_once('include/taxonomy.php'); @@ -2151,57 +2152,6 @@ function dba_timer() { } /** - * Get the unique hash identifying the current observer. - * - * Observer can be a local or remote channel. - * - * @return string Unique hash of observer, otherwise empty string if no - * observer - */ -function get_observer_hash() { - $observer = App::get_observer(); - if (is_array($observer)) { - return $observer['xchan_hash']; - } - - return ''; -} - -/** - * Get the guid of the current observer. - * - * Observer can be a local or remote channel. - * - * @return string The GUID of the observer, otherwise empty string if no - * observer - */ -function get_observer_guid() { - $observer = App::get_observer(); - if (is_array($observer)) { - return $observer['xchan_guid']; - } - - return ''; -} - -/** - * Get the name of the current observer. - * - * Observer can be a local or remote channel. - * - * @return string The name of the observer, otherwise empty string if no - * observer - */ -function get_observer_name() { - $observer = App::get_observer(); - if (is_array($observer)) { - return $observer['xchan_name']; - } - - return ''; -} - -/** * @brief Returns the complete URL of the current page, e.g.: http(s)://something.com/network * * Taken from http://webcheatsheet.com/php/get_current_page_url.php diff --git a/include/observer.php b/include/observer.php new file mode 100644 index 000000000..98c5002f7 --- /dev/null +++ b/include/observer.php @@ -0,0 +1,60 @@ +<?php +/** + * Helper functions for getting info about the observer. + * + * SPDX-FileCopyrightText: 2025 The Hubzilla Community + * SPDX-FileContributor: Harald Eilertsen <haraldei@anduin.net> + * + * SPDX-License-Identifier: MIT + */ + +/** + * Get the unique hash identifying the current observer. + * + * Observer can be a local or remote channel. + * + * @return string Unique hash of observer, otherwise empty string if no + * observer + */ +function get_observer_hash() { + $observer = App::get_observer(); + if (is_array($observer)) { + return $observer['xchan_hash']; + } + + return ''; +} + +/** + * Get the guid of the current observer. + * + * Observer can be a local or remote channel. + * + * @return string The GUID of the observer, otherwise empty string if no + * observer + */ +function get_observer_guid() { + $observer = App::get_observer(); + if (is_array($observer)) { + return $observer['xchan_guid']; + } + + return ''; +} + +/** + * Get the name of the current observer. + * + * Observer can be a local or remote channel. + * + * @return string The name of the observer, otherwise empty string if no + * observer + */ +function get_observer_name() { + $observer = App::get_observer(); + if (is_array($observer)) { + return $observer['xchan_name']; + } + + return ''; +} |