Conditions | 3 |
Paths | 2 |
Total Lines | 115 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
64 | public function generate() |
||
65 | { |
||
66 | $form = new \EE_Form_Section_Proper( |
||
67 | array( |
||
68 | 'name' => 'admin_option_settings', |
||
69 | 'html_id' => 'admin_option_settings', |
||
70 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
||
71 | 'subsections' => array( |
||
72 | // 'help_tour_activation_hdr' => new EE_Form_Section_HTML( |
||
73 | // EEH_HTML::h2( |
||
74 | // esc_html__('Help Tour Global Activation', 'event_espresso') |
||
75 | // . ' ' |
||
76 | // . EEH_HTML::span( |
||
77 | // EEH_Template::get_help_tab_link('help_tour_activation_info'), |
||
78 | // 'help_tour_activation' |
||
79 | // ), |
||
80 | // '', |
||
81 | // 'ee-admin-settings-hdr' |
||
82 | // ) |
||
83 | // ), |
||
84 | // 'help_tour_activation' => new EE_Yes_No_Input( |
||
85 | // array( |
||
86 | // 'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'), |
||
87 | // 'html_help_text' => esc_html__( |
||
88 | // 'This toggles whether the Event Espresso help tours are active globally or not.', |
||
89 | // 'event_espresso' |
||
90 | // ), |
||
91 | // 'default' => isset($this->registry->CFG->admin->help_tour_activation) |
||
92 | // ? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN) |
||
93 | // : true, |
||
94 | // 'required' => false, |
||
95 | // ) |
||
96 | // ), |
||
97 | 'compatibility_hdr' => new EE_Form_Section_HTML( |
||
98 | EEH_HTML::h2( |
||
99 | esc_html__('Compatibility Settings', 'event_espresso'), |
||
100 | '', |
||
101 | 'ee-admin-settings-hdr' |
||
102 | ) |
||
103 | ), |
||
104 | 'encode_session_data' => new EE_Yes_No_Input( |
||
105 | array( |
||
106 | 'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'), |
||
107 | 'html_help_text' => sprintf( |
||
108 | esc_html__( |
||
109 | 'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.', |
||
110 | 'event_espresso' |
||
111 | ), |
||
112 | '<br>' |
||
113 | ), |
||
114 | 'default' => $this->registry->CFG->admin->encode_session_data(), |
||
115 | 'required' => false, |
||
116 | ) |
||
117 | ), |
||
118 | ), |
||
119 | ) |
||
120 | ); |
||
121 | if ($this->registry->CAP->current_user_can( |
||
122 | 'manage_options', |
||
123 | 'display_admin_settings_options_promote_and_affiliate' |
||
124 | )) { |
||
125 | $form->add_subsections( |
||
126 | array( |
||
127 | 'promote_ee_hdr' => new EE_Form_Section_HTML( |
||
128 | EEH_HTML::h2( |
||
129 | esc_html__('Promote Event Espresso', 'event_espresso') |
||
130 | . ' ' |
||
131 | . EEH_HTML::span( |
||
132 | EEH_Template::get_help_tab_link('affiliate_info'), |
||
133 | 'affiliate_info' |
||
134 | ), |
||
135 | '', |
||
136 | 'ee-admin-settings-hdr' |
||
137 | ) |
||
138 | ), |
||
139 | 'show_reg_footer' => new EE_Yes_No_Input( |
||
140 | array( |
||
141 | 'html_label_text' => esc_html__( |
||
142 | 'Link to Event Espresso in your Registration Page?', |
||
143 | 'event_espresso' |
||
144 | ) |
||
145 | . EEH_Template::get_help_tab_link('email_validation_info'), |
||
146 | 'html_help_text' => esc_html__( |
||
147 | 'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.', |
||
148 | 'event_espresso' |
||
149 | ), |
||
150 | 'default' => filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN), |
||
151 | 'required' => false, |
||
152 | ) |
||
153 | ), |
||
154 | 'affiliate_id' => new EE_Text_Input( |
||
155 | array( |
||
156 | 'html_label_text' => sprintf( |
||
157 | esc_html__('Event Espresso %1$sAffiliate%2$s ID', 'event_espresso'), |
||
158 | '<a href="http://eventespresso.com/affiliates/" target="_blank">', |
||
159 | '</a>' |
||
160 | ), |
||
161 | 'html_help_text' => esc_html__( |
||
162 | 'Earn cash for promoting Event Espresso.', |
||
163 | 'event_espresso' |
||
164 | ), |
||
165 | 'html_class' => 'regular-text', |
||
166 | 'default' => isset($this->registry->CFG->admin->affiliate_id) |
||
167 | ? $this->registry->CFG->admin->get_pretty('affiliate_id') |
||
168 | : '', |
||
169 | 'required' => false, |
||
170 | ) |
||
171 | ), |
||
172 | ), |
||
173 | // 'help_tour_activation_hdr' |
||
174 | 'compatibility_hdr' |
||
175 | ); |
||
176 | } |
||
177 | return $form; |
||
178 | } |
||
179 | |||
244 |