textdomain = 'admin-customization'; $this->args = array( 'page_title' => __( 'Admin Customization Settings', $this->textdomain ), 'menu_title' => __( 'Admin Customization' , $this->textdomain ), 'page_slug' => 'admin-customization', ); $this->boxes = array( array( 'style_preferences', __( 'Style preferences', $this->textdomain ), 'normal' ), array( 'dashboard_settings', __( 'Dashboard widgets', $this->textdomain ), 'side' ), array( 'general_settings', __( 'General settings', $this->textdomain ), 'normal' ), ); } function general_settings_box() { $output = ''; $checkboxes = array( __( 'Hide update notices', $this->textdomain ) => array( 'value' => 'hide_update_notices', ), __( 'Hide plugin update count', $this->textdomain ) => array( 'value' => 'hide_plugin_count', ), __( 'Redirect to home page on logout', $this->textdomain ) => array( 'value' => 'redirect_on_logout', ), ); foreach ( $checkboxes as $name => $args ) { $output .= html( 'tr', html( 'th scope="row" class="check-column"', $this->input( array( 'type' => 'checkbox', 'name' => 'general[]', 'value' => $args['value'], 'desc' => false, 'checked' => in_array( $args['value'], (array) $this->options->general_settings ), ) ) ) .html( 'td', $name )); } echo $this->form_wrap( html( 'table class="checklist widefat notitle"', $output ), array('action' => 'general_preferences_button')); } function general_settings_handler() { if ( !isset( $_POST['general_preferences_button'] ) ) return; $this->admin_msg( __( 'General settings saved. You may need to refresh to see the changes.', $this->textdomain ) ); $this->options->general_settings = (array) @$_POST['general']; } function style_preferences_box() { $output = $this->table( array( array( 'title' => __( 'Favicon', $this->textdomain ), 'desc' => __( '(favicon path realative to wp-content)', $this->textdomain ), 'type' => 'text', 'name' => 'favicon', 'value' => implode( ', ', (array) $this->options->favicon ) ), array( 'title' => __( 'Login logo', $this->textdomain ), 'desc' => __( '(login logo path relative to wp-content)', $this->textdomain ), 'type' => 'text', 'name' => 'login_logo', 'value' => implode( ', ', (array) $this->options->login_logo ) ), array( 'title' => __( 'Admin logo ', $this->textdomain ), 'desc' => __( '(admin logo (max 32x32px) path relative to wp-content.)
e.g.: "themes/mytheme/img/admin_logo.png"', $this->textdomain ), 'type' => 'text', 'name' => 'admin_logo', 'value' => implode( ', ', (array) $this->options->admin_logo ) ) ) ); // same as $this->form_wrap( $output, '', 'style_preferences_button'); echo $this->form_wrap( $output, array('action' => 'style_preferences_button')); } function style_preferences_handler() { if ( !isset( $_POST['style_preferences_button'] ) ) return; $this->admin_msg( __( 'Style preferences changes saved. You may need to refresh to see the changes.', $this->textdomain ) ); foreach ( array( 'favicon', 'login_logo', 'admin_logo' ) as $key ) $this->options->$key = @$_POST[$key]; } function dashboard_settings_box() { $output = '

' . __( 'To update this list of widgets you must first visit the Dashboard.', $this->textdomain ) . '

'. $this->_widget_table(__( 'Disable All Widgets', $this->textdomain ), $this->options->widgets); // same as $this->form_wrap( $output, '', 'dashboard_settings_button'); echo $this->form_wrap( $output, array('action' => 'dashboard_settings_button')); } function dashboard_settings_handler() { if ( !isset ( $_POST['dashboard_settings_button'] ) ) return; $this->admin_msg( __( 'Dashboard widgets settings saved.', $this->textdomain ) ); $this->options->disabled_widgets = (array) @$_POST['widgets']; } function default_css() { ?> ' ) .html( 'th scope="col"', $title ) ); $table = html( 'table class="checklist widefat"', html( 'thead', $thead ) .html( 'tbody', $tbody ) ); return $table; } private function _widget_table( $title, $widgets ) { $tbody = ''; foreach ( $widgets as $widget ) { if ( empty( $widget['title'] ) ) continue; $tbody .= html( 'tr', html( 'th scope="row" class="check-column"', $this->input( array( 'type' => 'checkbox', 'name' => 'widgets[]', 'value' => $widget['id'], 'desc' => false, 'checked' => in_array( $widget['id'], (array) $this->options->disabled_widgets ), ) ) ) .html( 'td', $widget['title'] ) ); } return $this->_checklist_wrap( $title, $tbody ); } }