PluginProbe
ShiftController Employee Shift Scheduling / 2.2.5
ShiftController Employee Shift Scheduling v2.2.5
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
← All changes | shiftcontroller.php +102 -40 3.2.42.2.5 View file →
@@ -1,19 +1,26 @@
1 1 <?php
2 2 /**
3 3 * @package ShiftController
4 - * @author HitCode
4 + * @author ShiftController
5 + * @version 2.2.5
5 6 */
6 7 /*
7 8 Plugin Name: ShiftController
8 9 Plugin URI: http://www.shiftcontroller.com/
9 10 Description: Staff scheduling plugin.
10 -Author: HitCode
11 -Version: 3.2.4
12 -Author URI: http://www.hitcode.com/
13 -Text Domain: shiftcontroller
11 +Author: ShiftController
12 +Version: 2.2.5
13 +Author URI: http://www.shiftcontroller.com/
14 14 */
15 +error_reporting( E_ERROR & ~E_NOTICE );
15 16
17 +global $wp_version;
18 +if (version_compare($wp_version, "3.3", "<"))
19 +{
20 + exit('ShiftController requires WordPress 3.3 or newer, yours is ' . $wp_version);
21 +}
22 +
16 23 if( file_exists(dirname(__FILE__) . '/db.php') )
17 24 {
18 25 $nts_no_db = TRUE;
19 26 include_once( dirname(__FILE__) . '/db.php' );
@@ -24,60 +31,115 @@
24 31 else
25 32 $happ_path = dirname(__FILE__) . '/happ';
26 33 include_once( $happ_path . '/hclib/hcWpBase.php' );
27 34
28 -register_uninstall_hook( __FILE__, array('ShiftController', 'uninstall') );
35 +class ShiftController extends hcWpBase2
36 +{
37 + var $happ_path = '';
38 + var $happ_web_dir = '';
29 39
30 -class ShiftController extends hcWpBase5
31 -{
32 40 public function __construct()
33 41 {
34 - parent::__construct(
35 - strtolower(get_class()),
36 - __FILE__,
37 - '',
38 - 'ci'
42 + if( defined('NTS_DEVELOPMENT') )
43 + {
44 + $this->happ_path = NTS_DEVELOPMENT;
45 + $this->happ_web_dir = 'http://localhost';
46 + }
47 + else
48 + {
49 + $this->happ_path = dirname(__FILE__) . '/happ';
50 + $this->happ_web_dir = plugins_url('', __FILE__);
51 + }
52 +
53 + $GLOBALS['NTS_APPPATH'] = dirname(__FILE__) . '/application';
54 +
55 + parent::__construct(
56 + strtolower( get_class() ),
57 + dirname(__FILE__),
58 + array(),
59 + TRUE
39 60 );
40 61 $this->query_prefix = '?/';
62 +
63 + require( $this->happ_path . '/assets/files.php' );
64 + reset( $css_files );
65 + foreach( $css_files as $f )
66 + {
67 + if( is_array($f) )
68 + $f[0] = $this->happ_web_dir . '/' . $f[0];
69 + else
70 + $f = $this->happ_web_dir . '/' . $f;
71 + $this->register_admin_style($f);
72 + }
73 +
74 + reset( $js_files );
75 + foreach( $js_files as $f )
76 + {
77 + if( is_array($f) )
78 + $f[0] = $this->happ_web_dir . '/' . $f[0];
79 + else
80 + $f = $this->happ_web_dir . '/' . $f;
81 + $this->register_admin_script($f);
82 + }
83 +
84 + add_shortcode( $this->app, array($this, 'front_view'));
85 + add_action('wp', array($this, 'front_init') );
86 + add_action( 'admin_init', array($this, 'admin_init') );
87 + add_action( 'admin_menu', array($this, 'admin_menu') );
41 88 }
42 89
43 90 public function admin_menu()
44 91 {
45 - parent::admin_menu();
46 -
47 - $menu_title = ucfirst($this->app);
48 92 $page = add_menu_page(
49 - $menu_title,
50 - $menu_title,
93 + 'ShiftController',
94 + 'ShiftController',
51 95 'read',
52 - $this->slug,
53 - array( $this, 'admin_view' ),
54 - 'dashicons-calendar'
96 + $this->app,
97 + array( $this, 'admin_view' )
55 98 );
56 99 }
57 100
58 - static function uninstall( $prefix = 'shiftcontroller', $watch_other = array() )
101 + public function admin_init()
59 102 {
60 - $prefix = 'shiftcontroller';
61 - $watch_other = array('shiftcontroller-pro.php');
62 - hcWpBase5::uninstall( $prefix, $watch_other );
103 + if( $this->is_me_admin() )
104 + {
105 + parent::admin_init();
106 + // action
107 + require( $this->happ_path . '/application/index_action.php' );
108 + }
63 109 }
64 -}
65 110
66 -$sh = new ShiftController();
111 + public function front_init()
112 + {
113 + if( ! is_admin() )
114 + {
115 + if( parent::front_init() )
116 + {
117 + $GLOBALS['NTS_CONFIG'][$this->app]['FORCE_USER_LEVEL'] = 0;
118 + // action
119 + require( $this->happ_path . '/application/index_action.php' );
120 + $GLOBALS['NTS_CONFIG'][$this->app]['ACTION_STARTED'] = 1;
121 + }
122 + }
123 + }
67 124
68 -/*
69 -Can pass the following arguments for the shortcode:
70 - location:
71 - one, comma separated list
125 + public function admin_view()
126 + {
127 + $file = $this->happ_path . '/application/index_view.php';
128 + require( $file );
129 + }
72 130
73 - staff:
74 - one, comma separated list, _current_user_id_
131 + public function front_view()
132 + {
133 + if(
134 + isset($GLOBALS['NTS_CONFIG'][$this->app]['ACTION_STARTED']) &&
135 + $GLOBALS['NTS_CONFIG'][$this->app]['ACTION_STARTED']
136 + )
137 + {
138 + $file = $this->happ_path . '/application/index_view.php';
139 + require( $file );
140 + }
141 + }
142 +}
75 143
76 - date:
77 - date like 20150712, or range like 20150712_20150719
78 -
79 - range:
80 - week, month
81 -*/
82 -
144 +$sh = new ShiftController();
83 145 ?>