Completed
Pull Request — develop (#872)
by Zack
03:57
created
future/_mocks.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -62,6 +62,8 @@
 block discarded – undo
62 62
  * @internal
63 63
  * @since future
64 64
  *
65
+ * @param integer $form_id
66
+ * @param integer $count
65 67
  * @return array The old associative array data as returned by
66 68
  *  \GravityView_frontend::get_view_entries(), the paging parameters
67 69
  *  and a total count of all entries.
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 		$paging = rgar( $parameters, 'paging' );
95 95
 	} else {
96 96
 		$entries = $form->entries
97
-			->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria['search_criteria'] ) )
98
-			->offset( $args['offset'] )
99
-			->limit( $criteria['paging']['page_size'] )
100
-			->page( ( ( $criteria['paging']['offset'] - $args['offset'] ) / $criteria['paging']['page_size'] ) + 1 );
101
-		if ( ! empty( $criteria['sorting'] ) ) {
97
+			->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria[ 'search_criteria' ] ) )
98
+			->offset( $args[ 'offset' ] )
99
+			->limit( $criteria[ 'paging' ][ 'page_size' ] )
100
+			->page( ( ( $criteria[ 'paging' ][ 'offset' ] - $args[ 'offset' ] ) / $criteria[ 'paging' ][ 'page_size' ] ) + 1 );
101
+		if ( ! empty( $criteria[ 'sorting' ] ) ) {
102 102
 			$field = new \GV\Field();
103
-			$field->ID = $criteria['sorting']['key'];
104
-			$direction = strtolower( $criteria['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
103
+			$field->ID = $criteria[ 'sorting' ][ 'key' ];
104
+			$direction = strtolower( $criteria[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
105 105
 			$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
106 106
 		}
107 107
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 /** Add some global fix for field capability discrepancies. */
129 129
 add_filter( 'gravityview/configuration/fields', function( $fields ) {
130
-	if ( empty( $fields  ) ) {
130
+	if ( empty( $fields ) ) {
131 131
 		return $fields;
132 132
 	}
133 133
 
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 		}
155 155
 
156 156
 		foreach ( $_fields as $uid => &$_field ) {
157
-			if ( ! isset( $_field['only_loggedin'] ) ) {
157
+			if ( ! isset( $_field[ 'only_loggedin' ] ) ) {
158 158
 				continue;
159 159
 			}
160 160
 			/** If we do not require login, we don't require a cap. */
161
-			$_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' );
161
+			$_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' );
162 162
 		}
163 163
 	}
164 164
 	return $fields;
Please login to merge, or discard this patch.
includes/class-gravityview-merge-tags.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	public static function process_modifiers( $value, $merge_tag, $modifier, $field, $raw_value ) {
46 46
 
47 47
 		// No modifier was set or the raw value was empty
48
-		if( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) {
48
+		if ( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) {
49 49
 			return $value;
50 50
 		}
51 51
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 		foreach ( $gv_modifiers as $gv_modifier => $method ) {
62 62
 
63 63
 			// Only match the regex if it's the first modifer; this allows us to enforce our own modifier structure
64
-			preg_match( '/^' . $gv_modifier .'/ism', $modifier, $matches );
64
+			preg_match( '/^' . $gv_modifier . '/ism', $modifier, $matches );
65 65
 
66
-			if( ! empty( $matches ) ) {
66
+			if ( ! empty( $matches ) ) {
67 67
 				// The called method is passed the raw value and the full matches array
68 68
 				$return = self::$method( $raw_value, $matches );
69 69
 				break;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	private static function modifier_timestamp( $raw_value, $matches ) {
89 89
 
90
-		if( empty( $matches[0] ) ) {
90
+		if ( empty( $matches[ 0 ] ) ) {
91 91
 			return $raw_value;
92 92
 		}
93 93
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	private static function modifier_wpautop( $raw_value, $matches ) {
113 113
 
114
-		if( empty( $matches[0] ) || ! function_exists( 'wpautop' ) ) {
114
+		if ( empty( $matches[ 0 ] ) || ! function_exists( 'wpautop' ) ) {
115 115
 			return $raw_value;
116 116
 		}
117 117
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	private static function modifier_maxwords( $raw_value, $matches ) {
137 137
 
138
-		if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) {
138
+		if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) {
139 139
 			return $raw_value;
140 140
 		}
141 141
 
142
-		$max = intval( $matches[1] );
142
+		$max = intval( $matches[ 1 ] );
143 143
 
144 144
 		$more_placeholder = '[GVMORE]';
145 145
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @param  bool             $esc_html     Pass return value through `esc_html()`
172 172
 	 * @return string           Text with variables maybe replaced
173 173
 	 */
174
-	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
174
+	public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
175 175
 
176 176
 		/**
177 177
 		 * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 		 * @internal Fixed $form['title'] in Gravity Forms
197 197
 		 * @see      https://github.com/gravityforms/gravityforms/pull/27/files
198 198
 		 */
199
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
200
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
201
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
199
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
200
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
201
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
202 202
 
203 203
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
204 204
 	}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return mixed
220 220
 	 */
221
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
221
+	public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
222 222
 
223 223
 		/**
224 224
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		 * @see GFCommon::replace_variables_prepopulate()
227 227
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
228 228
 		 */
229
-		if( false === $form ) {
229
+		if ( false === $form ) {
230 230
 			return $text;
231 231
 		}
232 232
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
259 259
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
260 260
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
261
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
261
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
262 262
 		);
263 263
 
264 264
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
322 322
 
323 323
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
324
-		if( empty( $matches ) ) {
324
+		if ( empty( $matches ) ) {
325 325
 			return $text;
326 326
 		}
327 327
 
328 328
 		foreach ( $matches as $match ) {
329 329
 
330
-			$full_tag = $match[0];
331
-			$property = $match[1];
330
+			$full_tag = $match[ 0 ];
331
+			$property = $match[ 1 ];
332 332
 
333 333
 			$value = stripslashes_deep( rgget( $property ) );
334 334
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 			 * @since 1.15
353 353
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
354 354
 			 */
355
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
355
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
356 356
 
357 357
 			$value = $esc_html ? esc_html( $value ) : $value;
358 358
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			 * @param[in] array $form Gravity Forms form array
364 364
 			 * @param[in] array $entry Entry array
365 365
 			 */
366
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
366
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
367 367
 
368 368
 			$text = str_replace( $full_tag, $value, $text );
369 369
 		}
Please login to merge, or discard this patch.