Changeset 2815 for branches/plugin/bbp-includes/bbp-general-template.php
- Timestamp:
- 01/18/2011 08:35:34 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-general-template.php
r2812 r2815 318 318 319 319 /** Forms *********************************************************************/ 320 321 function bbp_wp_login_action( $args = '' ) { 322 $defaults = array ( 323 'action' => '', 324 'context' => '' 325 ); 326 $r = wp_parse_args( $args, $defaults ); 327 extract( $r ); 328 329 if ( !empty( $action ) ) 330 $login_url = add_query_arg( array( 'action' => $action ), 'wp-login.php' ); 331 else 332 $login_url = 'wp-login.php'; 333 334 $login_url = site_url( $login_url, $context ); 335 336 echo apply_filters( 'bbp_wp_login_action', $login_url, $args ); 337 } 338 339 /** 340 * Output hidden request URI field for user forms. 341 * 342 * The referer link is the current Request URI from the server super global. The 343 * input name is '_wp_http_referer', in case you wanted to check manually. 344 * 345 * @since bbPress (r2815) 346 * 347 * @uses esc_attr() 348 * @uses home_url() 349 * @uses apply_filters() 350 * @param str $url Pass a URL to redirect to 351 * @return str Hidden input to help process redirection. 352 */ 353 function bbp_redirect_to_field( $url = '' ) { 354 // If no URL is passed, use request 355 if ( empty( $url ) ) 356 $url = esc_url( $_SERVER['HTTP_REFERER'] ); 357 358 $referer_field = '<input type="hidden" name="redirect_to" value="' . $url . '" />'; 359 360 echo apply_filters( 'bbp_redirect_to_field', $referer_field ); 361 } 362 363 /** 364 * Echo sanitized $_REQUEST value. 365 * 366 * Use the $input_type parameter to properly process the value. This 367 * ensures correct sanitization of the value for the receiving input. 368 * 369 * @since bbPress (r2815) 370 * 371 * @uses bbp_get_sanitize_val() 372 * @param str $request Name of $_REQUEST to look for 373 * @param str $input_type Type of input the value is for 374 */ 375 function bbp_sanitize_val( $request = '', $input_type = 'text' ) { 376 echo bbp_get_sanitize_val( $request, $input_type ); 377 } 378 /** 379 * Return sanitized $_REQUEST value. 380 * 381 * Use the $input_type parameter to properly process the value. This 382 * ensures correct sanitization of the value for the receiving input. 383 * 384 * @since bbPress (r2815) 385 * 386 * @uses esc_attr() 387 * @uses stripslashes() 388 * @uses apply_filters() 389 * @param str $request Name of $_REQUEST to look for 390 * @param str $input_type Type of input the value is for 391 * @return str Sanitized value ready for screen display 392 */ 393 function bbp_get_sanitize_val( $request = '', $input_type = 'text' ) { 394 395 // Check that requested 396 if ( !isset( $_REQUEST[$request] ) || empty( $request ) ) 397 return false; 398 399 // Set request varaible 400 $pre_ret_val = $_REQUEST[$request]; 401 402 // Treat different kinds of fields in different ways 403 switch ( $input_type ) { 404 case 'text' : 405 case 'textarea' : 406 $retval = esc_attr( stripslashes( $pre_ret_val ) ); 407 break; 408 409 case 'password' : 410 case 'select' : 411 case 'radio' : 412 case 'checkbox' : 413 default : 414 $retval = esc_attr( $pre_ret_val ); 415 break; 416 } 417 418 return apply_filters( 'bbp_get_sanitize_val', $retval, $request, $input_type ); 419 } 320 420 321 421 /** … … 614 714 <input type="hidden" name="user_id" id="user_id" value="<?php bbp_displayed_user_id(); ?>" /> 615 715 616 <?php wp_referer_field(); ?>617 618 716 <?php wp_nonce_field( 'update-user_' . bbp_get_displayed_user_id() ); 619 717 }
Note: See TracChangeset
for help on using the changeset viewer.