public static function init()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 /**
  * Creates settings options
  */
 function inboundrocket_settings_page()
 {
     global $inboundrocket_contacts;
     register_setting('inboundrocket_options', 'inboundrocket_options', array($this, 'sanitize'));
     register_setting('inboundrocket_email_options', 'inboundrocket_email_options', array($this, 'sanitize'));
     $this->ir_visitor_tracking_settings();
     $this->ir_emails_settings();
     if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['inboundrocket_email_options'])) {
         inboundrocket_update_option('inboundrocket_options', 'inboundrocket_email_options', $_POST['inboundrocket_email_options']);
     }
     if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['inboundrocket_ss_options'])) {
         inboundrocket_update_option('inboundrocket_options', 'inboundrocket_ss_options', $_POST['inboundrocket_ss_options']);
     }
     if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['inboundrocket_ctt_options'])) {
         inboundrocket_update_option('inboundrocket_options', 'inboundrocket_ctt_options', $_POST['inboundrocket_ctt_options']);
     }
     if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['inboundrocket_is_options'])) {
         inboundrocket_update_option('inboundrocket_options', 'inboundrocket_is_options', $_POST['inboundrocket_is_options']);
     }
     if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['inboundrocket_wb_options'])) {
         inboundrocket_update_option('inboundrocket_options', 'inboundrocket_wb_options', $_POST['inboundrocket_wb_options']);
     }
     $inboundrocket_active_power_ups = unserialize(get_option('inboundrocket_active_power_ups'));
     if (count($inboundrocket_active_power_ups) > 1) {
         foreach ($this->admin_power_ups as $power_up) {
             if ($power_up->activated == 1 && $power_up->permanent != '1') {
                 $options_name = $power_up->options_name;
                 switch ($options_name) {
                     case "inboundrocket_ctt_options":
                         if (class_exists('WPClickToTweetAdmin')) {
                             $c2t = WPClickToTweetAdmin::init();
                             $this->plugin_settings_tabs[$options_name] = __('Click To Tweet', 'inboundrocket');
                             register_setting($options_name, $options_name, array($c2t, 'sanitize'));
                             add_settings_section('ir_ctt_section', '', '', $options_name);
                             add_settings_field('ir_ctt_settings', __('Click To Tweet Settings', 'inboundrocket'), array($c2t, 'ir_ctt_input_fields'), $options_name, 'ir_ctt_section');
                         }
                         break;
                     case "inboundrocket_ss_options":
                         if (class_exists('WPSelectionSharerAdmin')) {
                             $ss = WPSelectionSharerAdmin::init();
                             $this->plugin_settings_tabs[$options_name] = __('Selection Sharer', 'inboundrocket');
                             register_setting($options_name, $options_name, array($ss, 'sanitize'));
                             add_settings_section('ir_ss_section', '', '', $options_name);
                             add_settings_field('ir_ss_settings', __('Selection Sharer Settings', 'inboundrocket'), array($ss, 'ir_ss_input_fields'), $options_name, 'ir_ss_section');
                         }
                         break;
                     case "inboundrocket_wb_options":
                         if (class_exists('WPWelcomeBarAdmin')) {
                             $wb = WPWelcomeBarAdmin::init();
                             $this->plugin_settings_tabs[$options_name] = __('Welcome Bar', 'inboundrocket');
                             register_setting($options_name, $options_name, array($wb, 'sanitize'));
                             add_settings_section('ir_wb_section', '', '', $options_name);
                             add_settings_field('ir_wb_settings', __('Welcome Bar Settings', 'inboundrocket'), array($wb, 'ir_wb_input_fields'), $options_name, 'ir_wb_section');
                         }
                         break;
                 }
             }
         }
     } else {
         add_settings_section('ir_settings_section', '' . __('You have not activated any power-ups. Visit the', 'inboundrocket') . ' <a href="' . admin_url('admin.php?page=inboundrocket_power_ups') . '">' . __('power-ups page', 'inboundrocket') . '</a>, ' . __('activate some today and start increasing conversions.', 'inboundrocket') . '', '', 'inboundrocket_options');
     }
     // Update onboarding steps
     $options = get_option('inboundrocket_options');
     if (!isset($options['onboarding_step'])) {
         inboundrocket_update_option('inboundrocket_options', 'onboarding_step', 1);
     }
     if (isset($_POST['onboarding_step'])) {
         inboundrocket_update_option('inboundrocket_options', 'onboarding_step', intval($_POST['onboarding_step']));
     }
     if (isset($_POST['onboarding_complete'])) {
         inboundrocket_update_option('inboundrocket_options', 'onboarding_complete', intval($_POST['onboarding_complete']));
     }
     if (isset($_POST['ir_updates_subscription'])) {
         inboundrocket_update_option('inboundrocket_options', 'ir_updates_subscription', absint($_POST['ir_updates_subscription']));
     }
 }
Esempio n. 3
0
 public function admin_init()
 {
     $this->admin = WPClickToTweetAdmin::init();
 }