PluginProbe
UpStream: a Project Management Plugin for WordPress / trunk
UpStream: a Project Management Plugin for WordPress vtrunk
trunk 1.39.0 1.39.1 1.39.2 1.39.3 2.0.7 2.1.0
upstream / includes / up-wcs-helper.php

up-wcs-helper.php in UpStream: a Project Management Plugin for WordPress trunk, at includes/up-wcs-helper.php

58 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Handle WordPress Coding Standard (WCS) helper
4 *
5 * @package UpStream
6 */
7
8 /**
9 * Convert variable from snake to camel case
10 *
11 * @return array
12 */
13 function upstream_wcs_updated_variables() {
14 $variables = array(
15 'file_id' => 'fileId',
16 'severity_code' => 'severityCode',
17 'status_code' => 'statusCode',
18 'due_date' => 'dueDate',
19 'time_records' => 'timeRecords',
20 'elapsed_time' => 'elapsedTime',
21 'user_ids' => 'userIds',
22 'file_url' => 'fileURL',
23 'created_at' => 'createdAt',
24 'parent_id' => 'parentId',
25 'category_ids' => 'categoryIds',
26 'start_date' => 'startDate',
27 'end_date' => 'endDate',
28 'created_by' => 'createdBy',
29 'assigned_to' => 'assignedTo',
30 'assigned_to:byUsername' => 'assignedTo:byUsername',
31 'assigned_to:byEmail' => 'assignedTo:byEmail',
32 'client_id' => 'clientId',
33 'client_user_ids' => 'clientUserIds',
34 'member_user_ids' => 'memberUserIds',
35 'milestone_id' => 'milestoneId',
36 'start_timestamp' => 'startTimestamp',
37 );
38
39 return $variables;
40 }
41
42 /**
43 * Filter variable on model files
44 *
45 * @param string $variable Variable to filter.
46 * @return string
47 */
48 function upstream_wcs_model_variable( $variable ) {
49 $all_variables = upstream_wcs_updated_variables();
50
51 if ( isset( $all_variables[ $variable ] ) ) {
52 $variable = $all_variables[ $variable ];
53 }
54
55 return $variable;
56 }
57 add_filter( 'upstream_wcs_model_variable', 'upstream_wcs_model_variable', 10, 1 );
58