@@ -50,8 +50,8 @@ |
||
| 50 | 50 | /** |
| 51 | 51 | * By array. |
| 52 | 52 | */ |
| 53 | - if ( is_array( $view ) && ! empty( $view['id'] ) ) { |
|
| 54 | - return $this->get( $view['id'] ); |
|
| 53 | + if ( is_array( $view ) && ! empty( $view[ 'id' ] ) ) { |
|
| 54 | + return $this->get( $view[ 'id' ] ); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | require_once gravityview()->plugin->dir( 'future/includes/rest/class-gv-rest-route.php' ); |
| 22 | 22 | require_once gravityview()->plugin->dir( 'future/includes/rest/class-gv-rest-views-route.php' ); |
| 23 | 23 | |
| 24 | - self::$routes['views'] = $views = new Views_Route(); |
|
| 24 | + self::$routes[ 'views' ] = $views = new Views_Route(); |
|
| 25 | 25 | $views->register_routes(); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | $atts = apply_filters( 'gravityview/shortcodes/gvfield/atts', $atts ); |
| 45 | 45 | |
| 46 | - if ( ! $view = \GV\View::by_id( $atts['view_id'] ) ) { |
|
| 47 | - gravityview()->log->error( 'View #{view_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
| 46 | + if ( ! $view = \GV\View::by_id( $atts[ 'view_id' ] ) ) { |
|
| 47 | + gravityview()->log->error( 'View #{view_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
| 48 | 48 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, null, null, $atts ); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - switch( $atts['entry_id'] ): |
|
| 51 | + switch ( $atts[ 'entry_id' ] ): |
|
| 52 | 52 | case 'last': |
| 53 | 53 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
| 54 | 54 | /** |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | * Since we're using \GF_Query shorthand initialization we have to reverse the order parameters here. |
| 58 | 58 | */ |
| 59 | 59 | add_filter( 'gravityview_get_entries', $filter = function( $parameters, $args, $form_id ) { |
| 60 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
| 60 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
| 61 | 61 | /** |
| 62 | 62 | * Reverse existing sorts. |
| 63 | 63 | */ |
| 64 | - $sort = &$parameters['sorting']; |
|
| 65 | - $sort['direction'] = $sort['direction'] == 'RAND' ? : ( $sort['direction'] == 'ASC' ? 'DESC' : 'ASC' ); |
|
| 64 | + $sort = &$parameters[ 'sorting' ]; |
|
| 65 | + $sort[ 'direction' ] = $sort[ 'direction' ] == 'RAND' ?: ( $sort[ 'direction' ] == 'ASC' ? 'DESC' : 'ASC' ); |
|
| 66 | 66 | } else { |
| 67 | 67 | /** |
| 68 | 68 | * Otherwise, sort by date_created. |
| 69 | 69 | */ |
| 70 | - $parameters['sorting'] = array( |
|
| 70 | + $parameters[ 'sorting' ] = array( |
|
| 71 | 71 | 'key' => 'id', |
| 72 | 72 | 'direction' => 'ASC', |
| 73 | 73 | 'is_numeric' => true |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | /** If a sort already exists, reverse it. */ |
| 84 | 84 | if ( $sort = end( $entries->sorts ) ) { |
| 85 | - $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ? : ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
| 85 | + $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ?: ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
| 86 | 86 | } else { |
| 87 | 87 | /** Otherwise, sort by date_created */ |
| 88 | 88 | $entries = $entries->sort( new \GV\Entry_Sort( \GV\Internal_Field::by_id( 'id' ), \GV\Entry_Sort::ASC ), \GV\Entry_Sort::NUMERIC ); |
@@ -99,20 +99,20 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | break; |
| 101 | 101 | default: |
| 102 | - if ( ! $entry = \GV\GF_Entry::by_id( $atts['entry_id'] ) ) { |
|
| 103 | - gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
| 102 | + if ( ! $entry = \GV\GF_Entry::by_id( $atts[ 'entry_id' ] ) ) { |
|
| 103 | + gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
| 104 | 104 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, null, $atts ); |
| 105 | 105 | } |
| 106 | 106 | endswitch; |
| 107 | 107 | |
| 108 | - $field = is_numeric( $atts['field_id'] ) ? \GV\GF_Field::by_id( $view->form, $atts['field_id'] ) : \GV\Internal_Field::by_id( $atts['field_id'] ); |
|
| 108 | + $field = is_numeric( $atts[ 'field_id' ] ) ? \GV\GF_Field::by_id( $view->form, $atts[ 'field_id' ] ) : \GV\Internal_Field::by_id( $atts[ 'field_id' ] ); |
|
| 109 | 109 | |
| 110 | 110 | if ( ! $field ) { |
| 111 | - gravityview()->log->error( 'Field #{field_id} not found', array( 'view_id' => $atts['field_id'] ) ); |
|
| 111 | + gravityview()->log->error( 'Field #{field_id} not found', array( 'view_id' => $atts[ 'field_id' ] ) ); |
|
| 112 | 112 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $field, $atts ); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if ( $view->form->ID != $entry['form_id'] ) { |
|
| 115 | + if ( $view->form->ID != $entry[ 'form_id' ] ) { |
|
| 116 | 116 | gravityview()->log->error( 'Entry does not belong to view (form mismatch)' ); |
| 117 | 117 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
| 118 | 118 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | return apply_filters( 'gravityview/shortcodes/gvfield/output', get_the_password_form( $view->ID ), $view, $entry, $atts ); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if ( ! $view->form ) { |
|
| 125 | + if ( ! $view->form ) { |
|
| 126 | 126 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -145,13 +145,13 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** Unapproved entries. */ |
| 148 | - if ( $entry['status'] != 'active' ) { |
|
| 148 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 149 | 149 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 150 | 150 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if ( $view->settings->get( 'show_only_approved' ) ) { |
| 154 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 154 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 155 | 155 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 156 | 156 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
| 157 | 157 | } |
@@ -86,8 +86,8 @@ |
||
| 86 | 86 | */ |
| 87 | 87 | $context->view = Utils::get( $template, 'view' ); |
| 88 | 88 | $context->source = Utils::get( $template, 'source' ); |
| 89 | - $context->field = Utils::get( $template, 'field' ) ? : Utils::get( $data, 'field' ); |
|
| 90 | - $context->entry = Utils::get( $template, 'entry' ) ? : Utils::get( $data, 'entry' ); |
|
| 89 | + $context->field = Utils::get( $template, 'field' ) ?: Utils::get( $data, 'field' ); |
|
| 90 | + $context->entry = Utils::get( $template, 'entry' ) ?: Utils::get( $data, 'entry' ); |
|
| 91 | 91 | $context->request = Utils::get( $template, 'request' ); |
| 92 | 92 | |
| 93 | 93 | $context->entries = Utils::get( $template, 'entries' ) ? $template->entries : null; |
@@ -10,22 +10,22 @@ |
||
| 10 | 10 | $search_field = $gravityview_view->search_field; |
| 11 | 11 | |
| 12 | 12 | // Make sure that there are choices to display |
| 13 | -if( empty( $search_field['choices'] ) ) { |
|
| 13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 14 | 14 | gravityview()->log->debug( 'search-field-checkbox.php - No choices for field' ); |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | ?> |
| 19 | 19 | <div class="gv-search-box gv-search-field-checkbox"> |
| 20 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 22 | 22 | <?php } ?> |
| 23 | 23 | <p> |
| 24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
| 24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
| 25 | 25 | |
| 26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
| 27 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>[]" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true, 'checked' ); ?>> |
|
| 28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
| 26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
| 27 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true, 'checked' ); ?>> |
|
| 28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
| 29 | 29 | </label> |
| 30 | 30 | |
| 31 | 31 | <?php } ?> |
@@ -10,22 +10,22 @@ |
||
| 10 | 10 | $search_field = $gravityview_view->search_field; |
| 11 | 11 | |
| 12 | 12 | // Make sure that there are choices to display |
| 13 | -if( empty( $search_field['choices'] ) ) { |
|
| 13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 14 | 14 | gravityview()->log->debug( 'search-field-radio.php - No choices for field' ); |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | ?> |
| 19 | 19 | <div class="gv-search-box gv-search-field-radio"> |
| 20 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 22 | 22 | <?php } ?> |
| 23 | 23 | <p> |
| 24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
| 24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
| 25 | 25 | |
| 26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
| 27 | - <input type="radio" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php checked( $choice['value'], $search_field['value'], true ); ?>> |
|
| 28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
| 26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
| 27 | + <input type="radio" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php checked( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>> |
|
| 28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
| 29 | 29 | </label> |
| 30 | 30 | |
| 31 | 31 | <?php } ?> |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | * @param array $callback_args Arguments passed to the callback |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | - function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) { |
|
| 100 | + function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) { |
|
| 101 | 101 | |
| 102 | - $this->id = $this->prefix.$id; |
|
| 102 | + $this->id = $this->prefix . $id; |
|
| 103 | 103 | $this->title = $title; |
| 104 | 104 | $this->render_template_file = $file; |
| 105 | 105 | $this->callback = $callback; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | function parse_icon_class_name( $icon_class_name = '' ) { |
| 120 | 120 | |
| 121 | - if( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
| 121 | + if ( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
| 122 | 122 | $icon_class_name = 'dashicons ' . $icon_class_name; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -142,29 +142,29 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function render( $post ) { |
| 144 | 144 | |
| 145 | - if( !empty( $this->render_template_file ) ) { |
|
| 145 | + if ( ! empty( $this->render_template_file ) ) { |
|
| 146 | 146 | |
| 147 | 147 | $file = $this->render_template_file; |
| 148 | 148 | |
| 149 | 149 | // If the full path exists, use it |
| 150 | - if( file_exists( $file ) ) { |
|
| 150 | + if ( file_exists( $file ) ) { |
|
| 151 | 151 | $path = $file; |
| 152 | 152 | } else { |
| 153 | - $path = GRAVITYVIEW_DIR .'includes/admin/metaboxes/views/'.$file; |
|
| 153 | + $path = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/views/' . $file; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if( file_exists( $path ) ) { |
|
| 156 | + if ( file_exists( $path ) ) { |
|
| 157 | 157 | include $path; |
| 158 | 158 | } else { |
| 159 | 159 | gravityview()->log->error( 'Metabox template file not found', array( 'data' => $this ) ); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - } else if( !empty( $this->callback ) ) { |
|
| 162 | + } else if ( ! empty( $this->callback ) ) { |
|
| 163 | 163 | |
| 164 | - if( is_callable( $this->callback ) ) { |
|
| 164 | + if ( is_callable( $this->callback ) ) { |
|
| 165 | 165 | |
| 166 | 166 | /** @see do_accordion_sections() */ |
| 167 | - call_user_func( $this->callback, $post, (array) $this ); |
|
| 167 | + call_user_func( $this->callback, $post, (array)$this ); |
|
| 168 | 168 | |
| 169 | 169 | } else { |
| 170 | 170 | gravityview()->log->error( 'Metabox callback was not callable', array( 'data' => $this ) ); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | static function getInstance() { |
| 43 | 43 | gravityview()->log->notice( '\GravityView_oEmbed is deprecated. Use \GV\oEmbed instead.' ); |
| 44 | 44 | |
| 45 | - if( empty( self::$instance ) ) { |
|
| 45 | + if ( empty( self::$instance ) ) { |
|
| 46 | 46 | self::$instance = new self; |
| 47 | 47 | self::$instance->initialize(); |
| 48 | 48 | } |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | * @param mixed $field_id Field ID or Field array |
| 334 | 334 | * @return string field type |
| 335 | 335 | */ |
| 336 | -function gravityview_get_field_type( $form = null , $field_id = '' ) { |
|
| 337 | - return GVCommon::get_field_type( $form, $field_id ); |
|
| 336 | +function gravityview_get_field_type( $form = null, $field_id = '' ) { |
|
| 337 | + return GVCommon::get_field_type( $form, $field_id ); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | * @return string HTML of the output. Empty string if $view_id is empty. |
| 348 | 348 | */ |
| 349 | 349 | function get_gravityview( $view_id = '', $atts = array() ) { |
| 350 | - if( !empty( $view_id ) ) { |
|
| 351 | - $atts['id'] = $view_id; |
|
| 350 | + if ( ! empty( $view_id ) ) { |
|
| 351 | + $atts[ 'id' ] = $view_id; |
|
| 352 | 352 | $args = wp_parse_args( $atts, \GV\View_Settings::defaults() ); |
| 353 | 353 | $GravityView_frontend = GravityView_frontend::getInstance(); |
| 354 | 354 | $GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) ); |
@@ -391,19 +391,19 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) { |
| 393 | 393 | |
| 394 | - if( class_exists('GFFormsModel') && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 394 | + if ( class_exists( 'GFFormsModel' ) && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 395 | 395 | |
| 396 | 396 | /** @var GF_Field_Radio|GF_Field_Checkbox $form_field */ |
| 397 | - foreach( $form_fields as $form_field ) { |
|
| 397 | + foreach ( $form_fields as $form_field ) { |
|
| 398 | 398 | $field_id = $form_field->id; |
| 399 | - foreach( $view_fields as $zone ) { |
|
| 399 | + foreach ( $view_fields as $zone ) { |
|
| 400 | 400 | |
| 401 | 401 | // ACF compatibility; ACF-added fields aren't arrays |
| 402 | 402 | if ( ! is_array( $zone ) ) { continue; } |
| 403 | 403 | |
| 404 | - foreach( $zone as $field ) { |
|
| 404 | + foreach ( $zone as $field ) { |
|
| 405 | 405 | // If it's an input, not the parent and the parent ID matches a checkbox or radio |
| 406 | - if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) { |
|
| 406 | + if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) { |
|
| 407 | 407 | return true; |
| 408 | 408 | } |
| 409 | 409 | } |