Completed
Push — master ( 2cfa6f...8927a4 )
by Zack
10:00 queued 06:05
created

GravityView_Recent_Entries_Widget::widget()   B

Complexity

Conditions 5
Paths 9

Size

Total Lines 37
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 13
nc 9
nop 2
dl 0
loc 37
rs 8.439
c 0
b 0
f 0
1
<?php
2
/**
3
 * @file class-gravityview-recent-entries-widget.php
4
 */
5
6
/**
7
 * Class GravityView_Recent_Entries_Widget
8
 * @since 1.6
9
 */
10
class GravityView_Recent_Entries_Widget extends WP_Widget {
11
12
13
	function __construct( ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
14
15
		$name = __('GravityView Recent Entries', 'gravityview');
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
16
17
		$widget_options = array(
18
			'description' => __( 'Display the most recent entries for a View', 'gravityview' ),
19
		);
20
21
		parent::__construct( 'gv_recent_entries', $name, $widget_options );
22
23
		$this->initialize();
24
	}
25
26
	private function initialize() {
27
28
		add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') );
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
29
30
		add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) );
31
32
	}
33
34
	/**
35
	 * When the widget View is changed, update the Merge Tag data
36
	 *
37
	 * @since 1.6
38
	 */
39
	function ajax_get_view_merge_tag_data() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
40
41
		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) {
0 ignored issues
show
introduced by
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_POST
Loading history...
42
			exit( false );
0 ignored issues
show
Coding Style Compatibility introduced by
The method ajax_get_view_merge_tag_data() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
43
		}
44
45
		$form_id  = gravityview_get_form_id( $_POST['view_id'] );
0 ignored issues
show
introduced by
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-validated input variable: $_POST
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_POST
Loading history...
46
47
		$form = RGFormsModel::get_form_meta( $form_id );
48
49
		$output = array(
50
			'form' => array(
51
				'id' => $form['id'],
52
				'title' => $form['title'],
53
				'fields' => $form['fields'],
54
			),
55
			'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ),
56
		);
57
58
		echo json_encode( $output );
59
60
		exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method ajax_get_view_merge_tag_data() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
61
	}
62
63
	/**
64
	 * Enable the merge tags functionality
65
	 *
66
	 * @since 1.6
67
	 */
68
	function admin_enqueue_scripts() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
69
		global $pagenow;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
70
71
		if( $pagenow === 'widgets.php' ) {
0 ignored issues
show
introduced by
Found "=== '". Use Yoda Condition checks, you must
Loading history...
72
73
			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
74
75
			GravityView_Admin_Views::enqueue_gravity_forms_scripts();
76
77
			wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
78
79
			wp_localize_script( 'gravityview_widgets', 'GVWidgets', array(
80
				'nonce' => wp_create_nonce( 'gravityview_ajax_widget' )
81
			));
82
83
			wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version );
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
introduced by
No space after opening parenthesis of array is bad style
Loading history...
84
		}
85
86
	}
87
88
	/**
89
	 * @since 1.6
90
	 * @see WP_Widget::widget()
91
	 *
92
	 * @param array $args     Display arguments including before_title, after_title, before_widget, and after_widget.
93
	 * @param array $instance The settings for the particular instance of the widget.
94
	 */
95
	function widget( $args, $instance ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
96
97
		// Don't have the Customizer render too soon.
98
		if( empty( $instance['view_id'] ) ) {
99
			return;
100
		}
101
102
		$args['id']        = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries';
103
		$instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : '';
104
105
		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] );
0 ignored issues
show
introduced by
Array keys should NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
106
107
		echo $args['before_widget'];
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$args'
Loading history...
108
109
		if ( !empty( $title ) ) {
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
110
			echo $args['before_title'] . $title . $args['after_title'];
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$args'
Loading history...
introduced by
Expected next thing to be a escaping function, not '$title'
Loading history...
111
		}
112
113
		/**
114
		 * @action `gravityview/widget/recent-entries/before_widget` Before recent entries are displayed in the WordPress widget
115
		 * @param array $args     Display arguments including before_title, after_title, before_widget, and after_widget.
116
		 * @param array $instance The settings for the particular instance of the widget.
117
		 */
118
		do_action( 'gravityview/widget/recent-entries/before_widget', $args, $instance );
