PluginProbe
GetResponse Forms by Optin Cat / 2.0.2
GetResponse Forms by Optin Cat v2.0.2
1.3.4 1.3.5 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 2.0.0 All 36 releases
← All changes | includes/eoi-functions.php +423 -83 1.5.12.0.2 View file →
@@ -1,124 +1,464 @@
1 1 <?php
2 2
3 +require_once FCA_EOI_PLUGIN_DIR . 'includes/classes/k/k.php';
3 4
4 -/* ADD ANIMATION CSS TO FRONT-END AND ADMIN PAGES WHEN ENABLED */
5 -add_action( 'fca_eoi_display_lightbox', 'fca_eoi_load_animation_script_popup' );
6 -add_action( 'fca_eoi_render_animation_meta_box', 'fca_eoi_load_animation_script_popup' );
7 5
6 +function fca_eoi_tooltip ( $text = 'Tooltip', $icon = 'dashicons dashicons-editor-help' ) {
7 + return "<span class='$icon fca_eoi_tooltip' title='" . htmlentities( $text ) . "'></span>";
8 +}
9 +
10 +
8 11 /* REMOVE LINKS FOR USERS WITH FEWER PERMISSIONS THAN EDITOR */
9 12
10 -function FCA_EOI_remove_admin_bar_link() {
11 - if (!current_user_can( 'delete_others_pages' )){
13 +function fca_eoi_remove_admin_bar_link() {
14 + if (!current_user_can( 'delete_others_pages' ) && function_exists( 'remove_meta_box' )){
12 15 remove_meta_box( 'fca_eoi_dashboard_widget', 'dashboard', 'normal' );
13 16 }
14 17 }
18 +add_action( 'wp_dashboard_setup', 'fca_eoi_remove_admin_bar_link', 50 );
15 19
16 -add_action( 'wp_before_admin_bar_render', 'FCA_EOI_remove_admin_bar_link' );
20 +function fca_eoi_get_error_texts($post_meta) {
21 +
22 + $name_error = empty ( $post_meta[ 'error_text_field_required' ] ) ? "Please enter a valid email address. For example \"example@example.com\"." : $post_meta[ 'error_text_field_required' ];
23 + $email_error = empty ( $post_meta[ 'error_text_invalid_email' ] ) ? 'Please fill out this field to continue.' : $post_meta[ 'error_text_invalid_email' ];
24 +
25 + $errorTexts = array(
26 + 'field_required' => $name_error,
27 + 'invalid_email' => $email_error,
28 + );
29 +
30 + return $errorTexts;
31 +}
17 32
18 -$fca_eoi_animation_enabled = false; //ONLY ENQUEUE WHEN ITS TURNED ON
33 +function fca_eoi_get_thanks_mode($post_meta) {
19 34
20 -function fca_eoi_load_animation_script_popup() {
21 - global $fca_eoi_animation_enabled;
22 - if ( $fca_eoi_animation_enabled ) {
23 - wp_enqueue_style( 'fca_eoi_powerups_animate', FCA_EOI_PLUGIN_URL . '/assets/vendor/animate/animate.css' );
24 - }
35 + $mode = empty ( $post_meta[ 'thankyou_page_mode' ] ) ? 'ajax' : $post_meta[ 'thankyou_page_mode' ];
36 + return $mode;
25 37 }
26 38
27 -function fca_eoi_get_error_texts($id) {
39 +
40 +//CHECK IF USER HAS AN ACTIVE CUSTOM FORM IN ONE OF THEIR OPT INS, OTHERWISE TURN OFF THIS FEATURE
41 +function fca_eoi_set_custom_form_depreciation() {
42 +
43 + $optins_using_customform = get_posts( array(
44 + 'post_type' => 'easy-opt-ins',
45 + 'posts_per_page' => -1,
46 + 'post_status' => 'any',
47 + 'meta_key' => 'fca_eoi_provider',
48 + 'meta_value' => 'customform',
28 49
29 - $post_meta = get_post_meta( $id , 'fca_eoi', true );
30 - $errorTexts = array(
31 - 'field_required' => $post_meta[ 'error_text_field_required' ],
32 - 'invalid_email' => $post_meta[ 'error_text_invalid_email' ],
33 - );
50 + ));
51 +
52 + $forms_in_trash = get_posts( array(
53 + 'post_type' => 'easy-opt-ins',
54 + 'posts_per_page' => -1,
55 + 'post_status' => 'trash',
56 + 'meta_key' => 'fca_eoi_provider',
57 + 'meta_value' => 'customform',
34 58
35 - if (!empty($errorTexts['field_required']) AND !empty($errorTexts['invalid_email'])) {
36 - return array(
37 - 'field_required' => $errorTexts['field_required'],
38 - 'invalid_email' => $errorTexts['invalid_email'],
39 - );
40 -
41 - }else{
42 -
43 - return array(
44 - 'field_required' => 'Error: This field is required.',
45 - 'invalid_email' => "Error: Please enter a valid email address. For example \"max@domain.com\"."
46 - );
47 - }
59 + ));
60 +
61 + if ( count ( $optins_using_customform ) > 0 OR count ( $forms_in_trash ) > 0) {
62 + update_option ( 'fca_eoi_allow_customform', 'true' );
63 + } else {
64 + update_option ( 'fca_eoi_allow_customform', 'false' );
65 + }
66 +
48 67 }
49 68
50 -function fca_eoi_get_thanks_mode($id) {
69 +function fca_eoi_get_html( $form_id, $fca_eoi_meta ) {
70 +
71 + $selected_layout = $fca_eoi_meta[ 'layout' ];
72 +
73 + if( empty( $selected_layout ) OR empty ( $fca_eoi_meta ) ) {
74 + return 'Form data missing';
75 + }
76 +
77 + $list_ids = array ( 'mailchimp_list_id', 'campaignmonitor_list_id', 'getresponse_list_id', 'aweber_list_id', 'drip_list_id' );
78 + $list_id = 'Not Set';
79 +
80 + forEach ($list_ids as $id ) {
81 + if ( !empty ($fca_eoi_meta[$id]) ) {
82 + $list_id = $fca_eoi_meta[$id];
83 + break;
84 + }
85 + }
51 86
52 - $post_meta = get_post_meta( $id , 'fca_eoi', true );
53 -
54 - $mode = $post_meta[ 'thankyou_page_mode' ];
55 -
56 - if (empty ($mode)) {
57 - $mode = 'not set';
87 + $errorTexts = fca_eoi_get_error_texts($fca_eoi_meta);
88 +
89 + //determine if ajax or thank you page redirect
90 + $thanks_mode = fca_eoi_get_thanks_mode($fca_eoi_meta);
91 + if ( $thanks_mode === 'redirect' ) {
92 + $mode = empty ( $fca_eoi_meta[ 'redirect_page_mode' ] ) ? 'page' : $fca_eoi_meta[ 'redirect_page_mode' ];
93 + $home_url = get_site_url();
94 + if ( $mode === 'page' ) {
95 + $thanks_page = get_permalink( K::get_var( 'thank_you_page', $fca_eoi_meta, $home_url ) );
96 + } else {
97 + $thanks_page = empty ( $fca_eoi_meta[ 'thank_you_url' ] ) ? $home_url : $fca_eoi_meta[ 'thank_you_url' ];
58 98 }
59 99
60 - return $mode;
100 + } else {
101 + $thanks_page = htmlentities ( K::get_var( 'thankyou_ajax', $fca_eoi_meta, 'Thank you! Please check your inbox for your confirmation email.' ), ENT_QUOTES, "UTF-8");
102 + }
103 +
104 + $sub_msg = htmlentities ( K::get_var( 'subscribing_message', $fca_eoi_meta, 'Subscribing...' ), ENT_QUOTES, "UTF-8");
105 +
106 + $cookie_dur = K::get_var( 'success_duration', $fca_eoi_meta['publish_lightbox'], 0 );
107 +
108 + $layout_helper = new EasyOptInsLayout( $selected_layout );
109 + $php_path = $layout_helper->path_to_resource( 'layout', 'php' );
110 + $html_path = $layout_helper->path_to_resource( 'layout', 'html' );
111 + $html_wrap_path = $layout_helper->path_to_html_wrapper();
112 + $scss_path = $layout_helper->path_to_resource( 'layout', 'scss' );
61 113
62 -}
114 + $form_wrapper = '';
115 + $form_wrapper_end = '';
63 116
64 -function fca_eoi_migrate_css() {
117 + if ( $layout_helper->layout_type != 'lightbox' ) {
118 + $form_wrapper =
119 + '<div class="' .
120 + 'fca_eoi_form_wrapper ' .
121 + $layout_helper->layout_class . '_wrapper ' .
122 + 'fca_eoi_layout_' . $layout_helper->layout_number . '_wrapper' .
123 + '">';
124 + $form_wrapper_end = '</div>';
125 + }
65 126
66 - require_once FCA_EOI_PLUGIN_DIR . 'powerups/4_new_css/powerup.php';
127 + //SET UP TEMPLATE
128 +
129 + $layout_html = str_replace('{{{layout}}}', file_get_contents( $html_path ), file_get_contents( $html_wrap_path ));
130 +
131 + global $dh_easy_opt_ins_plugin;
132 +
133 + if ( $dh_easy_opt_ins_plugin->post_type_obj->settings[ 'distribution' ] === 'free' ) {
134 + $banding = K::get_var( 'show_fatcatapps_link', $fca_eoi_meta, false );
135 + $banding = $banding ? "<div class='fca_eoi_layout_fatcatapps_link_wrapper fca_eoi_form_text_element'><a href='https://fatcatapps.com/optincat/' target='_blank'>Powered by Optin Cat</a></div>" : '';
136 + } else {
137 + $banding = '';
138 + }
139 +
140 + $animation = get_post_meta( $form_id, 'fca_eoi_animation', true );
141 + $animation_class = ( empty ( $animation ) || $animation == 'None' ) ? '' : "animated $animation";
142 +
143 +
144 + if ( $layout_helper->layout_type === 'banner' ) {
145 + $push_page = K::get_var( 'push_page', $fca_eoi_meta, 'on' );
146 + $toggle_position = K::get_var( 'toggle_overlay_position', $fca_eoi_meta, 'off' );
67 147
68 - //CHECK CURRENT SETTING
69 - $isActive = powerup_new_css_is_active();
148 + if ( $push_page === 'on' && $toggle_position === 'off' ) {
149 + $push_page = 'down';
150 + }
151 +
152 + if ( $push_page === 'on' && $toggle_position === 'on' ) {
153 + $push_page = 'up';
154 + }
155 + } else {
156 + $push_page = '';
157 + }
158 +
159 + $form_head = $form_wrapper;
160 + $form_head .= "<div id='fca_eoi_form_$form_id' class='fca_eoi_form_content'>";
161 + $form_head .= "<form method='post' action='#' class='fca_eoi_form fca_eoi_layout_$layout_helper->layout_number $layout_helper->layout_class $animation_class' ";
162 + $form_head .= "data-fca_eoi_list_id='$list_id' data-fca_eoi_push_page='$push_page' data-fca_eoi_success_cookie_duration='$cookie_dur' data-fca_eoi_thank_you_page='$thanks_page' data-fca_eoi_thank_you_mode='$thanks_mode' data-fca_eoi_sub_msg='$sub_msg' novalidate>";
163 + $form_head .= "<input type='hidden' id='fca_eoi_form_id' name='fca_eoi_form_id' value='$form_id'>";
70 164
71 - if ( !$isActive ) {
72 -
73 - $new_css_obj = new EoiNewCssMigration();
74 - $new_css_obj->migrate( 'old', 'new' );
75 -
76 - powerup_new_css_set_active( TRUE );
77 - }
165 + //FILL TEMPLATE
166 + $layout_html = str_replace(
167 + array(
168 + '<form>',
169 + '{{{description_copy}}}',
170 + '{{{headline_copy}}}',
171 + '{{{name_field}}}',
172 + '{{{email_field}}}',
173 + '{{{submit_button}}}',
174 + '{{{privacy_copy}}}',
175 + '{{{fatcatapps_link}}}',
176 + '</form>',
177 + ),
178 + array(
179 + $form_head,
180 + '<div>{{{description_copy}}}</div>',
181 + '<div>{{{headline_copy}}}</div>',
182 + "<input class='fca_eoi_form_input_element' type='text' name='name' placeholder='{{{name_placeholder}}}'>",
183 + '<input class="fca_eoi_form_input_element" type="email" name="email" placeholder="{{{email_placeholder}}}">',
184 + '<input class="fca_eoi_form_button_element" type="submit" value="{{{button_copy}}}">',
185 + '<div>{{{privacy_copy}}}</div>',
186 + $banding,
187 + '<input type="hidden" name="fca_eoi" value="1">
188 + <input type="hidden" name="fca_eoi_error_texts_email" class="fca_eoi_error_texts_email" value="' . htmlspecialchars ($errorTexts['invalid_email']) . '">
189 + <input type="hidden" name="fca_eoi_error_texts_required" class="fca_eoi_error_texts_required" value="' . htmlspecialchars ($errorTexts['field_required']) . '"></form></div>' . $form_wrapper_end,
190 + ),
191 + $layout_html
192 + );
193 +
194 + //ADD TEXTS
195 + $show_headline = K::get_var( 'show_headline_field', $fca_eoi_meta, 'on' );
196 + $show_description = K::get_var( 'show_description_field', $fca_eoi_meta, 'on' );
197 + $show_privacy = K::get_var( 'show_privacy_field', $fca_eoi_meta, 'on' );
198 +
199 + $headline_copy = $show_headline == 'off' ? '' : $fca_eoi_meta[ 'headline_copy' ];
200 + $description_copy = $show_description == 'off' ? '' : $fca_eoi_meta[ 'description_copy' ];
201 +
202 + $name_placeholder = $fca_eoi_meta[ 'name_placeholder' ];
203 + $email_placeholder = $fca_eoi_meta[ 'email_placeholder' ];
204 +
205 + $button_copy = $fca_eoi_meta[ 'button_copy' ];
206 + $privacy_copy = $show_privacy == 'off' ? '' : $fca_eoi_meta[ 'privacy_copy' ];
207 +
208 + $output = str_replace(
209 + array(
210 + '{{{headline_copy}}}',
211 + '{{{description_copy}}}',
212 + '{{{name_placeholder}}}',
213 + '{{{email_placeholder}}}',
214 + '{{{button_copy}}}',
215 + '{{{privacy_copy}}}',
216 + ),
217 + array(
218 + $headline_copy,
219 + $description_copy,
220 + $name_placeholder,
221 + $email_placeholder,
222 + $button_copy,
223 + $privacy_copy,
224 + ),
225 + $layout_html
226 + );
227 +
228 + $output = apply_filters( 'fca_eoi_alter_form', $output, $fca_eoi_meta );
78 229
230 + return $output;
79 231 }
80 232
81 -function fca_eoi_compile_scss() {
233 +//ADD KEYUP ACTION TO TINY MCE VISUAL EDITOR
234 +function fca_eoi_tiny_mce_before_init( $initArray ) {
235 + global $post;
236 + if ( is_object ( $post ) && $post->post_type == 'easy-opt-ins' ) {
237 + $initArray['setup'] = <<<JS
238 +[function(ed) {
239 + ed.on('keyup', function(ed, e) {
240 + jQuery('[name="fca_eoi[description_copy]"]').html(tinymce.activeEditor.getContent()).trigger('keyup')
241 + });
242 +
243 +}][0]
244 +JS;
245 + return $initArray;
246 + } else {
247 + return $initArray;
248 + }
249 +}
250 +add_filter( 'tiny_mce_before_init', 'fca_eoi_tiny_mce_before_init' );
251 +
252 +//CONVERTS OLD EDITOR SAVE FORMAT TO NEW FORMAT
253 +function fca_eoi_convert_post_meta() {
82 254 require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-layout.php';
83 - $layouts_types = array( 'lightbox', 'postbox', 'widget');
84 - $fca_eoi_global_scss_array = array();
85 - foreach ( $layouts_types as $layout_type ) {
255 +
256 + $args = array(
257 + 'post_type' => 'easy-opt-ins',
258 + 'post_status' => 'publish',
259 + 'posts_per_page'=> -1,
260 + );
86 261
87 - foreach ( glob( FCA_EOI_PLUGIN_DIR . "layouts/$layout_type/*", GLOB_ONLYDIR ) as $layout_path ) {
262 + $posts_array = get_posts( $args );
263 +
264 + $settings = array (
265 + 'form_background_color_selector' => 'background-color',
266 + 'form_border_color_selector' => 'border-color',
267 + 'headline_font_size_selector' => 'font-size',
268 + 'headline_font_color_selector' => 'color',
269 + 'headline_background_color_selector' => 'background-color',
270 + 'description_font_size_selector' => 'font-size',
271 + 'description_font_color_selector' => 'color',
272 + 'name_font_size_selector' => 'font-size',
273 + 'name_font_color_selector' => 'color',
274 + 'name_background_color_selector' => 'background-color',
275 + 'name_border_color_selector' => 'border-color',
276 + 'email_font_size_selector' => 'font-size',
277 + 'email_font_color_selector' => 'color',
278 + 'email_background_color_selector' => 'background-color',
279 + 'email_border_color_selector' => 'border-color',
280 + 'button_font_size_selector' => 'font-size',
281 + 'button_font_color_selector' => 'color',
282 + 'button_background_color_selector' => 'background-color',
283 + 'button_wrapper_background_color_selector' => 'background-color',
284 + 'privacy_font_size_selector' => 'font-size',
285 + 'privacy_font_color_selector' => 'color',
286 + 'branding_font_color_selector' => 'color',
88 287
89 - $layout_id = basename( $layout_path );
90 - $layout_helper = new EasyOptInsLayout( $layout_id );
91 - $scss = $layout_helper->new_scss_compiler();
288 + );
289 +
290 + forEach ( $posts_array as $post ) {
291 + $form_id = $post->ID;
292 + $version = get_post_meta( $post->ID, 'fca_eoi_meta_format', true );
293 +
294 + //ONLY CONVERT OLD VERSIONS
295 + if ( $version != '2.0' ) {
296 + $meta = get_post_meta( $post->ID, 'fca_eoi', true );
297 + //FIX FOR EMPTY LAYOUT? SET THE DEFAULT
298 + $layout = empty ( $meta['layout'] ) ? 'postbox_1' : $meta['layout'];
299 + $new_meta['layout'] = $layout;
300 +
301 + $new_meta = $meta;
302 + unset ( $new_meta[$layout] );
303 +
304 + $i = 0;
305 +
306 + forEach ( $meta[$layout] as $selector => $array ) {
307 + $type = '';
308 +
309 + if ( $i == 0 ) {
310 + $type = 'form';
311 + } else if ( strpos($selector, 'headline') !== false ) {
312 + $type = 'headline';
313 + } else if ( strpos($selector, 'description') !== false ) {
314 + $type = 'description';
315 + } else if ( strpos($selector, 'name') !== false ) {
316 + $type = 'name';
317 + } else if ( strpos($selector, 'email') !== false ) {
318 + $type = 'email';
319 + } else if ( strpos($selector, 'submit_button_wrapper input:hover') !== false ) {
320 + $type = 'hover';
321 + } else if ( strpos($selector, 'submit_button_wrapper input') !== false && strpos($selector, 'hover') === false ) {
322 + $type = 'button';
323 + } else if ( strpos($selector, 'privacy') !== false ) {
324 + $type = 'privacy';
325 + } else if ( strpos($selector, 'fatcatapps') !== false ) {
326 + $type = 'branding';
327 + }
328 +
329 + forEach ($array as $css_property => $value ) {
330 + if ( !empty ( $type ) ) {
331 +
332 + if ( $type == 'hover' ) {
333 +
334 + $new_meta['button_wrapper_background_color_selector'] = '.fca_eoi_layout_submit_button_wrapper';
335 + $new_meta['button_wrapper_background_color'] = $value;
336 +
337 + } else {
338 +
339 + $new_key = $type . '_' . str_replace ('-', '_', $css_property) . '_selector';
340 + if ( strpos( $new_key, 'color' ) !== false && strpos( $new_key, 'border' ) === false && strpos( $new_key, 'background' ) === false ) {
341 + $new_key = str_replace ('_color', '_font_color', $new_key);
342 + }
343 + $new_meta[trim($new_key)] = $selector;
344 +
345 + $new_value_key = $type . '_' . str_replace ('-', '_', $css_property);
346 +
347 + if ( strpos( $new_value_key, 'color' ) !== false && strpos( $new_value_key, 'border' ) === false && strpos( $new_value_key, 'background' ) === false ) {
348 + $new_value_key = str_replace ('_color', '_font_color', $new_value_key);
349 + }
350 +
351 + $new_meta[trim($new_value_key)] = $value;
352 + }
353 + }
354 + }
355 +
356 + $i++;
357 + }
358 +
359 + //SOME SPECIAL CASES
360 + if ( empty ( $new_meta['email_font_size'] ) ) {
361 + $new_meta['email_font_size_selector'] = 'div.fca_eoi_layout_email_field_wrapper';
362 + $new_meta['email_font_size'] = '13px';
363 + }
364 + if ( empty ( $new_meta['name_font_size'] ) ) {
365 + $new_meta['name_font_size_selector'] = 'div.fca_eoi_layout_name_field_wrapper';
366 + $new_meta['name_font_size'] = '13px';
367 + }
368 +
369 + //POSSIBLE FIX FOR PUBLICATION MODE
370 + if ( stripos ( $new_meta[ 'layout' ], 'lightbox') === FALSE && array_key_exists( 'publish_lightbox_mode', $new_meta )) {
371 + unset ( $new_meta['publish_lightbox_mode'] );
372 + }
373 +
374 + //COMPILE CSS AND SAVE INTO 'HEAD' META
375 +
376 + // General CSS for all forms
377 + $css = "<style type='text/css' class='fca-eoi-style'>.fca_eoi_form{ margin: auto; } .fca_eoi_form p { width: auto; } #fca_eoi_form_$form_id input{ max-width: 9999px; }";
378 +
379 + // CACHE (ALMSOT) ALL THE OUTPUT HERE
380 + $layout_helper = new EasyOptInsLayout( $new_meta[ 'layout' ] );
92 381 $scss_path = $layout_helper->path_to_resource( 'layout', 'scss' );
93 382
94 - if ( EasyOptInsLayout::uses_new_css() ) {
95 - $layout[ 'css' ] = file_exists( $scss_path )
96 - ? '#fca_eoi_preview_form_container {' .
97 - file_get_contents( $scss_path ) .
98 - '.fca_eoi_layout_popup_close {' .
99 - 'display: none;' .
100 - '}' .
101 - '}'
102 - : ''
103 - ;
104 - } else {
105 - $layout[ 'css' ] = file_exists( $scss_path )
106 - ? file_get_contents( $scss_path)
107 - : ''
108 - ;
383 + if ( file_exists( $scss_path ) ) {
384 + $css_path = str_replace ( '.scss' , '_min.css', $scss_path );
385 + $css_file = file_get_contents( $css_path );
109 386 }
387 +
388 + $show_name = !empty( $new_meta['show_name_field'] ) ? $new_meta['show_name_field'] : false;
389 +
390 + if ( !$show_name ) {
391 + $css .= "#fca_eoi_form_$form_id .fca_eoi_layout_email_field_wrapper {width: 100% !important;}";
392 + $css .= "#fca_eoi_form_$form_id .fca_eoi_layout_name_field_wrapper {display: none !important;}";
393 + }
394 +
395 + //ADD CSS FROM FILE
396 + $css .= $css_file;
397 +
398 + //ADD CUSTOM CSS FROM SAVE
399 + $added_widget_3_css_rule = false;
400 +
401 + foreach ( $settings as $key => $property ) {
402 + $input = str_replace ( '_selector', '', $key);
403 +
404 + $selector = empty ( $new_meta[$key] ) ? '' : $new_meta[$key];
405 +
406 + if ( !empty ( $selector ) ) {
110 407
111 - // Add $ltr SASS variable
112 - $layout[ 'css' ] = sprintf( '$ltr: %s;', is_rtl() ? 'false' : 'true' )
113 - . $layout[ 'css' ]
114 - ;
408 +
409 + //SPECIAL CASE FOR WIDGET 3
410 + if ( $selector == '.fca_eoi_layout_3.fca_eoi_layout_widget div.fca_eoi_layout_headline_copy_wrapper div' && !$added_widget_3_css_rule && $input == 'headline_background_color' ) {
411 + $css .= "#fca_eoi_form_$form_id form.fca_eoi_layout_3.fca_eoi_layout_widget svg.fca_eoi_layout_headline_copy_triangle { fill: $new_meta[$input] !important; }";
412 + $added_widget_3_css_rule = true;
413 + }
414 +
415 + $css .= "#fca_eoi_form_$form_id $selector { $property: $new_meta[$input] !important; }";
416 + }
417 + }
418 +
419 + $head = $css . '</style>';
115 420
116 - $name = $layout[ 'css' ];
117 - $layout[ 'css' ] = $scss->compile( $layout[ 'css' ] );
118 - $fca_eoi_global_scss_array[$name] = $layout[ 'css' ];
421 + $html = fca_eoi_get_html ( $form_id, $new_meta );
422 +
423 + $head = $head . $html;
424 +
425 + update_post_meta( $post->ID, 'fca_eoi', $new_meta );
426 + update_post_meta( $post->ID, 'fca_eoi_meta_format', '2.0' );
427 + update_post_meta( $post->ID, 'fca_eoi_head', $head );
428 +
119 429 }
120 430 }
431 +}
121 432
122 - $file = FCA_EOI_PLUGIN_DIR . "includes/cache";
123 - $fileWrite = file_put_contents($file, serialize($fca_eoi_global_scss_array));
433 +function fca_eoi_convert_option_save() {
434 +
435 + $old_options = get_option('paf');
436 + $license = get_option('fca_eoi_license_key');
437 +
438 + $new_options = array(
439 + 'license_key' => $license,
440 + );
441 +
442 + $options = array (
443 +
444 + 'eoi_powerup_custom_css' => 'custom_css',
445 + 'eoi_powerup_optin_bait' => 'optin_bait',
446 + 'eoi_powerup_animation' => 'animation',
447 + 'eoi_powerup_mp_groups' => 'mailchimp_groups',
448 +
449 + );
450 +
451 + if ( !empty( $old_options ) ) {
452 + forEach ( $options as $key => $value ) {
453 + if ( !empty ( $old_options[$key] ) && $old_options[$key][0] == 'on' ) {
454 + $new_options[$value] = 1;
455 + }
456 + }
457 +
458 + update_option( 'fca_eoi_settings', $new_options );
459 + delete_option ( 'paf' );
460 + delete_option ( 'fca_eoi_license_key' );
461 +
462 + }
463 +
124 464 }