PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | modules/cost-tracker/classes/class-cost-tracker-manager.php +24 -3 5.1 → 6.2.1 View file →
@@ -9,14 +9,18 @@
9 9 namespace MainWP\Dashboard\Module\CostTracker;
10 10
11 11 use MainWP\Dashboard\MainWP_Utility;
12 12
13 +// Exit if accessed directly.
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit;
16 +}
17 +
13 18 /**
14 19 * Class Cost_Tracker_Manager
15 20 */
16 21 class Cost_Tracker_Manager {
17 22
18 -
19 23 /**
20 24 * Static variable to hold the single instance of the class.
21 25 *
22 26 * @static
@@ -50,10 +54,27 @@
50 54 spl_autoload_register( array( $this, 'autoload' ) );
51 55 Cost_Tracker_Admin::get_instance();
52 56 $base_dir = static::get_location_path();
53 57 // includes rest api work.
54 - require_once $base_dir . 'classes/class-cost-tracker-rest-api.php'; // NOSONAR - WP compatible.
55 - Rest_Api::instance()->init();
58 + require_once $base_dir . 'rest-api/version1/class-cost-tracker-rest-api-v1.php'; // NOSONAR - WP compatible.
59 + require_once $base_dir . 'rest-api/version1/class-cost-tracker-rest-api-handle-v1.php'; // NOSONAR - WP compatible.
60 +
61 + require_once $base_dir . 'rest-api/version2/class-mainwp-rest-costs-controller.php'; // NOSONAR - WP compatible.
62 +
63 + Cost_Tracker_Rest_Api_V1::instance()->init();
64 + add_filter( 'mainwp_rest_api_get_rest_namespaces', array( $this, 'hook_rest_api_get_rest_namespaces' ), 10, 1 );
65 + }
66 +
67 + /**
68 + * Method hook_rest_api_get_rest_namespaces().
69 + *
70 + * @param string $namespaces namespaces.
71 + *
72 + * @return string namespaces.
73 + */
74 + public function hook_rest_api_get_rest_namespaces( $namespaces ) {
75 + $namespaces['mainwp/v2/costs'] = array( 'costs' => \MainWP_Rest_Costs_Controller::class );
76 + return $namespaces;
56 77 }
57 78
58 79 /**
59 80 * Autoloader for classes.