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

155 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.2
9 Text Domain: etimeclockwp
10 Domain Path: /languages/
11 */
12
13
14 /* Copyright (c) 2018, 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.2');
50 }
51 if (!defined('ETIMECLOCKWP_SETTINGS_PAGE')) {
52 define('ETIMECLOCKWP_SETTINGS_PAGE', 'etimeclockwp_settings_page');
53 }
54
55 // languages
56 load_plugin_textdomain('etimeclockwp', false, ETIMECLOCKWP_PLUGIN_BASENAME . '/i18n/languages');
57
58 // wp version
59 global $wp_version;
60
61 // empty function used by free version to check if pro version is installed
62 function etimeclockwp_free() {
63 }
64
65 // check if pro version is attempting to be activated - if so, then deactive the free version
66 if (function_exists('etimeclockwp_pro')) {
67
68 deactivate_plugins('time-clock-pro/timeclock.php');
69
70 } else {
71
72 // check plugin requirements
73 if ((version_compare(PHP_VERSION, '5.6', '<')) || (version_compare($wp_version, '4.0', '<'))) {
74
75 // notices
76 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.', 'etimeclockwp'). "</p></div>';" ) );
77
78 add_action( 'admin_notices', create_function( '', "echo '<div class=\"error\"><p>".__('Employee Time Clock has been auto-deactivated.', 'etimeclockwp') ."</p></div>';" ) );
79
80 // deactivate plugin
81 function etimeclockwp_deactivate_self() {
82 deactivate_plugins(plugin_basename( __FILE__ ));
83 }
84 add_action('admin_init','etimeclockwp_deactivate_self');
85
86 // remove plugin activated notice
87 if (isset($_GET['activate'])) {
88 unset($_GET['activate']);
89 }
90
91 return;
92
93 } else {
94
95 // activate hook
96 function etimeclockwp_activation() {
97 global $wp_rewrite;
98
99 // activate includes
100 include_once ('includes/admin/post_types.php');
101
102 // register post types and taxonomies
103 etimeclockwp_register_post_type();
104
105 // save time that plugin was installed
106 add_option( 'etimeclockwp_install_date', date('Y-m-d G:i:s'), '', 'yes');
107 }
108
109 // deactivate hook
110 function etimeclockwp_deactivation() {
111 delete_option("etimeclockwp_firstrun");
112 }
113
114 // uninstall hook
115 function etimeclockwp_uninstall() {
116
117 // remove all plugin data if option is enabled
118 if (etimeclockwp_get_option('uninstall') == "1") {
119 etimeclockwp_uninstaller();
120 }
121
122 }
123
124 // register hooks
125 register_activation_hook(__FILE__,'etimeclockwp_activation');
126 register_deactivation_hook(__FILE__, 'etimeclockwp_deactivation');
127 register_uninstall_hook(__FILE__,'etimeclockwp_uninstall');
128
129
130 // public includes
131 include_once ('includes/admin/post_types.php');
132 include_once ('includes/settings/settings_api.php');
133 include_once ('includes/enqueue.php');
134 include_once ('includes/functions.php');
135 include_once ('includes/actions.php');
136 include_once ('includes/shortcodes.php');
137
138 // get settings
139 $etimeclockwp_options = etimeclockwp_get_options();
140
141 // admin includes
142 if (is_admin()) {
143 include_once ('includes/admin/menu.php');
144 include_once ('includes/admin/activity.php');
145 include_once ('includes/admin/users.php');
146 include_once ('includes/admin/menu.php');
147 include_once ('includes/admin/extensions.php');
148 include_once ('includes/admin/settings/settings_page.php');
149 include_once ('includes/admin/settings/settings_dashboard_items.php');
150 include_once ('includes/admin/ajax_functions_admin.php');
151 include_once ('includes/admin/deactivate_survey.php');
152 include_once ('includes/admin/uninstall.php');
153 }
154 }
155 }