__checked_selected_helper

函式
__checked_selected_helper ( $helper, $current, $echo, $type )
Access
Private
引數
  • (mixed) $helper One of the values to compare.
    Required:
  • (mixed) $current The other value to compare if not just true.
    Required:
  • (bool) $echo Whether to echo or just return the string.
    Required:
  • (string) $type The type of checked|selected|disabled|readonly we are doing.
    Required:
返回值
  • (string) HTML attribute or empty string.
定義位置
相關方法
wp_check_filetypewp_cache_delete_multiplewp_scheduled_deletedelete_themewp_ajax_delete_theme
引入
2.8.0
棄用
-

__checked_selected_helper: 這是一個用於檢查下拉選單中的選項是否被選中或覈取方塊是否被選中的函式。它接收當前值和要比較的值,並返回相應的選中或選定屬性。

用於checked、selected、disabled和readonly的私有輔助函式。

比較前兩個引數,如果相同則標記為`$type’。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
if ( (string) $helper === (string) $current ) {
$result = " $type='$type'";
} else {
$result = '';
}
if ( $echo ) {
echo $result;
}
return $result;
}
function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore if ( (string) $helper === (string) $current ) { $result = " $type='$type'"; } else { $result = ''; } if ( $echo ) { echo $result; } return $result; }
function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
	if ( (string) $helper === (string) $current ) {
		$result = " $type='$type'";
	} else {
		$result = '';
	}

	if ( $echo ) {
		echo $result;
	}

	return $result;
}

常見問題

FAQs
檢視更多 >