@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param bool $url_encode Whether to URL-encode output |
176 | 176 | * @param bool $esc_html Whether to apply `esc_html()` to output |
177 | 177 | * |
178 | - * @return mixed |
|
178 | + * @return string |
|
179 | 179 | */ |
180 | 180 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
181 | 181 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @since 1.8.4 |
204 | 204 | * |
205 | - * @param array $existing_merge_tags |
|
205 | + * @param array $custom_merge_tags |
|
206 | 206 | * @param int $form_id GF Form ID |
207 | 207 | * @param GF_Field[] $fields Array of fields in the form |
208 | 208 | * @param string $element_id The ID of the input that Merge Tags are being used on |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | * </pre> |
342 | 342 | * |
343 | 343 | * @param [type] $field_options [description] |
344 | - * @param [type] $template_id [description] |
|
345 | - * @param [type] $field_id [description] |
|
346 | - * @param [type] $context [description] |
|
347 | - * @param [type] $input_type [description] |
|
344 | + * @param string $template_id [description] |
|
345 | + * @param string $field_id [description] |
|
346 | + * @param string $context [description] |
|
347 | + * @param string $input_type [description] |
|
348 | 348 | * @return [type] [description] |
349 | 349 | */ |
350 | 350 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @type array |
74 | 74 | * @since 1.15.2 |
75 | 75 | */ |
76 | - var $contexts = array( 'single', 'multiple', 'edit', 'export' ); |
|
76 | + var $contexts = array('single', 'multiple', 'edit', 'export'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @internal Not yet implemented |
@@ -105,23 +105,23 @@ discard block |
||
105 | 105 | /** |
106 | 106 | * If this is a Gravity Forms field, use their labels. Spare our translation team! |
107 | 107 | */ |
108 | - if( ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
108 | + if (!empty($this->_gf_field_class_name) && class_exists($this->_gf_field_class_name)) { |
|
109 | 109 | /** @var GF_Field $GF_Field */ |
110 | 110 | $GF_Field = new $this->_gf_field_class_name; |
111 | 111 | $this->label = $GF_Field->get_form_editor_field_title(); |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Modify the field options based on the name of the field type |
115 | - add_filter( sprintf( 'gravityview_template_%s_options', $this->name ), array( &$this, 'field_options' ), 10, 5 ); |
|
115 | + add_filter(sprintf('gravityview_template_%s_options', $this->name), array(&$this, 'field_options'), 10, 5); |
|
116 | 116 | |
117 | - add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
|
117 | + add_filter('gravityview/sortable/field_blacklist', array($this, '_filter_sortable_fields'), 1); |
|
118 | 118 | |
119 | - if( $this->_custom_merge_tag ) { |
|
120 | - add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
|
121 | - add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
|
119 | + if ($this->_custom_merge_tag) { |
|
120 | + add_filter('gform_custom_merge_tags', array($this, '_filter_gform_custom_merge_tags'), 10, 4); |
|
121 | + add_filter('gform_replace_merge_tags', array($this, '_filter_gform_replace_merge_tags'), 10, 7); |
|
122 | 122 | } |
123 | 123 | |
124 | - GravityView_Fields::register( $this ); |
|
124 | + GravityView_Fields::register($this); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
140 | 140 | */ |
141 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
141 | + public function _filter_gform_replace_merge_tags($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | * @see GFCommon::replace_variables_prepopulate() |
147 | 147 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
148 | 148 | */ |
149 | - if( false === $form ) { |
|
149 | + if (false === $form) { |
|
150 | 150 | return $text; |
151 | 151 | } |
152 | 152 | |
153 | 153 | // Is there is field merge tag? Strip whitespace off the ned, too. |
154 | - preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER ); |
|
154 | + preg_match_all('/{'.preg_quote($this->_custom_merge_tag).':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER); |
|
155 | 155 | |
156 | 156 | // If there are no matches, return original text |
157 | - if ( empty( $matches ) ) { |
|
157 | + if (empty($matches)) { |
|
158 | 158 | return $text; |
159 | 159 | } |
160 | 160 | |
161 | - return $this->replace_merge_tag( $matches, $text, $form, $entry, $url_encode, $esc_html ); |
|
161 | + return $this->replace_merge_tag($matches, $text, $form, $entry, $url_encode, $esc_html); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -177,18 +177,18 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return mixed |
179 | 179 | */ |
180 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
180 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
181 | 181 | |
182 | - foreach( $matches as $match ) { |
|
182 | + foreach ($matches as $match) { |
|
183 | 183 | |
184 | 184 | $full_tag = $match[0]; |
185 | 185 | |
186 | 186 | // Strip the Merge Tags |
187 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
187 | + $tag = str_replace(array('{', '}'), '', $full_tag); |
|
188 | 188 | |
189 | 189 | // Replace the value from the entry, if exists |
190 | - if( isset( $entry[ $tag ] ) ) { |
|
191 | - $text = str_replace( $full_tag, $entry[ $tag ], $text ); |
|
190 | + if (isset($entry[$tag])) { |
|
191 | + $text = str_replace($full_tag, $entry[$tag], $text); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -209,13 +209,13 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @return array Modified merge tags |
211 | 211 | */ |
212 | - public function _filter_gform_custom_merge_tags( $custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '' ) { |
|
212 | + public function _filter_gform_custom_merge_tags($custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '') { |
|
213 | 213 | |
214 | - $form = GVCommon::get_form( $form_id ); |
|
214 | + $form = GVCommon::get_form($form_id); |
|
215 | 215 | |
216 | - $field_merge_tags = $this->custom_merge_tags( $form, $fields ); |
|
216 | + $field_merge_tags = $this->custom_merge_tags($form, $fields); |
|
217 | 217 | |
218 | - return array_merge( $custom_merge_tags, $field_merge_tags ); |
|
218 | + return array_merge($custom_merge_tags, $field_merge_tags); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @return array Merge tag array with `label` and `tag` keys based on class `label` and `_custom_merge_tag` variables |
232 | 232 | */ |
233 | - protected function custom_merge_tags( $form = array(), $fields = array() ) { |
|
233 | + protected function custom_merge_tags($form = array(), $fields = array()) { |
|
234 | 234 | |
235 | 235 | // Use variables to make it unnecessary for other fields to override |
236 | 236 | $merge_tags = array( |
237 | 237 | array( |
238 | 238 | 'label' => $this->label, |
239 | - 'tag' => '{' . $this->_custom_merge_tag . '}', |
|
239 | + 'tag' => '{'.$this->_custom_merge_tag.'}', |
|
240 | 240 | ), |
241 | 241 | ); |
242 | 242 | |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return array |
255 | 255 | */ |
256 | - public function _filter_sortable_fields( $not_sortable ) { |
|
256 | + public function _filter_sortable_fields($not_sortable) { |
|
257 | 257 | |
258 | - if( ! $this->is_sortable ) { |
|
258 | + if (!$this->is_sortable) { |
|
259 | 259 | $not_sortable[] = $this->name; |
260 | 260 | } |
261 | 261 | |
@@ -266,35 +266,35 @@ discard block |
||
266 | 266 | $options = array( |
267 | 267 | 'link_to_post' => array( |
268 | 268 | 'type' => 'checkbox', |
269 | - 'label' => __( 'Link to the post', 'gravityview' ), |
|
270 | - 'desc' => __( 'Link to the post created by the entry.', 'gravityview' ), |
|
269 | + 'label' => __('Link to the post', 'gravityview'), |
|
270 | + 'desc' => __('Link to the post created by the entry.', 'gravityview'), |
|
271 | 271 | 'value' => false, |
272 | 272 | ), |
273 | 273 | 'link_to_term' => array( |
274 | 274 | 'type' => 'checkbox', |
275 | - 'label' => __( 'Link to the category or tag', 'gravityview' ), |
|
276 | - 'desc' => __( 'Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview' ), |
|
275 | + 'label' => __('Link to the category or tag', 'gravityview'), |
|
276 | + 'desc' => __('Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview'), |
|
277 | 277 | 'value' => false, |
278 | 278 | ), |
279 | 279 | 'dynamic_data' => array( |
280 | 280 | 'type' => 'checkbox', |
281 | - 'label' => __( 'Use the live post data', 'gravityview' ), |
|
282 | - 'desc' => __( 'Instead of using the entry data, instead use the current post data.', 'gravityview' ), |
|
281 | + 'label' => __('Use the live post data', 'gravityview'), |
|
282 | + 'desc' => __('Instead of using the entry data, instead use the current post data.', 'gravityview'), |
|
283 | 283 | 'value' => true, |
284 | 284 | ), |
285 | 285 | 'date_display' => array( |
286 | 286 | 'type' => 'text', |
287 | - 'label' => __( 'Override Date Format', 'gravityview' ), |
|
288 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
287 | + 'label' => __('Override Date Format', 'gravityview'), |
|
288 | + 'desc' => sprintf(__('Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>'), |
|
289 | 289 | /** |
290 | 290 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
291 | 291 | * @param[in,out] null|string $date_format Date Format (default: null) |
292 | 292 | */ |
293 | - 'value' => apply_filters( 'gravityview_date_format', null ) |
|
293 | + 'value' => apply_filters('gravityview_date_format', null) |
|
294 | 294 | ), |
295 | 295 | 'new_window' => array( |
296 | 296 | 'type' => 'checkbox', |
297 | - 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
297 | + 'label' => __('Open link in a new tab or window?', 'gravityview'), |
|
298 | 298 | 'value' => false, |
299 | 299 | ), |
300 | 300 | ); |
@@ -303,15 +303,15 @@ discard block |
||
303 | 303 | * @filter `gravityview_field_support_options` Modify the settings that a field supports |
304 | 304 | * @param array $options Options multidimensional array with each key being the input name, with each array setting having `type`, `label`, `desc` and `value` (default values) keys |
305 | 305 | */ |
306 | - return apply_filters( 'gravityview_field_support_options', $options ); |
|
306 | + return apply_filters('gravityview_field_support_options', $options); |
|
307 | 307 | } |
308 | 308 | |
309 | - function add_field_support( $key = '', &$field_options ) { |
|
309 | + function add_field_support($key = '', &$field_options) { |
|
310 | 310 | |
311 | 311 | $options = $this->field_support_options(); |
312 | 312 | |
313 | - if( isset( $options[ $key ] ) ) { |
|
314 | - $field_options[ $key ] = $options[ $key ]; |
|
313 | + if (isset($options[$key])) { |
|
314 | + $field_options[$key] = $options[$key]; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $field_options; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @param [type] $input_type [description] |
348 | 348 | * @return [type] [description] |
349 | 349 | */ |
350 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
350 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
351 | 351 | |
352 | 352 | $this->_field_options = $field_options; |
353 | 353 | $this->_field_id = $field_id; |
@@ -77,7 +77,7 @@ |
||
77 | 77 | /** |
78 | 78 | * Alias for get_instance() |
79 | 79 | * |
80 | - * @param $field_name |
|
80 | + * @param string $field_name |
|
81 | 81 | * |
82 | 82 | * @return GravityView_Field |
83 | 83 | */ |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - public static function register( $field ) { |
|
27 | - if ( ! is_subclass_of( $field, 'GravityView_Field' ) ) { |
|
28 | - throw new Exception( 'Must be a subclass of GravityView_Field' ); |
|
26 | + public static function register($field) { |
|
27 | + if (!is_subclass_of($field, 'GravityView_Field')) { |
|
28 | + throw new Exception('Must be a subclass of GravityView_Field'); |
|
29 | 29 | } |
30 | - if ( empty( $field->name ) ) { |
|
31 | - throw new Exception( 'The name must be set' ); |
|
30 | + if (empty($field->name)) { |
|
31 | + throw new Exception('The name must be set'); |
|
32 | 32 | } |
33 | - if ( isset( self::$_fields[ $field->name ] ) ) { |
|
34 | - throw new Exception( 'Field type already registered: ' . $field->name ); |
|
33 | + if (isset(self::$_fields[$field->name])) { |
|
34 | + throw new Exception('Field type already registered: '.$field->name); |
|
35 | 35 | } |
36 | - self::$_fields[ $field->name ] = $field; |
|
36 | + self::$_fields[$field->name] = $field; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return GravityView_Field | bool |
43 | 43 | */ |
44 | - public static function create( $properties ) { |
|
45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
47 | - if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
|
48 | - return new GravityView_Field( $properties ); |
|
44 | + public static function create($properties) { |
|
45 | + $type = isset($properties['type']) ? $properties['type'] : ''; |
|
46 | + $type = empty($properties['inputType']) ? $type : $properties['inputType']; |
|
47 | + if (empty($type) || !isset(self::$_fields[$type])) { |
|
48 | + return new GravityView_Field($properties); |
|
49 | 49 | } |
50 | - $class = self::$_fields[ $type ]; |
|
51 | - $class_name = get_class( $class ); |
|
52 | - $field = new $class_name( $properties ); |
|
50 | + $class = self::$_fields[$type]; |
|
51 | + $class_name = get_class($class); |
|
52 | + $field = new $class_name($properties); |
|
53 | 53 | |
54 | 54 | return $field; |
55 | 55 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return bool True: yes, it exists; False: nope |
63 | 63 | */ |
64 | - public static function exists( $field_name ) { |
|
65 | - return isset( self::$_fields["{$field_name}"] ); |
|
64 | + public static function exists($field_name) { |
|
65 | + return isset(self::$_fields["{$field_name}"]); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return GravityView_Field |
72 | 72 | */ |
73 | - public static function get_instance( $field_name ) { |
|
74 | - return isset( self::$_fields[ $field_name ] ) ? self::$_fields[ $field_name ] : false; |
|
73 | + public static function get_instance($field_name) { |
|
74 | + return isset(self::$_fields[$field_name]) ? self::$_fields[$field_name] : false; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return GravityView_Field |
83 | 83 | */ |
84 | - public static function get( $field_name ) { |
|
85 | - return self::get_instance( $field_name ); |
|
84 | + public static function get($field_name) { |
|
85 | + return self::get_instance($field_name); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | /** If this file is called directly, abort. */ |
29 | -if ( ! defined( 'ABSPATH' ) ) { |
|
29 | +if (!defined('ABSPATH')) { |
|
30 | 30 | die; |
31 | 31 | } |
32 | 32 | |
@@ -36,52 +36,52 @@ discard block |
||
36 | 36 | * Full path to the GravityView file |
37 | 37 | * @define "GRAVITYVIEW_FILE" "./gravityview.php" |
38 | 38 | */ |
39 | -define( 'GRAVITYVIEW_FILE', __FILE__ ); |
|
39 | +define('GRAVITYVIEW_FILE', __FILE__); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * The URL to this file |
43 | 43 | */ |
44 | -define( 'GRAVITYVIEW_URL', plugin_dir_url( __FILE__ ) ); |
|
44 | +define('GRAVITYVIEW_URL', plugin_dir_url(__FILE__)); |
|
45 | 45 | |
46 | 46 | |
47 | 47 | /** @define "GRAVITYVIEW_DIR" "./" The absolute path to the plugin directory */ |
48 | -define( 'GRAVITYVIEW_DIR', plugin_dir_path( __FILE__ ) ); |
|
48 | +define('GRAVITYVIEW_DIR', plugin_dir_path(__FILE__)); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * GravityView requires at least this version of Gravity Forms to function properly. |
52 | 52 | */ |
53 | -define( 'GV_MIN_GF_VERSION', '1.9.9.10' ); |
|
53 | +define('GV_MIN_GF_VERSION', '1.9.9.10'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * GravityView requires at least this version of WordPress to function properly. |
57 | 57 | * @since 1.12 |
58 | 58 | */ |
59 | -define( 'GV_MIN_WP_VERSION', '3.3' ); |
|
59 | +define('GV_MIN_WP_VERSION', '3.3'); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * GravityView requires at least this version of PHP to function properly. |
63 | 63 | * @since 1.12 |
64 | 64 | */ |
65 | -define( 'GV_MIN_PHP_VERSION', '5.2.4' ); |
|
65 | +define('GV_MIN_PHP_VERSION', '5.2.4'); |
|
66 | 66 | |
67 | 67 | /** Load common & connector functions */ |
68 | -require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
|
69 | -require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
70 | -require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
71 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
|
72 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
|
73 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
|
68 | +require_once(GRAVITYVIEW_DIR.'includes/helper-functions.php'); |
|
69 | +require_once(GRAVITYVIEW_DIR.'includes/class-common.php'); |
|
70 | +require_once(GRAVITYVIEW_DIR.'includes/connector-functions.php'); |
|
71 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-compatibility.php'); |
|
72 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-roles-capabilities.php'); |
|
73 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-admin-notices.php'); |
|
74 | 74 | |
75 | 75 | /** Register Post Types and Rewrite Rules */ |
76 | -require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
76 | +require_once(GRAVITYVIEW_DIR.'includes/class-post-types.php'); |
|
77 | 77 | |
78 | 78 | /** Add Cache Class */ |
79 | -require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
79 | +require_once(GRAVITYVIEW_DIR.'includes/class-cache.php'); |
|
80 | 80 | |
81 | 81 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
82 | -if( is_admin() ) { |
|
83 | - register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) ); |
|
84 | - register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) ); |
|
82 | +if (is_admin()) { |
|
83 | + register_activation_hook(__FILE__, array('GravityView_Plugin', 'activate')); |
|
84 | + register_deactivation_hook(__FILE__, array('GravityView_Plugin', 'deactivate')); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public static function getInstance() { |
102 | 102 | |
103 | - if( empty( self::$instance ) ) { |
|
103 | + if (empty(self::$instance)) { |
|
104 | 104 | self::$instance = new self; |
105 | 105 | } |
106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function __construct() { |
111 | 111 | |
112 | 112 | |
113 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
113 | + if (!GravityView_Compatibility::is_valid()) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | */ |
127 | 127 | private function add_hooks() { |
128 | 128 | // Load plugin text domain |
129 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ), 1 ); |
|
129 | + add_action('init', array($this, 'load_plugin_textdomain'), 1); |
|
130 | 130 | |
131 | 131 | // Load frontend files |
132 | - add_action( 'init', array( $this, 'frontend_actions' ), 20 ); |
|
132 | + add_action('init', array($this, 'frontend_actions'), 20); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -139,48 +139,48 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function include_files() { |
141 | 141 | |
142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
142 | + include_once(GRAVITYVIEW_DIR.'includes/class-admin.php'); |
|
143 | 143 | |
144 | 144 | // Load fields |
145 | - include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-fields.php' ); |
|
146 | - include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
145 | + include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-fields.php'); |
|
146 | + include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field.php'); |
|
147 | 147 | |
148 | 148 | // Load all field files automatically |
149 | - foreach ( glob( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field*.php' ) as $gv_field_filename ) { |
|
150 | - include_once( $gv_field_filename ); |
|
149 | + foreach (glob(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field*.php') as $gv_field_filename) { |
|
150 | + include_once($gv_field_filename); |
|
151 | 151 | } |
152 | 152 | |
153 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
154 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
153 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-notes.php'); |
|
154 | + include_once(GRAVITYVIEW_DIR.'includes/load-plugin-and-theme-hooks.php'); |
|
155 | 155 | |
156 | 156 | // Load Extensions |
157 | 157 | // @todo: Convert to a scan of the directory or a method where this all lives |
158 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
159 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
158 | + include_once(GRAVITYVIEW_DIR.'includes/extensions/edit-entry/class-edit-entry.php'); |
|
159 | + include_once(GRAVITYVIEW_DIR.'includes/extensions/delete-entry/class-delete-entry.php'); |
|
160 | 160 | |
161 | 161 | // Load WordPress Widgets |
162 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
162 | + include_once(GRAVITYVIEW_DIR.'includes/wordpress-widgets/register-wordpress-widgets.php'); |
|
163 | 163 | |
164 | 164 | // Load GravityView Widgets |
165 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
165 | + include_once(GRAVITYVIEW_DIR.'includes/widgets/register-gravityview-widgets.php'); |
|
166 | 166 | |
167 | 167 | // Add oEmbed |
168 | - include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
|
168 | + include_once(GRAVITYVIEW_DIR.'includes/class-oembed.php'); |
|
169 | 169 | |
170 | 170 | // Add logging |
171 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-logging.php' ); |
|
172 | - |
|
173 | - include_once( GRAVITYVIEW_DIR . 'includes/class-ajax.php' ); |
|
174 | - include_once( GRAVITYVIEW_DIR . 'includes/class-settings.php'); |
|
175 | - include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
176 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
|
177 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
|
178 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
179 | - include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
|
180 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
|
181 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
|
182 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gvlogic-shortcode.php' ); |
|
183 | - include_once( GRAVITYVIEW_DIR . 'includes/presets/register-default-templates.php' ); |
|
171 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-logging.php'); |
|
172 | + |
|
173 | + include_once(GRAVITYVIEW_DIR.'includes/class-ajax.php'); |
|
174 | + include_once(GRAVITYVIEW_DIR.'includes/class-settings.php'); |
|
175 | + include_once(GRAVITYVIEW_DIR.'includes/class-frontend-views.php'); |
|
176 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-admin-bar.php'); |
|
177 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-list.php'); |
|
178 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
179 | + include_once(GRAVITYVIEW_DIR.'includes/class-data.php'); |
|
180 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-shortcode.php'); |
|
181 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-link-shortcode.php'); |
|
182 | + include_once(GRAVITYVIEW_DIR.'includes/class-gvlogic-shortcode.php'); |
|
183 | + include_once(GRAVITYVIEW_DIR.'includes/presets/register-default-templates.php'); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return bool |
191 | 191 | */ |
192 | 192 | public static function is_network_activated() { |
193 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
193 | + return is_multisite() && (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('gravityview/gravityview.php')); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | flush_rewrite_rules(); |
213 | 213 | |
214 | 214 | // Update the current GV version |
215 | - update_option( 'gv_version', self::version ); |
|
215 | + update_option('gv_version', self::version); |
|
216 | 216 | |
217 | 217 | // Add the transient to redirect to configuration page |
218 | - set_transient( '_gv_activation_redirect', true, 60 ); |
|
218 | + set_transient('_gv_activation_redirect', true, 60); |
|
219 | 219 | |
220 | 220 | // Clear settings transient |
221 | - delete_transient( 'redux_edd_license_license_valid' ); |
|
221 | + delete_transient('redux_edd_license_license_valid'); |
|
222 | 222 | |
223 | 223 | GravityView_Roles_Capabilities::get_instance()->add_caps(); |
224 | 224 | } |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | * @return void |
245 | 245 | */ |
246 | 246 | public static function include_extension_framework() { |
247 | - if ( ! class_exists( 'GravityView_Extension' ) ) { |
|
248 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-extension.php' ); |
|
247 | + if (!class_exists('GravityView_Extension')) { |
|
248 | + require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-extension.php'); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @since 1.7.5.1 |
256 | 256 | */ |
257 | 257 | public static function include_widget_class() { |
258 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
258 | + include_once(GRAVITYVIEW_DIR.'includes/widgets/class-gravityview-widget.php'); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -267,17 +267,17 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function load_plugin_textdomain() { |
269 | 269 | |
270 | - $loaded = load_plugin_textdomain( 'gravityview', false, '/languages/' ); |
|
271 | - if ( ! $loaded ) { |
|
272 | - $loaded = load_muplugin_textdomain( 'gravityview', '/languages/' ); |
|
270 | + $loaded = load_plugin_textdomain('gravityview', false, '/languages/'); |
|
271 | + if (!$loaded) { |
|
272 | + $loaded = load_muplugin_textdomain('gravityview', '/languages/'); |
|
273 | 273 | } |
274 | - if ( ! $loaded ) { |
|
275 | - $loaded = load_theme_textdomain( 'gravityview', '/languages/' ); |
|
274 | + if (!$loaded) { |
|
275 | + $loaded = load_theme_textdomain('gravityview', '/languages/'); |
|
276 | 276 | } |
277 | - if ( ! $loaded ) { |
|
278 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
|
279 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
280 | - load_textdomain( 'gravityview', $mofile ); |
|
277 | + if (!$loaded) { |
|
278 | + $locale = apply_filters('plugin_locale', get_locale(), 'gravityview'); |
|
279 | + $mofile = dirname(__FILE__).'/languages/gravityview-'.$locale.'.mo'; |
|
280 | + load_textdomain('gravityview', $mofile); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | } |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public static function is_admin() { |
291 | 291 | |
292 | - $doing_ajax = defined( 'DOING_AJAX' ) ? DOING_AJAX : false; |
|
292 | + $doing_ajax = defined('DOING_AJAX') ? DOING_AJAX : false; |
|
293 | 293 | |
294 | - return is_admin() && ! $doing_ajax; |
|
294 | + return is_admin() && !$doing_ajax; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -302,27 +302,27 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function frontend_actions() { |
304 | 304 | |
305 | - if( self::is_admin() ) { return; } |
|
305 | + if (self::is_admin()) { return; } |
|
306 | 306 | |
307 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
|
308 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
309 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
310 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
311 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
|
307 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-image.php'); |
|
308 | + include_once(GRAVITYVIEW_DIR.'includes/class-template.php'); |
|
309 | + include_once(GRAVITYVIEW_DIR.'includes/class-api.php'); |
|
310 | + include_once(GRAVITYVIEW_DIR.'includes/class-frontend-views.php'); |
|
311 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-change-entry-creator.php'); |
|
312 | 312 | |
313 | 313 | |
314 | 314 | /** |
315 | 315 | * When an entry is created, check if we need to update the custom slug meta |
316 | 316 | * todo: move this to its own class.. |
317 | 317 | */ |
318 | - add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
318 | + add_action('gform_entry_created', array('GravityView_API', 'entry_create_custom_slug'), 10, 2); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded |
322 | 322 | * |
323 | 323 | * Nice place to insert extensions' frontend stuff |
324 | 324 | */ |
325 | - do_action( 'gravityview_include_frontend_actions' ); |
|
325 | + do_action('gravityview_include_frontend_actions'); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -332,15 +332,15 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public static function get_default_widget_areas() { |
334 | 334 | $default_areas = array( |
335 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
336 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
335 | + array('1-1' => array(array('areaid' => 'top', 'title' => __('Top', 'gravityview'), 'subtitle' => ''))), |
|
336 | + array('1-2' => array(array('areaid' => 'left', 'title' => __('Left', 'gravityview'), 'subtitle' => '')), '2-2' => array(array('areaid' => 'right', 'title' => __('Right', 'gravityview'), 'subtitle' => ''))), |
|
337 | 337 | ); |
338 | 338 | |
339 | 339 | /** |
340 | 340 | * @filter `gravityview_widget_active_areas` Array of zones available for widgets to be dropped into |
341 | 341 | * @param array $default_areas Definition for default widget areas |
342 | 342 | */ |
343 | - return apply_filters( 'gravityview_widget_active_areas', $default_areas ); |
|
343 | + return apply_filters('gravityview_widget_active_areas', $default_areas); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** DEBUG */ |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | * @param mixed $data Additional data to display |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public static function log_debug( $message, $data = null ){ |
|
354 | + public static function log_debug($message, $data = null) { |
|
355 | 355 | /** |
356 | 356 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
357 | 357 | * @param string $message Message to display |
358 | 358 | * @param mixed $data Supporting data to print alongside it |
359 | 359 | */ |
360 | - do_action( 'gravityview_log_debug', $message, $data ); |
|
360 | + do_action('gravityview_log_debug', $message, $data); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -365,13 +365,13 @@ discard block |
||
365 | 365 | * @param string $message log message |
366 | 366 | * @return void |
367 | 367 | */ |
368 | - public static function log_error( $message, $data = null ){ |
|
368 | + public static function log_error($message, $data = null) { |
|
369 | 369 | /** |
370 | 370 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
371 | 371 | * @param string $message Error message to display |
372 | 372 | * @param mixed $data Supporting data to print alongside it |
373 | 373 | */ |
374 | - do_action( 'gravityview_log_error', $message, $data ); |
|
374 | + do_action('gravityview_log_error', $message, $data); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | } // end class GravityView_Plugin |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | /** If this file is called directly, abort. */ |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if (!defined('ABSPATH')) { |
|
16 | 16 | die; |
17 | 17 | } |
18 | 18 | |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | * @param mixed $form_id |
26 | 26 | * @return mixed False: no form ID specified or Gravity Forms isn't active. Array: Form returned from Gravity Forms |
27 | 27 | */ |
28 | - public static function get_form( $form_id ) { |
|
29 | - if ( empty( $form_id ) ) { |
|
28 | + public static function get_form($form_id) { |
|
29 | + if (empty($form_id)) { |
|
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | 33 | // Only get_form_meta is cached. ::facepalm:: |
34 | - if ( class_exists( 'RGFormsModel' ) ) { |
|
35 | - return GFFormsModel::get_form_meta( $form_id ); |
|
34 | + if (class_exists('RGFormsModel')) { |
|
35 | + return GFFormsModel::get_form_meta($form_id); |
|
36 | 36 | } |
37 | 37 | |
38 | - if ( class_exists( 'GFAPI' ) ) { |
|
39 | - return GFAPI::get_form( $form_id ); |
|
38 | + if (class_exists('GFAPI')) { |
|
39 | + return GFAPI::get_form($form_id); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return false; |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return bool True: user has at least one passed capability; False: user does not have any defined capabilities |
57 | 57 | */ |
58 | - public static function has_cap( $caps = '', $object_id = null, $user_id = null ) { |
|
59 | - return GravityView_Roles_Capabilities::has_cap( $caps, $object_id, $user_id ); |
|
58 | + public static function has_cap($caps = '', $object_id = null, $user_id = null) { |
|
59 | + return GravityView_Roles_Capabilities::has_cap($caps, $object_id, $user_id); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | * @param array|GF_Fields $field Gravity Forms field or array |
68 | 68 | * @return array Array version of $field |
69 | 69 | */ |
70 | - public static function get_field_array( $field ) { |
|
70 | + public static function get_field_array($field) { |
|
71 | 71 | |
72 | - if ( class_exists( 'GF_Fields' ) ) { |
|
72 | + if (class_exists('GF_Fields')) { |
|
73 | 73 | |
74 | - $field_object = GF_Fields::create( $field ); |
|
74 | + $field_object = GF_Fields::create($field); |
|
75 | 75 | |
76 | 76 | // Convert the field object in 1.9 to an array for backward compatibility |
77 | - $field_array = get_object_vars( $field_object ); |
|
77 | + $field_array = get_object_vars($field_object); |
|
78 | 78 | |
79 | 79 | } else { |
80 | 80 | $field_array = $field; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return array Array of Views as `WP_Post`. Empty array if none found. |
95 | 95 | */ |
96 | - public static function get_all_views( $args = array() ) { |
|
96 | + public static function get_all_views($args = array()) { |
|
97 | 97 | |
98 | 98 | $default_params = array( |
99 | 99 | 'post_type' => 'gravityview', |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | 'post_status' => 'publish', |
102 | 102 | ); |
103 | 103 | |
104 | - $params = wp_parse_args( $args, $default_params ); |
|
104 | + $params = wp_parse_args($args, $default_params); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @filter `gravityview/get_all_views/params` Modify the parameters sent to get all views. |
108 | 108 | * @param[in,out] array $params Array of parameters to pass to `get_posts()` |
109 | 109 | */ |
110 | - $views_params = apply_filters( 'gravityview/get_all_views/params', $params ); |
|
110 | + $views_params = apply_filters('gravityview/get_all_views/params', $params); |
|
111 | 111 | |
112 | - $views = get_posts( $views_params ); |
|
112 | + $views = get_posts($views_params); |
|
113 | 113 | |
114 | 114 | return $views; |
115 | 115 | } |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | * @param int|string $entry_slug Entry slug |
121 | 121 | * @return array Gravity Forms form array |
122 | 122 | */ |
123 | - public static function get_form_from_entry_id( $entry_slug ) { |
|
123 | + public static function get_form_from_entry_id($entry_slug) { |
|
124 | 124 | |
125 | - $entry = self::get_entry( $entry_slug, true ); |
|
125 | + $entry = self::get_entry($entry_slug, true); |
|
126 | 126 | |
127 | - $form = self::get_form( $entry['form_id'] ); |
|
127 | + $form = self::get_form($entry['form_id']); |
|
128 | 128 | |
129 | 129 | return $form; |
130 | 130 | } |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return bool|GF_Field[] |
140 | 140 | */ |
141 | - public static function has_product_field( $form = array() ) { |
|
141 | + public static function has_product_field($form = array()) { |
|
142 | 142 | |
143 | - $product_fields = apply_filters( 'gform_product_field_types', array( 'option', 'quantity', 'product', 'total', 'shipping', 'calculation', 'price' ) ); |
|
143 | + $product_fields = apply_filters('gform_product_field_types', array('option', 'quantity', 'product', 'total', 'shipping', 'calculation', 'price')); |
|
144 | 144 | |
145 | - $fields = GFAPI::get_fields_by_type( $form, $product_fields ); |
|
145 | + $fields = GFAPI::get_fields_by_type($form, $product_fields); |
|
146 | 146 | |
147 | - return empty( $fields ) ? false : $fields; |
|
147 | + return empty($fields) ? false : $fields; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param string $slug The entry slug, as returned by GravityView_API::get_entry_slug() |
155 | 155 | * @return int|null The entry ID, if exists; `NULL` if not |
156 | 156 | */ |
157 | - public static function get_entry_id_from_slug( $slug ) { |
|
157 | + public static function get_entry_id_from_slug($slug) { |
|
158 | 158 | global $wpdb; |
159 | 159 | |
160 | 160 | $search_criteria = array( |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | 'page_size' => 1, |
174 | 174 | ); |
175 | 175 | |
176 | - $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); |
|
176 | + $results = GFAPI::get_entries(0, $search_criteria, null, $paging); |
|
177 | 177 | |
178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
178 | + $result = (!empty($results) && !empty($results[0]['id'])) ? $results[0]['id'] : null; |
|
179 | 179 | |
180 | 180 | return $result; |
181 | 181 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public static function get_forms() { |
192 | 192 | $forms = array(); |
193 | - if ( class_exists( 'GFAPI' ) ) { |
|
193 | + if (class_exists('GFAPI')) { |
|
194 | 194 | $gf_forms = GFAPI::get_forms(); |
195 | - foreach ( $gf_forms as $form ) { |
|
195 | + foreach ($gf_forms as $form) { |
|
196 | 196 | $forms[] = array( |
197 | 197 | 'id' => $form['id'], |
198 | 198 | 'title' => $form['title'], |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | * @param string|array $form_id (default: '') or $form object |
210 | 210 | * @return array |
211 | 211 | */ |
212 | - public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) { |
|
212 | + public static function get_form_fields($form = '', $add_default_properties = false, $include_parent_field = true) { |
|
213 | 213 | |
214 | - if ( ! is_array( $form ) ) { |
|
215 | - $form = self::get_form( $form ); |
|
214 | + if (!is_array($form)) { |
|
215 | + $form = self::get_form($form); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | $fields = array(); |
@@ -222,56 +222,56 @@ discard block |
||
222 | 222 | $has_poll_fields = false; |
223 | 223 | |
224 | 224 | // If GF_Field exists, we're using GF 1.9+, where add_default_properties has been deprecated. |
225 | - if ( false === class_exists( 'GF_Field' ) && $add_default_properties ) { |
|
226 | - $form = RGFormsModel::add_default_properties( $form ); |
|
225 | + if (false === class_exists('GF_Field') && $add_default_properties) { |
|
226 | + $form = RGFormsModel::add_default_properties($form); |
|
227 | 227 | } |
228 | 228 | |
229 | - if ( $form ) { |
|
230 | - foreach ( $form['fields'] as $field ) { |
|
231 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
232 | - $fields[ $field['id'] ] = array( |
|
233 | - 'label' => rgar( $field, 'label' ), |
|
229 | + if ($form) { |
|
230 | + foreach ($form['fields'] as $field) { |
|
231 | + if ($include_parent_field || empty($field['inputs'])) { |
|
232 | + $fields[$field['id']] = array( |
|
233 | + 'label' => rgar($field, 'label'), |
|
234 | 234 | 'parent' => null, |
235 | - 'type' => rgar( $field, 'type' ), |
|
236 | - 'adminLabel' => rgar( $field, 'adminLabel' ), |
|
237 | - 'adminOnly' => rgar( $field, 'adminOnly' ), |
|
235 | + 'type' => rgar($field, 'type'), |
|
236 | + 'adminLabel' => rgar($field, 'adminLabel'), |
|
237 | + 'adminOnly' => rgar($field, 'adminOnly'), |
|
238 | 238 | ); |
239 | 239 | } |
240 | 240 | |
241 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
242 | - foreach ( $field['inputs'] as $input ) { |
|
241 | + if ($add_default_properties && !empty($field['inputs'])) { |
|
242 | + foreach ($field['inputs'] as $input) { |
|
243 | 243 | /** |
244 | 244 | * @hack |
245 | 245 | * In case of email/email confirmation, the input for email has the same id as the parent field |
246 | 246 | */ |
247 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
247 | + if ('email' == rgar($field, 'type') && false === strpos($input['id'], '.')) { |
|
248 | 248 | continue; |
249 | 249 | } |
250 | - $fields[ (string)$input['id'] ] = array( |
|
251 | - 'label' => rgar( $input, 'label' ), |
|
252 | - 'customLabel' => rgar( $input, 'customLabel' ), |
|
250 | + $fields[(string)$input['id']] = array( |
|
251 | + 'label' => rgar($input, 'label'), |
|
252 | + 'customLabel' => rgar($input, 'customLabel'), |
|
253 | 253 | 'parent' => $field, |
254 | - 'type' => rgar( $field, 'type' ), |
|
255 | - 'adminLabel' => rgar( $field, 'adminLabel' ), |
|
256 | - 'adminOnly' => rgar( $field, 'adminOnly' ), |
|
254 | + 'type' => rgar($field, 'type'), |
|
255 | + 'adminLabel' => rgar($field, 'adminLabel'), |
|
256 | + 'adminOnly' => rgar($field, 'adminOnly'), |
|
257 | 257 | ); |
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | 261 | /** @since 1.14 */ |
262 | - if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) { |
|
262 | + if ('list' === $field['type'] && !empty($field['enableColumns'])) { |
|
263 | 263 | |
264 | - foreach ( (array)$field['choices'] as $key => $input ) { |
|
264 | + foreach ((array)$field['choices'] as $key => $input) { |
|
265 | 265 | |
266 | - $input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key} |
|
266 | + $input_id = sprintf('%d.%d', $field['id'], $key); // {field_id}.{column_key} |
|
267 | 267 | |
268 | - $fields[ $input_id ] = array( |
|
269 | - 'label' => rgar( $input, 'text' ), |
|
268 | + $fields[$input_id] = array( |
|
269 | + 'label' => rgar($input, 'text'), |
|
270 | 270 | 'customLabel' => '', |
271 | 271 | 'parent' => $field, |
272 | - 'type' => rgar( $field, 'type' ), |
|
273 | - 'adminLabel' => rgar( $field, 'adminLabel' ), |
|
274 | - 'adminOnly' => rgar( $field, 'adminOnly' ), |
|
272 | + 'type' => rgar($field, 'type'), |
|
273 | + 'adminLabel' => rgar($field, 'adminLabel'), |
|
274 | + 'adminOnly' => rgar($field, 'adminOnly'), |
|
275 | 275 | ); |
276 | 276 | } |
277 | 277 | } |
@@ -279,27 +279,27 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * @since 1.8 |
281 | 281 | */ |
282 | - if( 'quiz' === $field['type'] ) { |
|
282 | + if ('quiz' === $field['type']) { |
|
283 | 283 | $has_quiz_fields = true; |
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
287 | 287 | * @since 1.8 |
288 | 288 | */ |
289 | - if( 'poll' === $field['type'] ) { |
|
289 | + if ('poll' === $field['type']) { |
|
290 | 290 | $has_poll_fields = true; |
291 | 291 | } |
292 | 292 | |
293 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
293 | + if (GFCommon::is_product_field($field['type'])) { |
|
294 | 294 | $has_product_fields = true; |
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
298 | 298 | * @hack Version 1.9 |
299 | 299 | */ |
300 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; |
|
300 | + $field_for_is_post_field = class_exists('GF_Fields') ? (object)$field : (array)$field; |
|
301 | 301 | |
302 | - if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { |
|
302 | + if (GFCommon::is_post_field($field_for_is_post_field)) { |
|
303 | 303 | $has_post_fields = true; |
304 | 304 | } |
305 | 305 | } |
@@ -308,47 +308,47 @@ discard block |
||
308 | 308 | /** |
309 | 309 | * @since 1.7 |
310 | 310 | */ |
311 | - if ( $has_post_fields ) { |
|
311 | + if ($has_post_fields) { |
|
312 | 312 | $fields['post_id'] = array( |
313 | - 'label' => __( 'Post ID', 'gravityview' ), |
|
313 | + 'label' => __('Post ID', 'gravityview'), |
|
314 | 314 | 'type' => 'post_id', |
315 | 315 | ); |
316 | 316 | } |
317 | 317 | |
318 | - if ( $has_product_fields ) { |
|
318 | + if ($has_product_fields) { |
|
319 | 319 | |
320 | 320 | $fields['payment_status'] = array( |
321 | - 'label' => __( 'Payment Status', 'gravityview' ), |
|
321 | + 'label' => __('Payment Status', 'gravityview'), |
|
322 | 322 | 'type' => 'payment_status', |
323 | 323 | ); |
324 | 324 | |
325 | 325 | $fields['payment_date'] = array( |
326 | - 'label' => __( 'Payment Date', 'gravityview' ), |
|
326 | + 'label' => __('Payment Date', 'gravityview'), |
|
327 | 327 | 'type' => 'payment_date', |
328 | 328 | ); |
329 | 329 | |
330 | 330 | $fields['payment_amount'] = array( |
331 | - 'label' => __( 'Payment Amount', 'gravityview' ), |
|
331 | + 'label' => __('Payment Amount', 'gravityview'), |
|
332 | 332 | 'type' => 'payment_amount', |
333 | 333 | ); |
334 | 334 | |
335 | 335 | $fields['payment_method'] = array( |
336 | - 'label' => __( 'Payment Method', 'gravityview' ), |
|
336 | + 'label' => __('Payment Method', 'gravityview'), |
|
337 | 337 | 'type' => 'payment_method', |
338 | 338 | ); |
339 | 339 | |
340 | 340 | $fields['is_fulfilled'] = array( |
341 | - 'label' => __( 'Is Fulfilled', 'gravityview' ), |
|
341 | + 'label' => __('Is Fulfilled', 'gravityview'), |
|
342 | 342 | 'type' => 'is_fulfilled', |
343 | 343 | ); |
344 | 344 | |
345 | 345 | $fields['transaction_id'] = array( |
346 | - 'label' => __( 'Transaction ID', 'gravityview' ), |
|
346 | + 'label' => __('Transaction ID', 'gravityview'), |
|
347 | 347 | 'type' => 'transaction_id', |
348 | 348 | ); |
349 | 349 | |
350 | 350 | $fields['transaction_type'] = array( |
351 | - 'label' => __( 'Transaction Type', 'gravityview' ), |
|
351 | + 'label' => __('Transaction Type', 'gravityview'), |
|
352 | 352 | 'type' => 'transaction_type', |
353 | 353 | ); |
354 | 354 | |
@@ -357,27 +357,27 @@ discard block |
||
357 | 357 | /** |
358 | 358 | * @since 1.8 |
359 | 359 | */ |
360 | - if( $has_quiz_fields ) { |
|
360 | + if ($has_quiz_fields) { |
|
361 | 361 | |
362 | - $fields['gquiz_score'] = array( |
|
363 | - 'label' => __( 'Quiz Score Total', 'gravityview' ), |
|
362 | + $fields['gquiz_score'] = array( |
|
363 | + 'label' => __('Quiz Score Total', 'gravityview'), |
|
364 | 364 | 'type' => 'quiz_score', |
365 | - 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
|
365 | + 'desc' => __('Displays the number of correct Quiz answers the user submitted.', 'gravityview'), |
|
366 | 366 | ); |
367 | 367 | $fields['gquiz_percent'] = array( |
368 | - 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
|
368 | + 'label' => __('Quiz Percentage Grade', 'gravityview'), |
|
369 | 369 | 'type' => 'quiz_percent', |
370 | - 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
|
370 | + 'desc' => __('Displays the percentage of correct Quiz answers the user submitted.', 'gravityview'), |
|
371 | 371 | ); |
372 | - $fields['gquiz_grade'] = array( |
|
373 | - 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
|
372 | + $fields['gquiz_grade'] = array( |
|
373 | + 'label' => __('Quiz Letter Grade', 'gravityview'), |
|
374 | 374 | 'type' => 'quiz_grade', |
375 | - 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
|
375 | + 'desc' => __('Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview'), |
|
376 | 376 | ); |
377 | 377 | $fields['gquiz_is_pass'] = array( |
378 | - 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
|
378 | + 'label' => __('Quiz Pass/Fail', 'gravityview'), |
|
379 | 379 | 'type' => 'quiz_is_pass', |
380 | - 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
|
380 | + 'desc' => __('Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview'), |
|
381 | 381 | ); |
382 | 382 | } |
383 | 383 | |
@@ -390,15 +390,15 @@ discard block |
||
390 | 390 | * @param string $form_id (default: '') |
391 | 391 | * @return array |
392 | 392 | */ |
393 | - public static function get_entry_meta( $form_id, $only_default_column = true ) { |
|
393 | + public static function get_entry_meta($form_id, $only_default_column = true) { |
|
394 | 394 | |
395 | - $extra_fields = GFFormsModel::get_entry_meta( $form_id ); |
|
395 | + $extra_fields = GFFormsModel::get_entry_meta($form_id); |
|
396 | 396 | |
397 | 397 | $fields = array(); |
398 | 398 | |
399 | - foreach ( $extra_fields as $key => $field ){ |
|
400 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
401 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
399 | + foreach ($extra_fields as $key => $field) { |
|
400 | + if (!empty($only_default_column) && !empty($field['is_default_column'])) { |
|
401 | + $fields[$key] = array('label' => $field['label'], 'type' => 'entry_meta'); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
@@ -414,13 +414,13 @@ discard block |
||
414 | 414 | * @since 1.1.6 |
415 | 415 | * @return array|void Array of entry IDs. Void if Gravity Forms isn't active. |
416 | 416 | */ |
417 | - public static function get_entry_ids( $form_id, $search_criteria = array() ) { |
|
417 | + public static function get_entry_ids($form_id, $search_criteria = array()) { |
|
418 | 418 | |
419 | - if ( ! class_exists( 'GFFormsModel' ) ) { |
|
419 | + if (!class_exists('GFFormsModel')) { |
|
420 | 420 | return; |
421 | 421 | } |
422 | 422 | |
423 | - return GFFormsModel::search_lead_ids( $form_id, $search_criteria ); |
|
423 | + return GFFormsModel::search_lead_ids($form_id, $search_criteria); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -432,33 +432,33 @@ discard block |
||
432 | 432 | * @param array $form_ids array Gravity Forms form IDs |
433 | 433 | * @return array |
434 | 434 | */ |
435 | - public static function calculate_get_entries_criteria( $passed_criteria = array(), $form_ids = array() ) { |
|
435 | + public static function calculate_get_entries_criteria($passed_criteria = array(), $form_ids = array()) { |
|
436 | 436 | |
437 | 437 | $search_criteria_defaults = array( |
438 | 438 | 'search_criteria' => null, |
439 | 439 | 'sorting' => null, |
440 | 440 | 'paging' => null, |
441 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
441 | + 'cache' => (isset($passed_criteria['cache']) ? $passed_criteria['cache'] : true), |
|
442 | 442 | ); |
443 | 443 | |
444 | - $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
|
444 | + $criteria = wp_parse_args($passed_criteria, $search_criteria_defaults); |
|
445 | 445 | |
446 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
447 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
446 | + if (!empty($criteria['search_criteria']['field_filters'])) { |
|
447 | + foreach ($criteria['search_criteria']['field_filters'] as &$filter) { |
|
448 | 448 | |
449 | - if ( ! is_array( $filter ) ) { |
|
449 | + if (!is_array($filter)) { |
|
450 | 450 | continue; |
451 | 451 | } |
452 | 452 | |
453 | 453 | // By default, we want searches to be wildcard for each field. |
454 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
454 | + $filter['operator'] = empty($filter['operator']) ? 'contains' : $filter['operator']; |
|
455 | 455 | |
456 | 456 | /** |
457 | 457 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
458 | 458 | * @param string $operator Existing search operator |
459 | 459 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
460 | 460 | */ |
461 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
461 | + $filter['operator'] = apply_filters('gravityview_search_operator', $filter['operator'], $filter); |
|
462 | 462 | } |
463 | 463 | } |
464 | 464 | |
@@ -466,32 +466,32 @@ discard block |
||
466 | 466 | * Prepare date formats to be in Gravity Forms DB format; |
467 | 467 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
468 | 468 | */ |
469 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
469 | + foreach (array('start_date', 'end_date') as $key) { |
|
470 | 470 | |
471 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
471 | + if (!empty($criteria['search_criteria'][$key])) { |
|
472 | 472 | |
473 | 473 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
474 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
474 | + $date = date_create($criteria['search_criteria'][$key]); |
|
475 | 475 | |
476 | - if ( $date ) { |
|
476 | + if ($date) { |
|
477 | 477 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
478 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
478 | + $criteria['search_criteria'][$key] = $date->format('Y-m-d H:i:s'); |
|
479 | 479 | } else { |
480 | 480 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
481 | - unset( $criteria['search_criteria'][ $key ] ); |
|
481 | + unset($criteria['search_criteria'][$key]); |
|
482 | 482 | |
483 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
483 | + do_action('gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][$key]); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
488 | 488 | |
489 | 489 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
490 | - if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
|
490 | + if (class_exists('GravityView_View_Data') && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry()) { |
|
491 | 491 | $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
492 | - } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
|
493 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
|
494 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
492 | + } elseif ('delete' === RGForms::get('action')) { |
|
493 | + $criteria['context_view_id'] = isset($_GET['view_id']) ? $_GET['view_id'] : null; |
|
494 | + } elseif (!isset($criteria['context_view_id'])) { |
|
495 | 495 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
496 | 496 | $criteria['context_view_id'] = null; |
497 | 497 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param array $form_ids Forms to search |
503 | 503 | * @param int $view_id ID of the view being used to search |
504 | 504 | */ |
505 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
505 | + $criteria = apply_filters('gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id']); |
|
506 | 506 | |
507 | 507 | return (array)$criteria; |
508 | 508 | |
@@ -520,35 +520,35 @@ discard block |
||
520 | 520 | * @param mixed &$total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate the total count. (default: null) |
521 | 521 | * @return mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays |
522 | 522 | */ |
523 | - public static function get_entries( $form_ids = null, $passed_criteria = null, &$total = null ) { |
|
523 | + public static function get_entries($form_ids = null, $passed_criteria = null, &$total = null) { |
|
524 | 524 | |
525 | 525 | // Filter the criteria before query (includes Adv Filter) |
526 | - $criteria = self::calculate_get_entries_criteria( $passed_criteria, $form_ids ); |
|
526 | + $criteria = self::calculate_get_entries_criteria($passed_criteria, $form_ids); |
|
527 | 527 | |
528 | - do_action( 'gravityview_log_debug', '[gravityview_get_entries] Final Parameters', $criteria ); |
|
528 | + do_action('gravityview_log_debug', '[gravityview_get_entries] Final Parameters', $criteria); |
|
529 | 529 | |
530 | 530 | // Return value |
531 | 531 | $return = null; |
532 | 532 | |
533 | 533 | /** Reduce # of database calls */ |
534 | - add_filter( 'gform_is_encrypted_field', '__return_false' ); |
|
534 | + add_filter('gform_is_encrypted_field', '__return_false'); |
|
535 | 535 | |
536 | - if ( ! empty( $criteria['cache'] ) ) { |
|
536 | + if (!empty($criteria['cache'])) { |
|
537 | 537 | |
538 | - $Cache = new GravityView_Cache( $form_ids, $criteria ); |
|
538 | + $Cache = new GravityView_Cache($form_ids, $criteria); |
|
539 | 539 | |
540 | - if ( $entries = $Cache->get() ) { |
|
540 | + if ($entries = $Cache->get()) { |
|
541 | 541 | |
542 | 542 | // Still update the total count when using cached results |
543 | - if ( ! is_null( $total ) ) { |
|
544 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
543 | + if (!is_null($total)) { |
|
544 | + $total = GFAPI::count_entries($form_ids, $criteria['search_criteria']); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | $return = $entries; |
548 | 548 | } |
549 | 549 | } |
550 | 550 | |
551 | - if ( is_null( $return ) && class_exists( 'GFAPI' ) && ( is_numeric( $form_ids ) || is_array( $form_ids ) ) ) { |
|
551 | + if (is_null($return) && class_exists('GFAPI') && (is_numeric($form_ids) || is_array($form_ids))) { |
|
552 | 552 | |
553 | 553 | /** |
554 | 554 | * @filter `gravityview_pre_get_entries` Define entries to be used before GFAPI::get_entries() is called |
@@ -558,24 +558,24 @@ discard block |
||
558 | 558 | * @param array $passed_criteria The original search criteria passed to `GVCommon::get_entries()` |
559 | 559 | * @param int|null $total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate |
560 | 560 | */ |
561 | - $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
|
561 | + $entries = apply_filters('gravityview_before_get_entries', null, $criteria, $passed_criteria, $total); |
|
562 | 562 | |
563 | 563 | // No entries returned from gravityview_before_get_entries |
564 | - if( is_null( $entries ) ) { |
|
564 | + if (is_null($entries)) { |
|
565 | 565 | |
566 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
566 | + $entries = GFAPI::get_entries($form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total); |
|
567 | 567 | |
568 | - if ( is_wp_error( $entries ) ) { |
|
569 | - do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
|
568 | + if (is_wp_error($entries)) { |
|
569 | + do_action('gravityview_log_error', $entries->get_error_message(), $entries); |
|
570 | 570 | |
571 | 571 | return false; |
572 | 572 | } |
573 | 573 | } |
574 | 574 | |
575 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
575 | + if (!empty($criteria['cache']) && isset($Cache)) { |
|
576 | 576 | |
577 | 577 | // Cache results |
578 | - $Cache->set( $entries, 'entries' ); |
|
578 | + $Cache->set($entries, 'entries'); |
|
579 | 579 | |
580 | 580 | } |
581 | 581 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | } |
584 | 584 | |
585 | 585 | /** Remove filter added above */ |
586 | - remove_filter( 'gform_is_encrypted_field', '__return_false' ); |
|
586 | + remove_filter('gform_is_encrypted_field', '__return_false'); |
|
587 | 587 | |
588 | 588 | /** |
589 | 589 | * @filter `gravityview_entries` Modify the array of entries returned to GravityView after it has been fetched from the cache or from `GFAPI::get_entries()`. |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | * @param array $passed_criteria The original search criteria passed to `GVCommon::get_entries()` |
593 | 593 | * @param int|null $total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate |
594 | 594 | */ |
595 | - $return = apply_filters( 'gravityview_entries', $return, $criteria, $passed_criteria, $total ); |
|
595 | + $return = apply_filters('gravityview_entries', $return, $criteria, $passed_criteria, $total); |
|
596 | 596 | |
597 | 597 | return $return; |
598 | 598 | } |
@@ -609,15 +609,15 @@ discard block |
||
609 | 609 | * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true. {@since 1.14} |
610 | 610 | * @return array|boolean |
611 | 611 | */ |
612 | - public static function get_entry( $entry_slug, $force_allow_ids = false, $check_entry_display = true ) { |
|
612 | + public static function get_entry($entry_slug, $force_allow_ids = false, $check_entry_display = true) { |
|
613 | 613 | |
614 | - if ( class_exists( 'GFAPI' ) && ! empty( $entry_slug ) ) { |
|
614 | + if (class_exists('GFAPI') && !empty($entry_slug)) { |
|
615 | 615 | |
616 | 616 | /** |
617 | 617 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
618 | 618 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
619 | 619 | */ |
620 | - $custom_slug = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
620 | + $custom_slug = apply_filters('gravityview_custom_entry_slug', false); |
|
621 | 621 | |
622 | 622 | /** |
623 | 623 | * @filter `gravityview_custom_entry_slug_allow_id` When using a custom slug, allow access to the entry using the original slug (the Entry ID). |
@@ -625,38 +625,38 @@ discard block |
||
625 | 625 | * - If enabled, you could access using the custom slug OR the entry id (example: `/entry/custom-slug/` OR `/entry/123/`) |
626 | 626 | * @param boolean $custom_slug_id_access True: allow accessing the slug by ID; False: only use the slug passed to the method. |
627 | 627 | */ |
628 | - $custom_slug_id_access = $force_allow_ids || apply_filters( 'gravityview_custom_entry_slug_allow_id', false ); |
|
628 | + $custom_slug_id_access = $force_allow_ids || apply_filters('gravityview_custom_entry_slug_allow_id', false); |
|
629 | 629 | |
630 | 630 | /** |
631 | 631 | * If we're using custom entry slugs, we do a meta value search |
632 | 632 | * instead of doing a straightup ID search. |
633 | 633 | */ |
634 | - if ( $custom_slug ) { |
|
634 | + if ($custom_slug) { |
|
635 | 635 | |
636 | - $entry_id = self::get_entry_id_from_slug( $entry_slug ); |
|
636 | + $entry_id = self::get_entry_id_from_slug($entry_slug); |
|
637 | 637 | |
638 | 638 | } |
639 | 639 | |
640 | 640 | // If custom slug is off, search using the entry ID |
641 | 641 | // ID allow ID access is on, also use entry ID as a backup |
642 | - if ( empty( $custom_slug ) || ! empty( $custom_slug_id_access ) ) { |
|
642 | + if (empty($custom_slug) || !empty($custom_slug_id_access)) { |
|
643 | 643 | // Search for IDs matching $entry_slug |
644 | 644 | $entry_id = $entry_slug; |
645 | 645 | } |
646 | 646 | |
647 | - if ( empty( $entry_id ) ) { |
|
647 | + if (empty($entry_id)) { |
|
648 | 648 | return false; |
649 | 649 | } |
650 | 650 | |
651 | 651 | // fetch the entry |
652 | - $entry = GFAPI::get_entry( $entry_id ); |
|
652 | + $entry = GFAPI::get_entry($entry_id); |
|
653 | 653 | |
654 | - if( $check_entry_display ) { |
|
654 | + if ($check_entry_display) { |
|
655 | 655 | // Is the entry allowed |
656 | - $entry = self::check_entry_display( $entry ); |
|
656 | + $entry = self::check_entry_display($entry); |
|
657 | 657 | } |
658 | 658 | |
659 | - return is_wp_error( $entry ) ? false : $entry; |
|
659 | + return is_wp_error($entry) ? false : $entry; |
|
660 | 660 | |
661 | 661 | } |
662 | 662 | |
@@ -680,51 +680,51 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @return bool True: matches, false: not matches |
682 | 682 | */ |
683 | - public static function matches_operation( $val1, $val2, $operation ) { |
|
683 | + public static function matches_operation($val1, $val2, $operation) { |
|
684 | 684 | |
685 | 685 | $value = false; |
686 | 686 | |
687 | - if( 'context' === $val1 ) { |
|
687 | + if ('context' === $val1) { |
|
688 | 688 | |
689 | - $matching_contexts = array( $val2 ); |
|
689 | + $matching_contexts = array($val2); |
|
690 | 690 | |
691 | 691 | // We allow for non-standard contexts. |
692 | - switch( $val2 ) { |
|
692 | + switch ($val2) { |
|
693 | 693 | // Check for either single or edit |
694 | 694 | case 'singular': |
695 | - $matching_contexts = array( 'single', 'edit' ); |
|
695 | + $matching_contexts = array('single', 'edit'); |
|
696 | 696 | break; |
697 | 697 | // Use multiple as alias for directory for consistency |
698 | 698 | case 'multiple': |
699 | - $matching_contexts = array( 'directory' ); |
|
699 | + $matching_contexts = array('directory'); |
|
700 | 700 | break; |
701 | 701 | } |
702 | 702 | |
703 | - $val1 = in_array( gravityview_get_context(), $matching_contexts ) ? $val2 : false; |
|
703 | + $val1 = in_array(gravityview_get_context(), $matching_contexts) ? $val2 : false; |
|
704 | 704 | } |
705 | 705 | |
706 | - switch ( $operation ) { |
|
706 | + switch ($operation) { |
|
707 | 707 | case 'equals': |
708 | - $value = GFFormsModel::matches_operation( $val1, $val2, 'is' ); |
|
708 | + $value = GFFormsModel::matches_operation($val1, $val2, 'is'); |
|
709 | 709 | break; |
710 | 710 | case 'greater_than_or_is': |
711 | 711 | case 'greater_than_or_equals': |
712 | - $is = GFFormsModel::matches_operation( $val1, $val2, 'is' ); |
|
713 | - $gt = GFFormsModel::matches_operation( $val1, $val2, 'greater_than' ); |
|
714 | - $value = ( $is || $gt ); |
|
712 | + $is = GFFormsModel::matches_operation($val1, $val2, 'is'); |
|
713 | + $gt = GFFormsModel::matches_operation($val1, $val2, 'greater_than'); |
|
714 | + $value = ($is || $gt); |
|
715 | 715 | break; |
716 | 716 | case 'less_than_or_is': |
717 | 717 | case 'less_than_or_equals': |
718 | - $is = GFFormsModel::matches_operation( $val1, $val2, 'is' ); |
|
719 | - $gt = GFFormsModel::matches_operation( $val1, $val2, 'less_than' ); |
|
720 | - $value = ( $is || $gt ); |
|
718 | + $is = GFFormsModel::matches_operation($val1, $val2, 'is'); |
|
719 | + $gt = GFFormsModel::matches_operation($val1, $val2, 'less_than'); |
|
720 | + $value = ($is || $gt); |
|
721 | 721 | break; |
722 | 722 | case 'not_contains': |
723 | - $contains = GFFormsModel::matches_operation( $val1, $val2, 'contains' ); |
|
724 | - $value = ! $contains; |
|
723 | + $contains = GFFormsModel::matches_operation($val1, $val2, 'contains'); |
|
724 | + $value = !$contains; |
|
725 | 725 | break; |
726 | 726 | default: |
727 | - $value = GFFormsModel::matches_operation( $val1, $val2, $operation ); |
|
727 | + $value = GFFormsModel::matches_operation($val1, $val2, $operation); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | return $value; |
@@ -742,41 +742,41 @@ discard block |
||
742 | 742 | * @param array $entry Gravity Forms Entry object |
743 | 743 | * @return bool|array Returns 'false' if entry is not valid according to the view search filters (Adv Filter) |
744 | 744 | */ |
745 | - public static function check_entry_display( $entry ) { |
|
745 | + public static function check_entry_display($entry) { |
|
746 | 746 | |
747 | - if ( ! $entry || is_wp_error( $entry ) ) { |
|
748 | - do_action( 'gravityview_log_debug', __METHOD__ . ' Entry was not found.', $entry ); |
|
747 | + if (!$entry || is_wp_error($entry)) { |
|
748 | + do_action('gravityview_log_debug', __METHOD__.' Entry was not found.', $entry); |
|
749 | 749 | return false; |
750 | 750 | } |
751 | 751 | |
752 | - if ( empty( $entry['form_id'] ) ) { |
|
753 | - do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
|
752 | + if (empty($entry['form_id'])) { |
|
753 | + do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry); |
|
754 | 754 | return false; |
755 | 755 | } |
756 | 756 | |
757 | 757 | $criteria = self::calculate_get_entries_criteria(); |
758 | 758 | |
759 | 759 | // Make sure the current View is connected to the same form as the Entry |
760 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
761 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
762 | - $context_form_id = gravityview_get_form_id( $context_view_id ); |
|
763 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
764 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
760 | + if (!empty($criteria['context_view_id'])) { |
|
761 | + $context_view_id = intval($criteria['context_view_id']); |
|
762 | + $context_form_id = gravityview_get_form_id($context_view_id); |
|
763 | + if (intval($context_form_id) !== intval($entry['form_id'])) { |
|
764 | + do_action('gravityview_log_debug', sprintf('[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id']), $criteria['context_view_id']); |
|
765 | 765 | return false; |
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
769 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
770 | - do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
|
769 | + if (empty($criteria['search_criteria']) || !is_array($criteria['search_criteria'])) { |
|
770 | + do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria); |
|
771 | 771 | return $entry; |
772 | 772 | } |
773 | 773 | |
774 | 774 | $search_criteria = $criteria['search_criteria']; |
775 | - unset( $criteria ); |
|
775 | + unset($criteria); |
|
776 | 776 | |
777 | 777 | // check entry status |
778 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
779 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
778 | + if (array_key_exists('status', $search_criteria) && $search_criteria['status'] != $entry['status']) { |
|
779 | + do_action('gravityview_log_debug', sprintf('[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status']), $search_criteria); |
|
780 | 780 | return false; |
781 | 781 | } |
782 | 782 | |
@@ -784,53 +784,53 @@ discard block |
||
784 | 784 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
785 | 785 | |
786 | 786 | // field_filters |
787 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
788 | - do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
|
787 | + if (empty($search_criteria['field_filters']) || !is_array($search_criteria['field_filters'])) { |
|
788 | + do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria); |
|
789 | 789 | return $entry; |
790 | 790 | } |
791 | 791 | |
792 | 792 | $filters = $search_criteria['field_filters']; |
793 | - unset( $search_criteria ); |
|
793 | + unset($search_criteria); |
|
794 | 794 | |
795 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
796 | - unset( $filters['mode'] ); |
|
795 | + $mode = array_key_exists('mode', $filters) ? strtolower($filters['mode']) : 'all'; |
|
796 | + unset($filters['mode']); |
|
797 | 797 | |
798 | - $form = self::get_form( $entry['form_id'] ); |
|
798 | + $form = self::get_form($entry['form_id']); |
|
799 | 799 | |
800 | - foreach ( $filters as $filter ) { |
|
800 | + foreach ($filters as $filter) { |
|
801 | 801 | |
802 | - if ( ! isset( $filter['key'] ) ) { |
|
802 | + if (!isset($filter['key'])) { |
|
803 | 803 | continue; |
804 | 804 | } |
805 | 805 | |
806 | 806 | $k = $filter['key']; |
807 | 807 | |
808 | - if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
|
809 | - $field_value = $entry[ $k ]; |
|
808 | + if (in_array($k, array('created_by', 'payment_status'))) { |
|
809 | + $field_value = $entry[$k]; |
|
810 | 810 | $field = null; |
811 | 811 | } else { |
812 | - $field = self::get_field( $form, $k ); |
|
813 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
812 | + $field = self::get_field($form, $k); |
|
813 | + $field_value = GFFormsModel::get_lead_field_value($entry, $field); |
|
814 | 814 | } |
815 | 815 | |
816 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
817 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
816 | + $operator = isset($filter['operator']) ? strtolower($filter['operator']) : 'is'; |
|
817 | + $is_value_match = GFFormsModel::is_value_match($field_value, $filter['value'], $operator, $field); |
|
818 | 818 | |
819 | 819 | // verify if we are already free to go! |
820 | - if ( ! $is_value_match && 'all' === $mode ) { |
|
821 | - do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed one criteria for ALL mode', $filter ); |
|
820 | + if (!$is_value_match && 'all' === $mode) { |
|
821 | + do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed one criteria for ALL mode', $filter); |
|
822 | 822 | return false; |
823 | - } elseif ( $is_value_match && 'any' === $mode ) { |
|
823 | + } elseif ($is_value_match && 'any' === $mode) { |
|
824 | 824 | return $entry; |
825 | 825 | } |
826 | 826 | } |
827 | 827 | |
828 | 828 | // at this point, if in ALL mode, then entry is approved - all conditions were met. |
829 | 829 | // Or, for ANY mode, means none of the conditions were satisfied, so entry is not approved |
830 | - if ( 'all' === $mode ) { |
|
830 | + if ('all' === $mode) { |
|
831 | 831 | return $entry; |
832 | 832 | } else { |
833 | - do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters ); |
|
833 | + do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters); |
|
834 | 834 | return false; |
835 | 835 | } |
836 | 836 | |
@@ -845,14 +845,14 @@ discard block |
||
845 | 845 | * @param string $field_id |
846 | 846 | * @return string |
847 | 847 | */ |
848 | - public static function get_field_label( $form = array(), $field_id = '' ) { |
|
848 | + public static function get_field_label($form = array(), $field_id = '') { |
|
849 | 849 | |
850 | - if ( empty( $form ) || empty( $field_id ) ) { |
|
850 | + if (empty($form) || empty($field_id)) { |
|
851 | 851 | return ''; |
852 | 852 | } |
853 | 853 | |
854 | - $field = self::get_field( $form, $field_id ); |
|
855 | - return isset( $field['label'] ) ? $field['label'] : ''; |
|
854 | + $field = self::get_field($form, $field_id); |
|
855 | + return isset($field['label']) ? $field['label'] : ''; |
|
856 | 856 | |
857 | 857 | } |
858 | 858 | |
@@ -869,9 +869,9 @@ discard block |
||
869 | 869 | * @param string|int $field_id |
870 | 870 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
871 | 871 | */ |
872 | - public static function get_field( $form, $field_id ) { |
|
873 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
874 | - return GFFormsModel::get_field( $form, $field_id ); |
|
872 | + public static function get_field($form, $field_id) { |
|
873 | + if (class_exists('GFFormsModel')) { |
|
874 | + return GFFormsModel::get_field($form, $field_id); |
|
875 | 875 | } else { |
876 | 876 | return null; |
877 | 877 | } |
@@ -887,16 +887,16 @@ discard block |
||
887 | 887 | * @param WP_Post $post WordPress post object |
888 | 888 | * @return boolean True: yep, GravityView; No: not! |
889 | 889 | */ |
890 | - public static function has_gravityview_shortcode( $post = null ) { |
|
891 | - if ( ! is_a( $post, 'WP_Post' ) ) { |
|
890 | + public static function has_gravityview_shortcode($post = null) { |
|
891 | + if (!is_a($post, 'WP_Post')) { |
|
892 | 892 | return false; |
893 | 893 | } |
894 | 894 | |
895 | - if ( 'gravityview' === get_post_type( $post ) ) { |
|
895 | + if ('gravityview' === get_post_type($post)) { |
|
896 | 896 | return true; |
897 | 897 | } |
898 | 898 | |
899 | - return self::has_shortcode_r( $post->post_content, 'gravityview' ) ? true : false; |
|
899 | + return self::has_shortcode_r($post->post_content, 'gravityview') ? true : false; |
|
900 | 900 | |
901 | 901 | } |
902 | 902 | |
@@ -907,27 +907,27 @@ discard block |
||
907 | 907 | * @param string $content Content to check whether there's a shortcode |
908 | 908 | * @param string $tag Current shortcode tag |
909 | 909 | */ |
910 | - public static function has_shortcode_r( $content, $tag = 'gravityview' ) { |
|
911 | - if ( false === strpos( $content, '[' ) ) { |
|
910 | + public static function has_shortcode_r($content, $tag = 'gravityview') { |
|
911 | + if (false === strpos($content, '[')) { |
|
912 | 912 | return false; |
913 | 913 | } |
914 | 914 | |
915 | - if ( shortcode_exists( $tag ) ) { |
|
915 | + if (shortcode_exists($tag)) { |
|
916 | 916 | |
917 | 917 | $shortcodes = array(); |
918 | 918 | |
919 | - preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
|
920 | - if ( empty( $matches ) ){ |
|
919 | + preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER); |
|
920 | + if (empty($matches)) { |
|
921 | 921 | return false; |
922 | 922 | } |
923 | 923 | |
924 | - foreach ( $matches as $shortcode ) { |
|
925 | - if ( $tag === $shortcode[2] ) { |
|
924 | + foreach ($matches as $shortcode) { |
|
925 | + if ($tag === $shortcode[2]) { |
|
926 | 926 | |
927 | 927 | // Changed this to $shortcode instead of true so we get the parsed atts. |
928 | 928 | $shortcodes[] = $shortcode; |
929 | 929 | |
930 | - } else if ( isset( $shortcode[5] ) && $result = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
930 | + } else if (isset($shortcode[5]) && $result = self::has_shortcode_r($shortcode[5], $tag)) { |
|
931 | 931 | $shortcodes = $result; |
932 | 932 | } |
933 | 933 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | * |
952 | 952 | * @return array Array with view details, as returned by get_posts() |
953 | 953 | */ |
954 | - public static function get_connected_views( $form_id, $args = array() ) { |
|
954 | + public static function get_connected_views($form_id, $args = array()) { |
|
955 | 955 | |
956 | 956 | $defaults = array( |
957 | 957 | 'post_type' => 'gravityview', |
@@ -960,9 +960,9 @@ discard block |
||
960 | 960 | 'meta_value' => (int)$form_id, |
961 | 961 | ); |
962 | 962 | |
963 | - $args = wp_parse_args( $args, $defaults ); |
|
963 | + $args = wp_parse_args($args, $defaults); |
|
964 | 964 | |
965 | - $views = get_posts( $args ); |
|
965 | + $views = get_posts($args); |
|
966 | 966 | |
967 | 967 | return $views; |
968 | 968 | } |
@@ -974,8 +974,8 @@ discard block |
||
974 | 974 | * |
975 | 975 | * @return string ID of the connected Form, if exists. Empty string if not. |
976 | 976 | */ |
977 | - public static function get_meta_form_id( $view_id ) { |
|
978 | - return get_post_meta( $view_id, '_gravityview_form_id', true ); |
|
977 | + public static function get_meta_form_id($view_id) { |
|
978 | + return get_post_meta($view_id, '_gravityview_form_id', true); |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | /** |
@@ -987,8 +987,8 @@ discard block |
||
987 | 987 | * |
988 | 988 | * @return string GravityView_Template::template_id value. Empty string if not. |
989 | 989 | */ |
990 | - public static function get_meta_template_id( $view_id ) { |
|
991 | - return get_post_meta( $view_id, '_gravityview_directory_template', true ); |
|
990 | + public static function get_meta_template_id($view_id) { |
|
991 | + return get_post_meta($view_id, '_gravityview_directory_template', true); |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | |
@@ -999,15 +999,15 @@ discard block |
||
999 | 999 | * @param int $post_id View ID |
1000 | 1000 | * @return array Associative array of settings with plugin defaults used if not set by the View |
1001 | 1001 | */ |
1002 | - public static function get_template_settings( $post_id ) { |
|
1002 | + public static function get_template_settings($post_id) { |
|
1003 | 1003 | |
1004 | - $settings = get_post_meta( $post_id, '_gravityview_template_settings', true ); |
|
1004 | + $settings = get_post_meta($post_id, '_gravityview_template_settings', true); |
|
1005 | 1005 | |
1006 | - if ( class_exists( 'GravityView_View_Data' ) ) { |
|
1006 | + if (class_exists('GravityView_View_Data')) { |
|
1007 | 1007 | |
1008 | 1008 | $defaults = GravityView_View_Data::get_default_args(); |
1009 | 1009 | |
1010 | - return wp_parse_args( (array)$settings, $defaults ); |
|
1010 | + return wp_parse_args((array)$settings, $defaults); |
|
1011 | 1011 | |
1012 | 1012 | } |
1013 | 1013 | |
@@ -1024,12 +1024,12 @@ discard block |
||
1024 | 1024 | * @param string $key Key for the setting |
1025 | 1025 | * @return mixed|null Setting value, or NULL if not set. |
1026 | 1026 | */ |
1027 | - public static function get_template_setting( $post_id, $key ) { |
|
1027 | + public static function get_template_setting($post_id, $key) { |
|
1028 | 1028 | |
1029 | - $settings = self::get_template_settings( $post_id ); |
|
1029 | + $settings = self::get_template_settings($post_id); |
|
1030 | 1030 | |
1031 | - if ( isset( $settings[ $key ] ) ) { |
|
1032 | - return $settings[ $key ]; |
|
1031 | + if (isset($settings[$key])) { |
|
1032 | + return $settings[$key]; |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | return null; |
@@ -1065,8 +1065,8 @@ discard block |
||
1065 | 1065 | * @param int $post_id View ID |
1066 | 1066 | * @return array Multi-array of fields with first level being the field zones. See code comment. |
1067 | 1067 | */ |
1068 | - public static function get_directory_fields( $post_id ) { |
|
1069 | - return get_post_meta( $post_id, '_gravityview_directory_fields', true ); |
|
1068 | + public static function get_directory_fields($post_id) { |
|
1069 | + return get_post_meta($post_id, '_gravityview_directory_fields', true); |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | |
@@ -1077,25 +1077,25 @@ discard block |
||
1077 | 1077 | * @param int $formid Form ID |
1078 | 1078 | * @return string html |
1079 | 1079 | */ |
1080 | - public static function get_sortable_fields( $formid, $current = '' ) { |
|
1081 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1080 | + public static function get_sortable_fields($formid, $current = '') { |
|
1081 | + $output = '<option value="" '.selected('', $current, false).'>'.esc_html__('Default', 'gravityview').'</option>'; |
|
1082 | 1082 | |
1083 | - if ( empty( $formid ) ) { |
|
1083 | + if (empty($formid)) { |
|
1084 | 1084 | return $output; |
1085 | 1085 | } |
1086 | 1086 | |
1087 | - $fields = self::get_sortable_fields_array( $formid ); |
|
1087 | + $fields = self::get_sortable_fields_array($formid); |
|
1088 | 1088 | |
1089 | - if ( ! empty( $fields ) ) { |
|
1089 | + if (!empty($fields)) { |
|
1090 | 1090 | |
1091 | - $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
|
1091 | + $blacklist_field_types = apply_filters('gravityview_blacklist_field_types', array('list', 'textarea'), null); |
|
1092 | 1092 | |
1093 | - foreach ( $fields as $id => $field ) { |
|
1094 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1093 | + foreach ($fields as $id => $field) { |
|
1094 | + if (in_array($field['type'], $blacklist_field_types)) { |
|
1095 | 1095 | continue; |
1096 | 1096 | } |
1097 | 1097 | |
1098 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1098 | + $output .= '<option value="'.$id.'" '.selected($id, $current, false).'>'.esc_attr($field['label']).'</option>'; |
|
1099 | 1099 | } |
1100 | 1100 | } |
1101 | 1101 | |
@@ -1113,27 +1113,27 @@ discard block |
||
1113 | 1113 | * |
1114 | 1114 | * @return array |
1115 | 1115 | */ |
1116 | - public static function get_sortable_fields_array( $formid, $blacklist = array( 'list', 'textarea' ) ) { |
|
1116 | + public static function get_sortable_fields_array($formid, $blacklist = array('list', 'textarea')) { |
|
1117 | 1117 | |
1118 | 1118 | // Get fields with sub-inputs and no parent |
1119 | - $fields = self::get_form_fields( $formid, true, false ); |
|
1119 | + $fields = self::get_form_fields($formid, true, false); |
|
1120 | 1120 | |
1121 | 1121 | $date_created = array( |
1122 | 1122 | 'date_created' => array( |
1123 | 1123 | 'type' => 'date_created', |
1124 | - 'label' => __( 'Date Created', 'gravityview' ), |
|
1124 | + 'label' => __('Date Created', 'gravityview'), |
|
1125 | 1125 | ), |
1126 | 1126 | ); |
1127 | 1127 | |
1128 | 1128 | $fields = $date_created + $fields; |
1129 | 1129 | |
1130 | - $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
|
1130 | + $blacklist_field_types = apply_filters('gravityview_blacklist_field_types', $blacklist, NULL); |
|
1131 | 1131 | |
1132 | 1132 | // TODO: Convert to using array_filter |
1133 | - foreach( $fields as $id => $field ) { |
|
1133 | + foreach ($fields as $id => $field) { |
|
1134 | 1134 | |
1135 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1136 | - unset( $fields[ $id ] ); |
|
1135 | + if (in_array($field['type'], $blacklist_field_types)) { |
|
1136 | + unset($fields[$id]); |
|
1137 | 1137 | } |
1138 | 1138 | } |
1139 | 1139 | |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | * @param array $fields Sub-set of GF form fields that are sortable |
1144 | 1144 | * @param int $formid The Gravity Forms form ID that the fields are from |
1145 | 1145 | */ |
1146 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1146 | + $fields = apply_filters('gravityview/common/sortable_fields', $fields, $formid); |
|
1147 | 1147 | |
1148 | 1148 | return $fields; |
1149 | 1149 | } |
@@ -1154,15 +1154,15 @@ discard block |
||
1154 | 1154 | * @param mixed $field_id Field ID or Field array |
1155 | 1155 | * @return string field type |
1156 | 1156 | */ |
1157 | - public static function get_field_type( $form = null, $field_id = '' ) { |
|
1157 | + public static function get_field_type($form = null, $field_id = '') { |
|
1158 | 1158 | |
1159 | - if ( ! empty( $field_id ) && ! is_array( $field_id ) ) { |
|
1160 | - $field = self::get_field( $form, $field_id ); |
|
1159 | + if (!empty($field_id) && !is_array($field_id)) { |
|
1160 | + $field = self::get_field($form, $field_id); |
|
1161 | 1161 | } else { |
1162 | 1162 | $field = $field_id; |
1163 | 1163 | } |
1164 | 1164 | |
1165 | - return class_exists( 'RGFormsModel' ) ? RGFormsModel::get_input_type( $field ) : ''; |
|
1165 | + return class_exists('RGFormsModel') ? RGFormsModel::get_input_type($field) : ''; |
|
1166 | 1166 | |
1167 | 1167 | } |
1168 | 1168 | |
@@ -1173,17 +1173,17 @@ discard block |
||
1173 | 1173 | * @param int|array $field field key or field array |
1174 | 1174 | * @return boolean |
1175 | 1175 | */ |
1176 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1176 | + public static function is_field_numeric($form = null, $field = '') { |
|
1177 | 1177 | |
1178 | - if ( ! is_array( $form ) && ! is_array( $field ) ) { |
|
1179 | - $form = self::get_form( $form ); |
|
1178 | + if (!is_array($form) && !is_array($field)) { |
|
1179 | + $form = self::get_form($form); |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | // If entry meta, it's a string. Otherwise, numeric |
1183 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1183 | + if (!is_numeric($field) && is_string($field)) { |
|
1184 | 1184 | $type = $field; |
1185 | 1185 | } else { |
1186 | - $type = self::get_field_type( $form, $field ); |
|
1186 | + $type = self::get_field_type($form, $field); |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | /** |
@@ -1191,16 +1191,16 @@ discard block |
||
1191 | 1191 | * @since 1.5.2 |
1192 | 1192 | * @param array $numeric_types Fields that are numeric. Default: `[ number, time ]` |
1193 | 1193 | */ |
1194 | - $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
|
1194 | + $numeric_types = apply_filters('gravityview/common/numeric_types', array('number', 'time')); |
|
1195 | 1195 | |
1196 | 1196 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1197 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1198 | - if( true === $gv_field->is_numeric ) { |
|
1197 | + if ($gv_field = GravityView_Fields::get($type)) { |
|
1198 | + if (true === $gv_field->is_numeric) { |
|
1199 | 1199 | $numeric_types[] = $gv_field->is_numeric; |
1200 | 1200 | } |
1201 | 1201 | } |
1202 | 1202 | |
1203 | - $return = in_array( $type, $numeric_types ); |
|
1203 | + $return = in_array($type, $numeric_types); |
|
1204 | 1204 | |
1205 | 1205 | return $return; |
1206 | 1206 | } |
@@ -1219,19 +1219,19 @@ discard block |
||
1219 | 1219 | * |
1220 | 1220 | * @return string Content, encrypted |
1221 | 1221 | */ |
1222 | - public static function js_encrypt( $content, $message = '' ) { |
|
1222 | + public static function js_encrypt($content, $message = '') { |
|
1223 | 1223 | |
1224 | 1224 | $output = $content; |
1225 | 1225 | |
1226 | - if ( ! class_exists( 'StandalonePHPEnkoder' ) ) { |
|
1227 | - include_once( GRAVITYVIEW_DIR . 'includes/lib/standalone-phpenkoder/StandalonePHPEnkoder.php' ); |
|
1226 | + if (!class_exists('StandalonePHPEnkoder')) { |
|
1227 | + include_once(GRAVITYVIEW_DIR.'includes/lib/standalone-phpenkoder/StandalonePHPEnkoder.php'); |
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( class_exists( 'StandalonePHPEnkoder' ) ) { |
|
1230 | + if (class_exists('StandalonePHPEnkoder')) { |
|
1231 | 1231 | |
1232 | 1232 | $enkoder = new StandalonePHPEnkoder; |
1233 | 1233 | |
1234 | - $message = empty( $message ) ? __( 'Email hidden; Javascript is required.', 'gravityview' ) : $message; |
|
1234 | + $message = empty($message) ? __('Email hidden; Javascript is required.', 'gravityview') : $message; |
|
1235 | 1235 | |
1236 | 1236 | /** |
1237 | 1237 | * @filter `gravityview/phpenkoder/msg` Modify the message shown when Javascript is disabled and an encrypted email field is displayed |
@@ -1239,9 +1239,9 @@ discard block |
||
1239 | 1239 | * @param string $message Existing message |
1240 | 1240 | * @param string $content Content to encrypt |
1241 | 1241 | */ |
1242 | - $enkoder->enkode_msg = apply_filters( 'gravityview/phpenkoder/msg', $message, $content ); |
|
1242 | + $enkoder->enkode_msg = apply_filters('gravityview/phpenkoder/msg', $message, $content); |
|
1243 | 1243 | |
1244 | - $output = $enkoder->enkode( $content ); |
|
1244 | + $output = $enkoder->enkode($content); |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | return $output; |
@@ -1258,25 +1258,25 @@ discard block |
||
1258 | 1258 | * |
1259 | 1259 | * @author rubo77 at https://gist.github.com/rubo77/6821632 |
1260 | 1260 | **/ |
1261 | - public static function gv_parse_str( $string, &$result ) { |
|
1262 | - if ( empty( $string ) ) { |
|
1261 | + public static function gv_parse_str($string, &$result) { |
|
1262 | + if (empty($string)) { |
|
1263 | 1263 | return false; |
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | $result = array(); |
1267 | 1267 | |
1268 | 1268 | // find the pairs "name=value" |
1269 | - $pairs = explode( '&', $string ); |
|
1269 | + $pairs = explode('&', $string); |
|
1270 | 1270 | |
1271 | - foreach ( $pairs as $pair ) { |
|
1271 | + foreach ($pairs as $pair) { |
|
1272 | 1272 | // use the original parse_str() on each element |
1273 | - parse_str( $pair, $params ); |
|
1273 | + parse_str($pair, $params); |
|
1274 | 1274 | |
1275 | - $k = key( $params ); |
|
1276 | - if ( ! isset( $result[ $k ] ) ) { |
|
1275 | + $k = key($params); |
|
1276 | + if (!isset($result[$k])) { |
|
1277 | 1277 | $result += $params; |
1278 | - } elseif ( array_key_exists( $k, $params ) && is_array( $params[ $k ] ) ) { |
|
1279 | - $result[ $k ] = self::array_merge_recursive_distinct( $result[ $k ], $params[ $k ] ); |
|
1278 | + } elseif (array_key_exists($k, $params) && is_array($params[$k])) { |
|
1279 | + $result[$k] = self::array_merge_recursive_distinct($result[$k], $params[$k]); |
|
1280 | 1280 | } |
1281 | 1281 | } |
1282 | 1282 | return true; |
@@ -1298,7 +1298,7 @@ discard block |
||
1298 | 1298 | * |
1299 | 1299 | * @return string HTML output of anchor link. If empty $href, returns NULL |
1300 | 1300 | */ |
1301 | - public static function get_link_html( $href = '', $anchor_text = '', $atts = array() ) { |
|
1301 | + public static function get_link_html($href = '', $anchor_text = '', $atts = array()) { |
|
1302 | 1302 | |
1303 | 1303 | // Supported attributes for anchor tags. HREF left out intentionally. |
1304 | 1304 | $allowed_atts = array( |
@@ -1334,31 +1334,31 @@ discard block |
||
1334 | 1334 | * @filter `gravityview/get_link/allowed_atts` Modify the attributes that are allowed to be used in generating links |
1335 | 1335 | * @param array $allowed_atts Array of attributes allowed |
1336 | 1336 | */ |
1337 | - $allowed_atts = apply_filters( 'gravityview/get_link/allowed_atts', $allowed_atts ); |
|
1337 | + $allowed_atts = apply_filters('gravityview/get_link/allowed_atts', $allowed_atts); |
|
1338 | 1338 | |
1339 | 1339 | // Make sure the attributes are formatted as array |
1340 | - $passed_atts = wp_parse_args( $atts ); |
|
1340 | + $passed_atts = wp_parse_args($atts); |
|
1341 | 1341 | |
1342 | 1342 | // Make sure the allowed attributes are only the ones in the $allowed_atts list |
1343 | - $final_atts = shortcode_atts( $allowed_atts, $passed_atts ); |
|
1343 | + $final_atts = shortcode_atts($allowed_atts, $passed_atts); |
|
1344 | 1344 | |
1345 | 1345 | // Remove attributes with empty values |
1346 | - $final_atts = array_filter( $final_atts ); |
|
1346 | + $final_atts = array_filter($final_atts); |
|
1347 | 1347 | |
1348 | 1348 | // If the href wasn't passed as an attribute, use the value passed to the function |
1349 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1349 | + if (empty($final_atts['href']) && !empty($href)) { |
|
1350 | 1350 | $final_atts['href'] = $href; |
1351 | 1351 | } |
1352 | 1352 | |
1353 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1353 | + $final_atts['href'] = esc_url_raw($href); |
|
1354 | 1354 | |
1355 | 1355 | // For each attribute, generate the code |
1356 | 1356 | $output = ''; |
1357 | - foreach ( $final_atts as $attr => $value ) { |
|
1358 | - $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
|
1357 | + foreach ($final_atts as $attr => $value) { |
|
1358 | + $output .= sprintf(' %s="%s"', $attr, esc_attr($value)); |
|
1359 | 1359 | } |
1360 | 1360 | |
1361 | - $output = '<a'. $output .'>'. $anchor_text .'</a>'; |
|
1361 | + $output = '<a'.$output.'>'.$anchor_text.'</a>'; |
|
1362 | 1362 | |
1363 | 1363 | return $output; |
1364 | 1364 | } |
@@ -1377,14 +1377,14 @@ discard block |
||
1377 | 1377 | * @author Daniel <daniel (at) danielsmedegaardbuus (dot) dk> |
1378 | 1378 | * @author Gabriel Sobrinho <gabriel (dot) sobrinho (at) gmail (dot) com> |
1379 | 1379 | */ |
1380 | - public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
|
1380 | + public static function array_merge_recursive_distinct(array &$array1, array &$array2) { |
|
1381 | 1381 | $merged = $array1; |
1382 | 1382 | |
1383 | - foreach ( $array2 as $key => &$value ) { |
|
1384 | - if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
|
1385 | - $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
|
1383 | + foreach ($array2 as $key => &$value) { |
|
1384 | + if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { |
|
1385 | + $merged[$key] = self::array_merge_recursive_distinct($merged[$key], $value); |
|
1386 | 1386 | } else { |
1387 | - $merged[ $key ] = $value; |
|
1387 | + $merged[$key] = $value; |
|
1388 | 1388 | } |
1389 | 1389 | } |
1390 | 1390 | |
@@ -1398,26 +1398,26 @@ discard block |
||
1398 | 1398 | * @param array $args Arguments to modify the user query. See get_users() {@since 1.14} |
1399 | 1399 | * @return array Array of WP_User objects. |
1400 | 1400 | */ |
1401 | - public static function get_users( $context = 'change_entry_creator', $args = array() ) { |
|
1401 | + public static function get_users($context = 'change_entry_creator', $args = array()) { |
|
1402 | 1402 | |
1403 | 1403 | $default_args = array( |
1404 | 1404 | 'number' => 2000, |
1405 | 1405 | 'orderby' => 'display_name', |
1406 | 1406 | 'order' => 'ASC', |
1407 | - 'fields' => array( 'ID', 'display_name', 'user_login', 'user_nicename' ) |
|
1407 | + 'fields' => array('ID', 'display_name', 'user_login', 'user_nicename') |
|
1408 | 1408 | ); |
1409 | 1409 | |
1410 | 1410 | // Merge in the passed arg |
1411 | - $get_users_settings = wp_parse_args( $args, $default_args ); |
|
1411 | + $get_users_settings = wp_parse_args($args, $default_args); |
|
1412 | 1412 | |
1413 | 1413 | /** |
1414 | 1414 | * @filter `gravityview/get_users/{$context}` There are issues with too many users using [get_users()](http://codex.wordpress.org/Function_Reference/get_users) where it breaks the select. We try to keep it at a reasonable number. \n |
1415 | 1415 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1416 | 1416 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1417 | 1417 | */ |
1418 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1418 | + $get_users_settings = apply_filters('gravityview/get_users/'.$context, apply_filters('gravityview_change_entry_creator_user_parameters', $get_users_settings)); |
|
1419 | 1419 | |
1420 | - return get_users( $get_users_settings ); |
|
1420 | + return get_users($get_users_settings); |
|
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | |
@@ -1429,8 +1429,8 @@ discard block |
||
1429 | 1429 | * |
1430 | 1430 | * @return string |
1431 | 1431 | */ |
1432 | - public static function generate_notice( $notice, $class = '' ) { |
|
1433 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1432 | + public static function generate_notice($notice, $class = '') { |
|
1433 | + return '<div class="gv-notice '.gravityview_sanitize_html_class($class).'">'.$notice.'</div>'; |
|
1434 | 1434 | } |
1435 | 1435 | |
1436 | 1436 | |
@@ -1452,6 +1452,6 @@ discard block |
||
1452 | 1452 | * |
1453 | 1453 | * @return string HTML output of anchor link. If empty $href, returns NULL |
1454 | 1454 | */ |
1455 | -function gravityview_get_link( $href = '', $anchor_text = '', $atts = array() ) { |
|
1456 | - return GVCommon::get_link_html( $href, $anchor_text, $atts ); |
|
1455 | +function gravityview_get_link($href = '', $anchor_text = '', $atts = array()) { |
|
1456 | + return GVCommon::get_link_html($href, $anchor_text, $atts); |
|
1457 | 1457 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | private function add_hooks() { |
21 | 21 | |
22 | 22 | /** @see GFCommon::replace_variables_prepopulate **/ |
23 | - add_filter( 'gform_replace_merge_tags', array( 'GravityView_Merge_Tags', 'replace_gv_merge_tags' ), 10, 7 ); |
|
23 | + add_filter('gform_replace_merge_tags', array('GravityView_Merge_Tags', 'replace_gv_merge_tags'), 10, 7); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param bool $esc_html Pass return value through `esc_html()` |
42 | 42 | * @return string Text with variables maybe replaced |
43 | 43 | */ |
44 | - public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
44 | + public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true) { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param[in] array $form GF Form array |
54 | 54 | * @param[in] array $entry GF Entry array |
55 | 55 | */ |
56 | - $do_replace_variables = apply_filters( 'gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry ); |
|
56 | + $do_replace_variables = apply_filters('gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry); |
|
57 | 57 | |
58 | - if ( strpos( $text, '{' ) === false || ! $do_replace_variables ) { |
|
58 | + if (strpos($text, '{') === false || !$do_replace_variables) { |
|
59 | 59 | return $text; |
60 | 60 | } |
61 | 61 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @internal Reported to GF Support on 12/3 |
66 | 66 | */ |
67 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
68 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
69 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
67 | + $form['title'] = isset($form['title']) ? $form['title'] : ''; |
|
68 | + $form['id'] = isset($form['id']) ? $form['id'] : ''; |
|
69 | + $form['fields'] = isset($form['fields']) ? $form['fields'] : array(); |
|
70 | 70 | |
71 | - return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html ); |
|
71 | + return GFCommon::replace_variables($text, $form, $entry, $url_encode, $esc_html); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
89 | + public static function replace_gv_merge_tags($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -94,52 +94,52 @@ discard block |
||
94 | 94 | * @see GFCommon::replace_variables_prepopulate() |
95 | 95 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
96 | 96 | */ |
97 | - if( false === $form ) { |
|
97 | + if (false === $form) { |
|
98 | 98 | return $text; |
99 | 99 | } |
100 | 100 | |
101 | - $text = self::replace_get_variables( $text, $form, $entry, $url_encode ); |
|
101 | + $text = self::replace_get_variables($text, $form, $entry, $url_encode); |
|
102 | 102 | |
103 | 103 | return $text; |
104 | 104 | } |
105 | 105 | |
106 | - public static function format_date( $date_created, $full_tag, $property ) { |
|
106 | + public static function format_date($date_created, $full_tag, $property) { |
|
107 | 107 | |
108 | - $site_date_format = get_option( 'date_format' ); |
|
108 | + $site_date_format = get_option('date_format'); |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Gravity Forms code to adjust date to locally-configured Time Zone |
112 | 112 | * @see GFCommon::format_date() |
113 | 113 | */ |
114 | - $entry_gmt_time = mysql2date( 'G', $date_created ); |
|
115 | - $entry_local_timestamp = GFCommon::get_local_timestamp( $entry_gmt_time ); |
|
114 | + $entry_gmt_time = mysql2date('G', $date_created); |
|
115 | + $entry_local_timestamp = GFCommon::get_local_timestamp($entry_gmt_time); |
|
116 | 116 | |
117 | 117 | // Expand all modifiers, skipping escaped colons. str_replace worked better than preg_split( "/(?<!\\):/" ) |
118 | - $exploded = explode( ':', str_replace( '\:', '|COLON|', $property ) ); |
|
118 | + $exploded = explode(':', str_replace('\:', '|COLON|', $property)); |
|
119 | 119 | |
120 | - $is_human = in_array( 'human', $exploded ); // {date_created:human} |
|
121 | - $is_diff = in_array( 'diff', $exploded ); // {date_created:diff} |
|
122 | - $is_raw = in_array( 'raw', $exploded ); // {date_created:raw} |
|
123 | - $is_timestamp = in_array( 'timestamp', $exploded ); // {date_created:timestamp} |
|
120 | + $is_human = in_array('human', $exploded); // {date_created:human} |
|
121 | + $is_diff = in_array('diff', $exploded); // {date_created:diff} |
|
122 | + $is_raw = in_array('raw', $exploded); // {date_created:raw} |
|
123 | + $is_timestamp = in_array('timestamp', $exploded); // {date_created:timestamp} |
|
124 | 124 | |
125 | 125 | // If {date_created:raw} was specified, don't modify the stored value |
126 | - if ( $is_raw ) { |
|
126 | + if ($is_raw) { |
|
127 | 127 | $formatted_date = $date_created; |
128 | - } elseif( $is_timestamp ) { |
|
128 | + } elseif ($is_timestamp) { |
|
129 | 129 | $formatted_date = $entry_local_timestamp; |
130 | - } elseif ( $is_diff ) { |
|
130 | + } elseif ($is_diff) { |
|
131 | 131 | |
132 | 132 | /* translators: %s is the time (seconds, hours, days, weeks, months, years) since entry was created */ |
133 | - $relative_format = self::get_format_from_modifiers( $exploded, esc_html__( '%s ago', 'gravityview' ) ); |
|
133 | + $relative_format = self::get_format_from_modifiers($exploded, esc_html__('%s ago', 'gravityview')); |
|
134 | 134 | |
135 | - $formatted_date = sprintf( $relative_format, human_time_diff( $entry_gmt_time ) ); |
|
135 | + $formatted_date = sprintf($relative_format, human_time_diff($entry_gmt_time)); |
|
136 | 136 | |
137 | 137 | } else { |
138 | 138 | |
139 | - $include_time = in_array( 'time', $exploded ); // {date_created:time} |
|
140 | - $match_date_format = self::get_format_from_modifiers( $exploded, $site_date_format ); |
|
139 | + $include_time = in_array('time', $exploded); // {date_created:time} |
|
140 | + $match_date_format = self::get_format_from_modifiers($exploded, $site_date_format); |
|
141 | 141 | |
142 | - $formatted_date = GFCommon::format_date( $date_created, $is_human, $match_date_format, $include_time ); |
|
142 | + $formatted_date = GFCommon::format_date($date_created, $is_human, $match_date_format, $include_time); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return $formatted_date; |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return string If format is found, the passed format. Otherwise, the backup. |
160 | 160 | */ |
161 | - private static function get_format_from_modifiers( $exploded, $backup = '' ) { |
|
161 | + private static function get_format_from_modifiers($exploded, $backup = '') { |
|
162 | 162 | |
163 | 163 | $return = $backup; |
164 | 164 | |
165 | - $format_key_index = array_search( 'format', $exploded ); |
|
165 | + $format_key_index = array_search('format', $exploded); |
|
166 | 166 | |
167 | 167 | // If there's a "format:[php date format string]" date format, grab it |
168 | - if ( false !== $format_key_index && isset( $exploded[ $format_key_index + 1 ] ) ) { |
|
168 | + if (false !== $format_key_index && isset($exploded[$format_key_index + 1])) { |
|
169 | 169 | // Return escaped colons placeholder |
170 | - $return = str_replace( '|COLON|', ':', $exploded[ $format_key_index + 1 ] ); |
|
170 | + $return = str_replace('|COLON|', ':', $exploded[$format_key_index + 1]); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | return $return; |
@@ -194,22 +194,22 @@ discard block |
||
194 | 194 | * @param array $entry Entry array |
195 | 195 | * @param bool $url_encode Whether to URL-encode output |
196 | 196 | */ |
197 | - public static function replace_get_variables( $text, $form = array(), $entry = array(), $url_encode = false ) { |
|
197 | + public static function replace_get_variables($text, $form = array(), $entry = array(), $url_encode = false) { |
|
198 | 198 | |
199 | 199 | // Is there is {get:[xyz]} merge tag? |
200 | - preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
|
200 | + preg_match_all("/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER); |
|
201 | 201 | |
202 | 202 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
203 | - if( empty( $matches ) ) { |
|
203 | + if (empty($matches)) { |
|
204 | 204 | return $text; |
205 | 205 | } |
206 | 206 | |
207 | - foreach ( $matches as $match ) { |
|
207 | + foreach ($matches as $match) { |
|
208 | 208 | |
209 | 209 | $full_tag = $match[0]; |
210 | 210 | $property = $match[1]; |
211 | 211 | |
212 | - $value = stripslashes_deep( rgget( $property ) ); |
|
212 | + $value = stripslashes_deep(rgget($property)); |
|
213 | 213 | |
214 | 214 | /** |
215 | 215 | * @filter `gravityview/merge_tags/get/glue/` Modify the glue used to convert an array of `{get}` values from an array to string |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * @param[in,out] string $glue String used to `implode()` $_GET values Default: ', ' |
218 | 218 | * @param[in] string $property The current name of the $_GET parameter being combined |
219 | 219 | */ |
220 | - $glue = apply_filters( 'gravityview/merge_tags/get/glue/', ', ', $property ); |
|
220 | + $glue = apply_filters('gravityview/merge_tags/get/glue/', ', ', $property); |
|
221 | 221 | |
222 | - $value = is_array( $value ) ? implode( $glue, $value ) : $value; |
|
222 | + $value = is_array($value) ? implode($glue, $value) : $value; |
|
223 | 223 | |
224 | - $value = $url_encode ? urlencode( $value ) : $value; |
|
224 | + $value = $url_encode ? urlencode($value) : $value; |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Disable esc_html() from running on `{get}` merge tag |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @since 1.15 |
232 | 232 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
233 | 233 | */ |
234 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
234 | + $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/'.$property, true); |
|
235 | 235 | |
236 | - $value = $esc_html ? esc_html( $value ) : $value; |
|
236 | + $value = $esc_html ? esc_html($value) : $value; |
|
237 | 237 | |
238 | 238 | /** |
239 | 239 | * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Modify the value of the `{get}` replacement before being used |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * @param[in] array $form Gravity Forms form array |
243 | 243 | * @param[in] array $entry Entry array |
244 | 244 | */ |
245 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
245 | + $value = apply_filters('gravityview/merge_tags/get/value/'.$property, $value, $text, $form, $entry); |
|
246 | 246 | |
247 | - $text = str_replace( $full_tag, $value, $text ); |
|
247 | + $text = str_replace($full_tag, $value, $text); |
|
248 | 248 | } |
249 | 249 | |
250 | - unset( $value, $glue, $matches ); |
|
250 | + unset($value, $glue, $matches); |
|
251 | 251 | |
252 | 252 | return $text; |
253 | 253 | } |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'created_by'; |
11 | 11 | |
12 | - var $search_operators = array( 'is', 'isnot' ); |
|
12 | + var $search_operators = array('is', 'isnot'); |
|
13 | 13 | |
14 | 14 | var $group = 'meta'; |
15 | 15 | |
16 | 16 | var $_custom_merge_tag = 'created_by'; |
17 | 17 | |
18 | 18 | public function __construct() { |
19 | - $this->label = esc_attr__( 'Created By', 'gravityview' ); |
|
19 | + $this->label = esc_attr__('Created By', 'gravityview'); |
|
20 | 20 | parent::__construct(); |
21 | 21 | } |
22 | 22 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return array Modified merge tags |
32 | 32 | */ |
33 | - protected function custom_merge_tags( $form = array(), $fields = array() ) { |
|
33 | + protected function custom_merge_tags($form = array(), $fields = array()) { |
|
34 | 34 | |
35 | 35 | $merge_tags = array( |
36 | 36 | array( |
@@ -75,52 +75,52 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return string Text, with user variables replaced, if they existed |
77 | 77 | */ |
78 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
78 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
79 | 79 | |
80 | 80 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
81 | - if( empty( $entry['created_by'] ) ) { |
|
81 | + if (empty($entry['created_by'])) { |
|
82 | 82 | return $text; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Get the creator of the entry |
86 | - $entry_creator = new WP_User( $entry['created_by'] ); |
|
86 | + $entry_creator = new WP_User($entry['created_by']); |
|
87 | 87 | |
88 | - foreach ( $matches as $match ) { |
|
88 | + foreach ($matches as $match) { |
|
89 | 89 | |
90 | 90 | $full_tag = $match[0]; |
91 | 91 | $property = $match[1]; |
92 | 92 | |
93 | - switch( $property ) { |
|
93 | + switch ($property) { |
|
94 | 94 | /** @since 1.13.2 */ |
95 | 95 | case 'roles': |
96 | - $value = implode( ', ', $entry_creator->roles ); |
|
96 | + $value = implode(', ', $entry_creator->roles); |
|
97 | 97 | break; |
98 | 98 | default: |
99 | - $value = $entry_creator->get( $property ); |
|
99 | + $value = $entry_creator->get($property); |
|
100 | 100 | } |
101 | 101 | |
102 | - $value = $url_encode ? urlencode( $value ) : $value; |
|
102 | + $value = $url_encode ? urlencode($value) : $value; |
|
103 | 103 | |
104 | - $value = $esc_html ? esc_html( $value ) : $value; |
|
104 | + $value = $esc_html ? esc_html($value) : $value; |
|
105 | 105 | |
106 | - $text = str_replace( $full_tag, $value, $text ); |
|
106 | + $text = str_replace($full_tag, $value, $text); |
|
107 | 107 | } |
108 | 108 | |
109 | - unset( $entry_creator ); |
|
109 | + unset($entry_creator); |
|
110 | 110 | |
111 | 111 | return $text; |
112 | 112 | } |
113 | 113 | |
114 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
114 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
115 | 115 | |
116 | - if( 'edit' === $context ) { |
|
116 | + if ('edit' === $context) { |
|
117 | 117 | return $field_options; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $field_options['name_display'] = array( |
121 | 121 | 'type' => 'select', |
122 | - 'label' => __( 'User Format', 'gravityview' ), |
|
123 | - 'desc' => __( 'How should the User information be displayed?', 'gravityview'), |
|
122 | + 'label' => __('User Format', 'gravityview'), |
|
123 | + 'desc' => __('How should the User information be displayed?', 'gravityview'), |
|
124 | 124 | 'choices' => array( |
125 | 125 | 'display_name' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'), |
126 | 126 | 'user_login' => __('Username (Example: "nostromo")', 'gravityview'), |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'date_created'; |
11 | 11 | |
12 | - var $search_operators = array( 'less_than', 'greater_than', 'is', 'isnot' ); |
|
12 | + var $search_operators = array('less_than', 'greater_than', 'is', 'isnot'); |
|
13 | 13 | |
14 | 14 | var $group = 'meta'; |
15 | 15 | |
16 | - var $contexts = array( 'single', 'multiple', 'export' ); |
|
16 | + var $contexts = array('single', 'multiple', 'export'); |
|
17 | 17 | |
18 | 18 | var $_custom_merge_tag = 'date_created'; |
19 | 19 | |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | * GravityView_Field_Date_Created constructor. |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - $this->label = esc_attr__( 'Date Created', 'gravityview' ); |
|
25 | - $this->description = esc_attr__( 'The date the entry was created.', 'gravityview' ); |
|
24 | + $this->label = esc_attr__('Date Created', 'gravityview'); |
|
25 | + $this->description = esc_attr__('The date the entry was created.', 'gravityview'); |
|
26 | 26 | parent::__construct(); |
27 | 27 | } |
28 | 28 | |
29 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
29 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
30 | 30 | |
31 | - if( 'edit' === $context ) { |
|
31 | + if ('edit' === $context) { |
|
32 | 32 | return $field_options; |
33 | 33 | } |
34 | 34 | |
35 | - $this->add_field_support('date_display', $field_options ); |
|
35 | + $this->add_field_support('date_display', $field_options); |
|
36 | 36 | |
37 | 37 | return $field_options; |
38 | 38 | } |
@@ -52,27 +52,27 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
54 | 54 | */ |
55 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
55 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
56 | 56 | |
57 | 57 | $return = $text; |
58 | 58 | |
59 | 59 | /** Use $this->name instead of date_created because Payment Date uses this as well*/ |
60 | - $date_created = rgar( $entry, $this->name ); |
|
60 | + $date_created = rgar($entry, $this->name); |
|
61 | 61 | |
62 | - foreach ( $matches as $match ) { |
|
62 | + foreach ($matches as $match) { |
|
63 | 63 | |
64 | 64 | $full_tag = $match[0]; |
65 | 65 | $property = $match[1]; |
66 | 66 | |
67 | - $formatted_date = GravityView_Merge_Tags::format_date( $date_created, $full_tag, $property ); |
|
67 | + $formatted_date = GravityView_Merge_Tags::format_date($date_created, $full_tag, $property); |
|
68 | 68 | |
69 | - $return = str_replace( $full_tag, $formatted_date, $return ); |
|
69 | + $return = str_replace($full_tag, $formatted_date, $return); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return $return; |
73 | 73 | } |
74 | 74 | |
75 | - public static function format( $value, $format = '', $context = 'display' ) { |
|
75 | + public static function format($value, $format = '', $context = 'display') { |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -81,16 +81,16 @@ discard block |
||
81 | 81 | * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true |
82 | 82 | * @param[in] string $context Where the filter is being called from. `display` in this case. |
83 | 83 | */ |
84 | - $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, $context ); |
|
84 | + $adjust_tz = apply_filters('gravityview_date_created_adjust_timezone', true, $context); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * date_created is stored in UTC format. Fetch in the current blog's timezone if $adjust_tz is true |
88 | 88 | */ |
89 | - $tz_value = $adjust_tz ? get_date_from_gmt( $value ) : $value; |
|
89 | + $tz_value = $adjust_tz ? get_date_from_gmt($value) : $value; |
|
90 | 90 | |
91 | - if( $format ) { |
|
91 | + if ($format) { |
|
92 | 92 | |
93 | - $output = date_i18n( $format, strtotime( $tz_value ) ); |
|
93 | + $output = date_i18n($format, strtotime($tz_value)); |
|
94 | 94 | |
95 | 95 | } else { |
96 | 96 | |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * @see https://codex.wordpress.org/Formatting_Date_and_Time |
100 | 100 | * @param null|string Date Format (default: $field->dateFormat) |
101 | 101 | */ |
102 | - $format = apply_filters( 'gravityview_date_format', rgar($field, "dateFormat") ); |
|
102 | + $format = apply_filters('gravityview_date_format', rgar($field, "dateFormat")); |
|
103 | 103 | |
104 | - $output = GFCommon::date_display( $tz_value, $format ); |
|
104 | + $output = GFCommon::date_display($tz_value, $format); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $output; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than', 'contains' ); |
|
17 | + var $search_operators = array('is', 'isnot', 'greater_than', 'less_than', 'contains'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * GravityView_Field_Payment_Amount constructor. |
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | - $this->label = esc_attr__( 'Payment Amount', 'gravityview' ); |
|
27 | + $this->label = esc_attr__('Payment Amount', 'gravityview'); |
|
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | 30 | |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
43 | 43 | */ |
44 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
44 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
45 | 45 | |
46 | 46 | $return = $text; |
47 | 47 | |
48 | - foreach ( $matches as $match ) { |
|
48 | + foreach ($matches as $match) { |
|
49 | 49 | |
50 | 50 | $full_tag = $match[0]; |
51 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
51 | + $modifier = isset($match[1]) ? $match[1] : false; |
|
52 | 52 | |
53 | - $amount = rgar( $entry, 'payment_amount' ); |
|
53 | + $amount = rgar($entry, 'payment_amount'); |
|
54 | 54 | |
55 | - $formatted_amount = ( 'raw' === $modifier ) ? $amount : GFCommon::to_money( $amount, rgar( $entry, 'currency' ) ); |
|
55 | + $formatted_amount = ('raw' === $modifier) ? $amount : GFCommon::to_money($amount, rgar($entry, 'currency')); |
|
56 | 56 | |
57 | - $return = str_replace( $full_tag, $formatted_amount, $return ); |
|
57 | + $return = str_replace($full_tag, $formatted_amount, $return); |
|
58 | 58 | } |
59 | 59 | |
60 | - unset( $formatted_amount, $amount, $full_tag, $matches ); |
|
60 | + unset($formatted_amount, $amount, $full_tag, $matches); |
|
61 | 61 | |
62 | 62 | return $return; |
63 | 63 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | var $is_searchable = true; |
14 | 14 | |
15 | - var $search_operators = array( 'less_than', 'greater_than', 'is', 'isnot' ); |
|
15 | + var $search_operators = array('less_than', 'greater_than', 'is', 'isnot'); |
|
16 | 16 | |
17 | 17 | var $group = 'pricing'; |
18 | 18 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * GravityView_Field_Date_Created constructor. |
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | - $this->label = esc_attr__( 'Payment Date', 'gravityview' ); |
|
26 | - $this->description = esc_attr__( 'The date the payment was received.', 'gravityview' ); |
|
25 | + $this->label = esc_attr__('Payment Date', 'gravityview'); |
|
26 | + $this->description = esc_attr__('The date the payment was received.', 'gravityview'); |
|
27 | 27 | parent::__construct(); |
28 | 28 | } |
29 | 29 | } |