PluginProbe
Cool Timeline (Horizontal & Vertical Timeline) / trunk
Cool Timeline (Horizontal & Vertical Timeline) vtrunk
3.4.0 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 2.2.3 2.3.3 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.6.1 2.7.1 2.8.3 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 All 79 releases
cool-timeline / admin / codestar-framework / views / welcome.php

welcome.php in Cool Timeline (Horizontal & Vertical Timeline) trunk, at admin/codestar-framework/views/welcome.php

144 lines 4.3 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( 'CSF_Welcome' ) ) {
11 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
12 class CSF_Welcome{
13
14 private static $instance = null;
15
16 public function __construct() {
17
18 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
19 if ( CSF::$premium && ( ! CSF::is_active_plugin( 'codestar-framework/codestar-framework.php' ) || apply_filters( 'csf_welcome_page', true ) === false ) ) { return; }
20
21 add_action( 'admin_menu', array( $this, 'add_about_menu' ), 0 );
22 add_filter( 'plugin_action_links', array( $this, 'add_plugin_action_links' ), 10, 5 );
23 add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
24
25 $this->set_demo_mode();
26
27 }
28
29 // instance
30 public static function instance() {
31 if ( is_null( self::$instance ) ) {
32 self::$instance = new self();
33 }
34 return self::$instance;
35 }
36
37 public function add_about_menu() {
38 add_management_page( 'Codestar Framework', 'Codestar Framework', 'manage_options', 'csf-welcome', array( $this, 'add_page_welcome' ) );
39 }
40
41 public function add_page_welcome() {
42
43 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
44 $section = ( ! empty( $_GET['section'] ) ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '';
45
46 CSF::include_plugin_file( 'views/header.php' );
47
48 // safely include pages
49 switch ( $section ) {
50
51 case 'quickstart':
52 CSF::include_plugin_file( 'views/quickstart.php' );
53 break;
54
55 case 'documentation':
56 CSF::include_plugin_file( 'views/documentation.php' );
57 break;
58
59 case 'relnotes':
60 CSF::include_plugin_file( 'views/relnotes.php' );
61 break;
62
63 case 'support':
64 CSF::include_plugin_file( 'views/support.php' );
65 break;
66
67 case 'free-vs-premium':
68 CSF::include_plugin_file( 'views/free-vs-premium.php' );
69 break;
70
71 default:
72 CSF::include_plugin_file( 'views/about.php' );
73 break;
74
75 }
76
77 CSF::include_plugin_file( 'views/footer.php' );
78
79 }
80
81 public static function add_plugin_action_links( $links, $plugin_file ) {
82
83 if ( $plugin_file === 'codestar-framework/codestar-framework.php' && ! empty( $links ) ) {
84 $links['csf--welcome'] = '<a href="'. esc_url( admin_url( 'tools.php?page=csf-welcome' ) ) .'">Settings</a>';
85 if ( ! CSF::$premium ) {
86 $links['csf--upgrade'] = '<a href="http://codestarframework.com/">Upgrade</a>';
87 }
88 }
89
90 return $links;
91
92 }
93
94 public static function add_plugin_row_meta( $links, $plugin_file ) {
95
96 if ( $plugin_file === 'codestar-framework/codestar-framework.php' && ! empty( $links ) ) {
97 $links['csf--docs'] = '<a href="http://codestarframework.com/documentation/" target="_blank">Documentation</a>';
98 }
99
100 return $links;
101
102 }
103
104 public function set_demo_mode() {
105
106 $demo_mode = get_option( 'csf_demo_mode', false );
107
108 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
109 $demo_activate = ( ! empty( $_GET[ 'csf-demo' ] ) ) ? sanitize_text_field( wp_unslash( $_GET[ 'csf-demo' ] ) ) : '';
110
111 if ( ! empty( $demo_activate ) ) {
112
113 $demo_mode = ( $demo_activate === 'activate' ) ? true : false;
114
115 update_option( 'csf_demo_mode', $demo_mode );
116
117 }
118
119 if ( ! empty( $demo_mode ) ) {
120
121 CSF::include_plugin_file( 'samples/admin-options.php' );
122
123 if ( CSF::$premium ) {
124
125 CSF::include_plugin_file( 'samples/customize-options.php' );
126 CSF::include_plugin_file( 'samples/metabox-options.php' );
127 CSF::include_plugin_file( 'samples/nav-menu-options.php' );
128 CSF::include_plugin_file( 'samples/profile-options.php' );
129 CSF::include_plugin_file( 'samples/shortcode-options.php' );
130 CSF::include_plugin_file( 'samples/taxonomy-options.php' );
131 CSF::include_plugin_file( 'samples/widget-options.php' );
132 CSF::include_plugin_file( 'samples/comment-options.php' );
133
134 }
135
136 }
137
138 }
139
140 }
141
142 CSF_Welcome::instance();
143 }
144