PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / libraries / mvc / admin / controllers / shortcodes.php
vikappointments / libraries / mvc / admin / controllers Last commit date
acl.php 2 days ago feedback.php 2 days ago license.php 2 days ago override.php 2 days ago rss.php 2 days ago shortcode.php 2 days ago shortcodes.php 2 days ago
shortcodes.php
119 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 VAPLoader::import('libraries.mvc.controllers.admin');
15
16 /**
17 * VikAppointments plugin Shortcodes controller.
18 *
19 * @since 1.0
20 */
21 class VikAppointmentsControllerShortcodes extends VAPControllerAdmin
22 {
23 /**
24 * Shortcodes create task.
25 *
26 * @return void
27 */
28 public function add()
29 {
30 if (!JFactory::getUser()->authorise('core.admin', 'com_vikappointments'))
31 {
32 wp_die(
33 '<h1>' . JText::translate('FATAL_ERROR') . '</h1>' .
34 '<p>' . JText::translate('RESOURCE_AUTH_ERROR') . '</p>',
35 403
36 );
37 }
38
39 $input = JFactory::getApplication()->input;
40
41 $input->set('view', 'shortcode');
42
43 parent::display();
44 }
45
46 /**
47 * Shortcodes edit task.
48 *
49 * @return void
50 */
51 public function edit()
52 {
53 if (!JFactory::getUser()->authorise('core.admin', 'com_vikappointments'))
54 {
55 wp_die(
56 '<h1>' . JText::translate('FATAL_ERROR') . '</h1>' .
57 '<p>' . JText::translate('RESOURCE_AUTH_ERROR') . '</p>',
58 403
59 );
60 }
61
62 $input = JFactory::getApplication()->input;
63
64 $input->set('view', 'shortcode');
65
66 parent::display();
67 }
68
69 /**
70 * Shortcodes delete task.
71 *
72 * @return void
73 */
74 public function delete()
75 {
76 $input = JFactory::getApplication()->input;
77
78 $cid = $input->getUint('cid', array());
79 $encoded = $input->getBase64('return', '');
80
81 $this->model->delete($cid);
82
83 $this->setRedirect('admin.php?option=com_vikappointments&view=shortcodes&return=' . $encoded);
84 }
85
86 /**
87 * Shortcodes back to list task.
88 *
89 * @return void
90 */
91 public function cancel()
92 {
93 $encoded = JFactory::getApplication()->input->getBase64('return', '');
94
95 $this->setRedirect('admin.php?option=com_vikappointments&view=shortcodes&return=' . $encoded);
96 }
97
98 /**
99 * Shortcodes back button task.
100 *
101 * @return void
102 */
103 public function back()
104 {
105 $return = JFactory::getApplication()->input->getBase64('return', '');
106
107 if ($return)
108 {
109 $return = base64_decode($return);
110 }
111 else
112 {
113 $return = 'admin.php?page=vikappointments';
114 }
115
116 $this->setRedirect($return);
117 }
118 }
119