PluginProbe
Time Clock – A WordPress Employee & Volunteer Time Clock Plugin / 1.3.2
Time Clock – A WordPress Employee & Volunteer Time Clock Plugin v1.3.2
trunk 1.0 1.0.1 1.1 1.1.1 1.1.2 1.2 1.2.1 1.2.2 1.2.3 1.3 1.3.1 1.3.2
time-clock / timeclock.php

timeclock.php in Time Clock – A WordPress Employee & Volunteer Time Clock Plugin 1.3.2, at timeclock.php

159 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 Plugin Name: Time Clock
5 Description: An employee and volunteer time clock plugin for WordPress
6 Author: Scott Paterson
7 Author URI: https://wpplugin.org
8 Version: 1.3.2
9 Text Domain: time-clock
10 Domain Path: /languages/
11 Plugin URI: https://wpplugin.org/downloads/time-clock-pro/
12 */
13
14
15 /* Copyright (c) 2018-2026 Scott Paterson
16
17 Employee Timeclock is free software; you can redistribute it and/or modify
18 it under the terms of the GNU General Public License as published by
19 the Free Software Foundation; either version 2 of the License, or
20 (at your option) any later version.
21
22 Time Clock is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 GNU General Public License for more details.
26
27 You should have received a copy of the GNU General Public License
28 along with this program; if not, write to the Free Software
29 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 */
31
32 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
33
34
35 // define common variables
36
37 if (!defined('ETIMECLOCKWP_PLUGIN_PATH')) {
38 define('ETIMECLOCKWP_PLUGIN_PATH', plugin_dir_path(__FILE__));
39 }
40 if (!defined('ETIMECLOCKWP_PLUGIN_BASENAME')) {
41 define('ETIMECLOCKWP_PLUGIN_BASENAME', plugin_basename(__FILE__));
42 }
43 if (!defined('ETIMECLOCKWP_SITE_URL')) {
44 define('ETIMECLOCKWP_SITE_URL', get_site_url());
45 }
46 if (!defined('ETIMECLOCKWP_NAME')) {
47 define('ETIMECLOCKWP_NAME', 'Time Clock');
48 }
49 if (!defined('ETIMECLOCKWP_VERSION')) {
50 define('ETIMECLOCKWP_VERSION', '1.3.2');
51 }
52 if (!defined('ETIMECLOCKWP_SETTINGS_PAGE')) {
53 define('ETIMECLOCKWP_SETTINGS_PAGE', 'etimeclockwp_settings_page');
54 }
55 if (!defined('ETIMECLOCKWP_PLUGIN_FILE')) {
56 define('ETIMECLOCKWP_PLUGIN_FILE', __FILE__);
57 }
58
59 // languages
60 load_plugin_textdomain('time-clock', false, dirname(plugin_basename(__FILE__)) . '/languages');
61
62 // wp version
63 global $wp_version;
64
65 // empty function used by free version to check if pro version is installed
66 function etimeclockwp_free() {
67 }
68
69 // check if pro version is attempting to be activated - if so, then deactive the free version
70 if (function_exists('etimeclockwp_pro')) {
71
72 deactivate_plugins('time-clock-pro/timeclock.php');
73
74 } else {
75
76 // check plugin requirements
77 if ((version_compare(PHP_VERSION, '5.6', '<')) || (version_compare($wp_version, '4.0', '<'))) {
78
79 // notices
80 add_action( 'admin_notices', create_function( '', "echo '<div class=\"error\"><p>". __('Employee Time Clock requires PHP 5.6+ and WordPress 4.0+ to function properly. Your current configuration does not meet one or more of these requirements.', 'time-clock'). "</p></div>';" ) );
81
82 add_action( 'admin_notices', create_function( '', "echo '<div class=\"error\"><p>".__('Employee Time Clock has been auto-deactivated.', 'time-clock') ."</p></div>';" ) );
83
84 // deactivate plugin
85 function etimeclockwp_deactivate_self() {
86 deactivate_plugins(plugin_basename( __FILE__ ));
87 }
88 add_action('admin_init','etimeclockwp_deactivate_self');
89
90 // remove plugin activated notice
91 if (isset($_GET['activate'])) {
92 unset($_GET['activate']);
93 }
94
95 return;
96
97 } else {
98
99 // activate hook
100 function etimeclockwp_activation() {
101 global $wp_rewrite;
102
103 // activate includes
104 include_once ('includes/admin/post_types.php');
105
106 // register post types and taxonomies
107 etimeclockwp_register_post_type();
108
109 // save time that plugin was installed
110 add_option( 'etimeclockwp_install_date', date('Y-m-d G:i:s'), '', 'yes');
111 }
112
113 // deactivate hook
114 function etimeclockwp_deactivation() {
115 delete_option("etimeclockwp_firstrun");
116 }
117
118 // uninstall hook
119 function etimeclockwp_uninstall() {
120
121 // remove all plugin data if option is enabled
122 if (etimeclockwp_get_option('uninstall') == "1") {
123 etimeclockwp_uninstaller();
124 }
125
126 }
127
128 // register hooks
129 register_activation_hook(__FILE__,'etimeclockwp_activation');
130 register_deactivation_hook(__FILE__, 'etimeclockwp_deactivation');
131 register_uninstall_hook(__FILE__,'etimeclockwp_uninstall');
132
133
134 // public includes
135 include_once ('includes/admin/post_types.php');
136 include_once ('includes/settings/settings_api.php');
137 include_once ('includes/enqueue.php');
138 include_once ('includes/functions.php');
139 include_once ('includes/actions.php');
140 include_once ('includes/shortcodes.php');
141
142 // get settings
143 $etimeclockwp_options = etimeclockwp_get_options();
144
145 // admin includes
146 if (is_admin()) {
147 include_once ('includes/admin/menu.php');
148 include_once ('includes/admin/activity.php');
149 include_once ('includes/admin/users.php');
150 include_once ('includes/admin/menu.php');
151 include_once ('includes/admin/extensions.php');
152 include_once ('includes/admin/settings/settings_page.php');
153 include_once ('includes/admin/settings/settings_dashboard_items.php');
154 include_once ('includes/admin/ajax_functions_admin.php');
155 include_once ('includes/admin/deactivate_survey.php');
156 include_once ('includes/admin/uninstall.php');
157 }
158 }
159 }