Code Duplication    Length = 19-21 lines in 2 locations

src/wp-includes/general-template.php 2 locations

@@ 301-319 (lines=19) @@
298
 * @param string $redirect Path to redirect to on logout.
299
 * @return string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url().
300
 */
301
function wp_logout_url($redirect = '') {
302
	$args = array( 'action' => 'logout' );
303
	if ( !empty($redirect) ) {
304
		$args['redirect_to'] = urlencode( $redirect );
305
	}
306
307
	$logout_url = add_query_arg($args, site_url('wp-login.php', 'login'));
308
	$logout_url = wp_nonce_url( $logout_url, 'log-out' );
309
310
	/**
311
	 * Filters the logout URL.
312
	 *
313
	 * @since 2.8.0
314
	 *
315
	 * @param string $logout_url The HTML-encoded logout URL.
316
	 * @param string $redirect   Path to redirect to on logout.
317
	 */
318
	return apply_filters( 'logout_url', $logout_url, $redirect );
319
}
320
321
/**
322
 * Retrieves the login URL.
@@ 331-351 (lines=21) @@
328
 *                             Default false.
329
 * @return string The login URL. Not HTML-encoded.
330
 */
331
function wp_login_url($redirect = '', $force_reauth = false) {
332
	$login_url = site_url('wp-login.php', 'login');
333
334
	if ( !empty($redirect) )
335
		$login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
336
337
	if ( $force_reauth )
338
		$login_url = add_query_arg('reauth', '1', $login_url);
339
340
	/**
341
	 * Filters the login URL.
342
	 *
343
	 * @since 2.8.0
344
	 * @since 4.2.0 The `$force_reauth` parameter was added.
345
	 *
346
	 * @param string $login_url    The login URL. Not HTML-encoded.
347
	 * @param string $redirect     The path to redirect to on login, if supplied.
348
	 * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
349
	 */
350
	return apply_filters( 'login_url', $login_url, $redirect, $force_reauth );
351
}
352
353
/**
354
 * Returns the URL that allows the user to register on the site.