/**
  *@ singleton method used to instantiate class object
  *@ access public
  *@ return class instance
  */
 public static function instance()
 {
     // check if class object is instantiated
     if (!self::$_instance instanceof EE_Admin) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 protected function _update_espresso_page_settings()
 {
     // capture incoming request data
     $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
     $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
     $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
     $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
     // pack critical_pages into an array
     $critical_pages = array('reg_page_id' => $reg_page_id, 'txn_page_id' => $txn_page_id, 'thank_you_page_id' => $thank_you_page_id, 'cancel_page_id' => $cancel_page_id);
     foreach ($critical_pages as $critical_page_name => $critical_page_id) {
         // has the page changed ?
         if (EE_Registry::instance()->CFG->core->{$critical_page_name} != $critical_page_id) {
             // grab post object for old page
             $post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name});
             // update post shortcodes for old page
             EE_Admin::parse_post_content_on_save($critical_page_id, $post);
             // grab post object for new page
             $post = get_post($critical_page_id);
             // update post shortcodes for new page
             EE_Admin::parse_post_content_on_save($critical_page_id, $post);
         }
     }
     // set page IDs
     EE_Registry::instance()->CFG->core->reg_page_id = $reg_page_id;
     EE_Registry::instance()->CFG->core->txn_page_id = $txn_page_id;
     EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
     EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
     EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data);
     $what = __('Critical Pages & Shortcodes', 'event_espresso');
     $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
     $query_args = array('action' => 'critical_pages');
     $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
 }
 /**
  * Test the filter callback for get_edit_post_link
  *
  * @since 4.3.0
  * @depends test_loading_admin
  */
 function test_modify_edit_post_link()
 {
     //add contact post
     $attendee = EE_Attendee::new_instance(array('ATT_full_name' => 'Test Dude'));
     $attendee->save();
     $id = $attendee->ID();
     //dummy link for testing
     $orig_link = 'http://testdummylink.com';
     EE_Registry::instance()->load_helper('URL');
     $expected_link = EEH_URL::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $id), admin_url('admin.php?page=espresso_registrations'));
     //first test that if the id given doesn't match our post type that the original link is returned.
     $notmodified = EE_Admin::instance()->modify_edit_post_link($orig_link, 5555, '');
     $this->assertEquals($orig_link, $notmodified);
     //next test that if the id given matches our post type that the expected link is generated
     $ismodified = EE_Admin::instance()->modify_edit_post_link($orig_link, $id, '');
     $this->assertEquals($expected_link, $ismodified);
 }