119
120
		// Print the entry list
121
		echo $this->get_output( $instance );
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
122
123
		/**
124
		 * @action `gravityview/widget/recent-entries/after_widget` After recent entries are displayed in the WordPress widget
125
		 * @param array $args     Display arguments including before_title, after_title, before_widget, and after_widget.
126
		 * @param array $instance The settings for the particular instance of the widget.
127
		 */
128
		do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance );
129
130
		echo $args['after_widget'];
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$args'
Loading history...
131
	}
132
133
	/**
134
	 * Get the HTML output for the entry list.
135
	 *
136
	 * @since 1.7.2
137
	 *
138
	 * @param array $instance The settings for the particular instance of the widget.
139
	 *
140
	 * @return string
141
	 */
142
	private function get_output( $instance ) {
143
144
		$form_id = gravityview_get_form_id( $instance['view_id'] );
145
146
		$form = gravityview_get_form( $form_id );
147
148
		$entries = $this->get_entries( $instance, $form_id );
149
150
		/**
151
		 * @since 1.6.1
152
		 * @var int $entry_link_post_id The ID to use as the parent post for the entry
153
		 */
154
		$entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id'];
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
155
156
		/**
157
		 * Generate list output
158
		 * @since 1.7.2
159
		 */
160
		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' );
161
162
		$output = $List->get_output();
163
164
		/**
165
		 * Modify the HTML before it's echo'd
166
		 * @param string $output HTML to be displayed
167
		 * @param array $instance Widget settings
168
		 */
169
		$output = apply_filters( 'gravityview/widget/recent-entries/output', $output, $instance );
170
171
		return $output;
172
	}
173
174
175
	/**
176
	 * Get the entries that will be shown in the current widget
177
	 *
178
	 * @param  array $instance Settings for the current widget
179
	 *
180
	 * @return array $entries Multidimensional array of Gravity Forms entries
181
	 */
182
	private function get_entries( $instance, $form_id ) {
183
184
		// Get the settings for the View ID
185
		$view_settings = gravityview_get_template_settings( $instance['view_id'] );
186
187
        // Set the context view ID to avoid conflicts with the Advanced Filter extension.
188
        $criteria['context_view_id'] = $instance['view_id'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$criteria was never initialized. Although not strictly required by PHP, it is generally a good practice to add $criteria = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
189
190
		$instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10;
191
		$view_settings['id'] = $instance['view_id'];
192
		$view_settings['page_size'] = $instance['limit'];
193
194
		// Prepare paging criteria
195
		$criteria['paging'] = array(
196
			'offset' => 0,
197
			'page_size' => $instance['limit']
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
198
		);
199
200
		// Prepare Search Criteria
201
		$criteria['search_criteria'] = array( 'field_filters' => array() );
202
		$criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
203
		$criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings );
204
205
		/**
206
		 * Modify the search parameters before the entries are fetched
207
		 */
208
		$criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id );
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
209
210
		$results = GVCommon::get_entries( $form_id, $criteria );
211
212
		return $results;
213
	}
214
215
	/**
216
	 * @since 1.6
217
	 * @see WP_Widget::update()
218
	 *
219
	 * @param array $new_instance Widget form settings after update
220
	 * @param array $old_instance Widget form settings before update
221
	 *
222
	 * @return array Calculated widget settings after processing
223
	 */
224
	public function update( $new_instance, $old_instance ) {
225
226
		$instance = $new_instance;
227
228
		// Force positive number
229
		$instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] );
230
231
		$instance['view_id'] = intval( $instance['view_id'] );
232
233
		$instance['link_format'] = trim( rtrim( $instance['link_format'] ) );
234
235
		$instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format'];
236
237
		$instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] );
238
239
		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] );
240
241
		//check if post_id is a valid post with embedded View
242
		$instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
243
244
		// Share that the widget isn't brand new
245
		$instance['updated']  = 1;
246
247
		/**
248
		 * Modify the updated instance. This will allow for validating any added instance settings externally.
249
		 *
250
		 * @param array $instance Calculated widget settings after processing
251
		 * @param array $new_instance Widget form settings after update
252
		 * @param array $old_instance Widget form settings before update
253
		 */
