PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.11.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.11.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/Functions/Utility.php +40 -0 2.8.12.11.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()
@@ -476,8 +477,29 @@
476 477
477 478 return $settings;
478 479 }
479 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 +
480 502 public static function hasEmailAnnouncementEnabled()
481 503 {
482 504 $settings = self::getEmailNotificationSettings();
483 505 return Arr::get($settings, 'mention_mail', 'no') === 'yes';
@@ -528,8 +550,25 @@
528 550 $key = 'fluent_community_post_topics';
529 551 $topics = self::getFromCache($key, function () {
530 552 $topics = Term::where('taxonomy_name', 'post_topic')->orderBy('title', 'ASC')->get();
531 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 +
532 571 /*
533 572 * object_id = term_id
534 573 * meta_key = space_id
535 574 */
@@ -552,8 +591,9 @@
552 591 'title' => $topic->title,
553 592 'description' => $topic->description,
554 593 'slug' => $topic->slug,
555 594 'admin_only' => Arr::get($topic->settings, 'admin_only', 'no'),
595 + 'serial' => Arr::get($topic->settings, 'serial'),
556 596 'space_ids' => isset($relations[$topic->id]) ? $relations[$topic->id] : []
557 597 ];
558 598 }
559 599