Changeset 3017163
- Timestamp:
- 01/03/2024 08:04:45 PM (2 years ago)
- Location:
- time-tracker/trunk
- Files:
-
- 6 edited
-
admin/function-tt-admin-notice.php (modified) (2 diffs)
-
inc/class-time-tracker-activator.php (modified) (19 diffs)
-
inc/class-time-tracker-delete.php (modified) (16 diffs)
-
inc/class-tt-hours-worked-month-summary.php (modified) (11 diffs)
-
readme.txt (modified) (2 diffs)
-
time-tracker.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
time-tracker/trunk/admin/function-tt-admin-notice.php
r3006195 r3017163 6 6 * 7 7 * @since 2.4 8 * @since 3.0.12 fix fatal activation error from function looking for option before it was created 8 9 * 9 10 */ … … 160 161 } 161 162 162 tt_add_new_admin_notice_timer('tt_feedback_request', new \DateTime(date_format(get_option('time_tracker_install_time'), 'Y-m-d H:i:s') . " + 1 month")); 163 if (! get_option('time_tracker_install_time')) { 164 $dt_notice = new \DateTime(date_format(new \DateTime(), 'Y-m-d H:i:s') . " + 1 month"); 165 } else { 166 $dt_notice = new \DateTime(date_format(get_option('time_tracker_install_time'), 'Y-m-d H:i:s') . " + 1 month"); 167 } 168 169 tt_add_new_admin_notice_timer('tt_feedback_request', $dt_notice); 163 170 tt_add_new_admin_notice_timer('tt_beta_tester_search', new \DateTime()); 164 171 -
time-tracker/trunk/inc/class-time-tracker-activator.php
r3006195 r3017163 5 5 * Initial activation of Time Tracker Plugin 6 6 * 7 * @since 1.0 7 * @since 1.0.0 8 8 * 9 9 */ … … 15 15 * Check if class exists 16 16 * 17 * @since 1.0.0 17 18 */ 18 19 if ( ! class_exists('Time_Tracker_Activator') ) { … … 22 23 * Class 23 24 * 25 * @since 1.0.0 24 26 */ 25 27 class Time_Tracker_Activator { … … 28 30 private static $default_task = null; 29 31 32 /** 33 * Activate plugin 34 * 35 * @since 1.0.0 36 * @since 3.0.12 removed window.alert and die functions as they were causing fatal activation error, replaced with wp_die alert 37 */ 30 38 public static function activate() { 31 39 self::define_plugin_variables(); 32 40 if (self::confirm_form_dependency_active() == false) { 33 ?> 34 <script type="text/javascript"> 35 window.alert('Time Tracker requires Contact Form 7 plugin to work properly. Please install the Contact Form 7 plugin before activating Time Tracker.'); 36 </script> 37 <?php 38 die('Please install the Contact Form 7 plugin before activating Time Tracker.'); 39 return; 41 wp_die("TIME TRACKER PLUGIN NOT ACTIVATED<br/><br/>Time Tracker requires either Contact Form 7 or WP Forms plugin be installed and activated. Please activate the Contact Form 7 or WP Forms plugin and try again.<br/><br/>Return to the <a href='" . esc_url( admin_url( "plugins.php" ) ) . "'>plugins page</a>."); 40 42 } 41 43 if (self::check_is_block_theme()) { 42 ?> 43 <script type="text/javascript"> 44 window.alert('Time Tracker is not yet configured to work with block themes. Please check back for a revision soon.'); 45 </script> 46 <?php 47 die('Time Tracker is not yet configured to work with block themes.'); 48 return; 44 wp_die("TIME TRACKER PLUGIN NOT ACTIVATED<br/><br/>Time Tracker is not yet configured to work with block themes. Please check back for a revision soon.<br/><br/>Return to the <a href='" . esc_url( admin_url( "plugins.php" ) ) . "'>plugins page</a>."); 49 45 } 50 46 self::setup(); … … 53 49 54 50 /** 55 * Confirm form dependency active 56 * @rev 3.0.10 added 57 * 58 */ 51 * Confirm form dependency active 52 * 53 * @since 3.0.10 54 * 55 * @return boolean True if Contact Form 7 or WPForms is installed and active, false if neither form dependency found. 56 */ 59 57 private static function confirm_form_dependency_active() { 60 58 if (TT_PLUGIN_FORM_TYPE == "CF7") { … … 70 68 /** 71 69 * Check for block theme 72 * @rev 3.0.10 - header/footer not yet configured for block theme and will throw error 70 * 71 * @since 3.0.10 Check for users using block theme. Time Tracker template not yet working with block theme and throw error about header/footer not yet configured. 73 72 * 73 * @return boolean True if user is using block theme, false if they are not. 74 74 */ 75 75 private static function check_is_block_theme() { … … 86 86 * Definitions 87 87 * 88 * @since 1.0.0 88 89 */ 89 90 private static function define_plugin_variables() { … … 92 93 93 94 95 /** 96 * Setup Time Tracker plugin 97 * 98 * @since 1.0.0 99 */ 94 100 private static function setup() { 95 101 self::log_plugin_installation(); … … 110 116 111 117 /** 112 * Log Install Time113 *114 * @rev 3.0.11 moved from class-time-tracker.php115 **/118 * Log Install Time 119 * 120 * @since 3.0.11 Moved from class-time-tracker.php. 121 */ 116 122 private static function log_plugin_installation() { 117 123 if (! get_option('time_tracker_install_time')) { … … 123 129 /** 124 130 * Check Plugin Version 125 *126 * @rev3.0.11 moved from class-time-tracker.php127 **/131 * 132 * @since 3.0.11 moved from class-time-tracker.php 133 */ 128 134 private static function check_plugin_version() { 129 135 $installed_version = get_option('time_tracker_version'); … … 142 148 143 149 150 /** 151 * Set initial database options 152 * 153 * @since x.x.x 154 */ 144 155 private static function set_initial_database_options() { 145 156 $now = new \DateTime; … … 193 204 194 205 206 /** 207 * Add default client to databsae 208 * 209 * @since x.x.x 210 */ 195 211 private static function add_default_client() { 196 212 self::get_default_client(); … … 202 218 } 203 219 220 /** 221 * Get default client from database 222 * 223 * @since x.x.x 224 */ 204 225 private static function get_default_client() { 205 226 $client_lookup = self::lookup_record("SELECT ClientID FROM tt_client WHERE Company='Undefined'"); … … 219 240 } 220 241 242 /** 243 * Attempt to add default client 244 * 245 * @since x.x.x 246 */ 221 247 private static function try_to_add_default_client() { 222 248 $rst = self::insert_record('tt_client', array('Company'=>'Undefined', 'Billable'=>1, 'Source'=>'Default Client'), array('%s', '%d', '%s')); … … 227 253 228 254 255 /** 256 * Add default task 257 * 258 * @since x.x.x 259 */ 229 260 private static function add_default_task() { 230 261 self::get_default_task(); … … 236 267 } 237 268 269 /** 270 * Get default task from database 271 * 272 * @since x.x.x 273 */ 238 274 private static function get_default_task() { 239 275 $task_lookup = self::lookup_record("SELECT TaskID FROM tt_task WHERE TDescription='Undefined'"); … … 253 289 } 254 290 291 292 /** 293 * Attempt to add default task to database 294 * 295 * @since x.x.x 296 */ 255 297 private static function try_to_add_default_task() { 256 298 $rst = self::insert_record('tt_task', array('TDescription'=>'Undefined', 'ClientID'=> self::$default_client, 'TNotes'=>'Default Task'), array('%s', '%d', '%s')); … … 262 304 } 263 305 306 307 /** 308 * Insert record into database 309 * TODO: Move this function outside this class as a general plugin function 310 * 311 * @since x.x.x 312 */ 264 313 private static function insert_record($tbl, $flds, $frmts) { 265 314 global $wpdb; … … 269 318 } 270 319 320 321 /** 322 * Lookup record from database 323 * TODO: Move this function outside this class as a general plugin function 324 * 325 * @since x.x.x 326 */ 271 327 private static function lookup_record($sql) { 272 328 global $wpdb; -
time-tracker/trunk/inc/class-time-tracker-delete.php
r2804852 r3017163 5 5 * Deactivation of Time Tracker Plugin 6 6 * 7 * @since 1.0 7 * @since 1.0.0 8 8 * 9 9 */ … … 17 17 * If class doesn't exist already 18 18 * 19 * @since 1.0.0 19 20 */ 20 21 if ( ! class_exists('Time_Tracker_Deletor') ) { … … 23 24 * Class 24 25 * 26 * @since 1.0.0 25 27 */ 26 28 class Time_Tracker_Deletor { … … 29 31 * Delete Main Function 30 32 * 33 * @since 1.0.0 31 34 */ 32 35 public static function delete_all() { … … 42 45 * Warn user 43 46 * 47 * @since 1.0.0 44 48 */ 45 49 public static function send_deletion_warning() { … … 52 56 * Definitions and Dependencies 53 57 * 58 * @since 1.0.0 59 * @since 3.0.12 include form subclass dependency to fix fatal deletion error 54 60 */ 55 61 public static function define_dependents() { … … 57 63 require_once 'class-time-tracker-activator-pages.php'; 58 64 require_once 'class-time-tracker-activator-forms.php'; 65 require_once TT_PLUGIN_FORM_TYPE . '/class-time-tracker-activator-forms-' . strtolower(TT_PLUGIN_FORM_TYPE) . '.php'; 59 66 require_once __DIR__ . '/../admin/function-tt-export-tables.php'; 60 67 } … … 62 69 63 70 /** 64 * Backup before deleting...just in case 65 * 71 * Backup before deleting...just in case. 72 * 73 * @since 1.0.0 66 74 */ 67 75 public static function backup_everything() { … … 71 79 72 80 /** 73 * Delete Tables - User Data - Only (From button on admin screen) 74 * 81 * Delete tables (ie: user data). From button on admin screen. 82 * 83 * @since 1.0.0 75 84 */ 76 85 public static function delete_tables_only() { … … 82 91 83 92 /** 84 * Delete Tables 85 * 93 * Delete all tables. 94 * 95 * @since 1.0.0 86 96 */ 87 97 public static function delete_tables() { … … 103 113 104 114 /** 105 * Remove Foreign Keys in Preparation for Deleting Tables 106 * 115 * Remove Foreign Keys in preparation for deleting tables. 116 * 117 * @since 1.0.0 107 118 */ 108 119 public static function remove_foreign_keys_from_tables() { … … 132 143 133 144 /** 134 * Delete Pages 135 * 145 * Delete all pages. 146 * 147 * @since 1.0.0 136 148 */ 137 149 public static function delete_pages() { … … 145 157 146 158 /** 147 * Delete Page 148 * 159 * Delete one page. 160 * 161 * @since 1.0.0 162 * 163 * @param string $pagename Friendly name of page to be deleted. 164 * 165 * @return int The Wordpress post ID of the page deleted, or 0 on error. 149 166 */ 150 167 private static function delete_tt_subpage($pagename) { … … 157 174 158 175 /** 159 * Delete Main Page 160 * 176 * Delete main Time Tracker page. 177 * 178 * @since 1.0.0 179 * 180 * @return int The post ID of the main homepage of the Time Tracker plugin, or 0 on error. 161 181 */ 162 182 private static function delete_tt_main_page() { … … 169 189 170 190 /** 171 * Delete Forms 172 * 191 * Delete all forms. 192 * 193 * @since 1.0.0 173 194 */ 174 195 public static function delete_forms() { … … 185 206 186 207 /** 187 * Delete Form 188 * 208 * Delete one form. 209 * 210 * @since 1.0.0 211 * 212 * @param int $post_id The Wordpress post ID of the form to be deleted. 213 * 214 * @return int The post ID of the form deleted, or 0 on error. 189 215 */ 190 216 private static function delete_form($post_id) { -
time-tracker/trunk/inc/class-tt-hours-worked-month-summary.php
r3006195 r3017163 5 5 * Takes the data from the hours worked class (query) and summarizes the current month's data for display 6 6 * 7 * @since 1.0 7 * @since 1.0.0 8 * @since 3.0.12 added group by today and value estimates for today and current work week 8 9 * 9 10 */ … … 17 18 * If class doesn't already exist 18 19 * 20 * @since x.x.x 19 21 */ 20 22 if ( !class_exists( 'Class_Hours_Worked_Month_Summary' ) ) { … … 24 26 * If class doesn't already exist 25 27 * 28 * @since x.x.x 26 29 */ 27 30 class Class_Hours_Worked_Month_Summary extends Class_Hours_Worked_Detail … … 32 35 * Constructor 33 36 * 37 * @since x.x.x 34 38 */ 35 39 public function __construct() { … … 42 46 * Reorganize data - Group by Month, then Week, then Bill To 43 47 * 48 * @since x.x.x 49 * @since 3.0.12 add group by today 50 * 51 * @return array Array of hours worked, grouped by month-week-bill to. 44 52 */ 45 53 private function groupDataByMonthWeekAndBillTo() { … … 52 60 $workweek = sanitize_text_field($item['WorkWeek']); 53 61 $thisweek = sanitize_text_field($item['ThisWeek']); 62 $workday = new \DateTime(sanitize_text_field($item['StartTime'])); 54 63 $billto = sanitize_text_field($item['BillTo']); 55 64 … … 66 75 } 67 76 77 if (date_format($workday, "m/d/y") == date("m/d/y")) { 78 $grouped_time['Today'][$billto][] = $item; 79 } 68 80 if ($workweek == $thisweek) { 69 81 $grouped_time['This Week'][$billto][] = $item; … … 83 95 * Calculate running totals by Month, then Week, then Bill To 84 96 * 97 * @since x.x.x 98 * 99 * @return array Time totaled by month-week-bill to. 85 100 */ 86 101 private function totalDataByMonthWeekAndBillTo() { … … 169 184 * Summarize all Bill To Names included 170 185 * 186 * @since x.x.x 187 * 188 * @return array List of bill-to names. 171 189 */ 172 190 private function listBillToNames($dataArray) { … … 192 210 * Create HTML display for front end display 193 211 * 212 * @since x.x.x 213 * @since 3.0.12 include today and current week value estimates in current month dashboard table 214 * 215 * @return string Html table summarizing data. 194 216 */ 195 217 public function createHTMLTable() { … … 276 298 $table .= "</tr>"; 277 299 300 //row - today value estimate 301 $curr_sign = tt_get_currency_type(); 302 $table .= "<tr><td class=\"tt-align-center tt-border-top-divider\">" . "Today's " . $curr_sign . " Estimate</td>"; 303 foreach ($bill_to_names as $bill_to_name) { 304 if ( (empty($time_summary)) or (!array_key_exists('Today', $time_summary)) ) { 305 $table .= "<td class=\"tt-align-right tt-border-top-divider\">N/A</td>"; 306 } elseif (array_key_exists($bill_to_name, $time_summary['Today']) && ($time_summary['Today'][$bill_to_name]['Billable'] == 1)) { 307 $table .= "<td class=\"tt-align-right tt-border-top-divider\">" . $curr_sign . " " . number_format($time_summary['Today'][$bill_to_name]['PendingValue'] + $time_summary['Today'][$bill_to_name]['ValueInvoiced'], 0, '.', ',') . "</td>"; 308 } else { 309 $table .= "<td class=\"tt-align-right tt-border-top-divider\">N/A</td>"; 310 } 311 } 312 $table .= "</tr>"; 313 314 315 //row - current week value estimate 316 $curr_sign = tt_get_currency_type(); 317 $table .= "<tr><td class=\"tt-align-center\">" . "Current Week's " . $curr_sign . " Estimate</td>"; 318 foreach ($bill_to_names as $bill_to_name) { 319 if ( (empty($time_summary)) or (!array_key_exists('This Week', $time_summary)) ) { 320 $table .= "<td class=\"tt-align-right\">N/A</td>"; 321 } elseif (array_key_exists($bill_to_name, $time_summary['This Week']) && ($time_summary['This Week'][$bill_to_name]['Billable'] == 1)) { 322 $table .= "<td class=\"tt-align-right\">" . $curr_sign . " " . number_format($time_summary['This Week'][$bill_to_name]['PendingValue'] + $time_summary['This Week'][$bill_to_name]['ValueInvoiced'], 0, '.', ',') . "</td>"; 323 } else { 324 $table .= "<td class=\"tt-align-right\">N/A</td>"; 325 } 326 } 327 $table .= "</tr>"; 328 329 278 330 //row - pending value estimate 279 331 $curr_sign = tt_get_currency_type(); -
time-tracker/trunk/readme.txt
r3006200 r3017163 4 4 Tags: time tracker, time management, project management, freelancer tools, billing, to-do, to do, to do list, list, task, cf7 extension, contact form 7 5 5 Requires at least: 5.3 6 Tested up to: 6. 3.16 Tested up to: 6.4.2 7 7 Requires PHP: 7.0 8 Stable tag: 3.0.1 18 Stable tag: 3.0.12 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 103 103 104 104 == Changelog == 105 106 = 3.0.12 = 107 Fix: Fix fatal activation error related to admin notice looking for option before it was set 108 Fix: Include form subclass dependency in deletor class to fix fatal deletion error 109 Fix: Replaced obsolete? functions causing fatal activation error 110 105 111 = 3.0.11 = 106 Improvement: Moved plugin update functions to activator class 107 112 Improvement: Modified installation / activation functions to streamline and avoid potential problems 108 113 109 114 = 3.0.10 = -
time-tracker/trunk/time-tracker.php
r3006200 r3017163 12 12 * Plugin URI: https://www.logicallytech.com/services/wordpress-plugins/time-tracker/ 13 13 * Description: A task and time tracking program. Perfect for freelancers or indivdiuals keeping track of to do lists and time worked and billed to clients. 14 * Version: 3.0.1 114 * Version: 3.0.12 15 15 * Requires at least: 5.3 16 16 * Requires PHP: 7.0 … … 40 40 * Use SemVer - https://semver.org 41 41 */ 42 define('TIME_TRACKER_VERSION', '3.0.1 1');42 define('TIME_TRACKER_VERSION', '3.0.12'); 43 43 define('TIME_TRACKER_PLUGIN_BASENAME', plugin_basename(__FILE__)); 44 44
Note: See TracChangeset
for help on using the changeset viewer.