public static function &get_instance() { // Create class instance if required if (!isset(self::$instance)) { self::$instance = new self(); } // Return class instance return self::$instance; }
public function show_main() { // check permissions if (!current_user_can('edit_posts')) { wp_die(__('You do not have sufficient permissions to access this page.')); } // TODO: add check_admin_referer to improve security (see /wp-admin/edit.php) // is there POST data an event was edited must be updated // check for actions if ($this->action) { switch ($this->action) { // actions showing edit view case 'edit': case 'added': case 'modified': $this->show_edit_view($this->action); return; // actions showing import view // actions showing import view case 'import': require_once EL_PATH . 'admin/includes/admin-import.php'; EL_Admin_Import::get_instance()->show_import(); return; // actions showing event list // actions showing event list case 'deleted': // nothing to do break; } } // proceed with normal event list page if (!isset($_GET['orderby'])) { // set initial sorting $_GET['orderby'] = 'date'; $_GET['order'] = 'asc'; } $this->show_page_header($this->action); echo $this->show_event_table(); echo '</div>'; }