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