namespace MO_CAW\Common\Views;
use MO_CAW\Common\Utils;
use MO_CAW\Common\DB_Utils;
use MO_CAW\Common\Constants;
class SQL_API_Creation
{
private $api_name = '';
private $namespace = "mo/v1";
private $method = Constants::HTTP_GET;
private $queries = array();
private $response = array();
private $blocked_roles = array();
private $sql_endpoint_config = array();
protected $license_status = '';
private $plan_status = "disabled";
public function __construct($gt)
{
if (!(isset($_GET["_wpnonce"]) && check_admin_referer("MO_CAW_SQL_API_Creation_" . ucfirst($gt) . "_Nonce", "_wpnonce"))) {
goto WO;
}
$DT = isset($_SESSION["MO_CAW_SQL_API_Creation_Form_Data"]) ? wp_unslash($_SESSION["MO_CAW_SQL_API_Creation_Form_Data"]) : array();
Utils::sanitize_nested_array($DT);
$this->sql_endpoint_config = !empty($DT) ? $DT : $this->sql_endpoint_config;
if (Constants::EDIT === $gt || Constants::VIEW === $gt || Constants::TEST === $gt || Constants::DELETE === $gt) {
goto ma;
}
if (Constants::ADD === $gt && Constants::DISABLED !== $this->license_status) {
goto q0;
}
goto ks;
ma:
$this->api_name = isset($_GET["api-name"]) ? sanitize_text_field(wp_unslash($_GET["api-name"])) : $this->api_name;
$this->method = isset($_GET["method"]) ? sanitize_text_field(wp_unslash($_GET["method"])) : $this->method;
$this->namespace = isset($_GET["namespace"]) ? sanitize_text_field(wp_unslash($_GET["namespace"])) : $this->namespace;
$UK = array("connection_name" => $this->api_name, "type" => Constants::SQL_ENDPOINT, "method" => $this->method, "namespace" => $this->namespace);
$this->sql_endpoint_config = empty($this->sql_endpoint_config) ? DB_Utils::get_configuration($UK)[0] : $this->sql_endpoint_config;
goto ks;
q0:
$this->namespace = $this->sql_endpoint_config["namespace"] ?? $this->namespace;
$this->method = $this->sql_endpoint_config["method"] ?? $this->method;
$this->api_name = $this->sql_endpoint_config["connection_name"] ?? $this->api_name;
ks:
$this->response = $this->sql_endpoint_config["configuration"]["response"] ?? array();
$this->blocked_roles = $this->sql_endpoint_config["configuration"]["blocked_roles"] ?? array();
$this->queries = $this->sql_endpoint_config["configuration"]["sql_queries"] ?? array();
WO:
}
public function display_sql_api_creation_ui($Z5, $gt)
{
switch ($gt) {
case Constants::ADD:
$this->display_api_creation_add_or_edit($gt);
goto A7;
case Constants::VIEW:
$this->display_api_creation_view();
goto A7;
case Constants::EDIT:
$this->display_api_creation_add_or_edit($gt);
goto A7;
case Constants::TEST:
$this->display_api_creation_add_or_edit($gt);
goto A7;
case "export":
$this->display_api_creation_export();
goto A7;
default:
$this->display_api_creation_all_config();
goto A7;
}
jo:
A7:
}
private function display_api_creation_all_config()
{
$UK["type"] = Constants::SQL_ENDPOINT;
$Pe = DB_Utils::get_configuration($UK);
$Pe = Utils::organize_endpoints_by_namespace($Pe);
echo "\x9 <div class="d-flex justify-content-between align-items-center mb-4">
\x9\x9 <h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">Configured SQL APIs</h6>\xa\x9 <div class="d-grid gap-2 d-md-block">
\x9 \x9\x9<button class="btn mo-caw-btn-outline-blue-medium mo-caw-roundedi6 pxl mo-caw-element-to-toggle mo-caw-light-mode ";
echo esc_attr($this->license_status);
echo "" method="button" data-bs-toggle="modal" data-bs-target="#" aria-hidden="true" hidden>Export Postman Collection</button>
\x9\x9 <button class="btn btn-primary mo-caw-rounded-16 mo-caw-bg-blue-dark px-4 ";
echo esc_attr($this->license_status);
echo " ";
echo !empty($Pe) ? "mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan mo-caw-add-standard-tooltip mo-caw-add-bac-tooltip mo-caw-add-eai-tooltip" : '';
echo "" method="button" type="button" onclick="window.location.href = '";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=add", "MO_CAW_SQL_API_Creation_Add_Nonce"));
echo "'">Create SQL API</button>\xa\x9\x9\x9</div>\xa <div class="modal fade mo-caw-export-modal" id="mo-caw-custom-sql-api-export-modal" tabindex="-1" aria-labelledby="mo-caw-custom-sql-api-export-modal-label" aria-hidden="true">\xa \x9 \x9<div class="modal-dialog modal-dialog-centered justify-content-center">\xa\x9\x9\x9 \x9<form method="POST">
\x9 \x9\x9";
wp_nonce_field("MO_CAW_SQL_API_Creation_Export", "MO_CAW_SQL_API_Creation_Nonce");
echo "\x9 \x9 \x9\x9<div class="modal-content">\xa \x9 \x9 \x9<div class="modal-header">\xa\x9\x9 \x9\x9\x9\x9\x9<h5 class="modal-title" id="mo-caw-custom-sql-api-export-modal-label">Export Data</h5>\xa\x9 \x9 \x9\x9 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>\xa\x9\x9\x9\x9 </div>
\x9\x9\x9\x9\x9\x9<div class="modal-body">\xa\x9 \x9\x9\x9 <h6 class="mo-caw-element-to-toggle mo-caw-light-mode">Select namespaces to export</h6>
\x9 \x9 \x9\x9<div class="form-check d-flex align-items-center justify-content-start p-2">
\x9 \x9\x9\x9\x9\x9 <input class="form-check-input m-0 bg-white mej mo-caw-select-all-checkbox" type="checkbox" value="" id="mo-caw-custom-sql-api-export-select-all" data-target="mo-caw-custom-sql-api-export">
\x9\x9\x9 \x9\x9\x9\x9<label class="form-check-label" for="mo-caw-custom-sql-api-export-select-all">Select All</label>
\x9\x9\x9\x9 \x9 </div>
\x9 \x9\x9\x9\x9";
foreach ($Pe as $Qi => $J1) {
echo " \x9 \x9\x9\x9<div class="form-check d-flex align-items-center justify-content-start p-2">\xa \x9\x9 \x9 \x9\x9<input class="form-check-input mh bg-white me-2 mo-caw-custom-sql-api-export" type="checkbox" value="";
echo esc_attr($Qi);
echo "" id="mo-caw-custom-sql-api-export-";
echo esc_attr($Qi);
echo "" name="mo-caw-custom-sql-api-export[]">\xa \x9 \x9 \x9 \x9<label class="form-check-label" for="mo-caw-custom-sql-api-export-";
echo esc_attr($Qi);
echo "">";
echo esc_attr($Qi);
echo "</label>
\x9 \x9\x9\x9\x9</div>
\x9 \x9 \x9 ";
rE:
}
mI:
echo "\x9 \x9\x9 \x9\x9</div>
\x9\x9 \x9<div class="modal-footer d-md-flex justify-content-md-center">\xa \x9 \x9 \x9 <button class="btn btn-primary mo-caw-bg-blue-medium mo-caw-rounded-16" type="submit">Export</button>\xa\x9\x9\x9\x9\x9\x9 </div>
\x9 \x9\x9\x9\x9</div>
\x9\x9 \x9 </form>
\x9 </div>
</div>
\x9 </div>\xa ";
if (!empty($Pe)) {
goto mO;
}
echo "\x9\x9 <div class="d-flex align-items-center flex-column">\xa \x9\x9<img src="";
echo esc_url(MO_CUSTOM_API_URL . "classes/Common/Resources/Images/not-found.jpeg");
echo "" width="4px" >
\x9\x9\x9<h6 class="mtm text-secondary">Oops! Seems like you have not created any Custom SQL APIs.</h6>
\x9\x9\x9</div>\xa\x9\x9";
goto ej;
mO:
echo "\x9 \x9<div class="accordion" id="mo-caw-custom-sql-api-accordion">
\x9 \x9<div class="accordion accordion-flush" id="mo-caw-custom-sql-api-accordion-flush">\xa \x9 ";
$gZ = 0;
echo " \x9 ";
foreach ($Pe as $Qi => $J1) {
echo " \x9\x9 <div class="accordion-item mo-caw-accordion-item mbj border-0 mo-caw-rounded-8 mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9\x9\x9\x9 <h2 class="accordion-header" id="mo-caw-custom-sql-api-config-accordion-";
echo esc_attr($gZ);
echo "">\xa \x9 \x9<button class="accordion-button mo-caw-bg-blue-light fw-normal shadow-none mo-caw-rounded-8 ";
echo 0 === $gZ ? '' : "collapsed";
echo "" type="button" data-bs-toggle="collapse" data-bs-target="#mo-caw-create-api-accordion-collapse-";
echo esc_attr($gZ);
echo "" aria-expanded="false" aria-controls="flush-collapseOne">";
echo esc_attr($Qi);
echo "</button>\xa \x9\x9 \x9 </h2>
\x9\x9 \x9<div id="mo-caw-create-api-accordion-collapse-";
echo esc_attr($gZ);
echo "" class="accordion-collapse collapse ";
echo 0 === $gZ ? "show" : '';
echo "" aria-labelledby="mo-caw-custom-sql-api-config-accordion-";
echo esc_attr($gZ);
echo "" data-bs-parent="#mo-caw-custom-sql-api-accordion-flush">\xa\x9\x9\x9 \x9\x9\x9<div class="accordion-body">\xa \x9 \x9\x9\x9<table class="table text-center fs-6 border borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9\x9\x9 \x9<thead>\xa \x9 \x9 \x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9\x9 \x9 \x9\x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3">API Name</th>\xa \x9\x9 \x9\x9 \x9\x9<th scope="col" class="borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottomh col-mdk p-3">Method</th>\xa \x9\x9 \x9\x9 \x9 \x9\x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3">Enable/Disable</th>\xa \x9\x9 \x9 \x9\x9 \x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottomh col-md-3 p-3">Actions</th>\xa\x9 \x9\x9 \x9\x9 </tr>
\x9 \x9\x9 \x9\x9 </thead>
\x9\x9\x9\x9 \x9\x9\x9 <tbody>\xa\x9\x9 \x9 \x9\x9 ";
foreach ($J1 as $jS => $Uq) {
echo " \x9\x9 <tr>
\x9\x9\x9 \x9\x9\x9 <td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">";
echo esc_attr($Uq["connection_name"]);
echo "</td>\xa\x9\x9 \x9\x9\x9\x9\x9\x9<td class="col-mdk border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle"><span class="rounded-pill py-2 px-4 mo-caw-";
echo esc_attr($Uq["method"]);
echo "-method">";
echo esc_attr(strtoupper($Uq["method"]));
echo "</span></td>\xa\x9\x9\x9 \x9\x9 \x9\x9 <td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">\xa\x9 \x9 \x9 <div class="form-check form-switch d-flex justify-content-center align-items-center">\xa\x9\x9 \x9 \x9 \x9\x9 <input class="form-check-input mo-caw-toggle-switch" type="checkbox" onchange="moCawEnableDisableApi(this, '";
echo esc_attr(wp_create_nonce("mo_caw_custom_sql_api_enable_disable_api"));
echo "', '";
echo esc_attr($Uq["connection_name"]);
echo "', '";
echo esc_attr($Uq["method"]);
echo "', '";
echo esc_attr($Qi);
echo "', '";
echo esc_attr(Constants::SQL_ENDPOINT);
echo "')"
\x9 \x9\x9 \x9\x9\x9";
echo !isset($Uq["is_enabled"]) || $Uq["is_enabled"] ? "checked " : '';
echo esc_attr($this->license_status);
echo "\x9 \x9\x9 \x9 >
\x9 \x9 \x9\x9 </div>\xa \x9 \x9 </td>
\x9 \x9\x9 <td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">\xa \x9\x9 \x9\x9 \x9\x9\x9 <div class="dropdown">
\x9 \x9\x9\x9 \x9\x9\x9<button class="btn btn-secondary dropdown-toggle mo-caw-dropdown-toggle rounded-pill mo-caw-bg-grey-light border-0 mo-caw-text-grey-medium" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">Pick an option</button>\xa\x9 \x9 \x9\x9 \x9 <ul class="dropdown-menu mo-caw-dropdown-menu" aria-labelledby="dropdownMenuButton1">
\x9\x9 \x9\x9 \x9 <li><a class="dropdown-item d-flex align-items-center justify-content-between" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=view&api-name=" . $Uq["connection_name"] . "&method=" . $Uq["method"] . "&namespace=" . $Qi, "MO_CAW_SQL_API_Creation_View_Nonce"));
echo ""><span>View</span><i class="far fa-eye mo-caw-text-black"></i></a></li>\xa\x9 \x9 \x9\x9\x9\x9 \x9\x9 <li><a class="dropdown-item d-flex align-items-center justify-content-between ";
echo esc_attr($this->license_status);
echo "" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=edit&api-name=" . $Uq["connection_name"] . "&method=" . $Uq["method"] . "&namespace=" . $Qi, "MO_CAW_SQL_API_Creation_Edit_Nonce"));
echo ""><span>Edit</span><i class="fas fa-pencil mo-caw-text-black"></i></a></li>\xa \x9\x9 \x9 \x9 \x9 \x9\x9<li><a class="dropdown-item d-flex align-items-center justify-content-between ";
echo esc_attr($this->license_status);
echo "" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=test&api-name=" . $Uq["connection_name"] . "&method=" . $Uq["method"] . "&namespace=" . $Qi . "&test-mode=true", "MO_CAW_SQL_API_Creation_Test_Nonce"));
echo ""><span>Test</span><i class="fas fa-check mo-caw-text-black"></i></a></li>\xa\x9\x9 \x9\x9\x9 \x9 \x9\x9\x9<li><a class="dropdown-item d-flex align-items-center justify-content-between ";
echo esc_attr($this->license_status);
echo "" onclick="if(confirm('Are you sure you want to delete this API?')){document.getElementById('mo-caw-api-creation-delete-form-";
echo esc_attr($Uq["connection_name"]) . "-" . esc_attr($Uq["method"]) . "-" . esc_attr($Qi);
echo "').submit(); return false;}"><span>Delete</span><i class="far fa-trash-can mo-caw-text-black"></i></a></li>\xa\x9\x9\x9 \x9 </ul>
\x9\x9 \x9 \x9\x9</div>\xa \x9 \x9 <form method="POST" id="mo-caw-api-creation-delete-form-";
echo esc_attr($Uq["connection_name"]) . "-" . esc_attr($Uq["method"]) . "-" . esc_attr($Qi);
echo "">\xa\x9 \x9 \x9 \x9 \x9 ";
wp_nonce_field("MO_CAW_SQL_API_Creation_Delete", "MO_CAW_SQL_API_Creation_Nonce");
echo " \x9 <input type="hidden" name="api-name" value="";
echo esc_attr($Uq["connection_name"]);
echo "">\xa\x9 \x9 \x9 \x9 \x9 <input type="hidden" name="method" value="";
echo esc_attr($Uq["method"]);
echo "">
\x9\x9\x9\x9\x9\x9\x9 \x9 <input type="hidden" name="namespace" value="";
echo esc_attr($Qi);
echo "">\xa\x9\x9 \x9 </form>
\x9\x9 \x9\x9 \x9</td>
\x9\x9 \x9\x9\x9 \x9\x9</tr>\xa\x9\x9\x9 \x9\x9\x9";
L7:
}
yG:
echo " \x9 \x9\x9\x9\x9</tbody>\xa\x9\x9 \x9\x9 </table>\xa\x9 \x9\x9 \x9</div>\xa \x9\x9\x9 </div>
\x9 \x9\x9 </div>\xa\x9 \x9 ";
++$gZ;
echo " \x9\x9\x9";
KO:
}
tA:
echo " \x9\x9 </div>\xa </div>\xa ";
ej:
echo "\x9 ";
}
private function display_api_creation_add_or_edit($gt)
{
global $wp_roles;
$nt = $wp_roles->roles;
$Ra = array();
$i2 = array_keys($nt);
foreach ($nt as $gZ => $tW) {
array_push($Ra, $tW["name"]);
Vi:
}
sV:
$ax = array("type" => Constants::SQL_ENDPOINT);
$mP = DB_Utils::get_all_namespaces($ax);
$iT = array();
foreach ($mP as $Qi) {
if (in_array($Qi->namespace, $iT, true)) {
goto HH;
}
array_push($iT, $Qi->namespace);
HH:
NR:
}
wN:
$iZ = isset($_GET["test-mode"]) ? filter_var(sanitize_text_field(wp_unslash($_GET["test-mode"])), FILTER_VALIDATE_BOOLEAN) : false;
echo "\x9 <form method="POST" id="mo-caw-custom-sql-api-form" class="mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9\x9";
wp_nonce_field("MO_CAW_SQL_API_Creation", "MO_CAW_SQL_API_Creation_Nonce");
echo " \x9<input type="hidden" id="mo-caw-custom-sql-api-test-mode" name="mo-caw-custom-sql-api-test-mode" value="false">\xa \x9 <div class="d-flex justify-content-between align-items-end mbl">\xa \x9<h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">";
echo Constants::ADD === $gt ? "Create Custom API" : "Edit API - " . esc_attr($this->api_name);
echo "</h6>\xa \x9\x9 <div class="d-grid gap-2 d-md-block">
\x9 \x9<button class="btn mo-caw-btn-outline-blue-medium mo-caw-rounded-16 px-4 mo-caw-element-to-toggle mo-caw-light-mode ";
echo esc_attr($this->license_status);
echo "" type="button"
\x9 \x9";
if (!(Constants::DISABLED !== $this->license_status)) {
goto g_;
}
echo esc_attr("onclick=moCawEnableTestMode()");
g_:
echo " \x9 \x9>Test</button>\xa \x9\x9\x9<button class="btn btn-primary mo-caw-roundedi6 mo-caw-bg-blue-dark px-4 ";
echo esc_attr($this->license_status);
echo "" type="submit" id="mo-caw-custom-sql-api-form-submit">Save</button>
\x9\x9 \x9</div>\xa \x9\x9</div>\xa\x9 \x9<div class="bg-white mo-caw-shadow p-3 mo-caw-rounded-16">
\x9\x9 \x9<div class="mbk">
\x9 \x9 <label for="mo-caw-custom-sql-api-namespace" class="form-label mo-caw-form-label">Custom Namespace</label>
\x9\x9\x9 <div class="d-flex justify-content-between align-items-center">\xa\x9\x9 \x9 \x9<input type="text" class="mo-caw-disable-standard-plan mo-caw-crown-standard-plan mo-caw-disable-bac-plan mo-caw-crown-bac-plan mo-caw-disable-eai-plan mo-caw-crown-eai-plan form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode py-1 px-2" id="mo-caw-custom-sql-api-namespace" name="mo-caw-custom-sql-api-namespace" value="";
echo esc_attr($this->namespace);
echo "" placeholder="Custom Namespace (eg. mo/v1)" list="mo-caw-custom-sql-api-namespace-list" pattern="^(?=.{1,}$)[A-Za-z]+/v[0-9]+$" title="Namespace must be of max length 15 and contain at least one '/' in between, [A-Z, a-z] before '/', 'v' (denoting version) and numbers only after '/'" aria-required="true" required ";
echo Constants::EDIT === $gt || Constants::TEST === $gt ? "disabled" : '';
echo ">\xa\x9 \x9 ";
if (!(Constants::EDIT === $gt || Constants::TEST === $gt)) {
goto AE;
}
echo " \x9\x9 \x9 <input type="hidden" name="mo-caw-custom-sql-api-namespace" value="";
echo esc_attr($this->namespace);
echo "">
\x9\x9 \x9\x9\x9";
AE:
echo "\x9 \x9\x9\x9</div>\xa\x9 <datalist id="mo-caw-custom-sql-api-namespace-list">
\x9\x9 \x9 ";
foreach ($iT as $Qi) {
echo " \x9 \x9 <option value="";
echo esc_attr($Qi);
echo "">
\x9\x9 ";
MF:
}
po:
echo "\x9 \x9 </datalist>
\x9\x9\x9 </div>\xa\x9\x9\x9\x9<div class="row">
<div class="mb-3 col">\xa\x9\x9 \x9 <label for="mo-caw-custom-sql-api-name" class="form-label mo-caw-form-label">API Name</label>\xa \x9 \x9 <input type="text" class="form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode pyi px-2" id="mo-caw-custom-sql-api-name" name="mo-caw-custom-sql-api-name" value="";
echo esc_attr($this->api_name);
echo "" placeholder="API Name" pattern="^(?=.{1,}$)[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$" title="Should be of maximum length 25 and only '-' are accepted in between along with [A-Z, a-z and 0-9]" aria-required="true" required ";
echo Constants::EDIT === $gt || Constants::TEST === $gt ? "disabled" : '';
echo ">
\x9 \x9\x9 \x9";
if (!(Constants::EDIT === $gt || Constants::TEST === $gt)) {
goto CI;
}
echo " \x9\x9\x9 <input type="hidden" name="mo-caw-custom-sql-api-name" value="";
echo esc_attr($this->api_name);
echo "">\xa \x9 \x9\x9\x9";
CI:
echo " \x9 \x9 </div>
\x9 \x9<div class="mb-3 col">
\x9 \x9\x9 <label for="mo-caw-custom-sql-api-method" class="form-label mo-caw-form-label">Method <i class="fas fa-info rounded-circle border py-1 px-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="HTTP request method"></i></label>\xa\x9 \x9 <select class="form-select mo-caw-form-select mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode mo-caw-method-selector" id="mo-caw-custom-sql-api-method" name="mo-caw-custom-sql-api-method" aria-label="#mo-caw-custom-sql-api-method" aria-required="true" required ";
echo Constants::EDIT === $gt || Constants::TEST === $gt ? "disabled" : '';
echo ">
\x9 \x9\x9 <option value="">Select Method</option>\xa\x9 \x9 <option value="get" ";
echo Constants::HTTP_GET === $this->method ? "selected" : '';
echo ">GET</option>
\x9 \x9<option value="post" ";
echo Constants::HTTP_POST === $this->method ? "selected" : '';
echo ">POST</option>\xa \x9\x9<option value="put" ";
echo Constants::HTTP_PUT === $this->method ? "selected" : '';
echo ">PUT</option>\xa \x9 <option value="delete" ";
echo Constants::HTTP_DELETE === $this->method ? "selected" : '';
echo ">DELETE</option>\xa \x9 \x9\x9</select>
\x9\x9";
if (!(Constants::EDIT === $gt || Constants::TEST === $gt)) {
goto U0;
}
echo "\x9 \x9 \x9\x9<input type="hidden" name="mo-caw-custom-sql-api-method" value="";
echo esc_attr($this->method);
echo "">\xa\x9 \x9\x9\x9";
U0:
echo "\x9\x9\x9 </div>\xa \x9\x9 </div>
\x9 <div>
\x9\x9 \x9 <div class="d-flex justify-content-between align-items-center mb-2 mo-caw-form-content d-none" request-methods="get post put delete">\xa\x9\x9 \x9\x9 <label class="form-label mo-caw-form-label fw-bolder">SQL Queries</em> <i class="fas fa-info rounded-circle border py-1 px-2" data-bs-toggle="tooltip" data-bs-placement="right" title="Write a SQL query. Any custom parameters to be replaced dynamically should be in the following format: E.g. "{{parameter_name}}"."></i></label>
\x9\x9 \x9 \x9<span>\xa \x9 \x9\x9<button class="mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan mo-caw-add-standard-tooltip mo-caw-add-bac-tooltip mo-caw-add-eai-tooltip border-0 bg-white p-0" type="button" onclick="moCawAddField('sql', 'mo-caw-custom-sql-api-query-duplicate-div-0', 'mo-caw-custom-sql-api-query-duplicate-div-', this.nextElementSibling)" ><i class="fa-solid fa-plus mo-caw-text-grey-medium border border-3 rounded pi"></i></button>\xa\x9\x9 \x9 \x9<button class="mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan mo-caw-add-standard-tooltip mo-caw-add-bac-tooltip mo-caw-add-eai-tooltip border-0 bg-white p-0" type="button" onclick="moCawRemoveField('mo-caw-custom-sql-api-query-duplicate-div-', this)" ><i class="fa-solid fa-minus mo-caw-text-grey-medium border border-3 rounded p-1"></i></button>
\x9\x9 \x9 </span>
\x9\x9 </div>
\x9 \x9 <div class="mo-caw-form-content d-none mb-3" request-methods="get post put delete">
\x9 \x9 <div id="mo-caw-sortable-list" class="list-group col">\xa\x9\x9\x9 \x9";
if (!empty($this->queries)) {
goto gc;
}
echo "\x9 \x9\x9 \x9<div class="row" id="mo-caw-custom-sql-api-query-duplicate-div-0">\xa\x9\x9\x9 \x9\x9<div class="list-group-item border-0" draggable="true">\xa\x9\x9\x9\x9 \x9 \x9<div class="input-group">
\x9 <input type="text" class="form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode py-1 border-endh" id="mo-caw-custom-sql-api-query" name="mo-caw-custom-sql-api-query[]" placeholder="Enter your SQL query" aria-required="true" required>\xa \x9 \x9\x9\x9 \x9<span class="input-group-text bg-white border-starth mo-caw-cursor-pointer">\xa\x9\x9 \x9\x9 \x9 \x9 ";
if (!(Constants::STANDARD_PLAN_NAME !== Constants::PLAN_NAME)) {
goto uZ;
}
echo "\x9 \x9\x9\x9 \x9\x9 <i class="fas fa-bars fa-xl mo-caw-handle"></i>\xa \x9 \x9\x9\x9 \x9";
uZ:
echo "\x9 \x9 \x9 \x9\x9</span>
\x9 \x9 \x9</div>
\x9 \x9\x9 \x9 </div>\xa\x9\x9\x9\x9\x9 </div>\xa \x9\x9 \x9 ";
goto B6;
gc:
echo " \x9 \x9 ";
foreach ($this->queries as $P8 => $kl) {
echo "\x9 \x9 \x9\x9 <div class="row" id="mo-caw-custom-sql-api-query-duplicate-div-";
echo esc_attr($P8);
echo "">
\x9 \x9\x9\x9\x9 \x9 \x9<div class="list-group-item border-0" draggable="true">
\x9 \x9\x9\x9 \x9\x9\x9\x9<div class="input-group">
\x9 \x9\x9\x9\x9 <input type="text" class="form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode pyi border-endh" id="mo-caw-custom-sql-api-query" name="mo-caw-custom-sql-api-query[]" value="";
echo esc_attr($kl);
echo "" placeholder="Enter your SQL query" aria-required="true" required>\xa\x9\x9\x9\x9 \x9\x9\x9\x9 \x9<span class="input-group-text bg-white border-start-0 mo-caw-cursor-pointer">
\x9 \x9\x9 \x9 \x9 ";
if (!(Constants::STANDARD_PLAN_NAME !== Constants::PLAN_NAME)) {
goto Gv;
}
echo "\x9\x9 \x9 \x9\x9\x9\x9\x9 \x9<i class="fas fa-bars fa-xl mo-caw-handle"></i>\xa\x9 \x9 \x9\x9\x9 \x9\x9\x9";
Gv:
echo " \x9\x9\x9\x9\x9\x9\x9 \x9</span>
\x9 \x9\x9\x9 \x9\x9 \x9</div>\xa \x9 \x9 \x9</div>\xa\x9\x9\x9\x9 \x9\x9 \x9</div>\xa\x9\x9 \x9 \x9";
fF:
}
D3:
echo "\x9\x9 \x9 \x9";
B6:
echo "\x9 \x9\x9\x9\x9</div>\xa\x9\x9 \x9</div>
\x9\x9\x9\x9</div>\xa\x9\x9\x9\x9<div class="accordion d-none" id="mo-caw-adv-setting-accordion">
\x9 \x9 <div class="accordion accordion-flush" id="mo-caw-custom-sql-api-accordion-flush">
\x9 \x9\x9\x9<div class="accordion-item mb-2 borderh mo-caw-rounded-8 mo-caw-accordion-item mo-caw-element-to-toggle mo-caw-light-mode">\xa\x9\x9\x9\x9\x9\x9 <h2 class="accordion-header" id="mo-caw-custom-sql-api-adv-settings-accordion-heading">
\x9 \x9\x9 \x9<button class="accordion-button collapsed mo-caw-bg-blue-light shadow-none mo-caw-rounded-8" type="button" data-bs-toggle="collapse" data-bs-target="#mo-caw-custom-sql-api-adv-settings-accordion-collapse" aria-expanded="false" aria-controls="mo-caw-custom-sql-api-adv-settings-accordion-collapse">\xa\x9 \x9 \x9 Advance Settings
\x9 \x9 \x9 </button>
\x9\x9 \x9</h2>\xa \x9\x9\x9\x9 <div id="mo-caw-custom-sql-api-adv-settings-accordion-collapse" class="accordion-collapse collapse" aria-labelledby="mo-caw-custom-sql-api-adv-settings-accordion-heading" data-bs-parent="#mo-caw-custom-sql-api-accordion-flush">\xa\x9\x9\x9\x9\x9 \x9<div class="accordion-body">\xa\x9\x9\x9\x9 \x9 \x9<div class="row">\xa\x9\x9 \x9 \x9\x9 <div class="mb-3 col mo-caw-form-content d-none" request-methods="get post put delete">\xa \x9\x9\x9 \x9\x9\x9 \x9\x9<label for="mo-caw-custom-sql-api-response-format" class="form-label mo-caw-form-label">Response Type <i class="fas fa-info rounded-circle border pyi pxj" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Send response in default or your custom format"></i></label>
\x9\x9\x9\x9 \x9\x9 \x9\x9 <div class="d-flex justify-content-between align-items-center">\xa\x9 \x9 \x9 \x9 \x9<select class="mo-caw-crown-standard-plan mo-caw-crown-bac-plan mo-caw-crown-eai-plan form-select mo-caw-form-select mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode" id="mo-caw-response-type" name="mo-caw-custom-sql-api-response-type" aria-label="#mo-caw-custom-sql-api-method" >
\x9\x9 \x9\x9 \x9<option value="default" ";
echo !isset($this->response["response_type"]) || Constants::DEFAULT === $this->response["response_type"] ? "selected" : '';
echo ">Default</option>
\x9 \x9 \x9 \x9 \x9 \x9<option value="custom" class="mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan" ";
echo isset($this->response["response_type"]) && Constants::CUSTOM === $this->response["response_type"] ? "selected" : '';
echo ">Custom Response</option>
\x9 \x9 \x9\x9\x9</select>\xa\x9\x9\x9\x9\x9 \x9\x9 \x9\x9</div>
\x9\x9\x9\x9 \x9\x9 </div>\xa \x9 \x9\x9\x9\x9 \x9<div class="mb-3 col mo-caw-form-content d-none" request-methods="get post put delete">\xa \x9\x9 \x9\x9 \x9\x9<label for="mo-caw-custom-sql-api-response-format" class="form-label mo-caw-form-label">Response Format</label>\xa\x9 \x9\x9\x9 \x9<div class="d-flex justify-content-between align-items-center">\xa \x9\x9\x9\x9 \x9 \x9<select class="form-select mo-caw-form-select mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode" id="mo-caw-custom-sql-api-response-format" name="mo-caw-custom-sql-api-response-format" aria-label="#mo-caw-custom-sql-api-method" >
\x9\x9\x9\x9\x9\x9 \x9 <option value="json" ";
echo !isset($this->response["response_content_type"]) || Constants::JSON === $this->response["response_content_type"] ? "selected" : '';
echo ">JSON</option>\xa \x9\x9\x9 \x9\x9 \x9<option value="xml" ";
echo isset($this->response["response_content_type"]) && Constants::XML === $this->response["response_content_type"] ? "selected" : '';
echo " aria-hidden="true" hidden>XML</option>\xa\x9\x9 \x9\x9\x9\x9\x9\x9 \x9\x9</select>
\x9 \x9 \x9 \x9</div>\xa\x9 \x9\x9\x9 \x9\x9\x9\x9</div>
\x9 \x9 \x9\x9 \x9 \x9<div id="mo-caw-response-format-block" class="";
echo !isset($this->response["response_type"]) || Constants::DEFAULT === $this->response["response_type"] ? "d-none" : '';
echo "">
\x9\x9\x9 \x9\x9 \x9\x9 <ul class="nav nav-tabs nav-pills border-0 flex-column flex-sm-row text-center rounded">
\x9 \x9\x9 \x9 \x9\x9\x9 <li class="nav-item mo-caw-bg-blue-light flex-sm-fill">
\x9\x9\x9\x9\x9\x9 \x9 <a class="nav-link active" data-bs-toggle="tab" href="#mo-caw-custom-sql-api-response-type-success">Success</a>\xa \x9\x9 \x9\x9\x9\x9\x9 \x9</li>\xa \x9 \x9\x9\x9 \x9 \x9\x9<li class="nav-item mx-1 mo-caw-bg-blue-light flex-sm-fill">
\x9\x9\x9 \x9 \x9\x9 \x9\x9<a class="nav-link" data-bs-toggle="tab" href="#mo-caw-custom-sql-api-response-type-error">Error</a>\xa \x9 \x9\x9\x9 </li>\xa \x9\x9 \x9\x9 \x9\x9 <li class="nav-item mo-caw-bg-blue-light flex-sm-fill">\xa \x9 \x9\x9\x9 <a class="nav-link" data-bs-toggle="tab" href="#mo-caw-custom-sql-api-response-type-authentication">Authentication</a>
\x9\x9 \x9 \x9 \x9 </li>
\x9 \x9\x9 \x9\x9 \x9</ul>\xa\x9\x9 \x9 \x9<div class="tab-content pbk">\xa\x9\x9 \x9\x9 \x9\x9 \x9 <div class="tab-pane active" id="mo-caw-custom-sql-api-response-type-success">
\x9\x9\x9 \x9 \x9 \x9<label for="mo-caw-custom-sql-api-response-type-success-format"></label>\xa\x9 \x9\x9 \x9\x9 \x9<textarea class="form-control" placeholder="{ "message": "success", "data": "$response_data"&#; }&#;&#;" id="mo-caw-custom-sql-api-response-type-success-format" name="mo-caw-custom-sql-api-response-type-success-format" rows=0">";
echo isset($this->response["response_content"]["success"]) && !empty($this->response["response_content"]["success"]) ? esc_attr($this->response["response_content"]["success"]) : '';
echo "</textarea>\xa \x9\x9\x9 \x9\x9\x9\x9</div>
\x9 \x9\x9\x9\x9\x9 <div class="tab-pane fade" id="mo-caw-custom-sql-api-response-type-error">
\x9 \x9 \x9 \x9<label for="mo-caw-custom-sql-api-response-type-error-format"></label>\xa\x9\x9\x9 \x9 \x9\x9 \x9<textarea class="form-control" placeholder="{ "message": "error",&#; "data": "$response_data" } &0;" id="mo-caw-custom-sql-api-response-type-error-format" name="mo-caw-custom-sql-api-response-type-error-format" rows="10">";
echo isset($this->response["response_content"]["error"]) && !empty($this->response["response_content"]["error"]) ? esc_attr($this->response["response_content"]["error"]) : '';
echo "</textarea>\xa \x9\x9\x9\x9\x9\x9 \x9</div>\xa \x9\x9 \x9 \x9\x9\x9<div class="tab-pane fade" id="mo-caw-custom-sql-api-response-type-authentication">
\x9\x9 \x9 \x9 \x9\x9\x9 \x9\x9<label for="mo-caw-custom-sql-api-response-type-authentication-format"></label>\xa \x9 \x9\x9 \x9 \x9 <textarea class="form-control" placeholder="{ &0; "message": "authentication_error", &0; "data": "$response_data"&3;&0;}&#; " id="mo-caw-custom-sql-api-response-type-authentication-format" name="mo-caw-custom-sql-api-response-type-authentication-format" rows="10">";
echo isset($this->response["response_content"]["authentication"]) && !empty($this->response["response_content"]["authentication"]) ? esc_attr($this->response["response_content"]["authentication"]) : '';
echo "</textarea>
\x9\x9 \x9\x9\x9 \x9\x9</div>
\x9\x9\x9\x9 \x9\x9\x9 </div>
\x9 \x9 \x9</div>\xa\x9\x9 \x9 </div>\xa\x9\x9\x9\x9 \x9 \x9 \x9<div class="mbk">\xa\x9\x9 \x9\x9 \x9<label for="mo-caw-custom-sql-api-allowed-roles" class="form-label mo-caw-form-label">Restrict role-based access</label>\xa \x9\x9\x9 \x9\x9\x9 \x9<div class="dropdown mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan" >
\x9 \x9\x9 \x9\x9\x9\x9<button class="mo-caw-disable-standard-plan mo-caw-crown-standard-plan mo-caw-disable-bac-plan mo-caw-crown-bac-plan mo-caw-disable-eai-plan mo-caw-crown-eai-plan btn dropdown-toggle mo-caw-dropdown-toggle w-1 bg-white mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode mo-caw-text-grey-medium d-flex justify-content-between align-items-center" type="button" id="mo-caw-custom-sql-api-allowed-roles-dropdown" data-bs-toggle="dropdown" aria-expanded="false">
\x9 \x9 \x9 \x9 \x9 ";
echo !empty($this->blocked_roles) ? "Selected (" . count($this->blocked_roles) . ")" : "Select Roles";
echo "\x9 \x9\x9\x9 \x9 \x9 </button>\xa \x9\x9 \x9 \x9 \x9\x9\x9 <div class="dropdown-menu mo-caw-dropdown-menu w-0" aria-labelledby="mo-caw-custom-sql-api-allowed-roles-dropdown">
\x9\x9 \x9 \x9 \x9 <div class="form-check d-flex align-items-center p-2">
\x9 \x9\x9 \x9\x9 \x9 <input class="form-check-input m-0 bg-white mo-caw-select-all-checkbox me-2" type="checkbox" value="" id="mo-caw-custom-sql-api-allowed-roles-select-all" data-target="mo-caw-custom-sql-api-allowed-roles" ";
echo count($this->blocked_roles) === count($i2) ? "checked" : '';
echo ">
\x9\x9 \x9\x9 \x9\x9 \x9\x9 \x9<label class="form-check-label" for="mo-caw-custom-sql-api-allowed-roles-select-all">Select All</label>
\x9 \x9\x9 \x9\x9 \x9\x9\x9</div>
\x9\x9 \x9 \x9 \x9";
foreach ($i2 as $gZ => $al) {
echo "\x9 \x9 \x9\x9 \x9\x9\x9<div class="form-check d-flex align-items-center p-2">
\x9 \x9\x9 \x9 \x9\x9\x9\x9<input class="form-check-input m-0 bg-white mo-caw-custom-sql-api-allowed-roles me-2" type="checkbox" value="";
echo esc_attr($al);
echo "" id="mo-caw-custom-sql-api-allowed-roles-";
echo esc_attr($gZ);
echo "" name="mo-caw-custom-sql-api-allowed-roles[]" ";
echo in_array($al, $this->blocked_roles, true) ? "checked" : '';
echo ">
\x9\x9\x9\x9 \x9 \x9\x9 \x9 <label class="form-check-label" for="mo-caw-custom-sql-api-allowed-roles-";
echo esc_attr($gZ);
echo "">";
echo esc_attr($Ra[$gZ]);
echo "</label>
\x9\x9 \x9 \x9\x9\x9 \x9</div>\xa \x9\x9 \x9\x9\x9";
Hk:
}
FR:
echo "\x9 \x9\x9 </div>\xa\x9 \x9 \x9 </div>\xa\x9\x9 \x9\x9 \x9 \x9</div>
\x9 \x9 </div>
\x9 \x9 \x9\x9</div>
\x9\x9 \x9\x9</div>\xa \x9\x9 </div>
\x9 </div>\xa </div>
\x9\x9</form>
<div class="modal fade mo-caw-export-modal" id="mo-caw-custom-sql-api-test-inputs-modal" tabindex="-1" aria-labelledby="mo-caw-custom-sql-api-test-inputs-modal-label" aria-hidden="true">
\x9 <div class="modal-dialog modal-dialog-centered justify-content-center">\xa \x9 \x9<form method="POST" id="mo-caw-custom-sql-api-test-inputs-form">\xa \x9\x9\x9 <div class="modal-content">\xa\x9 \x9 \x9<div class="modal-header">\xa\x9 \x9\x9\x9 \x9<h5 class="modal-title" id="mo-caw-custom-sql-api-test-inputs-modal-label">Values to run test</h5>\xa \x9 \x9 \x9 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
\x9 \x9 </div>\xa \x9 \x9<div class="modal-body">
\x9\x9\x9\x9\x9\x9</div>
\x9 \x9\x9<div class="modal-footer d-md-flex justify-content-md-center">\xa \x9\x9 \x9 <button class="btn btn-primary mo-caw-bg-blue-medium mo-caw-rounded-16" type="button" onclick="moCawGetCustomAPITestResult('";
echo esc_attr(site_url());
echo "')">Continue</button>\xa\x9 \x9\x9\x9 </div>
\x9 </div>
\x9\x9</form>\xa\x9 </div>
</div>\xa\x9\x9";
if (!$iZ) {
goto EB;
}
echo " \x9\x9<div class="d-flex justify-content-between align-items-end my-4">
\x9 \x9<div class="d-flex justify-content-center align-items-baseline">
\x9 <h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">Test Results</h6>\xa\x9\x9 \x9\x9<span class="ms-2 badge rounded-pill" id="mo-caw-custom-sql-api-test-result-status"></span>\xa \x9</div>\xa\x9 \x9</div>
\x9<div class="bg-white mo-caw-shadow p-3 mo-caw-roundedi6 mo-caw-test-result" id="mo-caw-custom-sql-api-test-result">
\x9 </div>
\x9\x9";
EB:
echo "\x9 ";
}
private function display_api_creation_view()
{
$G8 = site_url() . "/wp-json/" . $this->namespace . "/" . $this->api_name;
$N6 = implode('', $this->queries);
$Mn = "/{{([A-Za-z0-9-_]+)}}/";
preg_match_all($Mn, $N6, $MT);
$zp = $MT[1];
if (!(Constants::HTTP_GET === $this->method || Constants::HTTP_DELETE === $this->method)) {
goto id;
}
if (!(count($zp) > 0)) {
goto Jj;
}
$zp = array_values(array_unique($zp));
foreach ($zp as $O4) {
$EA[$O4] = "<" . $O4 . ">";
a6:
}
Gm:
$G8 = add_query_arg($EA, $G8);
Jj:
id:
echo "\x9\x9<div class="d-flex justify-content-between align-items-end mb-4">
\x9\x9<h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">";
echo "View API - " . esc_attr($this->api_name);
echo "</h6>
\x9 <div class="d-grid gap-2 d-md-block">\xa \x9 <button class="btn mo-caw-btn-outline-blue-medium mo-caw-rounded-16 mo-caw-bg-blue-dark px-4 ";
echo esc_attr($this->license_status);
echo "" type="submit" aria-hidden="true" hidden>Export Postman Collection</button> \xa\x9 <a class="btn mo-caw-btn-outline-blue-medium mo-caw-roundedi6 px-4 mo-caw-element-to-toggle mo-caw-light-mode ";
echo esc_attr($this->license_status);
echo "" type="button" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=test&api-name=" . $this->api_name . "&method=" . $this->method . "&namespace=" . $this->namespace . "&test-mode=true", "MO_CAW_SQL_API_Creation_Test_Nonce"));
echo "">Test</a>\xa\x9\x9 <a class="btn btn-primary mo-caw-rounded-16 mo-caw-bg-blue-dark px-4 ";
echo esc_attr($this->license_status);
echo "" type="button" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=edit&api-name=" . $this->api_name . "&method=" . $this->method . "&namespace=" . $this->namespace, "MO_CAW_SQL_API_Creation_Edit_Nonce"));
echo "">Edit API</a>
\x9\x9\x9</div>
\x9</div>
\x9<div class="bg-white mo-caw-shadow p-3 mo-caw-roundedi6">\xa \x9 <div class="input-group mb-3">\xa \x9\x9 <span class="input-group-text mo-caw-";
echo esc_attr($this->method);
echo "-method borderh fs-6 px-3">";
echo esc_attr(strtoupper($this->method));
echo "</span>\xa\x9 \x9 <input type="text" class="form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode border-end-0 border-starth bg-white fs-6" aria-label="" placeholder="https://<your_domain>/wp-json/<namespace>/<api-name>?<params>" value="";
echo esc_attr($G8);
echo "" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Any parameters enclosed within <> should be replaced with actual values" aria-readonly="true" readonly> \xa\x9 <span class="input-group-text bg-white mo-caw-cursor-pointer fs-6 mo-caw-copy-icon" data-bs-toggle="tooltip" data-bs-placement="right" title="Copy API Endpoint"><i class="far fa-copy fa-lg"></i></span>\xa\x9\x9 </div>\xa \x9 ";
if (!((Constants::HTTP_POST === $this->method || Constants::HTTP_PUT === $this->method) && count($zp))) {
goto Ow;
}
$t2 = array_fill_keys($zp, "value");
$vC = wp_json_encode($t2, JSON_PRETTY_PRINT);
echo "\x9\x9\x9\x9<h6 class="mb-3 mo-caw-element-to-toggle mo-caw-light-mode">Required parameters for Custom APIs</h6>\xa\x9\x9\x9\x9<div id="mo-caw-external-api-request-format-block">
\x9\x9 \x9 <ul class="nav nav-tabs nav-pills border-0 flex-column flex-sm-row text-center rounded mb-2">
\x9\x9 \x9\x9<li class="nav-item mo-caw-bg-blue-light flex-sm-fill col-6 px-0">\xa \x9\x9 <a class="nav-link active" data-bs-toggle="tab" href="#mo-caw-external-api-request-format-x-www">X-WWW-FORM-URLENCODED</a>\xa\x9\x9\x9 \x9 </li>
\x9\x9\x9\x9\x9 <li class="nav-item mo-caw-bg-blue-light flex-sm-fill coln pxh">\xa \x9 \x9 <a class="nav-link" data-bs-toggle="tab" href="#mo-caw-external-api-request-format-json">JSON</a>
\x9\x9\x9 </li>
\x9 \x9</ul>\xa \x9 \x9</div>\xa \x9 <div class="tab-content pb-3">\xa \x9\x9 <div class="tab-pane active" id="mo-caw-external-api-request-format-x-www">\xa \x9 \x9<div>\xa\x9\x9 \x9\x9\x9\x9<table class="table text-center fsn border border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa\x9 \x9\x9<thead>
\x9\x9\x9\x9\x9 \x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa\x9 \x9\x9 \x9\x9 <th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-mdk p-3 align-middle">Header Name</th>
\x9\x9\x9\x9\x9 \x9<th scope="col" class="borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3 align-middle">Header Value</th>
\x9\x9\x9\x9\x9 </tr>\xa \x9 \x9\x9\x9 \x9</thead>
\x9 \x9 \x9<tbody>
\x9\x9 \x9 \x9 \x9<tr>
\x9 \x9 \x9 <td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode pk align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Required if using POST/PUT method with x-www-form-urlencoded format">Content-Type</td>\xa\x9 \x9 \x9\x9\x9<td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">";
echo esc_html(Constants::X_WWW_HEADER_NAME);
echo "</td>\xa\x9 \x9 \x9\x9\x9</tbody>\xa\x9\x9\x9 \x9\x9 </table>
\x9 \x9\x9\x9 <div class="overflow-auto mh- mo-caw-table-wrapper" >
\x9 \x9 \x9 <table class="table text-center fsn border border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9\x9 \x9\x9 \x9<thead class="sticky-top">
\x9\x9\x9\x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9 \x9\x9\x9 \x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottomh col-mdk pk align-middle">Body Parameter Name</th>
\x9\x9 \x9 <th scope="col" class="borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-mdk pk align-middle">Body Parameter Value</th>\xa \x9 \x9 \x9 \x9</tr>\xa \x9\x9\x9\x9 \x9 </thead>
\x9\x9 \x9\x9\x9\x9 <tbody>
\x9 \x9\x9\x9 \x9 ";
foreach ($zp as $O0 => $I4) {
echo "\x9 \x9 \x9<tr>\xa \x9\x9 \x9 \x9 <td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Required if using x-www-form-urlencoded format">";
echo esc_html($I4);
echo "</td>
\x9\x9\x9 \x9 \x9\x9 \x9<td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">Column Value</td>\xa \x9 \x9\x9 \x9 \x9 </tr>
\x9 \x9\x9\x9 \x9 ";
i0:
}
Je:
echo " \x9\x9\x9\x9\x9 \x9</tbody>
\x9 \x9</table>
\x9 \x9\x9 </div>\xa \x9\x9\x9 </div>\xa\x9 \x9 </div>\xa \x9 <div class="tab-pane fade" id="mo-caw-external-api-request-format-json">\xa\x9 \x9 \x9<div>
\x9 \x9\x9 \x9<table class="table text-center fs-6 border borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9\x9\x9 <thead>\xa \x9\x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9 \x9\x9\x9\x9 <th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-mdk p-3 align-middle">Header Name</th>
\x9\x9 \x9 \x9<th scope="col" class="borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3 align-middle">Header Value</th>\xa \x9\x9\x9 \x9</tr>\xa\x9 \x9\x9 </thead>
\x9 \x9 \x9 \x9<tbody>\xa \x9 \x9\x9\x9\x9\x9<tr>\xa \x9\x9\x9 \x9 \x9<td class="col-mdk border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Required if using POST/PUT method with application/json format">Content-Type</td>
\x9 \x9\x9 \x9\x9 <td class="col-mdk border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">";
echo esc_html(Constants::JSON_HEADER_NAME);
echo "</td>
\x9 </tr>
\x9 </tbody>\xa\x9 \x9 \x9\x9</table>\xa \x9\x9 <table class="table text-center fsn border border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9 \x9\x9 \x9<thead>
\x9\x9\x9 \x9 \x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9 \x9\x9\x9 \x9\x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3 align-middle">Body</th>
\x9 \x9\x9 \x9\x9 </tr>\xa \x9\x9\x9 \x9 \x9</thead>
\x9 \x9</table>\xa \x9 \x9\x9\x9 <div>\xa\x9 \x9 \x9\x9 <textarea class="form-control mo-caw-form-control py-1" id="mo-caw-external-api-json-body" name="mo-caw-external-api-json-body" placeholder="Add JSON body" rows="10">";
echo esc_attr($vC);
echo "</textarea>\xa\x9\x9\x9\x9\x9\x9\x9</div>\xa\x9 \x9\x9\x9</div>\xa\x9\x9 </div>\xa\x9\x9\x9 </div>\xa\x9 \x9";
Ow:
echo " \x9 <div class="mt-4">
\x9\x9 <h6 class="mb-3 mo-caw-element-to-toggle mo-caw-light-mode">Request parameters for Pagination <em class="fw-normal">(Optional)</em></h6>\xa \x9\x9\x9<table class="table text-center fs-6 border border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9 <thead>
\x9<tr class="mo-caw-bg-blue-light mo-caw-rounded-top borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9 \x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottomh col-mdk p-3 align-middle">Parameter Name</th>\xa \x9 \x9\x9 <th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3 align-middle">Description</th>
\x9\x9\x9\x9 </tr>
\x9 \x9</thead>\xa \x9\x9 \x9<tbody>\xa \x9 \x9\x9 <tr>\xa \x9\x9\x9 \x9<td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Required if using pagination">size</td>
\x9\x9\x9 \x9\x9<td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">Defines page size</td>\xa \x9\x9\x9 </tr>
\x9\x9\x9\x9<tr>\xa \x9 \x9\x9 \x9<td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Optional in pagination">page</td>
\x9\x9 \x9\x9\x9 <td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">Page number needed in the response <em>(starts from 1)</em></td>\xa \x9 \x9\x9</tr>
\x9 <tr>\xa \x9\x9\x9\x9\x9\x9<td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode pk align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Optional in pagination">offset</td>\xa\x9 \x9\x9 \x9<td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">Defines from which count number to start returning data <em>(starts from)</em></td>\xa \x9 \x9</tr>\xa \x9\x9 \x9</tbody>
\x9 \x9 </table>
\x9 \x9</div>\xa </div>
\x9<div class="d-flex justify-content-between align-items-end my-4 d-none">
\x9 \x9<h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">Code Snippets</h6>\xa\x9\x9\x9<div class="dropdown">\xa \x9\x9<button class="btn mo-caw-btn-outline-blue-medium dropdown-toggle mo-caw-rounded- mo-caw-dropdown-toggle mo-caw-element-to-toggle mo-caw-light-mode" type="button" id="mo-caw-custom-sql-api-test-result-dropdown" data-bs-toggle="dropdown" aria-expanded="false" ";
echo esc_attr($this->license_status);
echo ">
\x9 \x9 Select Language\xa \x9</button>
\x9\x9\x9\x9<ul class="dropdown-menu mo-caw-dropdown-menu" aria-labelledby="mo-caw-custom-sql-api-test-result-dropdown">\xa\x9 \x9\x9\x9<li><a class="dropdown-item" href="#">Node.js</a></li>
\x9\x9\x9\x9 <li><a class="dropdown-item" href="#">PHP</a></li>\xa \x9 <li><a class="dropdown-item" href="#">Python</a></li>
\x9 \x9</ul>\xa \x9</div>\xa\x9 </div>
\x9 <div class="bg-white mo-caw-shadow p-3 mo-caw-roundedi6 d-none">\xa\x9 <pre>
\x9\x9\x9\x9const axios = require('axios');
\x9 const url = 'http://localhost/wp_1/wp-json/mo/v1/bghfx/{args}/{attempts}';\xa\xa \x9axios.get(url)\xa \x9 .then(response => {\xa\x9\x9 \x9\x9console.log(response.data);
\x9 \x9 })
\x9.catch(error => {\xa \x9 console.error('Request failed:', error);
\x9\x9 });
\x9\x9</pre>
</div>
\x9";
}
private function display_api_creation_export()
{
}
}
namespace MO_CAW\Common\Views;
use MO_CAW\Common\Utils;
use MO_CAW\Common\DB_Utils;
use MO_CAW\Common\Constants;
class SQL_API_Creation
{
private $api_name = '';
private $namespace = "mo/v1";
private $method = Constants::HTTP_GET;
private $queries = array();
private $response = array();
private $blocked_roles = array();
private $sql_endpoint_config = array();
protected $license_status = '';
private $plan_status = "disabled";
public function __construct($gt)
{
if (!(isset($_GET["_wpnonce"]) && check_admin_referer("MO_CAW_SQL_API_Creation_" . ucfirst($gt) . "_Nonce", "_wpnonce"))) {
goto WO;
}
$DT = isset($_SESSION["MO_CAW_SQL_API_Creation_Form_Data"]) ? wp_unslash($_SESSION["MO_CAW_SQL_API_Creation_Form_Data"]) : array();
Utils::sanitize_nested_array($DT);
$this->sql_endpoint_config = !empty($DT) ? $DT : $this->sql_endpoint_config;
if (Constants::EDIT === $gt || Constants::VIEW === $gt || Constants::TEST === $gt || Constants::DELETE === $gt) {
goto ma;
}
if (Constants::ADD === $gt && Constants::DISABLED !== $this->license_status) {
goto q0;
}
goto ks;
ma:
$this->api_name = isset($_GET["api-name"]) ? sanitize_text_field(wp_unslash($_GET["api-name"])) : $this->api_name;
$this->method = isset($_GET["method"]) ? sanitize_text_field(wp_unslash($_GET["method"])) : $this->method;
$this->namespace = isset($_GET["namespace"]) ? sanitize_text_field(wp_unslash($_GET["namespace"])) : $this->namespace;
$UK = array("connection_name" => $this->api_name, "type" => Constants::SQL_ENDPOINT, "method" => $this->method, "namespace" => $this->namespace);
$this->sql_endpoint_config = empty($this->sql_endpoint_config) ? DB_Utils::get_configuration($UK)[0] : $this->sql_endpoint_config;
goto ks;
q0:
$this->namespace = $this->sql_endpoint_config["namespace"] ?? $this->namespace;
$this->method = $this->sql_endpoint_config["method"] ?? $this->method;
$this->api_name = $this->sql_endpoint_config["connection_name"] ?? $this->api_name;
ks:
$this->response = $this->sql_endpoint_config["configuration"]["response"] ?? array();
$this->blocked_roles = $this->sql_endpoint_config["configuration"]["blocked_roles"] ?? array();
$this->queries = $this->sql_endpoint_config["configuration"]["sql_queries"] ?? array();
WO:
}
public function display_sql_api_creation_ui($Z5, $gt)
{
switch ($gt) {
case Constants::ADD:
$this->display_api_creation_add_or_edit($gt);
goto A7;
case Constants::VIEW:
$this->display_api_creation_view();
goto A7;
case Constants::EDIT:
$this->display_api_creation_add_or_edit($gt);
goto A7;
case Constants::TEST:
$this->display_api_creation_add_or_edit($gt);
goto A7;
case "export":
$this->display_api_creation_export();
goto A7;
default:
$this->display_api_creation_all_config();
goto A7;
}
jo:
A7:
}
private function display_api_creation_all_config()
{
$UK["type"] = Constants::SQL_ENDPOINT;
$Pe = DB_Utils::get_configuration($UK);
$Pe = Utils::organize_endpoints_by_namespace($Pe);
echo "\x9 <div class="d-flex justify-content-between align-items-center mb-4">
\x9\x9 <h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">Configured SQL APIs</h6>\xa\x9 <div class="d-grid gap-2 d-md-block">
\x9 \x9\x9<button class="btn mo-caw-btn-outline-blue-medium mo-caw-roundedi6 pxl mo-caw-element-to-toggle mo-caw-light-mode ";
echo esc_attr($this->license_status);
echo "" method="button" data-bs-toggle="modal" data-bs-target="#" aria-hidden="true" hidden>Export Postman Collection</button>
\x9\x9 <button class="btn btn-primary mo-caw-rounded-16 mo-caw-bg-blue-dark px-4 ";
echo esc_attr($this->license_status);
echo " ";
echo !empty($Pe) ? "mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan mo-caw-add-standard-tooltip mo-caw-add-bac-tooltip mo-caw-add-eai-tooltip" : '';
echo "" method="button" type="button" onclick="window.location.href = '";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=add", "MO_CAW_SQL_API_Creation_Add_Nonce"));
echo "'">Create SQL API</button>\xa\x9\x9\x9</div>\xa <div class="modal fade mo-caw-export-modal" id="mo-caw-custom-sql-api-export-modal" tabindex="-1" aria-labelledby="mo-caw-custom-sql-api-export-modal-label" aria-hidden="true">\xa \x9 \x9<div class="modal-dialog modal-dialog-centered justify-content-center">\xa\x9\x9\x9 \x9<form method="POST">
\x9 \x9\x9";
wp_nonce_field("MO_CAW_SQL_API_Creation_Export", "MO_CAW_SQL_API_Creation_Nonce");
echo "\x9 \x9 \x9\x9<div class="modal-content">\xa \x9 \x9 \x9<div class="modal-header">\xa\x9\x9 \x9\x9\x9\x9\x9<h5 class="modal-title" id="mo-caw-custom-sql-api-export-modal-label">Export Data</h5>\xa\x9 \x9 \x9\x9 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>\xa\x9\x9\x9\x9 </div>
\x9\x9\x9\x9\x9\x9<div class="modal-body">\xa\x9 \x9\x9\x9 <h6 class="mo-caw-element-to-toggle mo-caw-light-mode">Select namespaces to export</h6>
\x9 \x9 \x9\x9<div class="form-check d-flex align-items-center justify-content-start p-2">
\x9 \x9\x9\x9\x9\x9 <input class="form-check-input m-0 bg-white mej mo-caw-select-all-checkbox" type="checkbox" value="" id="mo-caw-custom-sql-api-export-select-all" data-target="mo-caw-custom-sql-api-export">
\x9\x9\x9 \x9\x9\x9\x9<label class="form-check-label" for="mo-caw-custom-sql-api-export-select-all">Select All</label>
\x9\x9\x9\x9 \x9 </div>
\x9 \x9\x9\x9\x9";
foreach ($Pe as $Qi => $J1) {
echo " \x9 \x9\x9\x9<div class="form-check d-flex align-items-center justify-content-start p-2">\xa \x9\x9 \x9 \x9\x9<input class="form-check-input mh bg-white me-2 mo-caw-custom-sql-api-export" type="checkbox" value="";
echo esc_attr($Qi);
echo "" id="mo-caw-custom-sql-api-export-";
echo esc_attr($Qi);
echo "" name="mo-caw-custom-sql-api-export[]">\xa \x9 \x9 \x9 \x9<label class="form-check-label" for="mo-caw-custom-sql-api-export-";
echo esc_attr($Qi);
echo "">";
echo esc_attr($Qi);
echo "</label>
\x9 \x9\x9\x9\x9</div>
\x9 \x9 \x9 ";
rE:
}
mI:
echo "\x9 \x9\x9 \x9\x9</div>
\x9\x9 \x9<div class="modal-footer d-md-flex justify-content-md-center">\xa \x9 \x9 \x9 <button class="btn btn-primary mo-caw-bg-blue-medium mo-caw-rounded-16" type="submit">Export</button>\xa\x9\x9\x9\x9\x9\x9 </div>
\x9 \x9\x9\x9\x9</div>
\x9\x9 \x9 </form>
\x9 </div>
</div>
\x9 </div>\xa ";
if (!empty($Pe)) {
goto mO;
}
echo "\x9\x9 <div class="d-flex align-items-center flex-column">\xa \x9\x9<img src="";
echo esc_url(MO_CUSTOM_API_URL . "classes/Common/Resources/Images/not-found.jpeg");
echo "" width="4px" >
\x9\x9\x9<h6 class="mtm text-secondary">Oops! Seems like you have not created any Custom SQL APIs.</h6>
\x9\x9\x9</div>\xa\x9\x9";
goto ej;
mO:
echo "\x9 \x9<div class="accordion" id="mo-caw-custom-sql-api-accordion">
\x9 \x9<div class="accordion accordion-flush" id="mo-caw-custom-sql-api-accordion-flush">\xa \x9 ";
$gZ = 0;
echo " \x9 ";
foreach ($Pe as $Qi => $J1) {
echo " \x9\x9 <div class="accordion-item mo-caw-accordion-item mbj border-0 mo-caw-rounded-8 mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9\x9\x9\x9 <h2 class="accordion-header" id="mo-caw-custom-sql-api-config-accordion-";
echo esc_attr($gZ);
echo "">\xa \x9 \x9<button class="accordion-button mo-caw-bg-blue-light fw-normal shadow-none mo-caw-rounded-8 ";
echo 0 === $gZ ? '' : "collapsed";
echo "" type="button" data-bs-toggle="collapse" data-bs-target="#mo-caw-create-api-accordion-collapse-";
echo esc_attr($gZ);
echo "" aria-expanded="false" aria-controls="flush-collapseOne">";
echo esc_attr($Qi);
echo "</button>\xa \x9\x9 \x9 </h2>
\x9\x9 \x9<div id="mo-caw-create-api-accordion-collapse-";
echo esc_attr($gZ);
echo "" class="accordion-collapse collapse ";
echo 0 === $gZ ? "show" : '';
echo "" aria-labelledby="mo-caw-custom-sql-api-config-accordion-";
echo esc_attr($gZ);
echo "" data-bs-parent="#mo-caw-custom-sql-api-accordion-flush">\xa\x9\x9\x9 \x9\x9\x9<div class="accordion-body">\xa \x9 \x9\x9\x9<table class="table text-center fs-6 border borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9\x9\x9 \x9<thead>\xa \x9 \x9 \x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9\x9 \x9 \x9\x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3">API Name</th>\xa \x9\x9 \x9\x9 \x9\x9<th scope="col" class="borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottomh col-mdk p-3">Method</th>\xa \x9\x9 \x9\x9 \x9 \x9\x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3">Enable/Disable</th>\xa \x9\x9 \x9 \x9\x9 \x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottomh col-md-3 p-3">Actions</th>\xa\x9 \x9\x9 \x9\x9 </tr>
\x9 \x9\x9 \x9\x9 </thead>
\x9\x9\x9\x9 \x9\x9\x9 <tbody>\xa\x9\x9 \x9 \x9\x9 ";
foreach ($J1 as $jS => $Uq) {
echo " \x9\x9 <tr>
\x9\x9\x9 \x9\x9\x9 <td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">";
echo esc_attr($Uq["connection_name"]);
echo "</td>\xa\x9\x9 \x9\x9\x9\x9\x9\x9<td class="col-mdk border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle"><span class="rounded-pill py-2 px-4 mo-caw-";
echo esc_attr($Uq["method"]);
echo "-method">";
echo esc_attr(strtoupper($Uq["method"]));
echo "</span></td>\xa\x9\x9\x9 \x9\x9 \x9\x9 <td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">\xa\x9 \x9 \x9 <div class="form-check form-switch d-flex justify-content-center align-items-center">\xa\x9\x9 \x9 \x9 \x9\x9 <input class="form-check-input mo-caw-toggle-switch" type="checkbox" onchange="moCawEnableDisableApi(this, '";
echo esc_attr(wp_create_nonce("mo_caw_custom_sql_api_enable_disable_api"));
echo "', '";
echo esc_attr($Uq["connection_name"]);
echo "', '";
echo esc_attr($Uq["method"]);
echo "', '";
echo esc_attr($Qi);
echo "', '";
echo esc_attr(Constants::SQL_ENDPOINT);
echo "')"
\x9 \x9\x9 \x9\x9\x9";
echo !isset($Uq["is_enabled"]) || $Uq["is_enabled"] ? "checked " : '';
echo esc_attr($this->license_status);
echo "\x9 \x9\x9 \x9 >
\x9 \x9 \x9\x9 </div>\xa \x9 \x9 </td>
\x9 \x9\x9 <td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">\xa \x9\x9 \x9\x9 \x9\x9\x9 <div class="dropdown">
\x9 \x9\x9\x9 \x9\x9\x9<button class="btn btn-secondary dropdown-toggle mo-caw-dropdown-toggle rounded-pill mo-caw-bg-grey-light border-0 mo-caw-text-grey-medium" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">Pick an option</button>\xa\x9 \x9 \x9\x9 \x9 <ul class="dropdown-menu mo-caw-dropdown-menu" aria-labelledby="dropdownMenuButton1">
\x9\x9 \x9\x9 \x9 <li><a class="dropdown-item d-flex align-items-center justify-content-between" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=view&api-name=" . $Uq["connection_name"] . "&method=" . $Uq["method"] . "&namespace=" . $Qi, "MO_CAW_SQL_API_Creation_View_Nonce"));
echo ""><span>View</span><i class="far fa-eye mo-caw-text-black"></i></a></li>\xa\x9 \x9 \x9\x9\x9\x9 \x9\x9 <li><a class="dropdown-item d-flex align-items-center justify-content-between ";
echo esc_attr($this->license_status);
echo "" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=edit&api-name=" . $Uq["connection_name"] . "&method=" . $Uq["method"] . "&namespace=" . $Qi, "MO_CAW_SQL_API_Creation_Edit_Nonce"));
echo ""><span>Edit</span><i class="fas fa-pencil mo-caw-text-black"></i></a></li>\xa \x9\x9 \x9 \x9 \x9 \x9\x9<li><a class="dropdown-item d-flex align-items-center justify-content-between ";
echo esc_attr($this->license_status);
echo "" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=test&api-name=" . $Uq["connection_name"] . "&method=" . $Uq["method"] . "&namespace=" . $Qi . "&test-mode=true", "MO_CAW_SQL_API_Creation_Test_Nonce"));
echo ""><span>Test</span><i class="fas fa-check mo-caw-text-black"></i></a></li>\xa\x9\x9 \x9\x9\x9 \x9 \x9\x9\x9<li><a class="dropdown-item d-flex align-items-center justify-content-between ";
echo esc_attr($this->license_status);
echo "" onclick="if(confirm('Are you sure you want to delete this API?')){document.getElementById('mo-caw-api-creation-delete-form-";
echo esc_attr($Uq["connection_name"]) . "-" . esc_attr($Uq["method"]) . "-" . esc_attr($Qi);
echo "').submit(); return false;}"><span>Delete</span><i class="far fa-trash-can mo-caw-text-black"></i></a></li>\xa\x9\x9\x9 \x9 </ul>
\x9\x9 \x9 \x9\x9</div>\xa \x9 \x9 <form method="POST" id="mo-caw-api-creation-delete-form-";
echo esc_attr($Uq["connection_name"]) . "-" . esc_attr($Uq["method"]) . "-" . esc_attr($Qi);
echo "">\xa\x9 \x9 \x9 \x9 \x9 ";
wp_nonce_field("MO_CAW_SQL_API_Creation_Delete", "MO_CAW_SQL_API_Creation_Nonce");
echo " \x9 <input type="hidden" name="api-name" value="";
echo esc_attr($Uq["connection_name"]);
echo "">\xa\x9 \x9 \x9 \x9 \x9 <input type="hidden" name="method" value="";
echo esc_attr($Uq["method"]);
echo "">
\x9\x9\x9\x9\x9\x9\x9 \x9 <input type="hidden" name="namespace" value="";
echo esc_attr($Qi);
echo "">\xa\x9\x9 \x9 </form>
\x9\x9 \x9\x9 \x9</td>
\x9\x9 \x9\x9\x9 \x9\x9</tr>\xa\x9\x9\x9 \x9\x9\x9";
L7:
}
yG:
echo " \x9 \x9\x9\x9\x9</tbody>\xa\x9\x9 \x9\x9 </table>\xa\x9 \x9\x9 \x9</div>\xa \x9\x9\x9 </div>
\x9 \x9\x9 </div>\xa\x9 \x9 ";
++$gZ;
echo " \x9\x9\x9";
KO:
}
tA:
echo " \x9\x9 </div>\xa </div>\xa ";
ej:
echo "\x9 ";
}
private function display_api_creation_add_or_edit($gt)
{
global $wp_roles;
$nt = $wp_roles->roles;
$Ra = array();
$i2 = array_keys($nt);
foreach ($nt as $gZ => $tW) {
array_push($Ra, $tW["name"]);
Vi:
}
sV:
$ax = array("type" => Constants::SQL_ENDPOINT);
$mP = DB_Utils::get_all_namespaces($ax);
$iT = array();
foreach ($mP as $Qi) {
if (in_array($Qi->namespace, $iT, true)) {
goto HH;
}
array_push($iT, $Qi->namespace);
HH:
NR:
}
wN:
$iZ = isset($_GET["test-mode"]) ? filter_var(sanitize_text_field(wp_unslash($_GET["test-mode"])), FILTER_VALIDATE_BOOLEAN) : false;
echo "\x9 <form method="POST" id="mo-caw-custom-sql-api-form" class="mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9\x9";
wp_nonce_field("MO_CAW_SQL_API_Creation", "MO_CAW_SQL_API_Creation_Nonce");
echo " \x9<input type="hidden" id="mo-caw-custom-sql-api-test-mode" name="mo-caw-custom-sql-api-test-mode" value="false">\xa \x9 <div class="d-flex justify-content-between align-items-end mbl">\xa \x9<h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">";
echo Constants::ADD === $gt ? "Create Custom API" : "Edit API - " . esc_attr($this->api_name);
echo "</h6>\xa \x9\x9 <div class="d-grid gap-2 d-md-block">
\x9 \x9<button class="btn mo-caw-btn-outline-blue-medium mo-caw-rounded-16 px-4 mo-caw-element-to-toggle mo-caw-light-mode ";
echo esc_attr($this->license_status);
echo "" type="button"
\x9 \x9";
if (!(Constants::DISABLED !== $this->license_status)) {
goto g_;
}
echo esc_attr("onclick=moCawEnableTestMode()");
g_:
echo " \x9 \x9>Test</button>\xa \x9\x9\x9<button class="btn btn-primary mo-caw-roundedi6 mo-caw-bg-blue-dark px-4 ";
echo esc_attr($this->license_status);
echo "" type="submit" id="mo-caw-custom-sql-api-form-submit">Save</button>
\x9\x9 \x9</div>\xa \x9\x9</div>\xa\x9 \x9<div class="bg-white mo-caw-shadow p-3 mo-caw-rounded-16">
\x9\x9 \x9<div class="mbk">
\x9 \x9 <label for="mo-caw-custom-sql-api-namespace" class="form-label mo-caw-form-label">Custom Namespace</label>
\x9\x9\x9 <div class="d-flex justify-content-between align-items-center">\xa\x9\x9 \x9 \x9<input type="text" class="mo-caw-disable-standard-plan mo-caw-crown-standard-plan mo-caw-disable-bac-plan mo-caw-crown-bac-plan mo-caw-disable-eai-plan mo-caw-crown-eai-plan form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode py-1 px-2" id="mo-caw-custom-sql-api-namespace" name="mo-caw-custom-sql-api-namespace" value="";
echo esc_attr($this->namespace);
echo "" placeholder="Custom Namespace (eg. mo/v1)" list="mo-caw-custom-sql-api-namespace-list" pattern="^(?=.{1,}$)[A-Za-z]+/v[0-9]+$" title="Namespace must be of max length 15 and contain at least one '/' in between, [A-Z, a-z] before '/', 'v' (denoting version) and numbers only after '/'" aria-required="true" required ";
echo Constants::EDIT === $gt || Constants::TEST === $gt ? "disabled" : '';
echo ">\xa\x9 \x9 ";
if (!(Constants::EDIT === $gt || Constants::TEST === $gt)) {
goto AE;
}
echo " \x9\x9 \x9 <input type="hidden" name="mo-caw-custom-sql-api-namespace" value="";
echo esc_attr($this->namespace);
echo "">
\x9\x9 \x9\x9\x9";
AE:
echo "\x9 \x9\x9\x9</div>\xa\x9 <datalist id="mo-caw-custom-sql-api-namespace-list">
\x9\x9 \x9 ";
foreach ($iT as $Qi) {
echo " \x9 \x9 <option value="";
echo esc_attr($Qi);
echo "">
\x9\x9 ";
MF:
}
po:
echo "\x9 \x9 </datalist>
\x9\x9\x9 </div>\xa\x9\x9\x9\x9<div class="row">
<div class="mb-3 col">\xa\x9\x9 \x9 <label for="mo-caw-custom-sql-api-name" class="form-label mo-caw-form-label">API Name</label>\xa \x9 \x9 <input type="text" class="form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode pyi px-2" id="mo-caw-custom-sql-api-name" name="mo-caw-custom-sql-api-name" value="";
echo esc_attr($this->api_name);
echo "" placeholder="API Name" pattern="^(?=.{1,}$)[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$" title="Should be of maximum length 25 and only '-' are accepted in between along with [A-Z, a-z and 0-9]" aria-required="true" required ";
echo Constants::EDIT === $gt || Constants::TEST === $gt ? "disabled" : '';
echo ">
\x9 \x9\x9 \x9";
if (!(Constants::EDIT === $gt || Constants::TEST === $gt)) {
goto CI;
}
echo " \x9\x9\x9 <input type="hidden" name="mo-caw-custom-sql-api-name" value="";
echo esc_attr($this->api_name);
echo "">\xa \x9 \x9\x9\x9";
CI:
echo " \x9 \x9 </div>
\x9 \x9<div class="mb-3 col">
\x9 \x9\x9 <label for="mo-caw-custom-sql-api-method" class="form-label mo-caw-form-label">Method <i class="fas fa-info rounded-circle border py-1 px-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="HTTP request method"></i></label>\xa\x9 \x9 <select class="form-select mo-caw-form-select mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode mo-caw-method-selector" id="mo-caw-custom-sql-api-method" name="mo-caw-custom-sql-api-method" aria-label="#mo-caw-custom-sql-api-method" aria-required="true" required ";
echo Constants::EDIT === $gt || Constants::TEST === $gt ? "disabled" : '';
echo ">
\x9 \x9\x9 <option value="">Select Method</option>\xa\x9 \x9 <option value="get" ";
echo Constants::HTTP_GET === $this->method ? "selected" : '';
echo ">GET</option>
\x9 \x9<option value="post" ";
echo Constants::HTTP_POST === $this->method ? "selected" : '';
echo ">POST</option>\xa \x9\x9<option value="put" ";
echo Constants::HTTP_PUT === $this->method ? "selected" : '';
echo ">PUT</option>\xa \x9 <option value="delete" ";
echo Constants::HTTP_DELETE === $this->method ? "selected" : '';
echo ">DELETE</option>\xa \x9 \x9\x9</select>
\x9\x9";
if (!(Constants::EDIT === $gt || Constants::TEST === $gt)) {
goto U0;
}
echo "\x9 \x9 \x9\x9<input type="hidden" name="mo-caw-custom-sql-api-method" value="";
echo esc_attr($this->method);
echo "">\xa\x9 \x9\x9\x9";
U0:
echo "\x9\x9\x9 </div>\xa \x9\x9 </div>
\x9 <div>
\x9\x9 \x9 <div class="d-flex justify-content-between align-items-center mb-2 mo-caw-form-content d-none" request-methods="get post put delete">\xa\x9\x9 \x9\x9 <label class="form-label mo-caw-form-label fw-bolder">SQL Queries</em> <i class="fas fa-info rounded-circle border py-1 px-2" data-bs-toggle="tooltip" data-bs-placement="right" title="Write a SQL query. Any custom parameters to be replaced dynamically should be in the following format: E.g. "{{parameter_name}}"."></i></label>
\x9\x9 \x9 \x9<span>\xa \x9 \x9\x9<button class="mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan mo-caw-add-standard-tooltip mo-caw-add-bac-tooltip mo-caw-add-eai-tooltip border-0 bg-white p-0" type="button" onclick="moCawAddField('sql', 'mo-caw-custom-sql-api-query-duplicate-div-0', 'mo-caw-custom-sql-api-query-duplicate-div-', this.nextElementSibling)" ><i class="fa-solid fa-plus mo-caw-text-grey-medium border border-3 rounded pi"></i></button>\xa\x9\x9 \x9 \x9<button class="mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan mo-caw-add-standard-tooltip mo-caw-add-bac-tooltip mo-caw-add-eai-tooltip border-0 bg-white p-0" type="button" onclick="moCawRemoveField('mo-caw-custom-sql-api-query-duplicate-div-', this)" ><i class="fa-solid fa-minus mo-caw-text-grey-medium border border-3 rounded p-1"></i></button>
\x9\x9 \x9 </span>
\x9\x9 </div>
\x9 \x9 <div class="mo-caw-form-content d-none mb-3" request-methods="get post put delete">
\x9 \x9 <div id="mo-caw-sortable-list" class="list-group col">\xa\x9\x9\x9 \x9";
if (!empty($this->queries)) {
goto gc;
}
echo "\x9 \x9\x9 \x9<div class="row" id="mo-caw-custom-sql-api-query-duplicate-div-0">\xa\x9\x9\x9 \x9\x9<div class="list-group-item border-0" draggable="true">\xa\x9\x9\x9\x9 \x9 \x9<div class="input-group">
\x9 <input type="text" class="form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode py-1 border-endh" id="mo-caw-custom-sql-api-query" name="mo-caw-custom-sql-api-query[]" placeholder="Enter your SQL query" aria-required="true" required>\xa \x9 \x9\x9\x9 \x9<span class="input-group-text bg-white border-starth mo-caw-cursor-pointer">\xa\x9\x9 \x9\x9 \x9 \x9 ";
if (!(Constants::STANDARD_PLAN_NAME !== Constants::PLAN_NAME)) {
goto uZ;
}
echo "\x9 \x9\x9\x9 \x9\x9 <i class="fas fa-bars fa-xl mo-caw-handle"></i>\xa \x9 \x9\x9\x9 \x9";
uZ:
echo "\x9 \x9 \x9 \x9\x9</span>
\x9 \x9 \x9</div>
\x9 \x9\x9 \x9 </div>\xa\x9\x9\x9\x9\x9 </div>\xa \x9\x9 \x9 ";
goto B6;
gc:
echo " \x9 \x9 ";
foreach ($this->queries as $P8 => $kl) {
echo "\x9 \x9 \x9\x9 <div class="row" id="mo-caw-custom-sql-api-query-duplicate-div-";
echo esc_attr($P8);
echo "">
\x9 \x9\x9\x9\x9 \x9 \x9<div class="list-group-item border-0" draggable="true">
\x9 \x9\x9\x9 \x9\x9\x9\x9<div class="input-group">
\x9 \x9\x9\x9\x9 <input type="text" class="form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode pyi border-endh" id="mo-caw-custom-sql-api-query" name="mo-caw-custom-sql-api-query[]" value="";
echo esc_attr($kl);
echo "" placeholder="Enter your SQL query" aria-required="true" required>\xa\x9\x9\x9\x9 \x9\x9\x9\x9 \x9<span class="input-group-text bg-white border-start-0 mo-caw-cursor-pointer">
\x9 \x9\x9 \x9 \x9 ";
if (!(Constants::STANDARD_PLAN_NAME !== Constants::PLAN_NAME)) {
goto Gv;
}
echo "\x9\x9 \x9 \x9\x9\x9\x9\x9 \x9<i class="fas fa-bars fa-xl mo-caw-handle"></i>\xa\x9 \x9 \x9\x9\x9 \x9\x9\x9";
Gv:
echo " \x9\x9\x9\x9\x9\x9\x9 \x9</span>
\x9 \x9\x9\x9 \x9\x9 \x9</div>\xa \x9 \x9 \x9</div>\xa\x9\x9\x9\x9 \x9\x9 \x9</div>\xa\x9\x9 \x9 \x9";
fF:
}
D3:
echo "\x9\x9 \x9 \x9";
B6:
echo "\x9 \x9\x9\x9\x9</div>\xa\x9\x9 \x9</div>
\x9\x9\x9\x9</div>\xa\x9\x9\x9\x9<div class="accordion d-none" id="mo-caw-adv-setting-accordion">
\x9 \x9 <div class="accordion accordion-flush" id="mo-caw-custom-sql-api-accordion-flush">
\x9 \x9\x9\x9<div class="accordion-item mb-2 borderh mo-caw-rounded-8 mo-caw-accordion-item mo-caw-element-to-toggle mo-caw-light-mode">\xa\x9\x9\x9\x9\x9\x9 <h2 class="accordion-header" id="mo-caw-custom-sql-api-adv-settings-accordion-heading">
\x9 \x9\x9 \x9<button class="accordion-button collapsed mo-caw-bg-blue-light shadow-none mo-caw-rounded-8" type="button" data-bs-toggle="collapse" data-bs-target="#mo-caw-custom-sql-api-adv-settings-accordion-collapse" aria-expanded="false" aria-controls="mo-caw-custom-sql-api-adv-settings-accordion-collapse">\xa\x9 \x9 \x9 Advance Settings
\x9 \x9 \x9 </button>
\x9\x9 \x9</h2>\xa \x9\x9\x9\x9 <div id="mo-caw-custom-sql-api-adv-settings-accordion-collapse" class="accordion-collapse collapse" aria-labelledby="mo-caw-custom-sql-api-adv-settings-accordion-heading" data-bs-parent="#mo-caw-custom-sql-api-accordion-flush">\xa\x9\x9\x9\x9\x9 \x9<div class="accordion-body">\xa\x9\x9\x9\x9 \x9 \x9<div class="row">\xa\x9\x9 \x9 \x9\x9 <div class="mb-3 col mo-caw-form-content d-none" request-methods="get post put delete">\xa \x9\x9\x9 \x9\x9\x9 \x9\x9<label for="mo-caw-custom-sql-api-response-format" class="form-label mo-caw-form-label">Response Type <i class="fas fa-info rounded-circle border pyi pxj" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Send response in default or your custom format"></i></label>
\x9\x9\x9\x9 \x9\x9 \x9\x9 <div class="d-flex justify-content-between align-items-center">\xa\x9 \x9 \x9 \x9 \x9<select class="mo-caw-crown-standard-plan mo-caw-crown-bac-plan mo-caw-crown-eai-plan form-select mo-caw-form-select mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode" id="mo-caw-response-type" name="mo-caw-custom-sql-api-response-type" aria-label="#mo-caw-custom-sql-api-method" >
\x9\x9 \x9\x9 \x9<option value="default" ";
echo !isset($this->response["response_type"]) || Constants::DEFAULT === $this->response["response_type"] ? "selected" : '';
echo ">Default</option>
\x9 \x9 \x9 \x9 \x9 \x9<option value="custom" class="mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan" ";
echo isset($this->response["response_type"]) && Constants::CUSTOM === $this->response["response_type"] ? "selected" : '';
echo ">Custom Response</option>
\x9 \x9 \x9\x9\x9</select>\xa\x9\x9\x9\x9\x9 \x9\x9 \x9\x9</div>
\x9\x9\x9\x9 \x9\x9 </div>\xa \x9 \x9\x9\x9\x9 \x9<div class="mb-3 col mo-caw-form-content d-none" request-methods="get post put delete">\xa \x9\x9 \x9\x9 \x9\x9<label for="mo-caw-custom-sql-api-response-format" class="form-label mo-caw-form-label">Response Format</label>\xa\x9 \x9\x9\x9 \x9<div class="d-flex justify-content-between align-items-center">\xa \x9\x9\x9\x9 \x9 \x9<select class="form-select mo-caw-form-select mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode" id="mo-caw-custom-sql-api-response-format" name="mo-caw-custom-sql-api-response-format" aria-label="#mo-caw-custom-sql-api-method" >
\x9\x9\x9\x9\x9\x9 \x9 <option value="json" ";
echo !isset($this->response["response_content_type"]) || Constants::JSON === $this->response["response_content_type"] ? "selected" : '';
echo ">JSON</option>\xa \x9\x9\x9 \x9\x9 \x9<option value="xml" ";
echo isset($this->response["response_content_type"]) && Constants::XML === $this->response["response_content_type"] ? "selected" : '';
echo " aria-hidden="true" hidden>XML</option>\xa\x9\x9 \x9\x9\x9\x9\x9\x9 \x9\x9</select>
\x9 \x9 \x9 \x9</div>\xa\x9 \x9\x9\x9 \x9\x9\x9\x9</div>
\x9 \x9 \x9\x9 \x9 \x9<div id="mo-caw-response-format-block" class="";
echo !isset($this->response["response_type"]) || Constants::DEFAULT === $this->response["response_type"] ? "d-none" : '';
echo "">
\x9\x9\x9 \x9\x9 \x9\x9 <ul class="nav nav-tabs nav-pills border-0 flex-column flex-sm-row text-center rounded">
\x9 \x9\x9 \x9 \x9\x9\x9 <li class="nav-item mo-caw-bg-blue-light flex-sm-fill">
\x9\x9\x9\x9\x9\x9 \x9 <a class="nav-link active" data-bs-toggle="tab" href="#mo-caw-custom-sql-api-response-type-success">Success</a>\xa \x9\x9 \x9\x9\x9\x9\x9 \x9</li>\xa \x9 \x9\x9\x9 \x9 \x9\x9<li class="nav-item mx-1 mo-caw-bg-blue-light flex-sm-fill">
\x9\x9\x9 \x9 \x9\x9 \x9\x9<a class="nav-link" data-bs-toggle="tab" href="#mo-caw-custom-sql-api-response-type-error">Error</a>\xa \x9 \x9\x9\x9 </li>\xa \x9\x9 \x9\x9 \x9\x9 <li class="nav-item mo-caw-bg-blue-light flex-sm-fill">\xa \x9 \x9\x9\x9 <a class="nav-link" data-bs-toggle="tab" href="#mo-caw-custom-sql-api-response-type-authentication">Authentication</a>
\x9\x9 \x9 \x9 \x9 </li>
\x9 \x9\x9 \x9\x9 \x9</ul>\xa\x9\x9 \x9 \x9<div class="tab-content pbk">\xa\x9\x9 \x9\x9 \x9\x9 \x9 <div class="tab-pane active" id="mo-caw-custom-sql-api-response-type-success">
\x9\x9\x9 \x9 \x9 \x9<label for="mo-caw-custom-sql-api-response-type-success-format"></label>\xa\x9 \x9\x9 \x9\x9 \x9<textarea class="form-control" placeholder="{ "message": "success", "data": "$response_data"&#; }&#;&#;" id="mo-caw-custom-sql-api-response-type-success-format" name="mo-caw-custom-sql-api-response-type-success-format" rows=0">";
echo isset($this->response["response_content"]["success"]) && !empty($this->response["response_content"]["success"]) ? esc_attr($this->response["response_content"]["success"]) : '';
echo "</textarea>\xa \x9\x9\x9 \x9\x9\x9\x9</div>
\x9 \x9\x9\x9\x9\x9 <div class="tab-pane fade" id="mo-caw-custom-sql-api-response-type-error">
\x9 \x9 \x9 \x9<label for="mo-caw-custom-sql-api-response-type-error-format"></label>\xa\x9\x9\x9 \x9 \x9\x9 \x9<textarea class="form-control" placeholder="{ "message": "error",&#; "data": "$response_data" } &0;" id="mo-caw-custom-sql-api-response-type-error-format" name="mo-caw-custom-sql-api-response-type-error-format" rows="10">";
echo isset($this->response["response_content"]["error"]) && !empty($this->response["response_content"]["error"]) ? esc_attr($this->response["response_content"]["error"]) : '';
echo "</textarea>\xa \x9\x9\x9\x9\x9\x9 \x9</div>\xa \x9\x9 \x9 \x9\x9\x9<div class="tab-pane fade" id="mo-caw-custom-sql-api-response-type-authentication">
\x9\x9 \x9 \x9 \x9\x9\x9 \x9\x9<label for="mo-caw-custom-sql-api-response-type-authentication-format"></label>\xa \x9 \x9\x9 \x9 \x9 <textarea class="form-control" placeholder="{ &0; "message": "authentication_error", &0; "data": "$response_data"&3;&0;}&#; " id="mo-caw-custom-sql-api-response-type-authentication-format" name="mo-caw-custom-sql-api-response-type-authentication-format" rows="10">";
echo isset($this->response["response_content"]["authentication"]) && !empty($this->response["response_content"]["authentication"]) ? esc_attr($this->response["response_content"]["authentication"]) : '';
echo "</textarea>
\x9\x9 \x9\x9\x9 \x9\x9</div>
\x9\x9\x9\x9 \x9\x9\x9 </div>
\x9 \x9 \x9</div>\xa\x9\x9 \x9 </div>\xa\x9\x9\x9\x9 \x9 \x9 \x9<div class="mbk">\xa\x9\x9 \x9\x9 \x9<label for="mo-caw-custom-sql-api-allowed-roles" class="form-label mo-caw-form-label">Restrict role-based access</label>\xa \x9\x9\x9 \x9\x9\x9 \x9<div class="dropdown mo-caw-disable-standard-plan mo-caw-disable-bac-plan mo-caw-disable-eai-plan" >
\x9 \x9\x9 \x9\x9\x9\x9<button class="mo-caw-disable-standard-plan mo-caw-crown-standard-plan mo-caw-disable-bac-plan mo-caw-crown-bac-plan mo-caw-disable-eai-plan mo-caw-crown-eai-plan btn dropdown-toggle mo-caw-dropdown-toggle w-1 bg-white mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode mo-caw-text-grey-medium d-flex justify-content-between align-items-center" type="button" id="mo-caw-custom-sql-api-allowed-roles-dropdown" data-bs-toggle="dropdown" aria-expanded="false">
\x9 \x9 \x9 \x9 \x9 ";
echo !empty($this->blocked_roles) ? "Selected (" . count($this->blocked_roles) . ")" : "Select Roles";
echo "\x9 \x9\x9\x9 \x9 \x9 </button>\xa \x9\x9 \x9 \x9 \x9\x9\x9 <div class="dropdown-menu mo-caw-dropdown-menu w-0" aria-labelledby="mo-caw-custom-sql-api-allowed-roles-dropdown">
\x9\x9 \x9 \x9 \x9 <div class="form-check d-flex align-items-center p-2">
\x9 \x9\x9 \x9\x9 \x9 <input class="form-check-input m-0 bg-white mo-caw-select-all-checkbox me-2" type="checkbox" value="" id="mo-caw-custom-sql-api-allowed-roles-select-all" data-target="mo-caw-custom-sql-api-allowed-roles" ";
echo count($this->blocked_roles) === count($i2) ? "checked" : '';
echo ">
\x9\x9 \x9\x9 \x9\x9 \x9\x9 \x9<label class="form-check-label" for="mo-caw-custom-sql-api-allowed-roles-select-all">Select All</label>
\x9 \x9\x9 \x9\x9 \x9\x9\x9</div>
\x9\x9 \x9 \x9 \x9";
foreach ($i2 as $gZ => $al) {
echo "\x9 \x9 \x9\x9 \x9\x9\x9<div class="form-check d-flex align-items-center p-2">
\x9 \x9\x9 \x9 \x9\x9\x9\x9<input class="form-check-input m-0 bg-white mo-caw-custom-sql-api-allowed-roles me-2" type="checkbox" value="";
echo esc_attr($al);
echo "" id="mo-caw-custom-sql-api-allowed-roles-";
echo esc_attr($gZ);
echo "" name="mo-caw-custom-sql-api-allowed-roles[]" ";
echo in_array($al, $this->blocked_roles, true) ? "checked" : '';
echo ">
\x9\x9\x9\x9 \x9 \x9\x9 \x9 <label class="form-check-label" for="mo-caw-custom-sql-api-allowed-roles-";
echo esc_attr($gZ);
echo "">";
echo esc_attr($Ra[$gZ]);
echo "</label>
\x9\x9 \x9 \x9\x9\x9 \x9</div>\xa \x9\x9 \x9\x9\x9";
Hk:
}
FR:
echo "\x9 \x9\x9 </div>\xa\x9 \x9 \x9 </div>\xa\x9\x9 \x9\x9 \x9 \x9</div>
\x9 \x9 </div>
\x9 \x9 \x9\x9</div>
\x9\x9 \x9\x9</div>\xa \x9\x9 </div>
\x9 </div>\xa </div>
\x9\x9</form>
<div class="modal fade mo-caw-export-modal" id="mo-caw-custom-sql-api-test-inputs-modal" tabindex="-1" aria-labelledby="mo-caw-custom-sql-api-test-inputs-modal-label" aria-hidden="true">
\x9 <div class="modal-dialog modal-dialog-centered justify-content-center">\xa \x9 \x9<form method="POST" id="mo-caw-custom-sql-api-test-inputs-form">\xa \x9\x9\x9 <div class="modal-content">\xa\x9 \x9 \x9<div class="modal-header">\xa\x9 \x9\x9\x9 \x9<h5 class="modal-title" id="mo-caw-custom-sql-api-test-inputs-modal-label">Values to run test</h5>\xa \x9 \x9 \x9 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
\x9 \x9 </div>\xa \x9 \x9<div class="modal-body">
\x9\x9\x9\x9\x9\x9</div>
\x9 \x9\x9<div class="modal-footer d-md-flex justify-content-md-center">\xa \x9\x9 \x9 <button class="btn btn-primary mo-caw-bg-blue-medium mo-caw-rounded-16" type="button" onclick="moCawGetCustomAPITestResult('";
echo esc_attr(site_url());
echo "')">Continue</button>\xa\x9 \x9\x9\x9 </div>
\x9 </div>
\x9\x9</form>\xa\x9 </div>
</div>\xa\x9\x9";
if (!$iZ) {
goto EB;
}
echo " \x9\x9<div class="d-flex justify-content-between align-items-end my-4">
\x9 \x9<div class="d-flex justify-content-center align-items-baseline">
\x9 <h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">Test Results</h6>\xa\x9\x9 \x9\x9<span class="ms-2 badge rounded-pill" id="mo-caw-custom-sql-api-test-result-status"></span>\xa \x9</div>\xa\x9 \x9</div>
\x9<div class="bg-white mo-caw-shadow p-3 mo-caw-roundedi6 mo-caw-test-result" id="mo-caw-custom-sql-api-test-result">
\x9 </div>
\x9\x9";
EB:
echo "\x9 ";
}
private function display_api_creation_view()
{
$G8 = site_url() . "/wp-json/" . $this->namespace . "/" . $this->api_name;
$N6 = implode('', $this->queries);
$Mn = "/{{([A-Za-z0-9-_]+)}}/";
preg_match_all($Mn, $N6, $MT);
$zp = $MT[1];
if (!(Constants::HTTP_GET === $this->method || Constants::HTTP_DELETE === $this->method)) {
goto id;
}
if (!(count($zp) > 0)) {
goto Jj;
}
$zp = array_values(array_unique($zp));
foreach ($zp as $O4) {
$EA[$O4] = "<" . $O4 . ">";
a6:
}
Gm:
$G8 = add_query_arg($EA, $G8);
Jj:
id:
echo "\x9\x9<div class="d-flex justify-content-between align-items-end mb-4">
\x9\x9<h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">";
echo "View API - " . esc_attr($this->api_name);
echo "</h6>
\x9 <div class="d-grid gap-2 d-md-block">\xa \x9 <button class="btn mo-caw-btn-outline-blue-medium mo-caw-rounded-16 mo-caw-bg-blue-dark px-4 ";
echo esc_attr($this->license_status);
echo "" type="submit" aria-hidden="true" hidden>Export Postman Collection</button> \xa\x9 <a class="btn mo-caw-btn-outline-blue-medium mo-caw-roundedi6 px-4 mo-caw-element-to-toggle mo-caw-light-mode ";
echo esc_attr($this->license_status);
echo "" type="button" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=test&api-name=" . $this->api_name . "&method=" . $this->method . "&namespace=" . $this->namespace . "&test-mode=true", "MO_CAW_SQL_API_Creation_Test_Nonce"));
echo "">Test</a>\xa\x9\x9 <a class="btn btn-primary mo-caw-rounded-16 mo-caw-bg-blue-dark px-4 ";
echo esc_attr($this->license_status);
echo "" type="button" href="";
echo esc_url(wp_nonce_url("admin.php?page=custom_api_wp_settings&tab=custom-sql-api&action=edit&api-name=" . $this->api_name . "&method=" . $this->method . "&namespace=" . $this->namespace, "MO_CAW_SQL_API_Creation_Edit_Nonce"));
echo "">Edit API</a>
\x9\x9\x9</div>
\x9</div>
\x9<div class="bg-white mo-caw-shadow p-3 mo-caw-roundedi6">\xa \x9 <div class="input-group mb-3">\xa \x9\x9 <span class="input-group-text mo-caw-";
echo esc_attr($this->method);
echo "-method borderh fs-6 px-3">";
echo esc_attr(strtoupper($this->method));
echo "</span>\xa\x9 \x9 <input type="text" class="form-control mo-caw-form-control mo-caw-element-to-toggle mo-caw-light-mode border-end-0 border-starth bg-white fs-6" aria-label="" placeholder="https://<your_domain>/wp-json/<namespace>/<api-name>?<params>" value="";
echo esc_attr($G8);
echo "" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Any parameters enclosed within <> should be replaced with actual values" aria-readonly="true" readonly> \xa\x9 <span class="input-group-text bg-white mo-caw-cursor-pointer fs-6 mo-caw-copy-icon" data-bs-toggle="tooltip" data-bs-placement="right" title="Copy API Endpoint"><i class="far fa-copy fa-lg"></i></span>\xa\x9\x9 </div>\xa \x9 ";
if (!((Constants::HTTP_POST === $this->method || Constants::HTTP_PUT === $this->method) && count($zp))) {
goto Ow;
}
$t2 = array_fill_keys($zp, "value");
$vC = wp_json_encode($t2, JSON_PRETTY_PRINT);
echo "\x9\x9\x9\x9<h6 class="mb-3 mo-caw-element-to-toggle mo-caw-light-mode">Required parameters for Custom APIs</h6>\xa\x9\x9\x9\x9<div id="mo-caw-external-api-request-format-block">
\x9\x9 \x9 <ul class="nav nav-tabs nav-pills border-0 flex-column flex-sm-row text-center rounded mb-2">
\x9\x9 \x9\x9<li class="nav-item mo-caw-bg-blue-light flex-sm-fill col-6 px-0">\xa \x9\x9 <a class="nav-link active" data-bs-toggle="tab" href="#mo-caw-external-api-request-format-x-www">X-WWW-FORM-URLENCODED</a>\xa\x9\x9\x9 \x9 </li>
\x9\x9\x9\x9\x9 <li class="nav-item mo-caw-bg-blue-light flex-sm-fill coln pxh">\xa \x9 \x9 <a class="nav-link" data-bs-toggle="tab" href="#mo-caw-external-api-request-format-json">JSON</a>
\x9\x9\x9 </li>
\x9 \x9</ul>\xa \x9 \x9</div>\xa \x9 <div class="tab-content pb-3">\xa \x9\x9 <div class="tab-pane active" id="mo-caw-external-api-request-format-x-www">\xa \x9 \x9<div>\xa\x9\x9 \x9\x9\x9\x9<table class="table text-center fsn border border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa\x9 \x9\x9<thead>
\x9\x9\x9\x9\x9 \x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa\x9 \x9\x9 \x9\x9 <th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-mdk p-3 align-middle">Header Name</th>
\x9\x9\x9\x9\x9 \x9<th scope="col" class="borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3 align-middle">Header Value</th>
\x9\x9\x9\x9\x9 </tr>\xa \x9 \x9\x9\x9 \x9</thead>
\x9 \x9 \x9<tbody>
\x9\x9 \x9 \x9 \x9<tr>
\x9 \x9 \x9 <td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode pk align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Required if using POST/PUT method with x-www-form-urlencoded format">Content-Type</td>\xa\x9 \x9 \x9\x9\x9<td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">";
echo esc_html(Constants::X_WWW_HEADER_NAME);
echo "</td>\xa\x9 \x9 \x9\x9\x9</tbody>\xa\x9\x9\x9 \x9\x9 </table>
\x9 \x9\x9\x9 <div class="overflow-auto mh- mo-caw-table-wrapper" >
\x9 \x9 \x9 <table class="table text-center fsn border border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9\x9 \x9\x9 \x9<thead class="sticky-top">
\x9\x9\x9\x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9 \x9\x9\x9 \x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottomh col-mdk pk align-middle">Body Parameter Name</th>
\x9\x9 \x9 <th scope="col" class="borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-mdk pk align-middle">Body Parameter Value</th>\xa \x9 \x9 \x9 \x9</tr>\xa \x9\x9\x9\x9 \x9 </thead>
\x9\x9 \x9\x9\x9\x9 <tbody>
\x9 \x9\x9\x9 \x9 ";
foreach ($zp as $O0 => $I4) {
echo "\x9 \x9 \x9<tr>\xa \x9\x9 \x9 \x9 <td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Required if using x-www-form-urlencoded format">";
echo esc_html($I4);
echo "</td>
\x9\x9\x9 \x9 \x9\x9 \x9<td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">Column Value</td>\xa \x9 \x9\x9 \x9 \x9 </tr>
\x9 \x9\x9\x9 \x9 ";
i0:
}
Je:
echo " \x9\x9\x9\x9\x9 \x9</tbody>
\x9 \x9</table>
\x9 \x9\x9 </div>\xa \x9\x9\x9 </div>\xa\x9 \x9 </div>\xa \x9 <div class="tab-pane fade" id="mo-caw-external-api-request-format-json">\xa\x9 \x9 \x9<div>
\x9 \x9\x9 \x9<table class="table text-center fs-6 border borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9\x9\x9 <thead>\xa \x9\x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9 \x9\x9\x9\x9 <th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-mdk p-3 align-middle">Header Name</th>
\x9\x9 \x9 \x9<th scope="col" class="borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3 align-middle">Header Value</th>\xa \x9\x9\x9 \x9</tr>\xa\x9 \x9\x9 </thead>
\x9 \x9 \x9 \x9<tbody>\xa \x9 \x9\x9\x9\x9\x9<tr>\xa \x9\x9\x9 \x9 \x9<td class="col-mdk border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Required if using POST/PUT method with application/json format">Content-Type</td>
\x9 \x9\x9 \x9\x9 <td class="col-mdk border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">";
echo esc_html(Constants::JSON_HEADER_NAME);
echo "</td>
\x9 </tr>
\x9 </tbody>\xa\x9 \x9 \x9\x9</table>\xa \x9\x9 <table class="table text-center fsn border border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9 \x9\x9 \x9<thead>
\x9\x9\x9 \x9 \x9 <tr class="mo-caw-bg-blue-light mo-caw-rounded-top border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">\xa \x9 \x9\x9\x9 \x9\x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3 align-middle">Body</th>
\x9 \x9\x9 \x9\x9 </tr>\xa \x9\x9\x9 \x9 \x9</thead>
\x9 \x9</table>\xa \x9 \x9\x9\x9 <div>\xa\x9 \x9 \x9\x9 <textarea class="form-control mo-caw-form-control py-1" id="mo-caw-external-api-json-body" name="mo-caw-external-api-json-body" placeholder="Add JSON body" rows="10">";
echo esc_attr($vC);
echo "</textarea>\xa\x9\x9\x9\x9\x9\x9\x9</div>\xa\x9 \x9\x9\x9</div>\xa\x9\x9 </div>\xa\x9\x9\x9 </div>\xa\x9 \x9";
Ow:
echo " \x9 <div class="mt-4">
\x9\x9 <h6 class="mb-3 mo-caw-element-to-toggle mo-caw-light-mode">Request parameters for Pagination <em class="fw-normal">(Optional)</em></h6>\xa \x9\x9\x9<table class="table text-center fs-6 border border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9 <thead>
\x9<tr class="mo-caw-bg-blue-light mo-caw-rounded-top borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode">
\x9\x9 \x9<th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottomh col-mdk p-3 align-middle">Parameter Name</th>\xa \x9 \x9\x9 <th scope="col" class="border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode border-bottom-0 col-md-3 p-3 align-middle">Description</th>
\x9\x9\x9\x9 </tr>
\x9 \x9</thead>\xa \x9\x9 \x9<tbody>\xa \x9 \x9\x9 <tr>\xa \x9\x9\x9 \x9<td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Required if using pagination">size</td>
\x9\x9\x9 \x9\x9<td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">Defines page size</td>\xa \x9\x9\x9 </tr>
\x9\x9\x9\x9<tr>\xa \x9 \x9\x9 \x9<td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Optional in pagination">page</td>
\x9\x9 \x9\x9\x9 <td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">Page number needed in the response <em>(starts from 1)</em></td>\xa \x9 \x9\x9</tr>
\x9 <tr>\xa \x9\x9\x9\x9\x9\x9<td class="col-md-3 borderi mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode pk align-middle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Optional in pagination">offset</td>\xa\x9 \x9\x9 \x9<td class="col-md-3 border-1 mo-caw-dark-border mo-caw-element-to-toggle mo-caw-light-mode p-3 align-middle">Defines from which count number to start returning data <em>(starts from)</em></td>\xa \x9 \x9</tr>\xa \x9\x9 \x9</tbody>
\x9 \x9 </table>
\x9 \x9</div>\xa </div>
\x9<div class="d-flex justify-content-between align-items-end my-4 d-none">
\x9 \x9<h6 class="fw-bolder mo-caw-element-to-toggle mo-caw-light-mode">Code Snippets</h6>\xa\x9\x9\x9<div class="dropdown">\xa \x9\x9<button class="btn mo-caw-btn-outline-blue-medium dropdown-toggle mo-caw-rounded- mo-caw-dropdown-toggle mo-caw-element-to-toggle mo-caw-light-mode" type="button" id="mo-caw-custom-sql-api-test-result-dropdown" data-bs-toggle="dropdown" aria-expanded="false" ";
echo esc_attr($this->license_status);
echo ">
\x9 \x9 Select Language\xa \x9</button>
\x9\x9\x9\x9<ul class="dropdown-menu mo-caw-dropdown-menu" aria-labelledby="mo-caw-custom-sql-api-test-result-dropdown">\xa\x9 \x9\x9\x9<li><a class="dropdown-item" href="#">Node.js</a></li>
\x9\x9\x9\x9 <li><a class="dropdown-item" href="#">PHP</a></li>\xa \x9 <li><a class="dropdown-item" href="#">Python</a></li>
\x9 \x9</ul>\xa \x9</div>\xa\x9 </div>
\x9 <div class="bg-white mo-caw-shadow p-3 mo-caw-roundedi6 d-none">\xa\x9 <pre>
\x9\x9\x9onst axios = require('axios');
\x9 const url = 'http://localhost/wp_1/wp-json/mo/v1/bghfx/{args}/{attempts}';\xa\xa xios.get(url)\xa \x9 .then(response => {\xa\x9\x9 \x9onsole.log(response.data);
\x9 \x9 })
\x9.catch(error => {\xa \x9 console.error('Request failed:', error);
\x9\x9 });
\x9\x9</pre>
</div>
\x9";
}
private function display_api_creation_export()
{
}
}
© 2023 Quttera Ltd. All rights reserved.