<?php
/**
 * @package embed-sharepoint-onedrive-documents
 * @author miniOrange
 * @link https://plugins.miniorange.com
 */


namespace MoSharePointObjectSync\Observer;

use MoSharePointObjectSync\Wrappers\pluginConstants;
use MoSharePointObjectSync\Wrappers\wpWrapper;
class appConfigObserver
{
    private static $obj;
    public static function getObserver()
    {
        if (isset(self::$obj)) {
            goto e2;
        }
        self::$obj = new appConfigObserver();
        e2:
        return self::$obj;
    }
    public function mo_sps_app_configuration_api_handler()
    {
        if (check_ajax_referer("\155\157\x5f\x73\160\x73\x5f\x61\160\x70\137\143\x6f\x6e\x66\x69\147\137\137\156\x6f\156\143\145", "\156\x6f\x6e\x63\145", false)) {
            goto tz;
        }
        wp_send_json_error(array("\145\162\x72" => "\x50\x65\x72\x6d\x69\163\x73\x69\x6f\156\40\x64\x65\x6e\151\145\x64\56"));
        exit;
        tz:
        $f9 = sanitize_text_field($_POST["\x74\141\163\x6b"]);
        switch ($f9) {
            case "\x6d\157\137\163\x70\163\x5f\x61\165\x74\x6f\137\x63\x6f\156\156\145\143\x74\x69\157\156\x5f\x73\141\166\x65\137\x74\171\160\x65":
                $this->mo_sps_auto_connection_save_type($_POST["\x70\141\x79\x6c\157\141\144"]);
                goto ip;
        }
        AW:
        ip:
    }
    private function mo_sps_auto_connection_save_type($jM)
    {
        $R3 = $jM["\143\157\156\x6e\145\143\x74\x69\x6f\x6e\137\x74\x79\x70\x65"];
        $QC = wpWrapper::mo_sps_get_option(pluginConstants::APP_CONFIG);
        $QC["\143\157\156\x6e\145\143\164\157\162"] = $R3;
        wpWrapper::mo_sps_set_option(pluginConstants::APP_CONFIG, $QC);
        wp_send_json_success("\x43\157\156\x6e\x65\143\x74\x69\157\156\40\145\x73\x74\141\142\x6c\x69\163\150\x65\x64\x20\163\x75\143\x63\145\163\163\x66\165\154\x6c\171\56");
    }
}
