@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field). |
| 167 | 167 | */ |
| 168 | 168 | public static function from_configuration( $configuration ) { |
| 169 | - if ( empty( $configuration['id'] ) ) { |
|
| 169 | + if ( empty( $configuration[ 'id' ] ) ) { |
|
| 170 | 170 | $field = new self(); |
| 171 | 171 | gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) ); |
| 172 | 172 | $field->update_configuration( $configuration ); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | } else { |
| 180 | 180 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); |
| 181 | 181 | } |
| 182 | - $trace = $trace[1]; |
|
| 183 | - if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) { |
|
| 182 | + $trace = $trace[ 1 ]; |
|
| 183 | + if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) { |
|
| 184 | 184 | $field = new self(); |
| 185 | 185 | gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' ); |
| 186 | 186 | $field->update_configuration( $configuration ); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** Determine the field implementation to use, and try to use. */ |
| 191 | - $field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 191 | + $field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @filter `gravityview/field/class` Filter the field class about to be created from the configuration. |
@@ -227,24 +227,24 @@ discard block |
||
| 227 | 227 | public function update_configuration( $configuration ) { |
| 228 | 228 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
| 229 | 229 | |
| 230 | - if ( $this->ID != $configuration['id'] ) { |
|
| 230 | + if ( $this->ID != $configuration[ 'id' ] ) { |
|
| 231 | 231 | /** Smelling trouble here... */ |
| 232 | 232 | gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) ); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $this->ID = $configuration['id']; |
|
| 236 | - $this->label = $configuration['label']; |
|
| 237 | - $this->show_label = $configuration['show_label'] == '1'; |
|
| 238 | - $this->custom_label = $configuration['custom_label']; |
|
| 239 | - $this->custom_class = $configuration['custom_class']; |
|
| 240 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
| 241 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
| 242 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
| 235 | + $this->ID = $configuration[ 'id' ]; |
|
| 236 | + $this->label = $configuration[ 'label' ]; |
|
| 237 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
| 238 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
| 239 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
| 240 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
| 241 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
| 242 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
| 243 | 243 | |
| 244 | 244 | /** Shared among all field types (sort of). */ |
| 245 | 245 | $shared_configuration_keys = array( |
| 246 | 246 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
| 247 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 247 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 248 | 248 | ); |
| 249 | 249 | |
| 250 | 250 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | /** A custom label is available. */ |
| 275 | 275 | if ( ! empty( $this->custom_label ) ) { |
| 276 | - return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null ); |
|
| 276 | + return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null ); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | return ''; |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
| 351 | 351 | */ |
| 352 | 352 | public function __get( $key ) { |
| 353 | - switch( $key ): |
|
| 353 | + switch ( $key ): |
|
| 354 | 354 | default: |
| 355 | 355 | if ( isset( $this->configuration[ $key ] ) ) { |
| 356 | 356 | return $this->configuration[ $key ]; |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | * @return boolean Whether this $key is set or not. |
| 367 | 367 | */ |
| 368 | 368 | public function __isset( $key ) { |
| 369 | - switch( $key ): |
|
| 369 | + switch ( $key ): |
|
| 370 | 370 | default: |
| 371 | 371 | return isset( $this->configuration[ $key ] ); |
| 372 | 372 | endswitch; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function remove_columns_from_searchable_fields( $fields ) { |
| 61 | 61 | |
| 62 | 62 | foreach ( $fields as $key => $field ) { |
| 63 | - if ( isset( $field['parent'] ) && $field['parent'] instanceof \GF_Field_List ) { |
|
| 63 | + if ( isset( $field[ 'parent' ] ) && $field[ 'parent' ] instanceof \GF_Field_List ) { |
|
| 64 | 64 | unset( $fields[ $key ] ); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | // Add the list columns |
| 87 | 87 | foreach ( $list_fields as $list_field ) { |
| 88 | 88 | |
| 89 | - if( empty( $list_field->enableColumns ) ) { |
|
| 89 | + if ( empty( $list_field->enableColumns ) ) { |
|
| 90 | 90 | continue; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // If there are columns, add them under the parent field |
| 110 | - if( ! empty( $list_columns ) ) { |
|
| 110 | + if ( ! empty( $list_columns ) ) { |
|
| 111 | 111 | |
| 112 | 112 | $index = array_search( $list_field->id, array_keys( $fields ) ) + 1; |
| 113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * Merge the $list_columns into the $fields array at $index |
| 116 | 116 | * @see https://stackoverflow.com/a/1783125 |
| 117 | 117 | */ |
| 118 | - $fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true); |
|
| 118 | + $fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true ); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | unset( $list_columns, $index, $input_id ); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $list_rows = maybe_unserialize( $field_value ); |
| 144 | 144 | |
| 145 | - if( ! is_array( $list_rows ) ) { |
|
| 145 | + if ( ! is_array( $list_rows ) ) { |
|
| 146 | 146 | gravityview()->log->error( '$field_value did not unserialize', array( 'data' => $field_value ) ); |
| 147 | 147 | return null; |
| 148 | 148 | } |
@@ -152,18 +152,18 @@ discard block |
||
| 152 | 152 | // Each list row |
| 153 | 153 | foreach ( $list_rows as $list_row ) { |
| 154 | 154 | $current_column = 0; |
| 155 | - foreach ( (array) $list_row as $column_key => $column_value ) { |
|
| 155 | + foreach ( (array)$list_row as $column_key => $column_value ) { |
|
| 156 | 156 | |
| 157 | 157 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
| 158 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
| 159 | - $column_values[] = $column_value; |
|
| 158 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
| 159 | + $column_values[ ] = $column_value; |
|
| 160 | 160 | } |
| 161 | 161 | $current_column++; |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Return the array of values |
| 166 | - if( 'raw' === $format ) { |
|
| 166 | + if ( 'raw' === $format ) { |
|
| 167 | 167 | return $column_values; |
| 168 | 168 | } |
| 169 | 169 | // Return the Gravity Forms Field output |
@@ -186,22 +186,22 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function _filter_field_label( $label, $field, $form, $entry ) { |
| 188 | 188 | |
| 189 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
| 189 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
| 190 | 190 | |
| 191 | 191 | // Not a list field |
| 192 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
| 192 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
| 193 | 193 | return $label; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // Custom label is defined, so use it |
| 197 | - if( ! empty( $field['custom_label'] ) ) { |
|
| 197 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
| 198 | 198 | return $label; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
| 201 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
| 202 | 202 | |
| 203 | 203 | // Parent field, not column field |
| 204 | - if( false === $column_id ) { |
|
| 204 | + if ( false === $column_id ) { |
|
| 205 | 205 | return $label; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
| 223 | 223 | |
| 224 | 224 | // Doesn't have columns enabled |
| 225 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
| 225 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
| 226 | 226 | return $backup_label; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public static function is_add_oembed_preview() { |
| 47 | 47 | /** The preview request is a parse-embed AJAX call without a type set. */ |
| 48 | - return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) ); |
|
| 48 | + return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @return boolean |
| 64 | 64 | */ |
| 65 | 65 | public static function is_rest() { |
| 66 | - return ! empty( $GLOBALS['wp']->query_vars['rest_route'] ); |
|
| 66 | + return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -141,15 +141,15 @@ discard block |
||
| 141 | 141 | $get = $_GET; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - unset( $get['mode'] ); |
|
| 144 | + unset( $get[ 'mode' ] ); |
|
| 145 | 145 | |
| 146 | 146 | $get = array_filter( $get, 'gravityview_is_not_empty_string' ); |
| 147 | 147 | |
| 148 | - if( $has_field_key = $this->_has_field_key( $get ) ) { |
|
| 148 | + if ( $has_field_key = $this->_has_field_key( $get ) ) { |
|
| 149 | 149 | return true; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ); |
|
| 152 | + return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] ); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $meta = array(); |
| 174 | 174 | foreach ( $fields as $field ) { |
| 175 | - if( empty( $field->_gf_field_class_name ) ) { |
|
| 176 | - $meta[] = preg_quote( $field->name ); |
|
| 175 | + if ( empty( $field->_gf_field_class_name ) ) { |
|
| 176 | + $meta[ ] = preg_quote( $field->name ); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | foreach ( $get as $key => $value ) { |
| 181 | - if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) { |
|
| 181 | + if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) { |
|
| 182 | 182 | $has_field_key = true; |
| 183 | 183 | break; |
| 184 | 184 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public static function get_instance() { |
| 89 | 89 | |
| 90 | - if( empty( self::$instance ) ) { |
|
| 90 | + if ( empty( self::$instance ) ) { |
|
| 91 | 91 | self::$instance = new self; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
| 123 | 123 | |
| 124 | - if( $with_values ) { |
|
| 124 | + if ( $with_values ) { |
|
| 125 | 125 | $operators_with_values = array(); |
| 126 | - foreach( $operators as $key ) { |
|
| 126 | + foreach ( $operators as $key ) { |
|
| 127 | 127 | $operators_with_values[ $key ] = ''; |
| 128 | 128 | } |
| 129 | 129 | return $operators_with_values; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $operators = $this->get_operators( false ); |
| 144 | 144 | |
| 145 | - if( !in_array( $operation, $operators ) ) { |
|
| 145 | + if ( ! in_array( $operation, $operators ) ) { |
|
| 146 | 146 | gravityview()->log->debug( ' Attempted to add invalid operation type. {operation}', array( 'operation' => $operation ) ); |
| 147 | 147 | return false; |
| 148 | 148 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | return null; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - if( empty( $atts ) ) { |
|
| 197 | + if ( empty( $atts ) ) { |
|
| 198 | 198 | gravityview()->log->error( '$atts are empty.', array( 'data' => $atts ) ); |
| 199 | 199 | return null; |
| 200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $this->parse_atts(); |
| 210 | 210 | |
| 211 | 211 | // We need an "if" |
| 212 | - if( false === $this->if ) { |
|
| 212 | + if ( false === $this->if ) { |
|
| 213 | 213 | gravityview()->log->error( '$atts->if is empty.', array( 'data' => $this->passed_atts ) ); |
| 214 | 214 | return null; |
| 215 | 215 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $setup = $this->setup_operation_and_comparison(); |
| 218 | 218 | |
| 219 | 219 | // We need an operation and comparison value |
| 220 | - if( ! $setup ) { |
|
| 220 | + if ( ! $setup ) { |
|
| 221 | 221 | gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) ); |
| 222 | 222 | return null; |
| 223 | 223 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | private function get_output() { |
| 269 | 269 | |
| 270 | - if( $this->is_match ) { |
|
| 270 | + if ( $this->is_match ) { |
|
| 271 | 271 | $output = $this->content; |
| 272 | 272 | } else { |
| 273 | 273 | $output = $this->else_content; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * @param string $output HTML/text output |
| 286 | 286 | * @param GVLogic_Shortcode $this This class |
| 287 | 287 | */ |
| 288 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
| 288 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
| 289 | 289 | |
| 290 | 290 | gravityview()->log->debug( 'Output: ', array( 'data' => $output ) ); |
| 291 | 291 | |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL ); |
| 306 | 306 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL ); |
| 307 | 307 | |
| 308 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
| 308 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
| 309 | 309 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
| 310 | 310 | |
| 311 | 311 | // The content is everything OTHER than the [else] |
| 312 | 312 | $this->content = $before_else_if; |
| 313 | 313 | |
| 314 | 314 | if ( ! $this->is_match ) { |
| 315 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 315 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 316 | 316 | $this->else_content = $elseif_content; |
| 317 | 317 | } else { |
| 318 | 318 | $this->else_content = $else_content; |
@@ -340,16 +340,16 @@ discard block |
||
| 340 | 340 | foreach ( $else_if_matches as $key => $else_if_match ) { |
| 341 | 341 | |
| 342 | 342 | // If $else_if_match[5] exists and has content, check for more shortcodes |
| 343 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 343 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 344 | 344 | |
| 345 | 345 | // If the logic passes, this is the value that should be used for $this->else_content |
| 346 | - $else_if_value = $else_if_match[5]; |
|
| 347 | - $check_elseif_match = $else_if_match[0]; |
|
| 346 | + $else_if_value = $else_if_match[ 5 ]; |
|
| 347 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
| 348 | 348 | |
| 349 | 349 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
| 350 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
| 351 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
| 352 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
| 350 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
| 351 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
| 352 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | // Process any remaining [else] tags |
| 369 | - return $this->process_elseif( $else_if_match[5] ); |
|
| 369 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | return false; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $this->atts = array_intersect_key( $this->passed_atts, $this->atts ); |
| 393 | 393 | |
| 394 | 394 | // Strip whitespace if it's not default false |
| 395 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
| 395 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
| 404 | 404 | |
| 405 | 405 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
| 406 | - unset( $this->atts['if'] ); |
|
| 406 | + unset( $this->atts[ 'if' ] ); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) { |
| 43 | 43 | |
| 44 | - if( ! empty( $output ) ) { |
|
| 44 | + if ( ! empty( $output ) ) { |
|
| 45 | 45 | $output = gravity_flow()->translate_status_label( $output ); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | foreach ( $search_fields as & $search_field ) { |
| 66 | 66 | if ( $this->name === \GV\Utils::get( $search_field, 'key' ) ) { |
| 67 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
| 67 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | die; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
| 19 | +if ( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
| 20 | 20 | require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | 'atts' => NULL, |
| 158 | 158 | ) ); |
| 159 | 159 | |
| 160 | - foreach ($atts as $key => $value) { |
|
| 161 | - if( is_null( $value ) ) { |
|
| 160 | + foreach ( $atts as $key => $value ) { |
|
| 161 | + if ( is_null( $value ) ) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | $this->{$key} = $value; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | static function getInstance( $passed_post = NULL ) { |
| 190 | 190 | |
| 191 | - if( empty( self::$instance ) ) { |
|
| 191 | + if ( empty( self::$instance ) ) { |
|
| 192 | 192 | self::$instance = new self( $passed_post ); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function getCurrentField( $key = NULL ) { |
| 203 | 203 | |
| 204 | - if( !empty( $key ) ) { |
|
| 205 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
| 204 | + if ( ! empty( $key ) ) { |
|
| 205 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
| 206 | 206 | return $this->_current_field[ $key ]; |
| 207 | 207 | } |
| 208 | 208 | return NULL; |
@@ -213,16 +213,16 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | public function setCurrentFieldSetting( $key, $value ) { |
| 215 | 215 | |
| 216 | - if( !empty( $this->_current_field ) ) { |
|
| 217 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
| 216 | + if ( ! empty( $this->_current_field ) ) { |
|
| 217 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function getCurrentFieldSetting( $key ) { |
| 223 | - $settings = $this->getCurrentField('field_settings'); |
|
| 223 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
| 224 | 224 | |
| 225 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
| 225 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
| 226 | 226 | return $settings[ $key ]; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function getAtts( $key = NULL ) { |
| 255 | 255 | |
| 256 | - if( !empty( $key ) ) { |
|
| 257 | - if( isset( $this->atts[ $key ] ) ) { |
|
| 256 | + if ( ! empty( $key ) ) { |
|
| 257 | + if ( isset( $this->atts[ $key ] ) ) { |
|
| 258 | 258 | return $this->atts[ $key ]; |
| 259 | 259 | } |
| 260 | 260 | return NULL; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
| 322 | 322 | |
| 323 | - if( $fields && !empty( $key ) ) { |
|
| 323 | + if ( $fields && ! empty( $key ) ) { |
|
| 324 | 324 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
| 325 | 325 | } |
| 326 | 326 | |
@@ -338,18 +338,18 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | public function getContextFields( $context = '' ) { |
| 340 | 340 | |
| 341 | - if( '' === $context ) { |
|
| 341 | + if ( '' === $context ) { |
|
| 342 | 342 | $context = $this->getContext(); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | $fields = $this->getFields(); |
| 346 | 346 | |
| 347 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 347 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
| 348 | 348 | |
| 349 | 349 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
| 350 | 350 | $matches = explode( '_', $key ); |
| 351 | 351 | |
| 352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 352 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
| 353 | 353 | return $context_fields; |
| 354 | 354 | } |
| 355 | 355 | } |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function getField( $key ) { |
| 372 | 372 | |
| 373 | - if( !empty( $key ) ) { |
|
| 374 | - if( isset( $this->fields[ $key ] ) ) { |
|
| 373 | + if ( ! empty( $key ) ) { |
|
| 374 | + if ( isset( $this->fields[ $key ] ) ) { |
|
| 375 | 375 | return $this->fields[ $key ]; |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -477,8 +477,8 @@ discard block |
||
| 477 | 477 | public function getPaginationCounts() { |
| 478 | 478 | |
| 479 | 479 | $paging = $this->getPaging(); |
| 480 | - $offset = $paging['offset']; |
|
| 481 | - $page_size = $paging['page_size']; |
|
| 480 | + $offset = $paging[ 'offset' ]; |
|
| 481 | + $page_size = $paging[ 'page_size' ]; |
|
| 482 | 482 | $total = $this->getTotalEntries(); |
| 483 | 483 | |
| 484 | 484 | if ( empty( $total ) ) { |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | */ |
| 500 | 500 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
| 501 | 501 | |
| 502 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
| 502 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
@@ -595,16 +595,16 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | public function getCurrentEntry() { |
| 597 | 597 | |
| 598 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
| 598 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
| 599 | 599 | $entries = $this->getEntries(); |
| 600 | - $entry = $entries[0]; |
|
| 600 | + $entry = $entries[ 0 ]; |
|
| 601 | 601 | } else { |
| 602 | 602 | $entry = $this->_current_entry; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | /** @since 1.16 Fixes DataTables empty entry issue */ |
| 606 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
| 607 | - $entry = $this->_current_field['entry']; |
|
| 606 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
| 607 | + $entry = $this->_current_field[ 'entry' ]; |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | return $entry; |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
| 645 | 645 | |
| 646 | 646 | if ( empty( $zone ) ) { |
| 647 | - gravityview()->log->error( 'No zone defined.'); |
|
| 647 | + gravityview()->log->error( 'No zone defined.' ); |
|
| 648 | 648 | return NULL; |
| 649 | 649 | } |
| 650 | 650 | |
@@ -653,16 +653,16 @@ discard block |
||
| 653 | 653 | 'context' => $this->getContext(), |
| 654 | 654 | 'entry' => $this->getCurrentEntry(), |
| 655 | 655 | 'form' => $this->getForm(), |
| 656 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
| 656 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
| 657 | 657 | ); |
| 658 | 658 | |
| 659 | 659 | $final_atts = wp_parse_args( $atts, $defaults ); |
| 660 | 660 | |
| 661 | 661 | $output = ''; |
| 662 | 662 | |
| 663 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
| 663 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
| 664 | 664 | |
| 665 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
| 665 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
| 666 | 666 | |
| 667 | 667 | // Backward compatibility |
| 668 | 668 | if ( 'table' === $this->getTemplatePartSlug() ) { |
@@ -672,19 +672,19 @@ discard block |
||
| 672 | 672 | * @param \GravityView_View $this |
| 673 | 673 | * @deprecated Use `gravityview/template/table/fields` |
| 674 | 674 | */ |
| 675 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
| 675 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | if ( empty( $fields ) ) { |
| 679 | 679 | |
| 680 | - gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) ); |
|
| 680 | + gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) ); |
|
| 681 | 681 | |
| 682 | 682 | return NULL; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | $field_output = ''; |
| 686 | 686 | foreach ( $fields as $field ) { |
| 687 | - $final_atts['field'] = $field; |
|
| 687 | + $final_atts[ 'field' ] = $field; |
|
| 688 | 688 | |
| 689 | 689 | $field_output .= gravityview_field_output( $final_atts ); |
| 690 | 690 | } |
@@ -701,17 +701,17 @@ discard block |
||
| 701 | 701 | return NULL; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 705 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
| 704 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 705 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | $output .= $field_output; |
| 709 | 709 | |
| 710 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 710 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 711 | 711 | $output .= '</div>'; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - if( $echo ) { |
|
| 714 | + if ( $echo ) { |
|
| 715 | 715 | echo $output; |
| 716 | 716 | } |
| 717 | 717 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | */ |
| 730 | 730 | function locate_template( $template_names, $load = false, $require_once = true ) { |
| 731 | 731 | |
| 732 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 732 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 733 | 733 | |
| 734 | 734 | $located = $this->located_templates[ $template_names ]; |
| 735 | 735 | |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | // Set $load to always false so we handle it here. |
| 739 | 739 | $located = parent::locate_template( $template_names, false, $require_once ); |
| 740 | 740 | |
| 741 | - if( is_string( $template_names ) ) { |
|
| 741 | + if ( is_string( $template_names ) ) { |
|
| 742 | 742 | $this->located_templates[ $template_names ] = $located; |
| 743 | 743 | } |
| 744 | 744 | } |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | * @return mixed|null The stored data. |
| 757 | 757 | */ |
| 758 | 758 | public function __get( $name ) { |
| 759 | - if( isset( $this->{$name} ) ) { |
|
| 759 | + if ( isset( $this->{$name} ) ) { |
|
| 760 | 760 | return $this->{$name}; |
| 761 | 761 | } else { |
| 762 | 762 | return NULL; |
@@ -785,17 +785,17 @@ discard block |
||
| 785 | 785 | $additional = array(); |
| 786 | 786 | |
| 787 | 787 | // form-19-table-body.php |
| 788 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 788 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 789 | 789 | |
| 790 | - if( $view_id = $this->getViewId() ) { |
|
| 790 | + if ( $view_id = $this->getViewId() ) { |
|
| 791 | 791 | // view-3-table-body.php |
| 792 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
| 792 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - if( $this->getPostId() ) { |
|
| 795 | + if ( $this->getPostId() ) { |
|
| 796 | 796 | |
| 797 | 797 | // page-19-table-body.php |
| 798 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 798 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | // Combine with existing table-body.php and table.php |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) ); |
| 819 | 819 | |
| 820 | - if( !empty( $template_file) ) { |
|
| 820 | + if ( ! empty( $template_file ) ) { |
|
| 821 | 821 | |
| 822 | 822 | if ( $require_once ) { |
| 823 | 823 | require_once( $template_file ); |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | |
| 886 | 886 | // Prevent being called twice |
| 887 | 887 | if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) { |
| 888 | - gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) ); |
|
| 888 | + gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) ); |
|
| 889 | 889 | return; |
| 890 | 890 | } |
| 891 | 891 | |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | * @param string $zone Current widget zone, either `header` or `footer` |
| 908 | 908 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
| 909 | 909 | */ |
| 910 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
| 910 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
| 911 | 911 | |
| 912 | 912 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 913 | 913 | |
@@ -915,15 +915,15 @@ discard block |
||
| 915 | 915 | ?> |
| 916 | 916 | <div class="<?php echo $css_class; ?>"> |
| 917 | 917 | <?php |
| 918 | - foreach( $rows as $row ) { |
|
| 919 | - foreach( $row as $col => $areas ) { |
|
| 918 | + foreach ( $rows as $row ) { |
|
| 919 | + foreach ( $row as $col => $areas ) { |
|
| 920 | 920 | $column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left"; |
| 921 | 921 | ?> |
| 922 | 922 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 923 | 923 | <?php |
| 924 | 924 | if ( ! empty( $areas ) ) { |
| 925 | 925 | foreach ( $areas as $area ) { |
| 926 | - foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) { |
|
| 926 | + foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) { |
|
| 927 | 927 | do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context ); |
| 928 | 928 | } |
| 929 | 929 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function __destruct() { |
| 95 | - remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback );; |
|
| 95 | + remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback ); ; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -175,55 +175,55 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | if ( $is_view && $post ) { |
| 177 | 177 | if ( $field_type ) { |
| 178 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
| 179 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
| 180 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
| 181 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
| 182 | - $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
| 183 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
| 184 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
| 185 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
| 178 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
| 179 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
| 180 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
| 181 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
| 182 | + $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
| 183 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
| 184 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
| 185 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
| 189 | - $specifics []= sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
| 190 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 191 | - $specifics []= sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
| 188 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
| 189 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
| 190 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 191 | + $specifics [ ] = sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** Field-specific */ |
| 195 | 195 | if ( $field_id && $form_id ) { |
| 196 | 196 | |
| 197 | 197 | if ( $field_id ) { |
| 198 | - $specifics []= sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
| 199 | - $specifics []= sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
| 198 | + $specifics [ ] = sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
| 199 | + $specifics [ ] = sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if ( $field_type ) { |
| 203 | - $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
| 204 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
| 205 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
| 206 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
| 207 | - |
|
| 208 | - $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
| 209 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
| 210 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
| 211 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
| 212 | - |
|
| 213 | - $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
| 214 | - $inputType && $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
| 215 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
| 216 | - $inputType && $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
| 203 | + $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
| 204 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
| 205 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
| 206 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
| 207 | + |
|
| 208 | + $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
| 209 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
| 210 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
| 211 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
| 212 | + |
|
| 213 | + $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
| 214 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
| 215 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
| 216 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if ( $form_id ) { |
| 221 | 221 | /** Generic field templates */ |
| 222 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
| 223 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
| 222 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
| 223 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
| 224 | 224 | |
| 225 | - $specifics []= sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
| 226 | - $specifics []= sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
| 225 | + $specifics [ ] = sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
| 226 | + $specifics [ ] = sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | * Ignore some types that conflict. |
| 232 | 232 | */ |
| 233 | 233 | if ( ! in_array( $field_type, array( 'notes' ) ) ) { |
| 234 | - $specifics []= sprintf( '%s.php', $field_type ); |
|
| 235 | - $specifics []= sprintf( 'fields/%s.php', $field_type ); |
|
| 234 | + $specifics [ ] = sprintf( '%s.php', $field_type ); |
|
| 235 | + $specifics [ ] = sprintf( 'fields/%s.php', $field_type ); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
| 239 | - $specifics []= sprintf( '%sfield.php', $slug_dir ); |
|
| 238 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
| 239 | + $specifics [ ] = sprintf( '%sfield.php', $slug_dir ); |
|
| 240 | 240 | |
| 241 | 241 | return array_merge( $specifics, $templates ); |
| 242 | 242 | }; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | /** Prevent any PHP warnings that may be generated. */ |
| 267 | 267 | ob_start(); |
| 268 | 268 | |
| 269 | - $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $this->entry['currency'], false, 'html' ); |
|
| 269 | + $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $this->entry[ 'currency' ], false, 'html' ); |
|
| 270 | 270 | |
| 271 | 271 | if ( $errors = ob_get_clean() ) { |
| 272 | 272 | gravityview()->log->error( 'Errors when calling GFCommon::get_lead_field_display()', array( 'data' => $errors ) ); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
| 38 | 38 | |
| 39 | - if( is_admin() ) { |
|
| 39 | + if ( is_admin() ) { |
|
| 40 | 40 | $this->load_components( 'admin' ); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | static function getInstance() { |
| 57 | 57 | |
| 58 | - if( empty( self::$instance ) ) { |
|
| 58 | + if ( empty( self::$instance ) ) { |
|
| 59 | 59 | self::$instance = new GravityView_Edit_Entry; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | private function add_hooks() { |
| 82 | 82 | |
| 83 | 83 | // Add front-end access to Gravity Forms delete file action |
| 84 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
| 85 | 85 | |
| 86 | 86 | // Make sure this hook is run for non-admins |
| 87 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 87 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
| 88 | 88 | |
| 89 | 89 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
| 90 | 90 | |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function addon_specific_hooks() { |
| 101 | 101 | |
| 102 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
| 103 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
| 102 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
| 103 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | } |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
| 148 | 148 | |
| 149 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
| 149 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
| 150 | 150 | |
| 151 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
| 151 | + $base = gv_entry_link( $entry, $post_id ?: $view_id ); |
|
| 152 | 152 | |
| 153 | 153 | $url = add_query_arg( array( |
| 154 | 154 | 'edit' => wp_create_nonce( $nonce_key ) |
| 155 | 155 | ), $base ); |
| 156 | 156 | |
| 157 | - if( $post_id ) { |
|
| 157 | + if ( $post_id ) { |
|
| 158 | 158 | $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | * Allow passing params to dynamically populate entry with values |
| 163 | 163 | * @since 1.9.2 |
| 164 | 164 | */ |
| 165 | - if( !empty( $field_values ) ) { |
|
| 165 | + if ( ! empty( $field_values ) ) { |
|
| 166 | 166 | |
| 167 | - if( is_array( $field_values ) ) { |
|
| 167 | + if ( is_array( $field_values ) ) { |
|
| 168 | 168 | // If already an array, no parse_str() needed |
| 169 | 169 | $params = $field_values; |
| 170 | 170 | } else { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
| 187 | 187 | |
| 188 | - if( empty( $context ) || $context !== 'edit' ) { |
|
| 188 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
| 189 | 189 | return $fields; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -246,25 +246,25 @@ discard block |
||
| 246 | 246 | // If they can edit any entries (as defined in Gravity Forms) |
| 247 | 247 | // Or if they can edit other people's entries |
| 248 | 248 | // Then we're good. |
| 249 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 249 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
| 250 | 250 | |
| 251 | 251 | gravityview()->log->debug( 'User has ability to edit all entries.' ); |
| 252 | 252 | |
| 253 | 253 | $user_can_edit = true; |
| 254 | 254 | |
| 255 | - } else if( !isset( $entry['created_by'] ) ) { |
|
| 255 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 256 | 256 | |
| 257 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
| 257 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
|
| 258 | 258 | |
| 259 | 259 | $user_can_edit = false; |
| 260 | 260 | |
| 261 | 261 | } else { |
| 262 | 262 | |
| 263 | 263 | // get user_edit setting |
| 264 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 264 | + if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 265 | 265 | // if View ID not specified or is the current view |
| 266 | 266 | // @deprecated path |
| 267 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
| 267 | + $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' ); |
|
| 268 | 268 | } else { |
| 269 | 269 | // in case is specified and not the current view |
| 270 | 270 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $current_user = wp_get_current_user(); |
| 274 | 274 | |
| 275 | 275 | // User edit is disabled |
| 276 | - if( empty( $user_edit ) ) { |
|
| 276 | + if ( empty( $user_edit ) ) { |
|
| 277 | 277 | |
| 278 | 278 | gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
| 279 | 279 | |
@@ -281,13 +281,13 @@ discard block |
||
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
| 284 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 284 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 285 | 285 | |
| 286 | 286 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
| 287 | 287 | |
| 288 | 288 | $user_can_edit = true; |
| 289 | 289 | |
| 290 | - } else if( ! is_user_logged_in() ) { |
|
| 290 | + } else if ( ! is_user_logged_in() ) { |
|
| 291 | 291 | |
| 292 | 292 | gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
| 293 | 293 | } |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
| 90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 91 | 91 | |
| 92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $this->context_view_id = $view_id; |
| 238 | 238 | |
| 239 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
| 239 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
| 240 | 240 | /** |
| 241 | 241 | * used on a has_multiple_views context |
| 242 | 242 | * @see GravityView_API::entry_link |
| 243 | 243 | */ |
| 244 | - $this->context_view_id = $_GET['gvid']; |
|
| 244 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 245 | 245 | |
| 246 | 246 | } elseif ( ! $multiple_views ) { |
| 247 | 247 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
@@ -278,25 +278,25 @@ discard block |
||
| 278 | 278 | global $wp_rewrite; |
| 279 | 279 | |
| 280 | 280 | $is_front_page = ( $query->is_home || $query->is_page ); |
| 281 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
| 282 | - $front_page_id = get_option('page_on_front'); |
|
| 281 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
| 282 | + $front_page_id = get_option( 'page_on_front' ); |
|
| 283 | 283 | |
| 284 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 284 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 285 | 285 | |
| 286 | 286 | // Force to be an array, potentially a query string ( entry=16 ) |
| 287 | 287 | $_query = wp_parse_args( $query->query ); |
| 288 | 288 | |
| 289 | 289 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
| 290 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
| 291 | - unset( $_query['pagename'] ); |
|
| 290 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
| 291 | + unset( $_query[ 'pagename' ] ); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // this is where will break from core wordpress |
| 295 | 295 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
| 296 | 296 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
| 297 | 297 | $endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' ); |
| 298 | - foreach ( (array) $endpoints as $endpoint ) { |
|
| 299 | - $ignore[] = $endpoint[1]; |
|
| 298 | + foreach ( (array)$endpoints as $endpoint ) { |
|
| 299 | + $ignore[ ] = $endpoint[ 1 ]; |
|
| 300 | 300 | } |
| 301 | 301 | unset( $endpoints ); |
| 302 | 302 | |
@@ -306,21 +306,21 @@ discard block |
||
| 306 | 306 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
| 307 | 307 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
| 308 | 308 | |
| 309 | - $qv =& $query->query_vars; |
|
| 309 | + $qv = & $query->query_vars; |
|
| 310 | 310 | |
| 311 | 311 | // Prevent redirect when on the single entry endpoint |
| 312 | - if( self::is_single_entry() ) { |
|
| 312 | + if ( self::is_single_entry() ) { |
|
| 313 | 313 | add_filter( 'redirect_canonical', '__return_false' ); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | $query->is_page = true; |
| 317 | 317 | $query->is_home = false; |
| 318 | - $qv['page_id'] = $front_page_id; |
|
| 318 | + $qv[ 'page_id' ] = $front_page_id; |
|
| 319 | 319 | |
| 320 | 320 | // Correct <!--nextpage--> for page_on_front |
| 321 | - if ( ! empty( $qv['paged'] ) ) { |
|
| 322 | - $qv['page'] = $qv['paged']; |
|
| 323 | - unset( $qv['paged'] ); |
|
| 321 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
| 322 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
| 323 | + unset( $qv[ 'paged' ] ); |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 352 | 352 | |
| 353 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 353 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 354 | 354 | $this->setPostId( $post_id ); |
| 355 | 355 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 356 | 356 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 388 | 388 | |
| 389 | - if( 'post' === $search_method ) { |
|
| 389 | + if ( 'post' === $search_method ) { |
|
| 390 | 390 | $get = $_POST; |
| 391 | 391 | } else { |
| 392 | 392 | $get = $_GET; |
@@ -443,20 +443,20 @@ discard block |
||
| 443 | 443 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 444 | 444 | * @param array $entry Current entry |
| 445 | 445 | */ |
| 446 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 446 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 447 | 447 | |
| 448 | 448 | if ( ! $apply_outside_loop ) { |
| 449 | 449 | return $title; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | // User reported WooCommerce doesn't pass two args. |
| 453 | - if ( empty( $passed_post_id ) ) { |
|
| 453 | + if ( empty( $passed_post_id ) ) { |
|
| 454 | 454 | return $title; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | // Don't modify the title for anything other than the current view/post. |
| 458 | 458 | // This is true for embedded shortcodes and Views. |
| 459 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 459 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 460 | 460 | return $title; |
| 461 | 461 | } |
| 462 | 462 | |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 469 | 469 | } else { |
| 470 | 470 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 471 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 471 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 472 | 472 | $view_meta = $view_data; |
| 473 | 473 | break; |
| 474 | 474 | } |
@@ -476,12 +476,12 @@ discard block |
||
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | /** Deprecated stuff in the future. See the branch above. */ |
| 479 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 479 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 480 | 480 | |
| 481 | - $title = $view_meta['atts']['single_title']; |
|
| 481 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 482 | 482 | |
| 483 | 483 | // We are allowing HTML in the fields, so no escaping the output |
| 484 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 484 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 485 | 485 | |
| 486 | 486 | $title = do_shortcode( $title ); |
| 487 | 487 | } |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | $context = GravityView_View::getInstance()->getContext(); |
| 554 | 554 | |
| 555 | - switch( $context ) { |
|
| 555 | + switch ( $context ) { |
|
| 556 | 556 | case 'directory': |
| 557 | 557 | $tab = __( 'Multiple Entries', 'gravityview' ); |
| 558 | 558 | break; |
@@ -566,12 +566,12 @@ discard block |
||
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | |
| 569 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
| 569 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
| 570 | 570 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
| 571 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
| 571 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
| 572 | 572 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
| 573 | 573 | |
| 574 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
| 574 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
| 575 | 575 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
| 576 | 576 | |
| 577 | 577 | echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID ); |
| 620 | 620 | $embed_only = $view->settings->get( 'embed_only' ); |
| 621 | 621 | |
| 622 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 622 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 623 | 623 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 624 | 624 | } |
| 625 | 625 | |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | $datetime_format = 'Y-m-d H:i:s'; |
| 667 | 667 | $search_is_outside_view_bounds = false; |
| 668 | 668 | |
| 669 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 669 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 670 | 670 | |
| 671 | 671 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 672 | 672 | |
@@ -694,14 +694,14 @@ discard block |
||
| 694 | 694 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 695 | 695 | |
| 696 | 696 | // Then we override the search and re-set the start date |
| 697 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 697 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 702 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 703 | 703 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 704 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 704 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 705 | 705 | gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) ); |
| 706 | 706 | } |
| 707 | 707 | } |
@@ -720,19 +720,19 @@ discard block |
||
| 720 | 720 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 721 | 721 | |
| 722 | 722 | /** @since 1.19 */ |
| 723 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
| 723 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 724 | 724 | gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' ); |
| 725 | 725 | return $search_criteria; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 728 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 729 | 729 | |
| 730 | - $search_criteria['field_filters'][] = array( |
|
| 730 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 731 | 731 | 'key' => GravityView_Entry_Approval::meta_key, |
| 732 | 732 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
| 733 | 733 | ); |
| 734 | 734 | |
| 735 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 735 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 736 | 736 | |
| 737 | 737 | gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) ); |
| 738 | 738 | } |
@@ -759,18 +759,18 @@ discard block |
||
| 759 | 759 | */ |
| 760 | 760 | public static function is_entry_approved( $entry, $args = array() ) { |
| 761 | 761 | |
| 762 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 762 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 763 | 763 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 764 | 764 | return true; |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | /** @since 1.19 */ |
| 768 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
| 768 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 769 | 769 | gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' ); |
| 770 | 770 | return true; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
| 773 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
| 774 | 774 | |
| 775 | 775 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
| 776 | 776 | } |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`. |
| 795 | 795 | */ |
| 796 | 796 | $criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) ); |
| 797 | - $search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() ); |
|
| 797 | + $search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() ); |
|
| 798 | 798 | |
| 799 | 799 | /** |
| 800 | 800 | * @filter `gravityview_fe_search_criteria` Modify the search criteria |
@@ -810,29 +810,29 @@ discard block |
||
| 810 | 810 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) ); |
| 811 | 811 | |
| 812 | 812 | // implicity search |
| 813 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 813 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 814 | 814 | |
| 815 | 815 | // Search operator options. Options: `is` or `contains` |
| 816 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 816 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 817 | 817 | |
| 818 | - $search_criteria['field_filters'][] = array( |
|
| 818 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 819 | 819 | 'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search |
| 820 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 820 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 821 | 821 | 'operator' => $operator, |
| 822 | 822 | ); |
| 823 | 823 | |
| 824 | 824 | // Lock search mode to "all" with implicit presearch filter. |
| 825 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
| 825 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 828 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 829 | 829 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) ); |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | // Handle setting date range |
| 833 | 833 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 834 | 834 | |
| 835 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 835 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 836 | 836 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) ); |
| 837 | 837 | } |
| 838 | 838 | |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 844 | 844 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 845 | 845 | */ |
| 846 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 846 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 847 | 847 | |
| 848 | 848 | return $search_criteria; |
| 849 | 849 | } |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | 'search_criteria' => $search_criteria, |
| 957 | 957 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
| 958 | 958 | 'paging' => $paging, |
| 959 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 959 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 960 | 960 | ); |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 982 | 982 | * @param array $args View configuration args. |
| 983 | 983 | */ |
| 984 | - $parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
| 984 | + $parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
| 985 | 985 | |
| 986 | 986 | gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) ); |
| 987 | 987 | |
@@ -1006,17 +1006,17 @@ discard block |
||
| 1006 | 1006 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
| 1007 | 1007 | |
| 1008 | 1008 | // Paging & offset |
| 1009 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
| 1009 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
| 1010 | 1010 | |
| 1011 | 1011 | if ( -1 === $page_size ) { |
| 1012 | 1012 | $page_size = PHP_INT_MAX; |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 1015 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 1016 | 1016 | $offset = ( $curr_page - 1 ) * $page_size; |
| 1017 | 1017 | |
| 1018 | - if ( ! empty( $args['offset'] ) ) { |
|
| 1019 | - $offset += intval( $args['offset'] ); |
|
| 1018 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
| 1019 | + $offset += intval( $args[ 'offset' ] ); |
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | $paging = array( |
@@ -1040,8 +1040,8 @@ discard block |
||
| 1040 | 1040 | */ |
| 1041 | 1041 | public static function updateViewSorting( $args, $form_id ) { |
| 1042 | 1042 | $sorting = array(); |
| 1043 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' ); |
|
| 1044 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' ); |
|
| 1043 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' ); |
|
| 1044 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' ); |
|
| 1045 | 1045 | |
| 1046 | 1046 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1047 | 1047 | |
@@ -1058,12 +1058,12 @@ discard block |
||
| 1058 | 1058 | $form = GFAPI::get_form( $form_id ); |
| 1059 | 1059 | |
| 1060 | 1060 | // Get the first GF_Field field ID, set as the key for entry randomization |
| 1061 | - if( ! empty( $form['fields'] ) ) { |
|
| 1061 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
| 1062 | 1062 | |
| 1063 | 1063 | /** @var GF_Field $field */ |
| 1064 | - foreach ( $form['fields'] as $field ) { |
|
| 1064 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 1065 | 1065 | |
| 1066 | - if( ! is_a( $field, 'GF_Field' ) ) { |
|
| 1066 | + if ( ! is_a( $field, 'GF_Field' ) ) { |
|
| 1067 | 1067 | continue; |
| 1068 | 1068 | } |
| 1069 | 1069 | |
@@ -1107,11 +1107,11 @@ discard block |
||
| 1107 | 1107 | |
| 1108 | 1108 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1109 | 1109 | |
| 1110 | - if( ! $sort_field ) { |
|
| 1110 | + if ( ! $sort_field ) { |
|
| 1111 | 1111 | return $sort_field_id; |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | - switch ( $sort_field['type'] ) { |
|
| 1114 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1115 | 1115 | |
| 1116 | 1116 | case 'address': |
| 1117 | 1117 | // Sorting by full address |
@@ -1128,7 +1128,7 @@ discard block |
||
| 1128 | 1128 | */ |
| 1129 | 1129 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1130 | 1130 | |
| 1131 | - switch( strtolower( $address_part ) ){ |
|
| 1131 | + switch ( strtolower( $address_part ) ) { |
|
| 1132 | 1132 | case 'street': |
| 1133 | 1133 | $sort_field_id .= '.1'; |
| 1134 | 1134 | break; |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | */ |
| 1209 | 1209 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1210 | 1210 | |
| 1211 | - if ( empty( $single_entry ) ){ |
|
| 1211 | + if ( empty( $single_entry ) ) { |
|
| 1212 | 1212 | return false; |
| 1213 | 1213 | } else { |
| 1214 | 1214 | return $single_entry; |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | $views = $this->getGvOutputData()->get_views(); |
| 1231 | 1231 | |
| 1232 | 1232 | foreach ( $views as $view_id => $data ) { |
| 1233 | - $view = \GV\View::by_id( $data['id'] ); |
|
| 1233 | + $view = \GV\View::by_id( $data[ 'id' ] ); |
|
| 1234 | 1234 | $view_id = $view->ID; |
| 1235 | 1235 | $template_id = gravityview_get_template_id( $view->ID ); |
| 1236 | 1236 | $data = $view->as_data(); |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1240 | 1240 | * @since 1.15 |
| 1241 | 1241 | */ |
| 1242 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1242 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1243 | 1243 | continue; |
| 1244 | 1244 | } |
| 1245 | 1245 | |
@@ -1256,13 +1256,13 @@ discard block |
||
| 1256 | 1256 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1257 | 1257 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1258 | 1258 | */ |
| 1259 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1259 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1260 | 1260 | |
| 1261 | 1261 | /** |
| 1262 | 1262 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1263 | 1263 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1264 | 1264 | */ |
| 1265 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1265 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | 1268 | /** |
@@ -1270,19 +1270,19 @@ discard block |
||
| 1270 | 1270 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1271 | 1271 | * @since 1.15 |
| 1272 | 1272 | */ |
| 1273 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1274 | - $css_dependencies[] = 'dashicons'; |
|
| 1273 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1274 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | 1277 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1278 | 1278 | |
| 1279 | 1279 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1280 | 1280 | |
| 1281 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
| 1281 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
| 1282 | 1282 | |
| 1283 | 1283 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1284 | 1284 | |
| 1285 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1285 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1286 | 1286 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1287 | 1287 | } |
| 1288 | 1288 | |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | public static function add_style( $template_id ) { |
| 1346 | 1346 | |
| 1347 | 1347 | if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) { |
| 1348 | - gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
| 1348 | + gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
| 1349 | 1349 | wp_enqueue_style( 'gravityview_style_' . $template_id ); |
| 1350 | 1350 | } elseif ( empty( $template_id ) ) { |
| 1351 | 1351 | gravityview()->log->error( 'Cannot add template style; template_id is empty' ); |
@@ -1376,11 +1376,11 @@ discard block |
||
| 1376 | 1376 | * Not a table-based template; don't add sort icons |
| 1377 | 1377 | * @since 1.12 |
| 1378 | 1378 | */ |
| 1379 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1379 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1380 | 1380 | return $label; |
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1383 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1384 | 1384 | return $label; |
| 1385 | 1385 | } |
| 1386 | 1386 | |
@@ -1388,29 +1388,29 @@ discard block |
||
| 1388 | 1388 | |
| 1389 | 1389 | $class = 'gv-sort'; |
| 1390 | 1390 | |
| 1391 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1391 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1392 | 1392 | |
| 1393 | 1393 | $sort_args = array( |
| 1394 | - 'sort' => $field['id'], |
|
| 1394 | + 'sort' => $field[ 'id' ], |
|
| 1395 | 1395 | 'dir' => 'asc', |
| 1396 | 1396 | ); |
| 1397 | 1397 | |
| 1398 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1398 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1399 | 1399 | //toggle sorting direction. |
| 1400 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1401 | - $sort_args['dir'] = 'desc'; |
|
| 1400 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1401 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1402 | 1402 | $class .= ' gv-icon-sort-desc'; |
| 1403 | 1403 | } else { |
| 1404 | - $sort_args['dir'] = 'asc'; |
|
| 1404 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1405 | 1405 | $class .= ' gv-icon-sort-asc'; |
| 1406 | 1406 | } |
| 1407 | 1407 | } else { |
| 1408 | 1408 | $class .= ' gv-icon-caret-up-down'; |
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1411 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1412 | 1412 | |
| 1413 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1413 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1414 | 1414 | |
| 1415 | 1415 | } |
| 1416 | 1416 | |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | |
| 1429 | 1429 | $field_type = $field_id; |
| 1430 | 1430 | |
| 1431 | - if( is_numeric( $field_id ) ) { |
|
| 1431 | + if ( is_numeric( $field_id ) ) { |
|
| 1432 | 1432 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1433 | 1433 | $field_type = $field->type; |
| 1434 | 1434 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
| 1451 | 1451 | return false; |
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1454 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1455 | 1455 | |
| 1456 | 1456 | } |
| 1457 | 1457 | |