PluginProbe
MaxButtons – Create buttons / 7.13
MaxButtons – Create buttons v7.13
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / classes / controller.php

controller.php in MaxButtons – Create buttons 7.13, at classes/controller.php

62 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace MaxButtons;
3
4 // controller for our views
5 abstract class MaxController
6 {
7
8 protected $view; // view data
9 protected $page;
10 protected $messages = array(); // messages to display to user.
11 protected $view_template;
12
13 public function __construct()
14 {
15 $this->view = new \stdClass;
16 }
17
18 public function view()
19 {
20 $view = $this->view;
21
22
23 if (! is_null($this->view_template))
24 {
25 $path = MB()->get_plugin_path() . 'includes/' . $this->view_template . '.php';
26 if (file_exists($path))
27 include_once($path);
28 else {
29 exit('Template Not Found');
30 }
31 }
32 }
33
34 abstract protected function handlePost();
35
36 public function getButtonLink($button_id = 0, $args = array())
37 {
38 $link = admin_url() . 'admin.php?page=maxbuttons-controller&action=edit';
39 if ($button_id > 0)
40 {
41 $link = add_query_arg('id', $button_id, $link);
42 }
43 $link = add_query_arg($args,$link);
44 return $link;
45 }
46
47 public function getListLink($view = 'all', $args = array() )
48 {
49 $link = admin_url() . 'admin.php?page=maxbuttons-list&view=' . $view;
50 $link = add_query_arg($args,$link);
51 return $link;
52
53 }
54
55 // sets name of the requested page. can be used to load a specific template.
56 public function setPage($page)
57 {
58 $this->page = $page;
59 }
60
61 }
62