PluginProbe ʕ •ᴥ•ʔ
PowerBI Embed Reports / 1.2.4
PowerBI Embed Reports v1.2.4
trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4
embed-power-bi-reports / Controller / adminController.php
embed-power-bi-reports / Controller Last commit date
accountSetupConfig.php 2 weeks ago adminController.php 2 weeks ago appConfig.php 2 weeks ago powerBIConfig.php 2 weeks ago powerBIsettingsConfig.php 2 weeks ago
adminController.php
112 lines
1 <?php
2 /**
3 * Holds the Admin Controller Config class instance.
4 *
5 * @package Admin_Controller
6 */
7
8 namespace MoEmbedPowerBI\Controller;
9
10 use MoEmbedPowerBI\Wrappers\secureInput;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 /**
17 * Class to handle admin controller functionalities.
18 */
19 class adminController {
20
21 /**
22 * Holds the Admin Controller class instance.
23 *
24 * @var Admin_Controller
25 */
26 private static $instance;
27
28 /**
29 * Object instance(Admin Controller) getter method.
30 *
31 * @return Admin_Controller
32 */
33 public static function get_controller() {
34 if ( ! isset( self::$instance ) ) {
35 $class = __CLASS__;
36 self::$instance = new $class();
37 }
38 return self::$instance;
39 }
40
41 /**
42 * Function for tab wise controller call.
43 *
44 * @return void
45 */
46 public function mo_epbr_admin_controller() {
47
48 // Only process requests that have mo_epbr_tab (admin controller requests)
49 // Skip feedback forms and other requests handled by adminObserver
50 if ( ! isset( $_POST['mo_epbr_tab'] ) || empty( $_POST['mo_epbr_tab'] ) ) {
51 return;
52 }
53
54 // Additional safety check - ensure this is a POST request
55 if ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
56 return;
57 }
58
59 // Get basic form data using secure wrapper (skip nonce verification as individual controllers handle it).
60 $controller_data = secureInput::mo_epbr_get_secure_data(
61 '', // No nonce action as individual controllers handle it
62 array(
63 'mo_epbr_tab' => 'text',
64 'option' => 'text',
65 ),
66 '_wpnonce',
67 'POST',
68 false // Skip admin check as individual controllers handle it
69 );
70
71 if ( empty( $controller_data ) ) {
72 return;
73 }
74
75 // Validate required fields exist (double-check after secure input processing)
76 if ( ! isset( $controller_data['mo_epbr_tab'] ) || ! isset( $controller_data['option'] ) ) {
77 return;
78 }
79
80 $tab_switch = $controller_data['mo_epbr_tab'];
81 $handler = self::get_controller();
82 $option = $controller_data['option'];
83
84 switch ( $tab_switch ) {
85 case 'app_config':
86 $handler = appConfig::get_controller();
87 break;
88
89 case 'pb_app_config':
90 $handler = powerBIConfig::get_controller();
91 break;
92
93 case 'settings_tab':
94 $handler = powerBIsettingsConfig::get_controller();
95 break;
96
97 case 'account_setup_tab':
98 $handler = accountSetupConfig::get_controller();
99 break;
100
101 default:
102 // Invalid tab, return silently
103 return;
104 }
105
106 // Check if the method exists before calling it
107 if ( method_exists( $handler, 'mo_epbr_save_settings' ) ) {
108 $handler->mo_epbr_save_settings( $option );
109 }
110 }
111 }
112