Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. Plugin Name:
  5. Description:
  6. Version: 0.1
  7. Author:
  8. Author URI:
  9. */
  10.  
  11. if ( ! class_exists( 'plugin_name' ) ) {
  12. if ( function_exists( 'add_action' ) ) {
  13. add_action( 'plugins_loaded' , array( 'plugin_name', 'get_object' ) );
  14. }
  15.  
  16. class plugin_name {
  17. /**
  18. * Class Object
  19. * @var object The Class Object
  20. */
  21. static private $classobj = NULL;
  22.  
  23. /**
  24. * Gets the object, if it does not exists, init it
  25. */
  26. public function get_object () {
  27. if ( NULL === self :: $classobj ) {
  28. self :: $classobj = new self;
  29. }
  30. return self :: $classobj;
  31. }
  32.  
  33. /**
  34. * Kick off
  35. */
  36. public function __construct () {
  37. // Actions
  38. $array = array(
  39. 'foo' => 'bar',
  40. 'baz' => 'boo'
  41. );
  42.  
  43. if ( FALSE == $bar ) {
  44. // Do something
  45.  
  46. }
  47.  
  48. echo 'Foo: ' . $array[ 'foo' ] . '<br />';
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement