Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. trait CheckEngine
  2. {
  3. public function checkUrl($data)
  4. {
  5. $string = array(
  6. "home" , "about" , "freetemplate" , "contact" , "?" ,
  7. "auto" , "beauty" , "cleaning" , "education" , "auto",
  8. "cat", "=" , "$");
  9.  
  10. foreach ($string as $key)
  11. {
  12. if ($data = strpos($key, $data))
  13. {
  14. if ($data === false)
  15. {
  16. unset($data);
  17. }
  18. else
  19. {
  20. return $data;
  21.  
  22. }
  23. }
  24. }
  25. }
  26. }
  27.  
  28.  
  29.  
  30. class TemplateController
  31. {
  32. use CheckEngine;
  33. public function actionIndex()
  34. {
  35. require_once("view/free-template.php");
  36. return true;
  37. }
  38.  
  39. public function actionCategory()
  40. {
  41.  
  42. if (isset($_GET["cat"]))
  43. {
  44.  
  45.  
  46. $cat = $this->checkUrl($_GET["cat"]);
  47.  
  48.  
  49. switch ($cat)
  50. {
  51. case 'auto':
  52. print("auto");
  53. break;
  54. case 'beauty':
  55. print("beauty");
  56. break;
  57. case 'cleaning':
  58. print("cleaning");
  59. break;
  60. case 'education':
  61. print("education");
  62. break;
  63. case 'other':
  64. print("other");
  65. break;
  66. default:
  67. print("something");
  68. break;
  69. }
  70.  
  71. }
  72.  
  73. require_once("view/free-template.php");
  74. return true;
  75. }
  76.  
  77. }
  78.  
  79. $template = new TemplateController();
  80. $template->actionIndex();
  81. $template->actionCategory();
  82.  
  83. default:
  84. print("something");
  85. break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement