Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait CheckEngine
- {
- public function checkUrl($data)
- {
- $string = array(
- "home" , "about" , "freetemplate" , "contact" , "?" ,
- "auto" , "beauty" , "cleaning" , "education" , "auto",
- "cat", "=" , "$");
- foreach ($string as $key)
- {
- if ($data = strpos($key, $data))
- {
- if ($data === false)
- {
- unset($data);
- }
- else
- {
- return $data;
- }
- }
- }
- }
- }
- class TemplateController
- {
- use CheckEngine;
- public function actionIndex()
- {
- require_once("view/free-template.php");
- return true;
- }
- public function actionCategory()
- {
- if (isset($_GET["cat"]))
- {
- $cat = $this->checkUrl($_GET["cat"]);
- switch ($cat)
- {
- case 'auto':
- print("auto");
- break;
- case 'beauty':
- print("beauty");
- break;
- case 'cleaning':
- print("cleaning");
- break;
- case 'education':
- print("education");
- break;
- case 'other':
- print("other");
- break;
- default:
- print("something");
- break;
- }
- }
- require_once("view/free-template.php");
- return true;
- }
- }
- $template = new TemplateController();
- $template->actionIndex();
- $template->actionCategory();
- default:
- print("something");
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement