public static function get_instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; }
public function _admin_init() { global $zendesk_support; // Scripts and styles add_action('admin_print_styles', array(&$this, '_admin_print_styles')); // Comments columns & row actions add_filter('comment_row_actions', array(&$zendesk_support, '_comment_row_actions'), 10, 2); add_filter('manage_edit-comments_columns', array(&$zendesk_support, '_comments_columns_filter'), 10, 1); add_action('manage_comments_custom_column', array(&$zendesk_support, '_comments_columns_action'), 10, 1); add_action('admin_notices', array(&$this, '_wp_admin_notices')); // General Settings register_setting('zendesk-settings', 'zendesk-settings', array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_validate_settings')); // Authentication Details add_settings_section('authentication', __('Your Zendesk Account', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_section_authentication'), 'zendesk-settings'); add_settings_field('account', __('Subdomain', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_account'), 'zendesk-settings', 'authentication'); // Show SSL when debug is on. if (ZENDESK_DEBUG) { add_settings_field('ssl', __('Use SSL', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_ssl'), 'zendesk-settings', 'authentication'); } // Display the rest of the settings only if a Zendesk account has been specified. if ($zendesk_support->settings['account']) { // Dashboard Widget Section add_settings_section('dashboard_widget', __('Dashboard Widget Visibility', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_section_dashboard_widget'), 'zendesk-settings'); add_settings_field('dashboard_administrator', __('Administrators', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_dashboard_access'), 'zendesk-settings', 'dashboard_widget', array('role' => 'administrator')); add_settings_field('dashboard_editor', __('Editors', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_dashboard_access'), 'zendesk-settings', 'dashboard_widget', array('role' => 'editor')); add_settings_field('dashboard_author', __('Authors', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_dashboard_access'), 'zendesk-settings', 'dashboard_widget', array('role' => 'author')); add_settings_field('dashboard_contributor', __('Contributors', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_dashboard_access'), 'zendesk-settings', 'dashboard_widget', array('role' => 'contributor')); add_settings_field('dashboard_subscriber', __('Subscribers', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_dashboard_access'), 'zendesk-settings', 'dashboard_widget', array('role' => 'subscriber')); // Contact Form Section add_settings_field('contact_form_anonymous', __('Anonymous Requests', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_contact_form_anonymous'), 'zendesk-settings', 'contact_form'); add_settings_field('contact_form_anonymous_user', __('Anonymous Requests By', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_contact_form_anonymous_user'), 'zendesk-settings', 'contact_form'); add_settings_section('contact_form', __('Contact Form Settings', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_section_contact_form'), 'zendesk-settings'); add_settings_field('contact_form_title', __('Form Title', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_contact_form_title'), 'zendesk-settings', 'contact_form'); add_settings_field('contact_form_summary', __('Summary Label', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_contact_form_summary'), 'zendesk-settings', 'contact_form'); add_settings_field('contact_form_details', __('Details Label', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_contact_form_details'), 'zendesk-settings', 'contact_form'); add_settings_field('contact_form_submit', __('Submit Button Label', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_contact_form_submit'), 'zendesk-settings', 'contact_form'); // Dropbox Settings - Only appears if the Dropbox is active, or if the web widget is off and there is a Feedback Tab snipped in the settings if ($zendesk_support->settings['dropbox_display'] == 'auto' || $zendesk_support->settings['dropbox_display'] == 'manual' || $zendesk_support->settings['webwidget_display'] == 'none' && $zendesk_support->settings['dropbox_code'] !== '') { add_settings_section('dropbox', __('Dropbox Settings', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_section_dropbox'), 'zendesk-settings'); add_settings_field('dropbox_display', __('Display', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_dropbox_display'), 'zendesk-settings', 'dropbox'); add_settings_field('dropbox_code', __('Dropbox Code', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_dropbox_code'), 'zendesk-settings', 'dropbox'); } // Web Widget Settings add_settings_section('webwidget', __('Web Widget Settings', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_section_webwidget'), 'zendesk-settings'); add_settings_field('webwidget_display', __('Display', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_webwidget_display'), 'zendesk-settings', 'webwidget'); add_settings_field('webwidget_code', __('Web Widget Code', 'zendesk'), array(Zendesk_Wordpress_Admin_Settings::get_instance(), '_settings_field_webwidget_code'), 'zendesk-settings', 'webwidget'); // Remote Authentication Settings register_setting('zendesk-settings-remote-auth', 'zendesk-settings-remote-auth', array(Zendesk_Wordpress_Admin_Remote_Auth_Settings::get_instance(), '_validate_remote_auth_settings')); // Remote Authentication Section Zendesk add_settings_section('zendesk', __('Zendesk Configuration', 'zendesk'), array(Zendesk_Wordpress_Admin_Remote_Auth_Settings::get_instance(), '_settings_remote_auth_section_zendesk'), 'zendesk-settings-remote-auth'); add_settings_field('login_url', __('Remote Login URL', 'zendesk'), array(Zendesk_Wordpress_Admin_Remote_Auth_Settings::get_instance(), '_settings_field_remote_auth_login_url'), 'zendesk-settings-remote-auth', 'zendesk'); add_settings_field('logout_url', __('Remote Logout URL', 'zendesk'), array(Zendesk_Wordpress_Admin_Remote_Auth_Settings::get_instance(), '_settings_field_remote_auth_logout_url'), 'zendesk-settings-remote-auth', 'zendesk'); // Remote Authentication Section add_settings_section('general', __('General Settings', 'zendesk'), array(Zendesk_Wordpress_Admin_Remote_Auth_Settings::get_instance(), '_settings_remote_auth_section_general'), 'zendesk-settings-remote-auth'); add_settings_field('strategy', __('Remote Auth Strategy', 'zendesk'), array(Zendesk_Wordpress_Admin_Remote_Auth_Settings::get_instance(), '_settings_remote_auth_strategy'), 'zendesk-settings-remote-auth', 'general'); add_settings_field('enabled', __('Remote Auth Status', 'zendesk'), array(Zendesk_Wordpress_Admin_Remote_Auth_Settings::get_instance(), '_settings_field_remote_auth_enabled'), 'zendesk-settings-remote-auth', 'general'); add_settings_field('token', __('Remote Auth Shared Token', 'zendesk'), array(Zendesk_Wordpress_Admin_Remote_Auth_Settings::get_instance(), '_settings_field_remote_auth_token'), 'zendesk-settings-remote-auth', 'general'); // Zendesk Forms $zendesk_support->_process_forms(); } }