register.php 1014 B

12345678910111213141516171819202122232425262728293031
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. /**
  3. * Registration class. Responsible for handling registration of fields, notifications, and sidebars
  4. *
  5. * @package Ninja Forms
  6. * @subpackage Classes/Register
  7. * @copyright Copyright (c) 2014, WPNINJAS
  8. * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
  9. * @since 3.0
  10. */
  11. class NF_Register
  12. {
  13. /**
  14. * Function that registers a notification type
  15. *
  16. * @access public
  17. * @param string $slug - Notification type slug. Must be unique.
  18. * @param string $classname - Name of the class that should be used for the notification type.
  19. * @since 3.0
  20. * @return void
  21. */
  22. public function notification_type( $slug, $nicename, $classname ) {
  23. if ( ! empty( $slug ) && ! empty( $classname ) && ! isset ( Ninja_Forms()->registered_field_types[ $slug ] ) ) {
  24. Ninja_Forms()->registered_notification_types[ $slug ]['nicename'] = $nicename;
  25. Ninja_Forms()->registered_notification_types[ $slug ]['classname'] = $classname;
  26. }
  27. }
  28. }