254
		$instance = apply_filters( 'gravityview/widget/update', $instance, $new_instance, $old_instance );
255
256
		return $instance;
257
	}
258
259
	/**
260
	 * @since 1.6
261
	 * @see WP_Widget::form()
262
	 */
263
	public function form( $instance ) {
264
265
		// Set up some default widget settings.
266
		$defaults = array(
267
			'title' 			=> __('Recent Entries', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
268
			'view_id'           => NULL,
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
269
			'post_id'           => NULL,
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
270
			'limit'            => 10,
271
			'link_format'       => __('Entry #{entry_id}', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
272
			'after_link'        => ''
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
273
		);
274
275
		$instance = wp_parse_args( (array) $instance, $defaults );
276
277
		?>
278
279
		<!-- Title -->
280
		<p>
281
			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label>
282
			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
283
		</p>
284
285
		<!-- Download -->
286
		<?php
287
		$args = array(
288
			'post_type'      => 'gravityview',
289
			'posts_per_page' => -1,
0 ignored issues
show
introduced by
Disabling pagination is prohibited in VIP context, do not set posts_per_page to -1 ever.
Loading history...
290
			'post_status'    => 'publish',
291
		);
292
		$views = get_posts( $args );
293
294
		// If there are no views set up yet, we get outta here.
295
		if( empty( $views ) ) {
296
			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>';
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'GravityView_Admin'
Loading history...
297
			return;
298
		}
299
300
		?>
301
302
		<?php
303
		/**
304
		 * Display errors generated for invalid embed IDs
305
		 * @see GravityView_View_Data::is_valid_embed_id
306
		 */
307
		if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) {
308
			?>
309
			<div class="error inline hide-on-view-change">
310
				<p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p>
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
311
			</div>
312
			<?php
313
			unset ( $error );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
314
		}
315
		?>
316
317
		<p>
318
			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label>
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
319
			<select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>">
320
				<option value=""><?php esc_html_e( '&mdash; Select a View as Entries Source &mdash;', 'gravityview' ); ?></option>
321
				<?php
322
323
				foreach( $views as $view ) {
324
					$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
325
					echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$view'
Loading history...
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
326
				}
327
328
				?>
329
			</select>
330
		</p>
331
332
		<?php
333
		/**
334
		 * Display errors generated for invalid embed IDs
335
		 * @see GravityView_View_Data::is_valid_embed_id
336
		 */
337
		if( !empty( $instance['error_post_id'] ) ) {
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
338
			?>
339
			<div class="error inline">
340
				<p><?php echo $instance['error_post_id']; ?></p>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$instance'
Loading history...
341
			</div>
342
			<?php
343
			unset ( $error );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
344
		}
345
		?>
346
347
		<p>
348
			<label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
349
			<input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" />
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
350
			<span class="howto"><?php
351
				esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
352
				echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview' ), 'target=_blank' );
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'gravityview_get_link'
Loading history...
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
353
				?></span>
354
		</p>
355
356
		<p>
357
			<label for="<?php echo $this->get_field_id( 'limit' ); ?>">
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
358
				<span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span>
359
			</label>
360
			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" />
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
361
		</p>
362
363
		<p>
364
			<label for="<?php echo $this->get_field_id( 'link_format' ); ?>">
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
365
				<span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span>
366
			</label>
367
			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
368
		</p>
369
370
		<p>
371
			<label for="<?php echo $this->get_field_id( 'after_link' ); ?>">
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
372
				<span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span>
373
			</label>
374
			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
375
		</p>
376
377
		<?php
378
379
		/**
380
		 * @action `gravityview_recent_entries_widget_form` Displayed at the bottom of the Recent Entries widget admin form
381
		 * @param GravityView_Recent_Entries_Widget $this WP_Widget object
382
		 * @param array $instance Current widget instance
383
		 */
384
		do_action( 'gravityview_recent_entries_widget_form' , $this, $instance );
385
386
		?>
387
388
		<script>
389
			// When the widget is saved or added, refresh the Merge Tags (here for backward compatibility)
390
			// WordPress 3.9 added widget-added and widget-updated actions
391
			jQuery('#<?php echo $this->get_field_id( 'view_id' ); ?>').trigger( 'change' );
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$this'
Loading history...
392
		</script>
393
	<?php }
394
395
}