@@ -141,7 +141,7 @@ |
||
| 141 | 141 | global $wpdb; |
| 142 | 142 | |
| 143 | 143 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) |
| 144 | - && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
| 144 | + && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
| 145 | 145 | $notes_table = GFFormsModel::get_entry_notes_table_name(); |
| 146 | 146 | } else { |
| 147 | 147 | $notes_table = GFFormsModel::get_lead_notes_table_name(); |
@@ -62,7 +62,6 @@ |
||
| 62 | 62 | * |
| 63 | 63 | * Internal static cache for gets, and whatnot. |
| 64 | 64 | * This is not persistent, resets across requests. |
| 65 | - |
|
| 66 | 65 | * @internal |
| 67 | 66 | */ |
| 68 | 67 | private static $cache = array(); |
@@ -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 |
@@ -237,26 +237,26 @@ |
||
| 237 | 237 | |
| 238 | 238 | /** DEBUG */ |
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * Logs messages using Gravity Forms logging add-on |
|
| 242 | - * @param string $message log message |
|
| 243 | - * @param mixed $data Additional data to display |
|
| 240 | + /** |
|
| 241 | + * Logs messages using Gravity Forms logging add-on |
|
| 242 | + * @param string $message log message |
|
| 243 | + * @param mixed $data Additional data to display |
|
| 244 | 244 | * @deprecated use gravityview()->log |
| 245 | - * @return void |
|
| 246 | - */ |
|
| 247 | - public static function log_debug( $message, $data = null ){ |
|
| 245 | + * @return void |
|
| 246 | + */ |
|
| 247 | + public static function log_debug( $message, $data = null ){ |
|
| 248 | 248 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
| 249 | 249 | gravityview()->log->debug( $message, $data ); |
| 250 | - } |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Logs messages using Gravity Forms logging add-on |
|
| 254 | - * @param string $message log message |
|
| 252 | + /** |
|
| 253 | + * Logs messages using Gravity Forms logging add-on |
|
| 254 | + * @param string $message log message |
|
| 255 | 255 | * @deprecated use gravityview()->log |
| 256 | - * @return void |
|
| 257 | - */ |
|
| 258 | - public static function log_error( $message, $data = null ){ |
|
| 256 | + * @return void |
|
| 257 | + */ |
|
| 258 | + public static function log_error( $message, $data = null ){ |
|
| 259 | 259 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
| 260 | 260 | gravityview()->log->error( $message, $data ); |
| 261 | - } |
|
| 261 | + } |
|
| 262 | 262 | } // end class GravityView_Plugin |
@@ -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 | |
@@ -28,11 +28,11 @@ |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
| 33 | - } |
|
| 34 | - $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
|
| 35 | - $placeholder = \GV\Utils::get( $this->field, 'placeholder' ); |
|
| 31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
| 33 | + } |
|
| 34 | + $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
|
| 35 | + $placeholder = \GV\Utils::get( $this->field, 'placeholder' ); |
|
| 36 | 36 | ?> |
| 37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
| 38 | 38 | <?php |
@@ -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} |