textdomain ), '3pagination', 'activate_plugins', '3pagination', array( $this, 'draw_settings_page' ) );
}
public function draw_settings_page() {
?>
textdomain ); ?>
register_setting( '3pagination_settings', '3pagination_settings', array( $this, 'threepagination_validate' ) );
// Add the section to reading settings so we can add our
// fields to it
add_settings_section( '3pagination_preview', __( 'Preview', $this->textdomain ), array( $this, 'section_preview' ), '3pagination' );
add_settings_section( '3pagination_labels', __( 'Labels', $this->textdomain ), array( $this, 'section_labels' ), '3pagination' );
add_settings_section( '3pagination_placement', __( 'Placement', $this->textdomain ), array( $this, 'section_placement' ), '3pagination' );
add_settings_section( '3pagination_css', __( 'DOM & CSS', $this->textdomain ), array( $this, 'section_css' ), '3pagination' );
// Add the field with the names and function to use for our new
// settings, put it in our new section
add_settings_field( 'threepagination_preview', __( 'Preview of pagination', $this->textdomain ), array( $this, 'preview' ), '3pagination', '3pagination_preview' );
add_settings_field( 'threepagination_labels_show', __( 'Show labels', $this->textdomain ), array( $this, 'labels_show' ), '3pagination', '3pagination_labels' );
add_settings_field( 'threepagination_labels_previous', __( 'Previous page', $this->textdomain ), array( $this, 'labels_previous' ), '3pagination', '3pagination_labels' );
add_settings_field( 'threepagination_labels_next', __( 'Next page', $this->textdomain ), array( $this, 'labels_next' ), '3pagination', '3pagination_labels' );
add_settings_field( 'threepagination_labels_first', __( 'First page', $this->textdomain ), array( $this, 'labels_first' ), '3pagination', '3pagination_labels' );
add_settings_field( 'threepagination_labels_last', __( 'Last page', $this->textdomain ), array( $this, 'labels_last' ), '3pagination', '3pagination_labels' );
add_settings_field( 'threepagination_css_class', __( 'Set CSS class', $this->textdomain ), array( $this, 'css_class' ), '3pagination', '3pagination_css' );
add_settings_field( 'threepagination_placement_header', __( 'Inject below header', $this->textdomain ), array( $this, 'placement_header' ), '3pagination', '3pagination_placement' );
add_settings_field( 'threepagination_placement_footer', __( 'Inject above footer', $this->textdomain ), array( $this, 'placement_footer' ), '3pagination', '3pagination_placement' );
add_settings_field( 'threepagination_placement_prepend', __( 'Prepend to', $this->textdomain ), array( $this, 'placement_prepend' ), '3pagination', '3pagination_placement' );
add_settings_field( 'threepagination_placement_append', __( 'Append to', $this->textdomain ), array( $this, 'placement_append' ), '3pagination', '3pagination_placement' );
}
/**
* Head of "preview" section
*
* @since 0.1
*/
public function section_preview() {
?>
Inject: You can "inject" the navigation bar below the header or above the footer div. Your theme needs to have an according HTML structure (which most WordPress themes do).' ); ?>
Append/Prepend: You can specifiy a container into which the pagination will be prepended/appended. Write it CSS-style, i.e. #mycontainer' ); ?>
Note: If you want your site to degrade gracefully, you should additionaly hardcode the pagination function into your theme files:
init_var( $settings, 'labels_show', 'on' ), 'on' ); ?> />
Default classes: classic, classic-glow, classic-small
init_var( $settings, 'placement_header_index', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_header_archive', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_header_category', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_header_search', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_footer_index', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_footer_archive', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_footer_category', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_footer_search', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_prepend_index', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_prepend_archive', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_prepend_category', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_prepend_search', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_append_index', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_append_archive', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_append_category', FALSE ), 'on' ); ?> />
init_var( $settings, 'placement_append_search', FALSE ), 'on' ); ?> />
$value ) {
if ( 0 === strpos( $key, 'placement_' ) && ! empty( $value ) ) {
$settings[ 'hide_serverside' ] = TRUE;
break;
}
}
return $settings;
}
/**
* Unregister and delete settings; clean database
*
* @uses unregister_setting, delete_option
* @access public
* @since 0.1
* @return void
*/
public function unregister_settings() {
unregister_setting( $this->option_string . '_group', $this->option_string );
delete_option( $this->option_string );
}
}
new threepagination_settings();
}
?>