Boilerplate to develop Wordpress Plugins
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.7 KiB

4 years ago
  1. <?php
  2. /**
  3. * The core plugin class.
  4. *
  5. * This is used to define internationalization, admin-specific hooks, and
  6. * public-facing site hooks.
  7. *
  8. * Also maintains the unique identifier of this plugin as well as the current
  9. * version of the plugin.
  10. *
  11. * @since 1.0.0
  12. * @package Test
  13. * @subpackage Test/includes
  14. * @author test <test>
  15. *
  16. */
  17. if (!defined('ABSPATH')) {
  18. exit; // Exit if accessed directly
  19. }
  20. class Test
  21. {
  22. /**
  23. * Define the core functionality of the plugin.
  24. *
  25. * Set the plugin name and the plugin version that can be used throughout the plugin.
  26. * Load the dependencies, define the locale, and set the hooks for the admin area and
  27. * the public-facing side of the site.
  28. *
  29. * @since 1.0.0
  30. */
  31. public function __construct()
  32. {
  33. // load dependencies
  34. require_once plugin_dir_path(dirname( __FILE__ )).'includes/class-i18n.php';
  35. $this->set_locale();
  36. $this->admin();
  37. $this->public();
  38. }
  39. /**
  40. * Define the locale for this plugin for internationalization.
  41. *
  42. * Uses the Test_i18n class in order to set the domain and to register the hook
  43. * with WordPress.
  44. *
  45. * @since 1.0.0
  46. * @access private
  47. */
  48. private function set_locale()
  49. {
  50. $plugin_i18n = new Test_i18n();
  51. $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
  52. }
  53. /**
  54. * Register all of the hooks related to the admin area functionality
  55. * of the plugin.
  56. *
  57. * @since 1.0.0
  58. * @access private
  59. */
  60. private function define_admin()
  61. {
  62. }
  63. /**
  64. * Register all of the hooks related to the public-facing functionality
  65. * of the plugin.
  66. *
  67. * @since 1.0.0
  68. * @access private
  69. */
  70. private function define_public()
  71. {
  72. }
  73. }