viewgit/index.php:465 Only variables should be passed by reference [2048]

viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]

  1. ## Object song
  2.  
  3. class chorus():
  4. def __init__(self):
  5. self.body = ""
  6.  
  7. def content(self):
  8. return self.body
  9.  
  10. def is_chorus(self):
  11. return True
  12.  
  13. class verse():
  14. def __init__(self):
  15. self.body = ""
  16.  
  17. def content(self):
  18. return self.body
  19.  
  20. def is_chorus(self):
  21. return False
  22.  
  23. class song():
  24.  
  25. def __init__(self, newtitle, newbody=[], newmauthor = "Unknown", newtauthor="Unknown", newtone="Unknown", newyear="Unknown"):
  26. # Initialize vars..
  27. self.title = newtitle
  28. # Body is an array of string with verses and
  29. # chorus to be understood with __structure
  30. self.body = newbody
  31.  
  32. self.mauthor = newmauthor
  33. self.tauthor = newtauthor
  34. self.tone = newtone
  35. self.year = newyear
  36.  
  37. # Structure is an array of the type 'c' 'v'
  38. # where c means Chorus, v means Verse
  39. self.structure = []
  40.  
  41.  
  42. # Gives the number of chorus in the song
  43. def n_chorus(self):
  44. count = 0
  45. for item in self.structure:
  46. if(item == 'c'):
  47. count += 1
  48. return count
  49.  
  50. # Gives the number of verse in the song
  51. def n_verse(self):
  52. count = 0
  53. for item in self.structure:
  54. if(item == 'v'):
  55. count += 1
  56. return count
  57.  
  58. def is_chorus(self, n):
  59. if(self.structure[n] == 'c'):
  60. return 1
  61. return 0
  62.  
  63. def is_verse(self, n):
  64. if(self.structure[n] == 'v'):
  65. return 1
  66. return 0
  67.  
  68. def add_chorus(self, t_chorus):
  69. newchorus = chorus()
  70. newchorus.body = t_chorus
  71. self.body.append(newchorus)
  72. self.structure.append('c')
  73.  
  74. def add_verse(self, t_verse):
  75. newverse = verse()
  76. newverse.body = t_verse
  77. self.body.append(newverse)
  78. self.structure.append('v')