| @@ -14,8 +14,9 @@ | ||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * PH_Settings_Page |
| 17 | 17 | */ |
| 18 | +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy public global class PH_Settings_Page; preserving the existing PH_* class name is required for plugin and extension compatibility. | |
| 18 | 19 | class PH_Settings_Page { |
| 19 | 20 | |
| 20 | 21 | protected $id = ''; |
| 21 | 22 | protected $label = ''; |
| @@ -62,9 +63,9 @@ | ||
| 62 | 63 | |
| 63 | 64 | $array_keys = array_keys( $sections ); |
| 64 | 65 | |
| 65 | 66 | foreach ( $sections as $id => $label ) |
| 66 | - echo '<li><a href="' . admin_url( 'admin.php?page=ph-settings&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; | |
| 67 | + echo '<li> <a href="' . esc_url(admin_url( 'admin.php?page=ph-settings&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . esc_html($label) . '</a> ' . ( end( $array_keys ) == $id ? '' : '| ' ) . ' </li>'; | |
| 67 | 68 | |
| 68 | 69 | echo '</ul><br class="clear" />'; |
| 69 | 70 | } |
| 70 | 71 | |
| @@ -80,8 +81,12 @@ | ||
| 80 | 81 | /** |
| 81 | 82 | * Save settings |
| 82 | 83 | */ |
| 83 | 84 | public function save() { |
| 85 | + if ( ! current_user_can( 'manage_options' ) || ! isset( $_REQUEST['_wpnonce'] ) || ! is_string( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'propertyhive-settings' ) ) { | |
| 86 | + return; | |
| 87 | + } | |
| 88 | + | |
| 84 | 89 | global $current_section; |
| 85 | 90 | |
| 86 | 91 | $settings = $this->get_settings(); |
| 87 | 92 | PH_Admin_Settings::save_fields( $settings ); |