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.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 1.1.0 All 77 releases
← All changes | app/Functions/Utility.php +90 -1 2.5.02.10.0 View file →
@@ -10,8 +10,9 @@
10 10 use FluentCommunity\App\Services\FeedsHelper;
11 11 use FluentCommunity\App\Services\Helper;
12 12 use FluentCommunity\Framework\Support\Arr;
13 13 use FluentCommunity\Modules\Course\Model\Course;
14 +use FluentCommunity\Modules\PushNotification\PushNotificationModule;
14 15
15 16 class Utility
16 17 {
17 18 public static function isDev()
@@ -116,8 +117,9 @@
116 117 'has_crm_sync' => 'no',
117 118 'content_moderation' => 'no',
118 119 'followers_module' => 'no',
119 120 'custom_profile_fields' => 'no',
121 + 'pwa_module' => 'no',
120 122 ];
121 123
122 124 if (defined('FLUENT_COMMUNITY_CLOUD_STORAGE') && FLUENT_COMMUNITY_CLOUD_STORAGE) {
123 125 $features['cloud_storage'] = 'yes';
@@ -134,8 +136,9 @@
134 136 $features['cloud_storage'] = 'no';
135 137 $features['user_badge'] = 'no';
136 138 $features['followers_module'] = 'no';
137 139 $features['custom_profile_fields'] = 'no';
140 + $features['pwa_module'] = 'no';
138 141 }
139 142
140 143 return $features;
141 144 }
@@ -201,8 +204,9 @@
201 204 }
202 205
203 206 $defaults = [
204 207 'dark_mode' => 'yes',
208 + 'default_theme_mode' => 'light',
205 209 'fixed_page_header' => 'yes',
206 210 'show_powered_by' => 'yes',
207 211 'feed_link_on_sidebar' => 'yes',
208 212 'show_post_modal' => 'yes',
@@ -217,9 +221,10 @@
217 221 'max_media_per_post' => 4,
218 222 'disable_feed_sort_by' => 'no',
219 223 'default_feed_sort_by' => '',
220 224 'collapse_sidebar_groups' => 'no',
221 - 'hide_header_on_scroll' => 'no'
225 + 'hide_header_on_scroll' => 'no',
226 + 'enable_sidebar_toggle' => 'no'
222 227 ];
223 228 $settings = self::getOption('customization_settings', $defaults);
224 229
225 230 $settings = wp_parse_args($settings, $defaults);
@@ -228,8 +233,9 @@
228 233 $settings['show_powered_by'] = 'yes';
229 234 $settings['affiliate_id'] = '';
230 235 $settings['rich_post_layout'] = 'classic';
231 236 $settings['member_list_layout'] = 'classic';
237 + $settings['enable_sidebar_toggle'] = 'no';
232 238 }
233 239 return $settings;
234 240 }
235 241
@@ -259,13 +265,15 @@
259 265
260 266 $defaults = [
261 267 'can_customize_username' => 'no',
262 268 'can_change_email' => 'no',
269 + 'can_change_password' => 'yes',
263 270 'show_last_activity' => 'yes',
264 271 'can_deactive_account' => 'no',
265 272 'email_auto_login' => 'yes',
266 273 'enable_gravatar' => 'yes',
267 274 'enable_user_sync' => 'yes',
275 + 'skip_crm_undeliverable_emails' => 'yes',
268 276 'members_page_status' => 'everybody', // everybody, logged_in, admin_only
269 277 'profile_page_visibility' => 'everybody', // everybody, logged_in, admin_only
270 278 'user_space_visibility' => 'everybody', // everybody, logged_in, admin_only
271 279 'leaderboard_members_visibility' => 'everybody', // everybody, logged_in, admin_only
@@ -341,8 +349,12 @@
341 349 {
342 350 $preSettings = self::getPrivacySettings();
343 351 $settings = Arr::only($settings, array_keys($preSettings));
344 352
353 + $settings = array_map(function ($value) {
354 + return is_scalar($value) ? sanitize_text_field($value) : '';
355 + }, $settings);
356 +
345 357 self::updateOption('privacy_settings', $settings);
346 358 self::forgetCache('privacy_settings');
347 359
348 360 return $settings;
@@ -386,8 +398,46 @@
386 398 ], $url);
387 399 }
388 400
389 401 /**
402 + * Build a spec-compliant "Upgrade to Pro" URL.
403 + *
404 + * Follows the shared Fluent* UTM spec:
405 + * utm_source = fluent-community (fixed vocabulary, never the wp.org slug)
406 + * utm_medium = free_plugin | pro_plugin (acquisition vs cross-sell)
407 + * utm_campaign= upgrade_pro (override for xsell_<target> / license_* )
408 + * utm_content = the exact placement, e.g. feature_lock_moderation, upgrade_page
409 + * utm_term = plugin version that generated the link
410 + * utm_id = promo id, blank normally (omit unless passed)
411 + *
412 + * @param string $content The utm_content placement.
413 + * @param array $overrides Override any utm_* param (e.g. utm_campaign for cross-sell).
414 + * @return string
415 + */
416 + public static function getProUpgradeUrl($content = 'upgrade_page', $overrides = [])
417 + {
418 + $baseUrl = apply_filters(
419 + 'fluent_community/pro_upgrade_base_url',
420 + 'https://fluentcommunity.co/pricing/'
421 + );
422 +
423 + $params = wp_parse_args($overrides, [
424 + 'utm_source' => 'fluent-community',
425 + 'utm_medium' => defined('FLUENT_COMMUNITY_PRO_VERSION') ? 'pro_plugin' : 'free_plugin',
426 + 'utm_campaign' => 'upgrade_pro',
427 + 'utm_content' => $content,
428 + 'utm_term' => FLUENT_COMMUNITY_PLUGIN_VERSION,
429 + ]);
430 +
431 + // Drop any blank params (e.g. an unset utm_id) so they never hit the URL.
432 + $params = array_filter($params, function ($value) {
433 + return $value !== '' && $value !== null;
434 + });
435 +
436 + return add_query_arg($params, $baseUrl);
437 + }
438 +
439 + /**
390 440 * Get the email notification settings.
391 441 *
392 442 * @return array The email notification settings.
393 443 */
@@ -427,8 +477,29 @@
427 477
428 478 return $settings;
429 479 }
430 480
481 + public static function getPushNotificationSettings()
482 + {
483 + static $settings;
484 + if ($settings) return $settings;
485 +
486 + $default = [
487 + 'push_enabled' => 'yes',
488 + 'com_my_post_push' => 'yes',
489 + 'reply_my_com_push' => 'yes',
490 + 'mention_push' => 'yes',
491 + 'co_com_push' => 'yes',
492 + 'prompt_placements' => PushNotificationModule::PROMPT_PLACEMENTS
493 + ];
494 +
495 + $settings = self::getOption('global_push_settings', $default);
496 +
497 + $settings = wp_parse_args($settings, $default);
498 +
499 + return $settings;
500 + }
501 +
431 502 public static function hasEmailAnnouncementEnabled()
432 503 {
433 504 $settings = self::getEmailNotificationSettings();
434 505 return Arr::get($settings, 'mention_mail', 'no') === 'yes';
@@ -479,8 +550,25 @@
479 550 $key = 'fluent_community_post_topics';
480 551 $topics = self::getFromCache($key, function () {
481 552 $topics = Term::where('taxonomy_name', 'post_topic')->orderBy('title', 'ASC')->get();
482 553
554 + // Respect the admin-defined order (settings.serial) when present;
555 + // topics without a serial fall back to the alphabetical order above.
556 + $topics = $topics->sort(function ($a, $b) {
557 + $serialA = Arr::get($a->settings, 'serial');
558 + $serialB = Arr::get($b->settings, 'serial');
559 + if ($serialA === null && $serialB === null) {
560 + return 0;
561 + }
562 + if ($serialA === null) {
563 + return 1;
564 + }
565 + if ($serialB === null) {
566 + return -1;
567 + }
568 + return (int) $serialA <=> (int) $serialB;
569 + })->values();
570 +
483 571 /*
484 572 * object_id = term_id
485 573 * meta_key = space_id
486 574 */
@@ -503,8 +591,9 @@
503 591 'title' => $topic->title,
504 592 'description' => $topic->description,
505 593 'slug' => $topic->slug,
506 594 'admin_only' => Arr::get($topic->settings, 'admin_only', 'no'),
595 + 'serial' => Arr::get($topic->settings, 'serial'),
507 596 'space_ids' => isset($relations[$topic->id]) ? $relations[$topic->id] : []
508 597 ];
509 598 }
510 599