fork download
  1. <?php
  2.  
  3. // your code goes here
  4. class
  5. PluginInfo {
  6.  
  7.  
  8. public $tags = [];
  9.  
  10. /**
  11. * Plugin Name: AmsitLab
  12. * Plugin Uri: amsitlab.net
  13. * Description: Hahahaha
  14. */
  15.  
  16. public function __construct( $file='' ){
  17. if( $file != '' ){
  18. return $this->on( $file );
  19. }
  20.  
  21. }
  22.  
  23. public function on( $file ){
  24. if( !file_exists( $file ) ){
  25. throw new Exception( sprintf( 'File <b>%s</b> is not avaible' ) );
  26. }
  27. $contents = file_get_contents( $file );
  28. $token = token_get_all( $contents );
  29. $token = array_filter( $token, function ($e){
  30. return $e[0] == T_DOC_COMMENT;
  31.  
  32. });
  33. $doc = array_shift( $token );
  34. $line = exlode("\n", $doc[1] );
  35. $n = count( $line );
  36. for($i=0; $i<=$n; $i++){
  37. If( preg_match( '/\*\s*(.*): (.*)\s*$/i',$line[$i],$match) ){
  38. $match[1] = trim($match[1]);
  39. $match[1] = str_replace(' ','_',$match[1]);
  40. $this->tags[$match[1]] = trim($match[2]);
  41. }
  42. }
  43. }
  44.  
  45. public function dump(){
  46. return print_r( $this->tags );
  47. }
  48.  
  49. public function has( $name ){
  50. $name = str_replace( ' ', '_', $name );
  51. return array_key_exists( $name , $this->tags );
  52.  
  53. }
  54.  
  55. public function get( $name , $default= false ){
  56. $name = str_replace( ' ', '_', $name );
  57. return $this->has( $name ) ? $this->tags[$name] : $default;
  58.  
  59. }
  60.  
  61. }
  62. $doc = new PluginInfo(__FILE__);
  63. echo $doc->get( 'Plugin Name', null);
  64.  
  65. ?>
Runtime error #stdin #stdout #stderr 0.02s 52472KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Call to undefined function exlode() in /home/fDd5wF/prog.php on line 34