Completed
Branch TASK-10784-decaf-about-page (7938c5)
by
unknown
119:07 queued 105:25
created

About_Admin_Page::_reviews()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
if (!defined('EVENT_ESPRESSO_VERSION') )
3
	exit('NO direct script access allowed');
4
5
/**
6
 *
7
 * EE_About_Admin_Page
8
 *
9
 * This contains the logic for the About Event Espresso Pages
10
 *
11
 *
12
 * @package		EventEspresso
13
 * @subpackage	EE_Admin_Page\About_Admin_Page
14
 * @author		Darren Ethier
15
 *
16
 * ------------------------------------------------------------------------
17
 */
18
class About_Admin_Page extends EE_Admin_Page {
19
20
21 View Code Duplication
	protected function _init_page_props() {
22
		$this->page_slug = EE_ABOUT_PG_SLUG;
23
		$this->page_label = esc_html__('About Event Espresso', 'event_espresso');
24
		$this->_admin_base_url = EE_ABOUT_ADMIN_URL;
25
		$this->_admin_base_path = EE_ABOUT_ADMIN;
26
	}
27
28
29
30
	protected function _ajax_hooks() {
31
		//todo: all hooks for ajax goes here.
32
	}
33
34
35
36
	protected function _define_page_props() {
37
		$this->_labels = array();
38
		$this->_admin_page_title = $this->page_label;
39
	}
40
41
42
43
	protected function _set_page_routes() {
44
		$this->_page_routes = array(
45
			'default' => array(
46
				'func' => '_overview',
47
				'capability' => 'manage_options'
48
				),
49
			//'overview' => '_overview',
50
				//'func' => '_overview',
51
				//'capability' => 'ee_read_ee'
52
				//),
53
			'credits' => array(
54
				'func' => '_credits',
55
				'capability' => 'manage_options'
56
				),
57
			'reviews' => array(
58
				'func' => '_reviews',
59
				'capability' => 'manage_options'
60
				),
61
			'decafvpro' => array(
62
				'func' => '_decafvpro',
63
				'capability' => 'manage_options'
64
				),			
65
			);
66
	}
67
68
69
70
	protected function _set_page_config() {
71
		$this->_page_config = array(
72
			/*'default' => array(
73
				'nav' => array(
74
					'label' => __('What\'s New', 'event_espresso'),
75
					'order' => 10),
76
				'require_nonce' => FALSE
77
				),*/
78
			//'overview' => array(
79
			'default' => array(
80
				'nav' => array(
81
					'label' => esc_html__('About', 'event_espresso'),
82
					'order' => 20),
83
				'require_nonce' => FALSE
84
				),
85
			'credits' => array(
86
				'nav' => array(
87
					'label' => esc_html__('Credits', 'event_espresso'),
88
					'order' => 30),
89
				'require_nonce' => FALSE
90
				),
91
			'reviews' => array(
92
				'nav' => array(
93
					'label' => esc_html__('Reviews', 'event_espresso'),
94
					'order' => 40),
95
				'require_nonce' => FALSE
96
				),
97
			'decafvpro' => array(
98
				'nav' => array(
99
					'label' => esc_html__('Decaf vs Regular', 'event_espresso'),
100
					'order' => 50),
101
				'require_nonce' => FALSE
102
				),
103
			);
104
	}
105
106
107
108
	//none of the below group are currently used for Support pages
109
	protected function _add_screen_options() {}
110
	protected function _add_feature_pointers() {}
111
	public function admin_init() {}
112
	public function admin_notices() {}
113
	public function admin_footer_scripts() {}
114
	public function load_scripts_styles() {}
115
116
117
	protected function _whats_new() {
118
		/*$steps = EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ? $this->_get_started_steps() : FALSE;
119
		$steps = $steps !== FALSE ? $steps : '';
120
		$this->_admin_page_title = sprintf( __('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION );
121
		$settings_message = $steps;
122
		$this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso' ) . $settings_message;
123
		$template = EE_ABOUT_TEMPLATE_PATH . 'whats_new.template.php';
124
		$this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE );
125
		$this->display_about_admin_page();*/
126
	}
127
128
129
130
	protected function _overview() {
131
		/*$this->_template_args['admin_page_title'] = __('About Event Espresso', 'event_espresso');
132
		$this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso Decaf, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso');
133
		$template = EE_ABOUT_TEMPLATE_PATH . 'ee4-overview.template.php';
134
		$this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE );
135
		$this->display_about_admin_page();*/
136
137
		//Copied from _whats_new()
138
		$steps = EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ? $this->_get_started_steps() : FALSE;
139
		$steps = $steps !== FALSE ? $steps : '';
140
		$this->_admin_page_title = sprintf( esc_html__('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION );
141
		$settings_message = $steps;
142
		$this->_template_args['admin_page_subtitle'] = esc_html__('Thank you for choosing Event Espresso, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso' ) . $settings_message;
143
		$template = EE_ABOUT_TEMPLATE_PATH . 'ee4-overview.template.php';
144
		$this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE );
145
		$this->display_about_admin_page();
146
	}
147
148
149
150
	protected function _get_started_steps() {
151
		$steps = '<h2>'.esc_html__('Getting Started').'</h2>';
152
		$step_one = '<p>'.sprintf( esc_html__('%sStep 1%s: Visit your %sOrganization Settings%s and add/update your details.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_general_settings">', '</a>') .'</strong></p>';
153
		$step_two = '<p>'.sprintf( esc_html__('%sStep 2%s: Setup your %sPayment Methods%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_payment_settings">', '</a>') .'</strong></p>';
154
		$step_three = '<p>'.sprintf( esc_html__('%sStep 3%s: Create your %sFirst Event%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_events&action=create_new">', '</a>') .'</strong></p>';
155
156
		//done?
157
		$done_step_one = EE_Registry::instance()->CFG->organization->address_1 == '123 Onna Road' ? FALSE : TRUE;
158
		$active_invoice_pm = EEM_Payment_Method::instance()->get_one_active( EEM_Payment_Method::scope_cart, array( array( 'PMD_type' => 'Invoice' ) ) );
159
		$active_pms_count = EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart );
160
		//done step two if a non-invoice paymetn method is active; or there is more than one PM active, or
161
		//if only the invoice is active but it's clearly been updated
162
		$done_step_two = $active_pms_count > 1  ||
163
						 ( $active_pms_count === 1 && ! $active_invoice_pm )	||
164
						 ( $active_invoice_pm instanceof EE_Payment_Method && (
165
								 $active_invoice_pm->get_extra_meta( 'pdf_payee_name', TRUE, '' ) ||
166
								 $active_invoice_pm->get_extra_meta( 'pdf_payee_email', TRUE, '' ) ||
167
								 $active_invoice_pm->get_extra_meta( 'pdf_payee_tax_number', TRUE, '' ) ||
168
								 $active_invoice_pm->get_extra_meta( 'pdf_payee_address', TRUE, '' ) ||
169
								 $active_invoice_pm->get_extra_meta( 'page_extra_info', TRUE, '' )
170
								)
171
				);
172
		$done_step_three = EE_Registry::instance()->load_model('Event')->count() > 0 ? TRUE : FALSE;
173
174
		//if ALL steps are done, let's just return FALSE so we don't display anything
175
		if ( $done_step_one && $done_step_two && $done_step_three )
176
			return FALSE;
177
178
		//now let's put it together
179
		$steps .= sprintf( '%s' . $step_one . '%s', $done_step_one ? '<strike>' : '', $done_step_one ? '</strike>': '' );
180
		$steps .= sprintf( '%s' . $step_two . '%s', $done_step_two ? '<strike>' : '', $done_step_two ? '</strike>': '' );
181
		$steps .= sprintf( '%s' . $step_three . '%s', $done_step_three ? '<strike>' : '', $done_step_three ? '</strike>': '' );
182
183
		return $steps;
184
	}
185
186
187
188 View Code Duplication
	protected function _credits() {
189
		$this->_template_args['admin_page_title'] = sprintf( __('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION );
190
		$this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso Decaf, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso');
191
		$template = EE_ABOUT_TEMPLATE_PATH . 'credits.template.php';
192
		$this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE );
193
		$this->display_about_admin_page();
194
	}
195
196 View Code Duplication
	protected function _reviews() {
197
		$this->_template_args['admin_page_title'] = __('Rave Reviews About Event Espresso 4', 'event_espresso');
198
		$this->_template_args['admin_page_subtitle'] = __('At Event Espresso, customer satisfaction is our ultimate goal.', 'event_espresso');
199
		$template = EE_ABOUT_TEMPLATE_PATH . 'reviews.template.php';
200
		$this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE );
201
		$this->display_about_admin_page();
202
	}
203
204
	protected function _decafvpro() {
205
		$this->_template_args['admin_page_title'] = sprintf( __('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION );
206
		$this->_template_args['admin_page_subtitle'] = sprintf(__('Event Espresso lets you focus on doing %swhat you love%s — %sorganizing your events%s', 'event_espresso'), '<em>', '</em>', '<strong>', '</strong>');
207
		$template = EE_ABOUT_TEMPLATE_PATH . 'decafvpro.template.php';
208
		$this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE );
209
		$this->display_about_admin_page();
210
	}
211
212
213
214
} //end Support_Admin_Page class
215