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


namespace MoSharePointObjectSync\Controller;

use MoSharePointObjectSync\Wrappers\wpWrapper;
class advanceSettings
{
    private static $instance;
    public static function getController()
    {
        if (isset(self::$instance)) {
            goto dm;
        }
        $pj = __CLASS__;
        self::$instance = new $pj();
        dm:
        return self::$instance;
    }
    public function mo_sps_save_settings()
    {
        $lN = sanitize_text_field($_POST["\157\160\164\151\x6f\x6e"]);
        switch ($lN) {
            case "\x6d\157\x5f\x73\160\163\137\x73\x61\x76\x65\137\x72\x6f\154\x65\137\146\157\154\144\x65\x72\x5f\155\141\160\160\151\x6e\x67\x5f\157\x70\164\151\157\x6e":
                $this->mo_sps_save_role_folder_mapping();
                goto ve;
        }
        zO:
        ve:
    }
    public function mo_sps_save_role_folder_mapping()
    {
        check_admin_referer("\x6d\157\x5f\163\x70\163\x5f\x73\141\x76\x65\x5f\x72\x6f\154\145\x5f\x66\x6f\154\144\x65\x72\137\x6d\141\x70\x70\x69\156\147\137\x6f\x70\x74\151\x6f\156");
        $cv = [];
        $FQ = isset($_POST["\x69\163\137\145\x6e\x61\x62\x6c\x65\x5f\x72\x6f\x6c\145\137\146\157\154\144\145\162\x5f\155\141\160\160\151\x6e\x67"]) ? $_POST["\x69\x73\137\145\x6e\141\142\x6c\145\x5f\x72\157\x6c\145\137\146\157\x6c\x64\x65\162\x5f\155\141\x70\160\151\156\x67"] : '';
        if (!empty($cv)) {
            goto jA;
        }
        $cv = [];
        jA:
        foreach ($_POST as $cD => $qF) {
            $Bk = explode("\x6d\157\x5f\163\x70\x73\x5f\x66\157\x6c\x64\145\x72\x73\137\146\157\x72\x5f\162\x6f\x6c\145\137", $cD);
            if (!(sizeof($Bk) == 2)) {
                goto bN;
            }
            $cv[$Bk[1]] = $qF;
            bN:
            aX:
        }
        hF:
        update_option("\155\157\137\163\x70\x73\137\147\162\x70\x5f\x66\x6f\x6c\144\x65\162\137\x6d\141\x70\160\151\156\x67", $cv);
        update_option("\151\x73\137\145\156\141\x62\x6c\x65\137\162\x6f\154\x65\x5f\x66\157\x6c\x64\145\x72\137\155\141\160\x70\x69\156\147", $FQ);
        wpWrapper::mo_sps__show_success_notice(esc_html__("\x53\x65\x74\x74\151\x6e\147\x73\x20\x53\x61\x76\x65\144\40\x53\x75\x63\x63\x65\x73\x73\x66\165\154\154\171\x2e"));
    }
}
