PluginProbe
Property Hive / 2.2.6
Property Hive v2.2.6
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / includes / admin / settings / class-ph-settings-page.php

class-ph-settings-page.php in Property Hive 2.2.6, at includes/admin/settings/class-ph-settings-page.php

94 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PropertyHive Settings Page/Tab
4 *
5 * @author PropertyHive
6 * @category Admin
7 * @package PropertyHive/Admin
8 * @version 1.0.0
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
13 if ( ! class_exists( 'PH_Settings_Page' ) ) :
14
15 /**
16 * PH_Settings_Page
17 */
18 class PH_Settings_Page {
19
20 protected $id = '';
21 protected $label = '';
22
23 /**
24 * Add this page to settings
25 */
26 public function add_settings_page( $pages ) {
27 $pages[ $this->id ] = $this->label;
28
29 return $pages;
30 }
31
32 /**
33 * Get settings array
34 *
35 * @return array
36 */
37 public function get_settings() {
38 return array();
39 }
40
41 /**
42 * Get sections
43 *
44 * @return array
45 */
46 public function get_sections() {
47 return array();
48 }
49
50 /**
51 * Output sections
52 */
53 public function output_sections() {
54 global $current_section;
55
56 $sections = $this->get_sections();
57
58 if ( empty( $sections ) )
59 return;
60
61 echo '<ul class="subsubsub">';
62
63 $array_keys = array_keys( $sections );
64
65 foreach ( $sections as $id => $label )
66 echo '<li>&nbsp;<a href="' . esc_url(admin_url( 'admin.php?page=ph-settings&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . esc_html($label) . '</a> ' . ( end( $array_keys ) == $id ? '' : '| ' ) . ' </li>';
67
68 echo '</ul><br class="clear" />';
69 }
70
71 /**
72 * Output the settings
73 */
74 public function output() {
75 $settings = $this->get_settings();
76
77 PH_Admin_Settings::output_fields( $settings );
78 }
79
80 /**
81 * Save settings
82 */
83 public function save() {
84 global $current_section;
85
86 $settings = $this->get_settings();
87 PH_Admin_Settings::save_fields( $settings );
88
89 if ( $current_section )
90 do_action( 'propertyhive_update_options_' . $this->id . '_' . $current_section );
91 }
92 }
93
94 endif;