Advertisement
Guest User

Test

a guest
Aug 4th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. <?php
  2. include 'SingleWebsiteUtils.php';
  3. class VariablesUtils extends SingleWebsiteUtils {
  4. var $serverName;
  5. var $serverIP;
  6. var $serverCount;
  7. var $serverPlayers;
  8. var $c;
  9. var $s;
  10.  
  11. function __construct($serv) {
  12. global $c;
  13.  
  14. global $sname;
  15. global $sip;
  16. global $scount;
  17. global $splayers;
  18. $this->serverCount = $scount;
  19. $this->serverIP = $sip;
  20. $this->serverName = $sname;
  21. $this->serverPlayers = $splayers;
  22. $this->c = $c;
  23. $this->s = $serv;
  24. }
  25.  
  26. function setup($texte) {
  27. $texte = preg_replace_callback(
  28. "/\{SERVERNAME\}/si",
  29. function ($matches) {
  30. return $this->serverName;
  31. },
  32. $texte
  33. );
  34. $texte = preg_replace_callback(
  35. "/\{PLAYERCOUNT\}/si",
  36. function ($matches) {
  37. return $this->serverCount;
  38. },
  39. $texte
  40. );
  41. $texte = preg_replace_callback(
  42. "/\{SERVERIP\}/si",
  43. function ($matches) {
  44. return $this->serverIP;
  45. },
  46. $texte
  47. );
  48. $texte = preg_replace_callback(
  49. "/\{MENU\}/si",
  50. function ($matches) {
  51. $str = "";
  52. foreach($this->getMenu() as &$menu) {
  53. $str.= "<li><a href='".$menu[1]."'>".$menu[0]."</a></li>";
  54. }
  55. return $str;
  56. },
  57. $texte
  58. );
  59.  
  60. //easy page loader.
  61. $texte = preg_replace_callback(
  62. "/\{PAGE_([0-9]+)\}/si",
  63. function ($matches) {
  64. $rt = preg_replace("/\{PAGE_/si", "", $matches[1]);
  65. $rt = preg_replace("/\}/si", "", $matches[1]);
  66. return $this->getPage($rt);
  67. },
  68. $texte
  69. );
  70. return $texte;
  71.  
  72. //easy page loader.
  73. $texte = preg_replace_callback(
  74. "/\{TITLE_([0-9]+)\}/si",
  75. function ($matches) {
  76. $rt = preg_replace("/\{TITLE_/si", "", $matches[1]);
  77. $rt = preg_replace("/\}/si", "", $matches[1]);
  78. return $this->getPageTitle($rt);
  79. },
  80. $texte
  81. );
  82. return $texte;
  83. }
  84.  
  85. function bbcode($texte) {
  86.  
  87.  
  88. }
  89. }
  90. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement