@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param GF_Field_List $field Gravity Forms field |
27 | 27 | * @param string|array $field_value Serialized or unserialized array value for the field |
28 | - * @param int|string $column_id The numeric key of the column (0-index) or the label of the column |
|
28 | + * @param integer $column_id The numeric key of the column (0-index) or the label of the column |
|
29 | 29 | * @param string $format If set to 'raw', return an array of values for the column. Otherwise, allow Gravity Forms to render using `html` or `text` |
30 | 30 | * |
31 | 31 | * @return array|string|null Returns null if the $field_value passed wasn't an array or serialized array |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'list'; |
11 | 11 | |
12 | - var $search_operators = array( 'contains' ); |
|
12 | + var $search_operators = array('contains'); |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @var bool |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | function __construct() { |
27 | 27 | |
28 | - $this->label = esc_attr__( 'List', 'gravityview' ); |
|
28 | + $this->label = esc_attr__('List', 'gravityview'); |
|
29 | 29 | |
30 | 30 | parent::__construct(); |
31 | 31 | |
32 | - add_filter( 'gravityview/template/field_label', array( $this, '_filter_field_label' ), 10, 4 ); |
|
32 | + add_filter('gravityview/template/field_label', array($this, '_filter_field_label'), 10, 4); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array|string|null Returns null if the $field_value passed wasn't an array or serialized array |
48 | 48 | */ |
49 | - public static function column_value( GF_Field_List $field, $field_value, $column_id = 0, $format = 'html' ) { |
|
49 | + public static function column_value(GF_Field_List $field, $field_value, $column_id = 0, $format = 'html') { |
|
50 | 50 | |
51 | - $list_rows = maybe_unserialize( $field_value ); |
|
51 | + $list_rows = maybe_unserialize($field_value); |
|
52 | 52 | |
53 | - if( ! is_array( $list_rows ) ) { |
|
54 | - do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
|
53 | + if (!is_array($list_rows)) { |
|
54 | + do_action('gravityview_log_error', __METHOD__.' - $field_value did not unserialize', $field_value); |
|
55 | 55 | return null; |
56 | 56 | } |
57 | 57 | |
58 | 58 | $column_values = array(); |
59 | 59 | |
60 | 60 | // Each list row |
61 | - foreach ( $list_rows as $list_row ) { |
|
61 | + foreach ($list_rows as $list_row) { |
|
62 | 62 | $current_column = 0; |
63 | - foreach ( $list_row as $column_key => $column_value ) { |
|
63 | + foreach ($list_row as $column_key => $column_value) { |
|
64 | 64 | |
65 | 65 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
66 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
66 | + if ((string)$column_key === (string)$column_id || (is_numeric($column_id) && (int)$column_id === $current_column)) { |
|
67 | 67 | $column_values[] = $column_value; |
68 | 68 | } |
69 | 69 | $current_column++; |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | // Return the array of values |
74 | - if( 'raw' === $format ) { |
|
74 | + if ('raw' === $format) { |
|
75 | 75 | return $column_values; |
76 | 76 | } |
77 | 77 | // Return the Gravity Forms Field output |
78 | 78 | else { |
79 | - return $field->get_value_entry_detail( serialize( $column_values ), '', false, $format ); |
|
79 | + return $field->get_value_entry_detail(serialize($column_values), '', false, $format); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return string Existing label if the field isn't |
94 | 94 | */ |
95 | - public function _filter_field_label( $label, $field, $form, $entry ) { |
|
95 | + public function _filter_field_label($label, $field, $form, $entry) { |
|
96 | 96 | |
97 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
97 | + $field_object = RGFormsModel::get_field($form, $field['id']); |
|
98 | 98 | |
99 | 99 | // Not a list field |
100 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
100 | + if (!$field_object || 'list' !== $field_object->type) { |
|
101 | 101 | return $label; |
102 | 102 | } |
103 | 103 | |
104 | 104 | // Custom label is defined, so use it |
105 | - if( ! empty( $field['custom_label'] ) ) { |
|
105 | + if (!empty($field['custom_label'])) { |
|
106 | 106 | return $label; |
107 | 107 | } |
108 | 108 | |
109 | - $field_id_array = explode( '.', $field['id'] ); |
|
109 | + $field_id_array = explode('.', $field['id']); |
|
110 | 110 | |
111 | 111 | // Parent field, not column field |
112 | - if( ! isset( $field_id_array[1] ) ) { |
|
112 | + if (!isset($field_id_array[1])) { |
|
113 | 113 | return $label; |
114 | 114 | } |
115 | 115 | |
116 | - $column_id = intval( $field_id_array[1] ); |
|
116 | + $column_id = intval($field_id_array[1]); |
|
117 | 117 | |
118 | - return self::get_column_label( $field_object, $column_id, $label ); |
|
118 | + return self::get_column_label($field_object, $column_id, $label); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
|
132 | + public static function get_column_label(GF_Field_List $field, $column_id, $backup_label = '') { |
|
133 | 133 | |
134 | 134 | // Doesn't have columns enabled |
135 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
135 | + if (!isset($field->choices) || !$field->enableColumns) { |
|
136 | 136 | return $backup_label; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Get the list of columns, with numeric index keys |
140 | - $columns = wp_list_pluck( $field->choices, 'text' ); |
|
140 | + $columns = wp_list_pluck($field->choices, 'text'); |
|
141 | 141 | |
142 | - return isset( $columns[ $column_id ] ) ? $columns[ $column_id ] : $backup_label; |
|
142 | + return isset($columns[$column_id]) ? $columns[$column_id] : $backup_label; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | } |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | |
8 | 8 | var $name = 'address'; |
9 | 9 | |
10 | - function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
10 | + function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') { |
|
11 | 11 | |
12 | 12 | // If this is NOT the full address field, return default options. |
13 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
13 | + if (floor($field_id) !== floatval($field_id)) { |
|
14 | 14 | return $field_options; |
15 | 15 | } |
16 | 16 | |
17 | - if( 'edit' === $context ) { |
|
17 | + if ('edit' === $context) { |
|
18 | 18 | return $field_options; |
19 | 19 | } |
20 | 20 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | $add_options['show_map_link'] = array( |
24 | 24 | 'type' => 'checkbox', |
25 | - 'label' => __( 'Show Map Link:', 'gravityview' ), |
|
25 | + 'label' => __('Show Map Link:', 'gravityview'), |
|
26 | 26 | 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
27 | 27 | 'value' => true, |
28 | 28 | 'merge_tags' => false, |
@@ -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 |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | /* @var GravityView_Field[] */ |
6 | 6 | private static $_fields = array(); |
7 | 7 | |
8 | - public static function register( $field ) { |
|
9 | - if ( ! is_subclass_of( $field, 'GravityView_Field' ) ) { |
|
10 | - throw new Exception( 'Must be a subclass of GravityView_Field' ); |
|
8 | + public static function register($field) { |
|
9 | + if (!is_subclass_of($field, 'GravityView_Field')) { |
|
10 | + throw new Exception('Must be a subclass of GravityView_Field'); |
|
11 | 11 | } |
12 | - if ( empty( $field->type ) ) { |
|
13 | - throw new Exception( 'The type must be set' ); |
|
12 | + if (empty($field->type)) { |
|
13 | + throw new Exception('The type must be set'); |
|
14 | 14 | } |
15 | - if ( isset( self::$_fields[ $field->type ] ) ) { |
|
16 | - throw new Exception( 'Field type already registered: ' . $field->type ); |
|
15 | + if (isset(self::$_fields[$field->type])) { |
|
16 | + throw new Exception('Field type already registered: '.$field->type); |
|
17 | 17 | } |
18 | - self::$_fields[ $field->type ] = $field; |
|
18 | + self::$_fields[$field->type] = $field; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return GravityView_Field | bool |
25 | 25 | */ |
26 | - public static function create( $properties ) { |
|
26 | + public static function create($properties) { |
|
27 | 27 | $type = isset($properties['type']) ? $properties['type'] : ''; |
28 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
29 | - if ( empty($type) || ! isset( self::$_fields[ $type ] ) ) { |
|
30 | - return new GravityView_Field( $properties ); |
|
28 | + $type = empty($properties['inputType']) ? $type : $properties['inputType']; |
|
29 | + if (empty($type) || !isset(self::$_fields[$type])) { |
|
30 | + return new GravityView_Field($properties); |
|
31 | 31 | } |
32 | - $class = self::$_fields[ $type ]; |
|
33 | - $class_name = get_class( $class ); |
|
34 | - $field = new $class_name( $properties ); |
|
32 | + $class = self::$_fields[$type]; |
|
33 | + $class_name = get_class($class); |
|
34 | + $field = new $class_name($properties); |
|
35 | 35 | |
36 | 36 | return $field; |
37 | 37 |
@@ -4,18 +4,18 @@ |
||
4 | 4 | |
5 | 5 | var $name = 'created_by'; |
6 | 6 | |
7 | - var $search_operators = array( 'is', 'isnot' ); |
|
7 | + var $search_operators = array('is', 'isnot'); |
|
8 | 8 | |
9 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
9 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
10 | 10 | |
11 | - if( 'edit' === $context ) { |
|
11 | + if ('edit' === $context) { |
|
12 | 12 | return $field_options; |
13 | 13 | } |
14 | 14 | |
15 | 15 | $field_options['name_display'] = array( |
16 | 16 | 'type' => 'select', |
17 | - 'label' => __( 'User Format', 'gravityview' ), |
|
18 | - 'desc' => __( 'How should the User information be displayed?', 'gravityview'), |
|
17 | + 'label' => __('User Format', 'gravityview'), |
|
18 | + 'desc' => __('How should the User information be displayed?', 'gravityview'), |
|
19 | 19 | 'choices' => array( |
20 | 20 | 'display_name' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'), |
21 | 21 | 'user_login' => __('Username (Example: "nostromo")', 'gravityview'), |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | var $name = 'custom'; |
10 | 10 | |
11 | - var $contexts = array( 'single', 'multiple', 'edit' ); |
|
11 | + var $contexts = array('single', 'multiple', 'edit'); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @var bool |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | */ |
23 | 23 | var $is_searchable = false; |
24 | 24 | |
25 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
25 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
26 | 26 | |
27 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
27 | + unset ($field_options['search_filter'], $field_options['show_as_link']); |
|
28 | 28 | |
29 | - if( 'edit' === $context ) { |
|
29 | + if ('edit' === $context) { |
|
30 | 30 | return $field_options; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $new_fields = array( |
34 | 34 | 'content' => array( |
35 | 35 | 'type' => 'textarea', |
36 | - 'label' => __( 'Custom Content', 'gravityview' ), |
|
37 | - 'desc' => sprintf( __( 'Enter text or HTML. Also supports shortcodes. You can show or hide data using the %s shortcode (%slearn more%s).', 'gravityview' ), '<code>[gvlogic]</code>', '<a href="http://docs.gravityview.co/article/252-gvlogic-shortcode">', '</a>' ), |
|
36 | + 'label' => __('Custom Content', 'gravityview'), |
|
37 | + 'desc' => sprintf(__('Enter text or HTML. Also supports shortcodes. You can show or hide data using the %s shortcode (%slearn more%s).', 'gravityview'), '<code>[gvlogic]</code>', '<a href="http://docs.gravityview.co/article/252-gvlogic-shortcode">', '</a>'), |
|
38 | 38 | 'value' => '', |
39 | 39 | 'class' => 'code', |
40 | 40 | 'merge_tags' => 'force', |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | ), |
43 | 43 | 'wpautop' => array( |
44 | 44 | 'type' => 'checkbox', |
45 | - 'label' => __( 'Automatically add paragraphs to content', 'gravityview' ), |
|
46 | - 'tooltip' => __( 'Wrap each block of text in an HTML paragraph tag (recommended for text).', 'gravityview' ), |
|
45 | + 'label' => __('Automatically add paragraphs to content', 'gravityview'), |
|
46 | + 'tooltip' => __('Wrap each block of text in an HTML paragraph tag (recommended for text).', 'gravityview'), |
|
47 | 47 | 'value' => '', |
48 | 48 | ), |
49 | 49 | ); |
@@ -7,13 +7,13 @@ |
||
7 | 7 | |
8 | 8 | var $name = 'date'; |
9 | 9 | |
10 | - function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
10 | + function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') { |
|
11 | 11 | |
12 | - if( 'edit' === $context ) { |
|
12 | + if ('edit' === $context) { |
|
13 | 13 | return $field_options; |
14 | 14 | } |
15 | 15 | |
16 | - $this->add_field_support('date_display', $field_options ); |
|
16 | + $this->add_field_support('date_display', $field_options); |
|
17 | 17 | |
18 | 18 | return $field_options; |
19 | 19 | } |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | |
8 | 8 | var $name = 'email'; |
9 | 9 | |
10 | - var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' ); |
|
10 | + var $search_operators = array('is', 'isnot', 'contains', 'starts_with', 'ends_with'); |
|
11 | 11 | |
12 | 12 | var $_gf_field_class_name = 'GF_Field_Email'; |
13 | 13 | |
14 | - function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
14 | + function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') { |
|
15 | 15 | |
16 | 16 | // It makes no sense to use this as the link. |
17 | - unset( $field_options['show_as_link'] ); |
|
17 | + unset($field_options['show_as_link']); |
|
18 | 18 | |
19 | - if( 'edit' === $context ) { |
|
19 | + if ('edit' === $context) { |
|
20 | 20 | return $field_options; |
21 | 21 | } |
22 | 22 | |
@@ -24,29 +24,29 @@ discard block |
||
24 | 24 | 'emailmailto' => array( |
25 | 25 | 'type' => 'checkbox', |
26 | 26 | 'value' => true, |
27 | - 'label' => __( 'Link the Email Address', 'gravityview' ), |
|
28 | - 'desc' => __( 'Clicking the link will generate a new email.', 'gravityview' ), |
|
27 | + 'label' => __('Link the Email Address', 'gravityview'), |
|
28 | + 'desc' => __('Clicking the link will generate a new email.', 'gravityview'), |
|
29 | 29 | ), |
30 | 30 | 'emailsubject' => array( |
31 | 31 | 'type' => 'text', |
32 | - 'label' => __( 'Email Subject', 'gravityview' ), |
|
32 | + 'label' => __('Email Subject', 'gravityview'), |
|
33 | 33 | 'value' => '', |
34 | - 'desc' => __( 'Set the default email subject line.', 'gravityview' ), |
|
34 | + 'desc' => __('Set the default email subject line.', 'gravityview'), |
|
35 | 35 | 'merge_tags' => 'force', |
36 | 36 | ), |
37 | 37 | 'emailbody' => array( |
38 | 38 | 'type' => 'textarea', |
39 | - 'label' => __( 'Email Body', 'gravityview' ), |
|
39 | + 'label' => __('Email Body', 'gravityview'), |
|
40 | 40 | 'value' => '', |
41 | - 'desc' => __( 'Set the default email content.', 'gravityview' ), |
|
41 | + 'desc' => __('Set the default email content.', 'gravityview'), |
|
42 | 42 | 'merge_tags' => 'force', |
43 | 43 | 'class' => 'widefat', |
44 | 44 | ), |
45 | 45 | 'emailencrypt' => array( |
46 | 46 | 'type' => 'checkbox', |
47 | 47 | 'value' => true, |
48 | - 'label' => __( 'Encrypt Email Address', 'gravityview' ), |
|
49 | - 'desc' => __( 'Make it harder for spammers to get email addresses from your entries. Email addresses will not be visible with Javascript disabled.', 'gravityview' ) |
|
48 | + 'label' => __('Encrypt Email Address', 'gravityview'), |
|
49 | + 'desc' => __('Make it harder for spammers to get email addresses from your entries. Email addresses will not be visible with Javascript disabled.', 'gravityview') |
|
50 | 50 | ) |
51 | 51 | ); |
52 | 52 |
@@ -7,15 +7,15 @@ |
||
7 | 7 | |
8 | 8 | var $name = 'date_created'; |
9 | 9 | |
10 | - var $search_operators = array( 'less_than', 'greater_than', 'is', 'isnot' ); |
|
10 | + var $search_operators = array('less_than', 'greater_than', 'is', 'isnot'); |
|
11 | 11 | |
12 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
12 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
13 | 13 | |
14 | - if( 'edit' === $context ) { |
|
14 | + if ('edit' === $context) { |
|
15 | 15 | return $field_options; |
16 | 16 | } |
17 | 17 | |
18 | - $this->add_field_support('date_display', $field_options ); |
|
18 | + $this->add_field_support('date_display', $field_options); |
|
19 | 19 | |
20 | 20 | return $field_options; |
21 | 21 | } |