X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FProfile.php;h=573af02c94f1c90d51ff446d37f962fb575ac607;hb=753996c86f0ddc3aa54c3fbd52a66626d89933aa;hp=a7f35f578213442158381d6a5ad0f7ed15ace67b;hpb=4cfa46186a54c2a0fdffe0f56481f1a764f9a6a1;p=friendica.git diff --git a/src/Model/Profile.php b/src/Model/Profile.php index a7f35f5782..573af02c94 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -1,5 +1,4 @@ $nickname]); if (!$user && !count($user) && !count($profiledata)) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); @@ -101,14 +100,14 @@ class Profile } if ($profiledata) { - $a->page['aside'] .= profile_sidebar($profiledata, true, $show_connect); + $a->page['aside'] .= self::sidebar($profiledata, true, $show_connect); if (!DBM::is_result($user)) { return; } } - $pdata = get_profiledata_by_nick($nickname, $user[0]['uid'], $profile); + $pdata = self::getByNickname($nickname, $user[0]['uid'], $profile); if (empty($pdata) && empty($profiledata)) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); @@ -176,14 +175,14 @@ class Profile * But: When this profile was on the same server, then we could display the contacts */ if (!$profiledata) { - $a->page['aside'] .= profile_sidebar($a->profile, $block, $show_connect); + $a->page['aside'] .= self::sidebar($a->profile, $block, $show_connect); } return; } /** - * @brief Get all profil data of a local user + * Get all profile data of a local user * * If the viewer is an authenticated remote viewer, the profile displayed is the * one that has been configured for his/her viewing in the Contact manager. @@ -192,12 +191,13 @@ class Profile * * Includes all available profile data * + * @brief Get all profile data of a local user * @param string $nickname nick * @param int $uid uid * @param int $profile_id ID of the profile - * @returns array + * @return array */ - function get_profiledata_by_nick($nickname, $uid = 0, $profile_id = 0) + public static function getByNickname($nickname, $uid = 0, $profile_id = 0) { if (remote_user() && count($_SESSION['remote'])) { foreach ($_SESSION['remote'] as $visitor) { @@ -245,11 +245,12 @@ class Profile } /** - * @brief Formats a profile for display in the sidebar. + * Formats a profile for display in the sidebar. * * It is very difficult to templatise the HTML completely * because of all the conditional logic. * + * @brief Formats a profile for display in the sidebar. * @param array $profile * @param int $block * @param boolean $show_connect Show connect link @@ -263,7 +264,7 @@ class Profile * @hooks 'profile_sidebar' * array $arr */ - function profile_sidebar($profile, $block = 0, $show_connect = true) + private static function sidebar($profile, $block = 0, $show_connect = true) { $a = get_app(); @@ -333,7 +334,7 @@ class Profile $subscribe_feed = false; } - if (remote_user() || (get_my_url() && x($profile, 'unkmail') && ($profile['uid'] != local_user()))) { + if (remote_user() || (self::getMyURL() && x($profile, 'unkmail') && ($profile['uid'] != local_user()))) { $wallmessage = t('Message'); $wallmessage_link = 'wallmessage/' . $profile['nickname']; @@ -348,7 +349,7 @@ class Profile $r = q( "SELECT `url` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `rel` = %d", intval($profile['uid']), - dbesc(normalise_link(get_my_url())), + dbesc(normalise_link(self::getMyURL())), intval(CONTACT_IS_FRIEND) ); } @@ -524,7 +525,7 @@ class Profile return $o; } - function get_birthdays() + public static function getBirthdays() { $a = get_app(); $o = ''; @@ -615,7 +616,7 @@ class Profile )); } - function get_events() + public static function getEvents() { require_once 'include/bbcode.php'; @@ -700,7 +701,7 @@ class Profile )); } - function advanced_profile(App $a) + public static function getAdvanced(App $a) { $o = ''; $uid = $a->profile['uid']; @@ -844,7 +845,7 @@ class Profile return ''; } - function profile_tabs($a, $is_owner = false, $nickname = null) + public static function getTabs($a, $is_owner = false, $nickname = null) { if (is_null($nickname)) { $nickname = $a->user['nickname']; @@ -950,7 +951,7 @@ class Profile * * @return string */ - function get_my_url() + public static function getMyURL() { if (x($_SESSION, 'my_url')) { return $_SESSION['my_url']; @@ -958,9 +959,9 @@ class Profile return null; } - function zrl_init(App $a) + public static function zrlInit(App $a) { - $my_url = get_my_url(); + $my_url = self::getMyURL(); $my_url = validate_url($my_url); if ($my_url) { // Is it a DDoS attempt? @@ -979,7 +980,7 @@ class Profile } } - function zrl($s, $force = false) + public static function zrl($s, $force = false) { if (!strlen($s)) { return $s; @@ -991,7 +992,7 @@ class Profile $s = $s . '/'; } $achar = strpos($s, '?') ? '&' : '?'; - $mine = get_my_url(); + $mine = self::getMyURL(); if ($mine && !link_compare($mine, $s)) { return $s . $achar . 'zrl=' . urlencode($mine); } @@ -999,7 +1000,7 @@ class Profile } /** - * @brief Get the user ID of the page owner + * Get the user ID of the page owner. * * Used from within PCSS themes to set theme parameters. If there's a * puid request variable, that is the "page owner" and normally their theme @@ -1007,12 +1008,13 @@ class Profile * system pconfig, which means they don't want to see anybody else's theme * settings except their own while on this site. * + * @brief Get the user ID of the page owner * @return int user ID * * @note Returns local_user instead of user ID if "always_my_theme" * is set to true */ - function get_theme_uid() + public static function getThemeUid() { $uid = ((!empty($_REQUEST['puid'])) ? intval($_REQUEST['puid']) : 0); if ((local_user()) && ((PConfig::get(local_user(), 'system', 'always_my_theme')) || (!$uid))) { @@ -1021,5 +1023,4 @@ class Profile return $uid; } - }