namespace OTP;
use OTP\Handler\EmailVerificationLogic;
use OTP\Handler\FormActionHandler;
use OTP\Handler\MoActionHandlerHandler;
use OTP\Handler\MoRegistrationHandler;
use OTP\Handler\PhoneVerificationLogic;
use OTP\Helper\CountryList;
use OTP\Helper\GatewayFunctions;
use OTP\Helper\MenuItems;
use OTP\Helper\MoConstants;
use OTP\Helper\MoDisplayMessages;
use OTP\Helper\MoMessages;
use OTP\Helper\MoUtility;
use OTP\Helper\MOVisualTour;
use OTP\Helper\PolyLangStrings;
use OTP\Helper\Templates\DefaultPopup;
use OTP\Helper\Templates\ErrorPopup;
use OTP\Helper\Templates\ExternalPopup;
use OTP\Helper\Templates\UserChoicePopup;
use OTP\Objects\PluginPageDetails;
use OTP\Objects\TabDetails;
use OTP\Objects\Tabs;
use OTP\Traits\Instance;
use OTP\Helper\MoAddonListContent;
use OTP\Handler\CustomForm;
use OTP\Helper\MocURLCall;
use OTP\Objects\BaseMessages;
use OTP\Helper\MoVersionUpdate;
use OTP\Helper\MoAlphaNumeric;
use OTP\Helper\MoSMSBackupGateway;
use OTP\Helper\MoGloballyBannedPhone;
use OTP\Helper\MoWhatsApp;
use OTP\Helper\MoMasterCode;
use OTP\Helper\PopupTemplateChange;
use OTP\Helper\MoReporting;
use OTP\Helper\TransactionCost;
use OTP\Helper\MoAutofill;
if (defined("ABSPATH")) {
goto ge;
}
exit;
ge:
if (class_exists("MoInit")) {
goto on;
}
final class MoInit
{
use Instance;
private function __construct()
{
$this->initialize_hooks();
$this->initialize_globals();
$this->initialize_helpers();
$this->initialize_handlers();
$this->register_polylang_strings();
$this->register_addons();
}
private function initialize_hooks()
{
add_action("plugins_loaded", array($this, "otp_load_textdomain"));
add_action("admin_menu", array($this, "miniorange_customer_validation_menu"));
add_action("admin_enqueue_scripts", array($this, "mo_registration_plugin_settings_style"));
add_action("admin_enqueue_scripts", array($this, "mo_registration_plugin_settings_script"));
add_action("wp_enqueue_scripts", array($this, "mo_registration_plugin_frontend_scripts"), 99);
add_action("login_enqueue_scripts", array($this, "mo_registration_plugin_frontend_scripts"), 99);
add_action("mo_registration_show_message", array($this, "mo_show_otp_message"), 1, 2);
add_action("hourly_sync", array($this, "hourly_sync"));
add_action("admin_footer", array($this, "feedback_request"));
add_filter("wp_mail_from_name", array($this, "custom_wp_mail_from_name"));
add_filter("plugin_row_meta", array($this, "mo_meta_links"), 10, 2);
add_action("wp_enqueue_scripts", array($this, "load_jquery_on_forms"));
add_action("plugin_action_links_" . MOV_PLUGIN_NAME, array($this, "plugin_action_links"), 10, 1);
}
public function load_jquery_on_forms()
{
if (wp_script_is("jquery", "enqueued")) {
goto r7;
}
wp_enqueue_script("jquery");
r7:
}
private function initialize_helpers()
{
MoMessages::instance();
MoAddonListContent::instance();
PolyLangStrings::instance();
MOVisualTour::instance();
TransactionCost::instance();
if (!file_exists(MOV_DIR . "helper/class-moversionupdate.php")) {
goto uH;
}
MoVersionUpdate::instance();
uH:
if (!file_exists(MOV_DIR . "helper/class-moalphanumeric.php")) {
goto H2;
}
MoAlphaNumeric::instance();
H2:
if (!file_exists(MOV_DIR . "helper/class-mosmsbackupgateway.php")) {
goto IX;
}
MoSMSBackupGateway::instance();
IX:
if (!file_exists(MOV_DIR . "helper/class-mogloballybannedphone.php")) {
goto BJ;
}
MoGloballyBannedPhone::instance();
BJ:
if (!file_exists(MOV_DIR . "helper/class-mowhatsapp.php")) {
goto Tf;
}
MoWhatsApp::instance();
Tf:
if (!file_exists(MOV_DIR . "helper/class-momastercode.php")) {
goto UI;
}
MoMasterCode::instance();
UI:
if (!file_exists(MOV_DIR . "helper/class-moreporting.php")) {
goto uq;
}
MoReporting::instance();
uq:
if (!file_exists(MOV_DIR . "helper/class-popuptemplatechange.php")) {
goto He;
}
PopupTemplateChange::instance();
He:
if (!file_exists(MOV_DIR . "helper/class-moautofill.php")) {
goto Xo;
}
MoAutofill::instance();
Xo:
}
private function initialize_handlers()
{
FormActionHandler::instance();
MoActionHandlerHandler::instance();
DefaultPopup::instance();
ErrorPopup::instance();
ExternalPopup::instance();
UserChoicePopup::instance();
MoRegistrationHandler::instance();
CustomForm::instance();
}
private function initialize_globals()
{
global $HA, $aJ;
$HA = PhoneVerificationLogic::instance();
$aJ = EmailVerificationLogic::instance();
}
public function miniorange_customer_validation_menu()
{
MenuItems::instance();
}
public function mo_customer_validation_options()
{
include MOV_DIR . "controllers/main-controller.php";
}
public function mo_registration_plugin_settings_style()
{
wp_enqueue_style("mo_customer_validation_admin_settings_style", MOV_CSS_URL, array(), MOV_VERSION);
wp_enqueue_style("mo_customer_validation_form_main_css", MOV_FORM_CSS, array(), MOV_VERSION);
wp_enqueue_style("mo_customer_validation_inttelinput_style", MO_INTTELINPUT_CSS, array(), MOV_VERSION);
wp_enqueue_style("mo_main_style", MOV_MAIN_CSS, array(), MOV_VERSION);
}
public function mo_registration_plugin_settings_script()
{
$Mp = array();
wp_enqueue_script("mo_customer_validation_admin_settings_script", MOV_JS_URL, array("jquery"), MOV_VERSION, false);
wp_enqueue_script("mo_customer_validation_form_validation_script", VALIDATION_JS_URL, array("jquery"), MOV_VERSION, false);
wp_register_script("mo_customer_validation_inttelinput_script", MO_INTTELINPUT_JS, array("jquery"), MOV_VERSION, false);
$Lu = CountryList::get_countrycode_list();
$Lu = apply_filters("selected_countries", $Lu);
foreach ($Lu as $Kn => $YW) {
array_push($Mp, $YW);
iw:
}
id:
wp_localize_script("mo_customer_validation_inttelinput_script", "moselecteddropdown", array("selecteddropdown" => $Mp));
wp_enqueue_script("mo_customer_validation_inttelinput_script");
}
public function mo_registration_plugin_frontend_scripts()
{
wp_enqueue_style("mo_customer_validation_form_main_css", MOV_FORM_CSS, array(), MOV_VERSION);
$Mp = array();
if (get_mo_option("show_dropdown_on_form")) {
goto gw;
}
return;
gw:
$RH = apply_filters("mo_phone_dropdown_selector", array());
if (!MoUtility::is_blank($RH)) {
goto tw;
}
return;
tw:
$RH = array_unique($RH);
$Lu = CountryList::get_countrycode_list();
$Lu = apply_filters("selected_countries", $Lu);
foreach ($Lu as $Kn => $YW) {
array_push($Mp, $YW);
Sv:
}
zT:
$UB = CountryList::get_default_country_iso_code();
$nc = apply_filters("mo_get_default_country", $UB);
wp_register_script("mo_customer_validation_inttelinput_script", MO_INTTELINPUT_JS, array("jquery"), MOV_VERSION, false);
wp_localize_script("mo_customer_validation_inttelinput_script", "moselecteddropdown", array("selecteddropdown" => $Mp));
wp_enqueue_script("mo_customer_validation_inttelinput_script");
wp_enqueue_style("mo_customer_validation_inttelinput_style", MO_INTTELINPUT_CSS, array(), MOV_VERSION);
wp_register_script("mo_customer_validation_dropdown_script", MO_DROPDOWN_JS, array("jquery"), MOV_VERSION, true);
wp_localize_script("mo_customer_validation_dropdown_script", "modropdownvars", array("selector" => wp_json_encode($RH), "defaultCountry" => $nc, "onlyCountries" => CountryList::get_only_country_list()));
wp_enqueue_script("mo_customer_validation_dropdown_script");
}
public function mo_show_otp_message($Gz, $TP)
{
new MoDisplayMessages($Gz, $TP);
}
public function otp_load_textdomain()
{
load_plugin_textdomain("miniorange-otp-verification", false, dirname(plugin_basename(__FILE__)) . "/lang/");
do_action("mo_otp_verification_add_on_lang_files");
}
private function register_polylang_strings()
{
if (MoUtility::is_polylang_installed()) {
goto zE;
}
return;
zE:
foreach (maybe_unserialize(MO_POLY_STRINGS) as $Kn => $YW) {
pll_register_string($Kn, $YW, "miniorange-otp-verification");
QB:
}
TG:
}
private function register_addons()
{
$JQ = GatewayFunctions::instance();
$JQ->register_addons();
}
public function feedback_request()
{
include MOV_DIR . "controllers/feedback.php";
}
public function mo_meta_links($T9, $Of)
{
if (!(MOV_PLUGIN_NAME === $Of)) {
goto iQ;
}
$T9[] = "<span class='dashicons dashicons-sticky'></span>
<a href='" . MoConstants::FAQ_URL . "' target='_blank'>" . mo_("FAQs") . "</a>";
iQ:
return $T9;
}
public function plugin_action_links($jB)
{
$fe = TabDetails::instance();
$kN = $fe->tab_details[Tabs::FORMS];
if (!function_exists("is_plugin_active")) {
include_once ABSPATH . "wp-admin/includes/plugin.php";
}
if (!is_plugin_active(MOV_PLUGIN_NAME)) {
goto t8;
}
$jB = array_merge(array("<a href="" . esc_url(admin_url("admin.php?page=" . $kN->menu_slug)) . "">" . mo_("Settings") . "</a>"), $jB);
t8:
return $jB;
}
public function hourly_sync()
{
$JQ = GatewayFunctions::instance();
$JQ->hourly_sync();
}
public function custom_wp_mail_from_name($H1)
{
$JQ = GatewayFunctions::instance();
return $JQ->custom_wp_mail_from_name($H1);
}
}
on:
© 2023 Quttera Ltd. All rights reserved.