PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.85
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.85
5.5.85 5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 All 161 releases
← All changes | WPDataAccess/Macro/WPDA_Macro.php +16 -16 5.5.29 → 5.5.85 View file →
@@ -10,10 +10,10 @@
10 10
11 11 public function __construct( $raw_code ) {
12 12 $this->raw_code = $raw_code;
13 13 if ( null !== $this->raw_code && '' !== str_replace( ' ', '', $this->raw_code ) ) {
14 - $this->raw_array = explode( "\n", $this->raw_code );//phpcs:ignore - 8.1 proof
15 - if ( is_array( $this->raw_array ) && count( $this->raw_array ) > 2 ) {//phpcs:ignore - 8.1 proof
14 + $this->raw_array = explode( "\n", $this->raw_code ); // phpcs:ignore -- 8.1 proof
15 + if ( is_array( $this->raw_array ) && count( $this->raw_array ) > 2 ) { // phpcs:ignore -- 8.1 proof
16 16 $this->has_macros = true;
17 17 }
18 18 }
19 19 }
@@ -35,9 +35,9 @@
35 35
36 36 $codeif = array();
37 37 $totalifs = 0;
38 38
39 - for ( $line = 0; $line < count( $code_array ); $line++ ) {//phpcs:ignore - 8.1 proof
39 + for ( $line = 0; $line < count( $code_array ); $line++ ) { // phpcs:ignore -- 8.1 proof
40 40 $code = $code_array[ $line ];
41 41 if ( $this->is_macro( 'if', $code ) ) {
42 42 $totalifs++;
43 43
@@ -45,9 +45,9 @@
45 45 $line_start = $line;
46 46 $line_else = -1;
47 47 $line_end = $line; // prevent PHP errors
48 48 $ifs_found = 1;
49 - for ( $i = $line + 1; $i < count( $code_array ); $i++ ) {//phpcs:ignore - 8.1 proof
49 + for ( $i = $line + 1; $i < count( $code_array ); $i++ ) { // phpcs:ignore -- 8.1 proof
50 50 if ( $this->is_macro( 'if', $code_array[ $i ] ) ) {
51 51 $ifs_found++;
52 52 }
53 53
@@ -67,14 +67,14 @@
67 67 }
68 68
69 69 if ( -1 === $line_else ) {
70 70 // Get code between if and end if
71 - $code_slice = array_slice( $code_array, $line_start + 1, $line_end - $line_start - 1 );//phpcs:ignore - 8.1 proof
71 + $code_slice = array_slice( $code_array, $line_start + 1, $line_end - $line_start - 1 ); // phpcs:ignore -- 8.1 proof
72 72 } else {
73 73 // Get code between if and else
74 - $code_slice = array_slice( $code_array, $line_start + 1, $line_else - $line_start - 1 );//phpcs:ignore - 8.1 proof
74 + $code_slice = array_slice( $code_array, $line_start + 1, $line_else - $line_start - 1 ); // phpcs:ignore -- 8.1 proof
75 75 // Get code between else and end if
76 - $code_else = array_slice( $code_array, $line_else + 1, $line_end - $line_else - 1 );//phpcs:ignore - 8.1 proof
76 + $code_else = array_slice( $code_array, $line_else + 1, $line_end - $line_else - 1 ); // phpcs:ignore -- 8.1 proof
77 77 }
78 78
79 79 // Process nested ifs
80 80 $code_slice = $this->macro_if( $code_slice );
@@ -82,12 +82,12 @@
82 82 $condition = null;
83 83 foreach ( array( '==', '!=', '<', '>' ) as $c ) { // Handle each condition individually in macro_if_check
84 84 if ( $this->macro_if_has( $code, $c, $condition ) ) {
85 85 if ( $this->macro_if_check( $condition, $c ) ) {
86 - $codeif = array_merge( $codeif, $code_slice );//phpcs:ignore - 8.1 proof
86 + $codeif = array_merge( $codeif, $code_slice ); // phpcs:ignore -- 8.1 proof
87 87 } else {
88 88 if ( $line_else > -1 ) {
89 - $codeif = array_merge( $codeif, $code_else );//phpcs:ignore - 8.1 proof
89 + $codeif = array_merge( $codeif, $code_else ); // phpcs:ignore -- 8.1 proof
90 90 }
91 91 }
92 92 $line = $line_end;
93 93 break;
@@ -93,9 +93,9 @@
93 93 break;
94 94 }
95 95 }
96 96 } else {
97 - $codeif = array_merge( $codeif, array( $code_array[ $line ] ) );//phpcs:ignore - 8.1 proof
97 + $codeif = array_merge( $codeif, array( $code_array[ $line ] ) ); // phpcs:ignore -- 8.1 proof
98 98 }
99 99 }
100 100
101 101 if ( $totalifs === 0 ) {
@@ -105,25 +105,25 @@
105 105 }
106 106 }
107 107
108 108 protected function macro_if_has( $code, $if, &$condition ) {
109 - $condition = explode( $if, html_entity_decode( substr( str_replace( ' ', '', (string ) $code ), 8 ) ) );//phpcs:ignore - 8.1 proof
110 - return is_array( $condition ) && count( $condition ) === 2;//phpcs:ignore - 8.1 proof
109 + $condition = explode( $if, html_entity_decode( substr( str_replace( ' ', '', (string ) $code ), 8 ) ) ); // phpcs:ignore -- 8.1 proof
110 + return is_array( $condition ) && count( $condition ) === 2; // phpcs:ignore -- 8.1 proof
111 111 }
112 112
113 113 protected function macro_if_check( $condition, $if ) {
114 114 switch ( $if ) {
115 115 case '==';
116 - return is_array( $condition ) && count( $condition ) === 2 && $condition[0] == $condition[1];//phpcs:ignore - 8.1 proof
116 + return is_array( $condition ) && count( $condition ) === 2 && $condition[0] == $condition[1]; // phpcs:ignore -- 8.1 proof
117 117 break;
118 118 case '!=';
119 - return is_array( $condition ) && count( $condition ) === 2 && $condition[0] != $condition[1];//phpcs:ignore - 8.1 proof
119 + return is_array( $condition ) && count( $condition ) === 2 && $condition[0] != $condition[1]; // phpcs:ignore -- 8.1 proof
120 120 break;
121 121 case '<';
122 - return is_array( $condition ) && count( $condition ) === 2 && $condition[0] < $condition[1];//phpcs:ignore - 8.1 proof
122 + return is_array( $condition ) && count( $condition ) === 2 && $condition[0] < $condition[1]; // phpcs:ignore -- 8.1 proof
123 123 break;
124 124 case '>';
125 - return is_array( $condition ) && count( $condition ) === 2 && $condition[0] > $condition[1];//phpcs:ignore - 8.1 proof
125 + return is_array( $condition ) && count( $condition ) === 2 && $condition[0] > $condition[1]; // phpcs:ignore -- 8.1 proof
126 126 break;
127 127 }
128 128 }
129 129