PluginProbe
Easy Hotel – Powerful Hotel Booking / trunk
Easy Hotel – Powerful Hotel Booking vtrunk
2.0.8 2.0.7 2.0.6 2.0.5 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.9.9 1.9.8 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 All 110 releases
easy-hotel / admin / includes / framework / views / welcome.php

welcome.php in Easy Hotel – Powerful Hotel Booking trunk, at admin/includes/framework/views/welcome.php

150 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2 /**
3 *
4 * Setup Framework Class
5 *
6 * @since 1.0.0
7 * @version 1.0.0
8 *
9 */
10 if ( ! class_exists( 'ESHB_Welcome' ) ) {
11 class ESHB_Welcome{
12
13 private static $instance = null;
14
15 public function __construct() {
16
17 if ( ESHB::$premium && ( ! ESHB::is_active_plugin( 'codestar-framework/codestar-framework.php' ) || apply_filters( 'eshb_welcome_page', true ) === false ) ) { return; }
18
19 add_action( 'admin_menu', array( $this, 'add_about_menu' ), 0 );
20 add_filter( 'plugin_action_links', array( $this, 'add_plugin_action_links' ), 10, 5 );
21 add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
22
23 $this->set_demo_mode();
24
25 }
26
27 // instance
28 public static function instance() {
29 if ( is_null( self::$instance ) ) {
30 self::$instance = new self();
31 }
32 return self::$instance;
33 }
34
35 public function add_about_menu() {
36 add_management_page( 'Codestar Framework', 'Codestar Framework', 'manage_options', 'eshb-welcome', array( $this, 'add_page_welcome' ) );
37 }
38
39 public function add_page_welcome() {
40
41 // Verify nonce for security
42 if (isset($_POST['eshb_save_meta'])) {
43 wp_verify_nonce( sanitize_text_field(wp_unslash($_POST['eshb_save_meta'])), 'eshb_save_meta_box_nonce');
44 }
45
46 $section = ( ! empty( $_GET['section'] ) ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '';
47
48 ESHB::include_plugin_file( 'views/header.php' );
49
50 // safely include pages
51 switch ( $section ) {
52
53 case 'quickstart':
54 ESHB::include_plugin_file( 'views/quickstart.php' );
55 break;
56
57 case 'documentation':
58 ESHB::include_plugin_file( 'views/documentation.php' );
59 break;
60
61 case 'relnotes':
62 ESHB::include_plugin_file( 'views/relnotes.php' );
63 break;
64
65 case 'support':
66 ESHB::include_plugin_file( 'views/support.php' );
67 break;
68
69 case 'free-vs-premium':
70 ESHB::include_plugin_file( 'views/free-vs-premium.php' );
71 break;
72
73 default:
74 ESHB::include_plugin_file( 'views/about.php' );
75 break;
76
77 }
78
79 ESHB::include_plugin_file( 'views/footer.php' );
80
81 }
82
83 public static function add_plugin_action_links( $links, $plugin_file ) {
84
85 if ( $plugin_file === 'codestar-framework/codestar-framework.php' && ! empty( $links ) ) {
86 $links['csf--welcome'] = '<a href="'. esc_url( admin_url( 'tools.php?page=eshb-welcome' ) ) .'">Settings</a>';
87 if ( ! ESHB::$premium ) {
88 $links['csf--upgrade'] = '<a href="http://codestarframework.com/">Upgrade</a>';
89 }
90 }
91
92 return $links;
93
94 }
95
96 public static function add_plugin_row_meta( $links, $plugin_file ) {
97
98 if ( $plugin_file === 'codestar-framework/codestar-framework.php' && ! empty( $links ) ) {
99 $links['csf--docs'] = '<a href="http://codestarframework.com/documentation/" target="_blank">Documentation</a>';
100 }
101
102 return $links;
103
104 }
105
106 public function set_demo_mode() {
107
108 // Verify nonce for security
109 if (isset($_POST['eshb_save_meta'])) {
110 wp_verify_nonce( sanitize_text_field(wp_unslash($_POST['eshb_save_meta'])), 'eshb_save_meta_box_nonce');
111 }
112
113 $demo_mode = get_option( 'eshb_demo_mode', false );
114
115 $demo_activate = ( ! empty( $_GET[ 'csf-demo' ] ) ) ? sanitize_text_field( wp_unslash( $_GET[ 'csf-demo' ] ) ) : '';
116
117 if ( ! empty( $demo_activate ) ) {
118
119 $demo_mode = ( $demo_activate === 'activate' ) ? true : false;
120
121 update_option( 'eshb_demo_mode', $demo_mode );
122
123 }
124
125 if ( ! empty( $demo_mode ) ) {
126
127 ESHB::include_plugin_file( 'samples/admin-options.php' );
128
129 if ( ESHB::$premium ) {
130
131 ESHB::include_plugin_file( 'samples/customize-options.php' );
132 ESHB::include_plugin_file( 'samples/metabox-options.php' );
133 ESHB::include_plugin_file( 'samples/nav-menu-options.php' );
134 ESHB::include_plugin_file( 'samples/profile-options.php' );
135 ESHB::include_plugin_file( 'samples/shortcode-options.php' );
136 ESHB::include_plugin_file( 'samples/taxonomy-options.php' );
137 ESHB::include_plugin_file( 'samples/widget-options.php' );
138 ESHB::include_plugin_file( 'samples/comment-options.php' );
139
140 }
141
142 }
143
144 }
145
146 }
147
148 ESHB_Welcome::instance();
149 }
150