parse_ini_string

Parse_ini_string() doesn't exist pre PHP 5.3.

Description

(array|bool) parse_ini_string( $string, $process_sections ); 

Returns (array|bool)

Parameters (2)

0. $string
The string.
1. $process_sections
The process sections.

Usage

  1. if ( !function_exists( 'parse_ini_string' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'all-in-one-seo-pack/inc/aioseop_functions.php'; 
  3.  
  4. // The string. 
  5. $string = null; 
  6.  
  7. // The process sections. 
  8. $process_sections = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = parse_ini_string($string, $process_sections); 
  12.  

Defined (1)

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

/inc/aioseop_functions.php  
  1. function parse_ini_string( $string, $process_sections ) { 
  2.  
  3. if ( ! class_exists( 'parse_ini_filter' ) ) { 
  4.  
  5. /** 
  6. * Class parse_ini_filter 
  7. * Define our filter class. 
  8. */ 
  9. class parse_ini_filter extends php_user_filter { 
  10. static $buf = ''; 
  11.  
  12. /** 
  13. * The actual filter for parsing. 
  14. * @param $in 
  15. * @param $out 
  16. * @param $consumed 
  17. * @param $closing 
  18. * @return int 
  19. */ 
  20. function filter( $in, $out, &$consumed, $closing ) { 
  21. $bucket = stream_bucket_new( fopen( 'php://memory', 'wb' ), self::$buf ); 
  22. stream_bucket_append( $out, $bucket ); 
  23.  
  24. return PSFS_PASS_ON; 
  25.  
  26. // Register our filter with PHP. 
  27. if ( ! stream_filter_register( 'parse_ini', 'parse_ini_filter' ) ) { 
  28. return false; 
  29. parse_ini_filter::$buf = $string; 
  30.  
  31. return parse_ini_file( 'php://filter/read=parse_ini/resource=php://memory', $process_sections );