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