@@ -7,20 +7,20 @@ |
||
7 | 7 | |
8 | 8 | var $name = 'post_tags'; |
9 | 9 | |
10 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
10 | + var $search_operators = array('is', 'in', 'not in', 'isnot', 'contains'); |
|
11 | 11 | |
12 | 12 | var $_gf_field_class_name = 'GF_Field_Post_Tags'; |
13 | 13 | |
14 | 14 | var $group = 'post'; |
15 | 15 | |
16 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
16 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
17 | 17 | |
18 | - if( 'edit' === $context ) { |
|
18 | + if ('edit' === $context) { |
|
19 | 19 | return $field_options; |
20 | 20 | } |
21 | 21 | |
22 | - $this->add_field_support('dynamic_data', $field_options ); |
|
23 | - $this->add_field_support('link_to_term', $field_options ); |
|
22 | + $this->add_field_support('dynamic_data', $field_options); |
|
23 | + $this->add_field_support('link_to_term', $field_options); |
|
24 | 24 | |
25 | 25 | return $field_options; |
26 | 26 | } |
@@ -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,29 +177,29 @@ 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 ] ) ) { |
|
190 | + if (isset($entry[$tag])) { |
|
191 | 191 | |
192 | - $value = $entry[ $tag ]; |
|
192 | + $value = $entry[$tag]; |
|
193 | 193 | |
194 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
195 | - $value = $this->get_content( $value ); |
|
194 | + if (is_callable(array($this, 'get_content'))) { |
|
195 | + $value = $this->get_content($value); |
|
196 | 196 | } |
197 | 197 | |
198 | - $text = str_replace( $full_tag, $value, $text ); |
|
198 | + $text = str_replace($full_tag, $value, $text); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | - unset( $value, $tag, $full_tag ); |
|
202 | + unset($value, $tag, $full_tag); |
|
203 | 203 | |
204 | 204 | return $text; |
205 | 205 | } |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return array Modified merge tags |
220 | 220 | */ |
221 | - public function _filter_gform_custom_merge_tags( $custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '' ) { |
|
221 | + public function _filter_gform_custom_merge_tags($custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '') { |
|
222 | 222 | |
223 | - $form = GVCommon::get_form( $form_id ); |
|
223 | + $form = GVCommon::get_form($form_id); |
|
224 | 224 | |
225 | - $field_merge_tags = $this->custom_merge_tags( $form, $fields ); |
|
225 | + $field_merge_tags = $this->custom_merge_tags($form, $fields); |
|
226 | 226 | |
227 | - return array_merge( $custom_merge_tags, $field_merge_tags ); |
|
227 | + return array_merge($custom_merge_tags, $field_merge_tags); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @return array Merge tag array with `label` and `tag` keys based on class `label` and `_custom_merge_tag` variables |
241 | 241 | */ |
242 | - protected function custom_merge_tags( $form = array(), $fields = array() ) { |
|
242 | + protected function custom_merge_tags($form = array(), $fields = array()) { |
|
243 | 243 | |
244 | 244 | // Use variables to make it unnecessary for other fields to override |
245 | 245 | $merge_tags = array( |
246 | 246 | array( |
247 | 247 | 'label' => $this->label, |
248 | - 'tag' => '{' . $this->_custom_merge_tag . '}', |
|
248 | + 'tag' => '{'.$this->_custom_merge_tag.'}', |
|
249 | 249 | ), |
250 | 250 | ); |
251 | 251 | |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @return array |
264 | 264 | */ |
265 | - public function _filter_sortable_fields( $not_sortable ) { |
|
265 | + public function _filter_sortable_fields($not_sortable) { |
|
266 | 266 | |
267 | - if( ! $this->is_sortable ) { |
|
267 | + if (!$this->is_sortable) { |
|
268 | 268 | $not_sortable[] = $this->name; |
269 | 269 | } |
270 | 270 | |
@@ -275,35 +275,35 @@ discard block |
||
275 | 275 | $options = array( |
276 | 276 | 'link_to_post' => array( |
277 | 277 | 'type' => 'checkbox', |
278 | - 'label' => __( 'Link to the post', 'gravityview' ), |
|
279 | - 'desc' => __( 'Link to the post created by the entry.', 'gravityview' ), |
|
278 | + 'label' => __('Link to the post', 'gravityview'), |
|
279 | + 'desc' => __('Link to the post created by the entry.', 'gravityview'), |
|
280 | 280 | 'value' => false, |
281 | 281 | ), |
282 | 282 | 'link_to_term' => array( |
283 | 283 | 'type' => 'checkbox', |
284 | - 'label' => __( 'Link to the category or tag', 'gravityview' ), |
|
285 | - 'desc' => __( 'Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview' ), |
|
284 | + 'label' => __('Link to the category or tag', 'gravityview'), |
|
285 | + 'desc' => __('Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview'), |
|
286 | 286 | 'value' => false, |
287 | 287 | ), |
288 | 288 | 'dynamic_data' => array( |
289 | 289 | 'type' => 'checkbox', |
290 | - 'label' => __( 'Use the live post data', 'gravityview' ), |
|
291 | - 'desc' => __( 'Instead of using the entry data, instead use the current post data.', 'gravityview' ), |
|
290 | + 'label' => __('Use the live post data', 'gravityview'), |
|
291 | + 'desc' => __('Instead of using the entry data, instead use the current post data.', 'gravityview'), |
|
292 | 292 | 'value' => true, |
293 | 293 | ), |
294 | 294 | 'date_display' => array( |
295 | 295 | 'type' => 'text', |
296 | - 'label' => __( 'Override Date Format', 'gravityview' ), |
|
297 | - '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>' ), |
|
296 | + 'label' => __('Override Date Format', 'gravityview'), |
|
297 | + '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>'), |
|
298 | 298 | /** |
299 | 299 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
300 | 300 | * @param[in,out] null|string $date_format Date Format (default: null) |
301 | 301 | */ |
302 | - 'value' => apply_filters( 'gravityview_date_format', null ) |
|
302 | + 'value' => apply_filters('gravityview_date_format', null) |
|
303 | 303 | ), |
304 | 304 | 'new_window' => array( |
305 | 305 | 'type' => 'checkbox', |
306 | - 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
306 | + 'label' => __('Open link in a new tab or window?', 'gravityview'), |
|
307 | 307 | 'value' => false, |
308 | 308 | ), |
309 | 309 | ); |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | * @filter `gravityview_field_support_options` Modify the settings that a field supports |
313 | 313 | * @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 |
314 | 314 | */ |
315 | - return apply_filters( 'gravityview_field_support_options', $options ); |
|
315 | + return apply_filters('gravityview_field_support_options', $options); |
|
316 | 316 | } |
317 | 317 | |
318 | - function add_field_support( $key = '', &$field_options ) { |
|
318 | + function add_field_support($key = '', &$field_options) { |
|
319 | 319 | |
320 | 320 | $options = $this->field_support_options(); |
321 | 321 | |
322 | - if( isset( $options[ $key ] ) ) { |
|
323 | - $field_options[ $key ] = $options[ $key ]; |
|
322 | + if (isset($options[$key])) { |
|
323 | + $field_options[$key] = $options[$key]; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | return $field_options; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @param [type] $input_type [description] |
357 | 357 | * @return [type] [description] |
358 | 358 | */ |
359 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
359 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
360 | 360 | |
361 | 361 | $this->_field_options = $field_options; |
362 | 362 | $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 ] ) && ! defined( 'DOING_GRAVITYVIEW_TESTS' ) ) { |
|
34 | - throw new Exception( 'Field type already registered: ' . $field->name ); |
|
33 | + if (isset(self::$_fields[$field->name]) && !defined('DOING_GRAVITYVIEW_TESTS')) { |
|
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 | /** |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return GravityView_Field[] |
96 | 96 | */ |
97 | - public static function get_all( $group = '' ) { |
|
97 | + public static function get_all($group = '') { |
|
98 | 98 | |
99 | - if( '' !== $group ) { |
|
99 | + if ('' !== $group) { |
|
100 | 100 | $return_fields = self::$_fields; |
101 | - foreach ( $return_fields as $key => $field ) { |
|
102 | - if( $group !== $field->group ) { |
|
103 | - unset( $return_fields[ $key ] ); |
|
101 | + foreach ($return_fields as $key => $field) { |
|
102 | + if ($group !== $field->group) { |
|
103 | + unset($return_fields[$key]); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | return $return_fields; |
@@ -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 |
@@ -1,29 +1,29 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @file gravityview.php |
|
4 | - * |
|
5 | - * The GravityView plugin |
|
6 | - * |
|
7 | - * Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output. |
|
8 | - * |
|
9 | - * @package GravityView |
|
10 | - * @license GPL2+ |
|
11 | - * @author Katz Web Services, Inc. |
|
12 | - * @link http://gravityview.co |
|
13 | - * @copyright Copyright 2016, Katz Web Services, Inc. |
|
14 | - * |
|
15 | - * @wordpress-plugin |
|
16 | - * Plugin Name: GravityView |
|
17 | - * Plugin URI: http://gravityview.co |
|
18 | - * Description: Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output. |
|
19 | - * Version: 1.16 |
|
20 | - * Author: Katz Web Services, Inc. |
|
21 | - * Author URI: http://www.katzwebservices.com |
|
22 | - * Text Domain: gravityview |
|
23 | - * License: GPLv2 or later |
|
24 | - * License URI: http://www.gnu.org/licenses/gpl-2.0.html |
|
25 | - * Domain Path: /languages |
|
26 | - */ |
|
3 | + * @file gravityview.php |
|
4 | + * |
|
5 | + * The GravityView plugin |
|
6 | + * |
|
7 | + * Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output. |
|
8 | + * |
|
9 | + * @package GravityView |
|
10 | + * @license GPL2+ |
|
11 | + * @author Katz Web Services, Inc. |
|
12 | + * @link http://gravityview.co |
|
13 | + * @copyright Copyright 2016, Katz Web Services, Inc. |
|
14 | + * |
|
15 | + * @wordpress-plugin |
|
16 | + * Plugin Name: GravityView |
|
17 | + * Plugin URI: http://gravityview.co |
|
18 | + * Description: Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output. |
|
19 | + * Version: 1.16 |
|
20 | + * Author: Katz Web Services, Inc. |
|
21 | + * Author URI: http://www.katzwebservices.com |
|
22 | + * Text Domain: gravityview |
|
23 | + * License: GPLv2 or later |
|
24 | + * License URI: http://www.gnu.org/licenses/gpl-2.0.html |
|
25 | + * Domain Path: /languages |
|
26 | + */ |
|
27 | 27 | |
28 | 28 | /** If this file is called directly, abort. */ |
29 | 29 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -311,11 +311,11 @@ discard block |
||
311 | 311 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
312 | 312 | |
313 | 313 | |
314 | - /** |
|
315 | - * When an entry is created, check if we need to update the custom slug meta |
|
316 | - * todo: move this to its own class.. |
|
317 | - */ |
|
318 | - add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
314 | + /** |
|
315 | + * When an entry is created, check if we need to update the custom slug meta |
|
316 | + * todo: move this to its own class.. |
|
317 | + */ |
|
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 |
@@ -345,34 +345,34 @@ discard block |
||
345 | 345 | |
346 | 346 | /** DEBUG */ |
347 | 347 | |
348 | - /** |
|
349 | - * Logs messages using Gravity Forms logging add-on |
|
350 | - * @param string $message log message |
|
351 | - * @param mixed $data Additional data to display |
|
352 | - * @return void |
|
353 | - */ |
|
354 | - public static function log_debug( $message, $data = null ){ |
|
355 | - /** |
|
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 | - * @param string $message Message to display |
|
358 | - * @param mixed $data Supporting data to print alongside it |
|
359 | - */ |
|
360 | - do_action( 'gravityview_log_debug', $message, $data ); |
|
361 | - } |
|
362 | - |
|
363 | - /** |
|
364 | - * Logs messages using Gravity Forms logging add-on |
|
365 | - * @param string $message log message |
|
366 | - * @return void |
|
367 | - */ |
|
368 | - public static function log_error( $message, $data = null ){ |
|
369 | - /** |
|
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 | - * @param string $message Error message to display |
|
372 | - * @param mixed $data Supporting data to print alongside it |
|
373 | - */ |
|
374 | - do_action( 'gravityview_log_error', $message, $data ); |
|
375 | - } |
|
348 | + /** |
|
349 | + * Logs messages using Gravity Forms logging add-on |
|
350 | + * @param string $message log message |
|
351 | + * @param mixed $data Additional data to display |
|
352 | + * @return void |
|
353 | + */ |
|
354 | + public static function log_debug( $message, $data = null ){ |
|
355 | + /** |
|
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 | + * @param string $message Message to display |
|
358 | + * @param mixed $data Supporting data to print alongside it |
|
359 | + */ |
|
360 | + do_action( 'gravityview_log_debug', $message, $data ); |
|
361 | + } |
|
362 | + |
|
363 | + /** |
|
364 | + * Logs messages using Gravity Forms logging add-on |
|
365 | + * @param string $message log message |
|
366 | + * @return void |
|
367 | + */ |
|
368 | + public static function log_error( $message, $data = null ){ |
|
369 | + /** |
|
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 | + * @param string $message Error message to display |
|
372 | + * @param mixed $data Supporting data to print alongside it |
|
373 | + */ |
|
374 | + do_action( 'gravityview_log_error', $message, $data ); |
|
375 | + } |
|
376 | 376 | |
377 | 377 | } // end class GravityView_Plugin |
378 | 378 |
@@ -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'), |
@@ -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 | } |
@@ -12,12 +12,12 @@ 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 | |
19 | -if( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
20 | - require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); |
|
19 | +if (!class_exists('Gamajo_Template_Loader')) { |
|
20 | + require(GRAVITYVIEW_DIR.'includes/lib/class-gamajo-template-loader.php'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | class GravityView_View extends Gamajo_Template_Loader { |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * Construct the view object |
146 | 146 | * @param array $atts Associative array to set the data of |
147 | 147 | */ |
148 | - function __construct( $atts = array() ) { |
|
148 | + function __construct($atts = array()) { |
|
149 | 149 | |
150 | - $atts = wp_parse_args( $atts, array( |
|
150 | + $atts = wp_parse_args($atts, array( |
|
151 | 151 | 'form_id' => NULL, |
152 | 152 | 'view_id' => NULL, |
153 | 153 | 'fields' => NULL, |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | 'post_id' => NULL, |
156 | 156 | 'form' => NULL, |
157 | 157 | 'atts' => NULL, |
158 | - ) ); |
|
158 | + )); |
|
159 | 159 | |
160 | 160 | foreach ($atts as $key => $value) { |
161 | - if( is_null( $value ) ) { |
|
161 | + if (is_null($value)) { |
|
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | $this->{$key} = $value; |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | |
167 | 167 | |
168 | 168 | // Add granular overrides |
169 | - add_filter( $this->filter_prefix . '_get_template_part', array( $this, 'add_id_specific_templates' ), 10, 3 ); |
|
169 | + add_filter($this->filter_prefix.'_get_template_part', array($this, 'add_id_specific_templates'), 10, 3); |
|
170 | 170 | |
171 | 171 | |
172 | 172 | // widget logic |
173 | - add_action( 'gravityview_before', array( $this, 'render_widget_hooks' ) ); |
|
174 | - add_action( 'gravityview_after', array( $this, 'render_widget_hooks' ) ); |
|
173 | + add_action('gravityview_before', array($this, 'render_widget_hooks')); |
|
174 | + add_action('gravityview_after', array($this, 'render_widget_hooks')); |
|
175 | 175 | |
176 | 176 | /** |
177 | 177 | * Clear the current entry after the loop is done |
178 | 178 | * @since 1.7.3 |
179 | 179 | */ |
180 | - add_action( 'gravityview_footer', array( $this, 'clearCurrentEntry' ), 500 ); |
|
180 | + add_action('gravityview_footer', array($this, 'clearCurrentEntry'), 500); |
|
181 | 181 | |
182 | 182 | self::$instance = &$this; |
183 | 183 | } |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return GravityView_View |
189 | 189 | */ |
190 | - static function getInstance( $passed_post = NULL ) { |
|
190 | + static function getInstance($passed_post = NULL) { |
|
191 | 191 | |
192 | - if( empty( self::$instance ) ) { |
|
193 | - self::$instance = new self( $passed_post ); |
|
192 | + if (empty(self::$instance)) { |
|
193 | + self::$instance = new self($passed_post); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | return self::$instance; |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | * @param string|null $key The key to a specific attribute of the current field |
201 | 201 | * @return array|mixed|null If $key is set and attribute exists at $key, return that. If not set, return NULL. Otherwise, return current field array |
202 | 202 | */ |
203 | - public function getCurrentField( $key = NULL ) { |
|
203 | + public function getCurrentField($key = NULL) { |
|
204 | 204 | |
205 | - if( !empty( $key ) ) { |
|
206 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
207 | - return $this->_current_field[ $key ]; |
|
205 | + if (!empty($key)) { |
|
206 | + if (isset($this->_current_field[$key])) { |
|
207 | + return $this->_current_field[$key]; |
|
208 | 208 | } |
209 | 209 | return NULL; |
210 | 210 | } |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | return $this->_current_field; |
213 | 213 | } |
214 | 214 | |
215 | - public function setCurrentFieldSetting( $key, $value ) { |
|
215 | + public function setCurrentFieldSetting($key, $value) { |
|
216 | 216 | |
217 | - if( !empty( $this->_current_field ) ) { |
|
218 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
217 | + if (!empty($this->_current_field)) { |
|
218 | + $this->_current_field['field_settings'][$key] = $value; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | - public function getCurrentFieldSetting( $key ) { |
|
223 | + public function getCurrentFieldSetting($key) { |
|
224 | 224 | $settings = $this->getCurrentField('field_settings'); |
225 | 225 | |
226 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
227 | - return $settings[ $key ]; |
|
226 | + if ($settings && !empty($settings[$key])) { |
|
227 | + return $settings[$key]; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | return NULL; |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * @param array $passed_field |
235 | 235 | */ |
236 | - public function setCurrentField( $passed_field ) { |
|
236 | + public function setCurrentField($passed_field) { |
|
237 | 237 | |
238 | 238 | $existing_field = $this->getCurrentField(); |
239 | 239 | |
240 | - $set_field = wp_parse_args( $passed_field, $existing_field ); |
|
240 | + $set_field = wp_parse_args($passed_field, $existing_field); |
|
241 | 241 | |
242 | 242 | $this->_current_field = $set_field; |
243 | 243 | |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | * @param string|null $key The key to a specific field in the fields array |
253 | 253 | * @return array|mixed|null If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields. |
254 | 254 | */ |
255 | - public function getAtts( $key = NULL ) { |
|
255 | + public function getAtts($key = NULL) { |
|
256 | 256 | |
257 | - if( !empty( $key ) ) { |
|
258 | - if( isset( $this->atts[ $key ] ) ) { |
|
259 | - return $this->atts[ $key ]; |
|
257 | + if (!empty($key)) { |
|
258 | + if (isset($this->atts[$key])) { |
|
259 | + return $this->atts[$key]; |
|
260 | 260 | } |
261 | 261 | return NULL; |
262 | 262 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | /** |
268 | 268 | * @param array $atts |
269 | 269 | */ |
270 | - public function setAtts( $atts ) { |
|
270 | + public function setAtts($atts) { |
|
271 | 271 | $this->atts = $atts; |
272 | 272 | } |
273 | 273 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | /** |
282 | 282 | * @param array $form |
283 | 283 | */ |
284 | - public function setForm( $form ) { |
|
284 | + public function setForm($form) { |
|
285 | 285 | $this->form = $form; |
286 | 286 | } |
287 | 287 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | /** |
296 | 296 | * @param int|null $post_id |
297 | 297 | */ |
298 | - public function setPostId( $post_id ) { |
|
298 | + public function setPostId($post_id) { |
|
299 | 299 | $this->post_id = $post_id; |
300 | 300 | } |
301 | 301 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | /** |
310 | 310 | * @param string $context |
311 | 311 | */ |
312 | - public function setContext( $context ) { |
|
312 | + public function setContext($context) { |
|
313 | 313 | $this->context = $context; |
314 | 314 | } |
315 | 315 | |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | * @param string|null $key The key to a specific field in the fields array |
318 | 318 | * @return array|mixed|null If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields. |
319 | 319 | */ |
320 | - public function getFields( $key = null ) { |
|
320 | + public function getFields($key = null) { |
|
321 | 321 | |
322 | - $fields = empty( $this->fields ) ? NULL : $this->fields; |
|
322 | + $fields = empty($this->fields) ? NULL : $this->fields; |
|
323 | 323 | |
324 | - if( $fields && !empty( $key ) ) { |
|
325 | - $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
|
324 | + if ($fields && !empty($key)) { |
|
325 | + $fields = isset($fields[$key]) ? $fields[$key] : NULL; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | return $fields; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * @param array $fields |
333 | 333 | */ |
334 | - public function setFields( $fields ) { |
|
334 | + public function setFields($fields) { |
|
335 | 335 | $this->fields = $fields; |
336 | 336 | } |
337 | 337 | |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | * @param string $key The key to a specific field in the fields array |
340 | 340 | * @return array|mixed|null If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields. |
341 | 341 | */ |
342 | - public function getField( $key ) { |
|
342 | + public function getField($key) { |
|
343 | 343 | |
344 | - if( !empty( $key ) ) { |
|
345 | - if( isset( $this->fields[ $key ] ) ) { |
|
346 | - return $this->fields[ $key ]; |
|
344 | + if (!empty($key)) { |
|
345 | + if (isset($this->fields[$key])) { |
|
346 | + return $this->fields[$key]; |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
@@ -354,22 +354,22 @@ discard block |
||
354 | 354 | * @param string $key The key to a specific field in the fields array |
355 | 355 | * @param mixed $value The value to set for the field |
356 | 356 | */ |
357 | - public function setField( $key, $value ) { |
|
358 | - $this->fields[ $key ] = $value; |
|
357 | + public function setField($key, $value) { |
|
358 | + $this->fields[$key] = $value; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
362 | 362 | * @return int |
363 | 363 | */ |
364 | 364 | public function getViewId() { |
365 | - return absint( $this->view_id ); |
|
365 | + return absint($this->view_id); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
369 | 369 | * @param int $view_id |
370 | 370 | */ |
371 | - public function setViewId( $view_id ) { |
|
372 | - $this->view_id = intval( $view_id ); |
|
371 | + public function setViewId($view_id) { |
|
372 | + $this->view_id = intval($view_id); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | /** |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | /** |
383 | 383 | * @param int $form_id |
384 | 384 | */ |
385 | - public function setFormId( $form_id ) { |
|
385 | + public function setFormId($form_id) { |
|
386 | 386 | $this->form_id = $form_id; |
387 | 387 | } |
388 | 388 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | /** |
397 | 397 | * @param array $entries |
398 | 398 | */ |
399 | - public function setEntries( $entries ) { |
|
399 | + public function setEntries($entries) { |
|
400 | 400 | $this->entries = $entries; |
401 | 401 | } |
402 | 402 | |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | /** |
411 | 411 | * @param int $total_entries |
412 | 412 | */ |
413 | - public function setTotalEntries( $total_entries ) { |
|
414 | - $this->total_entries = intval( $total_entries ); |
|
413 | + public function setTotalEntries($total_entries) { |
|
414 | + $this->total_entries = intval($total_entries); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | /** |
425 | 425 | * @param array $paging |
426 | 426 | */ |
427 | - public function setPaging( $paging ) { |
|
427 | + public function setPaging($paging) { |
|
428 | 428 | $this->paging = $paging; |
429 | 429 | } |
430 | 430 | |
@@ -446,25 +446,25 @@ discard block |
||
446 | 446 | $page_size = $paging['page_size']; |
447 | 447 | $total = $this->getTotalEntries(); |
448 | 448 | |
449 | - if ( empty( $total ) ) { |
|
450 | - do_action( 'gravityview_log_debug', __METHOD__ . ': No entries. Returning empty array.' ); |
|
449 | + if (empty($total)) { |
|
450 | + do_action('gravityview_log_debug', __METHOD__.': No entries. Returning empty array.'); |
|
451 | 451 | |
452 | 452 | return array(); |
453 | 453 | } |
454 | 454 | |
455 | - $first = empty( $offset ) ? 1 : $offset + 1; |
|
455 | + $first = empty($offset) ? 1 : $offset + 1; |
|
456 | 456 | |
457 | 457 | // If the page size + starting entry is larger than total, the total is the max. |
458 | - $last = ( $offset + $page_size > $total ) ? $total : $offset + $page_size; |
|
458 | + $last = ($offset + $page_size > $total) ? $total : $offset + $page_size; |
|
459 | 459 | |
460 | 460 | /** |
461 | 461 | * @filter `gravityview_pagination_counts` Modify the displayed pagination numbers |
462 | 462 | * @since 1.13 |
463 | 463 | * @param array $counts Array with $first, $last, $total numbers in that order |
464 | 464 | */ |
465 | - list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
|
465 | + list($first, $last, $total) = apply_filters('gravityview_pagination_counts', array($first, $last, $total)); |
|
466 | 466 | |
467 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
467 | + return array('first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | /** |
478 | 478 | * @param array $sorting |
479 | 479 | */ |
480 | - public function setSorting( $sorting ) { |
|
480 | + public function setSorting($sorting) { |
|
481 | 481 | $this->sorting = $sorting; |
482 | 482 | } |
483 | 483 | |
@@ -486,9 +486,9 @@ discard block |
||
486 | 486 | */ |
487 | 487 | public function getBackLinkLabel() { |
488 | 488 | |
489 | - $back_link_label = GravityView_API::replace_variables( $this->back_link_label, $this->getForm(), $this->getCurrentEntry() ); |
|
489 | + $back_link_label = GravityView_API::replace_variables($this->back_link_label, $this->getForm(), $this->getCurrentEntry()); |
|
490 | 490 | |
491 | - $back_link_label = do_shortcode( $back_link_label ); |
|
491 | + $back_link_label = do_shortcode($back_link_label); |
|
492 | 492 | |
493 | 493 | return $back_link_label; |
494 | 494 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | /** |
497 | 497 | * @param string $back_link_label |
498 | 498 | */ |
499 | - public function setBackLinkLabel( $back_link_label ) { |
|
499 | + public function setBackLinkLabel($back_link_label) { |
|
500 | 500 | $this->back_link_label = $back_link_label; |
501 | 501 | } |
502 | 502 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | /** |
511 | 511 | * @param boolean $hide_until_searched |
512 | 512 | */ |
513 | - public function setHideUntilSearched( $hide_until_searched ) { |
|
513 | + public function setHideUntilSearched($hide_until_searched) { |
|
514 | 514 | $this->hide_until_searched = $hide_until_searched; |
515 | 515 | } |
516 | 516 | |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | /** |
525 | 525 | * @param string $template_part_slug |
526 | 526 | */ |
527 | - public function setTemplatePartSlug( $template_part_slug ) { |
|
527 | + public function setTemplatePartSlug($template_part_slug) { |
|
528 | 528 | $this->template_part_slug = $template_part_slug; |
529 | 529 | } |
530 | 530 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | /** |
539 | 539 | * @param string $template_part_name |
540 | 540 | */ |
541 | - public function setTemplatePartName( $template_part_name ) { |
|
541 | + public function setTemplatePartName($template_part_name) { |
|
542 | 542 | $this->template_part_name = $template_part_name; |
543 | 543 | } |
544 | 544 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | */ |
549 | 549 | public function getCurrentEntry() { |
550 | 550 | |
551 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
551 | + if (in_array($this->getContext(), array('edit', 'single'))) { |
|
552 | 552 | $entries = $this->getEntries(); |
553 | 553 | $entry = $entries[0]; |
554 | 554 | } else { |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | /** @since 1.16 Fixes DataTables empty entry issue */ |
559 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
559 | + if (empty($entry) && !empty($this->_current_field['entry'])) { |
|
560 | 560 | $entry = $this->_current_field['entry']; |
561 | 561 | } |
562 | 562 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | * @param array $current_entry |
568 | 568 | * @return void |
569 | 569 | */ |
570 | - public function setCurrentEntry( $current_entry ) { |
|
570 | + public function setCurrentEntry($current_entry) { |
|
571 | 571 | $this->_current_entry = $current_entry; |
572 | 572 | } |
573 | 573 | |
@@ -589,9 +589,9 @@ discard block |
||
589 | 589 | * |
590 | 590 | * @return string|null |
591 | 591 | */ |
592 | - public function renderZone( $zone = '', $atts = array() ) { |
|
592 | + public function renderZone($zone = '', $atts = array()) { |
|
593 | 593 | |
594 | - if( empty( $zone ) ) { |
|
594 | + if (empty($zone)) { |
|
595 | 595 | do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.'); |
596 | 596 | return NULL; |
597 | 597 | } |
@@ -604,32 +604,32 @@ discard block |
||
604 | 604 | 'hide_empty' => $this->getAtts('hide_empty'), |
605 | 605 | ); |
606 | 606 | |
607 | - $final_atts = wp_parse_args( $atts, $defaults ); |
|
607 | + $final_atts = wp_parse_args($atts, $defaults); |
|
608 | 608 | |
609 | 609 | $output = ''; |
610 | 610 | |
611 | 611 | $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
612 | 612 | |
613 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
613 | + $fields = $this->getField($final_atts['zone_id']); |
|
614 | 614 | |
615 | 615 | // Backward compatibility |
616 | - if( 'table' === $this->getTemplatePartSlug() ) { |
|
616 | + if ('table' === $this->getTemplatePartSlug()) { |
|
617 | 617 | /** |
618 | 618 | * Modify the fields displayed in the table |
619 | 619 | * @var array |
620 | 620 | */ |
621 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
621 | + $fields = apply_filters("gravityview_table_cells", $fields, $this); |
|
622 | 622 | } |
623 | 623 | |
624 | - if( empty( $fields ) ) { |
|
624 | + if (empty($fields)) { |
|
625 | 625 | return NULL; |
626 | 626 | } |
627 | 627 | |
628 | 628 | $field_output = ''; |
629 | - foreach ( $fields as $field ) { |
|
629 | + foreach ($fields as $field) { |
|
630 | 630 | $final_atts['field'] = $field; |
631 | 631 | |
632 | - $field_output .= gravityview_field_output( $final_atts ); |
|
632 | + $field_output .= gravityview_field_output($final_atts); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | /** |
@@ -638,17 +638,17 @@ discard block |
||
638 | 638 | * @since 1.7.6 |
639 | 639 | * @param boolean $hide_empty_zone Default: false |
640 | 640 | */ |
641 | - if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
641 | + if (empty($field_output) && apply_filters('gravityview/render/hide-empty-zone', false)) { |
|
642 | 642 | return NULL; |
643 | 643 | } |
644 | 644 | |
645 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
646 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
645 | + if (!empty($final_atts['wrapper_class'])) { |
|
646 | + $output .= '<div class="'.gravityview_sanitize_html_class($final_atts['wrapper_class']).'">'; |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | $output .= $field_output; |
650 | 650 | |
651 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
651 | + if (!empty($final_atts['wrapper_class'])) { |
|
652 | 652 | $output .= '</div>'; |
653 | 653 | } |
654 | 654 | |
@@ -666,24 +666,24 @@ discard block |
||
666 | 666 | * @see Gamajo_Template_Loader::locate_template() |
667 | 667 | * @return null|string NULL: Template not found; String: path to template |
668 | 668 | */ |
669 | - function locate_template( $template_names, $load = false, $require_once = true ) { |
|
669 | + function locate_template($template_names, $load = false, $require_once = true) { |
|
670 | 670 | |
671 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
671 | + if (is_string($template_names) && isset($this->located_templates[$template_names])) { |
|
672 | 672 | |
673 | - $located = $this->located_templates[ $template_names ]; |
|
673 | + $located = $this->located_templates[$template_names]; |
|
674 | 674 | |
675 | 675 | } else { |
676 | 676 | |
677 | 677 | // Set $load to always false so we handle it here. |
678 | - $located = parent::locate_template( $template_names, false, $require_once ); |
|
678 | + $located = parent::locate_template($template_names, false, $require_once); |
|
679 | 679 | |
680 | - if( is_string( $template_names ) ) { |
|
681 | - $this->located_templates[ $template_names ] = $located; |
|
680 | + if (is_string($template_names)) { |
|
681 | + $this->located_templates[$template_names] = $located; |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | |
685 | - if ( $load && $located ) { |
|
686 | - load_template( $located, $require_once ); |
|
685 | + if ($load && $located) { |
|
686 | + load_template($located, $require_once); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | return $located; |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | * @param string $name Key for the data retrieval. |
695 | 695 | * @return mixed|null The stored data. |
696 | 696 | */ |
697 | - public function __get( $name ) { |
|
698 | - if( isset( $this->{$name} ) ) { |
|
697 | + public function __get($name) { |
|
698 | + if (isset($this->{$name} )) { |
|
699 | 699 | return $this->{$name}; |
700 | 700 | } else { |
701 | 701 | return NULL; |
@@ -719,47 +719,47 @@ discard block |
||
719 | 719 | * |
720 | 720 | * @return array $templates Modified template array, merged with existing $templates values |
721 | 721 | */ |
722 | - function add_id_specific_templates( $templates, $slug, $name ) { |
|
722 | + function add_id_specific_templates($templates, $slug, $name) { |
|
723 | 723 | |
724 | 724 | $additional = array(); |
725 | 725 | |
726 | 726 | // form-19-table-body.php |
727 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
727 | + $additional[] = sprintf('form-%d-%s-%s.php', $this->getFormId(), $slug, $name); |
|
728 | 728 | |
729 | 729 | // view-3-table-body.php |
730 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
730 | + $additional[] = sprintf('view-%d-%s-%s.php', $this->getViewId(), $slug, $name); |
|
731 | 731 | |
732 | - if( $this->getPostId() ) { |
|
732 | + if ($this->getPostId()) { |
|
733 | 733 | |
734 | 734 | // page-19-table-body.php |
735 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
735 | + $additional[] = sprintf('page-%d-%s-%s.php', $this->getPostId(), $slug, $name); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | // Combine with existing table-body.php and table.php |
739 | - $templates = array_merge( $additional, $templates ); |
|
739 | + $templates = array_merge($additional, $templates); |
|
740 | 740 | |
741 | - do_action( 'gravityview_log_debug', '[add_id_specific_templates] List of Template Files', $templates ); |
|
741 | + do_action('gravityview_log_debug', '[add_id_specific_templates] List of Template Files', $templates); |
|
742 | 742 | |
743 | 743 | return $templates; |
744 | 744 | } |
745 | 745 | |
746 | 746 | // Load the template |
747 | - public function render( $slug, $name, $require_once = true ) { |
|
747 | + public function render($slug, $name, $require_once = true) { |
|
748 | 748 | |
749 | - $this->setTemplatePartSlug( $slug ); |
|
749 | + $this->setTemplatePartSlug($slug); |
|
750 | 750 | |
751 | - $this->setTemplatePartName( $name ); |
|
751 | + $this->setTemplatePartName($name); |
|
752 | 752 | |
753 | - $template_file = $this->get_template_part( $slug, $name, false ); |
|
753 | + $template_file = $this->get_template_part($slug, $name, false); |
|
754 | 754 | |
755 | - do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file ); |
|
755 | + do_action('gravityview_log_debug', '[render] Rendering Template File', $template_file); |
|
756 | 756 | |
757 | - if( !empty( $template_file) ) { |
|
757 | + if (!empty($template_file)) { |
|
758 | 758 | |
759 | - if ( $require_once ) { |
|
760 | - require_once( $template_file ); |
|
759 | + if ($require_once) { |
|
760 | + require_once($template_file); |
|
761 | 761 | } else { |
762 | - require( $template_file ); |
|
762 | + require($template_file); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | } |
@@ -769,19 +769,19 @@ discard block |
||
769 | 769 | * |
770 | 770 | * @param $view_id |
771 | 771 | */ |
772 | - public function render_widget_hooks( $view_id ) { |
|
772 | + public function render_widget_hooks($view_id) { |
|
773 | 773 | |
774 | - if( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
775 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' ); |
|
774 | + if (empty($view_id) || 'single' == gravityview_get_context()) { |
|
775 | + do_action('gravityview_log_debug', __METHOD__.' - Not rendering widgets; single entry'); |
|
776 | 776 | return; |
777 | 777 | } |
778 | 778 | |
779 | - $view_data = gravityview_get_current_view_data( $view_id ); |
|
779 | + $view_data = gravityview_get_current_view_data($view_id); |
|
780 | 780 | |
781 | 781 | // get View widget configuration |
782 | 782 | $widgets = (array)$view_data['widgets']; |
783 | 783 | |
784 | - switch( current_filter() ) { |
|
784 | + switch (current_filter()) { |
|
785 | 785 | default: |
786 | 786 | case 'gravityview_before': |
787 | 787 | $zone = 'header'; |
@@ -795,10 +795,10 @@ discard block |
||
795 | 795 | * Filter widgets not in the current zone |
796 | 796 | * @since 1.16 |
797 | 797 | */ |
798 | - foreach( $widgets as $key => $widget ) { |
|
798 | + foreach ($widgets as $key => $widget) { |
|
799 | 799 | // The widget isn't in the current zone |
800 | - if( false === strpos( $key, $zone ) ) { |
|
801 | - unset( $widgets[ $key ] ); |
|
800 | + if (false === strpos($key, $zone)) { |
|
801 | + unset($widgets[$key]); |
|
802 | 802 | } |
803 | 803 | } |
804 | 804 | |
@@ -806,37 +806,37 @@ discard block |
||
806 | 806 | * Prevent output if no widgets to show. |
807 | 807 | * @since 1.16 |
808 | 808 | */ |
809 | - if ( empty( $widgets ) ) { |
|
810 | - do_action( 'gravityview_log_debug', sprintf( 'No widgets for View #%s', $view_id ) ); |
|
809 | + if (empty($widgets)) { |
|
810 | + do_action('gravityview_log_debug', sprintf('No widgets for View #%s', $view_id)); |
|
811 | 811 | return; |
812 | 812 | } |
813 | 813 | |
814 | 814 | // Prevent being called twice |
815 | - if( did_action( $zone.'_'.$view_id.'_widgets' ) ) { |
|
816 | - do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) ); |
|
815 | + if (did_action($zone.'_'.$view_id.'_widgets')) { |
|
816 | + do_action('gravityview_log_debug', sprintf('%s - Not rendering %s; already rendered', __METHOD__, $zone.'_'.$view_id.'_widgets')); |
|
817 | 817 | return; |
818 | 818 | } |
819 | 819 | |
820 | 820 | $rows = GravityView_Plugin::get_default_widget_areas(); |
821 | 821 | |
822 | 822 | // TODO: Move to sep. method, use an action instead |
823 | - wp_enqueue_style( 'gravityview_default_style' ); |
|
823 | + wp_enqueue_style('gravityview_default_style'); |
|
824 | 824 | |
825 | 825 | // TODO Convert to partials |
826 | 826 | ?> |
827 | 827 | <div class="gv-grid"> |
828 | 828 | <?php |
829 | - foreach( $rows as $row ) { |
|
830 | - foreach( $row as $col => $areas ) { |
|
829 | + foreach ($rows as $row) { |
|
830 | + foreach ($row as $col => $areas) { |
|
831 | 831 | $column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left'; |
832 | 832 | ?> |
833 | - <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
|
833 | + <div class="gv-grid-col-<?php echo esc_attr($column); ?>"> |
|
834 | 834 | <?php |
835 | - if( !empty( $areas ) ) { |
|
836 | - foreach( $areas as $area ) { |
|
837 | - if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) { |
|
838 | - foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) { |
|
839 | - do_action( "gravityview_render_widget_{$widget['id']}", $widget ); |
|
835 | + if (!empty($areas)) { |
|
836 | + foreach ($areas as $area) { |
|
837 | + if (!empty($widgets[$zone.'_'.$area['areaid']])) { |
|
838 | + foreach ($widgets[$zone.'_'.$area['areaid']] as $widget) { |
|
839 | + do_action("gravityview_render_widget_{$widget['id']}", $widget); |
|
840 | 840 | } |
841 | 841 | } |
842 | 842 | } |
@@ -852,8 +852,8 @@ discard block |
||
852 | 852 | * Prevent widgets from being called twice. |
853 | 853 | * Checking for loop_start prevents themes and plugins that pre-process shortcodes from triggering the action before displaying. Like, ahem, the Divi theme and WordPress SEO plugin |
854 | 854 | */ |
855 | - if( did_action( 'loop_start' ) ) { |
|
856 | - do_action( $zone.'_'.$view_id.'_widgets' ); |
|
855 | + if (did_action('loop_start')) { |
|
856 | + do_action($zone.'_'.$view_id.'_widgets'); |
|
857 | 857 | } |
858 | 858 | } |
859 | 859 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot' ); |
|
17 | + var $search_operators = array('is', 'isnot'); |
|
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__( 'Transaction ID', 'gravityview' ); |
|
27 | + $this->label = esc_attr__('Transaction ID', 'gravityview'); |
|
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | 30 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot' ); |
|
17 | + var $search_operators = array('is', 'isnot'); |
|
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__( 'Currency', 'gravityview' ); |
|
27 | + $this->label = esc_attr__('Currency', 'gravityview'); |
|
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | 30 | } |