PluginProbe ʕ •ᴥ•ʔ
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress / 4.9.0
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress v4.9.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 / CFF_FB_Settings.php
custom-facebook-feed / inc Last commit date
Admin 1 month ago Builder 1 month ago Helpers 1 month ago Integrations 1 month ago UsageTracking 1 month ago CFF_Autolink.php 1 month ago CFF_Blocks.php 1 month ago CFF_Cache.php 1 month ago CFF_Education.php 1 month ago CFF_Elementor_Base.php 1 month ago CFF_Elementor_Widget.php 1 month ago CFF_Error_Reporter.php 1 month ago CFF_FB_Settings.php 1 month ago CFF_Feed_Elementor_Control.php 1 month ago CFF_Feed_Locator.php 1 month ago CFF_Feed_Pro.php 1 month ago CFF_GDPR_Integrations.php 1 month ago CFF_Group_Posts.php 1 month ago CFF_HTTP_Request.php 1 month ago CFF_Oembed.php 1 month ago CFF_Parse.php 1 month ago CFF_Resizer.php 1 month ago CFF_Response.php 1 month ago CFF_Shortcode.php 1 month ago CFF_Shortcode_Display.php 1 month ago CFF_SiteHealth.php 1 month ago CFF_Utils.php 1 month ago CFF_View.php 1 month ago Custom_Facebook_Feed.php 1 month ago Email_Notification.php 1 month ago Platform_Data.php 1 month ago SB_Facebook_Data_Encryption.php 1 month ago SB_Facebook_Data_Manager.php 1 month ago index.php 1 month ago
CFF_FB_Settings.php
497 lines
1 <?php
2
3 /**
4 * Class CFF_FB_Options
5 *
6 * Creates a list of necessary options and atts for the Shortcode class
7 *
8 * @since 2.19
9 */
10
11 namespace CustomFacebookFeed;
12
13 if (! defined('ABSPATH')) {
14 die('-1');
15 }
16
17 class CFF_FB_Settings
18 {
19 /**
20 * @var array
21 */
22 protected $atts;
23
24 /**
25 * @var array
26 */
27 protected $options;
28
29 /**
30 * @var array
31 */
32 protected $settings;
33
34 /**
35 * @var id
36 */
37 protected $page_id;
38
39 /**
40 * @var string
41 */
42 protected $access_token;
43
44 /**
45 * CFF_FB_Options constructor.
46 *
47 * @param array $atts shortcode settings
48 * @param array $options settings from the wp_options table
49 *
50 * @since 2.19
51 */
52 public function __construct($atts, $options)
53 {
54 $this->atts = $atts;
55 $this->options = $options;
56
57 $include_string = $this->get_include_string();
58
59 $this->settings = shortcode_atts(
60 array(
61 'accesstoken' => trim(get_option('cff_access_token')),
62 'id' => get_option('cff_page_id'),
63 'pagetype' => get_option('cff_page_type'),
64 'num' => get_option('cff_num_show'),
65 'limit' => get_option('cff_post_limit'),
66 'others' => '',
67 'showpostsby' => get_option('cff_show_others'),
68 'cachetime' => get_option('cff_cache_time'),
69 'cacheunit' => get_option('cff_cache_time_unit'),
70 'locale' => get_option('cff_locale'),
71 'ajax' => get_option('cff_ajax'),
72 'offset' => '',
73 'account' => '',
74 'cff_enqueue_with_shortcode' => isset($options[ 'cff_enqueue_with_shortcode' ]) ? $options[ 'cff_enqueue_with_shortcode' ] : false,
75
76 // General
77 'width' => isset($options[ 'cff_feed_width' ]) ? $options[ 'cff_feed_width' ] : '',
78 'widthresp' => isset($options[ 'cff_feed_width_resp' ]) ? $options[ 'cff_feed_width_resp' ] : '',
79 'height' => isset($options[ 'cff_feed_height' ]) ? $options[ 'cff_feed_height' ] : '',
80 'padding' => isset($options[ 'cff_feed_padding' ]) ? $options[ 'cff_feed_padding' ] : '',
81 'bgcolor' => isset($options[ 'cff_bg_color' ]) ? $options[ 'cff_bg_color' ] : '',
82 'showauthor' => '',
83 'showauthornew' => isset($options[ 'cff_show_author' ]) ? $options[ 'cff_show_author' ] : '',
84 'class' => isset($options[ 'cff_class' ]) ? $options[ 'cff_class' ] : '',
85 'layout' => isset($options[ 'cff_preset_layout' ]) ? $options[ 'cff_preset_layout' ] : '',
86 'include' => $include_string,
87 'exclude' => '',
88 'gdpr' => isset($options[ 'gdpr' ]) ? $options[ 'gdpr' ] : 'auto',
89
90 // Cols
91 'cols' => isset($options[ 'cff_cols' ]) ? $options[ 'cff_cols' ] : '',
92 'colsmobile' => isset($options[ 'cff_cols_mobile' ]) ? $options[ 'cff_cols_mobile' ] : '',
93 'colsjs' => true,
94
95 // Mobile settings
96 'nummobile' => isset($options[ 'cff_num_mobile' ]) ? max(0, (int)$options[ 'cff_num_mobile' ]) : '',
97
98 // Post Style
99 'poststyle' => isset($options[ 'cff_post_style' ]) ? $options[ 'cff_post_style' ] : '',
100 'postbgcolor' => isset($options[ 'cff_post_bg_color' ]) ? $options[ 'cff_post_bg_color' ] : '',
101 'postcorners' => isset($options[ 'cff_post_rounded' ]) ? $options[ 'cff_post_rounded' ] : '',
102 'boxshadow' => isset($options[ 'cff_box_shadow' ]) ? $options[ 'cff_box_shadow' ] : '',
103
104 // Typography
105 'textformat' => isset($options[ 'cff_title_format' ]) ? $options[ 'cff_title_format' ] : '',
106 'textsize' => isset($options[ 'cff_title_size' ]) ? $options[ 'cff_title_size' ] : '',
107 'textweight' => isset($options[ 'cff_title_weight' ]) ? $options[ 'cff_title_weight' ] : '',
108 'textcolor' => isset($options[ 'cff_title_color' ]) ? $options[ 'cff_title_color' ] : '',
109 'textlinkcolor' => isset($options[ 'cff_posttext_link_color' ]) ? $options[ 'cff_posttext_link_color' ] : '',
110 'textlink' => isset($options[ 'cff_title_link' ]) ? $options[ 'cff_title_link' ] : '',
111 'posttags' => isset($options[ 'cff_post_tags' ]) ? $options[ 'cff_post_tags' ] : '',
112 'linkhashtags' => isset($options[ 'cff_link_hashtags' ]) ? $options[ 'cff_link_hashtags' ] : '',
113
114 // Description
115 'descsize' => isset($options[ 'cff_body_size' ]) ? $options[ 'cff_body_size' ] : '',
116 'descweight' => isset($options[ 'cff_body_weight' ]) ? $options[ 'cff_body_weight' ] : '',
117 'desccolor' => isset($options[ 'cff_body_color' ]) ? $options[ 'cff_body_color' ] : '',
118 'linktitleformat' => isset($options[ 'cff_link_title_format' ]) ? $options[ 'cff_link_title_format' ] : '',
119 'linktitlesize' => isset($options[ 'cff_link_title_size' ]) ? $options[ 'cff_link_title_size' ] : '',
120 'linkdescsize' => isset($options[ 'cff_link_desc_size' ]) ? $options[ 'cff_link_desc_size' ] : '',
121 'linkurlsize' => isset($options[ 'cff_link_url_size' ]) ? $options[ 'cff_link_url_size' ] : '',
122 'linkdesccolor' => isset($options[ 'cff_link_desc_color' ]) ? $options[ 'cff_link_desc_color' ] : '',
123 'linktitlecolor' => isset($options[ 'cff_link_title_color' ]) ? $options[ 'cff_link_title_color' ] : '',
124 'linkurlcolor' => isset($options[ 'cff_link_url_color' ]) ? $options[ 'cff_link_url_color' ] : '',
125 'linkbgcolor' => isset($options[ 'cff_link_bg_color' ]) ? $options[ 'cff_link_bg_color' ] : '',
126 'linkbordercolor' => isset($options[ 'cff_link_border_color' ]) ? $options[ 'cff_link_border_color' ] : '',
127 'disablelinkbox' => isset($options[ 'cff_disable_link_box' ]) ? $options[ 'cff_disable_link_box' ] : '',
128
129 // Author
130 'authorsize' => isset($options[ 'cff_author_size' ]) ? $options[ 'cff_author_size' ] : '',
131 'authorcolor' => isset($options[ 'cff_author_color' ]) ? $options[ 'cff_author_color' ] : '',
132
133 // Event title
134 'eventtitleformat' => isset($options[ 'cff_event_title_format' ]) ? $options[ 'cff_event_title_format' ] : '',
135 'eventtitlesize' => isset($options[ 'cff_event_title_size' ]) ? $options[ 'cff_event_title_size' ] : '',
136 'eventtitleweight' => isset($options[ 'cff_event_title_weight' ]) ? $options[ 'cff_event_title_weight' ] : '',
137 'eventtitlecolor' => isset($options[ 'cff_event_title_color' ]) ? $options[ 'cff_event_title_color' ] : '',
138 'eventtitlelink' => isset($options[ 'cff_event_title_link' ]) ? $options[ 'cff_event_title_link' ] : '',
139 // Event date
140 'eventdatesize' => isset($options[ 'cff_event_date_size' ]) ? $options[ 'cff_event_date_size' ] : '',
141 'eventdateweight' => isset($options[ 'cff_event_date_weight' ]) ? $options[ 'cff_event_date_weight' ] : '',
142 'eventdatecolor' => isset($options[ 'cff_event_date_color' ]) ? $options[ 'cff_event_date_color' ] : '',
143 'eventdatepos' => isset($options[ 'cff_event_date_position' ]) ? $options[ 'cff_event_date_position' ] : '',
144 'eventdateformat' => isset($options[ 'cff_event_date_formatting' ]) ? $options[ 'cff_event_date_formatting' ] : '',
145 'eventdatecustom' => isset($options[ 'cff_event_date_custom' ]) ? $options[ 'cff_event_date_custom' ] : '',
146 // Event details
147 'eventdetailssize' => isset($options[ 'cff_event_details_size' ]) ? $options[ 'cff_event_details_size' ] : '',
148 'eventdetailsweight' => isset($options[ 'cff_event_details_weight' ]) ? $options[ 'cff_event_details_weight' ] : '',
149 'eventdetailscolor' => isset($options[ 'cff_event_details_color' ]) ? $options[ 'cff_event_details_color' ] : '',
150 'eventlinkcolor' => isset($options[ 'cff_event_link_color' ]) ? $options[ 'cff_event_link_color' ] : '',
151 // Date
152 'datepos' => isset($options[ 'cff_date_position' ]) ? $options[ 'cff_date_position' ] : '',
153 'datesize' => isset($options[ 'cff_date_size' ]) ? $options[ 'cff_date_size' ] : '',
154 'dateweight' => isset($options[ 'cff_date_weight' ]) ? $options[ 'cff_date_weight' ] : '',
155 'datecolor' => isset($options[ 'cff_date_color' ]) ? $options[ 'cff_date_color' ] : '',
156 'dateformat' => isset($options[ 'cff_date_formatting' ]) ? $options[ 'cff_date_formatting' ] : '',
157 'datecustom' => isset($options[ 'cff_date_custom' ]) ? $options[ 'cff_date_custom' ] : '',
158 'beforedate' => isset($options[ 'cff_date_before' ]) ? $options[ 'cff_date_before' ] : '',
159 'afterdate' => isset($options[ 'cff_date_after' ]) ? $options[ 'cff_date_after' ] : '',
160 'timezone' => isset($options[ 'cff_timezone' ]) ? $options[ 'cff_timezone' ] : 'America/Chicago',
161
162 // Link to Facebook
163 'linksize' => isset($options[ 'cff_link_size' ]) ? $options[ 'cff_link_size' ] : '',
164 'linkweight' => isset($options[ 'cff_link_weight' ]) ? $options[ 'cff_link_weight' ] : '',
165 'linkcolor' => isset($options[ 'cff_link_color' ]) ? $options[ 'cff_link_color' ] : '',
166 'viewlinktext' => isset($options[ 'cff_view_link_text' ]) ? $options[ 'cff_view_link_text' ] : '',
167 'linktotimeline' => isset($options[ 'cff_link_to_timeline' ]) ? $options[ 'cff_link_to_timeline' ] : '',
168 // Social
169 'iconstyle' => isset($options[ 'cff_icon_style' ]) ? $options[ 'cff_icon_style' ] : '',
170 'socialtextcolor' => isset($options[ 'cff_meta_text_color' ]) ? $options[ 'cff_meta_text_color' ] : '',
171 'socialbgcolor' => isset($options[ 'cff_meta_bg_color' ]) ? $options[ 'cff_meta_bg_color' ] : '',
172 // Misc
173 'textlength' => get_option('cff_title_length'),
174 'desclength' => get_option('cff_body_length'),
175 'likeboxpos' => isset($options[ 'cff_like_box_position' ]) ? $options[ 'cff_like_box_position' ] : '',
176 'likeboxoutside' => isset($options[ 'cff_like_box_outside' ]) ? $options[ 'cff_like_box_outside' ] : '',
177 'likeboxcolor' => isset($options[ 'cff_likebox_bg_color' ]) ? $options[ 'cff_likebox_bg_color' ] : '',
178 'likeboxtextcolor' => isset($options[ 'cff_like_box_text_color' ]) ? $options[ 'cff_like_box_text_color' ] : '',
179 'likeboxwidth' => isset($options[ 'cff_likebox_width' ]) ? $options[ 'cff_likebox_width' ] : '',
180 'likeboxheight' => isset($options[ 'cff_likebox_height' ]) ? $options[ 'cff_likebox_height' ] : '',
181 'likeboxfaces' => isset($options[ 'cff_like_box_faces' ]) ? $options[ 'cff_like_box_faces' ] : '',
182 'likeboxborder' => isset($options[ 'cff_like_box_border' ]) ? $options[ 'cff_like_box_border' ] : '',
183 'likeboxcover' => isset($options[ 'cff_like_box_cover' ]) ? $options[ 'cff_like_box_cover' ] : '',
184 'likeboxsmallheader' => isset($options[ 'cff_like_box_small_header' ]) ? $options[ 'cff_like_box_small_header' ] : '',
185 'likeboxhidebtn' => isset($options[ 'cff_like_box_hide_cta' ]) ? $options[ 'cff_like_box_hide_cta' ] : '',
186
187 'credit' => isset($options[ 'cff_show_credit' ]) ? $options[ 'cff_show_credit' ] : '',
188 'nofollow' => 'true',
189 'disablestyles' => isset($options[ 'cff_disable_styles' ]) ? $options[ 'cff_disable_styles' ] : '',
190 'textissue' => isset($options[ 'cff_format_issue' ]) ? $options[ 'cff_format_issue' ] : '',
191 'restrictedpage' => isset($options[ 'cff_restricted_page' ]) ? $options[ 'cff_restricted_page' ] : '',
192 'salesposts' => 'false',
193 'storytags' => 'false',
194
195 // Page Header
196 'showheader' => isset($options[ 'cff_show_header' ]) ? $options[ 'cff_show_header' ] : '',
197 'headeroutside' => isset($options[ 'cff_header_outside' ]) ? $options[ 'cff_header_outside' ] : '',
198 'headertype' => isset($options[ 'cff_header_type' ]) ? $options[ 'cff_header_type' ] : '',
199 'headercover' => isset($options[ 'cff_header_cover' ]) ? $options[ 'cff_header_cover' ] : '',
200 'headeravatar' => isset($options[ 'cff_header_avatar' ]) ? $options[ 'cff_header_avatar' ] : '',
201 'headername' => isset($options[ 'cff_header_name' ]) ? $options[ 'cff_header_name' ] : '',
202 'headerbio' => isset($options[ 'cff_header_bio' ]) ? $options[ 'cff_header_bio' ] : '',
203 'headercoverheight' => isset($options[ 'cff_header_cover_height' ]) ? $options[ 'cff_header_cover_height' ] : '',
204 'headertext' => isset($options[ 'cff_header_text' ]) ? $options[ 'cff_header_text' ] : '',
205 'headerbg' => isset($options[ 'cff_header_bg_color' ]) ? $options[ 'cff_header_bg_color' ] : '',
206 'headerpadding' => isset($options[ 'cff_header_padding' ]) ? $options[ 'cff_header_padding' ] : '',
207 'headertextsize' => isset($options[ 'cff_header_text_size' ]) ? $options[ 'cff_header_text_size' ] : '',
208 'headertextweight' => isset($options[ 'cff_header_text_weight' ]) ? $options[ 'cff_header_text_weight' ] : '',
209 'headertextcolor' => isset($options[ 'cff_header_text_color' ]) ? $options[ 'cff_header_text_color' ] : '',
210 'headericon' => isset($options[ 'cff_header_icon' ]) ? $options[ 'cff_header_icon' ] : '',
211 'headericoncolor' => isset($options[ 'cff_header_icon_color' ]) ? $options[ 'cff_header_icon_color' ] : '',
212 'headericonsize' => isset($options[ 'cff_header_icon_size' ]) ? $options[ 'cff_header_icon_size' ] : '',
213 'headerinc' => '',
214 'headerexclude' => '',
215
216 'videoheight' => isset($options[ 'cff_video_height' ]) ? $options[ 'cff_video_height' ] : '',
217 'videoaction' => isset($options[ 'cff_video_action' ]) ? $options[ 'cff_video_action' ] : '',
218 'sepcolor' => isset($options[ 'cff_sep_color' ]) ? $options[ 'cff_sep_color' ] : '',
219 'sepsize' => isset($options[ 'cff_sep_size' ]) ? $options[ 'cff_sep_size' ] : '',
220
221 // Translate
222 'seemoretext' => isset($options[ 'cff_see_more_text' ]) ? stripslashes(esc_attr($options[ 'cff_see_more_text' ])) : '',
223 'seelesstext' => isset($options[ 'cff_see_less_text' ]) ? stripslashes(esc_attr($options[ 'cff_see_less_text' ])) : '',
224 'photostext' => isset($options[ 'cff_translate_photos_text' ]) ? stripslashes(esc_attr($options[ 'cff_translate_photos_text' ])) : '',
225 'phototext' => isset($options[ 'cff_translate_photo_text' ]) ? stripslashes(esc_attr($options[ 'cff_translate_photo_text' ])) : '',
226 'videotext' => isset($options[ 'cff_translate_video_text' ]) ? stripslashes(esc_attr($options[ 'cff_translate_video_text' ])) : '',
227
228 'learnmoretext' => isset($options[ 'cff_translate_learn_more_text' ]) ? stripslashes(esc_attr($options[ 'cff_translate_learn_more_text' ])) : '',
229 'shopnowtext' => isset($options[ 'cff_translate_shop_now_text' ]) ? stripslashes(esc_attr($options[ 'cff_translate_shop_now_text' ])) : '',
230 'messagepage' => isset($options[ 'cff_translate_message_page_text' ]) ? stripslashes(esc_attr($options[ 'cff_translate_message_page_text' ])) : '',
231
232 'facebooklinktext' => isset($options[ 'cff_facebook_link_text' ]) ? stripslashes(esc_attr($options[ 'cff_facebook_link_text' ])) : '',
233 'sharelinktext' => isset($options[ 'cff_facebook_share_text' ]) ? stripslashes(esc_attr($options[ 'cff_facebook_share_text' ])) : '',
234 'showfacebooklink' => isset($options[ 'cff_show_facebook_link' ]) ? $options[ 'cff_show_facebook_link' ] : '',
235 'showsharelink' => isset($options[ 'cff_show_facebook_share' ]) ? $options[ 'cff_show_facebook_share' ] : '',
236
237 'secondtext' => isset($options[ 'cff_translate_second' ]) ? stripslashes(esc_attr($options[ 'cff_translate_second' ])) : 'second',
238 'secondstext' => isset($options[ 'cff_translate_seconds' ]) ? stripslashes(esc_attr($options[ 'cff_translate_seconds' ])) : 'seconds',
239 'minutetext' => isset($options[ 'cff_translate_minute' ]) ? stripslashes(esc_attr($options[ 'cff_translate_minute' ])) : 'minute',
240 'minutestext' => isset($options[ 'cff_translate_minutes' ]) ? stripslashes(esc_attr($options[ 'cff_translate_minutes' ])) : 'minutes',
241 'hourtext' => isset($options[ 'cff_translate_hour' ]) ? stripslashes(esc_attr($options[ 'cff_translate_hour' ])) : 'hour',
242 'hourstext' => isset($options[ 'cff_translate_hours' ]) ? stripslashes(esc_attr($options[ 'cff_translate_hours' ])) : 'hours',
243 'daytext' => isset($options[ 'cff_translate_day' ]) ? stripslashes(esc_attr($options[ 'cff_translate_day' ])) : 'day',
244 'daystext' => isset($options[ 'cff_translate_days' ]) ? stripslashes(esc_attr($options[ 'cff_translate_days' ])) : 'days',
245 'weektext' => isset($options[ 'cff_translate_week' ]) ? stripslashes(esc_attr($options[ 'cff_translate_week' ])) : 'week',
246 'weekstext' => isset($options[ 'cff_translate_weeks' ]) ? stripslashes(esc_attr($options[ 'cff_translate_weeks' ])) : 'weeks',
247 'monthtext' => isset($options[ 'cff_translate_month' ]) ? stripslashes(esc_attr($options[ 'cff_translate_month' ])) : 'month',
248 'monthstext' => isset($options[ 'cff_translate_months' ]) ? stripslashes(esc_attr($options[ 'cff_translate_months' ])) : 'months',
249 'yeartext' => isset($options[ 'cff_translate_year' ]) ? stripslashes(esc_attr($options[ 'cff_translate_year' ])) : 'year',
250 'yearstext' => isset($options[ 'cff_translate_years' ]) ? stripslashes(esc_attr($options[ 'cff_translate_years' ])) : 'years',
251 'agotext' => isset($options[ 'cff_translate_ago' ]) ? stripslashes(esc_attr($options[ 'cff_translate_ago' ])) : 'ago'
252
253 ),
254 $atts
255 );
256 }
257
258 /**
259 * @return array
260 *
261 * @since 2.19
262 */
263 public function get_settings()
264 {
265 return $this->settings;
266 }
267
268 /**
269 * Get Include String for the Shortcode
270 *
271 * @return array
272 *
273 * @since 2.19
274 */
275 public function get_include_string()
276 {
277 $include_string = '';
278 $include_str_array = [
279 'cff_show_author' => 'author,',
280 'cff_show_text' => 'text,',
281 'cff_show_desc' => 'desc,',
282 'cff_show_shared_links' => 'sharedlinks,',
283 'cff_show_date' => 'date,',
284 'cff_show_media' => 'media,',
285 'cff_show_media_link' => 'medialink,',
286 'cff_show_event_title' => 'eventtitle,',
287 'cff_show_event_details' => 'eventdetails,',
288 'cff_show_meta' => 'social,',
289 'cff_show_link' => 'link,',
290 'cff_show_like_box' => 'likebox,'
291 ];
292 foreach ($include_str_array as $key => $value) {
293 if (isset($this->options[$key]) && $this->options[$key]) {
294 $include_string .= $value;
295 }
296 }
297 return $include_string;
298 }
299
300 /**
301 * @return array
302 *
303 * @since 2.19
304 */
305 public function get_id_and_token()
306 {
307 $id_and_token = [
308 'id' => trim($this->settings['id']),
309 'token' => $this->settings['accesstoken'],
310 'pagetype' => $this->settings['pagetype']
311 ];
312 // If an 'account' is specified then use that instead of the Page ID/token from the settings
313 $cff_account = trim($this->settings['account']);
314 $cff_connected_accounts = get_option('cff_connected_accounts');
315 $cff_connected_accounts = json_decode(str_replace('\"', '"', $cff_connected_accounts));
316 if (!empty($cff_account)) {
317 if (!empty($cff_connected_accounts) && isset($cff_connected_accounts->{ $cff_account })) {
318 // Grab the ID and token from the connected accounts setting
319 $id_and_token = [
320 'id' => $cff_connected_accounts->{ $cff_account }->{'id'},
321 'token' => $cff_connected_accounts->{ $cff_account }->{'accesstoken'},
322 'name' => $cff_connected_accounts->{ $cff_account }->{'name'},
323 'pagetype' => $cff_connected_accounts->{ $cff_account }->{'pagetype'}
324 ];
325 }
326 } else {
327 if (!empty($cff_connected_accounts)) {
328 $id_and_token['name'] = isset($cff_connected_accounts->{ $this->settings['id'] }->{'name'}) ? $cff_connected_accounts->{ $this->settings['id'] }->{'name'} : $this->settings['id'];
329 $id_and_token['pagetype'] = isset($cff_connected_accounts->{ $this->settings['id'] }->{'pagetype'}) ? $cff_connected_accounts->{ $this->settings['id'] }->{'pagetype'} : $this->settings['pagetype'];
330 }
331 }
332 $id_and_token['id'] = $this->check_page_id($id_and_token['id']);
333 $this->page_id = $id_and_token['id'];
334 $this->access_token = $id_and_token['token'];
335
336 return $id_and_token;
337 }
338
339 public function set_page_id($page_id)
340 {
341 $this->settings['id'] = $page_id;
342 }
343
344
345 /**
346 *
347 * Check the Page ID
348 *
349 * @return array
350 * @since 2.19
351 */
352 public function check_page_id($page_id)
353 {
354 // If user pastes their full URL into the Page ID field then strip it out
355 $cff_page_id_url_check = CFF_Utils::stripos($page_id, 'facebook.com');
356 if ($cff_page_id_url_check) {
357 $fb_url_pattern = '/^https?:\/\/(?:www|m)\.facebook.com\/(?:profile\.php\?id=)?([a-zA-Z0-9\.]+)$/';
358 $page_id = ( !preg_match($fb_url_pattern, $page_id, $matches) ) ? '' : $matches[1];
359 }
360 return $page_id;
361 }
362
363 public static function feed_type_and_terms_display($connected_accounts, $result, $database_settings)
364 {
365 $feeds_list = explode(',', $result['feed_id']);
366 $types = [];
367 $names = [];
368 foreach ($feeds_list as $feed_id) {
369 $account_settings = new CFF_FB_Settings(json_decode($result['shortcode_atts']), $database_settings);
370 $account_settings->set_page_id($feed_id);
371 $account_info = $account_settings->get_id_and_token();
372 if (!in_array($account_info['pagetype'], $types)) {
373 array_push($types, $account_info['pagetype']);
374 }
375 $account_name = (isset($account_info['name']) && $account_info['name'] != '') ? urldecode($account_info['name']) : $feed_id;
376 array_push($names, $account_name);
377 }
378 return [
379 'type' => $types,
380 'name' => $names,
381 ];
382 }
383
384 /**
385 * Check Active Extensions
386 *
387 * @return array
388 *
389 * @since 3.18
390 */
391 public static function check_active_extension($extension_name)
392 {
393 return false;
394 }
395
396 /* 3.0 new methods */
397
398 /**
399 * Returns the global settings with shortcode attributes applied for legacy feeds.
400 *
401 * @param $shortcode_atts
402 *
403 * @return array
404 */
405 public static function get_legacy_settings($shortcode_atts)
406 {
407 $encryption = new SB_Facebook_Data_Encryption();
408 $options = get_option('cff_legacy_feed_settings', array());
409 $options = $encryption->maybe_decrypt($options);
410
411 if (! empty($options)) {
412 $options = json_decode($options, true);
413 if (empty($options['id']) || empty($options['sources'])) {
414 $options['sources'] = isset($options['id']) && ! isset($options['sources']) ? $options['id'] : '';
415 $options['id'] = $options['sources'];
416 } else {
417 if (! empty($options['sources']) && is_string($options['sources'])) {
418 $options['id'] = $options['sources'];
419 }
420 }
421
422 if (! is_numeric($options['id'])) {
423 $id_for_slug = \CustomFacebookFeed\Builder\CFF_Source::get_id_from_slug($options['id']);
424
425 if ($id_for_slug) {
426 $options['id'] = $id_for_slug;
427 }
428 }
429 } else {
430 $old_options = get_option('cff_style_settings', array());
431
432 $legacy_feed_settings_obj = new \CustomFacebookFeed\CFF_FB_Settings(array(), $old_options);
433
434 $to_save = $legacy_feed_settings_obj->get_settings();
435
436 $settings_with_multiples = array(
437 'type',
438 'include',
439 'exclude'
440 );
441
442 foreach ($settings_with_multiples as $multiple_key) {
443 if (
444 isset($to_save[ $multiple_key ])
445 && ! is_array($to_save[ $multiple_key ])
446 ) {
447 $to_save[ $multiple_key ] = explode(',', $to_save[ $multiple_key ]);
448 }
449 }
450
451 if (
452 $to_save['cols'] > 1
453 || $to_save['colsmobile'] > 1
454 ) {
455 $to_save['feedlayout'] = 'masonry';
456 } else {
457 $to_save['feedlayout'] = 'list';
458 }
459 $to_save['feedtype'] = 'timeline';
460
461 if (! in_array('likebox', $to_save['include'])) {
462 $to_save['showlikebox'] = 'off';
463 }
464 if (! in_array('author', $to_save['include'])) {
465 $to_save['showauthornew'] = false;
466 } else {
467 $to_save['showauthornew'] = true;
468 }
469 if (! in_array('link', $to_save['include'])) {
470 $to_save['showfacebooklink'] = '';
471 $to_save['showsharelink'] = '';
472 } else {
473 $to_save['showfacebooklink'] = 'on';
474 $to_save['showsharelink'] = 'on';
475 }
476 $to_save['showfacebooklink'] = $to_save['showfacebooklink'] === 'on' || $to_save['showfacebooklink'] === 'true' ? 'on' : '';
477 $to_save['showsharelink'] = $to_save['showsharelink'] === 'on' || $to_save['showsharelink'] === 'true' ? 'on' : '';
478
479 $to_save['textlength'] = get_option('cff_title_length', '400');
480 $to_save['desclength'] = get_option('cff_body_length', '200');
481
482 $to_save_json = \CustomFacebookFeed\CFF_Utils::cff_json_encode($to_save);
483
484 update_option('cff_legacy_feed_settings', $to_save_json);
485
486 $options = $to_save;
487 }
488
489 $legacy_settings_with_updated_defaults = wp_parse_args($options, \CustomFacebookFeed\Builder\CFF_Feed_Saver::settings_defaults());
490
491 $legacy_settings = wp_parse_args($shortcode_atts, $legacy_settings_with_updated_defaults);
492 $legacy_settings['id'] = ! empty($legacy_settings['account']) ? $legacy_settings['account'] : $legacy_settings['id'];
493
494 return $legacy_settings;
495 }
496 }
497