public function update_account($name, $data_array = array()) { global $et_bloom; $service = $this->slug; if (!empty($name)) { $name = str_replace(array('"', "'"), '', stripslashes($name)); $options_array = ET_Bloom::get_bloom_options(); $new_account['accounts'] = isset($options_array['accounts']) ? $options_array['accounts'] : array(); $new_account['accounts'][$service][$name] = isset($new_account['accounts'][$service][$name]) ? array_merge($new_account['accounts'][$service][$name], $data_array) : $data_array; $et_bloom->update_option($new_account); } }
/** * Adds appropriate actions for Flyin, Popup, Below Content to wp_footer, * Adds custom_css function to wp_head * Adds trigger_bottom_mark to the_content filter for Flyin and Popup * Creates arrays with optins for for Flyin, Popup, Below Content to improve the performance during forms displaying */ function frontend_register_locations() { $options_array = ET_Bloom::get_bloom_options(); if (!is_admin() && !empty($options_array)) { add_action('wp_head', array($this, 'set_custom_css')); $flyin_count = 0; $popup_count = 0; $below_count = 0; $after_comment = 0; $after_purchase = 0; foreach ($options_array as $optin_id => $details) { if ('accounts' !== $optin_id) { if (isset($details['optin_status']) && 'active' === $details['optin_status'] && empty($details['child_of'])) { switch ($details['optin_type']) { case 'flyin': if (0 === $flyin_count) { add_action('wp_footer', array($this, "display_flyin")); $flyin_count++; } if (0 === $after_comment && isset($details['comment_trigger']) && true == $details['comment_trigger']) { add_filter('comment_post_redirect', array($this, 'after_comment_trigger')); $after_comment++; } if (0 === $after_purchase && isset($details['purchase_trigger']) && true == $details['purchase_trigger']) { add_action('woocommerce_thankyou', array($this, 'add_purchase_trigger')); $after_purchase++; } $this->flyin_optins[$optin_id] = $details; break; case 'pop_up': if (0 === $popup_count) { add_action('wp_footer', array($this, "display_popup")); $popup_count++; } if (0 === $after_comment && isset($details['comment_trigger']) && true == $details['comment_trigger']) { add_filter('comment_post_redirect', array($this, 'after_comment_trigger')); $after_comment++; } if (0 === $after_purchase && isset($details['purchase_trigger']) && true == $details['purchase_trigger']) { add_action('woocommerce_thankyou', array($this, 'add_purchase_trigger')); $after_purchase++; } $this->popup_optins[$optin_id] = $details; break; case 'below_post': if (0 === $below_count) { add_filter('the_content', array($this, 'display_below_post'), 9999); add_action('woocommerce_after_single_product_summary', array($this, 'display_on_wc_page')); $below_count++; } $this->below_post_optins[$optin_id] = $details; break; } } } } if (0 < $flyin_count || 0 < $popup_count) { add_filter('the_content', array($this, 'trigger_bottom_mark'), 9999); } } }