_bb_export_object

The BuddyPress bb export object function.

Description

_bb_export_object( $object, (constant) $properties = null, (int) $tabs = 1 ); 

Parameters (3)

0. $object
The object.
1. $properties — Optional. (constant) => null
The properties.
2. $tabs — Optional. (int) => 1
The tabs.

Usage

  1. if ( !function_exists( '_bb_export_object' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-admin/export.php'; 
  3.  
  4. // The object. 
  5. $object = null; 
  6.  
  7. // The properties. 
  8. $properties = null; 
  9.  
  10. // The tabs. 
  11. $tabs = 1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = _bb_export_object($object, $properties, $tabs); 
  15.  

Defined (1)

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

/bp-forums/bbpress/bb-admin/export.php  
  1. function _bb_export_object( $object, $properties = null, $tabs = 1 ) { 
  2. $r = ''; 
  3.  
  4. if ( !$type = $object['type'] ) 
  5. return; 
  6. unset($object['type']); 
  7.  
  8. $atts = ''; 
  9. $id = 0; 
  10. foreach ( $object as $att => $v ) { 
  11. if ( 'id' == $att ) { 
  12. $id = $v; 
  13. $v = $type . '_' . $v; 
  14. $atts .= " $att='$v'"; 
  15. unset($att, $v); 
  16.  
  17. $r .= str_repeat("\t", $tabs) . "<$type{$atts}>\n"; 
  18.  
  19. foreach ( (array) $properties as $k => $v ) { 
  20. if ( 'meta' == $k ) { 
  21. $data = ''; 
  22. foreach ( $v as $mk => $mv ) 
  23. $data .= str_repeat("\t", $tabs + 1) . "<meta key='$mk'><![CDATA[$mv]]></meta>\n"; 
  24. } else { 
  25. if ( '!' == $k{0} ) { 
  26. $k = substr($k, 1); 
  27. $v = "<![CDATA[$v]]>"; 
  28. $data = str_repeat("\t", $tabs + 1) . "<$k>$v</$k>\n"; 
  29. $r .= $data; 
  30.  
  31.  
  32. $r .= str_repeat("\t", $tabs) . "</$type>\n\n"; 
  33.  
  34. return $r;