@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | 'slug' => 'edit', |
| 25 | 25 | 'type' => 'internal', |
| 26 | 26 | 'label' => __( 'Edit Table', 'gravityview' ), |
| 27 | - 'description' => __('Display items in a table view.', 'gravityview'), |
|
| 28 | - 'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE), |
|
| 27 | + 'description' => __( 'Display items in a table view.', 'gravityview' ), |
|
| 28 | + 'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ), |
|
| 29 | 29 | 'css_source' => gravityview_css_url( 'table-view.css', GRAVITYVIEW_DIR . 'templates/css/' ), |
| 30 | 30 | ); |
| 31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | '1-1' => array( |
| 43 | 43 | array( |
| 44 | 44 | 'areaid' => 'edit-fields', |
| 45 | - 'title' => __('Visible Edit Fields', 'gravityview' ) |
|
| 45 | + 'title' => __( 'Visible Edit Fields', 'gravityview' ) |
|
| 46 | 46 | ) |
| 47 | 47 | ) |
| 48 | 48 | ) |
@@ -36,7 +36,6 @@ |
||
| 36 | 36 | * @since 1.16.4 |
| 37 | 37 | * @since 1.17 Moved to GravityView_Plugin_Hooks_Gravity_Forms_Survey class |
| 38 | 38 | * |
| 39 | - * @param array $form |
|
| 40 | 39 | * |
| 41 | 40 | * @return array Form, with all fields set to `allowsPrepopulate => true` |
| 42 | 41 | */ |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $return = $input_type; |
| 47 | 47 | |
| 48 | - if( 'survey' === $field_type ) { |
|
| 48 | + if ( 'survey' === $field_type ) { |
|
| 49 | 49 | $return = 'select'; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | public function fix_survey_fields( $fields ) { |
| 66 | 66 | |
| 67 | 67 | /** @var GF_Field $field */ |
| 68 | - foreach( $fields as &$field ) { |
|
| 69 | - if( 'survey' === $field->type ) { |
|
| 68 | + foreach ( $fields as &$field ) { |
|
| 69 | + if ( 'survey' === $field->type ) { |
|
| 70 | 70 | $field->allowsPrepopulate = true; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @return void |
| 83 | 83 | */ |
| 84 | 84 | function add_render_hooks() { |
| 85 | - add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10, 3 ); |
|
| 85 | + add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10, 3 ); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | 97 | function remove_render_hooks() { |
| 98 | - remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10 ); |
|
| 98 | + remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10 ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function fix_survey_field_value( $value, $field, $name ) { |
| 115 | 115 | |
| 116 | - if( 'survey' === $field->type ) { |
|
| 116 | + if ( 'survey' === $field->type ) { |
|
| 117 | 117 | |
| 118 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
| 118 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
| 119 | 119 | |
| 120 | 120 | // We need to run through each survey row until we find a match for expected values |
| 121 | 121 | foreach ( $entry as $field_id => $field_value ) { |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { |
|
| 127 | + if ( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { |
|
| 128 | 128 | list( $row_val, $col_val ) = explode( ':', $field_value, 2 ); |
| 129 | 129 | |
| 130 | 130 | // If the $name matches the $row_val, we are processing the correct row |
| 131 | - if( $row_val === $name ) { |
|
| 131 | + if ( $row_val === $name ) { |
|
| 132 | 132 | $value = $field_value; |
| 133 | 133 | break; |
| 134 | 134 | } |
@@ -7,133 +7,133 @@ |
||
| 7 | 7 | |
| 8 | 8 | class GravityView_GFFormsModel extends GFFormsModel { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * Given information provided in an entry, get array of media IDs |
|
| 12 | - * |
|
| 13 | - * This is necessary because GF doesn't expect to need to update post images, only to create them. |
|
| 14 | - * |
|
| 15 | - * @see GFFormsModel::create_post() |
|
| 16 | - * |
|
| 17 | - * @since 1.17 |
|
| 18 | - * |
|
| 19 | - * @param array $form Gravity Forms form array |
|
| 20 | - * @param array $entry Gravity Forms entry array |
|
| 21 | - * |
|
| 22 | - * @return array Array of "Field ID" => "Media IDs" |
|
| 23 | - */ |
|
| 24 | - public static function get_post_field_images( $form, $entry ) { |
|
| 25 | - |
|
| 26 | - $post_data = self::get_post_fields( $form, $entry ); |
|
| 27 | - |
|
| 28 | - $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 29 | - |
|
| 30 | - $post_images = array(); |
|
| 31 | - |
|
| 32 | - foreach ( $media as $media_item ) { |
|
| 33 | - foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 34 | - if( |
|
| 35 | - rgar( $post_data_item, 'title' ) === $media_item->post_title && |
|
| 36 | - rgar( $post_data_item, 'description' ) === $media_item->post_content && |
|
| 37 | - rgar( $post_data_item, 'caption' ) === $media_item->post_excerpt |
|
| 38 | - ) { |
|
| 39 | - $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - return $post_images; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Alias of GFFormsModel::get_post_fields(); just making it public |
|
| 49 | - * |
|
| 50 | - * @see GFFormsModel::get_post_fields() |
|
| 51 | - * |
|
| 52 | - * @since 1.17 |
|
| 53 | - * |
|
| 54 | - * @param array $form Gravity Forms form array |
|
| 55 | - * @param array $entry Gravity Forms entry array |
|
| 56 | - * |
|
| 57 | - * @return array |
|
| 58 | - */ |
|
| 59 | - public static function get_post_fields( $form, $entry ) { |
|
| 60 | - |
|
| 61 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' ); |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * If the method changes to public, use Gravity Forms' method |
|
| 65 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 66 | - */ |
|
| 67 | - if( $reflection->isPublic() ) { |
|
| 68 | - return parent::get_post_fields( $form, $entry ); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // It was private; let's make it public |
|
| 72 | - $reflection->setAccessible( true ); |
|
| 73 | - |
|
| 74 | - return $reflection->invoke( new GFFormsModel, $form, $entry ); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
|
| 79 | - * |
|
| 80 | - * @since 1.16.2 |
|
| 81 | - * |
|
| 82 | - * @param string $url URL of the post image to update |
|
| 83 | - * @param int $post_id ID of the post image to update |
|
| 84 | - * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
|
| 85 | - */ |
|
| 86 | - public static function copy_post_image( $url, $post_id ) { |
|
| 87 | - |
|
| 88 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' ); |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * If the method changes to public, use Gravity Forms' method |
|
| 92 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 93 | - */ |
|
| 94 | - if( $reflection->isPublic() ) { |
|
| 95 | - return parent::copy_post_image( $url, $post_id ); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - // It was private; let's make it public |
|
| 99 | - $reflection->setAccessible( true ); |
|
| 100 | - |
|
| 101 | - return $reflection->invoke( new GFFormsModel, $url, $post_id ); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
|
| 106 | - * |
|
| 107 | - * Note: The method became public in GF 1.9.17.7 |
|
| 108 | - * |
|
| 109 | - * @see GFFormsModel::media_handle_upload |
|
| 110 | - * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
|
| 111 | - * |
|
| 112 | - * @uses copy_post_image |
|
| 113 | - * @uses wp_insert_attachment |
|
| 114 | - * @uses wp_update_attachment_metadata |
|
| 115 | - * |
|
| 116 | - * @param string $url URL of the post image to update |
|
| 117 | - * @param int $post_id ID of the post image to update |
|
| 118 | - * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys. |
|
| 119 | - * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
|
| 120 | - */ |
|
| 121 | - public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
|
| 122 | - |
|
| 123 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' ); |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * If the method changes to public, use Gravity Forms' method |
|
| 127 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 128 | - */ |
|
| 129 | - if( $reflection->isPublic() ) { |
|
| 130 | - return parent::media_handle_upload( $url, $post_id, $post_data ); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - // It was private; let's make it public |
|
| 134 | - $reflection->setAccessible( true ); |
|
| 135 | - |
|
| 136 | - return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data ); |
|
| 137 | - } |
|
| 10 | + /** |
|
| 11 | + * Given information provided in an entry, get array of media IDs |
|
| 12 | + * |
|
| 13 | + * This is necessary because GF doesn't expect to need to update post images, only to create them. |
|
| 14 | + * |
|
| 15 | + * @see GFFormsModel::create_post() |
|
| 16 | + * |
|
| 17 | + * @since 1.17 |
|
| 18 | + * |
|
| 19 | + * @param array $form Gravity Forms form array |
|
| 20 | + * @param array $entry Gravity Forms entry array |
|
| 21 | + * |
|
| 22 | + * @return array Array of "Field ID" => "Media IDs" |
|
| 23 | + */ |
|
| 24 | + public static function get_post_field_images( $form, $entry ) { |
|
| 25 | + |
|
| 26 | + $post_data = self::get_post_fields( $form, $entry ); |
|
| 27 | + |
|
| 28 | + $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 29 | + |
|
| 30 | + $post_images = array(); |
|
| 31 | + |
|
| 32 | + foreach ( $media as $media_item ) { |
|
| 33 | + foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 34 | + if( |
|
| 35 | + rgar( $post_data_item, 'title' ) === $media_item->post_title && |
|
| 36 | + rgar( $post_data_item, 'description' ) === $media_item->post_content && |
|
| 37 | + rgar( $post_data_item, 'caption' ) === $media_item->post_excerpt |
|
| 38 | + ) { |
|
| 39 | + $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + return $post_images; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Alias of GFFormsModel::get_post_fields(); just making it public |
|
| 49 | + * |
|
| 50 | + * @see GFFormsModel::get_post_fields() |
|
| 51 | + * |
|
| 52 | + * @since 1.17 |
|
| 53 | + * |
|
| 54 | + * @param array $form Gravity Forms form array |
|
| 55 | + * @param array $entry Gravity Forms entry array |
|
| 56 | + * |
|
| 57 | + * @return array |
|
| 58 | + */ |
|
| 59 | + public static function get_post_fields( $form, $entry ) { |
|
| 60 | + |
|
| 61 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' ); |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * If the method changes to public, use Gravity Forms' method |
|
| 65 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 66 | + */ |
|
| 67 | + if( $reflection->isPublic() ) { |
|
| 68 | + return parent::get_post_fields( $form, $entry ); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + // It was private; let's make it public |
|
| 72 | + $reflection->setAccessible( true ); |
|
| 73 | + |
|
| 74 | + return $reflection->invoke( new GFFormsModel, $form, $entry ); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
|
| 79 | + * |
|
| 80 | + * @since 1.16.2 |
|
| 81 | + * |
|
| 82 | + * @param string $url URL of the post image to update |
|
| 83 | + * @param int $post_id ID of the post image to update |
|
| 84 | + * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
|
| 85 | + */ |
|
| 86 | + public static function copy_post_image( $url, $post_id ) { |
|
| 87 | + |
|
| 88 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' ); |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * If the method changes to public, use Gravity Forms' method |
|
| 92 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 93 | + */ |
|
| 94 | + if( $reflection->isPublic() ) { |
|
| 95 | + return parent::copy_post_image( $url, $post_id ); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + // It was private; let's make it public |
|
| 99 | + $reflection->setAccessible( true ); |
|
| 100 | + |
|
| 101 | + return $reflection->invoke( new GFFormsModel, $url, $post_id ); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
|
| 106 | + * |
|
| 107 | + * Note: The method became public in GF 1.9.17.7 |
|
| 108 | + * |
|
| 109 | + * @see GFFormsModel::media_handle_upload |
|
| 110 | + * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
|
| 111 | + * |
|
| 112 | + * @uses copy_post_image |
|
| 113 | + * @uses wp_insert_attachment |
|
| 114 | + * @uses wp_update_attachment_metadata |
|
| 115 | + * |
|
| 116 | + * @param string $url URL of the post image to update |
|
| 117 | + * @param int $post_id ID of the post image to update |
|
| 118 | + * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys. |
|
| 119 | + * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
|
| 120 | + */ |
|
| 121 | + public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
|
| 122 | + |
|
| 123 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' ); |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * If the method changes to public, use Gravity Forms' method |
|
| 127 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 128 | + */ |
|
| 129 | + if( $reflection->isPublic() ) { |
|
| 130 | + return parent::media_handle_upload( $url, $post_id, $post_data ); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + // It was private; let's make it public |
|
| 134 | + $reflection->setAccessible( true ); |
|
| 135 | + |
|
| 136 | + return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data ); |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | \ No newline at end of file |
@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $post_data = self::get_post_fields( $form, $entry ); |
| 27 | 27 | |
| 28 | - $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 28 | + $media = get_attached_media( 'image', $entry[ 'post_id' ] ); |
|
| 29 | 29 | |
| 30 | 30 | $post_images = array(); |
| 31 | 31 | |
| 32 | 32 | foreach ( $media as $media_item ) { |
| 33 | - foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 34 | - if( |
|
| 33 | + foreach ( (array)$post_data[ 'images' ] as $post_data_item ) { |
|
| 34 | + if ( |
|
| 35 | 35 | rgar( $post_data_item, 'title' ) === $media_item->post_title && |
| 36 | 36 | rgar( $post_data_item, 'description' ) === $media_item->post_content && |
| 37 | 37 | rgar( $post_data_item, 'caption' ) === $media_item->post_excerpt |
| 38 | 38 | ) { |
| 39 | - $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 39 | + $post_images[ "{$post_data_item[ 'field_id' ]}" ] = $media_item->ID; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * If the method changes to public, use Gravity Forms' method |
| 65 | 65 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 66 | 66 | */ |
| 67 | - if( $reflection->isPublic() ) { |
|
| 67 | + if ( $reflection->isPublic() ) { |
|
| 68 | 68 | return parent::get_post_fields( $form, $entry ); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * If the method changes to public, use Gravity Forms' method |
| 92 | 92 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 93 | 93 | */ |
| 94 | - if( $reflection->isPublic() ) { |
|
| 94 | + if ( $reflection->isPublic() ) { |
|
| 95 | 95 | return parent::copy_post_image( $url, $post_id ); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * If the method changes to public, use Gravity Forms' method |
| 127 | 127 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 128 | 128 | */ |
| 129 | - if( $reflection->isPublic() ) { |
|
| 129 | + if ( $reflection->isPublic() ) { |
|
| 130 | 130 | return parent::media_handle_upload( $url, $post_id, $post_data ); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | function edit_entry_fix_hidden_fields( $fields ) { |
| 48 | 48 | |
| 49 | 49 | /** @var GF_Field $field */ |
| 50 | - foreach( $fields as &$field ) { |
|
| 50 | + foreach ( $fields as &$field ) { |
|
| 51 | 51 | if ( 'hidden' === $field->type ) { |
| 52 | 52 | |
| 53 | 53 | // Replace GF_Field_Hidden with GF_Field_Text, copying all the data from $field |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @return void |
| 31 | 31 | */ |
| 32 | 32 | private function add_hooks() { |
| 33 | - add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value'), 10, 2 ); |
|
| 33 | + add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value' ), 10, 2 ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function edit_entry_field_value( $field_value, $field ) { |
| 47 | 47 | |
| 48 | - if( 'list' === $field->inputType ) { |
|
| 48 | + if ( 'list' === $field->inputType ) { |
|
| 49 | 49 | $field_value = is_string( $field_value ) ? json_decode( $field_value, true ) : $field_value; |
| 50 | 50 | |
| 51 | 51 | if ( ! is_array( $field_value ) ) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | function parse_um_profile_post_content( $args = array() ) { |
| 44 | 44 | global $ultimatemember; |
| 45 | 45 | |
| 46 | - if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
| 46 | + if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content ); |
|
| 62 | + GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content ); |
|
| 63 | 63 | |
| 64 | 64 | wp_reset_postdata(); |
| 65 | 65 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * Prevent Divi from adding their stuff to GV pages |
| 35 | 35 | */ |
| 36 | 36 | public function add_hooks_admin_init() { |
| 37 | - if( GravityView_Admin::is_admin_page() ) { |
|
| 37 | + if ( GravityView_Admin::is_admin_page() ) { |
|
| 38 | 38 | // Prevent Divi from adding import/export modal dialog |
| 39 | 39 | remove_action( 'admin_init', 'et_pb_register_builder_portabilities' ); |
| 40 | 40 | |
@@ -10,8 +10,8 @@ discard block |
||
| 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'] ) ) { |
|
| 14 | - do_action('gravityview_log_debug', 'search-field-select.php - No choices for field' ); |
|
| 13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 14 | + do_action( 'gravityview_log_debug', 'search-field-select.php - No choices for field' ); |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -21,19 +21,19 @@ discard block |
||
| 21 | 21 | * @param string $default_option Default: `—` (—) |
| 22 | 22 | * @param string $field_type Field type: "select" or "multiselect" |
| 23 | 23 | */ |
| 24 | -$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'select' ); |
|
| 24 | +$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'select' ); |
|
| 25 | 25 | |
| 26 | 26 | ?> |
| 27 | 27 | <div class="gv-search-box gv-search-field-select"> |
| 28 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 29 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 28 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 29 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 30 | 30 | <?php } ?> |
| 31 | 31 | <p> |
| 32 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"> |
|
| 33 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
| 32 | + <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"> |
|
| 33 | + <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
| 34 | 34 | <?php |
| 35 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
| 36 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $search_field['value'] ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
| 35 | + foreach ( $search_field[ 'choices' ] as $choice ) : ?> |
|
| 36 | + <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $search_field[ 'value' ] ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
| 37 | 37 | <?php endforeach; ?> |
| 38 | 38 | </select> |
| 39 | 39 | </p> |
@@ -12,10 +12,10 @@ |
||
| 12 | 12 | |
| 13 | 13 | $field_info_items = array(); |
| 14 | 14 | |
| 15 | - if( !empty( $this->item['description'] ) ) { |
|
| 15 | + if ( ! empty( $this->item[ 'description' ] ) ) { |
|
| 16 | 16 | |
| 17 | - $field_info_items[] = array( |
|
| 18 | - 'value' => $this->item['description'] |
|
| 17 | + $field_info_items[ ] = array( |
|
| 18 | + 'value' => $this->item[ 'description' ] |
|
| 19 | 19 | ); |
| 20 | 20 | |
| 21 | 21 | } |