From 1be98d7b7fea30a929d27e7aa0b1412da3276b2c Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sat, 28 Oct 2017 01:22:59 +0200 Subject: :white_check_mark: Some more work on unit tests. Some small improvements for coverage report. Add more functions from include/text.php Update composer dev libraries for phpunit. --- include/feedutils.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'include/feedutils.php') diff --git a/include/feedutils.php b/include/feedutils.php index 217da8188..62fa4849a 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1662,8 +1662,6 @@ function handle_feed($uid, $abook_id, $url) { /** * @brief Return a XML tag with author information. * - * @hooks \b atom_author Possibility to add further tags to returned XML string - * * \e string The created XML tag as a string without closing tag * @param string $tag The XML tag to create * @param string $nick preferred username * @param string $name displayed name of the author @@ -1672,7 +1670,7 @@ function handle_feed($uid, $abook_id, $url) { * @param int $w image width * @param string $type profile photo mime type * @param string $photo Fully qualified URL to a profile/avator photo - * @return string + * @return string XML tag */ function atom_author($tag, $nick, $name, $uri, $h, $w, $type, $photo) { $o = ''; @@ -1695,6 +1693,11 @@ function atom_author($tag, $nick, $name, $uri, $h, $w, $type, $photo) { $o .= ' ' . $nick . '' . "\r\n"; $o .= ' ' . $name . '' . "\r\n"; + /** + * @hooks atom_author + * Possibility to add further tags to returned XML string. + * * \e string The created XML tag as a string without closing tag + */ call_hooks('atom_author', $o); $o .= "\r\n"; @@ -1703,17 +1706,23 @@ function atom_author($tag, $nick, $name, $uri, $h, $w, $type, $photo) { } -function atom_render_author($tag,$xchan) { +/** + * @brief Return an atom tag with author information from an xchan. + * + * @param string $tag + * @param array $xchan + * @return string + */ +function atom_render_author($tag, $xchan) { - - $nick = xmlify(substr($xchan['xchan_addr'],0,strpos($xchan['xchan_addr'],'@'))); + $nick = xmlify(substr($xchan['xchan_addr'], 0, strpos($xchan['xchan_addr'], '@'))); $id = xmlify($xchan['xchan_url']); $name = xmlify($xchan['xchan_name']); $photo = xmlify($xchan['xchan_photo_l']); $type = xmlify($xchan['xchan_photo_mimetype']); $w = $h = 300; - $o .= "<$tag>\r\n"; + $o = "<$tag>\r\n"; $o .= " http://activitystrea.ms/schema/1.0/person\r\n"; $o .= " $id\r\n"; $o .= " $nick\r\n"; @@ -1724,13 +1733,16 @@ function atom_render_author($tag,$xchan) { $o .= ' ' . $nick . '' . "\r\n"; $o .= ' ' . $name . '' . "\r\n"; + /** + * @hooks atom_render_author + * Possibility to add further tags to returned XML string. + * * \e string The created XML tag as a string without closing tag + */ call_hooks('atom_render_author', $o); $o .= "\r\n"; return $o; - - } function compat_photos_list($s) { -- cgit v1.2.3