function translateHtml($html, $url, $password) { return translateContent($html, $url, $password, 'text/html'); }
/** * Calculate the user-specific information on a category. * * @param array &$category The category to calculate. */ private function calculateUser(&$category, $addUserCategory = null) { $category['Url'] = url($category['Url'], '//'); if ($Photo = val('Photo', $category)) { $category['PhotoUrl'] = Gdn_Upload::url($Photo); } if (!empty($category['LastUrl'])) { $category['LastUrl'] = url($category['LastUrl'], '//'); } $session = Gdn::session(); $permissionID = $category['PermissionCategoryID']; $category['PermsDiscussionsView'] = $session->checkPermission('Vanilla.Discussions.View', true, 'Category', $permissionID); $category['PermsDiscussionsAdd'] = $session->checkPermission('Vanilla.Discussions.Add', true, 'Category', $permissionID); $category['PermsDiscussionsEdit'] = $session->checkPermission('Vanilla.Discussions.Edit', true, 'Category', $permissionID); $category['PermsCommentsAdd'] = $session->checkPermission('Vanilla.Comments.Add', true, 'Category', $permissionID); $Code = $category['UrlCode']; $category['Name'] = translateContent("Categories." . $Code . ".Name", $category['Name']); $category['Description'] = translateContent("Categories." . $Code . ".Description", $category['Description']); if ($addUserCategory || $addUserCategory === null && $this->joinUserCategory()) { $userCategories = $this->getUserCategories(); $dateMarkedRead = val('DateMarkedRead', $category); $userData = val($category['CategoryID'], $userCategories); if ($userData) { $userDateMarkedRead = $userData['DateMarkedRead']; if (!$dateMarkedRead || $userDateMarkedRead && Gdn_Format::toTimestamp($userDateMarkedRead) > Gdn_Format::toTimestamp($dateMarkedRead)) { $category['DateMarkedRead'] = $userDateMarkedRead; $dateMarkedRead = $userDateMarkedRead; } $category['Unfollow'] = $userData['Unfollow']; } else { $category['Unfollow'] = false; } // Calculate the following field. $Following = !((bool) val('Archived', $category) || (bool) val('Unfollow', $userData, false)); $category['Following'] = $Following; // Calculate the read field. if (strcasecmp($category['DisplayAs'], 'heading') === 0) { $category['Read'] = false; } elseif ($dateMarkedRead) { if (val('LastDateInserted', $category)) { $category['Read'] = Gdn_Format::toTimestamp($dateMarkedRead) >= Gdn_Format::toTimestamp($category['LastDateInserted']); } else { $category['Read'] = true; } } else { $category['Read'] = false; } } }