xfn_check

Display checked checkboxes attribute for xfn microformat options.

Description

xfn_check( (string) $class, (string) $value = '', (string) $deprecated = '' ); 

Parameters (3)

0. $class (string)
The class.
1. $value — Optional. (string) => ''
The value.
2. $deprecated — Optional. (string) => ''
The deprecated.

Usage

  1. if ( !function_exists( 'xfn_check' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/meta-boxes.php'; 
  3.  
  4. // The class. 
  5. $class = ''; 
  6.  
  7. // The value. 
  8. $value = ''; 
  9.  
  10. // The deprecated. 
  11. $deprecated = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = xfn_check($class, $value, $deprecated); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/meta-boxes.php  
  1. function xfn_check( $class, $value = '', $deprecated = '' ) { 
  2. global $link; 
  3.  
  4. if ( !empty( $deprecated ) ) 
  5. _deprecated_argument( __FUNCTION__, '0.0.0' ); // Never implemented 
  6.  
  7. $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; 
  8. $rels = preg_split('/\s+/', $link_rel); 
  9.  
  10. if ('' != $value && in_array($value, $rels) ) { 
  11. echo ' checked="checked"'; 
  12.  
  13. if ('' == $value) { 
  14. if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"'; 
  15. if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"'; 
  16. if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"'; 
  17. if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';