|
- <?php
- /**
- * Plugin Name: Acare Advanced Office
- * Plugin URI: http://biukop.com.au/acaresydney/timesheets
- * Description: Advanced Office system, timesheet, Payroll for AcareSydney
- * Version: 2.1
- * Author: Biukop Intelligence
- * Author URI: http://biukop.com.au/
- */
-
- require_once(dirname(__FILE__) . '/autoload.php');
- require_once (ABSPATH . 'wp-includes/pluggable.php');
-
-
- class AcareOffice{
-
- private $nonce; //for ajax verification
- private $pages = array('time-sheets', 'user-list');
-
- public function __construct() {
- add_action('init', array($this, 'class_loader'));
- add_action('after_setup_theme', array($this, 'remove_admin_bar'));
- }
-
- /**
- * Autoload the custom theme classes
- */
- public function class_loader()
- {
- // Create a new instance of the autoloader
- $loader = new Psr4AutoloaderClass();
-
- // Register this instance
- $loader->register();
-
- // Add our namespace and the folder it maps to
- $loader->addNamespace('\XeroPHP', dirname(__FILE__) . '/xero-php-master/src/XeroPHP');
- $loader->addNamespace('\Biukop', dirname(__FILE__) . '/' );
-
-
- $n = new Biukop\Xero();
- }
-
- // private function pagename(){
- // global $wp_query;
- // $pagename = get_query_var('pagename');
- // if ( !$pagename ) {
- // // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
- // $post = $wp_query->get_queried_object();
- // $pagename = $post->post_name;
- // }
- // return $pagename;
- // }
-
- //
- public function remove_admin_bar(){
- global $pagename;
- //$pagename = $this->pagename();
- if (!$pagename)
- $pagename = get_query_var('pagename');
-
- if (!current_user_can('administrator')) {
- show_admin_bar(false);
- add_filter('show_admin_bar', '__return_false');
- return;
- }
-
- if (in_array($pagename, $this->pages)){
- show_admin_bar(false);
- add_filter('show_admin_bar', '__return_false');
- }
- }
-
- }
-
- new AcareOffice();
|