@@ -163,14 +163,14 @@ |
||
| 163 | 163 | return $settings; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - /** |
|
| 166 | + /** |
|
| 167 | 167 | * Get the Widget ID. |
| 168 | 168 | * |
| 169 | - * @return string The Widget ID. |
|
| 170 | - */ |
|
| 171 | - public function get_widget_id() { |
|
| 172 | - return $this->widget_id; |
|
| 173 | - } |
|
| 169 | + * @return string The Widget ID. |
|
| 170 | + */ |
|
| 171 | + public function get_widget_id() { |
|
| 172 | + return $this->widget_id; |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Get the widget settings |
@@ -161,20 +161,20 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | if( !empty( $field['custom_class'] ) ) { |
| 163 | 163 | |
| 164 | - $custom_class = $field['custom_class']; |
|
| 164 | + $custom_class = $field['custom_class']; |
|
| 165 | 165 | |
| 166 | - if( !empty( $entry ) ) { |
|
| 166 | + if( !empty( $entry ) ) { |
|
| 167 | 167 | |
| 168 | - // We want the merge tag to be formatted as a class. The merge tag may be |
|
| 169 | - // replaced by a multiple-word value that should be output as a single class. |
|
| 170 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
| 171 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 168 | + // We want the merge tag to be formatted as a class. The merge tag may be |
|
| 169 | + // replaced by a multiple-word value that should be output as a single class. |
|
| 170 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
| 171 | + add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 172 | 172 | |
| 173 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 173 | + $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 174 | 174 | |
| 175 | - // And then we want life to return to normal |
|
| 176 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 177 | - } |
|
| 175 | + // And then we want life to return to normal |
|
| 176 | + remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | 179 | // And now we want the spaces to be handled nicely. |
| 180 | 180 | $classes[] = gravityview_sanitize_html_class( $custom_class ); |
@@ -531,32 +531,32 @@ discard block |
||
| 531 | 531 | return sanitize_title( $slug ); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - /** |
|
| 535 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
| 536 | - * |
|
| 537 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 538 | - * |
|
| 539 | - * @param $entry array Gravity Forms entry object |
|
| 540 | - * @param $form array Gravity Forms form object |
|
| 541 | - */ |
|
| 542 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
| 543 | - /** |
|
| 544 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
| 545 | - * @param boolean $custom Should we process the custom entry slug? |
|
| 546 | - */ |
|
| 547 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
| 548 | - if( $custom ) { |
|
| 549 | - // create the gravityview_unique_id and save it |
|
| 534 | + /** |
|
| 535 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
| 536 | + * |
|
| 537 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 538 | + * |
|
| 539 | + * @param $entry array Gravity Forms entry object |
|
| 540 | + * @param $form array Gravity Forms form object |
|
| 541 | + */ |
|
| 542 | + public static function entry_create_custom_slug( $entry, $form ) { |
|
| 543 | + /** |
|
| 544 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
| 545 | + * @param boolean $custom Should we process the custom entry slug? |
|
| 546 | + */ |
|
| 547 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
| 548 | + if( $custom ) { |
|
| 549 | + // create the gravityview_unique_id and save it |
|
| 550 | 550 | |
| 551 | - // Get the entry hash |
|
| 552 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 551 | + // Get the entry hash |
|
| 552 | + $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 553 | 553 | |
| 554 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
| 554 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
| 555 | 555 | |
| 556 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 556 | + gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 557 | 557 | |
| 558 | - } |
|
| 559 | - } |
|
| 558 | + } |
|
| 559 | + } |
|
| 560 | 560 | |
| 561 | 561 | |
| 562 | 562 | |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | |
| 900 | 900 | // If there was an error, continue to the next term. |
| 901 | 901 | if ( is_wp_error( $term_link ) ) { |
| 902 | - continue; |
|
| 902 | + continue; |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
@@ -48,132 +48,132 @@ |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * Given information provided in an entry, get array of media IDs |
|
| 52 | - * |
|
| 53 | - * This is necessary because GF doesn't expect to need to update post images, only to create them. |
|
| 54 | - * |
|
| 55 | - * @see GFFormsModel::create_post() |
|
| 56 | - * |
|
| 57 | - * @since 1.17 |
|
| 58 | - * |
|
| 59 | - * @param array $form Gravity Forms form array |
|
| 60 | - * @param array $entry Gravity Forms entry array |
|
| 61 | - * |
|
| 62 | - * @return array Array of "Field ID" => "Media IDs" |
|
| 63 | - */ |
|
| 64 | - public static function get_post_field_images( $form, $entry ) { |
|
| 65 | - |
|
| 66 | - $post_data = self::get_post_fields( $form, $entry ); |
|
| 67 | - |
|
| 68 | - $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 69 | - |
|
| 70 | - $post_images = array(); |
|
| 71 | - |
|
| 72 | - foreach ( $media as $media_item ) { |
|
| 73 | - foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 74 | - if( |
|
| 75 | - \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title && |
|
| 76 | - \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content && |
|
| 77 | - \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt |
|
| 78 | - ) { |
|
| 79 | - $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 80 | - } |
|
| 81 | - } |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - return $post_images; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Alias of GFFormsModel::get_post_fields(); just making it public |
|
| 89 | - * |
|
| 90 | - * @see GFFormsModel::get_post_fields() |
|
| 91 | - * |
|
| 92 | - * @since 1.17 |
|
| 93 | - * |
|
| 94 | - * @param array $form Gravity Forms form array |
|
| 95 | - * @param array $entry Gravity Forms entry array |
|
| 96 | - * |
|
| 97 | - * @return array |
|
| 98 | - */ |
|
| 99 | - public static function get_post_fields( $form, $entry ) { |
|
| 100 | - |
|
| 101 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' ); |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * If the method changes to public, use Gravity Forms' method |
|
| 105 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 106 | - */ |
|
| 107 | - if( $reflection->isPublic() ) { |
|
| 108 | - return parent::get_post_fields( $form, $entry ); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - // It was private; let's make it public |
|
| 112 | - $reflection->setAccessible( true ); |
|
| 113 | - |
|
| 114 | - return $reflection->invoke( new GFFormsModel, $form, $entry ); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
|
| 119 | - * |
|
| 120 | - * @since 1.16.2 |
|
| 121 | - * |
|
| 122 | - * @param string $url URL of the post image to update |
|
| 123 | - * @param int $post_id ID of the post image to update |
|
| 124 | - * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
|
| 125 | - */ |
|
| 126 | - public static function copy_post_image( $url, $post_id ) { |
|
| 127 | - |
|
| 128 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' ); |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * If the method changes to public, use Gravity Forms' method |
|
| 132 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 133 | - */ |
|
| 134 | - if( $reflection->isPublic() ) { |
|
| 135 | - return parent::copy_post_image( $url, $post_id ); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - // It was private; let's make it public |
|
| 139 | - $reflection->setAccessible( true ); |
|
| 140 | - |
|
| 141 | - return $reflection->invoke( new GFFormsModel, $url, $post_id ); |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
|
| 146 | - * |
|
| 147 | - * Note: The method became public in GF 1.9.17.7 |
|
| 148 | - * |
|
| 149 | - * @see GFFormsModel::media_handle_upload |
|
| 150 | - * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
|
| 151 | - * |
|
| 152 | - * @uses copy_post_image |
|
| 153 | - * @uses wp_insert_attachment |
|
| 154 | - * @uses wp_update_attachment_metadata |
|
| 155 | - * |
|
| 156 | - * @param string $url URL of the post image to update |
|
| 157 | - * @param int $post_id ID of the post image to update |
|
| 158 | - * @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. |
|
| 159 | - * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
|
| 160 | - */ |
|
| 161 | - public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
|
| 162 | - |
|
| 163 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' ); |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * If the method changes to public, use Gravity Forms' method |
|
| 167 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 168 | - */ |
|
| 169 | - if( $reflection->isPublic() ) { |
|
| 170 | - return parent::media_handle_upload( $url, $post_id, $post_data ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - // It was private; let's make it public |
|
| 174 | - $reflection->setAccessible( true ); |
|
| 175 | - |
|
| 176 | - return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data ); |
|
| 177 | - } |
|
| 51 | + * Given information provided in an entry, get array of media IDs |
|
| 52 | + * |
|
| 53 | + * This is necessary because GF doesn't expect to need to update post images, only to create them. |
|
| 54 | + * |
|
| 55 | + * @see GFFormsModel::create_post() |
|
| 56 | + * |
|
| 57 | + * @since 1.17 |
|
| 58 | + * |
|
| 59 | + * @param array $form Gravity Forms form array |
|
| 60 | + * @param array $entry Gravity Forms entry array |
|
| 61 | + * |
|
| 62 | + * @return array Array of "Field ID" => "Media IDs" |
|
| 63 | + */ |
|
| 64 | + public static function get_post_field_images( $form, $entry ) { |
|
| 65 | + |
|
| 66 | + $post_data = self::get_post_fields( $form, $entry ); |
|
| 67 | + |
|
| 68 | + $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 69 | + |
|
| 70 | + $post_images = array(); |
|
| 71 | + |
|
| 72 | + foreach ( $media as $media_item ) { |
|
| 73 | + foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 74 | + if( |
|
| 75 | + \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title && |
|
| 76 | + \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content && |
|
| 77 | + \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt |
|
| 78 | + ) { |
|
| 79 | + $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + return $post_images; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Alias of GFFormsModel::get_post_fields(); just making it public |
|
| 89 | + * |
|
| 90 | + * @see GFFormsModel::get_post_fields() |
|
| 91 | + * |
|
| 92 | + * @since 1.17 |
|
| 93 | + * |
|
| 94 | + * @param array $form Gravity Forms form array |
|
| 95 | + * @param array $entry Gravity Forms entry array |
|
| 96 | + * |
|
| 97 | + * @return array |
|
| 98 | + */ |
|
| 99 | + public static function get_post_fields( $form, $entry ) { |
|
| 100 | + |
|
| 101 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' ); |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * If the method changes to public, use Gravity Forms' method |
|
| 105 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 106 | + */ |
|
| 107 | + if( $reflection->isPublic() ) { |
|
| 108 | + return parent::get_post_fields( $form, $entry ); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + // It was private; let's make it public |
|
| 112 | + $reflection->setAccessible( true ); |
|
| 113 | + |
|
| 114 | + return $reflection->invoke( new GFFormsModel, $form, $entry ); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
|
| 119 | + * |
|
| 120 | + * @since 1.16.2 |
|
| 121 | + * |
|
| 122 | + * @param string $url URL of the post image to update |
|
| 123 | + * @param int $post_id ID of the post image to update |
|
| 124 | + * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
|
| 125 | + */ |
|
| 126 | + public static function copy_post_image( $url, $post_id ) { |
|
| 127 | + |
|
| 128 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' ); |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * If the method changes to public, use Gravity Forms' method |
|
| 132 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 133 | + */ |
|
| 134 | + if( $reflection->isPublic() ) { |
|
| 135 | + return parent::copy_post_image( $url, $post_id ); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + // It was private; let's make it public |
|
| 139 | + $reflection->setAccessible( true ); |
|
| 140 | + |
|
| 141 | + return $reflection->invoke( new GFFormsModel, $url, $post_id ); |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
|
| 146 | + * |
|
| 147 | + * Note: The method became public in GF 1.9.17.7 |
|
| 148 | + * |
|
| 149 | + * @see GFFormsModel::media_handle_upload |
|
| 150 | + * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
|
| 151 | + * |
|
| 152 | + * @uses copy_post_image |
|
| 153 | + * @uses wp_insert_attachment |
|
| 154 | + * @uses wp_update_attachment_metadata |
|
| 155 | + * |
|
| 156 | + * @param string $url URL of the post image to update |
|
| 157 | + * @param int $post_id ID of the post image to update |
|
| 158 | + * @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. |
|
| 159 | + * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
|
| 160 | + */ |
|
| 161 | + public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
|
| 162 | + |
|
| 163 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' ); |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * If the method changes to public, use Gravity Forms' method |
|
| 167 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 168 | + */ |
|
| 169 | + if( $reflection->isPublic() ) { |
|
| 170 | + return parent::media_handle_upload( $url, $post_id, $post_data ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + // It was private; let's make it public |
|
| 174 | + $reflection->setAccessible( true ); |
|
| 175 | + |
|
| 176 | + return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data ); |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | 179 | } |
| 180 | 180 | \ No newline at end of file |
@@ -41,22 +41,22 @@ |
||
| 41 | 41 | |
| 42 | 42 | <?php |
| 43 | 43 | |
| 44 | - $search_value = \GV\Utils::_GET( $search_field['name'] ); |
|
| 44 | + $search_value = \GV\Utils::_GET( $search_field['name'] ); |
|
| 45 | 45 | |
| 46 | - foreach ( $search_field['choices'] as $k => $choice ) { |
|
| 46 | + foreach ( $search_field['choices'] as $k => $choice ) { |
|
| 47 | 47 | |
| 48 | - if ( 0 != $k ) { |
|
| 49 | - echo esc_html( $links_sep ); |
|
| 50 | - } |
|
| 48 | + if ( 0 != $k ) { |
|
| 49 | + echo esc_html( $links_sep ); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
| 52 | + $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
| 53 | 53 | |
| 54 | - if ( $active ) { |
|
| 55 | - $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
| 56 | - } else { |
|
| 57 | - $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
| 58 | - } |
|
| 59 | - ?> |
|
| 54 | + if ( $active ) { |
|
| 55 | + $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
| 56 | + } else { |
|
| 57 | + $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
| 58 | + } |
|
| 59 | + ?> |
|
| 60 | 60 | |
| 61 | 61 | <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a> |
| 62 | 62 | |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | // matching regex => the value is the method to call to replace the value. |
| 53 | 53 | $gv_modifiers = array( |
| 54 | 54 | 'maxwords:(\d+)' => 'modifier_maxwords', /** @see modifier_maxwords */ |
| 55 | - 'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */ |
|
| 55 | + 'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */ |
|
| 56 | 56 | 'explode' => 'modifier_explode', /** @see modifier_explode */ |
| 57 | 57 | |
| 58 | 58 | /** @see modifier_strings */ |
| 59 | 59 | 'urlencode' => 'modifier_strings', |
| 60 | 60 | 'wpautop' => 'modifier_strings', |
| 61 | - 'esc_html' => 'modifier_strings', |
|
| 62 | - 'sanitize_html_class' => 'modifier_strings', |
|
| 61 | + 'esc_html' => 'modifier_strings', |
|
| 62 | + 'sanitize_html_class' => 'modifier_strings', |
|
| 63 | 63 | 'sanitize_title' => 'modifier_strings', |
| 64 | 64 | 'strtolower' => 'modifier_strings', |
| 65 | 65 | 'strtoupper' => 'modifier_strings', |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | $atts = array( |
| 459 | 459 | 'format' => self::get_format_from_modifiers( $exploded, false ), |
| 460 | - 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
| 460 | + 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
| 461 | 461 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
| 462 | 462 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
| 463 | 463 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | private function add_hooks() { |
| 38 | - /** @see \GV\Field::get_value_filters */ |
|
| 38 | + /** @see \GV\Field::get_value_filters */ |
|
| 39 | 39 | add_filter( "gravityview/field/{$this->name}/output", array( $this, 'get_content' ), 4, 2 ); |
| 40 | 40 | add_action( 'gravityview/template/after', array( $this, 'print_script'), 10, 1 ); |
| 41 | 41 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function get_content( $output, $template ) { |
| 77 | 77 | $entry = $template->entry; |
| 78 | 78 | |
| 79 | - $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png'; |
|
| 79 | + $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png'; |
|
| 80 | 80 | |
| 81 | 81 | $entry_id = ''; |
| 82 | 82 | |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * Add JS to the bottom of the View if there is a star field and user has `gravityview_edit_entries` cap |
| 97 | - * |
|
| 97 | + * |
|
| 98 | 98 | * @param \GV\Template_Context $context The template context |
| 99 | - * @since 2.0 |
|
| 100 | - * |
|
| 101 | - * @return void |
|
| 99 | + * @since 2.0 |
|
| 100 | + * |
|
| 101 | + * @return void |
|
| 102 | 102 | */ |
| 103 | 103 | public function print_script( $context ) { |
| 104 | 104 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | if ( ! GravityView_Roles_Capabilities::has_cap( 'gravityview_edit_entries' ) ) { |
| 110 | - return; |
|
| 110 | + return; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | ?> |
@@ -328,34 +328,34 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
| 331 | - * Get the fields for a specific context |
|
| 332 | - * |
|
| 333 | - * @since 1.19.2 |
|
| 334 | - * |
|
| 331 | + * Get the fields for a specific context |
|
| 332 | + * |
|
| 333 | + * @since 1.19.2 |
|
| 334 | + * |
|
| 335 | 335 | * @param string $context [Optional] "directory", "single", or "edit" |
| 336 | 336 | * |
| 337 | 337 | * @return array Array of GravityView field layout configurations |
| 338 | 338 | */ |
| 339 | 339 | public function getContextFields( $context = '' ) { |
| 340 | 340 | |
| 341 | - if( '' === $context ) { |
|
| 342 | - $context = $this->getContext(); |
|
| 343 | - } |
|
| 341 | + if( '' === $context ) { |
|
| 342 | + $context = $this->getContext(); |
|
| 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 | - // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 350 | - $matches = explode( '_', $key ); |
|
| 349 | + // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 350 | + $matches = explode( '_', $key ); |
|
| 351 | 351 | |
| 352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 353 | - return $context_fields; |
|
| 354 | - } |
|
| 355 | - } |
|
| 352 | + if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 353 | + return $context_fields; |
|
| 354 | + } |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | 357 | return array(); |
| 358 | - } |
|
| 358 | + } |
|
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | 361 | * @param array $fields |
@@ -448,10 +448,10 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | public function getPaging() { |
| 450 | 450 | |
| 451 | - $default_params = array( |
|
| 452 | - 'offset' => 0, |
|
| 453 | - 'page_size' => 20, |
|
| 454 | - ); |
|
| 451 | + $default_params = array( |
|
| 452 | + 'offset' => 0, |
|
| 453 | + 'page_size' => 20, |
|
| 454 | + ); |
|
| 455 | 455 | |
| 456 | 456 | return wp_parse_args( $this->paging, $default_params ); |
| 457 | 457 | } |
@@ -508,10 +508,10 @@ discard block |
||
| 508 | 508 | public function getSorting() { |
| 509 | 509 | |
| 510 | 510 | $defaults_params = array( |
| 511 | - 'sort_field' => 'date_created', |
|
| 512 | - 'sort_direction' => 'ASC', |
|
| 513 | - 'is_numeric' => false, |
|
| 514 | - ); |
|
| 511 | + 'sort_field' => 'date_created', |
|
| 512 | + 'sort_direction' => 'ASC', |
|
| 513 | + 'is_numeric' => false, |
|
| 514 | + ); |
|
| 515 | 515 | |
| 516 | 516 | return wp_parse_args( $this->sorting, $defaults_params ); |
| 517 | 517 | } |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | */ |
| 838 | 838 | public function render_widget_hooks( $view_id_or_context ) { |
| 839 | 839 | |
| 840 | - /** |
|
| 840 | + /** |
|
| 841 | 841 | * @deprecated Numeric argument is deprecated. Pass a \GV\Template_Context instead. |
| 842 | 842 | */ |
| 843 | 843 | if ( is_numeric( $view_id_or_context ) ) { |
@@ -151,11 +151,11 @@ discard block |
||
| 151 | 151 | do_action( 'gravityview/template/list/body/before', $context ); |
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | - * @action `gravityview_list_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
| 155 | - * @deprecated Use `gravityview/template/list/body/before` |
|
| 156 | - * @since 1.0.7 |
|
| 157 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 158 | - */ |
|
| 154 | + * @action `gravityview_list_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
| 155 | + * @deprecated Use `gravityview/template/list/body/before` |
|
| 156 | + * @since 1.0.7 |
|
| 157 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 158 | + */ |
|
| 159 | 159 | do_action( 'gravityview_list_body_before', \GravityView_View::getInstance() /** ugh! */ ); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | do_action( 'gravityview/template/list/body/after', $context ); |
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | - * @action `gravityview_list_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
| 181 | - * @deprecated Use `gravityview/template/list/body/after` |
|
| 182 | - * @since 1.0.7 |
|
| 183 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 184 | - */ |
|
| 180 | + * @action `gravityview_list_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
| 181 | + * @deprecated Use `gravityview/template/list/body/after` |
|
| 182 | + * @since 1.0.7 |
|
| 183 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 184 | + */ |
|
| 185 | 185 | do_action( 'gravityview_list_body_after', \GravityView_View::getInstance() /** ugh! */ ); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | $zone = str_replace( '/', '_', $zone ); |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | - * @action `gravityview_list_entry_$zone_before` Inside the `entry`, before any rows are rendered. Can be used to insert additional rows. |
|
| 216 | - * @deprecated Use `gravityview/template/list/entry/$zone/before` |
|
| 217 | - * @since 1.0.7 |
|
| 218 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 219 | - */ |
|
| 215 | + * @action `gravityview_list_entry_$zone_before` Inside the `entry`, before any rows are rendered. Can be used to insert additional rows. |
|
| 216 | + * @deprecated Use `gravityview/template/list/entry/$zone/before` |
|
| 217 | + * @since 1.0.7 |
|
| 218 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 219 | + */ |
|
| 220 | 220 | do_action( sprintf( 'gravityview_list_entry%sbefore', $zone ), $entry->as_entry(), \GravityView_View::getInstance() /** ugh! */ ); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | $zone = str_replace( '/', '_', $zone ); |
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | - * @action `gravityview_list_entry_$zone_after` Inside the `entry`, after any rows are rendered. Can be used to insert additional rows. |
|
| 251 | - * @deprecated Use `gravityview/template/list/entry/after` |
|
| 252 | - * @since 1.0.7 |
|
| 253 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 254 | - */ |
|
| 250 | + * @action `gravityview_list_entry_$zone_after` Inside the `entry`, after any rows are rendered. Can be used to insert additional rows. |
|
| 251 | + * @deprecated Use `gravityview/template/list/entry/after` |
|
| 252 | + * @since 1.0.7 |
|
| 253 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 254 | + */ |
|
| 255 | 255 | do_action( sprintf( 'gravityview_list_entry%safter', $zone ), $entry->as_entry(), \GravityView_View::getInstance() /** ugh! */ ); |
| 256 | 256 | } |
| 257 | 257 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if( is_array( $search_field['value'] ) ) { |
| 19 | - gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
|
| 19 | + gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
|
| 20 | 20 | $search_field['value'] = reset( $search_field['value'] ); |
| 21 | 21 | } |
| 22 | 22 | |