@@ -88,15 +88,15 @@ |
||
| 88 | 88 | */ |
| 89 | 89 | public function maybe_modify_button_label( $label = '', $atts = array() ) { |
| 90 | 90 | |
| 91 | - if( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
| 91 | + if ( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
| 92 | 92 | return $label; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
| 95 | + if ( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
| 96 | 96 | return $label; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
| 99 | + if ( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
| 100 | 100 | return $label; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
| 66 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
| 65 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
| 66 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
| 67 | 67 | $form = GravityView_View::getInstance()->getForm(); |
| 68 | 68 | |
| 69 | 69 | /** @var GF_Field_Address $address_field */ |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $choices = array(); |
| 73 | 73 | |
| 74 | 74 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
| 75 | - if( method_exists( $this, $method_name ) ) { |
|
| 75 | + if ( method_exists( $this, $method_name ) ) { |
|
| 76 | 76 | /** |
| 77 | 77 | * @uses GravityView_Field_Address::get_choices_country() |
| 78 | 78 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | $choices = $this->{$method_name}( $address_field, $form ); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if( ! empty( $choices ) ) { |
|
| 84 | - $search_field['choices'] = $choices; |
|
| 85 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
| 83 | + if ( ! empty( $choices ) ) { |
|
| 84 | + $search_field[ 'choices' ] = $choices; |
|
| 85 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
| 86 | 86 | } else { |
| 87 | - $search_field['type'] = 'text'; |
|
| 88 | - $search_field['input'] = 'input_text'; |
|
| 87 | + $search_field[ 'type' ] = 'text'; |
|
| 88 | + $search_field[ 'input' ] = 'input_text'; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $country_choices = array(); |
| 111 | 111 | |
| 112 | 112 | foreach ( $countries as $key => $country ) { |
| 113 | - $country_choices[] = array( |
|
| 113 | + $country_choices[ ] = array( |
|
| 114 | 114 | 'value' => $country, |
| 115 | 115 | 'text' => $country, |
| 116 | 116 | ); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | private function get_choices_state( $address_field, $form ) { |
| 137 | 137 | |
| 138 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
| 138 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
| 139 | 139 | |
| 140 | 140 | $state_choices = array(); |
| 141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | $states = GFCommon::get_canadian_provinces(); |
| 148 | 148 | break; |
| 149 | 149 | default: |
| 150 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
| 151 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
| 150 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
| 151 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
| 152 | 152 | break; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -157,19 +157,19 @@ discard block |
||
| 157 | 157 | $state_subchoices = array(); |
| 158 | 158 | |
| 159 | 159 | foreach ( $state as $key => $substate ) { |
| 160 | - $state_subchoices[] = array( |
|
| 160 | + $state_subchoices[ ] = array( |
|
| 161 | 161 | 'value' => is_numeric( $key ) ? $substate : $key, |
| 162 | 162 | 'text' => $substate, |
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $state_choices[] = array( |
|
| 166 | + $state_choices[ ] = array( |
|
| 167 | 167 | 'text' => $key, |
| 168 | 168 | 'value' => $state_subchoices, |
| 169 | 169 | ); |
| 170 | 170 | |
| 171 | 171 | } else { |
| 172 | - $state_choices[] = array( |
|
| 172 | + $state_choices[ ] = array( |
|
| 173 | 173 | 'value' => is_numeric( $key ) ? $state : $key, |
| 174 | 174 | 'text' => $state, |
| 175 | 175 | ); |
@@ -193,13 +193,13 @@ discard block |
||
| 193 | 193 | // Use the same inputs as the "text" input type allows |
| 194 | 194 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
| 195 | 195 | |
| 196 | - $input_types['street'] = $text_inputs; |
|
| 197 | - $input_types['street2'] = $text_inputs; |
|
| 198 | - $input_types['city'] = $text_inputs; |
|
| 196 | + $input_types[ 'street' ] = $text_inputs; |
|
| 197 | + $input_types[ 'street2' ] = $text_inputs; |
|
| 198 | + $input_types[ 'city' ] = $text_inputs; |
|
| 199 | 199 | |
| 200 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 201 | - $input_types['zip'] = array( 'input_text' ); |
|
| 202 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 200 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 201 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
| 202 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 203 | 203 | |
| 204 | 204 | return $input_types; |
| 205 | 205 | } |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
| 221 | 221 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
| 222 | 222 | |
| 223 | - if( 'address' !== $field_type && $input_id ) { |
|
| 223 | + if ( 'address' !== $field_type && $input_id ) { |
|
| 224 | 224 | return $input_type; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
| 228 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 228 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 229 | 229 | $input_type = $address_field_name; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -273,20 +273,20 @@ discard block |
||
| 273 | 273 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 274 | 274 | |
| 275 | 275 | // If this is NOT the full address field, return default options. |
| 276 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 276 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 277 | 277 | return $field_options; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if( 'edit' === $context ) { |
|
| 280 | + if ( 'edit' === $context ) { |
|
| 281 | 281 | return $field_options; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | $add_options = array(); |
| 285 | 285 | |
| 286 | - $add_options['show_map_link'] = array( |
|
| 286 | + $add_options[ 'show_map_link' ] = array( |
|
| 287 | 287 | 'type' => 'checkbox', |
| 288 | 288 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 289 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
| 289 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
| 290 | 290 | 'value' => true, |
| 291 | 291 | 'merge_tags' => false, |
| 292 | 292 | ); |
@@ -47,7 +47,6 @@ |
||
| 47 | 47 | * @param string $atts |
| 48 | 48 | * @param string $css_class |
| 49 | 49 | * @param string $anchor_text |
| 50 | - * @param string $link_text |
|
| 51 | 50 | * |
| 52 | 51 | * @return string If no article information exists, original tooltip. Otherwise, modified! |
| 53 | 52 | */ |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function maybe_add_article_to_tooltip( $tooltip = '', $article = array(), $url = '', $atts = '', $css_class = '', $anchor_text = '' ) { |
| 55 | 55 | |
| 56 | - if ( empty( $article['id'] ) ) { |
|
| 56 | + if ( empty( $article[ 'id' ] ) ) { |
|
| 57 | 57 | return $tooltip; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $css_class .= ' gv_tooltip'; |
| 71 | 71 | |
| 72 | - if ( ! empty( $article['type'] ) ) { |
|
| 73 | - $atts = sprintf( 'data-beacon-article-%s="%s"', $article['type'], $article['id'] ); |
|
| 72 | + if ( ! empty( $article[ 'type' ] ) ) { |
|
| 73 | + $atts = sprintf( 'data-beacon-article-%s="%s"', $article[ 'type' ], $article[ 'id' ] ); |
|
| 74 | 74 | } else { |
| 75 | - $atts = sprintf( 'data-beacon-article="%s"', $article['id'] ); |
|
| 75 | + $atts = sprintf( 'data-beacon-article="%s"', $article[ 'id' ] ); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $url = \GV\Utils::get( $article, 'url', '#' ); |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | ) ); |
| 172 | 172 | |
| 173 | 173 | // This is just HTML we don't need. |
| 174 | - unset( $response['message'] ); |
|
| 174 | + unset( $response[ 'message' ] ); |
|
| 175 | 175 | |
| 176 | - switch ( intval( $response['price_id'] ) ) { |
|
| 176 | + switch ( intval( $response[ 'price_id' ] ) ) { |
|
| 177 | 177 | default: |
| 178 | 178 | case 1: |
| 179 | 179 | $package = 'Core'; |
@@ -199,12 +199,12 @@ discard block |
||
| 199 | 199 | 'email' => $current_user->user_email, |
| 200 | 200 | 'name' => mb_substr( $current_user->display_name, 0, 80 ), |
| 201 | 201 | 'signature' => hash_hmac( 'sha256', $current_user->user_email, self::beacon_key ), |
| 202 | - 'License Key' => $response['license_key'] . ' (' . ucwords( $response['license'] ) . ')', |
|
| 202 | + 'License Key' => $response[ 'license_key' ] . ' (' . ucwords( $response[ 'license' ] ) . ')', |
|
| 203 | 203 | 'License Level' => $package, |
| 204 | 204 | 'Alt Emails' => sprintf( "Admin: %s, GV Support: %s", get_bloginfo( 'admin_email' ), gravityview()->plugin->settings->get( 'support-email' ) ), |
| 205 | - 'Payment Details' => $response['customer_name'] . ' ' . $response['customer_email'], |
|
| 205 | + 'Payment Details' => $response[ 'customer_name' ] . ' ' . $response[ 'customer_email' ], |
|
| 206 | 206 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
| 207 | - 'PHP Version' => phpversion() . ' on ' . esc_html( $_SERVER['SERVER_SOFTWARE'] ), |
|
| 207 | + 'PHP Version' => phpversion() . ' on ' . esc_html( $_SERVER[ 'SERVER_SOFTWARE' ] ), |
|
| 208 | 208 | 'No-Conflict Mode' => empty( $no_conflict_mode ) ? 'Disabled' : 'Enabled', |
| 209 | 209 | 'GravityView Version' => \GV\Plugin::$version, |
| 210 | 210 | 'Gravity Forms Version' => GFForms::$version, |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | ob_get_clean(); |
| 215 | 215 | |
| 216 | 216 | // Help Scout length limit is 200 characters |
| 217 | - foreach( $data as $key => $value ) { |
|
| 217 | + foreach ( $data as $key => $value ) { |
|
| 218 | 218 | if ( ! is_string( $value ) ) { |
| 219 | 219 | continue; |
| 220 | 220 | } |
@@ -10,107 +10,107 @@ discard block |
||
| 10 | 10 | * |
| 11 | 11 | * @var string |
| 12 | 12 | */ |
| 13 | - protected $name; |
|
| 13 | + protected $name; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Field settings |
| 17 | 17 | * |
| 18 | 18 | * @var array |
| 19 | 19 | */ |
| 20 | - protected $field; |
|
| 20 | + protected $field; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Field current value |
| 24 | 24 | * |
| 25 | 25 | * @var mixed |
| 26 | 26 | */ |
| 27 | - protected $value; |
|
| 28 | - |
|
| 29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
| 30 | - |
|
| 31 | - $this->name = $name; |
|
| 32 | - |
|
| 33 | - $defaults = self::get_field_defaults(); |
|
| 34 | - |
|
| 35 | - // Backward compatibility |
|
| 36 | - if( !empty( $field['choices'] ) ) { |
|
| 37 | - $field['options'] = $field['choices']; |
|
| 38 | - unset( $field['choices'] ); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
| 42 | - |
|
| 43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
| 44 | - |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Returns the default details for a field option |
|
| 49 | - * |
|
| 50 | - * - default // default option value, in case nothing is defined (@deprecated) |
|
| 51 | - * - desc // option description |
|
| 52 | - * - value // the option default value |
|
| 53 | - * - label // the option label |
|
| 54 | - * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
| 55 | - * - id // the field id |
|
| 56 | - * - type // the option type ( text, checkbox, select, ... ) |
|
| 57 | - * - options // when type is select, define the select options ('choices' is @deprecated) |
|
| 58 | - * - merge_tags // if the option supports merge tags feature |
|
| 59 | - * - class // (new) define extra classes for the field |
|
| 60 | - * - tooltip // |
|
| 61 | - * |
|
| 62 | - * @return array |
|
| 63 | - */ |
|
| 64 | - public static function get_field_defaults() { |
|
| 65 | - return array( |
|
| 66 | - 'desc' => '', |
|
| 67 | - 'value' => null, |
|
| 68 | - 'label' => '', |
|
| 69 | - 'left_label' => null, |
|
| 70 | - 'id' => null, |
|
| 71 | - 'type' => 'text', |
|
| 72 | - 'options' => null, |
|
| 73 | - 'merge_tags' => true, |
|
| 74 | - 'class' => '', |
|
| 75 | - 'tooltip' => null, |
|
| 76 | - 'requires' => null |
|
| 77 | - ); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - |
|
| 81 | - function get_tooltip() { |
|
| 82 | - if( ! function_exists('gform_tooltip') ) { |
|
| 83 | - return null; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $article = wp_parse_args( \GV\Utils::get( $this->field, 'article', array() ), array( |
|
| 87 | - 'id' => '', |
|
| 88 | - 'type' => 'inline', |
|
| 89 | - 'url' => '#', |
|
| 90 | - ) ); |
|
| 91 | - |
|
| 92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Displays the tooltip |
|
| 97 | - * |
|
| 98 | - * @since 2.8.1 |
|
| 99 | - * |
|
| 100 | - * @global $__gf_tooltips |
|
| 101 | - * |
|
| 102 | - * @param string $name The name of the tooltip to be displayed |
|
| 103 | - * @param string $css_class Optional. The CSS class to apply toi the element. Defaults to empty string. |
|
| 104 | - * @param bool $return Optional. If the tooltip should be returned instead of output. Defaults to false (output) |
|
| 105 | - * @param array $article Optional. Details about support doc article connected to the tooltip. { |
|
| 106 | - * @type string $id Unique ID of article for Beacon API |
|
| 107 | - * @type string $url URL of support doc article |
|
| 108 | - * @type string $type Type of Beacon element to open. {@see https://developer.helpscout.com/beacon-2/web/javascript-api/#beaconarticle} |
|
| 109 | - * } |
|
| 110 | - * |
|
| 111 | - * @return string |
|
| 112 | - */ |
|
| 113 | - function tooltip( $name, $css_class = '', $return = false, $article = array() ) { |
|
| 27 | + protected $value; |
|
| 28 | + |
|
| 29 | + function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
| 30 | + |
|
| 31 | + $this->name = $name; |
|
| 32 | + |
|
| 33 | + $defaults = self::get_field_defaults(); |
|
| 34 | + |
|
| 35 | + // Backward compatibility |
|
| 36 | + if( !empty( $field['choices'] ) ) { |
|
| 37 | + $field['options'] = $field['choices']; |
|
| 38 | + unset( $field['choices'] ); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
| 42 | + |
|
| 43 | + $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
| 44 | + |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Returns the default details for a field option |
|
| 49 | + * |
|
| 50 | + * - default // default option value, in case nothing is defined (@deprecated) |
|
| 51 | + * - desc // option description |
|
| 52 | + * - value // the option default value |
|
| 53 | + * - label // the option label |
|
| 54 | + * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
| 55 | + * - id // the field id |
|
| 56 | + * - type // the option type ( text, checkbox, select, ... ) |
|
| 57 | + * - options // when type is select, define the select options ('choices' is @deprecated) |
|
| 58 | + * - merge_tags // if the option supports merge tags feature |
|
| 59 | + * - class // (new) define extra classes for the field |
|
| 60 | + * - tooltip // |
|
| 61 | + * |
|
| 62 | + * @return array |
|
| 63 | + */ |
|
| 64 | + public static function get_field_defaults() { |
|
| 65 | + return array( |
|
| 66 | + 'desc' => '', |
|
| 67 | + 'value' => null, |
|
| 68 | + 'label' => '', |
|
| 69 | + 'left_label' => null, |
|
| 70 | + 'id' => null, |
|
| 71 | + 'type' => 'text', |
|
| 72 | + 'options' => null, |
|
| 73 | + 'merge_tags' => true, |
|
| 74 | + 'class' => '', |
|
| 75 | + 'tooltip' => null, |
|
| 76 | + 'requires' => null |
|
| 77 | + ); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + |
|
| 81 | + function get_tooltip() { |
|
| 82 | + if( ! function_exists('gform_tooltip') ) { |
|
| 83 | + return null; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $article = wp_parse_args( \GV\Utils::get( $this->field, 'article', array() ), array( |
|
| 87 | + 'id' => '', |
|
| 88 | + 'type' => 'inline', |
|
| 89 | + 'url' => '#', |
|
| 90 | + ) ); |
|
| 91 | + |
|
| 92 | + return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Displays the tooltip |
|
| 97 | + * |
|
| 98 | + * @since 2.8.1 |
|
| 99 | + * |
|
| 100 | + * @global $__gf_tooltips |
|
| 101 | + * |
|
| 102 | + * @param string $name The name of the tooltip to be displayed |
|
| 103 | + * @param string $css_class Optional. The CSS class to apply toi the element. Defaults to empty string. |
|
| 104 | + * @param bool $return Optional. If the tooltip should be returned instead of output. Defaults to false (output) |
|
| 105 | + * @param array $article Optional. Details about support doc article connected to the tooltip. { |
|
| 106 | + * @type string $id Unique ID of article for Beacon API |
|
| 107 | + * @type string $url URL of support doc article |
|
| 108 | + * @type string $type Type of Beacon element to open. {@see https://developer.helpscout.com/beacon-2/web/javascript-api/#beaconarticle} |
|
| 109 | + * } |
|
| 110 | + * |
|
| 111 | + * @return string |
|
| 112 | + */ |
|
| 113 | + function tooltip( $name, $css_class = '', $return = false, $article = array() ) { |
|
| 114 | 114 | global $__gf_tooltips; //declared as global to improve WPML performance |
| 115 | 115 | |
| 116 | 116 | $css_class = empty( $css_class ) ? 'tooltip' : $css_class; |
@@ -128,17 +128,17 @@ discard block |
||
| 128 | 128 | $tooltip_class = isset( $__gf_tooltips[ $name ] ) ? "tooltip_{$name}" : ''; |
| 129 | 129 | $tooltip_class = esc_attr( $tooltip_class ); |
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * Below this line has been modified by GravityView. |
|
| 133 | - */ |
|
| 131 | + /** |
|
| 132 | + * Below this line has been modified by GravityView. |
|
| 133 | + */ |
|
| 134 | 134 | |
| 135 | 135 | if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
| 136 | 136 | return ''; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $url = '#'; |
| 140 | - $atts = 'onclick="return false;" onkeypress="return false;"'; |
|
| 141 | - $anchor_text = '<i class=\'fa fa-question-circle\'></i>'; |
|
| 140 | + $atts = 'onclick="return false;" onkeypress="return false;"'; |
|
| 141 | + $anchor_text = '<i class=\'fa fa-question-circle\'></i>'; |
|
| 142 | 142 | $css_class = gravityview_sanitize_html_class( 'gf_tooltip ' . $css_class . ' ' . $tooltip_class ); |
| 143 | 143 | |
| 144 | 144 | $tooltip = sprintf( '<a href="%s" %s class="%s" title="%s" role="button">%s</a>', |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | $anchor_text |
| 150 | 150 | ); |
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Modify the tooltip HTML before outputting |
|
| 154 | - * @internal |
|
| 155 | - * @see GravityView_Support_Port::maybe_add_article_to_tooltip() |
|
| 156 | - */ |
|
| 152 | + /** |
|
| 153 | + * Modify the tooltip HTML before outputting |
|
| 154 | + * @internal |
|
| 155 | + * @see GravityView_Support_Port::maybe_add_article_to_tooltip() |
|
| 156 | + */ |
|
| 157 | 157 | $tooltip = apply_filters( 'gravityview/tooltips/tooltip', $tooltip, $article, $url, $atts, $css_class, $tooltip_text, $anchor_text ); |
| 158 | 158 | |
| 159 | 159 | if ( ! $return ) { |
@@ -163,84 +163,84 @@ discard block |
||
| 163 | 163 | return $tooltip; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Build input id based on the name |
|
| 168 | - * @return string |
|
| 169 | - */ |
|
| 170 | - function get_field_id() { |
|
| 171 | - if( isset( $this->field['id'] ) ) { |
|
| 172 | - return esc_attr( $this->field['id'] ); |
|
| 173 | - } |
|
| 174 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Retrieve field label |
|
| 179 | - * @return string |
|
| 180 | - */ |
|
| 181 | - function get_field_label() { |
|
| 182 | - return esc_html( trim( $this->field['label'] ) ); |
|
| 183 | - } |
|
| 166 | + /** |
|
| 167 | + * Build input id based on the name |
|
| 168 | + * @return string |
|
| 169 | + */ |
|
| 170 | + function get_field_id() { |
|
| 171 | + if( isset( $this->field['id'] ) ) { |
|
| 172 | + return esc_attr( $this->field['id'] ); |
|
| 173 | + } |
|
| 174 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * Retrieve field label |
|
| 179 | + * @return string |
|
| 180 | + */ |
|
| 181 | + function get_field_label() { |
|
| 182 | + return esc_html( trim( $this->field['label'] ) ); |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | 186 | * Retrieve field left label |
| 187 | - * |
|
| 188 | - * @since 1.7 |
|
| 189 | - * |
|
| 187 | + * |
|
| 188 | + * @since 1.7 |
|
| 189 | + * |
|
| 190 | 190 | * @return string |
| 191 | 191 | */ |
| 192 | 192 | function get_field_left_label() { |
| 193 | 193 | return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - /** |
|
| 197 | - * Retrieve field label class |
|
| 198 | - * @return string |
|
| 199 | - */ |
|
| 200 | - function get_label_class() { |
|
| 201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Retrieve field description |
|
| 207 | - * @return string |
|
| 208 | - */ |
|
| 209 | - function get_field_desc() { |
|
| 210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * Verify if field should have merge tags |
|
| 216 | - * @return boolean |
|
| 217 | - */ |
|
| 218 | - function show_merge_tags() { |
|
| 219 | - // Show the merge tags if the field is a list view |
|
| 220 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
| 221 | - // Or is a single entry view |
|
| 222 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
| 223 | - |
|
| 224 | - return ( $is_single || $is_list ); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * important! Override this class |
|
| 231 | - * outputs the field option html |
|
| 232 | - */ |
|
| 233 | - function render_option() { |
|
| 234 | - // to replace on each field |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * important! Override this class if needed |
|
| 239 | - * outputs the field setting html |
|
| 240 | - */ |
|
| 241 | - function render_setting( $override_input = NULL ) { |
|
| 242 | - |
|
| 243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
| 196 | + /** |
|
| 197 | + * Retrieve field label class |
|
| 198 | + * @return string |
|
| 199 | + */ |
|
| 200 | + function get_label_class() { |
|
| 201 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Retrieve field description |
|
| 207 | + * @return string |
|
| 208 | + */ |
|
| 209 | + function get_field_desc() { |
|
| 210 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * Verify if field should have merge tags |
|
| 216 | + * @return boolean |
|
| 217 | + */ |
|
| 218 | + function show_merge_tags() { |
|
| 219 | + // Show the merge tags if the field is a list view |
|
| 220 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
| 221 | + // Or is a single entry view |
|
| 222 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
| 223 | + |
|
| 224 | + return ( $is_single || $is_list ); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * important! Override this class |
|
| 231 | + * outputs the field option html |
|
| 232 | + */ |
|
| 233 | + function render_option() { |
|
| 234 | + // to replace on each field |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * important! Override this class if needed |
|
| 239 | + * outputs the field setting html |
|
| 240 | + */ |
|
| 241 | + function render_setting( $override_input = NULL ) { |
|
| 242 | + |
|
| 243 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
| 244 | 244 | <th scope="row" colspan="2"> |
| 245 | 245 | <div> |
| 246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -260,14 +260,14 @@ discard block |
||
| 260 | 260 | </td> |
| 261 | 261 | <?php } |
| 262 | 262 | |
| 263 | - } |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * important! Override this class |
|
| 267 | - * outputs the input html part |
|
| 268 | - */ |
|
| 269 | - function render_input( $override_input ) { |
|
| 270 | - echo ''; |
|
| 271 | - } |
|
| 265 | + /** |
|
| 266 | + * important! Override this class |
|
| 267 | + * outputs the input html part |
|
| 268 | + */ |
|
| 269 | + function render_input( $override_input ) { |
|
| 270 | + echo ''; |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | 273 | } |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | $defaults = self::get_field_defaults(); |
| 34 | 34 | |
| 35 | 35 | // Backward compatibility |
| 36 | - if( !empty( $field['choices'] ) ) { |
|
| 37 | - $field['options'] = $field['choices']; |
|
| 38 | - unset( $field['choices'] ); |
|
| 36 | + if ( ! empty( $field[ 'choices' ] ) ) { |
|
| 37 | + $field[ 'options' ] = $field[ 'choices' ]; |
|
| 38 | + unset( $field[ 'choices' ] ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
| 41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
| 42 | 42 | |
| 43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
| 43 | + $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value; |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | function get_tooltip() { |
| 82 | - if( ! function_exists('gform_tooltip') ) { |
|
| 82 | + if ( ! function_exists( 'gform_tooltip' ) ) { |
|
| 83 | 83 | return null; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | 'url' => '#', |
| 90 | 90 | ) ); |
| 91 | 91 | |
| 92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
| 92 | + return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . $this->tooltip( $this->field[ 'tooltip' ], false, true, $article ) : null; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * Below this line has been modified by GravityView. |
| 133 | 133 | */ |
| 134 | 134 | |
| 135 | - if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
|
| 135 | + if ( empty( $tooltip_text ) && empty( $article[ 'id' ] ) ) { |
|
| 136 | 136 | return ''; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * @return string |
| 169 | 169 | */ |
| 170 | 170 | function get_field_id() { |
| 171 | - if( isset( $this->field['id'] ) ) { |
|
| 172 | - return esc_attr( $this->field['id'] ); |
|
| 171 | + if ( isset( $this->field[ 'id' ] ) ) { |
|
| 172 | + return esc_attr( $this->field[ 'id' ] ); |
|
| 173 | 173 | } |
| 174 | 174 | return esc_attr( sanitize_html_class( $this->name ) ); |
| 175 | 175 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @return string |
| 180 | 180 | */ |
| 181 | 181 | function get_field_label() { |
| 182 | - return esc_html( trim( $this->field['label'] ) ); |
|
| 182 | + return esc_html( trim( $this->field[ 'label' ] ) ); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @return string |
| 191 | 191 | */ |
| 192 | 192 | function get_field_left_label() { |
| 193 | - return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
| 193 | + return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @return string |
| 199 | 199 | */ |
| 200 | 200 | function get_label_class() { |
| 201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
| 201 | + return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] ); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @return string |
| 208 | 208 | */ |
| 209 | 209 | function get_field_desc() { |
| 210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
| 210 | + return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : ''; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | function render_setting( $override_input = NULL ) { |
| 242 | 242 | |
| 243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
| 243 | + if ( ! empty( $this->field[ 'full_width' ] ) ) { ?> |
|
| 244 | 244 | <th scope="row" colspan="2"> |
| 245 | 245 | <div> |
| 246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $is_table_layout = preg_match( '/table/ism', $template_id ); |
| 32 | 32 | |
| 33 | - if( 'field' === $field_type ) { |
|
| 33 | + if ( 'field' === $field_type ) { |
|
| 34 | 34 | |
| 35 | 35 | // Default options - fields |
| 36 | 36 | $field_options = array( |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'custom_class' => array( |
| 50 | 50 | 'type' => 'text', |
| 51 | 51 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
| 52 | - 'desc' => __( 'This class will be added to the field container', 'gravityview'), |
|
| 52 | + 'desc' => __( 'This class will be added to the field container', 'gravityview' ), |
|
| 53 | 53 | 'value' => '', |
| 54 | 54 | 'merge_tags' => true, |
| 55 | 55 | 'tooltip' => 'gv_css_merge_tags', |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | 72 | // Match Table as well as DataTables |
| 73 | - if( $is_table_layout && 'directory' === $context ) { |
|
| 74 | - $field_options['width'] = array( |
|
| 73 | + if ( $is_table_layout && 'directory' === $context ) { |
|
| 74 | + $field_options[ 'width' ] = array( |
|
| 75 | 75 | 'type' => 'number', |
| 76 | - 'label' => __('Percent Width', 'gravityview'), |
|
| 77 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
| 76 | + 'label' => __( 'Percent Width', 'gravityview' ), |
|
| 77 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ), |
|
| 78 | 78 | 'class' => 'code widefat', |
| 79 | 79 | 'value' => '', |
| 80 | 80 | ); |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | - if( is_multisite() ) { |
|
| 133 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
| 132 | + if ( is_multisite() ) { |
|
| 133 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
| 144 | 144 | * @param string $input_type Optional. (textarea, list, select, etc.) |
| 145 | 145 | */ |
| 146 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 146 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 147 | 147 | |
| 148 | 148 | return $select_cap_choices; |
| 149 | 149 | } |
@@ -171,27 +171,27 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
| 173 | 173 | |
| 174 | - if( empty( $uniqid ) ) { |
|
| 174 | + if ( empty( $uniqid ) ) { |
|
| 175 | 175 | //generate a unique field id |
| 176 | - $uniqid = uniqid('', false); |
|
| 176 | + $uniqid = uniqid( '', false ); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // get field/widget options |
| 180 | 180 | $options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id ); |
| 181 | 181 | |
| 182 | 182 | // two different post arrays, depending of the field type |
| 183 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
| 183 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
| 184 | 184 | |
| 185 | 185 | // build output |
| 186 | 186 | $output = ''; |
| 187 | - $output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
| 188 | - $output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
| 187 | + $output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
| 188 | + $output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
| 189 | 189 | if ( $form_id ) { |
| 190 | - $output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
| 190 | + $output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // If there are no options, return what we got. |
| 194 | - if(empty($options)) { |
|
| 194 | + if ( empty( $options ) ) { |
|
| 195 | 195 | |
| 196 | 196 | // This is here for checking if the output is empty in render_label() |
| 197 | 197 | $output .= '<!-- No Options -->'; |
@@ -199,33 +199,33 @@ discard block |
||
| 199 | 199 | return $output; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">'; |
|
| 202 | + $output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">'; |
|
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | 205 | * @since 1.8 |
| 206 | 206 | */ |
| 207 | - if( !empty( $item['subtitle'] ) ) { |
|
| 208 | - $output .= '<div class="subtitle">' . $item['subtitle'] . '</div>'; |
|
| 207 | + if ( ! empty( $item[ 'subtitle' ] ) ) { |
|
| 208 | + $output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>'; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - foreach( $options as $key => $option ) { |
|
| 211 | + foreach ( $options as $key => $option ) { |
|
| 212 | 212 | |
| 213 | 213 | $value = isset( $current[ $key ] ) ? $current[ $key ] : NULL; |
| 214 | 214 | |
| 215 | - $field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value); |
|
| 215 | + $field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value ); |
|
| 216 | 216 | |
| 217 | 217 | // The setting is empty |
| 218 | - if( empty( $field_output ) ) { |
|
| 218 | + if ( empty( $field_output ) ) { |
|
| 219 | 219 | continue; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - switch( $option['type'] ) { |
|
| 222 | + switch ( $option[ 'type' ] ) { |
|
| 223 | 223 | // Hide hidden fields |
| 224 | 224 | case 'hidden': |
| 225 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>'; |
|
| 225 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
|
| 226 | 226 | break; |
| 227 | 227 | default: |
| 228 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>'; |
|
| 228 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>'; |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -254,17 +254,17 @@ discard block |
||
| 254 | 254 | * @deprecated setting index 'default' was replaced by 'value' |
| 255 | 255 | * @see GravityView_FieldType::get_field_defaults |
| 256 | 256 | */ |
| 257 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
| 258 | - $option['value'] = $option['default']; |
|
| 259 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
| 257 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
| 258 | + $option[ 'value' ] = $option[ 'default' ]; |
|
| 259 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // prepare to render option field type |
| 263 | - if( isset( $option['type'] ) ) { |
|
| 263 | + if ( isset( $option[ 'type' ] ) ) { |
|
| 264 | 264 | |
| 265 | 265 | $type_class = self::load_type_class( $option ); |
| 266 | 266 | |
| 267 | - if( class_exists( $type_class ) ) { |
|
| 267 | + if ( class_exists( $type_class ) ) { |
|
| 268 | 268 | |
| 269 | 269 | /** @var GravityView_FieldType $render_type */ |
| 270 | 270 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @param[in,out] string $output field class name |
| 282 | 282 | * @param[in] array $option option field data |
| 283 | 283 | */ |
| 284 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
| 284 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | } // isset option[type] |
@@ -316,27 +316,27 @@ discard block |
||
| 316 | 316 | * @deprecated setting index 'name' was replaced by 'label' |
| 317 | 317 | * @see GravityView_FieldType::get_field_defaults |
| 318 | 318 | */ |
| 319 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
| 320 | - $setting['label'] = $setting['name']; |
|
| 321 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
| 319 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
| 320 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
| 321 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | $name = esc_attr( sprintf( $name, $key ) ); |
| 325 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
| 326 | - $setting['tooltip'] = 'gv_' . $key; |
|
| 325 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
| 326 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
| 327 | 327 | |
| 328 | 328 | // Use default if current setting isn't set. |
| 329 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
| 329 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
| 330 | 330 | |
| 331 | 331 | // default setting type = text |
| 332 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
| 332 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
| 333 | 333 | |
| 334 | 334 | // merge tags |
| 335 | - if( !isset( $setting['merge_tags'] ) ) { |
|
| 336 | - if( $setting['type'] === 'text' ) { |
|
| 337 | - $setting['merge_tags'] = true; |
|
| 335 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
| 336 | + if ( $setting[ 'type' ] === 'text' ) { |
|
| 337 | + $setting[ 'merge_tags' ] = true; |
|
| 338 | 338 | } else { |
| 339 | - $setting['merge_tags'] = false; |
|
| 339 | + $setting[ 'merge_tags' ] = false; |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | // render the setting |
| 346 | 346 | $type_class = self::load_type_class( $setting ); |
| 347 | - if( class_exists( $type_class ) ) { |
|
| 347 | + if ( class_exists( $type_class ) ) { |
|
| 348 | 348 | /** @var GravityView_FieldType $render_type */ |
| 349 | 349 | $render_type = new $type_class( $name, $setting, $curr_value ); |
| 350 | 350 | ob_start(); |
@@ -353,25 +353,25 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // Check if setting is specific for a template |
| 356 | - if( !empty( $setting['show_in_template'] ) ) { |
|
| 357 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
| 358 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
| 356 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
| 357 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
| 358 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
| 359 | 359 | } |
| 360 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
| 360 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
| 361 | 361 | } else { |
| 362 | 362 | $show_if = ''; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - if( ! empty( $setting['requires'] ) ) { |
|
| 366 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
| 365 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
| 366 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if( ! empty( $setting['requires_not'] ) ) { |
|
| 370 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
| 369 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
| 370 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | // output |
| 374 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
| 374 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
| 375 | 375 | |
| 376 | 376 | } |
| 377 | 377 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | public static function load_type_class( $field = NULL ) { |
| 385 | 385 | |
| 386 | - if( empty( $field['type'] ) ) { |
|
| 386 | + if ( empty( $field[ 'type' ] ) ) { |
|
| 387 | 387 | return NULL; |
| 388 | 388 | } |
| 389 | 389 | |
@@ -392,9 +392,9 @@ discard block |
||
| 392 | 392 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
| 393 | 393 | * @param array $field field data |
| 394 | 394 | */ |
| 395 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
| 395 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
| 396 | 396 | |
| 397 | - if( class_exists( $type_class ) ) { |
|
| 397 | + if ( class_exists( $type_class ) ) { |
|
| 398 | 398 | return $type_class; |
| 399 | 399 | } |
| 400 | 400 | |
@@ -403,9 +403,9 @@ discard block |
||
| 403 | 403 | * @param string $field_type_include_path field class file path |
| 404 | 404 | * @param array $field field data |
| 405 | 405 | */ |
| 406 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
| 406 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
| 407 | 407 | |
| 408 | - if( $class_file && file_exists( $class_file ) ) { |
|
| 408 | + if ( $class_file && file_exists( $class_file ) ) { |
|
| 409 | 409 | require_once( $class_file ); |
| 410 | 410 | } |
| 411 | 411 | |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
| 429 | 429 | |
| 430 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
| 431 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
| 430 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
| 431 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
| 432 | 432 | |
| 433 | 433 | return $output; |
| 434 | 434 | } |
@@ -448,22 +448,22 @@ discard block |
||
| 448 | 448 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
| 449 | 449 | |
| 450 | 450 | // Show the merge tags if the field is a list view |
| 451 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 451 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 452 | 452 | |
| 453 | 453 | // Or is a single entry view |
| 454 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 454 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 455 | 455 | $show = ( $is_single || $is_list ); |
| 456 | 456 | |
| 457 | 457 | $class = ''; |
| 458 | 458 | // and $add_merge_tags is not false |
| 459 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 459 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 460 | 460 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
| 464 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
| 463 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
| 464 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
| 465 | 465 | |
| 466 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
| 466 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /** |
@@ -480,21 +480,21 @@ discard block |
||
| 480 | 480 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
| 481 | 481 | |
| 482 | 482 | // Show the merge tags if the field is a list view |
| 483 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 483 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 484 | 484 | |
| 485 | 485 | // Or is a single entry view |
| 486 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 486 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 487 | 487 | $show = ( $is_single || $is_list ); |
| 488 | 488 | |
| 489 | 489 | $class = ''; |
| 490 | 490 | // and $add_merge_tags is not false |
| 491 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 491 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 492 | 492 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
| 495 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
| 496 | 496 | |
| 497 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
| 497 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
@@ -510,9 +510,9 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
| 512 | 512 | |
| 513 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
| 514 | - foreach( $choices as $value => $label ) { |
|
| 515 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
| 513 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
| 514 | + foreach ( $choices as $value => $label ) { |
|
| 515 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
| 516 | 516 | } |
| 517 | 517 | $output .= '</select>'; |
| 518 | 518 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string $name The key name (will be prefixed). |
| 53 | 53 | * @param mixed $default The default value if not found (Default: null) |
| 54 | 54 | * |
| 55 | - * @return mixed The value or $default if not found. |
|
| 55 | + * @return string The value or $default if not found. |
|
| 56 | 56 | */ |
| 57 | 57 | public static function _SERVER( $name, $default = null ) { |
| 58 | 58 | return self::get( $_SERVER, $name, $default ); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @param mixed $value The value to return from the closure. |
| 128 | 128 | * |
| 129 | - * @return Closure The closure with the $value bound. |
|
| 129 | + * @return \Closure The closure with the $value bound. |
|
| 130 | 130 | */ |
| 131 | 131 | public static function _return( $value ) { |
| 132 | 132 | return function() use ( $value ) { return $value; }; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * Try subkeys after split. |
| 92 | 92 | */ |
| 93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
| 94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
| 94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public static function gf_query_debug( $query ) { |
| 146 | 146 | $introspect = $query->_introspect(); |
| 147 | 147 | return array( |
| 148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
| 148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | if ( $condition->expressions ) { |
| 159 | 159 | $conditions = array(); |
| 160 | 160 | foreach ( $condition->expressions as $expression ) { |
| 161 | - $conditions[] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
| 161 | + $conditions[ ] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
| 162 | 162 | } |
| 163 | 163 | return call_user_func_array( |
| 164 | 164 | array( '\GF_Query_Condition', $condition->operator == 'AND' ? '_and' : '_or' ), |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected $form_id; |
| 46 | 46 | |
| 47 | - function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null) { |
|
| 47 | + function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null ) { |
|
| 48 | 48 | |
| 49 | 49 | // Backward compat |
| 50 | - if ( ! empty( $item['type'] ) ) { |
|
| 51 | - $item['input_type'] = $item['type']; |
|
| 52 | - unset( $item['type'] ); |
|
| 50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 52 | + unset( $item[ 'type' ] ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $this->id = $item_id; |
| 76 | 76 | $this->form_id = $form_id; |
| 77 | 77 | $this->settings = $settings; |
| 78 | - $this->label_type = $item['label_type']; |
|
| 78 | + $this->label_type = $item[ 'label_type' ]; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | foreach ( $field_info_items as $item ) { |
| 121 | 121 | |
| 122 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 122 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 123 | 123 | continue; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
| 126 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 127 | 127 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 128 | 128 | $output .= '<span class="' . $class . '">'; |
| 129 | - $output .= esc_html( $item['value'] ); |
|
| 129 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 130 | 130 | $output .= '</span>'; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -154,21 +154,21 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 156 | 156 | // TODO: Un-hack this |
| 157 | - $hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 158 | - $settings_link = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
| 157 | + $hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 158 | + $settings_link = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
| 159 | 159 | |
| 160 | 160 | // Should we show the icon that the field is being used as a link to single entry? |
| 161 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 161 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 162 | 162 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
| 163 | 163 | |
| 164 | 164 | // When a field label is empty, use the Field ID |
| 165 | 165 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
| 166 | 166 | |
| 167 | 167 | // If there's a custom label, and show label is checked, use that as the field heading |
| 168 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
| 169 | - $label = $this->settings['custom_label']; |
|
| 170 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
| 171 | - $label = $this->item['customLabel']; |
|
| 168 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 169 | + $label = $this->settings[ 'custom_label' ]; |
|
| 170 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 171 | + $label = $this->item[ 'customLabel' ]; |
|
| 172 | 172 | } |
| 173 | 173 | $label = esc_attr( $label ); |
| 174 | 174 | |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | $output .= '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
| 178 | 178 | |
| 179 | 179 | $parent_label = ''; |
| 180 | - if ( ! empty( $this->item['parent'] ) ) { |
|
| 181 | - $parent_label = ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
| 180 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 181 | + $parent_label = ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Name of field / widget |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | $output .= '</h5>'; |
| 195 | 195 | |
| 196 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 197 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 196 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 197 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 198 | 198 | |
| 199 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
| 199 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 200 | 200 | |
| 201 | 201 | return $output; |
| 202 | 202 | } |
@@ -27,32 +27,32 @@ discard block |
||
| 27 | 27 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 28 | 28 | |
| 29 | 29 | // Tooltips |
| 30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 31 | 31 | |
| 32 | 32 | // adding styles and scripts |
| 33 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 34 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 35 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 38 | - |
|
| 39 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 40 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 41 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 ); |
|
| 42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 33 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 34 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 35 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + |
|
| 39 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 40 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 41 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 ); |
|
| 42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 45 | 45 | |
| 46 | 46 | // @todo check if this hook is needed.. |
| 47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 48 | 48 | |
| 49 | 49 | // Add Connected Form column |
| 50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 51 | 51 | |
| 52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 53 | 53 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 54 | 54 | |
| 55 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 55 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 56 | 56 | |
| 57 | 57 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 58 | 58 | |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | function suggest_support_articles( $localization_data = array() ) { |
| 73 | 73 | |
| 74 | - if( ! gravityview()->request->is_view() ) { |
|
| 74 | + if ( ! gravityview()->request->is_view() ) { |
|
| 75 | 75 | return $localization_data; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $localization_data['suggest'] = array( |
|
| 78 | + $localization_data[ 'suggest' ] = array( |
|
| 79 | 79 | '57ef23539033602e61d4a560', |
| 80 | 80 | '54c67bb9e4b0512429885513', |
| 81 | 81 | '54c67bb9e4b0512429885512', |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 97 | 97 | global $pagenow; |
| 98 | 98 | |
| 99 | - if ( !is_admin() ) { |
|
| 99 | + if ( ! is_admin() ) { |
|
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false; |
|
| 103 | + $form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false; |
|
| 104 | 104 | |
| 105 | - if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 105 | + if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -119,18 +119,18 @@ discard block |
||
| 119 | 119 | function add_view_dropdown() { |
| 120 | 120 | $current_screen = get_current_screen(); |
| 121 | 121 | |
| 122 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 122 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $forms = gravityview_get_forms(); |
| 127 | 127 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
| 128 | 128 | // If there are no forms to select, show no forms. |
| 129 | - if( !empty( $forms ) ) { ?> |
|
| 129 | + if ( ! empty( $forms ) ) { ?> |
|
| 130 | 130 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 131 | 131 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 132 | - <?php foreach( $forms as $form ) { ?> |
|
| 133 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 132 | + <?php foreach ( $forms as $form ) { ?> |
|
| 133 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 134 | 134 | <?php } ?> |
| 135 | 135 | </select> |
| 136 | 136 | <?php } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 145 | 145 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 146 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 146 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | public static function gform_toolbar_menu( $menu_items = array(), $id = NULL ) { |
| 166 | 166 | |
| 167 | 167 | // Don't show on Trashed forms |
| 168 | - if( 'trash' === rgget( 'filter') ) { |
|
| 168 | + if ( 'trash' === rgget( 'filter' ) ) { |
|
| 169 | 169 | return $menu_items; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $priority = 0; |
| 175 | 175 | |
| 176 | - if( 'form_list' === GFForms::get_page() ) { |
|
| 176 | + if ( 'form_list' === GFForms::get_page() ) { |
|
| 177 | 177 | $priority = 790; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if( empty( $connected_views ) ) { |
|
| 180 | + if ( empty( $connected_views ) ) { |
|
| 181 | 181 | |
| 182 | - $menu_items['gravityview'] = array( |
|
| 182 | + $menu_items[ 'gravityview' ] = array( |
|
| 183 | 183 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 184 | 184 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 185 | 185 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -195,22 +195,22 @@ discard block |
||
| 195 | 195 | $sub_menu_items = array(); |
| 196 | 196 | foreach ( (array)$connected_views as $view ) { |
| 197 | 197 | |
| 198 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 198 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 199 | 199 | continue; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 202 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 203 | 203 | |
| 204 | - $sub_menu_items[] = array( |
|
| 204 | + $sub_menu_items[ ] = array( |
|
| 205 | 205 | 'label' => esc_attr( $label ), |
| 206 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 206 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 207 | 207 | ); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // If there were no items added, then let's create the parent menu |
| 211 | - if( $sub_menu_items ) { |
|
| 211 | + if ( $sub_menu_items ) { |
|
| 212 | 212 | |
| 213 | - $sub_menu_items[] = array( |
|
| 213 | + $sub_menu_items[ ] = array( |
|
| 214 | 214 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 215 | 215 | 'link_class' => 'gv-create-view', |
| 216 | 216 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -219,14 +219,14 @@ discard block |
||
| 219 | 219 | ); |
| 220 | 220 | |
| 221 | 221 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 222 | - $sub_menu_items[] = array( |
|
| 222 | + $sub_menu_items[ ] = array( |
|
| 223 | 223 | 'url' => '#', |
| 224 | 224 | 'label' => '', |
| 225 | 225 | 'menu_class' => 'hidden', |
| 226 | 226 | 'capabilities' => '', |
| 227 | 227 | ); |
| 228 | 228 | |
| 229 | - $menu_items['gravityview'] = array( |
|
| 229 | + $menu_items[ 'gravityview' ] = array( |
|
| 230 | 230 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 231 | 231 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 232 | 232 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | $add = array( 'captcha', 'page' ); |
| 256 | 256 | |
| 257 | 257 | // Don't allowing editing the following values: |
| 258 | - if( $context === 'edit' ) { |
|
| 259 | - $add[] = 'post_id'; |
|
| 258 | + if ( $context === 'edit' ) { |
|
| 259 | + $add[ ] = 'post_id'; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $return = array_merge( $array, $add ); |
@@ -279,32 +279,32 @@ discard block |
||
| 279 | 279 | foreach ( $default_args as $key => $arg ) { |
| 280 | 280 | |
| 281 | 281 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 282 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 282 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 283 | 283 | |
| 284 | 284 | // By default, use `tooltip` if defined. |
| 285 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 285 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 286 | 286 | |
| 287 | 287 | // Otherwise, use the description as a tooltip. |
| 288 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 289 | - $tooltip = $arg['desc']; |
|
| 288 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 289 | + $tooltip = $arg[ 'desc' ]; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | // If there's no tooltip set, continue |
| 293 | - if( empty( $tooltip ) ) { |
|
| 293 | + if ( empty( $tooltip ) ) { |
|
| 294 | 294 | continue; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // Add the tooltip |
| 298 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 299 | - 'title' => $arg['label'], |
|
| 298 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 299 | + 'title' => $arg[ 'label' ], |
|
| 300 | 300 | 'value' => $tooltip, |
| 301 | 301 | ); |
| 302 | 302 | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 306 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 307 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 305 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 306 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 307 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 308 | 308 | ); |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 324 | 324 | |
| 325 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 325 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 326 | 326 | |
| 327 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 327 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | return $tooltips; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * |
| 339 | 339 | * @return void |
| 340 | 340 | */ |
| 341 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 341 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 342 | 342 | |
| 343 | 343 | $output = ''; |
| 344 | 344 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 361 | 361 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 362 | 362 | |
| 363 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 363 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 364 | 364 | |
| 365 | 365 | break; |
| 366 | 366 | |
@@ -401,44 +401,44 @@ discard block |
||
| 401 | 401 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 402 | 402 | |
| 403 | 403 | // Either the form is empty or the form ID is 0, not yet set. |
| 404 | - if( empty( $form ) ) { |
|
| 404 | + if ( empty( $form ) ) { |
|
| 405 | 405 | return ''; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // The $form is passed as the form ID |
| 409 | - if( !is_array( $form ) ) { |
|
| 409 | + if ( ! is_array( $form ) ) { |
|
| 410 | 410 | $form = gravityview_get_form( $form ); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - $form_id = $form['id']; |
|
| 413 | + $form_id = $form[ 'id' ]; |
|
| 414 | 414 | $links = array(); |
| 415 | 415 | |
| 416 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 416 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 417 | 417 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 418 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 419 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 418 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 419 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 420 | 420 | } else { |
| 421 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 421 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 424 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 425 | 425 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 426 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 426 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 429 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 430 | 430 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 431 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 431 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 434 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 435 | 435 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 436 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 436 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $output = ''; |
| 440 | 440 | |
| 441 | - if( !empty( $include_form_link ) ) { |
|
| 441 | + if ( ! empty( $include_form_link ) ) { |
|
| 442 | 442 | $output .= $form_link; |
| 443 | 443 | } |
| 444 | 444 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 452 | 452 | |
| 453 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 453 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 454 | 454 | |
| 455 | 455 | return $output; |
| 456 | 456 | } |
@@ -464,8 +464,8 @@ discard block |
||
| 464 | 464 | // Get the date column and save it for later to add back in. |
| 465 | 465 | // This adds it after the Data Source column. |
| 466 | 466 | // This way, we don't need to do array_slice, array_merge, etc. |
| 467 | - $date = $columns['date']; |
|
| 468 | - unset( $columns['date'] ); |
|
| 467 | + $date = $columns[ 'date' ]; |
|
| 468 | + unset( $columns[ 'date' ] ); |
|
| 469 | 469 | |
| 470 | 470 | $data_source_required_caps = array( |
| 471 | 471 | 'gravityforms_edit_forms', |
@@ -476,14 +476,14 @@ discard block |
||
| 476 | 476 | 'gravityforms_preview_forms', |
| 477 | 477 | ); |
| 478 | 478 | |
| 479 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 480 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 479 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 480 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 483 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 484 | 484 | |
| 485 | 485 | // Add the date back in. |
| 486 | - $columns['date'] = $date; |
|
| 486 | + $columns[ 'date' ] = $date; |
|
| 487 | 487 | |
| 488 | 488 | return $columns; |
| 489 | 489 | } |
@@ -497,12 +497,12 @@ discard block |
||
| 497 | 497 | */ |
| 498 | 498 | function save_postdata( $post_id ) { |
| 499 | 499 | |
| 500 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 500 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 501 | 501 | return; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | // validate post_type |
| 505 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 505 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 506 | 506 | return; |
| 507 | 507 | } |
| 508 | 508 | |
@@ -517,63 +517,63 @@ discard block |
||
| 517 | 517 | $statii = array(); |
| 518 | 518 | |
| 519 | 519 | // check if this is a start fresh View |
| 520 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 520 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 521 | 521 | |
| 522 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 522 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 523 | 523 | // save form id |
| 524 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 524 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 525 | 525 | |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 528 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 529 | 529 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
| 530 | 530 | return; |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | // Was this a start fresh? |
| 534 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 535 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 534 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 535 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 536 | 536 | } else { |
| 537 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 537 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | // Check if we have a template id |
| 541 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 541 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 542 | 542 | |
| 543 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 543 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 544 | 544 | |
| 545 | 545 | // now save template id |
| 546 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 546 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | |
| 550 | 550 | // save View Configuration metabox |
| 551 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 551 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 552 | 552 | |
| 553 | 553 | // template settings |
| 554 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 555 | - $_POST['template_settings'] = array(); |
|
| 554 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 555 | + $_POST[ 'template_settings' ] = array(); |
|
| 556 | 556 | } |
| 557 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 557 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 558 | 558 | |
| 559 | 559 | // guard against unloaded View configuration page |
| 560 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
| 560 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
| 561 | 561 | $fields = array(); |
| 562 | 562 | |
| 563 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
| 563 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 564 | 564 | $fields = _gravityview_process_posted_fields(); |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | $fields = wp_slash( $fields ); |
| 568 | 568 | |
| 569 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 569 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | // Directory Visible Widgets |
| 573 | - if( empty( $_POST['widgets'] ) ) { |
|
| 574 | - $_POST['widgets'] = array(); |
|
| 573 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 574 | + $_POST[ 'widgets' ] = array(); |
|
| 575 | 575 | } |
| 576 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
| 576 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
| 577 | 577 | |
| 578 | 578 | } // end save view configuration |
| 579 | 579 | |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
| 584 | 584 | * @since 1.17.2 |
| 585 | 585 | */ |
| 586 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 586 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 587 | 587 | |
| 588 | 588 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
| 589 | 589 | } |
@@ -630,20 +630,20 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | $output = ''; |
| 632 | 632 | |
| 633 | - if( !empty( $fields ) ) { |
|
| 633 | + if ( ! empty( $fields ) ) { |
|
| 634 | 634 | |
| 635 | - foreach( $fields as $id => $details ) { |
|
| 635 | + foreach ( $fields as $id => $details ) { |
|
| 636 | 636 | |
| 637 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
| 637 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
| 638 | 638 | continue; |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | // Edit mode only allows editing the parent fields, not single inputs. |
| 642 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
| 642 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 643 | 643 | continue; |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form ); |
|
| 646 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form ); |
|
| 647 | 647 | |
| 648 | 648 | } // End foreach |
| 649 | 649 | } |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | echo $output; |
| 652 | 652 | |
| 653 | 653 | // For the EDIT view we only want to allow the form fields. |
| 654 | - if( $context === 'edit' ) { |
|
| 654 | + if ( $context === 'edit' ) { |
|
| 655 | 655 | return; |
| 656 | 656 | } |
| 657 | 657 | |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | $additional_fields = array( |
| 672 | 672 | array( |
| 673 | 673 | 'label_text' => '+ ' . __( 'Add All Form Fields', 'gravityview' ), |
| 674 | - 'desc' => __('Insert all the form fields at once.', 'gravityview'), |
|
| 674 | + 'desc' => __( 'Insert all the form fields at once.', 'gravityview' ), |
|
| 675 | 675 | 'field_id' => 'all-fields', |
| 676 | 676 | 'label_type' => 'field', |
| 677 | 677 | 'input_type' => null, |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | */ |
| 687 | 687 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
| 688 | 688 | |
| 689 | - foreach ( (array) $additional_fields as $item ) { |
|
| 689 | + foreach ( (array)$additional_fields as $item ) { |
|
| 690 | 690 | |
| 691 | 691 | // Prevent items from not having index set |
| 692 | 692 | $item = wp_parse_args( $item, array( |
@@ -696,16 +696,16 @@ discard block |
||
| 696 | 696 | 'input_type' => null, |
| 697 | 697 | 'field_options' => null, |
| 698 | 698 | 'settings_html' => null, |
| 699 | - )); |
|
| 699 | + ) ); |
|
| 700 | 700 | |
| 701 | 701 | // Backward compat. |
| 702 | - if( !empty( $item['field_options'] ) ) { |
|
| 702 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 703 | 703 | // Use settings_html from now on. |
| 704 | - $item['settings_html'] = $item['field_options']; |
|
| 704 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | // Render a label for each of them |
| 708 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
| 708 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
| 709 | 709 | |
| 710 | 710 | } |
| 711 | 711 | |
@@ -717,54 +717,54 @@ discard block |
||
| 717 | 717 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 718 | 718 | * @return array |
| 719 | 719 | */ |
| 720 | - function get_entry_default_fields($form, $zone) { |
|
| 720 | + function get_entry_default_fields( $form, $zone ) { |
|
| 721 | 721 | |
| 722 | 722 | $entry_default_fields = array(); |
| 723 | 723 | |
| 724 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 724 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 725 | 725 | |
| 726 | 726 | $entry_default_fields = array( |
| 727 | 727 | 'id' => array( |
| 728 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 728 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 729 | 729 | 'type' => 'id', |
| 730 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 730 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 731 | 731 | ), |
| 732 | 732 | 'date_created' => array( |
| 733 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 734 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 733 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 734 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 735 | 735 | 'type' => 'date_created', |
| 736 | 736 | ), |
| 737 | 737 | 'source_url' => array( |
| 738 | - 'label' => __('Source URL', 'gravityview'), |
|
| 738 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 739 | 739 | 'type' => 'source_url', |
| 740 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 740 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 741 | 741 | ), |
| 742 | 742 | 'ip' => array( |
| 743 | - 'label' => __('User IP', 'gravityview'), |
|
| 743 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 744 | 744 | 'type' => 'ip', |
| 745 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 745 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 746 | 746 | ), |
| 747 | 747 | 'created_by' => array( |
| 748 | - 'label' => __('User', 'gravityview'), |
|
| 748 | + 'label' => __( 'User', 'gravityview' ), |
|
| 749 | 749 | 'type' => 'created_by', |
| 750 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 750 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 751 | 751 | ), |
| 752 | 752 | |
| 753 | 753 | /** |
| 754 | 754 | * @since 1.7.2 |
| 755 | 755 | */ |
| 756 | 756 | 'other_entries' => array( |
| 757 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 757 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 758 | 758 | 'type' => 'other_entries', |
| 759 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 759 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 760 | 760 | ), |
| 761 | 761 | ); |
| 762 | 762 | |
| 763 | - if( 'single' !== $zone) { |
|
| 763 | + if ( 'single' !== $zone ) { |
|
| 764 | 764 | |
| 765 | - $entry_default_fields['entry_link'] = array( |
|
| 766 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 767 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 765 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 766 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 767 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 768 | 768 | 'type' => 'entry_link', |
| 769 | 769 | ); |
| 770 | 770 | } |
@@ -774,19 +774,19 @@ discard block |
||
| 774 | 774 | /** |
| 775 | 775 | * @since 1.2 |
| 776 | 776 | */ |
| 777 | - $entry_default_fields['custom'] = array( |
|
| 778 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 777 | + $entry_default_fields[ 'custom' ] = array( |
|
| 778 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 779 | 779 | 'type' => 'custom', |
| 780 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 780 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 781 | 781 | ); |
| 782 | 782 | |
| 783 | 783 | /** |
| 784 | 784 | * @since develop |
| 785 | 785 | */ |
| 786 | - $entry_default_fields['sequence'] = array( |
|
| 787 | - 'label' => __('Result Number', 'gravityview'), |
|
| 786 | + $entry_default_fields[ 'sequence' ] = array( |
|
| 787 | + 'label' => __( 'Result Number', 'gravityview' ), |
|
| 788 | 788 | 'type' => 'sequence', |
| 789 | - 'desc' => __('Display a sequential result number for each entry.', 'gravityview'), |
|
| 789 | + 'desc' => __( 'Display a sequential result number for each entry.', 'gravityview' ), |
|
| 790 | 790 | ); |
| 791 | 791 | |
| 792 | 792 | /** |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | * @param string|array $form form_ID or form object |
| 796 | 796 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 797 | 797 | */ |
| 798 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 798 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | /** |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | */ |
| 807 | 807 | function get_available_fields( $form = '', $zone = NULL ) { |
| 808 | 808 | |
| 809 | - if( empty( $form ) ) { |
|
| 809 | + if ( empty( $form ) ) { |
|
| 810 | 810 | gravityview()->log->error( '$form is empty' ); |
| 811 | 811 | return array(); |
| 812 | 812 | } |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | $fields = gravityview_get_form_fields( $form, true ); |
| 816 | 816 | |
| 817 | 817 | // get meta fields ( only if form was already created ) |
| 818 | - if( !is_array( $form ) ) { |
|
| 818 | + if ( ! is_array( $form ) ) { |
|
| 819 | 819 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 820 | 820 | } else { |
| 821 | 821 | $meta_fields = array(); |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | $fields = $fields + $meta_fields + $default_fields; |
| 829 | 829 | |
| 830 | 830 | // Move Custom Content to top |
| 831 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
| 831 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
| 832 | 832 | |
| 833 | 833 | /** |
| 834 | 834 | * @filter `gravityview/admin/available_fields` Modify the available fields that can be used in a View. |
@@ -848,11 +848,11 @@ discard block |
||
| 848 | 848 | |
| 849 | 849 | $widgets = $this->get_registered_widgets(); |
| 850 | 850 | |
| 851 | - if( !empty( $widgets ) ) { |
|
| 851 | + if ( ! empty( $widgets ) ) { |
|
| 852 | 852 | |
| 853 | - foreach( $widgets as $id => $details ) { |
|
| 853 | + foreach ( $widgets as $id => $details ) { |
|
| 854 | 854 | |
| 855 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 855 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 856 | 856 | |
| 857 | 857 | } |
| 858 | 858 | } |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 882 | 882 | global $post; |
| 883 | 883 | |
| 884 | - if( $type === 'widget' ) { |
|
| 884 | + if ( $type === 'widget' ) { |
|
| 885 | 885 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 886 | 886 | } else { |
| 887 | 887 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -907,10 +907,10 @@ discard block |
||
| 907 | 907 | $form_id = null; |
| 908 | 908 | |
| 909 | 909 | // if saved values, get available fields to label everyone |
| 910 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 910 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 911 | 911 | |
| 912 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 913 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 912 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 913 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 914 | 914 | } else { |
| 915 | 915 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
| 916 | 916 | } |
@@ -928,42 +928,42 @@ discard block |
||
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | - foreach( $rows as $row ) : |
|
| 932 | - foreach( $row as $col => $areas ) : |
|
| 933 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 931 | + foreach ( $rows as $row ) : |
|
| 932 | + foreach ( $row as $col => $areas ) : |
|
| 933 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 934 | 934 | |
| 935 | 935 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 936 | 936 | |
| 937 | - <?php foreach( $areas as $area ) : ?> |
|
| 937 | + <?php foreach ( $areas as $area ) : ?> |
|
| 938 | 938 | |
| 939 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 940 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 939 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 940 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 941 | 941 | <?php // render saved fields |
| 942 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 942 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 943 | 943 | |
| 944 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 944 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 945 | 945 | |
| 946 | 946 | // Maybe has a form ID |
| 947 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
| 947 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
| 948 | 948 | |
| 949 | 949 | $input_type = NULL; |
| 950 | 950 | |
| 951 | 951 | if ( $form_id ) { |
| 952 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
| 952 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
| 953 | 953 | } else { |
| 954 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 954 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 955 | 955 | } |
| 956 | 956 | |
| 957 | - if ( !$original_item ) { |
|
| 958 | - gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
|
| 957 | + if ( ! $original_item ) { |
|
| 958 | + gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) ); |
|
| 959 | 959 | |
| 960 | 960 | $original_item = $field; |
| 961 | 961 | } else { |
| 962 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 962 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | // Field options dialog box |
| 966 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 966 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 967 | 967 | |
| 968 | 968 | $item = array( |
| 969 | 969 | 'input_type' => $input_type, |
@@ -976,22 +976,22 @@ discard block |
||
| 976 | 976 | $item = wp_parse_args( $item, $original_item ); |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | - switch( $type ) { |
|
| 979 | + switch ( $type ) { |
|
| 980 | 980 | case 'widget': |
| 981 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 981 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 982 | 982 | break; |
| 983 | 983 | default: |
| 984 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
| 984 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
| 985 | 985 | } |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | } // End if zone is not empty ?> |
| 989 | 989 | |
| 990 | - <span class="drop-message"><?php echo sprintf( esc_html__('"+ %s" or drag existing %ss here.', 'gravityview'), esc_html( $button_label ), esc_html( $type ) ); ?></span> |
|
| 990 | + <span class="drop-message"><?php echo sprintf( esc_html__( '"+ %s" or drag existing %ss here.', 'gravityview' ), esc_html( $button_label ), esc_html( $type ) ); ?></span> |
|
| 991 | 991 | </div> |
| 992 | 992 | <div class="gv-droppable-area-action"> |
| 993 | - <button class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></button> |
|
| 994 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
| 993 | + <button class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></button> |
|
| 994 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
| 995 | 995 | </div> |
| 996 | 996 | </div> |
| 997 | 997 | |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | // This is a new View, prefill the widgets |
| 1020 | 1020 | $widgets = array( |
| 1021 | 1021 | 'header_top' => array( |
| 1022 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
| 1022 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
| 1023 | 1023 | 'id' => 'search_bar', |
| 1024 | 1024 | 'label' => __( 'Search Bar', 'gravityview' ), |
| 1025 | 1025 | 'search_layout' => 'horizontal', |
@@ -1094,12 +1094,12 @@ discard block |
||
| 1094 | 1094 | if ( $post ) { |
| 1095 | 1095 | $source_form_id = gravityview_get_form_id( $post->ID ); |
| 1096 | 1096 | if ( $source_form_id ) { |
| 1097 | - $form_ids[] = $source_form_id; |
|
| 1097 | + $form_ids[ ] = $source_form_id; |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
| 1101 | 1101 | foreach ( $joined_forms as $joined_form ) { |
| 1102 | - $form_ids[] = $joined_form->ID; |
|
| 1102 | + $form_ids[ ] = $joined_form->ID; |
|
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| 1105 | 1105 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | * @return string HTML of the active areas |
| 1135 | 1135 | */ |
| 1136 | 1136 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 1137 | - if( empty( $template_id ) ) { |
|
| 1137 | + if ( empty( $template_id ) ) { |
|
| 1138 | 1138 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
| 1139 | 1139 | return ''; |
| 1140 | 1140 | } |
@@ -1148,12 +1148,12 @@ discard block |
||
| 1148 | 1148 | */ |
| 1149 | 1149 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 1150 | 1150 | |
| 1151 | - if( empty( $template_areas ) ) { |
|
| 1151 | + if ( empty( $template_areas ) ) { |
|
| 1152 | 1152 | |
| 1153 | 1153 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
| 1154 | 1154 | $output = '<div>'; |
| 1155 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
| 1156 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
| 1155 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
| 1156 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
| 1157 | 1157 | $output .= '</div>'; |
| 1158 | 1158 | } else { |
| 1159 | 1159 | |
@@ -1168,7 +1168,7 @@ discard block |
||
| 1168 | 1168 | |
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | - if( $echo ) { |
|
| 1171 | + if ( $echo ) { |
|
| 1172 | 1172 | echo $output; |
| 1173 | 1173 | } |
| 1174 | 1174 | |
@@ -1188,32 +1188,32 @@ discard block |
||
| 1188 | 1188 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 1189 | 1189 | |
| 1190 | 1190 | // Add the GV font (with the Astronaut) |
| 1191 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1191 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
| 1192 | 1192 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1193 | 1193 | |
| 1194 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1194 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1195 | 1195 | |
| 1196 | - if( GFForms::get_page() === 'form_list' ) { |
|
| 1196 | + if ( GFForms::get_page() === 'form_list' ) { |
|
| 1197 | 1197 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1198 | 1198 | return; |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | // Don't process any scripts below here if it's not a GravityView page. |
| 1202 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1202 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1203 | 1203 | return; |
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 1207 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1207 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
| 1208 | 1208 | |
| 1209 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1209 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 1210 | 1210 | |
| 1211 | 1211 | //enqueue scripts |
| 1212 | 1212 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
| 1213 | 1213 | |
| 1214 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1214 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1215 | 1215 | 'cookiepath' => COOKIEPATH, |
| 1216 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1216 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
| 1217 | 1217 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1218 | 1218 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
| 1219 | 1219 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1229 | 1229 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1230 | 1230 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
| 1231 | - )); |
|
| 1231 | + ) ); |
|
| 1232 | 1232 | |
| 1233 | 1233 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1234 | 1234 | |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | ); |
| 1256 | 1256 | |
| 1257 | 1257 | if ( wp_is_mobile() ) { |
| 1258 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1258 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1259 | 1259 | } |
| 1260 | 1260 | |
| 1261 | 1261 | wp_enqueue_script( $scripts ); |