PluginProbe
Time Clock – A WordPress Employee & Volunteer Time Clock Plugin / 1.3.1
Time Clock – A WordPress Employee & Volunteer Time Clock Plugin v1.3.1
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.1, at timeclock.php

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