PluginProbe ʕ •ᴥ•ʔ
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress / 4.12.0
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress v4.12.0
4.12.0 4.10.0 4.9.0 4.8.1 trunk 1.0 1.1 1.12.1 1.2.3 1.2.4 1.2.5 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5 1.5.1 1.5.2 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.5.1 1.6.6 1.6.6.1 1.6.6.2 1.6.6.3 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.9.0 1.9.1 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.8.1 1.9.9 1.9.9.1 1.9.9.2 1.9.9.3 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.10 2.11 2.11.1 2.12 2.12.1 2.12.2 2.12.3 2.12.4 2.13 2.14 2.14.1 2.15 2.15.1 2.16 2.16.1 2.17 2.17.1 2.18 2.18.1 2.18.2 2.18.3 2.19 2.19.1 2.19.2 2.19.3 2.2 2.2.1 2.3 2.3.1 2.3.10 2.3.2 2.3.3 2.3.4 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.1.1 2.4.1.2 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5 2.5.1 2.5.2 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.7 2.7.1 2.7.2 2.8 2.9 2.9.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.7.5 4.7.6 4.7.7
custom-facebook-feed / inc / Integrations / Analytics / SB_Analytics.php
custom-facebook-feed / inc / Integrations / Analytics Last commit date
SB_Analytics.php 2 weeks ago index.php 2 weeks ago
SB_Analytics.php
147 lines
1 <?php
2
3 /**
4 * SB_Analytics plugin integration
5 * Class to impelement filters to return
6 * data needed in the SB_Analytics plugin
7 */
8
9 namespace CustomFacebookFeed\Integrations\Analytics;
10
11 use CustomFacebookFeed\Builder\CFF_Db;
12
13 if (!defined('ABSPATH')) {
14 exit; // Exit if accessed directly
15 }
16
17 class SB_Analytics
18 {
19 /**
20 * Summary of current_plugin
21 *
22 * @var string
23 */
24 private static $current_plugin = 'facebook';
25
26
27 /**
28 * Summary of __construct
29 */
30 public function __construct()
31 {
32 $this->init();
33 }
34
35 /**
36 * Summary of init
37 *
38 * @return void
39 */
40 public function init()
41 {
42 // Filter Top Posts
43 add_filter(
44 'sb_analytics_filter_top_posts',
45 [$this, 'filter_top_posts'],
46 10,
47 3
48 );
49
50 // Filter Profile Details
51 add_filter(
52 'sb_analytics_filter_profile_details',
53 [$this, 'filter_profile_details'],
54 10,
55 3
56 );
57
58 // Filter Feed Lists
59 add_filter(
60 'sb_analytics_filter_feed_list',
61 [$this, 'filter_feed_list'],
62 10,
63 3
64 );
65 }
66
67 /**
68 * Summary of filter_top_posts
69 *
70 * @param mixed $posts
71 * @param mixed $post_ids
72 * @param mixed $plugin_slug
73 *
74 * @return mixed
75 */
76 public function filter_top_posts($posts, $post_ids, $plugin_slug)
77 {
78 if ($plugin_slug !== self::$current_plugin) {
79 return $posts;
80 }
81
82 return CFF_Db::get_posts_by_ids($post_ids);
83 }
84
85 /**
86 * Summary of filter_profile_details
87 *
88 * @param mixed $profile_details
89 * @param mixed $feed_id
90 * @param mixed $plugin_slug
91 *
92 * @return mixed
93 */
94 public function filter_profile_details($profile_details, $feed_id, $plugin_slug)
95 {
96 if ($plugin_slug !== self::$current_plugin) {
97 return $profile_details;
98 }
99
100 $source = CFF_Db::get_feed_source_info($feed_id);
101 if (empty($source) || empty($source['name'])) {
102 return [];
103 }
104
105 return [
106 'id' => $source['id'],
107 'pluginSlug' => self::$current_plugin,
108 'profile' => [
109 'label' => $source['name'],
110 'imageSrc' => $source['picture']
111 ]
112 ];
113 }
114
115 /**
116 * Summary of filter_feed_list
117 *
118 * @param mixed $feeds
119 * @param mixed $plugin_slug
120 *
121 * @return mixed
122 */
123 public function filter_feed_list($feeds, $plugin_slug)
124 {
125 if ($plugin_slug !== self::$current_plugin) {
126 return $feeds;
127 }
128
129 $results = [];
130 $db_fees = CFF_Db::all_feeds_query(); // Get All stored Feeds
131
132 // Transform result feed schema
133 foreach ($db_fees as $feed) {
134 array_push(
135 $results,
136 [
137 'value' => [
138 'feed_id' => $feed['id'],
139 ],
140 'label' => $feed['feed_name'],
141 ]
142 );
143 }
144 return $results;
145 }
146 }
147