timesheet source code
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.

76 line
2.2KB

  1. <?php
  2. /**
  3. * Plugin Name: Acare Advanced Office
  4. * Plugin URI: http://biukop.com.au/acaresydney/timesheets
  5. * Description: Advanced Office system, timesheet, Payroll for AcareSydney
  6. * Version: 2.1
  7. * Author: Biukop Intelligence
  8. * Author URI: http://biukop.com.au/
  9. */
  10. require_once(dirname(__FILE__) . '/autoload.php');
  11. require_once (ABSPATH . 'wp-includes/pluggable.php');
  12. class AcareOffice{
  13. private $nonce; //for ajax verification
  14. private $pages = array('time-sheets', 'user-list');
  15. public function __construct() {
  16. add_action('init', array($this, 'class_loader'));
  17. add_action('after_setup_theme', array($this, 'remove_admin_bar'));
  18. }
  19. /**
  20. * Autoload the custom theme classes
  21. */
  22. public function class_loader()
  23. {
  24. // Create a new instance of the autoloader
  25. $loader = new Psr4AutoloaderClass();
  26. // Register this instance
  27. $loader->register();
  28. // Add our namespace and the folder it maps to
  29. $loader->addNamespace('\XeroPHP', dirname(__FILE__) . '/xero-php-master/src/XeroPHP');
  30. $loader->addNamespace('\Biukop', dirname(__FILE__) . '/' );
  31. $n = new Biukop\Xero();
  32. }
  33. // private function pagename(){
  34. // global $wp_query;
  35. // $pagename = get_query_var('pagename');
  36. // if ( !$pagename ) {
  37. // // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
  38. // $post = $wp_query->get_queried_object();
  39. // $pagename = $post->post_name;
  40. // }
  41. // return $pagename;
  42. // }
  43. //
  44. public function remove_admin_bar(){
  45. global $pagename;
  46. //$pagename = $this->pagename();
  47. if (!$pagename)
  48. $pagename = get_query_var('pagename');
  49. if (!current_user_can('administrator')) {
  50. show_admin_bar(false);
  51. add_filter('show_admin_bar', '__return_false');
  52. return;
  53. }
  54. if (in_array($pagename, $this->pages)){
  55. show_admin_bar(false);
  56. add_filter('show_admin_bar', '__return_false');
  57. }
  58. }
  59. }
  60. new AcareOffice();