| 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 |
class PH_Settings_Demo_Data extends PH_Settings_Page { |
| 21 |
|
| 22 |
/** |
| 23 |
* Constructor. |
| 24 |
*/ |
| 25 |
public function __construct() |
| 26 |
{ |
| 27 |
$this->id = 'demo_data'; |
| 28 |
$this->label = __( 'Demo Data', 'propertyhive' ); |
| 29 |
|
| 30 |
add_filter( 'propertyhive_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
| 31 |
add_action( 'propertyhive_settings_' . $this->id, array( $this, 'output' ) ); |
| 32 |
add_action( 'propertyhive_admin_field_demo_data', array( $this, 'demodata_setting' ) ); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Get settings array |
| 37 |
* |
| 38 |
* @return array |
| 39 |
*/ |
| 40 |
public function get_settings() |
| 41 |
{ |
| 42 |
global $hide_save_button; |
| 43 |
|
| 44 |
$hide_save_button = TRUE; |
| 45 |
|
| 46 |
return apply_filters( 'propertyhive_demo_data_settings', array( |
| 47 |
|
| 48 |
array( |
| 49 |
'type' => 'demo_data', |
| 50 |
), |
| 51 |
|
| 52 |
array( 'type' => 'sectionend', 'id' => 'demo_data_options') |
| 53 |
|
| 54 |
) ); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Output the settings |
| 59 |
*/ |
| 60 |
public function output() |
| 61 |
{ |
| 62 |
$settings = $this->get_settings(); |
| 63 |
|
| 64 |
PH_Admin_Settings::output_fields( $settings ); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Output link to demo data |
| 69 |
* |
| 70 |
* @access public |
| 71 |
* @return void |
| 72 |
*/ |
| 73 |
public function demodata_setting() |
| 74 |
{ |
| 75 |
?> |
| 76 |
<style type="text/css"> |
| 77 |
|
| 78 |
.demo-data .intro-text { width:81%; font-size:1.1em; } |
| 79 |
|
| 80 |
</style> |
| 81 |
<table class="form-table"> |
| 82 |
<tr> |
| 83 |
<td class="demo-data"> |
| 84 |
<p class="intro-text"> |
| 85 |
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. |
| 86 |
<br><br> |
| 87 |
Simply activate our free Demo Data feature below to get started: |
| 88 |
</p> |
| 89 |
<br> |
| 90 |
<p> |
| 91 |
<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> |
| 92 |
|
| 93 |
<a href="<?php echo esc_url(admin_url('admin.php?page=ph-settings&tab=demo_data&hidetab=1')); ?>">Hide This Page</a> |
| 94 |
</p> |
| 95 |
</td> |
| 96 |
</tr> |
| 97 |
</table> |
| 98 |
<?php |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
endif; |
| 103 |
|
| 104 |
return new PH_Settings_Demo_Data(); |
| 105 |
|