| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | * Give Settings Page/Tab |
| 4 | 4 | * |
| 5 | 5 | * @package Give |
| 6 | 6 | * @subpackage Classes/Give_Settings_Page |
| 7 | - * @copyright Copyright (c) 2016, WordImpress | |
| 7 | + * @copyright Copyright (c) 2016, GiveWP | |
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| @@ -19,8 +19,9 @@ | ||
| 19 | 19 | * Give_Settings_Page. |
| 20 | 20 | * |
| 21 | 21 | * @sine 1.8 |
| 22 | 22 | */ |
| 23 | + #[\AllowDynamicProperties] | |
| 23 | 24 | class Give_Settings_Page { |
| 24 | 25 | |
| 25 | 26 | /** |
| 26 | 27 | * Setting page id. |
| @@ -69,20 +70,23 @@ | ||
| 69 | 70 | public function __construct() { |
| 70 | 71 | // Get current setting page. |
| 71 | 72 | $this->current_setting_page = give_get_current_setting_page(); |
| 72 | 73 | |
| 74 | + // Get current section. | |
| 75 | + $this->current_section = give_get_current_setting_section(); | |
| 76 | + | |
| 73 | 77 | add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
| 74 | 78 | add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
| 75 | 79 | add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
| 76 | 80 | |
| 77 | - // Output section only if exist. | |
| 78 | - $sections = $this->get_sections(); | |
| 79 | - if ( ! empty( $sections ) ) { | |
| 80 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( | |
| 81 | + // Output sections. | |
| 82 | + add_action( | |
| 83 | + "{$this->current_setting_page}_sections_{$this->id}_page", | |
| 84 | + array( | |
| 81 | 85 | $this, |
| 82 | 86 | 'output_sections', |
| 83 | - ) ); | |
| 84 | - } | |
| 87 | + ) | |
| 88 | + ); | |
| 85 | 89 | |
| 86 | 90 | // Save hide button by default. |
| 87 | 91 | $GLOBALS['give_hide_save_button'] = true; |
| 88 | 92 | |
| @@ -193,8 +197,14 @@ | ||
| 193 | 197 | } |
| 194 | 198 | |
| 195 | 199 | $section_list = array(); |
| 196 | 200 | foreach ( $sections as $id => $label ) { |
| 201 | + | |
| 202 | + // If the `$label` return array then get title from the array as a label. | |
| 203 | + if ( is_array( $label ) && ! empty( $label['title'] ) ) { | |
| 204 | + $label = $label['title']; | |
| 205 | + } | |
| 206 | + | |
| 197 | 207 | /** |
| 198 | 208 | * Fire the filter to hide particular section on tab. |
| 199 | 209 | * |
| 200 | 210 | * @since 2.0 |
| @@ -205,12 +215,14 @@ | ||
| 205 | 215 | |
| 206 | 216 | $section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section === $id ? 'current' : '' ) . '">' . $label . '</a>'; |
| 207 | 217 | } |
| 208 | 218 | |
| 209 | - echo wp_kses_post( sprintf( | |
| 210 | - '<ul class="give-subsubsub">%s</ul><br class="clear" /><hr>', | |
| 211 | - implode( ' | </li>', $section_list ) | |
| 212 | - ) ); | |
| 219 | + echo wp_kses_post( | |
| 220 | + sprintf( | |
| 221 | + '<ul class="give-subsubsub">%s</ul><br class="clear" /><hr>', | |
| 222 | + implode( ' | </li>', $section_list ) | |
| 223 | + ) | |
| 224 | + ); | |
| 213 | 225 | } |
| 214 | 226 | |
| 215 | 227 | /** |
| 216 | 228 | * Output the settings. |
| @@ -287,9 +299,9 @@ | ||
| 287 | 299 | * @return string |
| 288 | 300 | */ |
| 289 | 301 | public function get_heading_html() { |
| 290 | 302 | return sprintf( |
| 291 | - '<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">', | |
| 303 | + '<h1 class="wp-heading-inline">%s</h1>', | |
| 292 | 304 | implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() ) |
| 293 | 305 | ); |
| 294 | 306 | } |
| 295 | 307 | } |