@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | var $name = 'checkbox'; |
6 | 6 | |
7 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
7 | + var $search_operators = array('is', 'in', 'not in', 'isnot', 'contains'); |
|
8 | 8 | |
9 | 9 | var $_gf_field_class_name = 'GF_Field_Checkbox'; |
10 | 10 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | function __construct() { |
11 | 11 | parent::__construct(); |
12 | 12 | |
13 | - add_filter( 'gravityview_field_entry_value_section', array( $this, 'prevent_empty_field' ) ); |
|
13 | + add_filter('gravityview_field_entry_value_section', array($this, 'prevent_empty_field')); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return string If output was empty, return an empty HTML comment tag. Otherwise, return output. |
24 | 24 | */ |
25 | - function prevent_empty_field( $output = '' ) { |
|
26 | - return empty( $output ) ? '<!-- -->' : $output; |
|
25 | + function prevent_empty_field($output = '') { |
|
26 | + return empty($output) ? '<!-- -->' : $output; |
|
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 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
31 | + unset ($field_options['search_filter'], $field_options['show_as_link']); |
|
32 | 32 | |
33 | 33 | // Set the default CSS class to gv-section, which applies a border and top/bottom margin |
34 | 34 | $field_options['custom_class']['value'] = 'gv-section'; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | var $_gf_field_class_name = 'GF_Field_Text'; |
8 | 8 | |
9 | - var $search_operators = array( 'contains', 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
9 | + var $search_operators = array('contains', 'is', 'isnot', 'starts_with', 'ends_with'); |
|
10 | 10 | |
11 | 11 | var $group = 'standard'; |
12 | 12 |
@@ -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,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 |
@@ -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-beta |
|
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-beta |
|
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'), |
@@ -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; |