Changeset 2965352
- Timestamp:
- 09/11/2023 01:13:46 PM (2 years ago)
- Location:
- time-tracker/trunk
- Files:
-
- 12 edited
-
admin/tt-admin-settings-callbacks.php (modified) (15 diffs)
-
inc/CF7/class-time-tracker-activator-forms-cf7.php (modified) (1 diff)
-
inc/class-time-tracker-activator-pages.php (modified) (3 diffs)
-
inc/class-time-tracker-activator.php (modified) (3 diffs)
-
inc/class-time-tracker-deactivator.php (modified) (2 diffs)
-
inc/class-time-tracker-updater.php (modified) (1 diff)
-
inc/class-tt-save-form-input.php (modified) (2 diffs)
-
inc/class-tt-task-list.php (modified) (1 diff)
-
inc/css/tt-css-buttons.php (modified) (2 diffs)
-
inc/function-tt-utilities.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
-
time-tracker.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
time-tracker/trunk/admin/tt-admin-settings-callbacks.php
r2957960 r2965352 34 34 function tt_categories_default_rate_callback() { 35 35 //get the value if it's already been saved 36 $ settings = get_option('time_tracker_categories');36 $dr = trim(sanitize_textarea_field(\Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_categories", "default_rate"))); 37 37 38 38 //display on menu page … … 40 40 <div class="tt-indent"> 41 41 <input type="text" id="tt-default-rate" name="time_tracker_categories[default_rate]" rows=1 cols=20 class="tt-options-form" form="tt-options" 42 <?php $dr = trim(sanitize_textarea_field($settings['default_rate']));42 <?php 43 43 if (isset($dr)) { 44 if ($dr != null ) {44 if ($dr != null && $dr != "") { 45 45 echo " value=" . intval($dr); 46 46 } … … 57 57 function tt_categories_default_currency_callback() { 58 58 //get the value if it's already been saved 59 $ settings = get_option('time_tracker_categories');59 $cs = trim(sanitize_textarea_field(\Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_categories", "currency_sign"))); 60 60 61 61 //display on menu page … … 63 63 <div class="tt-indent"> 64 64 <input type="text" id="tt-currency-sign" name="time_tracker_categories[currency_sign]" rows=1 cols=20 class="tt-options-form" form="tt-options" 65 <?php $cs = trim(sanitize_textarea_field($settings['currency_sign']));65 <?php 66 66 if (isset($cs)) { 67 if ($cs != null ) {67 if ($cs != null && $cs != "") { 68 68 echo " value=" . esc_html($cs); 69 69 } … … 80 80 */ 81 81 function tt_categories_task_status_callback() { 82 //get the value if it's already been saved to db 83 $setting = get_option('time_tracker_categories'); 84 85 //display on admin page 86 ?> 87 <div class="tt-indent"> 88 <textarea id="tt-task-status" name="time_tracker_categories[task_status]" rows="7" cols="30" class="tt-options-form" form="tt-options"><?php 89 $ts = trim(sanitize_textarea_field($setting['task_status'])); 90 if (isset( $ts ) && $ts <> "") { 91 echo esc_html($ts); 92 } else { 93 $str = 'New 82 //default values 83 $str = 'New 94 84 In Process 95 85 Waiting Client 96 86 Complete 97 87 Canceled'; 98 echo $str; 99 } 88 //get the value if it's already been saved to db 89 $ts = trim(sanitize_textarea_field(\Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_categories", "task_status"))); 90 if (isset( $ts )) { 91 if ($ts != "" && $ts != null) { 92 $str = esc_html($ts); 93 } 94 } 95 96 //display on admin page 97 ?> 98 <div class="tt-indent"> 99 <textarea id="tt-task-status" name="time_tracker_categories[task_status]" rows="7" cols="30" class="tt-options-form" form="tt-options"><?php 100 echo $str; 100 101 ?></textarea><span class="tt-options-form">List the statuses you'd like to use to keep track of your tasks.<br> 101 102 Examples: New, In Process, Waiting Client, Complete, Canceled<br> … … 113 114 function tt_categories_bill_to_names_callback() { 114 115 //get the value if it's already been entered 115 $setting = get_option('time_tracker_categories'); 116 $btn = trim(sanitize_textarea_field(\Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_categories", "bill_to_names"))); 117 $str = ""; 118 if (isset( $btn )) { 119 $str = esc_html($btn); 120 } 116 121 117 122 //display on menu page … … 119 124 <div class="tt-indent"> 120 125 <textarea id="tt-bill-to" name="time_tracker_categories[bill_to_names]" rows="5" cols="30" class="tt-options-form" form="tt-options"><?php 121 $btn = trim(sanitize_textarea_field($setting['bill_to_names'])); 122 if (isset( $btn )) { 123 echo esc_html($btn); 124 } else { 125 echo ''; 126 } 126 echo $str; 127 127 ?></textarea><span class="tt-options-form">Do you always bill directly to the client? Or do white-label services where you bill to a third party?<br> 128 128 Do you perform services under different business names?<br> … … 140 140 function tt_categories_work_categories_callback() { 141 141 //get the value if it's already been entered 142 $setting = get_option('time_tracker_categories'); 142 $wc = trim(sanitize_textarea_field(\Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_categories", "work_categories"))); 143 $str = ""; 144 if (isset( $wc )) { 145 $str = esc_html($wc); 146 } 143 147 144 148 //display on menu page … … 146 150 <div class="tt-indent"> 147 151 <textarea id="tt-categories" name="time_tracker_categories[work_categories]" rows="10" cols="30" class="tt-options-form" form="tt-options"><?php 148 $wc = trim(sanitize_textarea_field($setting['work_categories'])); 149 if (isset( $wc )) { 150 echo esc_html($wc); 151 } else { 152 echo ''; 153 } 152 echo $str; 154 153 ?></textarea><span class="tt-options-form">Time Tracker can help you keep track of different types of work.<br> 155 154 In this section, add the options you'd like to see for this field when entering a new project or task.<br> … … 167 166 function tt_categories_client_categories_callback() { 168 167 //get the value if it's already been entered 169 $setting = get_option('time_tracker_categories'); 168 $cc = trim(sanitize_textarea_field(\Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_categories", "client_categories"))); 169 $str = ""; 170 if (isset( $cc )) { 171 $str = esc_html($cc); 172 } 170 173 171 174 //display on menu page … … 173 176 <div class="tt-indent"> 174 177 <textarea id="tt-csource" name="time_tracker_categories[client_categories]" rows="10" cols="30" class="tt-options-form" form="tt-options"><?php 175 $cc = trim(sanitize_textarea_field($setting['client_categories'])); 176 if (isset( $cc )) { 177 echo esc_html($cc); 178 } else { 179 echo ''; 180 } 178 echo $str; 181 179 ?></textarea><span class="tt-options-form">Time Tracker will maintain information on each of your clients.<br> 182 180 When adding a new client you'll be asked to enter how they found you.<br> … … 194 192 function tt_categories_client_sub_categories_callback() { 195 193 //get the value if it's already been entered 196 $setting = get_option('time_tracker_categories'); 194 $csc = trim(sanitize_textarea_field(\Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_categories", "client_categories"))); 195 $str = ""; 196 if (isset( $csc )) { 197 $str = esc_html($csc); 198 } 197 199 198 200 //display on menu page … … 200 202 <div class="tt-indent"> 201 203 <textarea id="tt-client-sub-categories" name="time_tracker_categories[client_sub_categories]" rows="10" cols="30" class="tt-options-form" form="tt-options"><?php 202 $csc = sanitize_textarea_field($setting['client_sub_categories']); 203 if (isset( $csc )) { 204 echo esc_html($csc); 205 } else { 206 echo ''; 207 } 204 echo $str; 208 205 ?></textarea><span class="tt-options-form">You can also add a second level of information on how the client found you.<br> 209 206 In this section, add the options you'd like to see for this field, one per line.<br> … … 238 235 function tt_css_button_override_value() { 239 236 //get the value if it's already been entered 240 $styles = get_option('time_tracker_style'); 241 if (is_array($styles)) { 242 if (array_key_exists('css', $styles)) { 243 if (is_array($styles['css'])) { 244 if (array_key_exists('buttons', $styles['css'])) { 245 if (is_array($styles['css']['buttons'])) { 246 if (array_key_exists('override', $styles['css']['buttons'])) { 247 if (trim(sanitize_textarea_field($styles['css']['buttons']['override'])) == "on") { 248 return true; 249 } 237 $css = \Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_style", "css"); 238 if ($css != null) { 239 if (is_array($css)) { 240 if (array_key_exists('buttons', $css)) { 241 if (is_array($css['buttons'])) { 242 if (array_key_exists('override', $css['buttons'])) { 243 if (trim(sanitize_textarea_field($css['buttons']['override'])) == "on") { 244 return true; 250 245 } 251 246 } … … 260 255 function tt_css_option_callback($args) { 261 256 //get the value if it's already been entered 262 $optn = ''; 263 $styles = get_option('time_tracker_style'); 264 if (is_array($styles)) { 265 if (array_key_exists('css', $styles)) { 266 $optn = $styles['css']; 267 foreach ($args as $arg) { 268 if (is_array($optn)) { 269 if (array_key_exists($arg, $optn)) { 270 $optn = $optn[$arg]; 271 } 272 } else { 273 $optn = trim(sanitize_text_field($optn)); 257 $optn = ""; 258 $css = \Logically_Tech\Time_Tracker\Inc\tt_get_user_options("time_tracker_style", "css"); 259 if ($css != null) { 260 $optn = $css; 261 foreach ($args as $arg) { 262 if (is_array($optn)) { 263 if (array_key_exists($arg, $optn)) { 264 $optn = $optn[$arg]; 274 265 } 266 } else { 267 $optn = trim(sanitize_text_field($optn)); 275 268 } 276 269 } -
time-tracker/trunk/inc/CF7/class-time-tracker-activator-forms-cf7.php
r2957960 r2965352 229 229 */ 230 230 private static function get_task_status_options() { 231 $setting = get_option('time_tracker_categories'); 232 $task_status = $setting['task_status']; 233 if ($task_status <> "") { 231 $task_status = \Logically_Tech\Time_Tracker\Inc\tt_get_user_options('time_tracker_categories', 'task_status'); 232 if ($task_status != "" && $task_status != null) { 234 233 $arr = explode(chr(13), $task_status); 235 234 } else { -
time-tracker/trunk/inc/class-time-tracker-activator-pages.php
r2957960 r2965352 74 74 /** 75 75 * Check page exists, has correct status and matches current version 76 * rev 3.0.10 updated to delete any existing pages (in case multiple exist due to activation errors) and create new ones 76 77 * 77 78 */ 78 79 private static function check_page_exists_and_is_up_to_date($i) { 79 //query db for page if it exists 80 $page_exists = tt_get_page_id(self::get_page_details($i)['post_title']); 81 82 //if page doesn't exist 83 if (empty($page_exists) or $page_exists == null) { 84 $page_id = self::create_page(self::get_page_details($i)); 85 86 87 //page exists, make sure everything is correct 88 } else { 89 90 $page_id = $page_exists; 91 92 //pages are changed to draft on plugin deactivation 93 if (get_post_status($page_exists) == 'draft') { 94 self::update_page_status($page_id); 95 } 96 97 //check content matches current version 98 $installed_page = get_post($page_id); 99 $installed_page_content = $installed_page->post_content; 100 101 $updated_content = self::get_page_details($i)['post_content']; 102 //does the content match the current version 103 if ($installed_page_content != $updated_content) { 104 //update content of page in db 105 $updated_page = array( 106 'ID' => $page_id, 107 'post_content' => $updated_content 108 ); 109 wp_update_post($updated_page); 110 } 111 } 80 //delete any existing pages - check for multiple 81 $page_id = tt_get_page_id(self::get_page_details($i)['post_title']); 82 while ($page_id > 0){ 83 $result = wp_delete_post($page_id); 84 $page_id = tt_get_page_id(self::get_page_details($i)['post_title']); 85 log_tt_misc('page ' . self::get_page_details($i)['post_title'] . ', #' . $page_id . ' should have been deleted on plugin activation'); 86 $page_id = tt_get_page_id(self::get_page_details($i)['post_title']); 87 } 88 89 //create new page 90 $page_id = self::create_page(self::get_page_details($i)); 91 log_tt_misc(' page ' . self::get_page_details($i)['post_title'] . ' should have been created, now is #' . $page_id); 112 92 return $page_id; 113 93 } … … 126 106 /** 127 107 * Update Page Status 108 * @rev 3.0.10 no longer used - pages deleted on deactivation and recreated on activation 128 109 * 129 110 */ 130 111 private static function update_page_status($page_id) { 131 wp_update_post(array(112 add_action('init', wp_update_post(array( 132 113 'ID' => $page_id, 133 114 'post_status' => 'private' 134 )) ;115 )), 10, 1); 135 116 } 136 117 … … 170 151 * 171 152 */ 172 p rivatestatic function create_homepage_details_array() {153 public static function create_homepage_details_array() { 173 154 $details_all = array(); 174 155 //tt-home -
time-tracker/trunk/inc/class-time-tracker-activator.php
r2957960 r2965352 30 30 public static function activate() { 31 31 self::define_plugin_variables(); 32 if (TT_PLUGIN_FORM_TYPE == "CF7") { 33 self::setup(); 34 } elseif (TT_PLUGIN_FORM_TYPE == "WPF") { 35 self::setup(); 36 } else { 37 ?> 32 if (self::confirm_form_dependency_active() == false) { 33 ?> 38 34 <script type="text/javascript"> 39 35 window.alert('Time Tracker requires Contact Form 7 plugin to work properly. Please install the Contact Form 7 plugin before activating Time Tracker.'); … … 41 37 <?php 42 38 die('Please install the Contact Form 7 plugin before activating Time Tracker.'); 43 } 44 } 39 return; 40 } 41 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; 49 } 50 self::setup(); 51 } 52 53 54 /** 55 * Confirm form dependency active 56 * @rev 3.0.10 added 57 * 58 */ 59 private static function confirm_form_dependency_active() { 60 if (TT_PLUGIN_FORM_TYPE == "CF7") { 61 return true; 62 } elseif (TT_PLUGIN_FORM_TYPE == "WPF") { 63 return true; 64 } else { 65 return false; 66 } 67 } 68 69 70 /** 71 * Check for block theme 72 * @rev 3.0.10 - header/footer not yet configured for block theme and will throw error 73 * 74 */ 75 private static function check_is_block_theme() { 76 if (function_exists('wp_is_block_theme')) { 77 if (wp_is_block_theme()) { 78 return true; 79 } 80 } 81 return false; 82 } 45 83 46 84 … … 81 119 add_option('time_tracker_categories', array('bill-to-names'=>'Client', 'work-categories'=>'Uncategorized', 'client-categories'=>'Uncategorized', 'client-sub-categories'=>'Uncategorized', 'default-client'=>print_r(self::$default_client), 'default_task'=>print_r(self::$default_task), 'default_rate'=>null)); 82 120 } else { 83 //updates84 121 $optns = get_option('time_tracker_categories'); 85 if ($optns['default_client'] == null and self::$default_client != null) { 86 $optns['default_client'] = self::$default_client; 87 } 88 if ($optns['default_task'] == null and self::$default_task != null) { 89 $optns['default_task'] = self::$default_client; 90 } 91 //added in 2.5.0 92 if (!array_key_exists('default_rate', $optns)) { 93 $optns['default_rate'] = null; 94 } 95 if (!array_key_exists('currency_sign', $optns)) { 96 $optns['currency_sign'] = '$'; 97 } 98 update_option('time_tracker_categories', $optns); 122 //if it is there but blank add defaults 123 if ($optns == null || $optns == "") { 124 add_option('time_tracker_categories', array('bill-to-names'=>'Client', 'work-categories'=>'Uncategorized', 'client-categories'=>'Uncategorized', 'client-sub-categories'=>'Uncategorized', 'default-client'=>print_r(self::$default_client), 'default_task'=>print_r(self::$default_task), 'default_rate'=>null)); 125 } else { 126 //add default client 127 if (array_key_exists("default_client", $optns)) { 128 if ($optns['default_client'] == null and self::$default_client != null) { 129 $optns['default_client'] = self::$default_client; 130 } 131 } else { 132 if (self::$default_client != null) { 133 $optns['default_client'] = self::$default_client; 134 } 135 } 136 //add default task 137 if (array_key_exists("default_task", $optns)) { 138 if ($optns['default_task'] == null and self::$default_task != null) { 139 $optns['default_task'] = self::$default_task; 140 } 141 } else { 142 if (self::$default_task != null) { 143 $optns['default_task'] = self::$default_task; 144 } 145 } 146 //added in 2.5.0 - add default rate 147 if (!array_key_exists('default_rate', $optns)) { 148 $optns['default_rate'] = null; 149 } 150 //add currency sign 151 if (!array_key_exists('currency_sign', $optns)) { 152 $optns['currency_sign'] = '$'; 153 } 154 update_option('time_tracker_categories', $optns); 155 } 99 156 } 100 157 } -
time-tracker/trunk/inc/class-time-tracker-deactivator.php
r2957960 r2965352 31 31 //self::send_deletion_warning(); WON'T NEED TO DO THIS, ONLY DURING DELETION 32 32 self::define_plugin_variables(); 33 //self::delete_tables(); DON'T REMOVE TABLES, ONLY DO THIS DURING PLUGIN DELETION ???33 //self::delete_tables(); DON'T REMOVE TABLES, ONLY DO THIS DURING PLUGIN DELETION 34 34 self::deactivate_crons(); 35 self::deactivate_pages(); 36 //self::delete_forms(); DON'T REMOVE FORMS, ONLY DO THIS DURING PLUGIN DELETION ??? 37 38 //WHAT NEEDS TO BE DONE HERE? 35 //self::deactivate_pages(); 36 self::delete_pages(); 37 //self::delete_forms(); DON'T REMOVE FORMS, ONLY DO THIS DURING PLUGIN DELETION 39 38 } 40 39 … … 78 77 79 78 /** 79 * Get Page List in Deletion Order 80 * 81 */ 82 public static function get_page_list_in_deletion_order() { 83 $tt_pages = Time_Tracker_Activator_Pages::create_subpage_details_array(1); 84 return array_reverse($tt_pages); 85 } 86 87 88 /** 89 * Delete pages 90 * 91 */ 92 public static function delete_pages() { 93 $tt_pages_delete_order = self::get_page_list_in_deletion_order(); 94 foreach ($tt_pages_delete_order as $tt_page) { 95 self::delete_page($tt_page['Title']); 96 } 97 $tt_homepage = Time_Tracker_Activator_Pages::create_homepage_details_array(); 98 self::delete_page($tt_homepage['Title']); 99 } 100 101 102 /** 103 * Delete Page 104 * 105 */ 106 private static function delete_page($pagename) { 107 $post_id = tt_get_page_id($pagename); 108 if ($post_id > 0) { 109 $result = wp_delete_post($post_id); 110 } 111 } 112 113 114 /** 80 115 * Deactivate pages 81 116 * 82 117 */ 83 118 public static function deactivate_pages() { 84 $tt_pages = Time_Tracker_Activator_Pages::create_subpage_details_array(1); 85 $tt_pages_delete_order = array_reverse($tt_pages); 86 /**$tt_pages = array( 87 'time-tracker', 88 'clients', 89 'new-client', 90 'new-project', 91 'new-recurring-task', 92 'new-task', 93 'new-time-entry', 94 'open-task-list', 95 'pending-time', 96 'project-list', 97 'task-detail', 98 'task-list', 99 'time-log' 100 );**/ 119 $tt_pages_delete_order = self::get_page_list_in_deletion_order(); 101 120 foreach ($tt_pages_delete_order as $tt_page) { 102 121 self::change_page_to_draft($tt_page['Slug']); 103 122 } 123 $tt_homepage = Time_Tracker_Activator_Pages::create_homepage_details_array(); 124 self::change_page_to_draft($tt_homepage['Slug']); 104 125 } 105 126 -
time-tracker/trunk/inc/class-time-tracker-updater.php
r2957960 r2965352 155 155 private function tt_update_forms($force_update = false) { 156 156 require_once(TT_PLUGIN_DIR_INC . 'class-time-tracker-activator-forms.php'); 157 require_once(TT_PLUGIN_DIR_INC . TT_PLUGIN_FORM_TYPE . '/class-time-tracker-activator-forms-' . strtolower(TT_PLUGIN_FORM_TYPE) . '.php'); 157 if (TT_PLUGIN_FORM_TYPE != null && TT_PLUGIN_FORM_TYPE != "") { 158 require_once(TT_PLUGIN_DIR_INC . TT_PLUGIN_FORM_TYPE . '/class-time-tracker-activator-forms-' . strtolower(TT_PLUGIN_FORM_TYPE) . '.php'); 159 } else { 160 require_once(TT_PLUGIN_DIR_INC . "CF7" . '/class-time-tracker-activator-forms-' . strtolower(TT_PLUGIN_FORM_TYPE) . '.php'); 161 } 162 158 163 if ($force_update) { 159 164 $tt_forms = Time_Tracker_Activator_Forms::force_form_updates(); -
time-tracker/trunk/inc/class-tt-save-form-input.php
r2957960 r2965352 315 315 } else { 316 316 //use default client if one exists, if not just enter null 317 return array_key_exists('default_client', get_option('time_tracker_categories')) ? get_option('time_tracker_categories')['default_client'] : null;317 return tt_get_user_options("time_tracker_categories", "default_client"); 318 318 } 319 319 } … … 350 350 return $task_number_from_string; 351 351 } 352 return array_key_exists('default_task', get_option('time_tracker_categories')) ? get_option('time_tracker_categories')['default_task'] : null;352 return tt_get_user_options("time_tracker_categories", "default_task"); 353 353 } 354 354 -
time-tracker/trunk/inc/class-tt-task-list.php
r2957960 r2965352 215 215 */ 216 216 private function get_task_status_options() { 217 $setting = get_option('time_tracker_categories'); 218 $task_status = $setting['task_status']; 219 if ($task_status <> "") { 217 $task_status = tt_get_user_options("time_tracker_categories", "task_status"); 218 if ($task_status != "" && $task_status != null) { 220 219 return explode(chr(13), $task_status); 221 220 } else { -
time-tracker/trunk/inc/css/tt-css-buttons.php
r2957960 r2965352 9 9 **/ 10 10 11 use function Logically_Tech\Time_Tracker\Inc\tt_get_user_options; 12 11 13 /** defaults **/ 12 14 $button_background_color = "#01375d"; //dark blue … … 15 17 $button_hover_text_color = "#01375d"; //dark blue 16 18 17 $ settings = get_option('time_tracker_style');18 if ($settings) { 19 if (trim(sanitize_textarea_field($settings['css']['buttons']['override'])) == "on") { 20 //override with user settings 21 if (array_key_exists('css', $settings)) {22 if (array_key_exists('buttons', $settings['css'])) {23 if (array_key_exists('background', $settings['css']['buttons'])) {24 if (array_key_exists('normal', $settings['css']['buttons']['background'])) {25 $button_background_color = sanitize_text_field($settings['css']['buttons']['background']['normal']);26 }27 if (array_key_exists('hover', $settings['css']['buttons']['background'])) {28 $button_hover_background_color = sanitize_text_field($settings['css']['buttons']['background']['hover']);19 $override = false; 20 $css = tt_get_user_options("time_tracker_style", "css"); 21 22 if ($css) { 23 if ($css != null && $css != "") { 24 if (is_array($css)) { 25 if (array_key_exists("buttons", $css)) { 26 if (is_array($css["buttons"])) { 27 if (array_key_exists("override", $css["buttons"])) { 28 if (trim(sanitize_textarea_field($css["buttons"]["override"])) == "on") { 29 $override = true; 30 } 29 31 } 30 32 } 31 if (array_key_exists('text', $settings['css']['buttons'])) { 32 if (array_key_exists('normal', $settings['css']['buttons']['text'])) { 33 $button_text_color = sanitize_text_field($settings['css']['buttons']['text']['normal']); 33 } 34 } 35 } 36 if ($override) { 37 //override with user settings 38 if (is_array($css)) { 39 if (array_key_exists("buttons", $css)) { 40 if (is_array($css["buttons"])) { 41 //button backgrounds 42 if (array_key_exists("background", $css["buttons"])) { 43 if (is_array($css["buttons"]["background"])) { 44 if (array_key_exists("normal", $css["buttons"]["background"])) { 45 $button_background_color = sanitize_text_field($css['buttons']['background']['normal']); 46 } 47 if (array_key_exists('hover', $css['buttons']['background'])) { 48 $button_hover_background_color = sanitize_text_field($css['buttons']['background']['hover']); 49 } 50 } 34 51 } 35 if (array_key_exists('hover', $settings['css']['buttons']['text'])) { 36 $button_hover_text_color = sanitize_text_field($settings['css']['buttons']['text']['hover']); 37 } 38 } 52 //button text 53 if (array_key_exists('text', $css['buttons'])) { 54 if (array_key_exists('normal', $css['buttons']['text'])) { 55 $button_text_color = sanitize_text_field($css['buttons']['text']['normal']); 56 } 57 if (array_key_exists('hover', $css['buttons']['text'])) { 58 $button_hover_text_color = sanitize_text_field($css['buttons']['text']['hover']); 59 } 60 } 61 } 39 62 } 40 63 } -
time-tracker/trunk/inc/function-tt-utilities.php
r2963193 r2965352 293 293 //$pages = get_page_by_title($page_name, ARRAY_A); 294 294 //rev 3.0.8 get_page_by_title deprecated in WordPress 6.2 295 //get_posts only available after plugins loaded 296 //status must be specified or only published posts returned (not private) 297 //to search by title use title NOT post_title 295 298 $pages = get_posts( 296 299 array( 297 300 'post_type' => 'page', 298 'post_title' => $page_name 301 'post_status' => get_post_statuses(), 302 'title' => $page_name 299 303 ) 300 304 ); … … 308 312 } 309 313 } 310 311 314 return; 312 315 } … … 377 380 */ 378 381 function tt_get_currency_type() { 379 $ optns = get_option('time_tracker_categories');380 if ( array_key_exists('currency_sign', $optns)) {381 return esc_html($ optns['currency_sign']);382 } 383 return '';382 $curr = tt_get_user_options("time_tracker_categories", "currency_sign"); 383 if ($curr != null and $curr != "") { 384 return esc_html($curr); 385 } 386 return ""; 384 387 } 385 388 … … 390 393 */ 391 394 function tt_get_default_billing_rate() { 392 $optns = get_option('time_tracker_categories'); 393 if ($optns) { 394 if (array_key_exists('default_rate', $optns)) { 395 return intval($optns['default_rate']); 396 } 395 $rate = tt_get_user_options("time_tracker_categories", "default_rate"); 396 if ($rate != null && $rate != "" && is_numeric($rate)) { 397 return intval($rate); 397 398 } 398 399 return; … … 659 660 function tt_get_user_options($option_name, $sub_option_name) { 660 661 $optns = get_option($option_name); 661 if (array_key_exists($sub_option_name, $optns)) { 662 //var_dump(nl2br($optns[$sub_option_name])); 663 //var_dump(sanitize_text_field(nl2br($optns[$sub_option_name]))); 664 return $optns[$sub_option_name]; 665 } 666 return ""; 662 if ($optns) { 663 if (array_key_exists($sub_option_name, $optns)) { 664 //var_dump(nl2br($optns[$sub_option_name])); 665 //var_dump(sanitize_text_field(nl2br($optns[$sub_option_name]))); 666 return $optns[$sub_option_name]; 667 } 668 } 669 return; 667 670 } 668 671 -
time-tracker/trunk/readme.txt
r2964656 r2965352 6 6 Tested up to: 6.3.1 7 7 Requires PHP: 7.0 8 Stable tag: 3.0. 98 Stable tag: 3.0.10 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 104 104 == Changelog == 105 105 = 3.0.10 = 106 Fix: Fix error on activation due to missing options not yet created 106 Improvement: Delete TT pages on plugin deactivation / Create brand new pages on re-activation 107 Improvement: Changed method for getting user settings to avoid errors when missing or not yet created 108 Fix: Added notice and prevented plugin activation on block themes as block header/footer required and not yet established in code 109 Fix: Fix error related to deprecated wp function 107 110 108 111 = 3.0.9 = -
time-tracker/trunk/time-tracker.php
r2964656 r2965352 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. 914 * Version: 3.0.10 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. 9');42 define('TIME_TRACKER_VERSION', '3.0.10'); 43 43 define('TIME_TRACKER_PLUGIN_BASENAME', plugin_basename(__FILE__)); 44 44
Note: See TracChangeset
for help on using the changeset viewer.