Plugin Directory

Changeset 3017163


Ignore:
Timestamp:
01/03/2024 08:04:45 PM (2 years ago)
Author:
GermanPearls
Message:

ver 3.0.12

Location:
time-tracker/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • time-tracker/trunk/admin/function-tt-admin-notice.php

    r3006195 r3017163  
    66 *
    77 * @since 2.4
     8 * @since 3.0.12 fix fatal activation error from function looking for option before it was created
    89 *
    910 */
     
    160161}
    161162
    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"));
     163if (! 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
     169tt_add_new_admin_notice_timer('tt_feedback_request', $dt_notice);
    163170tt_add_new_admin_notice_timer('tt_beta_tester_search', new \DateTime());
    164171
  • time-tracker/trunk/inc/class-time-tracker-activator.php

    r3006195 r3017163  
    55 * Initial activation of Time Tracker Plugin
    66 *
    7  * @since 1.0
     7 * @since 1.0.0
    88 *
    99 */
     
    1515 * Check if class exists
    1616 *
     17 * @since 1.0.0
    1718 */
    1819if ( ! class_exists('Time_Tracker_Activator') ) {
     
    2223     * Class
    2324     *
     25     * @since 1.0.0
    2426     */
    2527    class Time_Tracker_Activator {
     
    2830        private static $default_task = null;
    2931
     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         */
    3038        public static function activate() {
    3139            self::define_plugin_variables();
    3240            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>.");
    4042            }
    4143            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>.");
    4945            }           
    5046            self::setup();                                                                         
     
    5349
    5450        /**
    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         */
    5957        private static function confirm_form_dependency_active() {
    6058            if (TT_PLUGIN_FORM_TYPE == "CF7") {
     
    7068        /**
    7169        * 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.
    7372        *
     73        * @return boolean True if user is using block theme, false if they are not.
    7474        */
    7575        private static function check_is_block_theme() {
     
    8686         * Definitions
    8787         *
     88         * @since 1.0.0
    8889         */
    8990        private static function define_plugin_variables() {
     
    9293
    9394
     95        /**
     96         * Setup Time Tracker plugin
     97         *
     98         * @since 1.0.0
     99         */
    94100        private static function setup() {
    95101            self::log_plugin_installation();
     
    110116
    111117        /**
    112         * Log Install Time
    113         *
    114         * @rev 3.0.11 moved from class-time-tracker.php
    115         **/
     118         * Log Install Time
     119         *
     120         * @since 3.0.11 Moved from class-time-tracker.php.
     121         */
    116122        private static function log_plugin_installation() {
    117123            if (! get_option('time_tracker_install_time')) {
     
    123129        /**
    124130         * Check Plugin Version
    125         *
    126         * @rev 3.0.11 moved from class-time-tracker.php
    127         **/ 
     131         *
     132         * @since 3.0.11 moved from class-time-tracker.php
     133         */ 
    128134        private static function check_plugin_version() {
    129135            $installed_version = get_option('time_tracker_version');
     
    142148       
    143149       
     150        /**
     151         * Set initial database options
     152         *
     153         * @since x.x.x
     154         */
    144155        private static function set_initial_database_options() {
    145156            $now = new \DateTime;
     
    193204       
    194205
     206        /**
     207         * Add default client to databsae
     208         *
     209         * @since x.x.x
     210         */
    195211        private static function add_default_client() {
    196212            self::get_default_client();
     
    202218        }
    203219
     220        /**
     221         * Get default client from database
     222         *
     223         * @since x.x.x
     224         */
    204225        private static function get_default_client() {
    205226            $client_lookup = self::lookup_record("SELECT ClientID FROM tt_client WHERE Company='Undefined'");
     
    219240        }
    220241
     242        /**
     243         * Attempt to add default client
     244         *
     245         * @since x.x.x
     246         */
    221247        private static function try_to_add_default_client() {
    222248            $rst = self::insert_record('tt_client', array('Company'=>'Undefined', 'Billable'=>1, 'Source'=>'Default Client'), array('%s', '%d', '%s'));
     
    227253
    228254
     255        /**
     256         * Add default task
     257         *
     258         * @since x.x.x
     259         */
    229260        private static function add_default_task() {
    230261            self::get_default_task();
     
    236267        }
    237268       
     269        /**
     270         * Get default task from database
     271         *
     272         * @since x.x.x
     273         */
    238274        private static function get_default_task() {
    239275            $task_lookup = self::lookup_record("SELECT TaskID FROM tt_task WHERE TDescription='Undefined'");
     
    253289        }
    254290       
     291
     292        /**
     293         * Attempt to add default task to database
     294         *
     295         * @since x.x.x
     296         */
    255297        private static function try_to_add_default_task() {
    256298            $rst = self::insert_record('tt_task', array('TDescription'=>'Undefined', 'ClientID'=> self::$default_client, 'TNotes'=>'Default Task'), array('%s', '%d', '%s'));
     
    262304        }
    263305       
     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         */
    264313        private static function insert_record($tbl, $flds, $frmts) {
    265314            global $wpdb;
     
    269318        }
    270319
     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         */
    271327        private static function lookup_record($sql) {
    272328            global $wpdb;
  • time-tracker/trunk/inc/class-time-tracker-delete.php

    r2804852 r3017163  
    55 * Deactivation of Time Tracker Plugin
    66 *
    7  * @since 1.0
     7 * @since 1.0.0
    88 *
    99 */
     
    1717 * If class doesn't exist already
    1818 *
     19 * @since 1.0.0
    1920 */
    2021if ( ! class_exists('Time_Tracker_Deletor') ) {
     
    2324     * Class
    2425     *
     26     * @since 1.0.0
    2527     */
    2628    class Time_Tracker_Deletor {
     
    2931         * Delete Main Function
    3032         *
     33         * @since 1.0.0
    3134         */
    3235        public static function delete_all() {
     
    4245         * Warn user
    4346         *
     47         * @since 1.0.0
    4448         */
    4549        public static function send_deletion_warning() {
     
    5256         * Definitions and Dependencies
    5357         *
     58         * @since 1.0.0
     59         * @since 3.0.12 include form subclass dependency to fix fatal deletion error
    5460         */
    5561        public static function define_dependents() {
     
    5763            require_once 'class-time-tracker-activator-pages.php';
    5864            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';
    5966            require_once __DIR__ . '/../admin/function-tt-export-tables.php';
    6067        }
     
    6269
    6370        /**
    64          * Backup before deleting...just in case
    65          *
     71         * Backup before deleting...just in case.
     72         *
     73         * @since 1.0.0
    6674         */
    6775        public static function backup_everything() {
     
    7179
    7280        /**
    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
    7584         */
    7685        public static function delete_tables_only() {
     
    8291       
    8392        /**
    84          * Delete Tables
    85          *
     93         * Delete all tables.
     94         *
     95         * @since 1.0.0
    8696         */
    8797        public static function delete_tables() {
     
    103113
    104114        /**
    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
    107118         */
    108119        public static function remove_foreign_keys_from_tables() {
     
    132143       
    133144        /**
    134          * Delete Pages
    135          *
     145         * Delete all pages.
     146         *
     147         * @since 1.0.0
    136148         */
    137149        public static function delete_pages() {
     
    145157
    146158        /**
    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.
    149166         */
    150167        private static function delete_tt_subpage($pagename) {
     
    157174
    158175        /**
    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.
    161181         */
    162182        private static function delete_tt_main_page() {
     
    169189
    170190        /**
    171          * Delete Forms
    172          *
     191         * Delete all forms.
     192         *
     193         * @since 1.0.0
    173194         */
    174195        public static function delete_forms() {
     
    185206
    186207        /**
    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.
    189215         */
    190216        private static function delete_form($post_id) {
  • time-tracker/trunk/inc/class-tt-hours-worked-month-summary.php

    r3006195 r3017163  
    55 * Takes the data from the hours worked class (query) and summarizes the current month's data for display
    66 *
    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
    89 *
    910 */
     
    1718 * If class doesn't already exist
    1819 *
     20 * @since x.x.x
    1921 */
    2022if ( !class_exists( 'Class_Hours_Worked_Month_Summary' ) ) {
     
    2426     * If class doesn't already exist
    2527     *
     28     * @since x.x.x
    2629     */
    2730    class Class_Hours_Worked_Month_Summary extends Class_Hours_Worked_Detail
     
    3235         * Constructor
    3336         *
     37         * @since x.x.x
    3438         */
    3539        public function __construct() {
     
    4246         * Reorganize data - Group by Month, then Week, then Bill To
    4347         *
     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.
    4452         */       
    4553        private function groupDataByMonthWeekAndBillTo() {
     
    5260                    $workweek = sanitize_text_field($item['WorkWeek']);
    5361                    $thisweek = sanitize_text_field($item['ThisWeek']);
     62                    $workday = new \DateTime(sanitize_text_field($item['StartTime']));
    5463                    $billto = sanitize_text_field($item['BillTo']);
    5564
     
    6675                        }
    6776
     77                        if (date_format($workday, "m/d/y") == date("m/d/y")) {
     78                            $grouped_time['Today'][$billto][] = $item;
     79                        }
    6880                        if ($workweek == $thisweek) {
    6981                            $grouped_time['This Week'][$billto][] = $item;
     
    8395         * Calculate running totals by Month, then Week, then Bill To
    8496         *
     97         * @since x.x.x
     98         *
     99         * @return array Time totaled by month-week-bill to.
    85100         */
    86101        private function totalDataByMonthWeekAndBillTo() {
     
    169184         * Summarize all Bill To Names included
    170185         *
     186         * @since x.x.x
     187         *
     188         * @return array List of bill-to names.
    171189         */
    172190        private function listBillToNames($dataArray) {
     
    192210         * Create HTML display for front end display
    193211         *
     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.
    194216         */
    195217        public function createHTMLTable() {
     
    276298            $table .= "</tr>";
    277299           
     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
    278330            //row - pending value estimate
    279331            $curr_sign = tt_get_currency_type();
  • time-tracker/trunk/readme.txt

    r3006200 r3017163  
    44Tags: time tracker, time management, project management, freelancer tools, billing, to-do, to do, to do list, list, task, cf7 extension, contact form 7
    55Requires at least: 5.3
    6 Tested up to: 6.3.1
     6Tested up to: 6.4.2
    77Requires PHP: 7.0
    8 Stable tag: 3.0.11
     8Stable tag: 3.0.12
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    103103 
    104104== Changelog ==
     105
     106= 3.0.12 =
     107Fix: Fix fatal activation error related to admin notice looking for option before it was set
     108Fix: Include form subclass dependency in deletor class to fix fatal deletion error
     109Fix: Replaced obsolete? functions causing fatal activation error
     110
    105111= 3.0.11 =
    106 Improvement: Moved plugin update functions to activator class
    107 
     112Improvement: Modified installation / activation functions to streamline and avoid potential problems
    108113
    109114= 3.0.10 =
  • time-tracker/trunk/time-tracker.php

    r3006200 r3017163  
    1212 * Plugin URI:        https://www.logicallytech.com/services/wordpress-plugins/time-tracker/
    1313 * 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.11
     14 * Version:           3.0.12
    1515 * Requires at least: 5.3
    1616 * Requires PHP:      7.0
     
    4040 * Use SemVer - https://semver.org
    4141 */
    42 define('TIME_TRACKER_VERSION', '3.0.11');
     42define('TIME_TRACKER_VERSION', '3.0.12');
    4343define('TIME_TRACKER_PLUGIN_BASENAME', plugin_basename(__FILE__));
    4444
Note: See TracChangeset for help on using the changeset viewer.