| @@ -96,8 +96,9 @@ | ||
| 96 | 96 | users VARCHAR( 200 ) NULL DEFAULT '0', |
| 97 | 97 | date_created datetime, |
| 98 | 98 | task_auth_code LONGTEXT NULL DEFAULT NULL, |
| 99 | 99 | active int(11) DEFAULT 1, |
| 100 | + parent_task_id integer NOT NULL DEFAULT 0, | |
| 100 | 101 | PRIMARY KEY (id) |
| 101 | 102 | );"; |
| 102 | 103 | dbDelta( $sql ); |
| 103 | 104 | |
| @@ -139,8 +140,18 @@ | ||
| 139 | 140 | created_by integer, |
| 140 | 141 | PRIMARY KEY (id) |
| 141 | 142 | );"; |
| 142 | 143 | dbDelta( $sql ); |
| 144 | + $sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wppm_project_comment ( | |
| 145 | + id integer NOT NULL AUTO_INCREMENT, | |
| 146 | + proj_id integer, | |
| 147 | + body LONGTEXT NULL DEFAULT NULL, | |
| 148 | + attachment_ids TINYTEXT NULL DEFAULT NULL, | |
| 149 | + create_time datetime, | |
| 150 | + created_by integer, | |
| 151 | + PRIMARY KEY (id) | |
| 152 | + );"; | |
| 153 | + dbDelta( $sql ); | |
| 143 | 154 | $sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wppm_attachments ( |
| 144 | 155 | id BIGINT NOT NULL AUTO_INCREMENT, |
| 145 | 156 | name VARCHAR(200) NOT NULL, |
| 146 | 157 | file_name VARCHAR(200) NOT NULL, |
| @@ -160,12 +171,38 @@ | ||
| 160 | 171 | assigned_by integer, |
| 161 | 172 | PRIMARY KEY (id) |
| 162 | 173 | );"; |
| 163 | 174 | dbDelta( $sql ); |
| 175 | + $sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wppm_project_comment_meta ( | |
| 176 | + id BIGINT NOT NULL AUTO_INCREMENT, | |
| 177 | + proj_id integer, | |
| 178 | + comment_id integer, | |
| 179 | + comment_type VARCHAR(200) NOT NULL, | |
| 180 | + PRIMARY KEY (id) | |
| 181 | + );"; | |
| 182 | + dbDelta( $sql ); | |
| 183 | + $sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wppm_task_comment_meta ( | |
| 184 | + id BIGINT NOT NULL AUTO_INCREMENT, | |
| 185 | + task_id integer, | |
| 186 | + comment_id integer, | |
| 187 | + comment_type VARCHAR(200) NOT NULL, | |
| 188 | + PRIMARY KEY (id) | |
| 189 | + );"; | |
| 190 | + dbDelta( $sql ); | |
| 191 | + $sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wppm_notifications ( | |
| 192 | + id BIGINT AUTO_INCREMENT PRIMARY KEY, | |
| 193 | + user_id INT, | |
| 194 | + message TEXT, | |
| 195 | + link TEXT, | |
| 196 | + is_read TINYINT DEFAULT 0, | |
| 197 | + notification_type VARCHAR(200) NOT NULL, | |
| 198 | + created_at DATETIME DEFAULT CURRENT_TIMESTAMP | |
| 199 | + );"; | |
| 200 | + dbDelta( $sql ); | |
| 164 | 201 | } |
| 165 | 202 | |
| 166 | 203 | public function upgrade(){ |
| 167 | - global $wpdb; | |
| 204 | + global $wpdb,$wppmfunction; | |
| 168 | 205 | $installed_version = get_option( 'wppm_version' ); |
| 169 | 206 | $installed_version = $installed_version ? $installed_version : 0; |
| 170 | 207 | if($installed_version < '1.0.0'){ |
| 171 | 208 | //User Roles |
| @@ -172,12 +209,12 @@ | ||
| 172 | 209 | $user_role = get_option('wppm_user_role'); |
| 173 | 210 | if(empty($user_role)){ |
| 174 | 211 | $user_role = array( |
| 175 | 212 | 1 => array( |
| 176 | - 'label' => __('manager','taskbuilder'), | |
| 213 | + 'label' => esc_html__('manager','taskbuilder'), | |
| 177 | 214 | ), |
| 178 | 215 | 2 => array( |
| 179 | - 'label' => __('co-worker','taskbuilder'), | |
| 216 | + 'label' => esc_html__('co-worker','taskbuilder'), | |
| 180 | 217 | ) |
| 181 | 218 | ); |
| 182 | 219 | update_option('wppm_user_role',$user_role); |
| 183 | 220 | } |
| @@ -186,46 +223,46 @@ | ||
| 186 | 223 | if(empty($wppm_email_notificatins)){ |
| 187 | 224 | $wppm_email_notificatins = array( |
| 188 | 225 | 1=>array( |
| 189 | 226 | 'type'=>'new_project', |
| 190 | - 'subject'=>__('New project has been created:{project_name}','taskbuilder'), | |
| 191 | - 'body'=>__('<p><strong>{user_name}</strong> assigned project to you.</p> <p>Below are details of the project :</p><p><strong> Assign to:-</strong>{project_assigned_users}</p><p><strong> Start Date:-</strong>{project_start_date} </p><p> <strong> End Date:- </strong> {project_end_date} </p> <p><strong>Description:-</strong>{project_description}</p>','taskbuilder'), | |
| 227 | + 'subject'=>esc_html__('New project has been created:{project_name}','taskbuilder'), | |
| 228 | + 'body'=>esc_html__('<p><strong>{user_name}</strong> assigned project to you.</p> <p>Below are details of the project :</p><p><strong> Assign to:-</strong>{project_assigned_users}</p><p><strong> Start Date:-</strong>{project_start_date} </p><p> <strong> End Date:- </strong> {project_end_date} </p> <p><strong>Description:-</strong>{project_description}</p>','taskbuilder'), | |
| 192 | 229 | 'recipients'=>array(1,2) |
| 193 | 230 | ), |
| 194 | 231 | 2=>array( |
| 195 | 232 | 'type'=>'new_task', |
| 196 | - 'subject'=>__('New task has been created: {task_name}','taskbuilder'), | |
| 197 | - 'body'=>__('<p><strong>{user_name}</strong> assigned task to you.</p><p>Below are details of the task :</p> <p><strong>Assign to:-</strong>{task_assigned_users} </p><p><strong> Start Date:-</strong>{task_start_date}</p><p><strong>End Date:-</strong>{task_end_date} </p><p> <strong>Description:-</strong>{task_description}</p>','taskbuilder'), | |
| 233 | + 'subject'=>esc_html__('New task has been created: {task_name}','taskbuilder'), | |
| 234 | + 'body'=>esc_html__('<p><strong>{user_name}</strong> assigned task to you.</p><p>Below are details of the task :</p> <p><strong>Assign to:-</strong>{task_assigned_users} </p><p><strong> Start Date:-</strong>{task_start_date}</p><p><strong>End Date:-</strong>{task_end_date} </p><p> <strong>Description:-</strong>{task_description}</p>','taskbuilder'), | |
| 198 | 235 | 'recipients'=>array(1,2) |
| 199 | 236 | ), |
| 200 | 237 | 3=>array( |
| 201 | 238 | 'type'=>'change_project_status', |
| 202 | - 'subject'=>__('{project_name} Project\'s status has been changed from {old_project_status} to {new_project_status}','taskbuilder'), | |
| 203 | - 'body'=>__('<p><strong>{user_name}</strong> changed project\'s status to <strong>{new_project_status}</strong> </p> <p>Below are details of the project:</p><p><strong>Assign to:- </strong> {project_assigned_users}</p><p><strong>Start Date:-</strong>{project_start_date} </p> <p><strong>End Date:-</strong>{project_end_date} </p> <p><strong>Description:-</strong>{project_description}</p>','taskbuilder'), | |
| 239 | + 'subject'=>esc_html__('{project_name} Project\'s status has been changed from {old_project_status} to {new_project_status}','taskbuilder'), | |
| 240 | + 'body'=>esc_html__('<p><strong>{user_name}</strong> changed project\'s status to <strong>{new_project_status}</strong> </p> <p>Below are details of the project:</p><p><strong>Assign to:- </strong> {project_assigned_users}</p><p><strong>Start Date:-</strong>{project_start_date} </p> <p><strong>End Date:-</strong>{project_end_date} </p> <p><strong>Description:-</strong>{project_description}</p>','taskbuilder'), | |
| 204 | 241 | 'recipients'=>array(1,2) |
| 205 | 242 | ), |
| 206 | 243 | 4=>array( |
| 207 | 244 | 'type'=>'change_task_status', |
| 208 | - 'subject'=>__('{task_name} Task\'s status has been changed from {old_task_status} to {new_task_status}','taskbuilder'), | |
| 209 | - 'body'=>__('<p><strong>{user_name}</strong> changed task status to <strong>{new_task_status} </strong><p> Below are details of the task:</p> <p><strong>Assign to:-</strong>{task_assigned_users} </p> <p><strong>Start Date:-</strong>{task_start_date}</p><p><strong>End Date:-</strong>{task_end_date} </p> <p><strong>Description:-</strong>{task_description}</p>','taskbuilder'), | |
| 245 | + 'subject'=>esc_html__('{task_name} Task\'s status has been changed from {old_task_status} to {new_task_status}','taskbuilder'), | |
| 246 | + 'body'=>esc_html__('<p><strong>{user_name}</strong> changed task status to <strong>{new_task_status} </strong><p> Below are details of the task:</p> <p><strong>Assign to:-</strong>{task_assigned_users} </p> <p><strong>Start Date:-</strong>{task_start_date}</p><p><strong>End Date:-</strong>{task_end_date} </p> <p><strong>Description:-</strong>{task_description}</p>','taskbuilder'), | |
| 210 | 247 | 'recipients'=>array(1,2) |
| 211 | 248 | ), |
| 212 | 249 | 5=>array( |
| 213 | 250 | 'type'=>'change_project_assign_users', |
| 214 | - 'subject'=>__('{project_name} Project\'s assigned users changed from {previously_assigned_project_users} to {project_assigned_users}','taskbuilder'), | |
| 215 | - 'body'=>__('<p><strong>{user_name}</strong> changed project\'s assign users to <strong> {project_assigned_users}</strong></p> <p>Below are details of the project :</p><p><strong> Assign to:-</strong>{project_assigned_users}</p><p><strong> Start Date:-</strong>{project_start_date} </p><p> <strong> End Date:- </strong> {project_end_date} </p> <p><strong>Description:-</strong>{project_description}</p>','taskbuilder'), | |
| 251 | + 'subject'=>esc_html__('{project_name} Project\'s assigned users changed from {previously_assigned_project_users} to {project_assigned_users}','taskbuilder'), | |
| 252 | + 'body'=>esc_html__('<p><strong>{user_name}</strong> changed project\'s assign users to <strong> {project_assigned_users}</strong></p> <p>Below are details of the project :</p><p><strong> Assign to:-</strong>{project_assigned_users}</p><p><strong> Start Date:-</strong>{project_start_date} </p><p> <strong> End Date:- </strong> {project_end_date} </p> <p><strong>Description:-</strong>{project_description}</p>','taskbuilder'), | |
| 216 | 253 | 'recipients'=>array(1,2) |
| 217 | 254 | ), |
| 218 | 255 | 6=>array( |
| 219 | 256 | 'type'=>'change_task_assign_users', |
| 220 | - 'subject'=>__('{task_name} Task\'s assigned users change from {previously_assigned_task_users} to {task_assigned_users}','taskbuilder'), | |
| 221 | - 'body'=>__('<p><strong>{user_name}</strong> changed task\'s assign users to <strong>{task_assigned_users}</strong></p><p>Below are details of the task :</p> <p><strong>Assign to:-</strong>{task_assigned_users} </p><p><strong> Start Date:-</strong>{task_start_date}</p><p><strong>End Date:-</strong>{task_end_date} </p><p> <strong>Description:-</strong>{task_description}</p>','taskbuilder'), | |
| 257 | + 'subject'=>esc_html__('{task_name} Task\'s assigned users change from {previously_assigned_task_users} to {task_assigned_users}','taskbuilder'), | |
| 258 | + 'body'=>esc_html__('<p><strong>{user_name}</strong> changed task\'s assign users to <strong>{task_assigned_users}</strong></p><p>Below are details of the task :</p> <p><strong>Assign to:-</strong>{task_assigned_users} </p><p><strong> Start Date:-</strong>{task_start_date}</p><p><strong>End Date:-</strong>{task_end_date} </p><p> <strong>Description:-</strong>{task_description}</p>','taskbuilder'), | |
| 222 | 259 | 'recipients'=>array(1,2) |
| 223 | 260 | ), |
| 224 | 261 | 7=>array( |
| 225 | 262 | 'type'=>'new_discussion', |
| 226 | - 'subject'=>__('[{project_name}][{task_name}] {last_comment_user_name} started new discussion:','taskbuilder'), | |
| 227 | - 'body'=>__('<p><strong>{last_comment_user_name}</strong> wrote:</p> <p>{comment_body}</p>','taskbuilder'), | |
| 263 | + 'subject'=>esc_html__('[{project_name}][{task_name}] {last_comment_user_name} started new discussion:','taskbuilder'), | |
| 264 | + 'body'=>esc_html__('<p><strong>{last_comment_user_name}</strong> wrote:</p> <p>{comment_body}</p>','taskbuilder'), | |
| 228 | 265 | 'recipients'=>array(1,2) |
| 229 | 266 | ) |
| 230 | 267 | ); |
| 231 | 268 | update_option('wppm_email_notification',$wppm_email_notificatins); |
| @@ -234,12 +271,12 @@ | ||
| 234 | 271 | update_option('wppm_default_task_list_view',1); |
| 235 | 272 | |
| 236 | 273 | $default_statuses = $wpdb->get_var("select count(*) from {$wpdb->prefix}wppm_project_statuses"); |
| 237 | 274 | if (empty($default_statuses)) { |
| 238 | - $wpdb->insert($wpdb->prefix . "wppm_project_statuses", array('id' => 1,'name' => __('New','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#306EFF','load_order'=>1)); | |
| 239 | - $wpdb->insert($wpdb->prefix . "wppm_project_statuses", array('id' => 2,'name' => __('In Progress','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#FCD12A','load_order'=>2)); | |
| 240 | - $wpdb->insert($wpdb->prefix . "wppm_project_statuses", array('id' => 3,'name' => __('Hold','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#D3D3D3','load_order'=>3)); | |
| 241 | - $wpdb->insert($wpdb->prefix . "wppm_project_statuses", array('id' => 4,'name' => __('Completed','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#5cb85c','load_order'=>4)); | |
| 275 | + $wpdb->insert($wpdb->prefix . "wppm_project_statuses", array('id' => 1,'name' => esc_html__('New','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#306EFF','load_order'=>1)); | |
| 276 | + $wpdb->insert($wpdb->prefix . "wppm_project_statuses", array('id' => 2,'name' => esc_html__('In Progress','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#FCD12A','load_order'=>2)); | |
| 277 | + $wpdb->insert($wpdb->prefix . "wppm_project_statuses", array('id' => 3,'name' => esc_html__('Hold','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#D3D3D3','load_order'=>3)); | |
| 278 | + $wpdb->insert($wpdb->prefix . "wppm_project_statuses", array('id' => 4,'name' => esc_html__('Completed','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#5cb85c','load_order'=>4)); | |
| 242 | 279 | } |
| 243 | 280 | $wppm_default_project_status = get_option('wppm_default_project_status',true); |
| 244 | 281 | if($wppm_default_project_status == ''){ |
| 245 | 282 | update_option('wppm_default_project_status',1); |
| @@ -245,12 +282,12 @@ | ||
| 245 | 282 | update_option('wppm_default_project_status',1); |
| 246 | 283 | } |
| 247 | 284 | $default_task_statuses = $wpdb->get_var("select count(*) from {$wpdb->prefix}wppm_task_statuses"); |
| 248 | 285 | if (empty($default_task_statuses)) { |
| 249 | - $wpdb->insert($wpdb->prefix . "wppm_task_statuses",array('id' => 1,'name' => __('Todo','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#306EFF','load_order'=>1)); | |
| 250 | - $wpdb->insert($wpdb->prefix . "wppm_task_statuses",array('id' => 2,'name' => __('In Progress','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#FCD12A','load_order'=>2)); | |
| 251 | - $wpdb->insert($wpdb->prefix . "wppm_task_statuses",array('id' => 3,'name' => __('Hold','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#D3D3D3','load_order'=>3)); | |
| 252 | - $wpdb->insert($wpdb->prefix . "wppm_task_statuses",array('id' => 4,'name' => __('Completed','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#5cb85c','load_order'=>4)); | |
| 286 | + $wpdb->insert($wpdb->prefix . "wppm_task_statuses",array('id' => 1,'name' => esc_html__('Todo','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#306EFF','load_order'=>1)); | |
| 287 | + $wpdb->insert($wpdb->prefix . "wppm_task_statuses",array('id' => 2,'name' => esc_html__('In Progress','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#FCD12A','load_order'=>2)); | |
| 288 | + $wpdb->insert($wpdb->prefix . "wppm_task_statuses",array('id' => 3,'name' => esc_html__('Hold','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#D3D3D3','load_order'=>3)); | |
| 289 | + $wpdb->insert($wpdb->prefix . "wppm_task_statuses",array('id' => 4,'name' => esc_html__('Completed','taskbuilder'),'color'=>'#ffffff','bg_color'=>'#5cb85c','load_order'=>4)); | |
| 253 | 290 | } |
| 254 | 291 | $wppm_default_task_status = get_option('wppm_default_task_status',true); |
| 255 | 292 | if($wppm_default_task_status == ''){ |
| 256 | 293 | update_option('wppm_default_task_status',1); |
| @@ -257,8 +294,341 @@ | ||
| 257 | 294 | } |
| 258 | 295 | } |
| 259 | 296 | if($installed_version < '1.0.2'){ |
| 260 | 297 | update_option('wppm_project_time', 1); |
| 298 | + } | |
| 299 | + if($installed_version < '2.0.0'){ | |
| 300 | + update_option('wppm_default_project_date', 1); | |
| 301 | + update_option('wppm_default_task_date', 1); | |
| 302 | + } | |
| 303 | + if($installed_version < '2.0.2'){ | |
| 304 | + update_option('wppm_default_edit_tasks_permission', 0); | |
| 305 | + } | |
| 306 | + if($installed_version < '2.0.4'){ | |
| 307 | + update_option('wppm_public_projects_permission',0); | |
| 308 | + } | |
| 309 | + if($installed_version < '2.0.8'){ | |
| 310 | + update_option('wppm_task_time',1); | |
| 311 | + } | |
| 312 | + if($installed_version < '3.0.0'){ | |
| 313 | + $wppm_email_notificatins = get_option('wppm_email_notification'); | |
| 314 | + if(!empty($wppm_email_notificatins) && !isset($wppm_email_notificatins[8])){ | |
| 315 | + $wppm_email_notificatins[8] = array( | |
| 316 | + 'type'=>'new_proj_discussion', | |
| 317 | + 'subject'=>esc_html__('[{project_name}] {last_proj_comment_user_name} started new discussion:','taskbuilder'), | |
| 318 | + 'body'=>esc_html__('<p><strong>{last_proj_comment_user_name}</strong> wrote:</p> <p>{proj_comment_body}</p>','taskbuilder'), | |
| 319 | + 'recipients'=>array(1,2) | |
| 320 | + ); | |
| 321 | + update_option('wppm_email_notification',$wppm_email_notificatins); | |
| 322 | + } | |
| 323 | + update_option( | |
| 324 | + 'wppm-ap-project-list', | |
| 325 | + array( | |
| 326 | + 'list-header-button-background-color' => '#0052CC', | |
| 327 | + 'list-header-button-hover-color' => '#0065ff', | |
| 328 | + 'list-header-button-text-color' => '#fff', | |
| 329 | + 'list-header-background-color' => '#304FFE', | |
| 330 | + 'list-header-text-color' => '#fff', | |
| 331 | + 'list-item-odd-background-color' => '#fff', | |
| 332 | + 'list-item-odd-text-color' => '#2C3E50', | |
| 333 | + 'list-item-even-background-color' => '#F2F2F2', | |
| 334 | + 'list-item-even-text-color' => '#2C3E50', | |
| 335 | + 'list-item-hover-background-color' => '#F5F5F5', | |
| 336 | + 'list-item-hover-text-color' => '#2C3E50' | |
| 337 | + ) | |
| 338 | + ); | |
| 339 | + update_option( | |
| 340 | + 'wppm-ap-task-list', | |
| 341 | + array( | |
| 342 | + 'list-header-button-background-color'=>'#0052CC', | |
| 343 | + 'list-header-button-hover-color' =>'#0065ff', | |
| 344 | + 'list-header-button-text-color' =>'#fff', | |
| 345 | + 'list-header-background-color' => '#304FFE', | |
| 346 | + 'list-header-text-color' => '#fff', | |
| 347 | + 'list-item-odd-background-color' => '#fff', | |
| 348 | + 'list-item-odd-text-color' => '#2C3E50', | |
| 349 | + 'list-item-even-background-color' => '#F2F2F2', | |
| 350 | + 'list-item-even-text-color' => '#2C3E50', | |
| 351 | + 'list-item-hover-background-color' => '#F5F5F5', | |
| 352 | + 'list-item-hover-text-color' => '#2C3E50', | |
| 353 | + ) | |
| 354 | + ); | |
| 355 | + update_option( | |
| 356 | + 'wppm-ap-individual-project', | |
| 357 | + array( | |
| 358 | + 'menu-button-bg-color' =>'#0052CC', | |
| 359 | + 'menu-button-hover-color' =>'#0065ff', | |
| 360 | + 'menu-button-text-color' =>'#fff', | |
| 361 | + 'comment-primary-color' => '#000000', | |
| 362 | + 'comment-secondary-color' => '#4e4e4e', | |
| 363 | + 'comment-date-color' => '#a8aeb5', | |
| 364 | + 'comment-date-hover-color' => '#000000', | |
| 365 | + 'comment-send-btn-bg-color' => '#5067c5', | |
| 366 | + 'comment-send-btn-color' => '#ffffff', | |
| 367 | + 'widget-header-bg-color' => '#ffffff', | |
| 368 | + 'widget-header-text-color' => '#2C3E50', | |
| 369 | + 'widget-body-bg-color' => '#ffffff', | |
| 370 | + 'widget-body-label-color' => '#9c9c9c', | |
| 371 | + 'widget-body-text-color' => '#2C3E50', | |
| 372 | + ) | |
| 373 | + ); | |
| 374 | + update_option( | |
| 375 | + 'wppm-ap-individual-task', | |
| 376 | + array( | |
| 377 | + 'comment-primary-color' => '#000000', | |
| 378 | + 'comment-secondary-color' => '#4e4e4e', | |
| 379 | + 'comment-date-color' => '#a8aeb5', | |
| 380 | + 'comment-date-hover-color' => '#000000', | |
| 381 | + 'comment-send-btn-bg-color' => '#5067c5', | |
| 382 | + 'comment-send-btn-color' => '#ffffff', | |
| 383 | + 'widget-header-bg-color' => '#ffffff', | |
| 384 | + 'widget-header-text-color' => '#2C3E50', | |
| 385 | + 'widget-body-bg-color' => '#ffffff', | |
| 386 | + 'widget-body-label-color' => '#9c9c9c', | |
| 387 | + 'widget-body-text-color' => '#2C3E50', | |
| 388 | + ) | |
| 389 | + ); | |
| 390 | + update_option( | |
| 391 | + 'wppm-ap-modal', | |
| 392 | + array( | |
| 393 | + 'header-bg-color' => '#ffffff', | |
| 394 | + 'header-text-color' => '#3c434a', | |
| 395 | + 'body-bg-color' => '#fff', | |
| 396 | + 'body-label-color' => '#3c434a', | |
| 397 | + 'body-text-color' => '#555', | |
| 398 | + 'footer-bg-color' => '#F6F6F6', | |
| 399 | + 'action-btn-bg-color' =>'#306EFF', | |
| 400 | + 'action-btn-text-color'=>'#fff', | |
| 401 | + 'z-index' => 900000000, | |
| 402 | + ) | |
| 403 | + ); | |
| 404 | + update_option( | |
| 405 | + 'wppm-ap-grid-view', | |
| 406 | + array( | |
| 407 | + 'menu-button-bg-color' =>'#0052CC', | |
| 408 | + 'menu-button-hover-color' =>'#0065ff', | |
| 409 | + 'menu-button-text-color' =>'#fff', | |
| 410 | + 'grid-background-color' => '#fff', | |
| 411 | + 'grid-header-text-color' => '#2C3E50' | |
| 412 | + ) | |
| 413 | + ); | |
| 414 | + update_option( | |
| 415 | + 'wppm-ap-settings', | |
| 416 | + array( | |
| 417 | + 'tab-background-color' => '#0052CC', | |
| 418 | + 'tab-text-color' => '#fff', | |
| 419 | + 'add-new-button-bg-color' =>'#0052CC', | |
| 420 | + 'add-new-button-text-color' =>'#fff', | |
| 421 | + 'add-new-button-hover-color'=>'#0065ff', | |
| 422 | + 'save-changes-button-bg-color'=>'#306EFF', | |
| 423 | + 'save-changes-button-text-color'=>'#fff' | |
| 424 | + ) | |
| 425 | + ); | |
| 426 | + } | |
| 427 | + if($installed_version < '3.0.1'){ | |
| 428 | + update_option('wppm_default_project_status', 1); | |
| 429 | + update_option('wppm_default_task_status', 1); | |
| 430 | + } | |
| 431 | + if($installed_version < '3.0.5'){ | |
| 432 | + update_option('wppm_tinymce_visibility_open_task',0); | |
| 433 | + update_option('wppm_tinymce_visibility_open_project',0); | |
| 434 | + update_option('wppm_default_email_notification_to_current_user', 1); | |
| 435 | + } | |
| 436 | + if($installed_version < '3.0.6'){ | |
| 437 | + update_option('wppm_allow_coworkers_create_task',1); | |
| 438 | + update_option('wppm_allow_coworkers_add_checklist',1); | |
| 439 | + update_option('wppm_allow_coworkers_assign_users', 0); | |
| 440 | + update_option('wppm_allow_coworkers_change_status', 1); | |
| 441 | + } | |
| 442 | + if($installed_version < '3.0.9'){ | |
| 443 | + update_option('wppm_rich_text_editor',1); | |
| 444 | + update_option( | |
| 445 | + 'wppm_toolbar_actions', | |
| 446 | + array( | |
| 447 | + 'bold' => '1', | |
| 448 | + 'italic' => '1', | |
| 449 | + 'underline' =>'1', | |
| 450 | + 'blockquote' =>'1', | |
| 451 | + 'align'=>'1', | |
| 452 | + 'bullist'=>'1', | |
| 453 | + 'numlist'=>'1', | |
| 454 | + 'rtl'=>'1', | |
| 455 | + 'link'=>'1', | |
| 456 | + 'wppm_insert_editor_img'=>'1', | |
| 457 | + 'forecolor'=>'0', | |
| 458 | + 'backcolor' => '0', | |
| 459 | + 'strikethrough' => '0' | |
| 460 | + ) | |
| 461 | + ); | |
| 462 | + } | |
| 463 | + | |
| 464 | + if($installed_version < '4.0.0'){ | |
| 465 | + update_option( | |
| 466 | + 'wppm-page-settings', | |
| 467 | + array( | |
| 468 | + 'task-url-page' => 0, | |
| 469 | + 'project-url-page' => 0 | |
| 470 | + ) | |
| 471 | + ); | |
| 472 | + } | |
| 473 | + | |
| 474 | + if($installed_version < '4.0.4'){ | |
| 475 | + update_option('wppm_date_setting','Y-m-d h:i:sa'); | |
| 476 | + } | |
| 477 | + | |
| 478 | + if($installed_version < '4.0.5'){ | |
| 479 | + update_option('wppm_hide_completed_status_proj','1'); | |
| 480 | + update_option('wppm_hide_completed_status_task','1'); | |
| 481 | + update_option('wppm_hide_proj_statuses_from_frontend','0'); | |
| 482 | + update_option('wppm_hide_task_statuses_from_frontend','0'); | |
| 483 | + update_option('wppm_proj_hide_comment_section','1'); | |
| 484 | + update_option('wppm_task_hide_comment_section','1'); | |
| 485 | + } | |
| 486 | + | |
| 487 | + if($installed_version < '5.0.0'){ | |
| 488 | + $wppm_print_settings = array( | |
| 489 | + 'wppm_print_body_font_size' => 10); | |
| 490 | + update_option('wppm_print_settings',$wppm_print_settings); | |
| 491 | + } | |
| 492 | + if($installed_version < '5.0.2'){ | |
| 493 | + $table_name = $wpdb->prefix . 'wppm_checklist_items'; | |
| 494 | + $column_name = 'load_order'; | |
| 495 | + $column_type = 'INT(11) NOT NULL DEFAULT 1'; | |
| 496 | + | |
| 497 | + $column_exists = $wpdb->get_var( | |
| 498 | + $wpdb->prepare( | |
| 499 | + "SHOW COLUMNS FROM `$table_name` LIKE %s", | |
| 500 | + $column_name | |
| 501 | + ) | |
| 502 | + ); | |
| 503 | + | |
| 504 | + if ( null === $column_exists ) { | |
| 505 | + | |
| 506 | + // Column name and type are hardcoded, not user input. | |
| 507 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared | |
| 508 | + $wpdb->query( | |
| 509 | + "ALTER TABLE `$table_name` | |
| 510 | + ADD `$column_name` $column_type" | |
| 511 | + ); | |
| 512 | + } | |
| 513 | + $table_name = $wpdb->prefix . 'wppm_task'; | |
| 514 | + $cl_name = 'is_archived'; | |
| 515 | + $cl_type = 'TINYINT(1) DEFAULT 0'; | |
| 516 | + | |
| 517 | + $cl_exists = $wpdb->get_var( | |
| 518 | + $wpdb->prepare( | |
| 519 | + "SHOW COLUMNS FROM `$table_name` LIKE %s", | |
| 520 | + $cl_name | |
| 521 | + ) | |
| 522 | + ); | |
| 523 | + | |
| 524 | + if ( null === $cl_exists ) { | |
| 525 | + | |
| 526 | + $sql = sprintf( | |
| 527 | + 'ALTER TABLE `%s` ADD `%s` %s', | |
| 528 | + $table_name, | |
| 529 | + $cl_name, | |
| 530 | + $cl_type | |
| 531 | + ); | |
| 532 | + | |
| 533 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Safe: identifiers are hardcoded. | |
| 534 | + $wpdb->query( $sql ); | |
| 535 | + } | |
| 536 | + } | |
| 537 | + if($installed_version < '5.0.3'){ | |
| 538 | + update_option('wppm_display_time_duration_project',0); | |
| 539 | + update_option('wppm_display_time_duration_task',0); | |
| 540 | + | |
| 541 | + } | |
| 542 | + if($installed_version < '5.0.6'){ | |
| 543 | + update_option('wppm_show_update_notice', 1); | |
| 544 | + $user_role = get_option('wppm_user_role'); | |
| 545 | + if (!isset($user_role[3])) { | |
| 546 | + $user_role[3] = array( | |
| 547 | + 'label' => esc_html__('Client', 'taskbuilder'), | |
| 548 | + ); | |
| 549 | + } | |
| 550 | + update_option('wppm_user_role', $user_role); | |
| 551 | + } | |
| 552 | + if($installed_version < '6.0.0'){ | |
| 553 | + $table_name = $wpdb->prefix . 'wppm_project'; | |
| 554 | + $column_name = 'project_auth_code'; | |
| 555 | + $column_type = 'LONGTEXT NULL DEFAULT NULL'; | |
| 556 | + $column_exists = $wpdb->get_var( | |
| 557 | + $wpdb->prepare( | |
| 558 | + "SHOW COLUMNS FROM `$table_name` LIKE %s", | |
| 559 | + $column_name | |
| 560 | + ) | |
| 561 | + ); | |
| 562 | + if ( empty( $column_exists ) ) { | |
| 563 | + // Column name and type are hardcoded, not user input. | |
| 564 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared | |
| 565 | + $wpdb->query( | |
| 566 | + "ALTER TABLE `$table_name` | |
| 567 | + ADD `$column_name` $column_type" | |
| 568 | + ); | |
| 569 | + } | |
| 570 | + $projects = $wpdb->get_results( | |
| 571 | + "SELECT id FROM {$wpdb->prefix}wppm_project | |
| 572 | + WHERE project_auth_code IS NULL OR project_auth_code = ''" | |
| 573 | + ); | |
| 574 | + foreach ( $projects as $project ) { | |
| 575 | + $wpdb->update( | |
| 576 | + "{$wpdb->prefix}wppm_project", | |
| 577 | + array( | |
| 578 | + 'project_auth_code' => $wppmfunction->getRandomString(10), | |
| 579 | + ), | |
| 580 | + array( | |
| 581 | + 'id' => $project->id, | |
| 582 | + ), | |
| 583 | + array('%s'), | |
| 584 | + array('%d') | |
| 585 | + ); | |
| 586 | + } | |
| 587 | + $table_name = $wpdb->prefix . 'wppm_project'; | |
| 588 | + $cl_name = 'is_archived'; | |
| 589 | + $cl_type = 'TINYINT(1) DEFAULT 0'; | |
| 590 | + $cl_exists = $wpdb->get_var( | |
| 591 | + $wpdb->prepare( | |
| 592 | + "SHOW COLUMNS FROM `$table_name` LIKE %s", | |
| 593 | + $cl_name | |
| 594 | + ) | |
| 595 | + ); | |
| 596 | + if ( empty( $cl_exists ) ) { | |
| 597 | + $sql = sprintf( | |
| 598 | + 'ALTER TABLE `%s` ADD `%s` %s', | |
| 599 | + $table_name, | |
| 600 | + $cl_name, | |
| 601 | + $cl_type | |
| 602 | + ); | |
| 603 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Safe: identifiers are hardcoded. | |
| 604 | + $wpdb->query( $sql ); | |
| 605 | + } | |
| 606 | + } | |
| 607 | + if($installed_version < '6.0.6'){ | |
| 608 | + update_option('wppm_default_global_mention_comment_notification', 1); | |
| 609 | + $project_list_settings = get_option( 'wppm-ap-project-list', array() ); | |
| 610 | + $project_list_settings['list-header-button-background-color'] = '#0052CC'; | |
| 611 | + $project_list_settings['list-header-button-hover-color'] = '#0065ff'; | |
| 612 | + $project_list_settings['list-header-button-text-color'] = '#fff'; | |
| 613 | + update_option( 'wppm-ap-project-list', $project_list_settings ); | |
| 614 | + $table_name = $wpdb->prefix . 'wppm_task'; | |
| 615 | + $column_name = 'parent_task_id'; | |
| 616 | + $column_type = 'INT(11) NOT NULL DEFAULT 0'; | |
| 617 | + $column_exists = $wpdb->get_var( | |
| 618 | + $wpdb->prepare( | |
| 619 | + "SHOW COLUMNS FROM `$table_name` LIKE %s", | |
| 620 | + $column_name | |
| 621 | + ) | |
| 622 | + ); | |
| 623 | + if ( empty( $column_exists ) ) { | |
| 624 | + // Column name and type are hardcoded, not user input. | |
| 625 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared | |
| 626 | + $wpdb->query( | |
| 627 | + "ALTER TABLE `$table_name` | |
| 628 | + ADD `$column_name` $column_type" | |
| 629 | + ); | |
| 630 | + } | |
| 261 | 631 | } |
| 262 | 632 | // update wppm_version option to plugin version |
| 263 | 633 | update_option( 'wppm_version', WPPM_VERSION ); |
| 264 | 634 | } |