| Conditions | 3 |
| Paths | 2 |
| Total Lines | 257 |
| Code Lines | 193 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 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 |
||
| 97 | public function generate() |
||
| 98 | { |
||
| 99 | $form = new EE_Form_Section_Proper( |
||
| 100 | array( |
||
| 101 | 'name' => 'organization_settings', |
||
| 102 | 'html_id' => 'organization_settings', |
||
| 103 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
||
| 104 | 'subsections' => array( |
||
| 105 | 'site_license_key_hdr' => new EE_Form_Section_HTML( |
||
| 106 | EEH_HTML::h2( |
||
| 107 | esc_html__('Your Event Espresso License Key', 'event_espresso') |
||
| 108 | . ' ' |
||
| 109 | . EEH_HTML::span( |
||
| 110 | EEH_Template::get_help_tab_link('site_license_key_info'), |
||
| 111 | 'help_tour_activation' |
||
| 112 | ), |
||
| 113 | '', |
||
| 114 | 'site-license-key-hdr' |
||
| 115 | ) |
||
| 116 | ), |
||
| 117 | 'site_license_key' => $this->getSiteLicenseKeyField(), |
||
| 118 | 'contact_information_hdr' => new EE_Form_Section_HTML( |
||
| 119 | EEH_HTML::h2( |
||
| 120 | esc_html__('Contact Information', 'event_espresso') |
||
| 121 | . ' ' |
||
| 122 | . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')), |
||
| 123 | '', |
||
| 124 | 'contact-information-hdr' |
||
| 125 | ) |
||
| 126 | ), |
||
| 127 | 'organization_name' => new EE_Text_Input( |
||
| 128 | array( |
||
| 129 | 'html_name' => 'organization_name', |
||
| 130 | 'html_label_text' => esc_html__('Organization Name', 'event_espresso'), |
||
| 131 | 'html_help_text' => esc_html__( |
||
| 132 | 'Displayed on all emails and invoices.', |
||
| 133 | 'event_espresso' |
||
| 134 | ), |
||
| 135 | 'default' => $this->organization_config->get_pretty('name'), |
||
| 136 | 'required' => false, |
||
| 137 | ) |
||
| 138 | ), |
||
| 139 | 'organization_address_1' => new EE_Text_Input( |
||
| 140 | array( |
||
| 141 | 'html_name' => 'organization_address_1', |
||
| 142 | 'html_label_text' => esc_html__('Street Address', 'event_espresso'), |
||
| 143 | 'default' => $this->organization_config->get_pretty('address_1'), |
||
| 144 | 'required' => false, |
||
| 145 | ) |
||
| 146 | ), |
||
| 147 | 'organization_address_2' => new EE_Text_Input( |
||
| 148 | array( |
||
| 149 | 'html_name' => 'organization_address_2', |
||
| 150 | 'html_label_text' => esc_html__('Street Address 2', 'event_espresso'), |
||
| 151 | 'default' => $this->organization_config->get_pretty('address_2'), |
||
| 152 | 'required' => false, |
||
| 153 | ) |
||
| 154 | ), |
||
| 155 | 'organization_city' => new EE_Text_Input( |
||
| 156 | array( |
||
| 157 | 'html_name' => 'organization_city', |
||
| 158 | 'html_label_text' => esc_html__('City', 'event_espresso'), |
||
| 159 | 'default' => $this->organization_config->get_pretty('city'), |
||
| 160 | 'required' => false, |
||
| 161 | ) |
||
| 162 | ), |
||
| 163 | 'organization_state' => new EE_State_Select_Input( |
||
| 164 | null, |
||
| 165 | array( |
||
| 166 | 'html_name' => 'organization_state', |
||
| 167 | 'html_label_text' => esc_html__('State/Province', 'event_espresso'), |
||
| 168 | 'default' => $this->organization_config->STA_ID, |
||
| 169 | 'required' => false, |
||
| 170 | ) |
||
| 171 | ), |
||
| 172 | 'organization_country' => new EE_Country_Select_Input( |
||
| 173 | null, |
||
| 174 | array( |
||
| 175 | 'html_name' => 'organization_country', |
||
| 176 | 'html_label_text' => esc_html__('Country', 'event_espresso'), |
||
| 177 | 'default' => $this->organization_config->CNT_ISO, |
||
| 178 | 'required' => false, |
||
| 179 | ) |
||
| 180 | ), |
||
| 181 | 'organization_zip' => new EE_Text_Input( |
||
| 182 | array( |
||
| 183 | 'html_name' => 'organization_zip', |
||
| 184 | 'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'), |
||
| 185 | 'default' => $this->organization_config->get_pretty('zip'), |
||
| 186 | 'required' => false, |
||
| 187 | ) |
||
| 188 | ), |
||
| 189 | 'organization_email' => new EE_Text_Input( |
||
| 190 | array( |
||
| 191 | 'html_name' => 'organization_email', |
||
| 192 | 'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'), |
||
| 193 | 'html_help_text' => sprintf( |
||
| 194 | esc_html__( |
||
| 195 | 'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', |
||
| 196 | 'event_espresso' |
||
| 197 | ), |
||
| 198 | '<code>[CO_FORMATTED_EMAIL]</code>', |
||
| 199 | '<code>[CO_EMAIL]</code>' |
||
| 200 | ), |
||
| 201 | 'default' => $this->organization_config->get_pretty('email'), |
||
| 202 | 'required' => false, |
||
| 203 | ) |
||
| 204 | ), |
||
| 205 | 'organization_phone' => new EE_Text_Input( |
||
| 206 | array( |
||
| 207 | 'html_name' => 'organization_phone', |
||
| 208 | 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
||
| 209 | 'html_help_text' => esc_html__( |
||
| 210 | 'The phone number for your organization.', |
||
| 211 | 'event_espresso' |
||
| 212 | ), |
||
| 213 | 'default' => $this->organization_config->get_pretty('phone'), |
||
| 214 | 'required' => false, |
||
| 215 | ) |
||
| 216 | ), |
||
| 217 | 'organization_vat' => new EE_Text_Input( |
||
| 218 | array( |
||
| 219 | 'html_name' => 'organization_vat', |
||
| 220 | 'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'), |
||
| 221 | 'html_help_text' => esc_html__( |
||
| 222 | 'The VAT/Tax Number may be displayed on invoices and receipts.', |
||
| 223 | 'event_espresso' |
||
| 224 | ), |
||
| 225 | 'default' => $this->organization_config->get_pretty('vat'), |
||
| 226 | 'required' => false, |
||
| 227 | ) |
||
| 228 | ), |
||
| 229 | 'company_logo_hdr' => new EE_Form_Section_HTML( |
||
| 230 | EEH_HTML::h2( |
||
| 231 | esc_html__('Company Logo', 'event_espresso') |
||
| 232 | . ' ' |
||
| 233 | . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')), |
||
| 234 | '', |
||
| 235 | 'company-logo-hdr' |
||
| 236 | ) |
||
| 237 | ), |
||
| 238 | 'organization_logo_url' => new EE_Admin_File_Uploader_Input( |
||
| 239 | array( |
||
| 240 | 'html_name' => 'organization_logo_url', |
||
| 241 | 'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'), |
||
| 242 | 'html_help_text' => esc_html__( |
||
| 243 | 'Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
||
| 244 | 'event_espresso' |
||
| 245 | ), |
||
| 246 | 'default' => $this->organization_config->get_pretty('logo_url'), |
||
| 247 | 'required' => false, |
||
| 248 | ) |
||
| 249 | ), |
||
| 250 | 'social_links_hdr' => new EE_Form_Section_HTML( |
||
| 251 | EEH_HTML::h2( |
||
| 252 | esc_html__('Social Links', 'event_espresso') |
||
| 253 | . ' ' |
||
| 254 | . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info')) |
||
| 255 | . EEH_HTML::br() |
||
| 256 | . EEH_HTML::p( |
||
| 257 | esc_html__( |
||
| 258 | 'Enter any links to social accounts for your organization here', |
||
| 259 | 'event_espresso' |
||
| 260 | ), |
||
| 261 | '', |
||
| 262 | 'description' |
||
| 263 | ), |
||
| 264 | '', |
||
| 265 | 'social-links-hdr' |
||
| 266 | ) |
||
| 267 | ), |
||
| 268 | 'organization_facebook' => new EE_Text_Input( |
||
| 269 | array( |
||
| 270 | 'html_name' => 'organization_facebook', |
||
| 271 | 'html_label_text' => esc_html__('Facebook', 'event_espresso'), |
||
| 272 | 'other_html_attributes' => ' placeholder="facebook.com/profile.name"', |
||
| 273 | 'default' => $this->organization_config->get_pretty('facebook'), |
||
| 274 | 'required' => false, |
||
| 275 | ) |
||
| 276 | ), |
||
| 277 | 'organization_twitter' => new EE_Text_Input( |
||
| 278 | array( |
||
| 279 | 'html_name' => 'organization_twitter', |
||
| 280 | 'html_label_text' => esc_html__('Twitter', 'event_espresso'), |
||
| 281 | 'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"', |
||
| 282 | 'default' => $this->organization_config->get_pretty('twitter'), |
||
| 283 | 'required' => false, |
||
| 284 | ) |
||
| 285 | ), |
||
| 286 | 'organization_linkedin' => new EE_Text_Input( |
||
| 287 | array( |
||
| 288 | 'html_name' => 'organization_linkedin', |
||
| 289 | 'html_label_text' => esc_html__('LinkedIn', 'event_espresso'), |
||
| 290 | 'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"', |
||
| 291 | 'default' => $this->organization_config->get_pretty('linkedin'), |
||
| 292 | 'required' => false, |
||
| 293 | ) |
||
| 294 | ), |
||
| 295 | 'organization_pinterest' => new EE_Text_Input( |
||
| 296 | array( |
||
| 297 | 'html_name' => 'organization_pinterest', |
||
| 298 | 'html_label_text' => esc_html__('Pinterest', 'event_espresso'), |
||
| 299 | 'other_html_attributes' => ' placeholder="pinterest.com/profilename"', |
||
| 300 | 'default' => $this->organization_config->get_pretty('pinterest'), |
||
| 301 | 'required' => false, |
||
| 302 | ) |
||
| 303 | ), |
||
| 304 | 'organization_google' => new EE_Text_Input( |
||
| 305 | array( |
||
| 306 | 'html_name' => 'organization_google', |
||
| 307 | 'html_label_text' => esc_html__('Google+', 'event_espresso'), |
||
| 308 | 'other_html_attributes' => ' placeholder="google.com/+profilename"', |
||
| 309 | 'default' => $this->organization_config->get_pretty('google'), |
||
| 310 | 'required' => false, |
||
| 311 | ) |
||
| 312 | ), |
||
| 313 | 'organization_instagram' => new EE_Text_Input( |
||
| 314 | array( |
||
| 315 | 'html_name' => 'organization_instagram', |
||
| 316 | 'html_label_text' => esc_html__('Instagram', 'event_espresso'), |
||
| 317 | 'other_html_attributes' => ' placeholder="instagram.com/handle"', |
||
| 318 | 'default' => $this->organization_config->get_pretty('instagram'), |
||
| 319 | 'required' => false, |
||
| 320 | ) |
||
| 321 | ), |
||
| 322 | ), |
||
| 323 | ) |
||
| 324 | ); |
||
| 325 | if (is_main_site()) { |
||
| 326 | $form->add_subsections( |
||
| 327 | array( |
||
| 328 | 'uxip_optin_hdr' => new EE_Form_Section_HTML( |
||
| 329 | $this->uxipOptinText() |
||
| 330 | ), |
||
| 331 | 'ueip_optin' => new EE_Checkbox_Multi_Input( |
||
| 332 | array( |
||
| 333 | true => __('Yes! I want to help improve Event Espresso!', 'event_espresso') |
||
| 334 | ), |
||
| 335 | array( |
||
| 336 | 'html_name' => EE_Core_Config::OPTION_NAME_UXIP, |
||
| 337 | 'html_label_text' => esc_html__( |
||
| 338 | 'UXIP Opt In?', |
||
| 339 | 'event_espresso' |
||
| 340 | ), |
||
| 341 | 'default' => isset($this->core_config->ee_ueip_optin) |
||
| 342 | ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN) |
||
| 343 | : false, |
||
| 344 | 'required' => false, |
||
| 345 | ) |
||
| 346 | ), |
||
| 347 | ), |
||
| 348 | 'organization_instagram', |
||
| 349 | false |
||
| 350 | ); |
||
| 351 | } |
||
| 352 | return $form; |
||
| 353 | } |
||
| 354 | |||
| 534 |