| Conditions | 3 |
| Paths | 4 |
| Total Lines | 462 |
| Code Lines | 342 |
| Lines | 0 |
| Ratio | 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 |
||
| 158 | public function init_fields () { |
||
| 159 | global $pagenow; |
||
| 160 | |||
| 161 | $pages_array = $this->pages_array(); |
||
| 162 | $posts_per_page_array = array( '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20' ); |
||
| 163 | $complete_settings = array( 'passed' => __( 'Once all the course lessons have been completed', 'woothemes-sensei' ), 'complete' => __( 'At any time (by clicking the \'Complete Course\' button)', 'woothemes-sensei' ) ); |
||
| 164 | $course_display_settings = array( 'excerpt' => __( 'Course Excerpt', 'woothemes-sensei' ), 'full' => __( 'Full Course Content', 'woothemes-sensei' ) ); |
||
| 165 | |||
| 166 | $fields = array(); |
||
| 167 | |||
| 168 | $fields['access_permission'] = array( |
||
| 169 | 'name' => __( 'Access Permissions', 'woothemes-sensei' ), |
||
| 170 | 'description' => __( 'Users must be logged in to view Course and Lesson content.', 'woothemes-sensei', 'woothemes-sensei' ), |
||
| 171 | 'type' => 'checkbox', |
||
| 172 | 'default' => true, |
||
| 173 | 'section' => 'default-settings' |
||
| 174 | ); |
||
| 175 | |||
| 176 | $fields['messages_disable'] = array( |
||
| 177 | 'name' => __( 'Disable Private Messages', 'woothemes-sensei' ), |
||
| 178 | 'description' => __( 'Disable the private message functions between learners and teachers.', 'woothemes-sensei' ), |
||
| 179 | 'type' => 'checkbox', |
||
| 180 | 'default' => false, |
||
| 181 | 'section' => 'default-settings' |
||
| 182 | ); |
||
| 183 | |||
| 184 | $fields['course_page'] = array( |
||
| 185 | 'name' => __( 'Course Archive Page', 'woothemes-sensei' ), |
||
| 186 | 'description' => __( 'The page to use to display courses. If you leave this blank the default custom post type archive will apply.', 'woothemes-sensei' ), |
||
| 187 | 'type' => 'select', |
||
| 188 | 'default' => get_option( 'woothemes-sensei_courses_page_id', 0 ), |
||
| 189 | 'section' => 'default-settings', |
||
| 190 | 'required' => 0, |
||
| 191 | 'options' => $pages_array |
||
| 192 | ); |
||
| 193 | |||
| 194 | $fields['my_course_page'] = array( |
||
| 195 | 'name' => __( 'My Courses Page', 'woothemes-sensei' ), |
||
| 196 | 'description' => __( 'The page to use to display the courses that a user is currently taking as well as the courses a user has complete.', 'woothemes-sensei' ), |
||
| 197 | 'type' => 'select', |
||
| 198 | 'default' => get_option( 'woothemes-sensei_user_dashboard_page_id', 0 ), |
||
| 199 | 'section' => 'default-settings', |
||
| 200 | 'required' => 0, |
||
| 201 | 'options' => $pages_array |
||
| 202 | ); |
||
| 203 | |||
| 204 | $fields['placeholder_images_enable'] = array( |
||
| 205 | 'name' => __( 'Use placeholder images', 'woothemes-sensei' ), |
||
| 206 | 'description' => __( 'Output a placeholder image when no featured image has been specified for Courses and Lessons.', 'woothemes-sensei' ), |
||
| 207 | 'type' => 'checkbox', |
||
| 208 | 'default' => false, |
||
| 209 | 'section' => 'default-settings' |
||
| 210 | ); |
||
| 211 | |||
| 212 | $fields['styles_disable'] = array( |
||
| 213 | 'name' => __( 'Disable Sensei Styles', 'woothemes-sensei' ), |
||
| 214 | 'description' => __( 'Prevent the frontend stylesheets from loading. This will remove the default styles for all Sensei elements.', 'woothemes-sensei' ), |
||
| 215 | 'type' => 'checkbox', |
||
| 216 | 'default' => false, |
||
| 217 | 'section' => 'default-settings' |
||
| 218 | ); |
||
| 219 | |||
| 220 | $fields['js_disable'] = array( |
||
| 221 | 'name' => __( 'Disable Sensei Javascript', 'woothemes-sensei' ), |
||
| 222 | 'description' => __( 'Prevent the frontend javascript from loading. This affects the progress bars and the My Courses tabs.', 'woothemes-sensei' ), |
||
| 223 | 'type' => 'checkbox', |
||
| 224 | 'default' => false, |
||
| 225 | 'section' => 'default-settings' |
||
| 226 | ); |
||
| 227 | |||
| 228 | // Course Settings |
||
| 229 | |||
| 230 | $fields['course_completion'] = array( |
||
| 231 | 'name' => __( 'Courses are complete:', 'woothemes-sensei' ), |
||
| 232 | 'description' => __( 'This will determine when courses are marked as complete.', 'woothemes-sensei' ), |
||
| 233 | 'type' => 'select', |
||
| 234 | 'default' => 'passed', |
||
| 235 | 'section' => 'course-settings', |
||
| 236 | 'required' => 0, |
||
| 237 | 'options' => $complete_settings |
||
| 238 | ); |
||
| 239 | |||
| 240 | $fields['course_author'] = array( |
||
| 241 | 'name' => __( 'Display Course Author', 'woothemes-sensei' ), |
||
| 242 | 'description' => __( 'Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei' ), |
||
| 243 | 'type' => 'checkbox', |
||
| 244 | 'default' => true, |
||
| 245 | 'section' => 'course-settings' |
||
| 246 | ); |
||
| 247 | |||
| 248 | $fields['my_course_amount'] = array( |
||
| 249 | 'name' => __( 'My Courses Pagination', 'woothemes-sensei' ), |
||
| 250 | 'description' => __( 'The number of courses to output for the my courses page.', 'woothemes-sensei' ), |
||
| 251 | 'type' => 'range', |
||
| 252 | 'default' => '0', |
||
| 253 | 'section' => 'course-settings', |
||
| 254 | 'required' => 0, |
||
| 255 | 'options' => $posts_per_page_array |
||
| 256 | ); |
||
| 257 | |||
| 258 | $fields['course_archive_image_enable'] = array( |
||
| 259 | 'name' => __( 'Course Archive Image', 'woothemes-sensei' ), |
||
| 260 | 'description' => __( 'Output the Course Image on the Course Archive Page.', 'woothemes-sensei' ), |
||
| 261 | 'type' => 'checkbox', |
||
| 262 | 'default' => true, |
||
| 263 | 'section' => 'course-settings' |
||
| 264 | ); |
||
| 265 | |||
| 266 | $fields['course_archive_image_width'] = array( |
||
| 267 | 'name' => __( 'Image Width - Archive', 'woothemes-sensei' ), |
||
| 268 | 'description' => __( 'The width in pixels of the featured image for the Course Archive page.', 'woothemes-sensei' ), |
||
| 269 | 'type' => 'text', |
||
| 270 | 'default' => '100', |
||
| 271 | 'section' => 'course-settings', |
||
| 272 | 'required' => 0 |
||
| 273 | ); |
||
| 274 | |||
| 275 | $fields['course_archive_image_height'] = array( |
||
| 276 | 'name' => __( 'Image Height - Archive', 'woothemes-sensei' ), |
||
| 277 | 'description' => __( 'The height in pixels of the featured image for the Course Archive page.', 'woothemes-sensei' ), |
||
| 278 | 'type' => 'text', |
||
| 279 | 'default' => '100', |
||
| 280 | 'section' => 'course-settings', |
||
| 281 | 'required' => 0 |
||
| 282 | ); |
||
| 283 | |||
| 284 | $fields['course_archive_image_hard_crop'] = array( |
||
| 285 | 'name' => __( 'Image Hard Crop - Archive', 'woothemes-sensei' ), |
||
| 286 | 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
||
| 287 | 'type' => 'checkbox', |
||
| 288 | 'default' => false, |
||
| 289 | 'section' => 'course-settings' |
||
| 290 | ); |
||
| 291 | |||
| 292 | $fields['course_single_image_enable'] = array( |
||
| 293 | 'name' => __( 'Single Course Image', 'woothemes-sensei' ), |
||
| 294 | 'description' => __( 'Output the Course Image on the Single Course Page.', 'woothemes-sensei' ), |
||
| 295 | 'type' => 'checkbox', |
||
| 296 | 'default' => false, |
||
| 297 | 'section' => 'course-settings' |
||
| 298 | ); |
||
| 299 | |||
| 300 | $fields['course_single_image_width'] = array( |
||
| 301 | 'name' => __( 'Image Width - Single', 'woothemes-sensei' ), |
||
| 302 | 'description' => __( 'The width in pixels of the featured image for the Course single post page.', 'woothemes-sensei' ), |
||
| 303 | 'type' => 'text', |
||
| 304 | 'default' => '100', |
||
| 305 | 'section' => 'course-settings', |
||
| 306 | 'required' => 0 |
||
| 307 | ); |
||
| 308 | |||
| 309 | $fields['course_single_image_height'] = array( |
||
| 310 | 'name' => __( 'Image Height - Single', 'woothemes-sensei' ), |
||
| 311 | 'description' => __( 'The height in pixels of the featured image for the Course single post page.', 'woothemes-sensei' ), |
||
| 312 | 'type' => 'text', |
||
| 313 | 'default' => '100', |
||
| 314 | 'section' => 'course-settings', |
||
| 315 | 'required' => 0 |
||
| 316 | ); |
||
| 317 | |||
| 318 | $fields['course_single_image_hard_crop'] = array( |
||
| 319 | 'name' => __( 'Image Hard Crop - Single', 'woothemes-sensei' ), |
||
| 320 | 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
||
| 321 | 'type' => 'checkbox', |
||
| 322 | 'default' => false, |
||
| 323 | 'section' => 'course-settings' |
||
| 324 | ); |
||
| 325 | |||
| 326 | $fields['course_single_content_display'] = array( |
||
| 327 | 'name' => __( 'Single Course page displays:', 'woothemes-sensei' ), |
||
| 328 | 'description' => __( 'Determines what content to display on the single course page.', 'woothemes-sensei' ), |
||
| 329 | 'type' => 'select', |
||
| 330 | 'default' => 'excerpt', |
||
| 331 | 'section' => 'course-settings', |
||
| 332 | 'required' => 0, |
||
| 333 | 'options' => $course_display_settings |
||
| 334 | ); |
||
| 335 | |||
| 336 | $fields['course_archive_featured_enable'] = array( |
||
| 337 | 'name' => __( 'Featured Courses Panel', 'woothemes-sensei' ), |
||
| 338 | 'description' => __( 'Output the Featured Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
||
| 339 | 'type' => 'checkbox', |
||
| 340 | 'default' => true, |
||
| 341 | 'section' => 'course-settings' |
||
| 342 | ); |
||
| 343 | |||
| 344 | $fields['course_archive_more_link_text'] = array( |
||
| 345 | 'name' => __( 'More link text', 'woothemes-sensei' ), |
||
| 346 | 'description' => __( 'The text that will be displayed on the Course Archive for the more courses link.', 'woothemes-sensei' ), |
||
| 347 | 'type' => 'text', |
||
| 348 | 'default' => __ ( 'More', 'woothemes-sensei' ), |
||
| 349 | 'section' => 'course-settings', |
||
| 350 | 'required' => 0 |
||
| 351 | ); |
||
| 352 | |||
| 353 | // Lesson Settings |
||
| 354 | |||
| 355 | $fields['lesson_comments'] = array( |
||
| 356 | 'name' => __( 'Allow Comments for Lessons', 'woothemes-sensei' ), |
||
| 357 | 'description' => __( 'This will allow learners to post comments on the single Lesson page, only learner who have access to the Lesson will be allowed to comment.', 'woothemes-sensei' ), |
||
| 358 | 'type' => 'checkbox', |
||
| 359 | 'default' => true, |
||
| 360 | 'section' => 'lesson-settings' |
||
| 361 | ); |
||
| 362 | |||
| 363 | $fields['lesson_author'] = array( |
||
| 364 | 'name' => __( 'Display Lesson Author', 'woothemes-sensei' ), |
||
| 365 | 'description' => __( 'Output the Lesson Author on Course single page & Lesson archive page.', 'woothemes-sensei' ), |
||
| 366 | 'type' => 'checkbox', |
||
| 367 | 'default' => true, |
||
| 368 | 'section' => 'lesson-settings' |
||
| 369 | ); |
||
| 370 | |||
| 371 | $fields['course_lesson_image_enable'] = array( |
||
| 372 | 'name' => __( 'Course Lesson Images', 'woothemes-sensei' ), |
||
| 373 | 'description' => __( 'Output the Lesson Image on the Single Course Page.', 'woothemes-sensei' ), |
||
| 374 | 'type' => 'checkbox', |
||
| 375 | 'default' => false, |
||
| 376 | 'section' => 'lesson-settings' |
||
| 377 | ); |
||
| 378 | |||
| 379 | $fields['lesson_archive_image_width'] = array( |
||
| 380 | 'name' => __( 'Image Width - Course Lessons', 'woothemes-sensei' ), |
||
| 381 | 'description' => __( 'The width in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei' ), |
||
| 382 | 'type' => 'text', |
||
| 383 | 'default' => '100', |
||
| 384 | 'section' => 'lesson-settings', |
||
| 385 | 'required' => 0 |
||
| 386 | ); |
||
| 387 | |||
| 388 | $fields['lesson_archive_image_height'] = array( |
||
| 389 | 'name' => __( 'Image Height - Course Lessons', 'woothemes-sensei' ), |
||
| 390 | 'description' => __( 'The height in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei' ), |
||
| 391 | 'type' => 'text', |
||
| 392 | 'default' => '100', |
||
| 393 | 'section' => 'lesson-settings', |
||
| 394 | 'required' => 0 |
||
| 395 | ); |
||
| 396 | |||
| 397 | $fields['lesson_archive_image_hard_crop'] = array( |
||
| 398 | 'name' => __( 'Image Hard Crop - Course Lessons', 'woothemes-sensei' ), |
||
| 399 | 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
||
| 400 | 'type' => 'checkbox', |
||
| 401 | 'default' => false, |
||
| 402 | 'section' => 'lesson-settings' |
||
| 403 | ); |
||
| 404 | |||
| 405 | $fields['lesson_single_image_enable'] = array( |
||
| 406 | 'name' => __( 'Single Lesson Images', 'woothemes-sensei' ), |
||
| 407 | 'description' => __( 'Output the Lesson Image on the Single Lesson Page.', 'woothemes-sensei' ), |
||
| 408 | 'type' => 'checkbox', |
||
| 409 | 'default' => false, |
||
| 410 | 'section' => 'lesson-settings' |
||
| 411 | ); |
||
| 412 | |||
| 413 | $fields['lesson_single_image_width'] = array( |
||
| 414 | 'name' => __( 'Image Width - Single', 'woothemes-sensei' ), |
||
| 415 | 'description' => __( 'The width in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei' ), |
||
| 416 | 'type' => 'text', |
||
| 417 | 'default' => '100', |
||
| 418 | 'section' => 'lesson-settings', |
||
| 419 | 'required' => 0 |
||
| 420 | ); |
||
| 421 | |||
| 422 | $fields['lesson_single_image_height'] = array( |
||
| 423 | 'name' => __( 'Image Height - Single', 'woothemes-sensei' ), |
||
| 424 | 'description' => __( 'The height in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei' ), |
||
| 425 | 'type' => 'text', |
||
| 426 | 'default' => '100', |
||
| 427 | 'section' => 'lesson-settings', |
||
| 428 | 'required' => 0 |
||
| 429 | ); |
||
| 430 | |||
| 431 | $fields['lesson_single_image_hard_crop'] = array( |
||
| 432 | 'name' => __( 'Image Hard Crop - Single', 'woothemes-sensei' ), |
||
| 433 | 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
||
| 434 | 'type' => 'checkbox', |
||
| 435 | 'default' => false, |
||
| 436 | 'section' => 'lesson-settings' |
||
| 437 | ); |
||
| 438 | |||
| 439 | // Learner Profile settings |
||
| 440 | |||
| 441 | $profile_url_base = apply_filters( 'sensei_learner_profiles_url_base', __( 'learner', 'woothemes-sensei') ); |
||
| 442 | $profile_url_example = trailingslashit( get_site_url() ) . $profile_url_base . '/%username%'; |
||
| 443 | |||
| 444 | $fields['learner_profile_enable'] = array( |
||
| 445 | 'name' => __( 'Public learner profiles', 'woothemes-sensei' ), |
||
| 446 | 'description' => sprintf( __( 'Enable public learner profiles that will be accessible to everyone. Profile URL format: %s', 'woothemes-sensei' ), $profile_url_example ), |
||
| 447 | 'type' => 'checkbox', |
||
| 448 | 'default' => true, |
||
| 449 | 'section' => 'learner-profile-settings' |
||
| 450 | ); |
||
| 451 | |||
| 452 | $fields['learner_profile_show_courses'] = array( |
||
| 453 | 'name' => __( 'Show learner\'s courses', 'woothemes-sensei' ), |
||
| 454 | 'description' => __( 'Display the learner\'s active and completed courses on their profile.', 'woothemes-sensei' ), |
||
| 455 | 'type' => 'checkbox', |
||
| 456 | 'default' => true, |
||
| 457 | 'section' => 'learner-profile-settings' |
||
| 458 | ); |
||
| 459 | |||
| 460 | // Email notifications |
||
| 461 | |||
| 462 | $learner_email_options = array( |
||
| 463 | 'learner-graded-quiz' => __( 'Their quiz is graded (auto and manual grading)', 'woothemes-sensei' ), |
||
| 464 | 'learner-completed-course' => __( 'They complete a course', 'woothemes-sensei' ), |
||
| 465 | ); |
||
| 466 | |||
| 467 | $teacher_email_options = array( |
||
| 468 | 'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ), |
||
| 469 | 'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ), |
||
| 470 | 'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ), |
||
| 471 | 'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ), |
||
| 472 | 'teacher-new-message' => __( 'A learner sends a private message to a teacher', 'woothemes-sensei' ), |
||
| 473 | ); |
||
| 474 | |||
| 475 | $global_email_options = array( |
||
| 476 | 'new-message-reply' => __( 'They receive a reply to their private message', 'woothemes-sensei' ), |
||
| 477 | ); |
||
| 478 | |||
| 479 | $fields['email_learners'] = array( |
||
| 480 | 'name' => __( 'Emails Sent to Learners', 'woothemes-sensei' ), |
||
| 481 | 'description' => __( 'Select the notifications that will be sent to learners.', 'woothemes-sensei' ), |
||
| 482 | 'type' => 'multicheck', |
||
| 483 | 'options' => $learner_email_options, |
||
| 484 | 'defaults' => array( 'learner-graded-quiz', 'learner-completed-course' ), |
||
| 485 | 'section' => 'email-notification-settings' |
||
| 486 | ); |
||
| 487 | |||
| 488 | $fields['email_teachers'] = array( |
||
| 489 | 'name' => __( 'Emails Sent to Teachers', 'woothemes-sensei' ), |
||
| 490 | 'description' => __( 'Select the notifications that will be sent to teachers.', 'woothemes-sensei' ), |
||
| 491 | 'type' => 'multicheck', |
||
| 492 | 'options' => $teacher_email_options, |
||
| 493 | 'defaults' => array( 'teacher-completed-course', 'teacher-started-course', 'teacher-quiz-submitted', 'teacher-new-message' ), |
||
| 494 | 'section' => 'email-notification-settings' |
||
| 495 | ); |
||
| 496 | |||
| 497 | $fields['email_global'] = array( |
||
| 498 | 'name' => __( 'Emails Sent to All Users', 'woothemes-sensei' ), |
||
| 499 | 'description' => __( 'Select the notifications that will be sent to all users.', 'woothemes-sensei' ), |
||
| 500 | 'type' => 'multicheck', |
||
| 501 | 'options' => $global_email_options, |
||
| 502 | 'defaults' => array( 'new-message-reply' ), |
||
| 503 | 'section' => 'email-notification-settings' |
||
| 504 | ); |
||
| 505 | |||
| 506 | $fields['email_from_name'] = array( |
||
| 507 | 'name' => __( '"From" Name', 'woothemes-sensei' ), |
||
| 508 | 'description' => __( 'The name from which all emails will be sent.', 'woothemes-sensei' ), |
||
| 509 | 'type' => 'text', |
||
| 510 | 'default' => get_bloginfo( 'name' ), |
||
| 511 | 'section' => 'email-notification-settings', |
||
| 512 | 'required' => 1 |
||
| 513 | ); |
||
| 514 | |||
| 515 | $fields['email_from_address'] = array( |
||
| 516 | 'name' => __( '"From" Address', 'woothemes-sensei' ), |
||
| 517 | 'description' => __( 'The address from which all emails will be sent.', 'woothemes-sensei' ), |
||
| 518 | 'type' => 'text', |
||
| 519 | 'default' => get_bloginfo( 'admin_email' ), |
||
| 520 | 'section' => 'email-notification-settings', |
||
| 521 | 'required' => 1 |
||
| 522 | ); |
||
| 523 | |||
| 524 | $fields['email_header_image'] = array( |
||
| 525 | 'name' => __( 'Header Image', 'woothemes-sensei' ), |
||
| 526 | 'description' => sprintf( __( 'Enter a URL to an image you want to show in the email\'s header. Upload your image using the %1$smedia uploader%2$s.', 'woothemes-sensei' ), '<a href="' . admin_url( 'media-new.php' ) . '">', '</a>' ), |
||
| 527 | 'type' => 'text', |
||
| 528 | 'default' => '', |
||
| 529 | 'section' => 'email-notification-settings', |
||
| 530 | 'required' => 0 |
||
| 531 | ); |
||
| 532 | |||
| 533 | $fields['email_footer_text'] = array( |
||
| 534 | 'name' => __( 'Email Footer Text', 'woothemes-sensei' ), |
||
| 535 | 'description' => __( 'The text to appear in the footer of Sensei emails.', 'woothemes-sensei' ), |
||
| 536 | 'type' => 'textarea', |
||
| 537 | 'default' => sprintf( __( '%1$s - Powered by Sensei', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), |
||
| 538 | 'section' => 'email-notification-settings', |
||
| 539 | 'required' => 0 |
||
| 540 | ); |
||
| 541 | |||
| 542 | $fields['email_base_color'] = array( |
||
| 543 | 'name' => __( 'Base Colour', 'woothemes-sensei' ), |
||
| 544 | 'description' => sprintf( __( 'The base colour for Sensei email templates. Default %1$s#557da1%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
||
| 545 | 'type' => 'color', |
||
| 546 | 'default' => '#557da1', |
||
| 547 | 'section' => 'email-notification-settings', |
||
| 548 | 'required' => 1 |
||
| 549 | ); |
||
| 550 | |||
| 551 | $fields['email_background_color'] = array( |
||
| 552 | 'name' => __( 'Background Colour', 'woothemes-sensei' ), |
||
| 553 | 'description' => sprintf( __( 'The background colour for Sensei email templates. Default %1$s#f5f5f5%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
||
| 554 | 'type' => 'color', |
||
| 555 | 'default' => '#f5f5f5', |
||
| 556 | 'section' => 'email-notification-settings', |
||
| 557 | 'required' => 1 |
||
| 558 | ); |
||
| 559 | |||
| 560 | $fields['email_body_background_color'] = array( |
||
| 561 | 'name' => __( 'Body Background Colour', 'woothemes-sensei' ), |
||
| 562 | 'description' => sprintf( __( 'The main body background colour for Sensei email templates. Default %1$s#fdfdfd%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
||
| 563 | 'type' => 'color', |
||
| 564 | 'default' => '#fdfdfd', |
||
| 565 | 'section' => 'email-notification-settings', |
||
| 566 | 'required' => 1 |
||
| 567 | ); |
||
| 568 | |||
| 569 | $fields['email_text_color'] = array( |
||
| 570 | 'name' => __( 'Body Text Colour', 'woothemes-sensei' ), |
||
| 571 | 'description' => sprintf( __( 'The main body text colour for Sensei email templates. Default %1$s#505050%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
||
| 572 | 'type' => 'color', |
||
| 573 | 'default' => '#505050', |
||
| 574 | 'section' => 'email-notification-settings', |
||
| 575 | 'required' => 1 |
||
| 576 | ); |
||
| 577 | |||
| 578 | if ( Sensei_WC::is_woocommerce_present() ) { |
||
| 579 | // WooCommerce Settings |
||
| 580 | $fields['woocommerce_enabled'] = array( |
||
| 581 | 'name' => __( 'Enable WooCommerce Courses', 'woothemes-sensei' ), |
||
| 582 | 'description' => __( 'Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei' ), |
||
| 583 | 'type' => 'checkbox', |
||
| 584 | 'default' => true, |
||
| 585 | 'section' => 'woocommerce-settings' |
||
| 586 | ); |
||
| 587 | |||
| 588 | $fields['course_archive_free_enable'] = array( |
||
| 589 | 'name' => __( 'Free Courses Panel', 'woothemes-sensei' ), |
||
| 590 | 'description' => __( 'Output the Free Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
||
| 591 | 'type' => 'checkbox', |
||
| 592 | 'default' => true, |
||
| 593 | 'section' => 'woocommerce-settings' |
||
| 594 | ); |
||
| 595 | |||
| 596 | $fields['course_archive_paid_enable'] = array( |
||
| 597 | 'name' => __( 'Paid Courses Panel', 'woothemes-sensei' ), |
||
| 598 | 'description' => __( 'Output the Paid Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
||
| 599 | 'type' => 'checkbox', |
||
| 600 | 'default' => true, |
||
| 601 | 'section' => 'woocommerce-settings' |
||
| 602 | ); |
||
| 603 | |||
| 604 | } // End If Statement |
||
| 605 | |||
| 606 | if ( 'en_US' !== get_locale() ) { |
||
| 607 | $fields['install_language_pack'] = array( |
||
| 608 | 'name' => __( 'Install Language Pack', 'woothemes-sensei' ), |
||
| 609 | 'description' => __( 'Use this action to install or re-install translation for your language if available.', 'woothemes-sensei' ), |
||
| 610 | 'type' => 'button', |
||
| 611 | 'section' => 'language-settings', |
||
| 612 | 'target' => Sensei_Language_Pack_Manager::get_install_uri(), |
||
| 613 | 'label' => __( 'Install', 'woothemes-sensei' ) |
||
| 614 | ); |
||
| 615 | } |
||
| 616 | |||
| 617 | $this->fields = apply_filters( 'sensei_settings_fields', $fields ); |
||
| 618 | |||
| 619 | } // End init_fields() |
||
| 620 | |||
| 716 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: