bbp_new_converter

This is a function that is purposely written to look like a "new" statement.

Description

bbp_new_converter( (string) $platform ); 

It is basically a dynamic loader that will load in the platform conversion of your choice.

Parameters (1)

0. $platform (string)
Name of valid platform class.

Usage

  1. if ( !function_exists( 'bbp_new_converter' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/admin/converter.php'; 
  3.  
  4. // Name of valid platform class. 
  5. $platform = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_new_converter($platform); 
  9.  

Defined (1)

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

/includes/admin/converter.php  
  1. function bbp_new_converter( $platform ) { 
  2. $found = false; 
  3.  
  4. if ( $curdir = opendir(bbpress)->admin->admin_dir . 'converters/' ) ) { 
  5. while ( $file = readdir( $curdir ) ) { 
  6. if ( stristr( $file, '.php' ) && stristr( $file, 'index' ) === FALSE ) { 
  7. $file = preg_replace( '/.php/', '', $file ); 
  8. if ( $platform == $file ) { 
  9. $found = true; 
  10. continue; 
  11. closedir( $curdir ); 
  12.  
  13. if ( true === $found ) { 
  14. require_once(bbpress)->admin->admin_dir . 'converters/' . $platform . '.php' ); 
  15. return new $platform; 
  16. } else { 
  17. return null;