PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
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-demo-data.php

class-ph-settings-demo-data.php in Property Hive 2.3.0, at includes/admin/settings/class-ph-settings-demo-data.php

107 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PropertyHive Demo Data
4 *
5 * @author PropertyHive
6 * @category Admin
7 * @package PropertyHive/Admin
8 * @version 1.0.0
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly
13 }
14
15 if ( ! class_exists( 'PH_Settings_Demo_Data' ) ) :
16
17 /**
18 * PH_Settings_Demo_Data
19 */
20 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy public global class PH_Settings_Demo_Data; preserving the existing PH_* class name is required for plugin and extension compatibility.
21 class PH_Settings_Demo_Data extends PH_Settings_Page {
22
23 /**
24 * Constructor.
25 */
26 public function __construct()
27 {
28 $this->id = 'demo_data';
29 $this->label = __( 'Demo Data', 'propertyhive' );
30
31 add_filter( 'propertyhive_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
32 add_action( 'propertyhive_settings_' . $this->id, array( $this, 'output' ) );
33 add_action( 'propertyhive_admin_field_demo_data', array( $this, 'demodata_setting' ) );
34 }
35
36 /**
37 * Get settings array
38 *
39 * @return array
40 */
41 public function get_settings()
42 {
43 global $hide_save_button;
44
45 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Shared admin settings-view state; this global is intentionally used to control the common settings template and is not an arbitrary application global.
46 $hide_save_button = TRUE;
47
48 return apply_filters( 'propertyhive_demo_data_settings', array(
49
50 array(
51 'type' => 'demo_data',
52 ),
53
54 array( 'type' => 'sectionend', 'id' => 'demo_data_options')
55
56 ) );
57 }
58
59 /**
60 * Output the settings
61 */
62 public function output()
63 {
64 $settings = $this->get_settings();
65
66 PH_Admin_Settings::output_fields( $settings );
67 }
68
69 /**
70 * Output link to demo data
71 *
72 * @access public
73 * @return void
74 */
75 public function demodata_setting()
76 {
77 ?>
78 <style type="text/css">
79
80 .demo-data .intro-text { width:81%; font-size:1.1em; }
81
82 </style>
83 <table class="form-table">
84 <tr>
85 <td class="demo-data">
86 <p class="intro-text">
87 To get an idea of how Property Hive works, if you're a new user you can quickly fill it with a set of demo data, including properties, applicants and more.
88 <br><br>
89 Simply activate our free Demo Data feature below to get started:
90 </p>
91 <br>
92 <p>
93 <a href="<?php echo esc_url(admin_url('admin.php?page=ph-settings&tab=features&profilter=free')); ?>" class="button button-primary">Activate Demo Data Feature</a>
94 &nbsp;
95 <a href="<?php echo esc_url( wp_nonce_url( admin_url('admin.php?page=ph-settings&tab=demo_data&hidetab=1'), 'propertyhive-hide-demo-data' ) ); ?>">Hide This Page</a>
96 </p>
97 </td>
98 </tr>
99 </table>
100 <?php
101 }
102 }
103
104 endif;
105
106 return new PH_Settings_Demo_Data();
107