@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Select_Reveal_Input |
4 | 4 | * |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Reveal_Input extends EE_Select_Input{ |
|
14 | +class EE_Select_Reveal_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $answer_options Array keys which match a sibling section's name |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $input_settings |
28 | 28 | */ |
29 | - public function __construct( $answer_options, $input_settings = array() ){ |
|
30 | - parent::__construct( $answer_options, $input_settings ); |
|
29 | + public function __construct($answer_options, $input_settings = array()) { |
|
30 | + parent::__construct($answer_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function sibling_sections_controlled() { |
38 | 38 | $sibling_sections = array(); |
39 | - foreach( $this->options() as $sibling_section_name => $sibling_section ) { |
|
39 | + foreach ($this->options() as $sibling_section_name => $sibling_section) { |
|
40 | 40 | //if it's an empty string just leave it alone |
41 | - if( empty( $sibling_section_name ) ) { |
|
41 | + if (empty($sibling_section_name)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | - $sibling_section = $this->find_section_from_path( '../' . $sibling_section_name ); |
|
45 | - if( |
|
44 | + $sibling_section = $this->find_section_from_path('../'.$sibling_section_name); |
|
45 | + if ( |
|
46 | 46 | $sibling_section instanceof EE_Form_Section_Base |
47 | - && ! empty( $sibling_section_name ) |
|
47 | + && ! empty($sibling_section_name) |
|
48 | 48 | ) { |
49 | - $sibling_sections[ $sibling_section_name ] = $sibling_section; |
|
49 | + $sibling_sections[$sibling_section_name] = $sibling_section; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | return $sibling_sections; |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | * @param array $form_other_js_data |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
63 | - $form_other_js_data = parent::get_other_js_data( $form_other_js_data ); |
|
64 | - if( ! isset($form_other_js_data[ 'select_reveal_inputs' ] ) ) { |
|
65 | - $form_other_js_data[ 'select_reveal_inputs' ] = array(); |
|
62 | + public function get_other_js_data($form_other_js_data = array()) { |
|
63 | + $form_other_js_data = parent::get_other_js_data($form_other_js_data); |
|
64 | + if ( ! isset($form_other_js_data['select_reveal_inputs'])) { |
|
65 | + $form_other_js_data['select_reveal_inputs'] = array(); |
|
66 | 66 | } |
67 | 67 | $sibling_input_to_html_id_map = array(); |
68 | - foreach( $this->sibling_sections_controlled() as $sibling_section_path => $sibling_section ) { |
|
69 | - $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id(); |
|
68 | + foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { |
|
69 | + $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); |
|
70 | 70 | } |
71 | - $form_other_js_data[ 'select_reveal_inputs' ][ $this->html_id() ] = $sibling_input_to_html_id_map; |
|
71 | + $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; |
|
72 | 72 | return $form_other_js_data; |
73 | 73 | } |
74 | 74 |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return string |
15 | 15 | */ |
16 | - public function layout_form_begin( $additional_args = array() ) { |
|
16 | + public function layout_form_begin($additional_args = array()) { |
|
17 | 17 | $this->_form_section->set_html_class('form-table'); |
18 | - return parent::layout_form_begin( $additional_args ); |
|
18 | + return parent::layout_form_begin($additional_args); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | * @param EE_Form_Section_Proper $form_section |
26 | 26 | * @return string |
27 | 27 | */ |
28 | - public function layout_subsection( $form_section ){ |
|
29 | - if ( $form_section instanceof EE_Form_Section_Proper ) { |
|
30 | - return EEH_HTML::no_row( $form_section->get_html(), 2 ); |
|
31 | - } else if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
28 | + public function layout_subsection($form_section) { |
|
29 | + if ($form_section instanceof EE_Form_Section_Proper) { |
|
30 | + return EEH_HTML::no_row($form_section->get_html(), 2); |
|
31 | + } else if ($form_section instanceof EE_Form_Section_HTML) { |
|
32 | 32 | return $form_section->get_html(); |
33 | 33 | } |
34 | 34 | return ''; |
@@ -41,30 +41,30 @@ discard block |
||
41 | 41 | * @param EE_Form_Input_Base $input |
42 | 42 | * @return string |
43 | 43 | */ |
44 | - public function layout_input( $input ) { |
|
44 | + public function layout_input($input) { |
|
45 | 45 | |
46 | 46 | if ( |
47 | 47 | $input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy || |
48 | 48 | $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy || |
49 | 49 | $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
50 | 50 | ) { |
51 | - $input->set_html_class( $input->html_class() . ' large-text' ); |
|
51 | + $input->set_html_class($input->html_class().' large-text'); |
|
52 | 52 | } |
53 | - if ( $input instanceof EE_Text_Area_Input ) { |
|
54 | - $input->set_rows( 4 ); |
|
55 | - $input->set_cols( 60 ); |
|
53 | + if ($input instanceof EE_Text_Area_Input) { |
|
54 | + $input->set_rows(4); |
|
55 | + $input->set_cols(60); |
|
56 | 56 | } |
57 | 57 | $input_html = $input->get_html_for_input(); |
58 | 58 | // maybe add errors and help text ? |
59 | - $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
60 | - $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
59 | + $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
60 | + $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
61 | 61 | //overriding parent to add wp admin specific things. |
62 | 62 | $html = ''; |
63 | - if ( $input instanceof EE_Hidden_Input ) { |
|
64 | - $html .= EEH_HTML::no_row( $input->get_html_for_input(), 2 ); |
|
63 | + if ($input instanceof EE_Hidden_Input) { |
|
64 | + $html .= EEH_HTML::no_row($input->get_html_for_input(), 2); |
|
65 | 65 | } else { |
66 | 66 | $html .= EEH_HTML::tr( |
67 | - EEH_HTML::th( $input->get_html_for_label(), '', '', '', 'scope="row"' ) . EEH_HTML::td( $input_html ) |
|
67 | + EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"').EEH_HTML::td($input_html) |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | return $html; |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base{ |
|
3 | +class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base { |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Should be used to start teh form section (Eg a table tag, or a div tag, etc.) |
7 | 7 | * @param array $additional_args |
8 | 8 | * @return string |
9 | 9 | */ |
10 | - public function layout_form_begin( $additional_args = array() ) { |
|
11 | - return EEH_HTML::table( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() ) . EEH_HTML::tbody(); |
|
10 | + public function layout_form_begin($additional_args = array()) { |
|
11 | + return EEH_HTML::table('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style()).EEH_HTML::tbody(); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * @param array $additional_args |
19 | 19 | * @return string |
20 | 20 | */ |
21 | - public function layout_form_end( $additional_args = array() ) { |
|
22 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex( $this->_form_section->html_id() ); |
|
21 | + public function layout_form_end($additional_args = array()) { |
|
22 | + return EEH_HTML::tbodyx().EEH_HTML::tablex($this->_form_section->html_id()); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | * @param EE_Form_Input_Base $input |
30 | 30 | * @return string |
31 | 31 | */ |
32 | - public function layout_input( $input ) { |
|
32 | + public function layout_input($input) { |
|
33 | 33 | $html = ''; |
34 | - if ( $input instanceof EE_Hidden_Input ) { |
|
34 | + if ($input instanceof EE_Hidden_Input) { |
|
35 | 35 | $html .= $input->get_html_for_input(); |
36 | 36 | } else { |
37 | 37 | $html_for_input = $input->get_html_for_input(); |
38 | - $html_for_input .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
39 | - $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
38 | + $html_for_input .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
39 | + $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
40 | 40 | $html .= EEH_HTML::tr( |
41 | - EEH_HTML::th( $input->get_html_for_label() ) . |
|
42 | - EEH_HTML::td( $html_for_input ) |
|
41 | + EEH_HTML::th($input->get_html_for_label()). |
|
42 | + EEH_HTML::td($html_for_input) |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | return $html; |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @param EE_Form_Section_Proper $form_section |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - public function layout_subsection( $form_section ){ |
|
55 | + public function layout_subsection($form_section) { |
|
56 | 56 | $html = ''; |
57 | - if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
57 | + if ($form_section instanceof EE_Form_Section_HTML) { |
|
58 | 58 | $html .= $form_section->get_html(); |
59 | 59 | } else { |
60 | 60 | $html .= EEH_HTML::tr( |
61 | - EEH_HTML::td( $form_section->get_html(), '', '', '', 'colspan="2"' ) |
|
61 | + EEH_HTML::td($form_section->get_html(), '', '', '', 'colspan="2"') |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | return $html; |
@@ -26,31 +26,31 @@ discard block |
||
26 | 26 | * @param EE_Form_Input_Base $input |
27 | 27 | * @return string |
28 | 28 | */ |
29 | - public function layout_input( $input ) { |
|
29 | + public function layout_input($input) { |
|
30 | 30 | $html = ''; |
31 | - if ( $input instanceof EE_Hidden_Input ) { |
|
32 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
33 | - } else if ( $input instanceof EE_Submit_Input ) { |
|
31 | + if ($input instanceof EE_Hidden_Input) { |
|
32 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
33 | + } else if ($input instanceof EE_Submit_Input) { |
|
34 | 34 | $html .= EEH_HTML::br(); |
35 | 35 | $html .= $input->get_html_for_input(); |
36 | - } else if ( $input instanceof EE_Select_Input ) { |
|
36 | + } else if ($input instanceof EE_Select_Input) { |
|
37 | 37 | $html .= EEH_HTML::br(); |
38 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
39 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
40 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
41 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
38 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
39 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
40 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
41 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
42 | 42 | $html .= EEH_HTML::br(); |
43 | - } else if ( $input instanceof EE_Form_Input_With_Options_Base ) { |
|
43 | + } else if ($input instanceof EE_Form_Input_With_Options_Base) { |
|
44 | 44 | $html .= EEH_HTML::br(); |
45 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
46 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
47 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
45 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
46 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
47 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
48 | 48 | } else { |
49 | 49 | $html .= EEH_HTML::br(); |
50 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
51 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
52 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
53 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
50 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
51 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
52 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
53 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
54 | 54 | } |
55 | 55 | $html .= EEH_HTML::nl(-1); |
56 | 56 | return $html; |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param EE_Form_Section_Proper $form_section |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - public function layout_subsection( $form_section ){ |
|
66 | + public function layout_subsection($form_section) { |
|
67 | 67 | // d( $form_section ); |
68 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
68 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * closing div tag for a form |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function layout_form_end(){ |
|
76 | + public function layout_form_end() { |
|
77 | 77 | return EEH_HTML::nl(-1); |
78 | 78 | } |
79 | 79 | } |
80 | 80 | \ No newline at end of file |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | * @since 4.6.0 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base{ |
|
13 | +class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * opening div tag for a form |
17 | 17 | * @return string |
18 | 18 | */ |
19 | 19 | public function layout_form_begin() { |
20 | - return EEH_HTML::div( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() ); |
|
20 | + return EEH_HTML::div('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,38 +26,38 @@ discard block |
||
26 | 26 | * @param EE_Form_Input_Base $input |
27 | 27 | * @return string |
28 | 28 | */ |
29 | - public function layout_input( $input ) { |
|
29 | + public function layout_input($input) { |
|
30 | 30 | $html = ''; |
31 | - if ( $input instanceof EE_Hidden_Input ) { |
|
32 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
33 | - } else if ( $input instanceof EE_Submit_Input ) { |
|
34 | - $html .= EEH_HTML::div( $input->get_html_for_input(), $input->html_id() . '-submit-dv', $input->html_class() . '-submit-dv' ); |
|
35 | - } else if ( $input instanceof EE_Select_Input ) { |
|
31 | + if ($input instanceof EE_Hidden_Input) { |
|
32 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
33 | + } else if ($input instanceof EE_Submit_Input) { |
|
34 | + $html .= EEH_HTML::div($input->get_html_for_input(), $input->html_id().'-submit-dv', $input->html_class().'-submit-dv'); |
|
35 | + } else if ($input instanceof EE_Select_Input) { |
|
36 | 36 | $html .= EEH_HTML::div( |
37 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
38 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
39 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
40 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
41 | - $input->html_id() . '-input-dv', |
|
42 | - $input->html_class() . '-input-dv' |
|
37 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
38 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
39 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
40 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
41 | + $input->html_id().'-input-dv', |
|
42 | + $input->html_class().'-input-dv' |
|
43 | 43 | ); |
44 | - } else if ( $input instanceof EE_Form_Input_With_Options_Base ) { |
|
44 | + } else if ($input instanceof EE_Form_Input_With_Options_Base) { |
|
45 | 45 | $html .= EEH_HTML::div( |
46 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question( $input ) . |
|
47 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
48 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
49 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
50 | - $input->html_id() . '-input-dv', |
|
51 | - $input->html_class() . '-input-dv' |
|
46 | + EEH_HTML::nl().$this->_display_label_for_option_type_question($input). |
|
47 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
48 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
49 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
50 | + $input->html_id().'-input-dv', |
|
51 | + $input->html_class().'-input-dv' |
|
52 | 52 | ); |
53 | 53 | } else { |
54 | 54 | $html .= EEH_HTML::div( |
55 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
56 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
57 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
58 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
59 | - $input->html_id() . '-input-dv', |
|
60 | - $input->html_class() . '-input-dv' |
|
55 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
56 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
57 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
58 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
59 | + $input->html_id().'-input-dv', |
|
60 | + $input->html_class().'-input-dv' |
|
61 | 61 | ); |
62 | 62 | } |
63 | 63 | return $html; |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * @param EE_Form_Input_With_Options_Base $input |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - protected function _display_label_for_option_type_question( EE_Form_Input_With_Options_Base $input ){ |
|
78 | - if ( $input->display_html_label_text() != '' ) { |
|
79 | - $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class(); |
|
80 | - $label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
81 | - $html = '<div id="' . $input->html_label_id() . '"'; |
|
82 | - $html .= ' class="' . $class . '"'; |
|
83 | - $html .= ' style="' . $input->html_label_style() . '">'; |
|
84 | - $html .= $label_text . '</div>'; |
|
77 | + protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) { |
|
78 | + if ($input->display_html_label_text() != '') { |
|
79 | + $class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class(); |
|
80 | + $label_text = $input->required() ? $input->html_label_text().'<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
81 | + $html = '<div id="'.$input->html_label_id().'"'; |
|
82 | + $html .= ' class="'.$class.'"'; |
|
83 | + $html .= ' style="'.$input->html_label_style().'">'; |
|
84 | + $html .= $label_text.'</div>'; |
|
85 | 85 | return $html; |
86 | 86 | } else { |
87 | 87 | return ''; |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param EE_Form_Section_Proper $form_section |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function layout_subsection( $form_section ){ |
|
98 | + public function layout_subsection($form_section) { |
|
99 | 99 | // d( $form_section ); |
100 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
100 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * closing div tag for a form |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function layout_form_end(){ |
|
109 | - return EEH_HTML::divx( $this->_form_section->html_id(), $this->_form_section->html_class() ); |
|
108 | + public function layout_form_end() { |
|
109 | + return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | * @type $name string the name for this form section, if you want to explicitly define it |
80 | 80 | * } |
81 | 81 | */ |
82 | - public function __construct( $options_array = array() ) { |
|
82 | + public function __construct($options_array = array()) { |
|
83 | 83 | // used by display strategies |
84 | 84 | // assign incoming values to properties |
85 | - foreach( $options_array as $key => $value ) { |
|
86 | - $key = '_' . $key; |
|
87 | - if ( property_exists( $this, $key ) && empty( $this->{$key} )) { |
|
85 | + foreach ($options_array as $key => $value) { |
|
86 | + $key = '_'.$key; |
|
87 | + if (property_exists($this, $key) && empty($this->{$key} )) { |
|
88 | 88 | $this->{$key} = $value; |
89 | 89 | } |
90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param $name |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - protected function _construct_finalize( $parent_form_section, $name ){ |
|
100 | + protected function _construct_finalize($parent_form_section, $name) { |
|
101 | 101 | $this->_construction_finalized = TRUE; |
102 | 102 | $this->_parent_section = $parent_form_section; |
103 | 103 | $this->_name = $name; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * @param string $action |
120 | 120 | */ |
121 | - public function set_action( $action ) { |
|
121 | + public function set_action($action) { |
|
122 | 122 | $this->_action = $action; |
123 | 123 | } |
124 | 124 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | public function method() { |
131 | - return ! empty( $this->_method ) ? $this->_method : 'POST'; |
|
131 | + return ! empty($this->_method) ? $this->_method : 'POST'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * @param string $method |
138 | 138 | */ |
139 | - public function set_method( $method ) { |
|
140 | - switch ( $method ) { |
|
139 | + public function set_method($method) { |
|
140 | + switch ($method) { |
|
141 | 141 | case 'get' : |
142 | 142 | case 'GET' : |
143 | 143 | $this->_method = 'GET'; |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @throws \EE_Error |
158 | 158 | */ |
159 | - protected function _set_default_html_id_if_empty(){ |
|
160 | - if( ! $this->_html_id ){ |
|
161 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper ){ |
|
162 | - $this->_html_id = $this->_parent_section->html_id() . '-' . $this->_prep_name_for_html_id( $this->name() ); |
|
163 | - }else{ |
|
164 | - $this->_html_id = $this->_prep_name_for_html_id( $this->name() ); |
|
159 | + protected function _set_default_html_id_if_empty() { |
|
160 | + if ( ! $this->_html_id) { |
|
161 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
162 | + $this->_html_id = $this->_parent_section->html_id().'-'.$this->_prep_name_for_html_id($this->name()); |
|
163 | + } else { |
|
164 | + $this->_html_id = $this->_prep_name_for_html_id($this->name()); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param $name |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - private function _prep_name_for_html_id( $name ) { |
|
177 | - return sanitize_key( str_replace( array( ' ', ' ', '_' ), '-', $name )); |
|
176 | + private function _prep_name_for_html_id($name) { |
|
177 | + return sanitize_key(str_replace(array(' ', ' ', '_'), '-', $name)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * Enqueueing JS after "wp_enqueue_scripts" action may not work |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - public function get_html_and_js(){ |
|
188 | + public function get_html_and_js() { |
|
189 | 189 | return $this->get_html(); |
190 | 190 | } |
191 | 191 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | * @param bool $add_pound_sign |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function html_id( $add_pound_sign = FALSE ){ |
|
205 | - return $add_pound_sign ? '#' . $this->_html_id : $this->_html_id; |
|
204 | + public function html_id($add_pound_sign = FALSE) { |
|
205 | + return $add_pound_sign ? '#'.$this->_html_id : $this->_html_id; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | /** |
211 | 211 | * @return string |
212 | 212 | */ |
213 | - public function html_class(){ |
|
213 | + public function html_class() { |
|
214 | 214 | return $this->_html_class; |
215 | 215 | } |
216 | 216 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | /** |
220 | 220 | * @return string |
221 | 221 | */ |
222 | - public function html_style(){ |
|
222 | + public function html_style() { |
|
223 | 223 | return $this->_html_style; |
224 | 224 | } |
225 | 225 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | /** |
229 | 229 | * @param mixed $html_class |
230 | 230 | */ |
231 | - public function set_html_class( $html_class ) { |
|
231 | + public function set_html_class($html_class) { |
|
232 | 232 | $this->_html_class = $html_class; |
233 | 233 | } |
234 | 234 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | /** |
238 | 238 | * @param mixed $html_id |
239 | 239 | */ |
240 | - public function set_html_id( $html_id ) { |
|
240 | + public function set_html_id($html_id) { |
|
241 | 241 | $this->_html_id = $html_id; |
242 | 242 | } |
243 | 243 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | /** |
247 | 247 | * @param mixed $html_style |
248 | 248 | */ |
249 | - public function set_html_style( $html_style ) { |
|
249 | + public function set_html_style($html_style) { |
|
250 | 250 | $this->_html_style = $html_style; |
251 | 251 | } |
252 | 252 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | /** |
256 | 256 | * @param string $other_html_attributes |
257 | 257 | */ |
258 | - public function set_other_html_attributes( $other_html_attributes ) { |
|
258 | + public function set_other_html_attributes($other_html_attributes) { |
|
259 | 259 | $this->_other_html_attributes = $other_html_attributes; |
260 | 260 | } |
261 | 261 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @throws EE_Error |
276 | 276 | * @return string |
277 | 277 | */ |
278 | - public function name(){ |
|
279 | - if( ! $this->_construction_finalized ){ |
|
280 | - throw new EE_Error(sprintf( __( 'You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso' ), get_class($this) ) ); |
|
278 | + public function name() { |
|
279 | + if ( ! $this->_construction_finalized) { |
|
280 | + throw new EE_Error(sprintf(__('You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso'), get_class($this))); |
|
281 | 281 | } |
282 | 282 | return $this->_name; |
283 | 283 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * Gets the parent section |
289 | 289 | * @return EE_Form_Section_Proper |
290 | 290 | */ |
291 | - public function parent_section(){ |
|
291 | + public function parent_section() { |
|
292 | 292 | return $this->_parent_section; |
293 | 293 | } |
294 | 294 | |
@@ -301,18 +301,18 @@ discard block |
||
301 | 301 | * @param string $other_attributes anything else added to the form open tag, MUST BE VALID HTML |
302 | 302 | * @return string |
303 | 303 | */ |
304 | - public function form_open( $action = '', $method = '', $other_attributes = '' ) { |
|
305 | - if ( ! empty( $action )) { |
|
306 | - $this->set_action( $action ); |
|
304 | + public function form_open($action = '', $method = '', $other_attributes = '') { |
|
305 | + if ( ! empty($action)) { |
|
306 | + $this->set_action($action); |
|
307 | 307 | } |
308 | - if ( ! empty( $method )) { |
|
309 | - $this->set_method( $method ); |
|
308 | + if ( ! empty($method)) { |
|
309 | + $this->set_method($method); |
|
310 | 310 | } |
311 | - $html = EEH_HTML::nl( 1, 'form' ) . '<form'; |
|
312 | - $html .= $this->html_id() !== '' ? ' id="' . $this->html_id() . '"' : ''; |
|
313 | - $html .= ' action="' . $this->action() . '"'; |
|
314 | - $html .= ' method="' . $this->method() . '"'; |
|
315 | - $html .= $other_attributes . '>'; |
|
311 | + $html = EEH_HTML::nl(1, 'form').'<form'; |
|
312 | + $html .= $this->html_id() !== '' ? ' id="'.$this->html_id().'"' : ''; |
|
313 | + $html .= ' action="'.$this->action().'"'; |
|
314 | + $html .= ' method="'.$this->method().'"'; |
|
315 | + $html .= $other_attributes.'>'; |
|
316 | 316 | return $html; |
317 | 317 | } |
318 | 318 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @return string |
324 | 324 | */ |
325 | 325 | public function form_close() { |
326 | - return EEH_HTML::nl( -1, 'form' ) . '</form>' . EEH_HTML::nl() . '<!-- end of ee-' . $this->html_id() . '-form -->' . EEH_HTML::nl(); |
|
326 | + return EEH_HTML::nl( -1, 'form' ).'</form>'.EEH_HTML::nl().'<!-- end of ee-'.$this->html_id().'-form -->'.EEH_HTML::nl(); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * Default does nothing, but child classes can override |
333 | 333 | * @return string |
334 | 334 | */ |
335 | - public function enqueue_js(){ |
|
335 | + public function enqueue_js() { |
|
336 | 336 | //defaults to enqueue NO js or css |
337 | 337 | } |
338 | 338 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @param array $form_other_js_data |
349 | 349 | * @return array |
350 | 350 | */ |
351 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
351 | + public function get_other_js_data($form_other_js_data = array()) { |
|
352 | 352 | return $form_other_js_data; |
353 | 353 | } |
354 | 354 | |
@@ -366,20 +366,20 @@ discard block |
||
366 | 366 | * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false |
367 | 367 | * @return EE_Form_Section_Base |
368 | 368 | */ |
369 | - public function find_section_from_path( $form_section_path ) { |
|
370 | - if( strpos( $form_section_path, '/' ) === 0 ) { |
|
371 | - $form_section_path = substr( $form_section_path, strlen( '/' ) ); |
|
369 | + public function find_section_from_path($form_section_path) { |
|
370 | + if (strpos($form_section_path, '/') === 0) { |
|
371 | + $form_section_path = substr($form_section_path, strlen('/')); |
|
372 | 372 | } |
373 | - if( empty( $form_section_path ) ) { |
|
373 | + if (empty($form_section_path)) { |
|
374 | 374 | return $this; |
375 | 375 | } |
376 | - if( strpos( $form_section_path, '../' ) === 0 ) { |
|
376 | + if (strpos($form_section_path, '../') === 0) { |
|
377 | 377 | $parent = $this->parent_section(); |
378 | 378 | |
379 | - $form_section_path = substr( $form_section_path, strlen( '../' ) ); |
|
380 | - if( $parent instanceof EE_Form_Section_Base ) { |
|
381 | - return $parent->find_section_from_path( $form_section_path ); |
|
382 | - } elseif( empty( $form_section_path ) ) { |
|
379 | + $form_section_path = substr($form_section_path, strlen('../')); |
|
380 | + if ($parent instanceof EE_Form_Section_Base) { |
|
381 | + return $parent->find_section_from_path($form_section_path); |
|
382 | + } elseif (empty($form_section_path)) { |
|
383 | 383 | return $this; |
384 | 384 | } |
385 | 385 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{ |
|
11 | +abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * the input's name attribute |
@@ -143,54 +143,54 @@ discard block |
||
143 | 143 | * @type EE_Validation_Strategy_Base[] $validation_strategies |
144 | 144 | * } |
145 | 145 | */ |
146 | - public function __construct( $input_args = array() ){ |
|
147 | - $input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this ); |
|
146 | + public function __construct($input_args = array()) { |
|
147 | + $input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this); |
|
148 | 148 | // the following properties must be cast as arrays |
149 | - if ( isset( $input_args['validation_strategies'] ) ) { |
|
150 | - foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) { |
|
151 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
152 | - $this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy; |
|
149 | + if (isset($input_args['validation_strategies'])) { |
|
150 | + foreach ((array) $input_args['validation_strategies'] as $validation_strategy) { |
|
151 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
152 | + $this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy; |
|
153 | 153 | } |
154 | 154 | } |
155 | - unset( $input_args['validation_strategies'] ); |
|
155 | + unset($input_args['validation_strategies']); |
|
156 | 156 | } |
157 | 157 | // loop thru incoming options |
158 | - foreach( $input_args as $key => $value ) { |
|
158 | + foreach ($input_args as $key => $value) { |
|
159 | 159 | // add underscore to $key to match property names |
160 | - $_key = '_' . $key; |
|
161 | - if ( property_exists( $this, $_key )) { |
|
160 | + $_key = '_'.$key; |
|
161 | + if (property_exists($this, $_key)) { |
|
162 | 162 | $this->{$_key} = $value; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | // ensure that "required" is set correctly |
166 | 166 | $this->set_required( |
167 | - $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) |
|
168 | - ? $input_args[ 'required_validation_error_message' ] |
|
167 | + $this->_required, isset($input_args['required_validation_error_message']) |
|
168 | + ? $input_args['required_validation_error_message'] |
|
169 | 169 | : null |
170 | 170 | ); |
171 | 171 | |
172 | 172 | //$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE; |
173 | 173 | |
174 | 174 | $this->_display_strategy->_construct_finalize($this); |
175 | - foreach( $this->_validation_strategies as $validation_strategy ){ |
|
175 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
176 | 176 | $validation_strategy->_construct_finalize($this); |
177 | 177 | } |
178 | 178 | |
179 | - if( ! $this->_normalization_strategy){ |
|
179 | + if ( ! $this->_normalization_strategy) { |
|
180 | 180 | $this->_normalization_strategy = new EE_Text_Normalization(); |
181 | 181 | } |
182 | 182 | $this->_normalization_strategy->_construct_finalize($this); |
183 | 183 | |
184 | 184 | //at least we can use the normalization strategy to populate the default |
185 | - if( isset( $input_args[ 'default' ] ) ) { |
|
186 | - $this->set_default( $input_args[ 'default' ] ); |
|
185 | + if (isset($input_args['default'])) { |
|
186 | + $this->set_default($input_args['default']); |
|
187 | 187 | } |
188 | 188 | |
189 | - if( ! $this->_sensitive_data_removal_strategy){ |
|
189 | + if ( ! $this->_sensitive_data_removal_strategy) { |
|
190 | 190 | $this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal(); |
191 | 191 | } |
192 | 192 | $this->_sensitive_data_removal_strategy->_construct_finalize($this); |
193 | - parent::__construct( $input_args ); |
|
193 | + parent::__construct($input_args); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | - protected function _set_default_html_name_if_empty(){ |
|
205 | - if( ! $this->_html_name){ |
|
204 | + protected function _set_default_html_name_if_empty() { |
|
205 | + if ( ! $this->_html_name) { |
|
206 | 206 | $this->_html_name = $this->name(); |
207 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){ |
|
208 | - $this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]"; |
|
207 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
208 | + $this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]"; |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | } |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | public function _construct_finalize($parent_form_section, $name) { |
221 | 221 | parent::_construct_finalize($parent_form_section, $name); |
222 | 222 | $this->_set_default_html_name_if_empty(); |
223 | - if( ! $this->_html_label && ! $this->_html_label_text){ |
|
224 | - $this->_html_label_text = ucwords( str_replace("_"," ",$name)); |
|
223 | + if ( ! $this->_html_label && ! $this->_html_label_text) { |
|
224 | + $this->_html_label_text = ucwords(str_replace("_", " ", $name)); |
|
225 | 225 | } |
226 | - do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name ); |
|
226 | + do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @return EE_Display_Strategy_Base |
232 | 232 | * @throws EE_Error |
233 | 233 | */ |
234 | - protected function _get_display_strategy(){ |
|
235 | - if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){ |
|
234 | + protected function _get_display_strategy() { |
|
235 | + if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) { |
|
236 | 236 | throw new EE_Error( |
237 | 237 | sprintf( |
238 | 238 | __( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->html_id() |
244 | 244 | ) |
245 | 245 | ); |
246 | - }else{ |
|
246 | + } else { |
|
247 | 247 | return $this->_display_strategy; |
248 | 248 | } |
249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * Sets the display strategy. |
252 | 252 | * @param EE_Display_Strategy_Base $strategy |
253 | 253 | */ |
254 | - protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){ |
|
254 | + protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) { |
|
255 | 255 | $this->_display_strategy = $strategy; |
256 | 256 | } |
257 | 257 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * Sets the sanitization strategy |
260 | 260 | * @param EE_Normalization_Strategy_Base $strategy |
261 | 261 | */ |
262 | - protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){ |
|
262 | + protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) { |
|
263 | 263 | $this->_normalization_strategy = $strategy; |
264 | 264 | } |
265 | 265 | |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | * Gets the display strategy for this input |
286 | 286 | * @return EE_Display_Strategy_Base |
287 | 287 | */ |
288 | - public function get_display_strategy(){ |
|
288 | + public function get_display_strategy() { |
|
289 | 289 | return $this->_display_strategy; |
290 | 290 | } |
291 | 291 | /** |
292 | 292 | * Overwrites the display strategy |
293 | 293 | * @param EE_Display_Strategy_Base $display_strategy |
294 | 294 | */ |
295 | - public function set_display_strategy($display_strategy){ |
|
295 | + public function set_display_strategy($display_strategy) { |
|
296 | 296 | $this->_display_strategy = $display_strategy; |
297 | 297 | $this->_display_strategy->_construct_finalize($this); |
298 | 298 | } |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * Gets the normalization strategy set on this input |
301 | 301 | * @return EE_Normalization_Strategy_Base |
302 | 302 | */ |
303 | - public function get_normalization_strategy(){ |
|
303 | + public function get_normalization_strategy() { |
|
304 | 304 | return $this->_normalization_strategy; |
305 | 305 | } |
306 | 306 | /** |
307 | 307 | * Overwrites the normalization strategy |
308 | 308 | * @param EE_Normalization_Strategy_Base $normalization_strategy |
309 | 309 | */ |
310 | - public function set_normalization_strategy($normalization_strategy){ |
|
310 | + public function set_normalization_strategy($normalization_strategy) { |
|
311 | 311 | $this->_normalization_strategy = $normalization_strategy; |
312 | 312 | $this->_normalization_strategy->_construct_finalize($this); |
313 | 313 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * Returns all teh validation strategies which apply to this field, numerically indexed |
317 | 317 | * @return EE_Validation_Strategy_Base[] |
318 | 318 | */ |
319 | - public function get_validation_strategies(){ |
|
319 | + public function get_validation_strategies() { |
|
320 | 320 | return $this->_validation_strategies; |
321 | 321 | } |
322 | 322 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * @param EE_Validation_Strategy_Base $validation_strategy |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){ |
|
331 | - $validation_strategy->_construct_finalize( $this ); |
|
330 | + protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
331 | + $validation_strategy->_construct_finalize($this); |
|
332 | 332 | $this->_validation_strategies[] = $validation_strategy; |
333 | 333 | } |
334 | 334 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_Validation_Strategy_Base $validation_strategy |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) { |
|
343 | - $this->_add_validation_strategy( $validation_strategy ); |
|
342 | + public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
343 | + $this->_add_validation_strategy($validation_strategy); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -350,13 +350,13 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @param string $validation_strategy_classname |
352 | 352 | */ |
353 | - public function remove_validation_strategy( $validation_strategy_classname ) { |
|
354 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
355 | - if( |
|
353 | + public function remove_validation_strategy($validation_strategy_classname) { |
|
354 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
355 | + if ( |
|
356 | 356 | $validation_strategy instanceof $validation_strategy_classname |
357 | - || is_subclass_of( $validation_strategy, $validation_strategy_classname ) |
|
357 | + || is_subclass_of($validation_strategy, $validation_strategy_classname) |
|
358 | 358 | ) { |
359 | - unset( $this->_validation_strategies[ $key ] ); |
|
359 | + unset($this->_validation_strategies[$key]); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | } |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | * @param array $validation_strategy_classnames |
370 | 370 | * @return bool |
371 | 371 | */ |
372 | - public function has_validation_strategy( $validation_strategy_classnames ) { |
|
373 | - $validation_strategy_classnames = is_array( $validation_strategy_classnames ) |
|
372 | + public function has_validation_strategy($validation_strategy_classnames) { |
|
373 | + $validation_strategy_classnames = is_array($validation_strategy_classnames) |
|
374 | 374 | ? $validation_strategy_classnames |
375 | - : array( $validation_strategy_classnames ); |
|
376 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
377 | - if( in_array( $key, $validation_strategy_classnames ) ) { |
|
375 | + : array($validation_strategy_classnames); |
|
376 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
377 | + if (in_array($key, $validation_strategy_classnames)) { |
|
378 | 378 | return true; |
379 | 379 | } |
380 | 380 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * Gets the HTML |
388 | 388 | * @return string |
389 | 389 | */ |
390 | - public function get_html(){ |
|
390 | + public function get_html() { |
|
391 | 391 | return $this->_parent_section->get_html_for_input($this); |
392 | 392 | } |
393 | 393 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @return string |
402 | 402 | * @throws \EE_Error |
403 | 403 | */ |
404 | - public function get_html_for_input(){ |
|
404 | + public function get_html_for_input() { |
|
405 | 405 | return $this->_get_display_strategy()->display(); |
406 | 406 | } |
407 | 407 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @return string |
412 | 412 | */ |
413 | 413 | public function html_other_attributes() { |
414 | - return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : ''; |
|
414 | + return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : ''; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | /** |
420 | 420 | * @param string $html_other_attributes |
421 | 421 | */ |
422 | - public function set_html_other_attributes( $html_other_attributes ) { |
|
422 | + public function set_html_other_attributes($html_other_attributes) { |
|
423 | 423 | $this->_html_other_attributes = $html_other_attributes; |
424 | 424 | } |
425 | 425 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * according to the form section's layout strategy |
429 | 429 | * @return string |
430 | 430 | */ |
431 | - public function get_html_for_label(){ |
|
431 | + public function get_html_for_label() { |
|
432 | 432 | return $this->_parent_section->get_layout_strategy()->display_label($this); |
433 | 433 | } |
434 | 434 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * according to the form section's layout strategy |
437 | 437 | * @return string |
438 | 438 | */ |
439 | - public function get_html_for_errors(){ |
|
439 | + public function get_html_for_errors() { |
|
440 | 440 | return $this->_parent_section->get_layout_strategy()->display_errors($this); |
441 | 441 | } |
442 | 442 | /** |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * according to the form section's layout strategy |
445 | 445 | * @return string |
446 | 446 | */ |
447 | - public function get_html_for_help(){ |
|
447 | + public function get_html_for_help() { |
|
448 | 448 | return $this->_parent_section->get_layout_strategy()->display_help_text($this); |
449 | 449 | } |
450 | 450 | /** |
@@ -453,18 +453,18 @@ discard block |
||
453 | 453 | * @return boolean |
454 | 454 | */ |
455 | 455 | protected function _validate() { |
456 | - foreach($this->_validation_strategies as $validation_strategy){ |
|
457 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
458 | - try{ |
|
456 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
457 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
458 | + try { |
|
459 | 459 | $validation_strategy->validate($this->normalized_value()); |
460 | - }catch(EE_Validation_Error $e){ |
|
460 | + } catch (EE_Validation_Error $e) { |
|
461 | 461 | $this->add_validation_error($e); |
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
465 | - if( $this->get_validation_errors()){ |
|
465 | + if ($this->get_validation_errors()) { |
|
466 | 466 | return false; |
467 | - }else{ |
|
467 | + } else { |
|
468 | 468 | return true; |
469 | 469 | } |
470 | 470 | } |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | * @param string $value |
478 | 478 | * @return null|string |
479 | 479 | */ |
480 | - private function _sanitize($value){ |
|
481 | - return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field |
|
480 | + private function _sanitize($value) { |
|
481 | + return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | |
@@ -492,24 +492,24 @@ discard block |
||
492 | 492 | * @return boolean whether or not there was an error |
493 | 493 | * @throws \EE_Error |
494 | 494 | */ |
495 | - protected function _normalize( $req_data ) { |
|
495 | + protected function _normalize($req_data) { |
|
496 | 496 | //any existing validation errors don't apply so clear them |
497 | 497 | $this->_validation_errors = array(); |
498 | 498 | try { |
499 | - $raw_input = $this->find_form_data_for_this_section( $req_data ); |
|
499 | + $raw_input = $this->find_form_data_for_this_section($req_data); |
|
500 | 500 | //super simple sanitization for now |
501 | - if ( is_array( $raw_input )) { |
|
501 | + if (is_array($raw_input)) { |
|
502 | 502 | $this->_raw_value = array(); |
503 | - foreach( $raw_input as $key => $value ) { |
|
504 | - $this->_raw_value[ $key ] = $this->_sanitize( $value ); |
|
503 | + foreach ($raw_input as $key => $value) { |
|
504 | + $this->_raw_value[$key] = $this->_sanitize($value); |
|
505 | 505 | } |
506 | 506 | } else { |
507 | - $this->_raw_value = $this->_sanitize( $raw_input ); |
|
507 | + $this->_raw_value = $this->_sanitize($raw_input); |
|
508 | 508 | } |
509 | 509 | //we want ot mostly leave the input alone in case we need to re-display it to the user |
510 | - $this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() ); |
|
511 | - } catch ( EE_Validation_Error $e ) { |
|
512 | - $this->add_validation_error( $e ); |
|
510 | + $this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value()); |
|
511 | + } catch (EE_Validation_Error $e) { |
|
512 | + $this->add_validation_error($e); |
|
513 | 513 | } |
514 | 514 | } |
515 | 515 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | /** |
519 | 519 | * @return string |
520 | 520 | */ |
521 | - public function html_name(){ |
|
521 | + public function html_name() { |
|
522 | 522 | return $this->_html_name; |
523 | 523 | } |
524 | 524 | |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | /** |
528 | 528 | * @return string |
529 | 529 | */ |
530 | - public function html_label_id(){ |
|
531 | - return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl'; |
|
530 | + public function html_label_id() { |
|
531 | + return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl'; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | /** |
537 | 537 | * @return string |
538 | 538 | */ |
539 | - public function html_label_class(){ |
|
539 | + public function html_label_class() { |
|
540 | 540 | return $this->_html_label_class; |
541 | 541 | } |
542 | 542 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | /** |
546 | 546 | * @return string |
547 | 547 | */ |
548 | - public function html_label_style(){ |
|
548 | + public function html_label_style() { |
|
549 | 549 | return $this->_html_label_style; |
550 | 550 | } |
551 | 551 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | /** |
555 | 555 | * @return string |
556 | 556 | */ |
557 | - public function html_label_text(){ |
|
557 | + public function html_label_text() { |
|
558 | 558 | return $this->_html_label_text; |
559 | 559 | } |
560 | 560 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | /** |
564 | 564 | * @return string |
565 | 565 | */ |
566 | - public function html_help_text(){ |
|
566 | + public function html_help_text() { |
|
567 | 567 | return $this->_html_help_text; |
568 | 568 | } |
569 | 569 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | /** |
573 | 573 | * @return string |
574 | 574 | */ |
575 | - public function html_help_class(){ |
|
575 | + public function html_help_class() { |
|
576 | 576 | return $this->_html_help_class; |
577 | 577 | } |
578 | 578 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | /** |
582 | 582 | * @return string |
583 | 583 | */ |
584 | - public function html_help_style(){ |
|
584 | + public function html_help_style() { |
|
585 | 585 | return $this->_html_style; |
586 | 586 | } |
587 | 587 | /** |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * in which case, we would have stored the malicious content to our database. |
595 | 595 | * @return string |
596 | 596 | */ |
597 | - public function raw_value(){ |
|
597 | + public function raw_value() { |
|
598 | 598 | return $this->_raw_value; |
599 | 599 | } |
600 | 600 | /** |
@@ -602,15 +602,15 @@ discard block |
||
602 | 602 | * it escapes all html entities |
603 | 603 | * @return string |
604 | 604 | */ |
605 | - public function raw_value_in_form(){ |
|
606 | - return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8'); |
|
605 | + public function raw_value_in_form() { |
|
606 | + return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8'); |
|
607 | 607 | } |
608 | 608 | /** |
609 | 609 | * returns the value after it's been sanitized, and then converted into it's proper type |
610 | 610 | * in PHP. Eg, a string, an int, an array, |
611 | 611 | * @return mixed |
612 | 612 | */ |
613 | - public function normalized_value(){ |
|
613 | + public function normalized_value() { |
|
614 | 614 | return $this->_normalized_value; |
615 | 615 | } |
616 | 616 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | * the best thing to display |
621 | 621 | * @return string |
622 | 622 | */ |
623 | - public function pretty_value(){ |
|
623 | + public function pretty_value() { |
|
624 | 624 | return $this->_normalized_value; |
625 | 625 | } |
626 | 626 | /** |
@@ -639,19 +639,19 @@ discard block |
||
639 | 639 | }</code> |
640 | 640 | * @return array |
641 | 641 | */ |
642 | - public function get_jquery_validation_rules(){ |
|
642 | + public function get_jquery_validation_rules() { |
|
643 | 643 | |
644 | 644 | $jquery_validation_rules = array(); |
645 | - foreach($this->get_validation_strategies() as $validation_strategy){ |
|
645 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
646 | 646 | $jquery_validation_rules = array_replace_recursive( |
647 | 647 | $jquery_validation_rules, |
648 | 648 | $validation_strategy->get_jquery_validation_rule_array() |
649 | 649 | ); |
650 | 650 | } |
651 | 651 | |
652 | - if(! empty($jquery_validation_rules)){ |
|
653 | - $jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules; |
|
654 | - }else{ |
|
652 | + if ( ! empty($jquery_validation_rules)) { |
|
653 | + $jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules; |
|
654 | + } else { |
|
655 | 655 | return array(); |
656 | 656 | } |
657 | 657 | return $jquery_validation_js; |
@@ -663,9 +663,9 @@ discard block |
||
663 | 663 | * @param mixed $value |
664 | 664 | * @return void |
665 | 665 | */ |
666 | - public function set_default($value){ |
|
666 | + public function set_default($value) { |
|
667 | 667 | $this->_normalized_value = $value; |
668 | - $this->_raw_value = $this->_normalization_strategy->unnormalize( $value ); |
|
668 | + $this->_raw_value = $this->_normalization_strategy->unnormalize($value); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | /** |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | * @param string $label |
674 | 674 | * @return void |
675 | 675 | */ |
676 | - public function set_html_label_text($label){ |
|
676 | + public function set_html_label_text($label) { |
|
677 | 677 | $this->_html_label_text = $label; |
678 | 678 | } |
679 | 679 | |
@@ -687,13 +687,13 @@ discard block |
||
687 | 687 | * @param boolean $required boolean |
688 | 688 | * @param null $required_text |
689 | 689 | */ |
690 | - public function set_required($required = true, $required_text = NULL ){ |
|
691 | - $required = filter_var( $required, FILTER_VALIDATE_BOOLEAN ); |
|
690 | + public function set_required($required = true, $required_text = NULL) { |
|
691 | + $required = filter_var($required, FILTER_VALIDATE_BOOLEAN); |
|
692 | 692 | //whether $required is a string or a boolean, we want to add a required validation strategy |
693 | - if ( $required ) { |
|
694 | - $this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) ); |
|
693 | + if ($required) { |
|
694 | + $this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text)); |
|
695 | 695 | } else { |
696 | - unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] ); |
|
696 | + unset($this->_validation_strategies['EE_Required_Validation_Strategy']); |
|
697 | 697 | } |
698 | 698 | $this->_required = $required; |
699 | 699 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * Returns whether or not this field is required |
702 | 702 | * @return boolean |
703 | 703 | */ |
704 | - public function required(){ |
|
704 | + public function required() { |
|
705 | 705 | return $this->_required; |
706 | 706 | } |
707 | 707 | |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | /** |
711 | 711 | * @param string $required_css_class |
712 | 712 | */ |
713 | - public function set_required_css_class( $required_css_class ) { |
|
713 | + public function set_required_css_class($required_css_class) { |
|
714 | 714 | $this->_required_css_class = $required_css_class; |
715 | 715 | } |
716 | 716 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | * Sets the help text, in case |
730 | 730 | * @param string $text |
731 | 731 | */ |
732 | - public function set_html_help_text($text){ |
|
732 | + public function set_html_help_text($text) { |
|
733 | 733 | $this->_html_help_text = $text; |
734 | 734 | } |
735 | 735 | /** |
@@ -741,8 +741,8 @@ discard block |
||
741 | 741 | public function clean_sensitive_data() { |
742 | 742 | //if we do ANY kind of sensitive data removal on this, then just clear out the raw value |
743 | 743 | //if we need more logic than this we'll make a strategy for it |
744 | - if( $this->_sensitive_data_removal_strategy && |
|
745 | - ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){ |
|
744 | + if ($this->_sensitive_data_removal_strategy && |
|
745 | + ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) { |
|
746 | 746 | $this->_raw_value = NULL; |
747 | 747 | } |
748 | 748 | //and clean the normalized value according to the appropriate strategy |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | * @param string $button_size |
759 | 759 | * @param string $other_attributes |
760 | 760 | */ |
761 | - public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) { |
|
761 | + public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') { |
|
762 | 762 | $button_css_attributes = 'button'; |
763 | 763 | $button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary'; |
764 | - switch ( $button_size ) { |
|
764 | + switch ($button_size) { |
|
765 | 765 | case 'xs' : |
766 | 766 | case 'extra-small' : |
767 | 767 | $button_css_attributes .= ' button-xs'; |
@@ -782,8 +782,8 @@ discard block |
||
782 | 782 | default : |
783 | 783 | $button_css_attributes .= ''; |
784 | 784 | } |
785 | - $this->_button_css_attributes .= ! empty( $other_attributes ) |
|
786 | - ? $button_css_attributes . ' ' . $other_attributes |
|
785 | + $this->_button_css_attributes .= ! empty($other_attributes) |
|
786 | + ? $button_css_attributes.' '.$other_attributes |
|
787 | 787 | : $button_css_attributes; |
788 | 788 | } |
789 | 789 | |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | * @return string |
794 | 794 | */ |
795 | 795 | public function button_css_attributes() { |
796 | - if ( empty( $this->_button_css_attributes )) { |
|
796 | + if (empty($this->_button_css_attributes)) { |
|
797 | 797 | $this->set_button_css_attributes(); |
798 | 798 | } |
799 | 799 | return $this->_button_css_attributes; |
@@ -815,26 +815,26 @@ discard block |
||
815 | 815 | * @return mixed whatever the raw value of this form section is in the request data |
816 | 816 | * @throws \EE_Error |
817 | 817 | */ |
818 | - public function find_form_data_for_this_section( $req_data ){ |
|
818 | + public function find_form_data_for_this_section($req_data) { |
|
819 | 819 | // break up the html name by "[]" |
820 | - if ( strpos( $this->html_name(), '[' ) !== FALSE ) { |
|
821 | - $before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') ); |
|
820 | + if (strpos($this->html_name(), '[') !== FALSE) { |
|
821 | + $before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '[')); |
|
822 | 822 | } else { |
823 | 823 | $before_any_brackets = $this->html_name(); |
824 | 824 | } |
825 | 825 | // grab all of the segments |
826 | - preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches); |
|
827 | - if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
|
828 | - $name_parts = $matches[ 1 ]; |
|
826 | + preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches); |
|
827 | + if (isset($matches[1]) && is_array($matches[1])) { |
|
828 | + $name_parts = $matches[1]; |
|
829 | 829 | array_unshift($name_parts, $before_any_brackets); |
830 | - }else{ |
|
831 | - $name_parts = array( $before_any_brackets ); |
|
830 | + } else { |
|
831 | + $name_parts = array($before_any_brackets); |
|
832 | 832 | } |
833 | 833 | // now get the value for the input |
834 | 834 | $value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data); |
835 | 835 | // check if this thing's name is at the TOP level of the request data |
836 | - if( $value === null && isset( $req_data[ $this->name() ] ) ){ |
|
837 | - $value = $req_data[ $this->name() ]; |
|
836 | + if ($value === null && isset($req_data[$this->name()])) { |
|
837 | + $value = $req_data[$this->name()]; |
|
838 | 838 | } |
839 | 839 | return $value; |
840 | 840 | } |
@@ -847,18 +847,18 @@ discard block |
||
847 | 847 | * @param array $req_data |
848 | 848 | * @return array | NULL |
849 | 849 | */ |
850 | - public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){ |
|
851 | - $first_part_to_consider = array_shift( $html_name_parts ); |
|
852 | - if( isset( $req_data[ $first_part_to_consider ] ) ){ |
|
853 | - if( empty($html_name_parts ) ){ |
|
854 | - return $req_data[ $first_part_to_consider ]; |
|
855 | - }else{ |
|
850 | + public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) { |
|
851 | + $first_part_to_consider = array_shift($html_name_parts); |
|
852 | + if (isset($req_data[$first_part_to_consider])) { |
|
853 | + if (empty($html_name_parts)) { |
|
854 | + return $req_data[$first_part_to_consider]; |
|
855 | + } else { |
|
856 | 856 | return $this->_find_form_data_for_this_section_using_name_parts( |
857 | 857 | $html_name_parts, |
858 | - $req_data[ $first_part_to_consider ] |
|
858 | + $req_data[$first_part_to_consider] |
|
859 | 859 | ); |
860 | 860 | } |
861 | - }else{ |
|
861 | + } else { |
|
862 | 862 | return NULL; |
863 | 863 | } |
864 | 864 | } |
@@ -872,14 +872,14 @@ discard block |
||
872 | 872 | * @return boolean |
873 | 873 | * @throws \EE_Error |
874 | 874 | */ |
875 | - public function form_data_present_in($req_data = NULL){ |
|
876 | - if( $req_data === NULL ){ |
|
875 | + public function form_data_present_in($req_data = NULL) { |
|
876 | + if ($req_data === NULL) { |
|
877 | 877 | $req_data = $_POST; |
878 | 878 | } |
879 | - $checked_value = $this->find_form_data_for_this_section( $req_data ); |
|
880 | - if( $checked_value !== null ){ |
|
879 | + $checked_value = $this->find_form_data_for_this_section($req_data); |
|
880 | + if ($checked_value !== null) { |
|
881 | 881 | return TRUE; |
882 | - }else{ |
|
882 | + } else { |
|
883 | 883 | return FALSE; |
884 | 884 | } |
885 | 885 | } |
@@ -889,8 +889,8 @@ discard block |
||
889 | 889 | * @param array $form_other_js_data |
890 | 890 | * @return array |
891 | 891 | */ |
892 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
893 | - $form_other_js_data = $this->get_other_js_data_from_strategies( $form_other_js_data ); |
|
892 | + public function get_other_js_data($form_other_js_data = array()) { |
|
893 | + $form_other_js_data = $this->get_other_js_data_from_strategies($form_other_js_data); |
|
894 | 894 | return $form_other_js_data; |
895 | 895 | } |
896 | 896 | |
@@ -899,10 +899,10 @@ discard block |
||
899 | 899 | * the validation strategies and the display strategy |
900 | 900 | * @param array $form_other_js_data |
901 | 901 | */ |
902 | - public function get_other_js_data_from_strategies( $form_other_js_data = array() ) { |
|
903 | - $form_other_js_data = $this->get_display_strategy()->get_other_js_data( $form_other_js_data ); |
|
904 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
905 | - $form_other_js_data = $validation_strategy->get_other_js_data( $form_other_js_data ); |
|
902 | + public function get_other_js_data_from_strategies($form_other_js_data = array()) { |
|
903 | + $form_other_js_data = $this->get_display_strategy()->get_other_js_data($form_other_js_data); |
|
904 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
905 | + $form_other_js_data = $validation_strategy->get_other_js_data($form_other_js_data); |
|
906 | 906 | } |
907 | 907 | return $form_other_js_data; |
908 | 908 | } |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | * Override parent because we want to give our strategies an opprtunity to enqueue some js and css |
912 | 912 | * @return void |
913 | 913 | */ |
914 | - public function enqueue_js(){ |
|
914 | + public function enqueue_js() { |
|
915 | 915 | //ask our display strategy and validation strategies if they have js to enqueue |
916 | 916 | $this->enqueue_js_from_strategies(); |
917 | 917 | } |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | */ |
923 | 923 | public function enqueue_js_from_strategies() { |
924 | 924 | $this->get_display_strategy()->enqueue_js(); |
925 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
925 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
926 | 926 | $validation_strategy->enqueue_js(); |
927 | 927 | } |
928 | 928 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param null $validation_error_message |
24 | 24 | */ |
25 | - public function __construct( $validation_error_message = null ) { |
|
25 | + public function __construct($validation_error_message = null) { |
|
26 | 26 | $this->_validation_error_message = $validation_error_message === null |
27 | - ? __( 'Input invalid', 'event_espresso' ) |
|
27 | + ? __('Input invalid', 'event_espresso') |
|
28 | 28 | : $validation_error_message; |
29 | 29 | parent::__construct(); |
30 | 30 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * this validation strategy is the 'required' validation strategy, |
42 | 42 | * most should be OK with a null, empty string, etc) |
43 | 43 | */ |
44 | - public function validate( $normalized_value ) { |
|
44 | + public function validate($normalized_value) { |
|
45 | 45 | //by default, the validation strategy does no validation. this should be implemented |
46 | 46 | } |
47 | 47 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * in each form's "other_data" javascript object. |
89 | 89 | * @return array |
90 | 90 | */ |
91 | - public function get_other_js_data( $other_js_data = array() ) { |
|
91 | + public function get_other_js_data($other_js_data = array()) { |
|
92 | 92 | return $other_js_data; |
93 | 93 | } |
94 | 94 |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * @param \EE_Registry $Registry |
89 | 89 | * @return \EE_System |
90 | 90 | */ |
91 | - public static function instance( EE_Registry $Registry = null ) { |
|
91 | + public static function instance(EE_Registry $Registry = null) { |
|
92 | 92 | // check if class object is instantiated |
93 | - if ( ! self::$_instance instanceof EE_System ) { |
|
94 | - self::$_instance = new self( $Registry ); |
|
93 | + if ( ! self::$_instance instanceof EE_System) { |
|
94 | + self::$_instance = new self($Registry); |
|
95 | 95 | } |
96 | 96 | return self::$_instance; |
97 | 97 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * resets the instance and returns it |
102 | 102 | * @return EE_System |
103 | 103 | */ |
104 | - public static function reset(){ |
|
104 | + public static function reset() { |
|
105 | 105 | self::$_instance->_req_type = NULL; |
106 | 106 | //we need to reset the migration manager in order for it to detect DMSs properly |
107 | 107 | EE_Data_Migration_Manager::reset(); |
108 | 108 | //make sure none of the old hooks are left hanging around |
109 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
109 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
110 | 110 | self::instance()->detect_activations_or_upgrades(); |
111 | 111 | self::instance()->perform_activations_upgrades_and_migrations(); |
112 | 112 | return self::instance(); |
@@ -122,28 +122,28 @@ discard block |
||
122 | 122 | * @access private |
123 | 123 | * @param \EE_Registry $Registry |
124 | 124 | */ |
125 | - private function __construct( EE_Registry $Registry ) { |
|
125 | + private function __construct(EE_Registry $Registry) { |
|
126 | 126 | $this->registry = $Registry; |
127 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
127 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
128 | 128 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
129 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
129 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
130 | 130 | // when an ee addon is activated, we want to call the core hook(s) again |
131 | 131 | // because the newly-activated addon didn't get a chance to run at all |
132 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
132 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
133 | 133 | // detect whether install or upgrade |
134 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
134 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
135 | 135 | // load EE_Config, EE_Textdomain, etc |
136 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
136 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
137 | 137 | // load EE_Config, EE_Textdomain, etc |
138 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
138 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
139 | 139 | // you wanna get going? I wanna get going... let's get going! |
140 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
140 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
141 | 141 | //other housekeeping |
142 | 142 | //exclude EE critical pages from wp_list_pages |
143 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
143 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
144 | 144 | // ALL EE Addons should use the following hook point to attach their initial setup too |
145 | 145 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
146 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
146 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -163,30 +163,30 @@ discard block |
||
163 | 163 | public function load_espresso_addons() { |
164 | 164 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
165 | 165 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
166 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
166 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
167 | 167 | //load and setup EE_Capabilities |
168 | - $this->registry->load_core( 'Capabilities' ); |
|
168 | + $this->registry->load_core('Capabilities'); |
|
169 | 169 | //caps need to be initialized on every request so that capability maps are set. |
170 | 170 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
171 | 171 | $this->registry->CAP->init_caps(); |
172 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
172 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
173 | 173 | //if the WP API basic auth plugin isn't already loaded, load it now. |
174 | 174 | //We want it for mobile apps. Just include the entire plugin |
175 | 175 | //also, don't load the basic auth when a plugin is getting activated, because |
176 | 176 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
177 | 177 | //and causes a fatal error |
178 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
179 | - && ! function_exists( 'json_basic_auth_error' ) |
|
178 | + if ( ! function_exists('json_basic_auth_handler') |
|
179 | + && ! function_exists('json_basic_auth_error') |
|
180 | 180 | && ! ( |
181 | - isset( $_GET[ 'action'] ) |
|
182 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
181 | + isset($_GET['action']) |
|
182 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
183 | 183 | ) |
184 | 184 | && ! ( |
185 | - isset( $_GET['activate' ] ) |
|
186 | - && $_GET['activate' ] === 'true' |
|
185 | + isset($_GET['activate']) |
|
186 | + && $_GET['activate'] === 'true' |
|
187 | 187 | ) |
188 | 188 | ) { |
189 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
189 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * @access public |
203 | 203 | * @return void |
204 | 204 | */ |
205 | - public function detect_activations_or_upgrades(){ |
|
205 | + public function detect_activations_or_upgrades() { |
|
206 | 206 | //first off: let's make sure to handle core |
207 | 207 | $this->detect_if_activation_or_upgrade(); |
208 | - foreach($this->registry->addons as $addon){ |
|
208 | + foreach ($this->registry->addons as $addon) { |
|
209 | 209 | //detect teh request type for that addon |
210 | 210 | $addon->detect_activation_or_upgrade(); |
211 | 211 | } |
@@ -226,41 +226,41 @@ discard block |
||
226 | 226 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
227 | 227 | |
228 | 228 | // load M-Mode class |
229 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
229 | + $this->registry->load_core('Maintenance_Mode'); |
|
230 | 230 | // check if db has been updated, or if its a brand-new installation |
231 | 231 | |
232 | 232 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
233 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
233 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
234 | 234 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
235 | 235 | |
236 | - switch($request_type){ |
|
236 | + switch ($request_type) { |
|
237 | 237 | case EE_System::req_type_new_activation: |
238 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
239 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
238 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
239 | + $this->_handle_core_version_change($espresso_db_update); |
|
240 | 240 | break; |
241 | 241 | case EE_System::req_type_reactivation: |
242 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
243 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
242 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
243 | + $this->_handle_core_version_change($espresso_db_update); |
|
244 | 244 | break; |
245 | 245 | case EE_System::req_type_upgrade: |
246 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
246 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
247 | 247 | //migrations may be required now that we've upgraded |
248 | 248 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
249 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
249 | + $this->_handle_core_version_change($espresso_db_update); |
|
250 | 250 | // echo "done upgrade";die; |
251 | 251 | break; |
252 | 252 | case EE_System::req_type_downgrade: |
253 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
253 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
254 | 254 | //its possible migrations are no longer required |
255 | 255 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
256 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
256 | + $this->_handle_core_version_change($espresso_db_update); |
|
257 | 257 | break; |
258 | 258 | case EE_System::req_type_normal: |
259 | 259 | default: |
260 | 260 | // $this->_maybe_redirect_to_ee_about(); |
261 | 261 | break; |
262 | 262 | } |
263 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
263 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * initializing the database later during the request |
269 | 269 | * @param array $espresso_db_update |
270 | 270 | */ |
271 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
272 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
271 | + protected function _handle_core_version_change($espresso_db_update) { |
|
272 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
273 | 273 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
274 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
274 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -286,44 +286,44 @@ discard block |
||
286 | 286 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
287 | 287 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
288 | 288 | */ |
289 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
290 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
291 | - if( ! $espresso_db_update){ |
|
292 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
289 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
290 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
291 | + if ( ! $espresso_db_update) { |
|
292 | + $espresso_db_update = get_option('espresso_db_update'); |
|
293 | 293 | } |
294 | 294 | // check that option is an array |
295 | - if( ! is_array( $espresso_db_update )) { |
|
295 | + if ( ! is_array($espresso_db_update)) { |
|
296 | 296 | // if option is FALSE, then it never existed |
297 | - if ( $espresso_db_update === FALSE ) { |
|
297 | + if ($espresso_db_update === FALSE) { |
|
298 | 298 | // make $espresso_db_update an array and save option with autoload OFF |
299 | - $espresso_db_update = array(); |
|
300 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
299 | + $espresso_db_update = array(); |
|
300 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
301 | 301 | } else { |
302 | 302 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
303 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
304 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
303 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
304 | + update_option('espresso_db_update', $espresso_db_update); |
|
305 | 305 | } |
306 | - }else{ |
|
306 | + } else { |
|
307 | 307 | $corrected_db_update = array(); |
308 | 308 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
309 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
310 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
309 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
310 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
311 | 311 | //the key is an int, and the value IS NOT an array |
312 | 312 | //so it must be numerically-indexed, where values are versions installed... |
313 | 313 | //fix it! |
314 | 314 | $version_string = $should_be_array; |
315 | 315 | $corrected_db_update[$version_string] = array('unknown-date'); |
316 | - }else{ |
|
316 | + } else { |
|
317 | 317 | //ok it checks out |
318 | 318 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
319 | 319 | } |
320 | 320 | } |
321 | 321 | $espresso_db_update = $corrected_db_update; |
322 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
322 | + update_option('espresso_db_update', $espresso_db_update); |
|
323 | 323 | |
324 | 324 | } |
325 | 325 | |
326 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
326 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
327 | 327 | return $espresso_db_update; |
328 | 328 | } |
329 | 329 | |
@@ -343,34 +343,34 @@ discard block |
||
343 | 343 | * so we prefer to only do it when necessary |
344 | 344 | * @return void |
345 | 345 | */ |
346 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
346 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
347 | 347 | $request_type = $this->detect_req_type(); |
348 | 348 | //only initialize system if we're not in maintenance mode. |
349 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
350 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
349 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
350 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
351 | 351 | |
352 | - if( $verify_schema ) { |
|
352 | + if ($verify_schema) { |
|
353 | 353 | EEH_Activation::initialize_db_and_folders(); |
354 | 354 | } |
355 | 355 | EEH_Activation::initialize_db_content(); |
356 | 356 | EEH_Activation::system_initialization(); |
357 | - if( $initialize_addons_too ) { |
|
357 | + if ($initialize_addons_too) { |
|
358 | 358 | $this->initialize_addons(); |
359 | 359 | } |
360 | - }else{ |
|
361 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
360 | + } else { |
|
361 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
362 | 362 | } |
363 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
364 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
363 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
364 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
369 | 369 | * Initializes the db for all registered addons |
370 | 370 | */ |
371 | - public function initialize_addons(){ |
|
371 | + public function initialize_addons() { |
|
372 | 372 | //foreach registered addon, make sure its db is up-to-date too |
373 | - foreach($this->registry->addons as $addon){ |
|
373 | + foreach ($this->registry->addons as $addon) { |
|
374 | 374 | $addon->initialize_db_if_no_migrations_required(); |
375 | 375 | } |
376 | 376 | } |
@@ -382,16 +382,16 @@ discard block |
||
382 | 382 | * @param string $current_version_to_add version to be added to the version history |
383 | 383 | * @return boolean success as to whether or not this option was changed |
384 | 384 | */ |
385 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
386 | - if( ! $version_history ) { |
|
385 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
386 | + if ( ! $version_history) { |
|
387 | 387 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
388 | 388 | } |
389 | - if( $current_version_to_add == NULL){ |
|
389 | + if ($current_version_to_add == NULL) { |
|
390 | 390 | $current_version_to_add = espresso_version(); |
391 | 391 | } |
392 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
392 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
393 | 393 | // re-save |
394 | - return update_option( 'espresso_db_update', $version_history ); |
|
394 | + return update_option('espresso_db_update', $version_history); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | * but still know if this is a new install or not |
409 | 409 | * @return int one of the constants on EE_System::req_type_ |
410 | 410 | */ |
411 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
412 | - if ( $this->_req_type === NULL ){ |
|
413 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
414 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
411 | + public function detect_req_type($espresso_db_update = NULL) { |
|
412 | + if ($this->_req_type === NULL) { |
|
413 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
414 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
415 | 415 | } |
416 | 416 | return $this->_req_type; |
417 | 417 | } |
@@ -427,39 +427,39 @@ discard block |
||
427 | 427 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
428 | 428 | * @return int one of the constants on EE_System::req_type_* |
429 | 429 | */ |
430 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
431 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
432 | - if( $activation_history_for_addon ){ |
|
430 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
431 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
432 | + if ($activation_history_for_addon) { |
|
433 | 433 | //it exists, so this isn't a completely new install |
434 | 434 | //check if this version already in that list of previously installed versions |
435 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
435 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
436 | 436 | //it a version we haven't seen before |
437 | - if( $version_is_higher === 1 ){ |
|
437 | + if ($version_is_higher === 1) { |
|
438 | 438 | $req_type = EE_System::req_type_upgrade; |
439 | - }else{ |
|
439 | + } else { |
|
440 | 440 | $req_type = EE_System::req_type_downgrade; |
441 | 441 | } |
442 | - delete_option( $activation_indicator_option_name ); |
|
442 | + delete_option($activation_indicator_option_name); |
|
443 | 443 | } else { |
444 | 444 | // its not an update. maybe a reactivation? |
445 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
446 | - if ( $version_is_higher === -1 ){ |
|
445 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
446 | + if ($version_is_higher === -1) { |
|
447 | 447 | $req_type = EE_System::req_type_downgrade; |
448 | - }elseif( $version_is_higher === 0 ){ |
|
448 | + }elseif ($version_is_higher === 0) { |
|
449 | 449 | //we've seen this version before, but it's an activation. must be a reactivation |
450 | 450 | $req_type = EE_System::req_type_reactivation; |
451 | - }else{//$version_is_higher === 1 |
|
451 | + } else {//$version_is_higher === 1 |
|
452 | 452 | $req_type = EE_System::req_type_upgrade; |
453 | 453 | } |
454 | - delete_option( $activation_indicator_option_name ); |
|
454 | + delete_option($activation_indicator_option_name); |
|
455 | 455 | } else { |
456 | 456 | //we've seen this version before and the activation indicate doesn't show it was just activated |
457 | - if ( $version_is_higher === -1 ){ |
|
457 | + if ($version_is_higher === -1) { |
|
458 | 458 | $req_type = EE_System::req_type_downgrade; |
459 | - }elseif( $version_is_higher === 0 ){ |
|
459 | + }elseif ($version_is_higher === 0) { |
|
460 | 460 | //we've seen this version before and it's not an activation. its normal request |
461 | 461 | $req_type = EE_System::req_type_normal; |
462 | - }else{//$version_is_higher === 1 |
|
462 | + } else {//$version_is_higher === 1 |
|
463 | 463 | $req_type = EE_System::req_type_upgrade; |
464 | 464 | } |
465 | 465 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | } else { |
468 | 468 | //brand new install |
469 | 469 | $req_type = EE_System::req_type_new_activation; |
470 | - delete_option( $activation_indicator_option_name ); |
|
470 | + delete_option($activation_indicator_option_name); |
|
471 | 471 | } |
472 | 472 | return $req_type; |
473 | 473 | } |
@@ -485,30 +485,30 @@ discard block |
||
485 | 485 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
486 | 486 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
487 | 487 | */ |
488 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
488 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
489 | 489 | //find the most recently-activated version |
490 | 490 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
491 | 491 | $most_recently_active_version = '0.0.0.dev.000'; |
492 | - if( is_array( $activation_history_for_addon ) ){ |
|
493 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
492 | + if (is_array($activation_history_for_addon)) { |
|
493 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
494 | 494 | //check there is a record of when this version was activated. Otherwise, |
495 | 495 | //mark it as unknown |
496 | - if( ! $times_activated ){ |
|
497 | - $times_activated = array( 'unknown-date'); |
|
496 | + if ( ! $times_activated) { |
|
497 | + $times_activated = array('unknown-date'); |
|
498 | 498 | } |
499 | - if( is_string( $times_activated ) ){ |
|
500 | - $times_activated = array( $times_activated ); |
|
499 | + if (is_string($times_activated)) { |
|
500 | + $times_activated = array($times_activated); |
|
501 | 501 | } |
502 | - foreach( $times_activated as $an_activation ){ |
|
503 | - if( $an_activation != 'unknown-date' && |
|
504 | - $an_activation > $most_recently_active_version_activation ){ |
|
502 | + foreach ($times_activated as $an_activation) { |
|
503 | + if ($an_activation != 'unknown-date' && |
|
504 | + $an_activation > $most_recently_active_version_activation) { |
|
505 | 505 | $most_recently_active_version = $version; |
506 | 506 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
507 | 507 | } |
508 | 508 | } |
509 | 509 | } |
510 | 510 | } |
511 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
511 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | |
@@ -518,24 +518,24 @@ discard block |
||
518 | 518 | * @return void |
519 | 519 | */ |
520 | 520 | public function redirect_to_about_ee() { |
521 | - $notices = EE_Error::get_notices( FALSE ); |
|
521 | + $notices = EE_Error::get_notices(FALSE); |
|
522 | 522 | //if current user is an admin and it's not an ajax request |
523 | 523 | if ( |
524 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
525 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
526 | - && ! isset( $notices[ 'errors' ] ) |
|
524 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
525 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
526 | + && ! isset($notices['errors']) |
|
527 | 527 | ) { |
528 | - $query_params = array( 'page' => 'espresso_about' ); |
|
528 | + $query_params = array('page' => 'espresso_about'); |
|
529 | 529 | |
530 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
530 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
531 | 531 | $query_params['new_activation'] = TRUE; |
532 | 532 | } |
533 | 533 | |
534 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
534 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
535 | 535 | $query_params['reactivation'] = TRUE; |
536 | 536 | } |
537 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
538 | - wp_safe_redirect( $url ); |
|
537 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
538 | + wp_safe_redirect($url); |
|
539 | 539 | exit(); |
540 | 540 | } |
541 | 541 | } |
@@ -549,31 +549,31 @@ discard block |
||
549 | 549 | * |
550 | 550 | * @return void |
551 | 551 | */ |
552 | - public function load_core_configuration(){ |
|
553 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
554 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
552 | + public function load_core_configuration() { |
|
553 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
554 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
555 | 555 | //load textdomain |
556 | 556 | EE_Load_Textdomain::load_textdomain(); |
557 | 557 | // load and setup EE_Config and EE_Network_Config |
558 | - $this->registry->load_core( 'Config' ); |
|
559 | - $this->registry->load_core( 'Network_Config' ); |
|
558 | + $this->registry->load_core('Config'); |
|
559 | + $this->registry->load_core('Network_Config'); |
|
560 | 560 | // setup autoloaders |
561 | 561 | // enable logging? |
562 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
563 | - $this->registry->load_core( 'Log' ); |
|
562 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
563 | + $this->registry->load_core('Log'); |
|
564 | 564 | } |
565 | 565 | // check for activation errors |
566 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
567 | - if ( $activation_errors ) { |
|
568 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
569 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
566 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
567 | + if ($activation_errors) { |
|
568 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
569 | + update_option('ee_plugin_activation_errors', FALSE); |
|
570 | 570 | } |
571 | 571 | // get model names |
572 | 572 | $this->_parse_model_names(); |
573 | 573 | |
574 | 574 | //load caf stuff a chance to play during the activation process too. |
575 | 575 | $this->_maybe_brew_regular(); |
576 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
576 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -582,23 +582,23 @@ discard block |
||
582 | 582 | * |
583 | 583 | * @return void |
584 | 584 | */ |
585 | - private function _parse_model_names(){ |
|
585 | + private function _parse_model_names() { |
|
586 | 586 | //get all the files in the EE_MODELS folder that end in .model.php |
587 | - $models = glob( EE_MODELS.'*.model.php'); |
|
587 | + $models = glob(EE_MODELS.'*.model.php'); |
|
588 | 588 | $model_names = array(); |
589 | 589 | $non_abstract_db_models = array(); |
590 | - foreach( $models as $model ){ |
|
590 | + foreach ($models as $model) { |
|
591 | 591 | // get model classname |
592 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
593 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
592 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
593 | + $short_name = str_replace('EEM_', '', $classname); |
|
594 | 594 | $reflectionClass = new ReflectionClass($classname); |
595 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
596 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
595 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
596 | + $non_abstract_db_models[$short_name] = $classname; |
|
597 | 597 | } |
598 | - $model_names[ $short_name ] = $classname; |
|
598 | + $model_names[$short_name] = $classname; |
|
599 | 599 | } |
600 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
601 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
600 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
601 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | * @return void |
609 | 609 | */ |
610 | 610 | private function _maybe_brew_regular() { |
611 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
612 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
611 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
612 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
@@ -626,9 +626,9 @@ discard block |
||
626 | 626 | * @return void |
627 | 627 | */ |
628 | 628 | public function register_shortcodes_modules_and_widgets() { |
629 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
629 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
630 | 630 | // check for addons using old hookpoint |
631 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
631 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
632 | 632 | $this->_incompatible_addon_error(); |
633 | 633 | } |
634 | 634 | } |
@@ -642,19 +642,19 @@ discard block |
||
642 | 642 | */ |
643 | 643 | private function _incompatible_addon_error() { |
644 | 644 | // get array of classes hooking into here |
645 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
646 | - if ( ! empty( $class_names )) { |
|
647 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
645 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
646 | + if ( ! empty($class_names)) { |
|
647 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
648 | 648 | $msg .= '<ul>'; |
649 | - foreach ( $class_names as $class_name ) { |
|
650 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
649 | + foreach ($class_names as $class_name) { |
|
650 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
651 | 651 | } |
652 | 652 | $msg .= '</ul>'; |
653 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
653 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
654 | 654 | // save list of incompatible addons to wp-options for later use |
655 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
656 | - if ( is_admin() ) { |
|
657 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
655 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
656 | + if (is_admin()) { |
|
657 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | } |
@@ -671,26 +671,26 @@ discard block |
||
671 | 671 | * |
672 | 672 | * @return void |
673 | 673 | */ |
674 | - public function brew_espresso(){ |
|
675 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
674 | + public function brew_espresso() { |
|
675 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
676 | 676 | // load some final core systems |
677 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
678 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
679 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
680 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
681 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
682 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
683 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
684 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
685 | - add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
686 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
687 | - |
|
688 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
677 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
678 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
679 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
680 | + add_action('init', array($this, 'load_controllers'), 7); |
|
681 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
682 | + add_action('init', array($this, 'initialize'), 10); |
|
683 | + add_action('init', array($this, 'initialize_last'), 100); |
|
684 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
685 | + add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
686 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
687 | + |
|
688 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
689 | 689 | // pew pew pew |
690 | - $this->registry->load_core( 'PUE' ); |
|
691 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
690 | + $this->registry->load_core('PUE'); |
|
691 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
692 | 692 | } |
693 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
693 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | */ |
705 | 705 | public function set_hooks_for_core() { |
706 | 706 | $this->_deactivate_incompatible_addons(); |
707 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
707 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | |
@@ -713,15 +713,15 @@ discard block |
||
713 | 713 | * Using the information gathered in EE_System::_incompatible_addon_error, |
714 | 714 | * deactivates any addons considered incompatible with the current version of EE |
715 | 715 | */ |
716 | - private function _deactivate_incompatible_addons(){ |
|
717 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
718 | - if ( ! empty( $incompatible_addons )) { |
|
719 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
720 | - foreach ( $active_plugins as $active_plugin ) { |
|
721 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
722 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
723 | - unset( $_GET['activate'] ); |
|
724 | - espresso_deactivate_plugin( $active_plugin ); |
|
716 | + private function _deactivate_incompatible_addons() { |
|
717 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
718 | + if ( ! empty($incompatible_addons)) { |
|
719 | + $active_plugins = get_option('active_plugins', array()); |
|
720 | + foreach ($active_plugins as $active_plugin) { |
|
721 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
722 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
723 | + unset($_GET['activate']); |
|
724 | + espresso_deactivate_plugin($active_plugin); |
|
725 | 725 | } |
726 | 726 | } |
727 | 727 | } |
@@ -738,10 +738,10 @@ discard block |
||
738 | 738 | */ |
739 | 739 | public function perform_activations_upgrades_and_migrations() { |
740 | 740 | //first check if we had previously attempted to setup EE's directories but failed |
741 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
741 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
742 | 742 | EEH_Activation::create_upload_directories(); |
743 | 743 | } |
744 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
744 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -753,10 +753,10 @@ discard block |
||
753 | 753 | * @return void |
754 | 754 | */ |
755 | 755 | public function load_CPTs_and_session() { |
756 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
756 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
757 | 757 | // register Custom Post Types |
758 | - $this->registry->load_core( 'Register_CPTs' ); |
|
759 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
758 | + $this->registry->load_core('Register_CPTs'); |
|
759 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
760 | 760 | } |
761 | 761 | |
762 | 762 | |
@@ -771,16 +771,16 @@ discard block |
||
771 | 771 | * @return void |
772 | 772 | */ |
773 | 773 | public function load_controllers() { |
774 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
774 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
775 | 775 | // let's get it started |
776 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
777 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
778 | - $this->registry->load_core( 'Front_Controller', array(), false, true ); |
|
779 | - } else if ( ! EE_FRONT_AJAX ) { |
|
780 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
781 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
776 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
777 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
778 | + $this->registry->load_core('Front_Controller', array(), false, true); |
|
779 | + } else if ( ! EE_FRONT_AJAX) { |
|
780 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
781 | + EE_Registry::instance()->load_core('Admin'); |
|
782 | 782 | } |
783 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
783 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | |
@@ -794,9 +794,9 @@ discard block |
||
794 | 794 | * @return void |
795 | 795 | */ |
796 | 796 | public function core_loaded_and_ready() { |
797 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
798 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
799 | - $this->registry->load_core( 'Session' ); |
|
797 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
798 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
799 | + $this->registry->load_core('Session'); |
|
800 | 800 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
801 | 801 | } |
802 | 802 | |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | * @return void |
812 | 812 | */ |
813 | 813 | public function initialize() { |
814 | - do_action( 'AHEE__EE_System__initialize' ); |
|
814 | + do_action('AHEE__EE_System__initialize'); |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | * @return void |
826 | 826 | */ |
827 | 827 | public function initialize_last() { |
828 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
828 | + do_action('AHEE__EE_System__initialize_last'); |
|
829 | 829 | } |
830 | 830 | |
831 | 831 | |
@@ -857,21 +857,21 @@ discard block |
||
857 | 857 | */ |
858 | 858 | public static function do_not_cache() { |
859 | 859 | // set no cache constants |
860 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
861 | - define( 'DONOTCACHEPAGE', true ); |
|
860 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
861 | + define('DONOTCACHEPAGE', true); |
|
862 | 862 | } |
863 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
864 | - define( 'DONOTCACHCEOBJECT', true ); |
|
863 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
864 | + define('DONOTCACHCEOBJECT', true); |
|
865 | 865 | } |
866 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
867 | - define( 'DONOTCACHEDB', true ); |
|
866 | + if ( ! defined('DONOTCACHEDB')) { |
|
867 | + define('DONOTCACHEDB', true); |
|
868 | 868 | } |
869 | 869 | // add no cache headers |
870 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
870 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
871 | 871 | // plus a little extra for nginx and Google Chrome |
872 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
872 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
873 | 873 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
874 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
874 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
875 | 875 | } |
876 | 876 | |
877 | 877 | |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | * @param $headers |
884 | 884 | * @return array |
885 | 885 | */ |
886 | - public static function extra_nocache_headers ( $headers ) { |
|
886 | + public static function extra_nocache_headers($headers) { |
|
887 | 887 | // for NGINX |
888 | 888 | $headers['X-Accel-Expires'] = 0; |
889 | 889 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -912,14 +912,14 @@ discard block |
||
912 | 912 | * @param WP_Admin_Bar $admin_bar |
913 | 913 | * @return void |
914 | 914 | */ |
915 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
915 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
916 | 916 | |
917 | 917 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
918 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
918 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
919 | 919 | return; |
920 | 920 | } |
921 | 921 | |
922 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
922 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
923 | 923 | $menu_class = 'espresso_menu_item_class'; |
924 | 924 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
925 | 925 | //because they're only defined in each of their respective constructors |
@@ -931,20 +931,20 @@ discard block |
||
931 | 931 | //Top Level |
932 | 932 | $admin_bar->add_menu(array( |
933 | 933 | 'id' => 'espresso-toolbar', |
934 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
934 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
935 | 935 | 'href' => $events_admin_url, |
936 | 936 | 'meta' => array( |
937 | 937 | 'title' => __('Event Espresso', 'event_espresso'), |
938 | - 'class' => $menu_class . 'first' |
|
938 | + 'class' => $menu_class.'first' |
|
939 | 939 | ), |
940 | 940 | )); |
941 | 941 | |
942 | 942 | //Events |
943 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
943 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
944 | 944 | $admin_bar->add_menu(array( |
945 | 945 | 'id' => 'espresso-toolbar-events', |
946 | 946 | 'parent' => 'espresso-toolbar', |
947 | - 'title' => __( 'Events', 'event_espresso' ), |
|
947 | + 'title' => __('Events', 'event_espresso'), |
|
948 | 948 | 'href' => $events_admin_url, |
949 | 949 | 'meta' => array( |
950 | 950 | 'title' => __('Events', 'event_espresso'), |
@@ -955,13 +955,13 @@ discard block |
||
955 | 955 | } |
956 | 956 | |
957 | 957 | |
958 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
958 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
959 | 959 | //Events Add New |
960 | 960 | $admin_bar->add_menu(array( |
961 | 961 | 'id' => 'espresso-toolbar-events-new', |
962 | 962 | 'parent' => 'espresso-toolbar-events', |
963 | 963 | 'title' => __('Add New', 'event_espresso'), |
964 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
964 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
965 | 965 | 'meta' => array( |
966 | 966 | 'title' => __('Add New', 'event_espresso'), |
967 | 967 | 'target' => '', |
@@ -970,18 +970,18 @@ discard block |
||
970 | 970 | )); |
971 | 971 | } |
972 | 972 | |
973 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
973 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
974 | 974 | |
975 | 975 | //Current post |
976 | 976 | global $post; |
977 | 977 | |
978 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
978 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
979 | 979 | //Events Edit Current Event |
980 | 980 | $admin_bar->add_menu(array( |
981 | 981 | 'id' => 'espresso-toolbar-events-edit', |
982 | 982 | 'parent' => 'espresso-toolbar-events', |
983 | 983 | 'title' => __('Edit Event', 'event_espresso'), |
984 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
984 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
985 | 985 | 'meta' => array( |
986 | 986 | 'title' => __('Edit Event', 'event_espresso'), |
987 | 987 | 'target' => '', |
@@ -993,11 +993,11 @@ discard block |
||
993 | 993 | } |
994 | 994 | |
995 | 995 | //Events View |
996 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
996 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
997 | 997 | $admin_bar->add_menu(array( |
998 | 998 | 'id' => 'espresso-toolbar-events-view', |
999 | 999 | 'parent' => 'espresso-toolbar-events', |
1000 | - 'title' => __( 'View', 'event_espresso' ), |
|
1000 | + 'title' => __('View', 'event_espresso'), |
|
1001 | 1001 | 'href' => $events_admin_url, |
1002 | 1002 | 'meta' => array( |
1003 | 1003 | 'title' => __('View', 'event_espresso'), |
@@ -1007,12 +1007,12 @@ discard block |
||
1007 | 1007 | )); |
1008 | 1008 | } |
1009 | 1009 | |
1010 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1010 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1011 | 1011 | //Events View All |
1012 | 1012 | $admin_bar->add_menu(array( |
1013 | 1013 | 'id' => 'espresso-toolbar-events-all', |
1014 | 1014 | 'parent' => 'espresso-toolbar-events-view', |
1015 | - 'title' => __( 'All', 'event_espresso' ), |
|
1015 | + 'title' => __('All', 'event_espresso'), |
|
1016 | 1016 | 'href' => $events_admin_url, |
1017 | 1017 | 'meta' => array( |
1018 | 1018 | 'title' => __('All', 'event_espresso'), |
@@ -1023,13 +1023,13 @@ discard block |
||
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
1026 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1026 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1027 | 1027 | //Events View Today |
1028 | 1028 | $admin_bar->add_menu(array( |
1029 | 1029 | 'id' => 'espresso-toolbar-events-today', |
1030 | 1030 | 'parent' => 'espresso-toolbar-events-view', |
1031 | 1031 | 'title' => __('Today', 'event_espresso'), |
1032 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1032 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1033 | 1033 | 'meta' => array( |
1034 | 1034 | 'title' => __('Today', 'event_espresso'), |
1035 | 1035 | 'target' => '', |
@@ -1039,13 +1039,13 @@ discard block |
||
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | |
1042 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1042 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1043 | 1043 | //Events View This Month |
1044 | 1044 | $admin_bar->add_menu(array( |
1045 | 1045 | 'id' => 'espresso-toolbar-events-month', |
1046 | 1046 | 'parent' => 'espresso-toolbar-events-view', |
1047 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1048 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1047 | + 'title' => __('This Month', 'event_espresso'), |
|
1048 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1049 | 1049 | 'meta' => array( |
1050 | 1050 | 'title' => __('This Month', 'event_espresso'), |
1051 | 1051 | 'target' => '', |
@@ -1055,11 +1055,11 @@ discard block |
||
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | //Registration Overview |
1058 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1058 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1059 | 1059 | $admin_bar->add_menu(array( |
1060 | 1060 | 'id' => 'espresso-toolbar-registrations', |
1061 | 1061 | 'parent' => 'espresso-toolbar', |
1062 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1062 | + 'title' => __('Registrations', 'event_espresso'), |
|
1063 | 1063 | 'href' => $reg_admin_url, |
1064 | 1064 | 'meta' => array( |
1065 | 1065 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1070,12 +1070,12 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | //Registration Overview Today |
1073 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1073 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1074 | 1074 | $admin_bar->add_menu(array( |
1075 | 1075 | 'id' => 'espresso-toolbar-registrations-today', |
1076 | 1076 | 'parent' => 'espresso-toolbar-registrations', |
1077 | - 'title' => __( 'Today', 'event_espresso'), |
|
1078 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1077 | + 'title' => __('Today', 'event_espresso'), |
|
1078 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1079 | 1079 | 'meta' => array( |
1080 | 1080 | 'title' => __('Today', 'event_espresso'), |
1081 | 1081 | 'target' => '', |
@@ -1085,14 +1085,14 @@ discard block |
||
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | //Registration Overview Today Completed |
1088 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1088 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1089 | 1089 | $admin_bar->add_menu(array( |
1090 | 1090 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1091 | 1091 | 'parent' => 'espresso-toolbar-registrations-today', |
1092 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1093 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1092 | + 'title' => __('Approved', 'event_espresso'), |
|
1093 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1094 | 1094 | 'meta' => array( |
1095 | - 'title' => __('Approved', 'event_espresso' ), |
|
1095 | + 'title' => __('Approved', 'event_espresso'), |
|
1096 | 1096 | 'target' => '', |
1097 | 1097 | 'class' => $menu_class |
1098 | 1098 | ), |
@@ -1100,14 +1100,14 @@ discard block |
||
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | //Registration Overview Today Pending\ |
1103 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1103 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1104 | 1104 | $admin_bar->add_menu(array( |
1105 | 1105 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1106 | 1106 | 'parent' => 'espresso-toolbar-registrations-today', |
1107 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1108 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1107 | + 'title' => __('Pending', 'event_espresso'), |
|
1108 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1109 | 1109 | 'meta' => array( |
1110 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1110 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1111 | 1111 | 'target' => '', |
1112 | 1112 | 'class' => $menu_class |
1113 | 1113 | ), |
@@ -1115,14 +1115,14 @@ discard block |
||
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | //Registration Overview Today Incomplete |
1118 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1118 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1119 | 1119 | $admin_bar->add_menu(array( |
1120 | 1120 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1121 | 1121 | 'parent' => 'espresso-toolbar-registrations-today', |
1122 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1123 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1122 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1123 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1124 | 1124 | 'meta' => array( |
1125 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1125 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1126 | 1126 | 'target' => '', |
1127 | 1127 | 'class' => $menu_class |
1128 | 1128 | ), |
@@ -1130,12 +1130,12 @@ discard block |
||
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | //Registration Overview Today Incomplete |
1133 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1133 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1134 | 1134 | $admin_bar->add_menu(array( |
1135 | 1135 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1136 | 1136 | 'parent' => 'espresso-toolbar-registrations-today', |
1137 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1138 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1137 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1138 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1139 | 1139 | 'meta' => array( |
1140 | 1140 | 'title' => __('Cancelled', 'event_espresso'), |
1141 | 1141 | 'target' => '', |
@@ -1145,12 +1145,12 @@ discard block |
||
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | //Registration Overview This Month |
1148 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1148 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1149 | 1149 | $admin_bar->add_menu(array( |
1150 | 1150 | 'id' => 'espresso-toolbar-registrations-month', |
1151 | 1151 | 'parent' => 'espresso-toolbar-registrations', |
1152 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1153 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1152 | + 'title' => __('This Month', 'event_espresso'), |
|
1153 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1154 | 1154 | 'meta' => array( |
1155 | 1155 | 'title' => __('This Month', 'event_espresso'), |
1156 | 1156 | 'target' => '', |
@@ -1160,12 +1160,12 @@ discard block |
||
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | //Registration Overview This Month Approved |
1163 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1163 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1164 | 1164 | $admin_bar->add_menu(array( |
1165 | 1165 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1166 | 1166 | 'parent' => 'espresso-toolbar-registrations-month', |
1167 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1168 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1167 | + 'title' => __('Approved', 'event_espresso'), |
|
1168 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1169 | 1169 | 'meta' => array( |
1170 | 1170 | 'title' => __('Approved', 'event_espresso'), |
1171 | 1171 | 'target' => '', |
@@ -1175,12 +1175,12 @@ discard block |
||
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | //Registration Overview This Month Pending |
1178 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1178 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1179 | 1179 | $admin_bar->add_menu(array( |
1180 | 1180 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1181 | 1181 | 'parent' => 'espresso-toolbar-registrations-month', |
1182 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1183 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1182 | + 'title' => __('Pending', 'event_espresso'), |
|
1183 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1184 | 1184 | 'meta' => array( |
1185 | 1185 | 'title' => __('Pending', 'event_espresso'), |
1186 | 1186 | 'target' => '', |
@@ -1190,14 +1190,14 @@ discard block |
||
1190 | 1190 | } |
1191 | 1191 | |
1192 | 1192 | //Registration Overview This Month Not Approved |
1193 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1193 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1194 | 1194 | $admin_bar->add_menu(array( |
1195 | 1195 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1196 | 1196 | 'parent' => 'espresso-toolbar-registrations-month', |
1197 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1198 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1197 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1198 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1199 | 1199 | 'meta' => array( |
1200 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1200 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1201 | 1201 | 'target' => '', |
1202 | 1202 | 'class' => $menu_class |
1203 | 1203 | ), |
@@ -1206,12 +1206,12 @@ discard block |
||
1206 | 1206 | |
1207 | 1207 | |
1208 | 1208 | //Registration Overview This Month Cancelled |
1209 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1209 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1210 | 1210 | $admin_bar->add_menu(array( |
1211 | 1211 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1212 | 1212 | 'parent' => 'espresso-toolbar-registrations-month', |
1213 | 1213 | 'title' => __('Cancelled', 'event_espresso'), |
1214 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1214 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1215 | 1215 | 'meta' => array( |
1216 | 1216 | 'title' => __('Cancelled', 'event_espresso'), |
1217 | 1217 | 'target' => '', |
@@ -1221,11 +1221,11 @@ discard block |
||
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | //Extensions & Services |
1224 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1224 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1225 | 1225 | $admin_bar->add_menu(array( |
1226 | 1226 | 'id' => 'espresso-toolbar-extensions-and-services', |
1227 | 1227 | 'parent' => 'espresso-toolbar', |
1228 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1228 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1229 | 1229 | 'href' => $extensions_admin_url, |
1230 | 1230 | 'meta' => array( |
1231 | 1231 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1247,8 +1247,8 @@ discard block |
||
1247 | 1247 | * @param array $exclude_array any existing pages being excluded are in this array. |
1248 | 1248 | * @return array |
1249 | 1249 | */ |
1250 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1251 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
1250 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1251 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | |
@@ -1268,15 +1268,15 @@ discard block |
||
1268 | 1268 | */ |
1269 | 1269 | public function wp_enqueue_scripts() { |
1270 | 1270 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1271 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1271 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1272 | 1272 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1273 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1273 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1274 | 1274 | // register jQuery Validate and additional methods |
1275 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE ); |
|
1276 | - wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE ); |
|
1275 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
1276 | + wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE); |
|
1277 | 1277 | } |
1278 | - wp_register_script( 'select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true ); |
|
1279 | - wp_register_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
1278 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true); |
|
1279 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
1280 | 1280 | } |
1281 | 1281 | } |
1282 | 1282 |