S 6 - Setup plugin API routes

This commit is contained in:
Max Ducoudré 2024-08-08 11:54:23 +02:00
parent c0f67511a2
commit c881caff99
2 changed files with 67 additions and 0 deletions

44
module_setup.php Normal file
View File

@ -0,0 +1,44 @@
<?php
/*
* Plugin Name: Kalifast bug reporter
* Plugin URI: https://kalifast.com/#/home
* Description: Add a button to report a bug on the website
* Version: 1.0
* Author: EISGE
* Author URI: https://kalifast.com/#/home
*/
/* EISGE Core plugin requirement */
require_once(ABSPATH.'/wp-content/plugins/EISGE-API-Core/EISGE_Module_Core.php');
require_once(ABSPATH.'/wp-content/plugins/Kalifast-Bug-Reporter/reporter.php');
/* Register the module */
function install_kalifast_bug_reporter() {
$instance = new EISGE_Module_Core();
$instance->moduleInstall(array
(
'application' => 'eisge_api',
'module' => 'Kalifast-Bug-Reporter',
'module_desc' => 'A module to let the user create KALIFAST tickets',
'libraries' => array(
array(
"lib_name" => "Reporter",
"lib_desc" => "Contains the rest functions to report a bug on the website",
),
),
'modes' => array('DISPLAY', 'EDIT')
));
}
/* Unregister the module */
function uninstall_kalifast_bug_reporter() {
$instance = new EISGE_Module_Core();
$instance->moduleUninstall(array('application' => 'eisge_api', 'module'=>'Kalifast-Bug-Reporter'));
}
/* Setup hooks */
add_action( 'activate_Kalifast-Bug-Reporter/module_setup.php', 'install_kalifast_bug_reporter' );
add_action( 'deactivate_Kalifast-Bug-Reporter/module_setup.php', 'uninstall_kalifast_bug_reporter' );

23
reporter.php Normal file
View File

@ -0,0 +1,23 @@
<?php
require_once(ABSPATH."/wp-content/plugins/EISGE-API-Core/EISGE_Library_Core.php");
/**
* Class Reporter
* This class defines routes for the Kalifast Bug Reporter
*/
class Reporter extends EISGE_Library_Core {
public function getActions(){
return array(
"post_kalifast_ticket" => array(
"mode" => "EDIT",
"guest_mod" => true,
"desc" => "Send a ticket to the Kalifast Application",
"args" => "no_args"
)
);
}
public function post_kalifast_ticket(){
return $this->functionFailed("not_implemented", "Not implemented yet!");
}
}