PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.0
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
← All changes | app/Services/Helper.php +25 -3 2.9.02.10.0 View file →
@@ -1349,8 +1349,30 @@
1349 1349
1350 1350 return $menuGroups;
1351 1351 }
1352 1352
1353 + /**
1354 + * Drop the links the given user may not see.
1355 + *
1356 + * Space links carry their own privacy, so every place that hands a space's settings
1357 + * to a client has to filter them. Doing that inline is how the feed endpoints came
1358 + * to skip it, so both call sites go through here.
1359 + *
1360 + * @param array $links
1361 + * @param \FluentCommunity\App\Models\User|null $currentUser
1362 + * @return array
1363 + */
1364 + public static function filterAccessibleLinks($links, $currentUser = null)
1365 + {
1366 + if (!$links || !is_array($links)) {
1367 + return [];
1368 + }
1369 +
1370 + return array_values(array_filter($links, function ($link) use ($currentUser) {
1371 + return self::isLinkAccessible($link, $currentUser);
1372 + }));
1373 + }
1374 +
1353 1375 public static function isLinkAccessible($link, $currentUser = null)
1354 1376 {
1355 1377 $isEnabled = Arr::get($link, 'enabled', 'yes') === 'yes';
1356 1378 $isUnavailable = Arr::get($link, 'is_unavailable') === 'yes';
@@ -1862,15 +1884,15 @@
1862 1884 'rel' => Arr::get($link, 'new_tab') === 'yes' ? 'noopener noreferrer' : '',
1863 1885 ]);
1864 1886
1865 1887 ?>
1866 - <a data-fcom-tip="<?php echo esc_attr(Arr::get($link, 'title')); ?>"
1867 - title="<?php echo esc_attr(Arr::get($link, 'title')); ?>"
1888 + <a data-fcom-hint="<?php echo esc_attr(Arr::get($link, 'title')); ?>"
1868 1889 href="<?php echo esc_url($link['permalink']); ?>"<?php foreach ($linkAtts as $key => $value) {
1869 1890 echo ' ' . esc_attr($key) . '="' . esc_attr($value) . '"';
1870 1891 } ?>>
1871 1892 <?php $renderIcon && self::printLinkIcon($link, $fallback); ?>
1872 - <span class="community_name"><?php echo wp_kses_post(Arr::get($link, 'title')); ?></span>
1893 + <?php // The native title sits on the label span (not the anchor) so it can not duplicate the link's accessible name for screen readers. ?>
1894 + <span class="community_name" title="<?php echo esc_attr(Arr::get($link, 'title')); ?>"><?php echo wp_kses_post((string) Arr::get($link, 'title', '')); ?></span>
1873 1895 <?php if (Arr::get($link, 'show_lock')) : ?>
1874 1896 <span class="fcom_space_lock">
1875 1897 <i class="el-icon">
1876 1898 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">