Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace MoSharePointObjectSync\API; use MoSharePointObjectSync\Wrappers\pl..
Decoded Output download
<?php
namespace MoSharePointObjectSync\API;
use MoSharePointObjectSync\Wrappers\pluginConstants;
use MoSharePointObjectSync\Wrappers\sharepointWrapper;
use MoSharePointObjectSync\Wrappers\wpWrapper;
class Azure
{
private static $obj;
private $endpoints;
private $config;
private $scope = "https://graph.microsoft.com/.default";
private $access_token;
private $handler;
private $all_documents = ["files" => [], "folders" => []];
private function __construct($u8)
{
$this->config = $u8;
$this->handler = Authorization::getController();
}
public static function getClient($u8)
{
if (isset(self::$obj)) {
goto SS;
}
self::$obj = new Azure($u8);
self::$obj->setEndpoints();
SS:
return self::$obj;
}
public function mo_sps_sync_azure_users()
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_grpah_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if ($this->access_token) {
goto il;
}
wp_die(esc_html("Access token is missing from the response. Please try again later."));
il:
$this->fetch_users_using_access_token();
}
private function setEndpoints()
{
$this->endpoints["token"] = "https://accounts.accesscontrol.windows.net/" . $this->config["tenant_id"] . "/tokens/OAuth/2";
$this->endpoints["graph_token"] = "https://login.microsoftonline.com/" . $this->config["tenant_id"] . "/oauth2/v2.0/token";
$this->endpoints["graph_users"] = "https://graph.microsoft.com/beta/users/?$select=userPrincipalName,id";
}
private function fetch_users_using_access_token()
{
$i9 = ["Authorization" => "Bearer " . $this->access_token];
$gs = $this->handler->mo_sps_get_request($this->endpoints["graph_users"], $i9);
if (!(!is_array($gs) || count($gs) <= 0)) {
goto bk;
}
wp_die(esc_html("Unknown error occurred. Please try again later."));
bk:
foreach ($gs["value"] as $user) {
if (empty($user)) {
goto kh;
}
$MP = sanitize_user($user["id"]);
$iu = sanitize_email($user["userPrincipalName"]);
$g5 = username_exists($MP);
if ($g5) {
goto oA;
}
$g5 = email_exists($iu);
oA:
if (!$g5) {
goto iV;
}
wp_update_user(["user_email" => $iu]);
goto eY;
iV:
$mU = wp_generate_password("12", false);
$g5 = wp_create_user($MP, $mU, $iu);
eY:
kh:
bI:
}
hQ:
}
public function mo_sps_process_files_and_folders($jI, $K2)
{
$xS = [];
$CS = [];
$ia = [];
if (!isset($jI["Folders"]["results"])) {
goto Qa;
}
foreach ($jI["Folders"]["results"] as $zS) {
if (!($zS["__metadata"]["type"] == "SP.Folder" && $zS["Name"] != "Forms")) {
goto sl;
}
array_push($CS, ["id" => $zS["UniqueId"], "parent_folder_id" => $K2, "name" => $zS["Name"], "slug" => $zS["UniqueId"], "path" => $zS["ServerRelativeUrl"], "children_count" => $zS["ItemCount"], "time_created" => $zS["TimeCreated"], "time_last_modified" => $zS["TimeLastModified"]]);
sl:
ZB:
}
d0:
Qa:
foreach ($CS as $zS) {
if (!($zS["children_count"] !== 0)) {
goto lX;
}
$pY = "https://" . wpWrapper::mo_sps_get_domain_from_url($this->config["sps_relative_uri"]) . "/_api/web/GetFolderByServerRelativeUrl('" . $zS["path"] . "')/?$expand=Folders,Files";
$this->mo_sps_sync_sharepoint_documents($pY, $zS["id"]);
lX:
LJ:
}
ux:
if (!isset($jI["Files"]["results"])) {
goto Pe;
}
foreach ($jI["Files"]["results"] as $Vj) {
if (!($Vj["__metadata"]["type"] == "SP.File")) {
goto oM;
}
array_push($ia, ["id" => $Vj["UniqueId"], "LinkingUri" => $Vj["LinkingUri"], "parent_folder_id" => $K2, "name" => $Vj["Name"], "slug" => $Vj["UniqueId"], "path" => $Vj["ServerRelativeUrl"], "size" => $Vj["Length"], "time_created" => $Vj["TimeCreated"], "time_last_modified" => $Vj["TimeLastModified"]]);
oM:
NX:
}
Mo:
Pe:
$xS = ["folders" => $CS, "files" => $ia];
return $xS;
}
public function mo_sps_sync_sharepoint_documents($pY, $K2 = 0)
{
$Dj = wpWrapper::mo_sps_get_option(pluginConstants::SHAREPOINT_ROOT_FOLDER);
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["Authorization" => "Bearer " . $this->access_token, "Accept" => "application/json; odata=verbose"];
$dw = $this->handler->mo_sps_get_request($pY, $i9);
if (isset($dw["d"])) {
goto HW;
}
return;
HW:
$pb = $dw["d"];
$xS = $this->mo_sps_process_files_and_folders($pb, $K2);
$this->all_documents["files"] = array_merge($this->all_documents["files"], $xS["files"]);
$this->all_documents["folders"] = array_merge($this->all_documents["folders"], $xS["folders"]);
}
public function mo_sps_send_access_token()
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if (!$this->access_token) {
goto ML;
}
return $this->access_token;
ML:
}
public function mo_sps_download_file_from_sharepoint($Tu)
{
$cA = "https://" . wpWrapper::mo_sps_get_domain_from_url($this->config["sps_relative_uri"]) . "/_api/web/" . $Tu . "$value";
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["Authorization" => "Bearer " . $this->access_token, "Accept-Encoding" => "gzip, compress, deflate, br"];
$Vj = $this->handler->mo_sps_get_media_request($cA, $i9);
return $Vj;
}
public function mo_sps_sync_all_documents_from_sharepoint()
{
set_time_limit(0);
$ri = wpWrapper::mo_sps_get_option(pluginConstants::SHAREPOINT_ROOT_DOC_LIB);
if (!empty($ri)) {
goto pW;
}
$ri = "/Shared Documents";
pW:
$pY = "https://" . wpWrapper::mo_sps_get_domain_from_url($this->config["sps_relative_uri"]) . "/_api/web/GetFolderByServerRelativeUrl('" . $ri . "/')/?$expand=Folders,Files";
$this->mo_sps_sync_sharepoint_documents($pY);
if (!function_exists("wp_generate_attachment_metadata")) {
include ABSPATH . "wp-admin/includes/image.php";
}
$CS = $this->all_documents["folders"];
$a5 = sizeof($CS);
$lq = wpWrapper::mo_sps_get_option(pluginConstants::SHAREPOINT_ROOT_FOLDER);
$pu = sharepointWrapper::mo_sps_get_folder_map_array();
$pu["0"] = $lq;
$TL = $pu;
$K2 = $a5 - 1;
Cc:
if (!($K2 >= 0)) {
goto f1;
}
$zS = $CS[$K2];
unset($TL[$zS["id"]]);
if (term_exists($zS["slug"])) {
goto vA;
}
$Sp = wp_insert_term($zS["name"], "wpmf-category", ["slug" => $zS["slug"], "parent" => $pu[$zS["parent_folder_id"]]]);
goto AO;
vA:
$Sp = wp_update_term(term_exists($zS["slug"]), "wpmf-category", ["name" => $zS["name"], "parent" => $pu[$zS["parent_folder_id"]]]);
AO:
if (!is_wp_error($Sp)) {
goto jQ;
}
return;
jQ:
if (!isset($Sp["term_id"])) {
goto lA;
}
$To = $Sp["term_id"];
$pu[$zS["id"]] = $To;
sharepointWrapper::mo_sps_update_folder_map($zS["id"], $To);
lA:
zw:
$K2--;
goto Cc;
f1:
foreach ($TL as $K2 => $To) {
if (!($K2 === 0)) {
goto bW;
}
goto Ip;
bW:
unset($pu[$K2]);
sharepointWrapper::mo_sps_delete_folder_id($zS["id"]);
wp_delete_term($To, "wpmf-category");
Ip:
}
OC:
$ia = $this->all_documents["files"];
$cq = sizeof($ia);
$cR = pluginConstants::MIME_TYPES;
$Qw = wp_upload_dir();
$Kw = $Qw["path"];
$rm = $Qw["url"];
$Ak = sharepointWrapper::mo_sps_get_file_map_array();
$lW = $Ak;
$vd = [];
$bH = $cq - 1;
ca:
if (!($bH >= 0)) {
goto K4;
}
$Vj = $ia[$bH];
$Cg = pathinfo($Vj["name"], PATHINFO_EXTENSION);
$Jf = basename($Vj["name"], "." . $Cg);
$mg = $pu[$Vj["parent_folder_id"]];
if (!($mg == 0)) {
goto tf;
}
$mg = $lq;
tf:
unset($lW[$Vj["id"]]);
$Iu = $Vj["size"];
$Ya = $Vj["name"];
$Vo = $Kw . "/" . $Ya;
if (is_admin()) {
goto SL;
}
require_once ABSPATH . "wp-admin/includes/post.php";
SL:
if (isset($Ak[$Vj["id"]])) {
goto UV;
}
$rv = admin_url("admin-ajax.php") . "?action=mo_sps_sync_file&file_id=" . $Vj["id"] . "&download=0";
$qO = wp_insert_attachment(array("guid" => $rm . "/" . $Ya, "post_title" => $Jf, "post_status" => "inherit", "post_mime_type" => $cR[strtolower($Cg)], "meta_input" => array("mo_sps_file_url" => $rv)), $Vo);
wp_set_object_terms((int) $qO, (int) $mg, "wpmf-category", true);
update_post_meta($qO, "wpmf_size", $Iu);
update_post_meta($qO, "wpmf_type", strtolower($Cg));
update_post_meta($qO, "_wp_attached_file", $Ya);
update_post_meta($qO, "mo_sps_relative_path", $Vj["path"]);
update_post_meta($qO, "mo_sps_file_edit_url", $Vj["LinkingUri"]);
if (!(strpos($cR[strtolower($Cg)], "image") !== false)) {
goto Rp;
}
array_push($vd, ["id" => $qO, "file_url" => $rv]);
Rp:
goto U_;
UV:
$qO = $Ak[$Vj["id"]];
$rv = admin_url("admin-ajax.php") . "?action=mo_sps_sync_file&file_id=" . $Vj["id"] . "&download=0";
wp_update_post(array("ID" => $qO, "post_title" => $Jf, "post_mime_type" => $cR[strtolower($Cg)]));
wp_set_object_terms((int) $qO, (int) $mg, "wpmf-category", true);
update_post_meta($qO, "_wp_attached_file", $Ya);
update_post_meta($qO, "wpmf_size", $Iu);
update_post_meta($qO, "mo_sps_relative_path", $Vj["path"]);
update_post_meta($qO, "mo_sps_file_url", $rv);
update_post_meta($qO, "mo_sps_file_edit_url", $Vj["LinkingUri"]);
U_:
$Ak[$Vj["id"]] = $qO;
sharepointWrapper::mo_sps_update_file_map($Vj["id"], $qO);
BQ:
$bH--;
goto ca;
K4:
foreach ($lW as $bH => $qO) {
unset($Ak[$bH]);
sharepointWrapper::mo_sps_delete_file_id($Ak[$bH]);
wp_delete_post($qO, true);
F1:
}
hG:
foreach ($vd as $n1) {
$rk = wp_generate_attachment_metadata($n1["id"], $n1["file_url"]);
wp_update_attachment_metadata($n1["id"], $rk);
FU:
}
xm:
set_time_limit(120);
error_log("end....");
}
public function mo_sps_get_all_site_news()
{
$ri = explode($this->config["admin_uri"], $this->config["sps_relative_uri"]);
if (empty($ri) || empty($ri[1])) {
goto A5;
}
$ri = trailingslashit($ri[1] . '');
goto WU;
A5:
$ri = '';
WU:
$YO = "https://" . wpWrapper::mo_sps_get_domain_from_url($this->config["sps_relative_uri"]) . "/_api/web/lists/getByTitle('Site Pages')/items/";
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["Authorization" => "Bearer " . $this->access_token, "Accept" => "application/json; odata=verbose"];
$Xj = $this->handler->mo_sps_get_request($YO, $i9);
return $Xj;
}
public function mo_sps_get_all_site_events()
{
$ri = explode($this->config["admin_uri"], $this->config["sps_relative_uri"]);
if (empty($ri) || empty($ri[1])) {
goto we;
}
$ri = trailingslashit($ri[1] . '');
goto OM;
we:
$ri = '';
OM:
$yJ = "https://" . wpWrapper::mo_sps_get_domain_from_url($this->config["sps_relative_uri"]) . "/_api/web/lists/getByTitle('Events')/items";
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["Authorization" => "Bearer " . $this->access_token, "Accept" => "application/json; odata=verbose"];
$Xj = $this->handler->mo_sps_get_request($yJ, $i9);
return $Xj;
}
public function mo_sps_get_banerurl_for_an_artcile($DD)
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["Authorization" => "Bearer " . $this->access_token];
$Xj = $this->handler->mo_sps_get_media_request($DD, $i9);
return $Xj;
}
public function mo_sps_get_specific_user_detail()
{
$ri = explode($this->config["admin_uri"], $this->config["sps_relative_uri"]);
if (empty($ri) || empty($ri[1])) {
goto Db;
}
$ri = trailingslashit($ri[1] . '');
goto b4;
Db:
$ri = '';
b4:
$Fe = "https://" . wpWrapper::mo_sps_get_domain_from_url($this->config["sps_relative_uri"]) . "/_api/web/GetFolderByServerRelativeUrl('/" . $ri . "')/?$expand=Folders,Files";
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["Authorization" => "Bearer " . $this->access_token, "Accept" => "application/json; odata=verbose"];
$Xj = $this->handler->mo_sps_get_request($Fe, $i9);
return $Xj;
}
public function mo_sps_sync_doc_media_lib()
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_grpah_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if (!(!$this->access_token || isset($this->access_token["error"]))) {
goto qx;
}
return;
qx:
$ll = wpWrapper::mo_sps_get_option("mo_sps_selected_site");
$UM = wpWrapper::mo_sps_get_option("mo_sps_selected_drive");
$o7 = "https://graph.microsoft.com/v1.0/sites/" . $ll["site_id"] . "/drives/" . $UM["drive_id"] . "/root/children";
$i9 = ["Authorization" => "Bearer " . $this->access_token, "Content-type" => "application/json"];
$dw = $this->handler->mo_sps_get_media_request($o7, $i9);
$dw = json_decode($dw["data"], true);
$St = $dw["value"];
foreach ($St as $R4) {
if (isset($R4["folder"])) {
goto RZ;
}
if (isset($R4["file"])) {
goto gN;
}
goto p4;
RZ:
wp_schedule_single_event(time(), "mo_sps_folder_sync_action", ["folder_id" => $R4["id"]]);
goto p4;
gN:
$Qw = wp_upload_dir();
$Kw = $Qw["path"];
$rm = $Qw["url"];
$Ya = $R4["name"];
$Cg = pathinfo($R4["name"], PATHINFO_EXTENSION);
$Jf = basename($R4["name"], "." . $Cg);
$cR = pluginConstants::MIME_TYPES;
$rv = admin_url("admin-ajax.php") . "?action=mo_sps_generate_url&file_id=" . $R4["id"] . "&drive_id=" . $R4["parentReference"]["driveId"];
$Vo = $Kw . "/" . $Ya;
$Ep = $this->mo_sps_post_exists_already($R4["id"]);
if ($Ep) {
goto l6;
}
$this->mp_sps_insert_in_media_library($rm, $Ya, $Jf, $cR, $Cg, $rv, $Vo, $R4["id"]);
goto Kz;
l6:
$qO = get_post_thumbnail_id($Ep);
$jj = array("post_title" => $Jf, "post_status" => "inherit", "post_mime_type" => $cR[strtolower($Cg)], "meta_input" => array("mo_sps_file_url" => $rv, "mo_sps_file_id" => $R4["id"]));
wp_update_attachment_metadata($qO, $jj);
Kz:
p4:
Hh:
}
gr:
}
public function mo_sps_sync_folder_files_in_media($K2)
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_grpah_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if (!(!$this->access_token || isset($this->access_token["error"]))) {
goto uX;
}
return;
uX:
$UM = wpWrapper::mo_sps_get_option("mo_sps_selected_drive");
$o7 = "https://graph.microsoft.com/v1.0/drives/" . $UM["drive_id"] . "/items/" . $K2 . "/children";
$i9 = ["Authorization" => "Bearer " . $this->access_token, "Content-type" => "application/json"];
$dw = $this->handler->mo_sps_get_media_request($o7, $i9);
$dw = json_decode($dw["data"], true);
$St = $dw["value"];
foreach ($St as $R4) {
if (!empty($R4["folder"]) && $R4["folder"]["childCount"]) {
goto ol;
}
if (isset($R4["file"])) {
goto hv;
}
goto eD;
ol:
wp_schedule_single_event(time(), "mo_sps_folder_sync_action", ["folder_id" => $R4["id"]]);
goto eD;
hv:
$Qw = wp_upload_dir();
$Kw = $Qw["path"];
$rm = $Qw["url"];
$Ya = $R4["name"];
$Cg = pathinfo($R4["name"], PATHINFO_EXTENSION);
$Jf = basename($R4["name"], "." . $Cg);
$cR = pluginConstants::MIME_TYPES;
$rv = admin_url("admin-ajax.php") . "?action=mo_sps_generate_url&file_id=" . $R4["id"] . "&drive_id=" . $R4["parentReference"]["driveId"];
$Vo = $Kw . "/" . $Ya;
$Ep = $this->mo_sps_post_exists_already($R4["id"]);
if ($Ep) {
goto MV;
}
$this->mp_sps_insert_in_media_library($rm, $Ya, $Jf, $cR, $Cg, $rv, $Vo, $R4["id"]);
goto IP;
MV:
$qO = get_post_thumbnail_id($Ep);
$jj = array("post_title" => $Jf, "post_status" => "inherit", "post_mime_type" => $cR[strtolower($Cg)], "meta_input" => array("mo_sps_file_url" => $rv, "mo_sps_file_id" => $R4["id"]));
wp_update_attachment_metadata($qO, $jj);
IP:
eD:
pJ:
}
Py:
}
public function mp_sps_insert_in_media_library($rm, $Ya, $Jf, $cR, $Cg, $rv, $Vo, $bH)
{
$qO = wp_insert_attachment(array("guid" => $rm . "/" . $Ya, "post_title" => $Jf, "post_status" => "inherit", "post_mime_type" => $cR[strtolower($Cg)], "meta_input" => array("mo_sps_file_url" => $rv, "mo_sps_file_id" => $bH)), $Vo);
update_post_meta($qO, "_wp_attachment_file_urls", $rv);
return $qO;
}
public function mo_sps_post_exists_already($Vh)
{
$Rr = "mo_sps_file_id";
$i9 = array("post_type" => "attachment", "meta_key" => $Rr, "meta_value" => $Vh, "posts_per_page" => 1);
$ug = get_posts($i9);
if (!empty($ug)) {
goto gT;
}
return false;
goto PS;
gT:
$Ep = $ug[0]->ID;
return $Ep;
PS:
}
public function mo_sps_get_file_download_url($bH, $xc)
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_grpah_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if (!(!$this->access_token || isset($this->access_token["error"]))) {
goto Ez;
}
return;
Ez:
$o7 = "https://graph.microsoft.com/v1.0/drives/" . $xc . "/items/" . $bH;
$i9 = ["Authorization" => "Bearer " . $this->access_token, "Content-type" => "application/json"];
$dw = $this->handler->mo_sps_get_media_request($o7, $i9);
$dw = json_decode($dw["data"], true);
$o2["download_url"] = $dw["@microsoft.graph.downloadUrl"];
$o2["file_type"] = $dw["file"]["mimeType"];
return $o2;
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace MoSharePointObjectSync\API;
use MoSharePointObjectSync\Wrappers\pluginConstants;
use MoSharePointObjectSync\Wrappers\sharepointWrapper;
use MoSharePointObjectSync\Wrappers\wpWrapper;
class Azure
{
private static $obj;
private $endpoints;
private $config;
private $scope = "\x68\x74\x74\160\x73\x3a\57\x2f\x67\162\x61\x70\150\x2e\x6d\x69\143\x72\x6f\x73\157\x66\164\56\143\x6f\155\57\x2e\x64\x65\x66\141\x75\154\164";
private $access_token;
private $handler;
private $all_documents = ["\146\x69\x6c\x65\163" => [], "\146\x6f\x6c\144\x65\x72\163" => []];
private function __construct($u8)
{
$this->config = $u8;
$this->handler = Authorization::getController();
}
public static function getClient($u8)
{
if (isset(self::$obj)) {
goto SS;
}
self::$obj = new Azure($u8);
self::$obj->setEndpoints();
SS:
return self::$obj;
}
public function mo_sps_sync_azure_users()
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_grpah_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if ($this->access_token) {
goto il;
}
wp_die(esc_html("\x41\x63\143\145\x73\163\x20\164\157\x6b\145\x6e\40\x69\x73\40\155\151\x73\163\151\156\x67\40\x66\x72\x6f\155\40\164\150\145\x20\162\145\x73\x70\x6f\x6e\163\145\56\40\x50\x6c\145\141\x73\145\x20\164\x72\x79\40\x61\147\x61\x69\x6e\x20\154\x61\164\x65\x72\x2e"));
il:
$this->fetch_users_using_access_token();
}
private function setEndpoints()
{
$this->endpoints["\x74\x6f\153\x65\156"] = "\x68\x74\x74\160\x73\x3a\57\x2f\141\x63\143\x6f\165\x6e\x74\x73\x2e\141\143\x63\145\163\163\x63\157\156\164\x72\157\x6c\56\167\151\156\144\x6f\x77\163\x2e\156\x65\164\x2f" . $this->config["\164\x65\x6e\141\x6e\164\x5f\x69\144"] . "\x2f\164\x6f\153\145\x6e\x73\57\x4f\x41\165\164\150\x2f\x32";
$this->endpoints["\x67\162\x61\x70\150\137\x74\x6f\153\145\x6e"] = "\x68\164\164\160\163\x3a\x2f\57\154\157\147\x69\156\x2e\x6d\x69\x63\162\x6f\x73\157\x66\x74\157\156\154\151\156\145\56\x63\x6f\155\x2f" . $this->config["\x74\145\x6e\141\x6e\x74\x5f\151\x64"] . "\x2f\x6f\x61\x75\x74\150\x32\57\x76\62\56\x30\x2f\164\x6f\153\x65\156";
$this->endpoints["\147\162\141\x70\150\x5f\x75\163\145\162\163"] = "\x68\x74\164\x70\x73\x3a\57\57\x67\x72\x61\160\150\x2e\x6d\151\x63\x72\x6f\x73\x6f\x66\x74\56\143\157\x6d\x2f\142\x65\164\x61\57\165\163\145\162\x73\x2f\77\x24\163\x65\x6c\x65\143\164\x3d\165\163\x65\162\x50\x72\151\x6e\x63\x69\x70\141\x6c\x4e\141\155\145\x2c\151\144";
}
private function fetch_users_using_access_token()
{
$i9 = ["\x41\x75\x74\x68\157\x72\151\172\x61\164\151\x6f\x6e" => "\x42\145\x61\162\x65\162\40" . $this->access_token];
$gs = $this->handler->mo_sps_get_request($this->endpoints["\147\162\141\x70\x68\x5f\165\x73\x65\162\163"], $i9);
if (!(!is_array($gs) || count($gs) <= 0)) {
goto bk;
}
wp_die(esc_html("\125\156\x6b\x6e\x6f\x77\x6e\40\145\162\162\157\162\40\x6f\143\143\165\162\x72\x65\x64\x2e\x20\120\x6c\145\141\163\x65\40\164\162\x79\40\x61\x67\141\x69\x6e\x20\x6c\141\x74\145\x72\56"));
bk:
foreach ($gs["\x76\141\x6c\x75\145"] as $user) {
if (empty($user)) {
goto kh;
}
$MP = sanitize_user($user["\x69\x64"]);
$iu = sanitize_email($user["\x75\x73\x65\x72\120\x72\151\156\x63\151\x70\141\x6c\116\x61\155\x65"]);
$g5 = username_exists($MP);
if ($g5) {
goto oA;
}
$g5 = email_exists($iu);
oA:
if (!$g5) {
goto iV;
}
wp_update_user(["\165\163\x65\162\x5f\145\x6d\141\151\154" => $iu]);
goto eY;
iV:
$mU = wp_generate_password("\61\62", false);
$g5 = wp_create_user($MP, $mU, $iu);
eY:
kh:
bI:
}
hQ:
}
public function mo_sps_process_files_and_folders($jI, $K2)
{
$xS = [];
$CS = [];
$ia = [];
if (!isset($jI["\106\x6f\154\x64\145\x72\163"]["\x72\x65\163\x75\154\164\163"])) {
goto Qa;
}
foreach ($jI["\x46\x6f\x6c\x64\145\162\x73"]["\x72\x65\163\165\x6c\164\x73"] as $zS) {
if (!($zS["\137\x5f\155\145\x74\x61\x64\x61\x74\141"]["\164\171\160\145"] == "\123\120\56\x46\x6f\x6c\x64\x65\x72" && $zS["\x4e\141\x6d\x65"] != "\x46\157\162\155\163")) {
goto sl;
}
array_push($CS, ["\x69\x64" => $zS["\x55\x6e\x69\161\165\145\x49\x64"], "\160\141\x72\145\156\164\x5f\x66\x6f\154\144\x65\162\137\x69\x64" => $K2, "\x6e\141\155\x65" => $zS["\116\141\155\145"], "\163\x6c\x75\147" => $zS["\125\156\151\x71\165\145\111\x64"], "\160\141\x74\150" => $zS["\123\145\x72\x76\145\162\x52\145\x6c\x61\164\151\x76\x65\x55\x72\x6c"], "\143\150\151\x6c\144\x72\145\156\137\x63\x6f\165\x6e\x74" => $zS["\111\164\x65\x6d\103\x6f\x75\156\164"], "\164\151\155\x65\x5f\x63\162\x65\141\164\145\x64" => $zS["\124\151\x6d\x65\103\162\145\141\x74\145\x64"], "\164\x69\x6d\145\x5f\154\x61\163\x74\x5f\155\157\144\151\146\151\145\x64" => $zS["\124\151\155\x65\114\x61\163\x74\115\x6f\144\x69\146\151\x65\x64"]]);
sl:
ZB:
}
d0:
Qa:
foreach ($CS as $zS) {
if (!($zS["\x63\x68\151\x6c\144\x72\x65\156\137\x63\x6f\165\x6e\x74"] !== 0)) {
goto lX;
}
$pY = "\150\164\x74\160\x73\72\57\57" . wpWrapper::mo_sps_get_domain_from_url($this->config["\163\160\163\x5f\162\145\154\x61\164\x69\x76\x65\137\x75\x72\x69"]) . "\57\x5f\141\x70\x69\57\167\145\x62\x2f\x47\x65\x74\106\157\x6c\144\x65\162\x42\x79\x53\145\162\166\145\162\x52\x65\154\141\164\151\x76\x65\x55\x72\x6c\x28\x27" . $zS["\160\x61\164\150"] . "\x27\51\57\77\44\145\x78\x70\141\x6e\x64\x3d\106\x6f\154\144\x65\x72\163\x2c\x46\x69\x6c\x65\x73";
$this->mo_sps_sync_sharepoint_documents($pY, $zS["\x69\144"]);
lX:
LJ:
}
ux:
if (!isset($jI["\106\151\x6c\145\x73"]["\162\x65\x73\165\x6c\164\163"])) {
goto Pe;
}
foreach ($jI["\x46\151\x6c\x65\163"]["\162\145\163\x75\154\x74\x73"] as $Vj) {
if (!($Vj["\137\x5f\155\x65\x74\x61\x64\x61\164\x61"]["\164\171\x70\x65"] == "\x53\120\x2e\x46\151\x6c\x65")) {
goto oM;
}
array_push($ia, ["\x69\x64" => $Vj["\125\156\151\x71\x75\145\111\x64"], "\x4c\x69\x6e\x6b\x69\156\x67\125\162\x69" => $Vj["\114\151\x6e\153\151\x6e\x67\x55\162\x69"], "\x70\141\x72\x65\156\164\137\146\157\154\x64\145\x72\137\x69\144" => $K2, "\156\141\x6d\145" => $Vj["\116\141\155\145"], "\163\x6c\165\147" => $Vj["\125\156\151\x71\x75\x65\111\x64"], "\160\x61\x74\x68" => $Vj["\x53\x65\162\x76\x65\x72\122\145\154\141\164\151\x76\145\125\x72\x6c"], "\163\x69\x7a\x65" => $Vj["\x4c\145\x6e\147\x74\x68"], "\x74\x69\155\145\137\143\x72\145\x61\x74\x65\x64" => $Vj["\x54\151\155\x65\103\x72\x65\x61\164\145\x64"], "\x74\151\155\145\137\154\x61\x73\164\x5f\155\157\x64\x69\146\151\145\x64" => $Vj["\x54\151\155\145\x4c\141\163\x74\115\x6f\144\151\x66\151\145\144"]]);
oM:
NX:
}
Mo:
Pe:
$xS = ["\x66\x6f\154\144\145\162\163" => $CS, "\146\151\x6c\145\163" => $ia];
return $xS;
}
public function mo_sps_sync_sharepoint_documents($pY, $K2 = 0)
{
$Dj = wpWrapper::mo_sps_get_option(pluginConstants::SHAREPOINT_ROOT_FOLDER);
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["\101\165\x74\x68\157\x72\151\172\141\x74\x69\x6f\x6e" => "\102\x65\x61\162\x65\162\40" . $this->access_token, "\x41\x63\x63\145\160\164" => "\x61\160\160\154\151\143\141\164\151\157\156\x2f\152\163\x6f\156\73\40\x6f\144\141\x74\x61\75\166\x65\x72\142\157\163\145"];
$dw = $this->handler->mo_sps_get_request($pY, $i9);
if (isset($dw["\x64"])) {
goto HW;
}
return;
HW:
$pb = $dw["\144"];
$xS = $this->mo_sps_process_files_and_folders($pb, $K2);
$this->all_documents["\x66\151\154\x65\x73"] = array_merge($this->all_documents["\146\x69\x6c\x65\x73"], $xS["\146\151\154\145\163"]);
$this->all_documents["\x66\x6f\154\x64\x65\162\163"] = array_merge($this->all_documents["\146\x6f\154\144\145\162\x73"], $xS["\x66\x6f\154\x64\x65\162\x73"]);
}
public function mo_sps_send_access_token()
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if (!$this->access_token) {
goto ML;
}
return $this->access_token;
ML:
}
public function mo_sps_download_file_from_sharepoint($Tu)
{
$cA = "\x68\x74\164\160\x73\72\x2f\x2f" . wpWrapper::mo_sps_get_domain_from_url($this->config["\x73\x70\x73\x5f\x72\145\x6c\141\164\151\x76\145\137\165\x72\151"]) . "\x2f\137\x61\160\x69\57\x77\145\142\x2f" . $Tu . "\44\x76\141\x6c\x75\x65";
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["\101\x75\164\x68\157\x72\151\x7a\x61\x74\151\157\156" => "\x42\145\141\x72\145\162\x20" . $this->access_token, "\101\143\143\x65\160\x74\55\x45\x6e\143\157\x64\151\156\147" => "\147\x7a\x69\x70\54\40\143\157\155\x70\x72\x65\x73\163\x2c\40\x64\x65\146\154\141\x74\145\54\40\142\162"];
$Vj = $this->handler->mo_sps_get_media_request($cA, $i9);
return $Vj;
}
public function mo_sps_sync_all_documents_from_sharepoint()
{
set_time_limit(0);
$ri = wpWrapper::mo_sps_get_option(pluginConstants::SHAREPOINT_ROOT_DOC_LIB);
if (!empty($ri)) {
goto pW;
}
$ri = "\57\x53\150\x61\x72\145\x64\x20\104\157\143\x75\155\145\156\164\x73";
pW:
$pY = "\150\164\x74\160\163\x3a\57\57" . wpWrapper::mo_sps_get_domain_from_url($this->config["\163\x70\x73\137\162\x65\154\141\164\151\x76\x65\137\165\x72\151"]) . "\x2f\137\141\160\151\57\167\x65\x62\57\107\x65\164\x46\x6f\154\144\x65\x72\x42\171\x53\145\x72\x76\145\162\122\145\154\141\164\151\x76\145\125\x72\x6c\50\47" . $ri . "\x2f\47\51\x2f\x3f\x24\145\x78\x70\141\x6e\x64\75\106\157\x6c\144\145\x72\163\x2c\x46\x69\x6c\145\x73";
$this->mo_sps_sync_sharepoint_documents($pY);
if (!function_exists("\167\160\x5f\147\145\x6e\x65\162\141\x74\145\x5f\141\164\164\x61\143\x68\x6d\145\156\164\137\x6d\x65\164\141\x64\141\164\x61")) {
include ABSPATH . "\x77\160\55\141\144\155\151\x6e\x2f\151\156\143\x6c\x75\x64\145\163\x2f\151\x6d\141\147\145\x2e\160\150\160";
}
$CS = $this->all_documents["\x66\157\154\x64\145\162\163"];
$a5 = sizeof($CS);
$lq = wpWrapper::mo_sps_get_option(pluginConstants::SHAREPOINT_ROOT_FOLDER);
$pu = sharepointWrapper::mo_sps_get_folder_map_array();
$pu["\60"] = $lq;
$TL = $pu;
$K2 = $a5 - 1;
Cc:
if (!($K2 >= 0)) {
goto f1;
}
$zS = $CS[$K2];
unset($TL[$zS["\x69\144"]]);
if (term_exists($zS["\163\x6c\x75\x67"])) {
goto vA;
}
$Sp = wp_insert_term($zS["\156\x61\x6d\x65"], "\x77\160\155\x66\x2d\x63\x61\164\145\x67\157\162\x79", ["\163\x6c\x75\x67" => $zS["\163\154\165\147"], "\160\x61\162\145\x6e\164" => $pu[$zS["\160\141\x72\x65\156\164\137\146\157\154\144\x65\x72\137\151\x64"]]]);
goto AO;
vA:
$Sp = wp_update_term(term_exists($zS["\x73\154\165\x67"]), "\167\x70\155\x66\x2d\143\x61\x74\145\x67\x6f\162\171", ["\156\141\x6d\x65" => $zS["\156\141\x6d\145"], "\160\x61\162\145\x6e\164" => $pu[$zS["\x70\x61\x72\145\x6e\164\137\146\157\x6c\x64\x65\x72\137\x69\x64"]]]);
AO:
if (!is_wp_error($Sp)) {
goto jQ;
}
return;
jQ:
if (!isset($Sp["\164\145\x72\x6d\x5f\151\144"])) {
goto lA;
}
$To = $Sp["\164\145\162\x6d\x5f\151\x64"];
$pu[$zS["\x69\x64"]] = $To;
sharepointWrapper::mo_sps_update_folder_map($zS["\x69\x64"], $To);
lA:
zw:
$K2--;
goto Cc;
f1:
foreach ($TL as $K2 => $To) {
if (!($K2 === 0)) {
goto bW;
}
goto Ip;
bW:
unset($pu[$K2]);
sharepointWrapper::mo_sps_delete_folder_id($zS["\x69\144"]);
wp_delete_term($To, "\x77\x70\155\x66\55\143\141\x74\x65\147\x6f\x72\171");
Ip:
}
OC:
$ia = $this->all_documents["\x66\151\154\x65\163"];
$cq = sizeof($ia);
$cR = pluginConstants::MIME_TYPES;
$Qw = wp_upload_dir();
$Kw = $Qw["\160\141\x74\x68"];
$rm = $Qw["\x75\x72\x6c"];
$Ak = sharepointWrapper::mo_sps_get_file_map_array();
$lW = $Ak;
$vd = [];
$bH = $cq - 1;
ca:
if (!($bH >= 0)) {
goto K4;
}
$Vj = $ia[$bH];
$Cg = pathinfo($Vj["\x6e\141\155\x65"], PATHINFO_EXTENSION);
$Jf = basename($Vj["\x6e\x61\x6d\145"], "\56" . $Cg);
$mg = $pu[$Vj["\160\x61\x72\145\156\164\137\x66\157\x6c\x64\145\162\x5f\151\x64"]];
if (!($mg == 0)) {
goto tf;
}
$mg = $lq;
tf:
unset($lW[$Vj["\151\144"]]);
$Iu = $Vj["\x73\x69\172\145"];
$Ya = $Vj["\x6e\x61\x6d\x65"];
$Vo = $Kw . "\57" . $Ya;
if (is_admin()) {
goto SL;
}
require_once ABSPATH . "\x77\160\x2d\x61\x64\155\x69\156\x2f\x69\156\x63\x6c\165\144\145\163\x2f\x70\x6f\163\x74\56\x70\150\160";
SL:
if (isset($Ak[$Vj["\151\x64"]])) {
goto UV;
}
$rv = admin_url("\141\144\155\x69\x6e\55\x61\152\141\170\x2e\160\x68\x70") . "\77\141\x63\x74\151\157\x6e\x3d\155\x6f\137\163\x70\163\137\163\171\156\x63\137\x66\151\x6c\145\x26\x66\151\154\145\x5f\151\144\x3d" . $Vj["\x69\x64"] . "\46\144\157\167\156\154\157\x61\x64\75\x30";
$qO = wp_insert_attachment(array("\147\165\151\144" => $rm . "\x2f" . $Ya, "\160\157\x73\164\137\x74\151\164\154\x65" => $Jf, "\x70\157\x73\164\137\163\x74\x61\x74\165\163" => "\x69\x6e\150\x65\x72\x69\x74", "\160\157\163\x74\x5f\x6d\x69\155\145\x5f\x74\x79\x70\x65" => $cR[strtolower($Cg)], "\x6d\145\164\141\137\151\x6e\160\165\x74" => array("\x6d\x6f\137\x73\x70\163\137\x66\151\x6c\145\137\x75\x72\x6c" => $rv)), $Vo);
wp_set_object_terms((int) $qO, (int) $mg, "\167\x70\155\146\x2d\x63\x61\164\x65\147\x6f\162\x79", true);
update_post_meta($qO, "\167\x70\155\146\137\163\x69\172\145", $Iu);
update_post_meta($qO, "\167\x70\x6d\x66\x5f\164\171\160\145", strtolower($Cg));
update_post_meta($qO, "\x5f\167\x70\x5f\x61\x74\164\x61\143\150\x65\x64\137\146\x69\x6c\145", $Ya);
update_post_meta($qO, "\155\157\x5f\163\x70\163\137\162\145\154\x61\164\x69\x76\x65\x5f\x70\141\x74\150", $Vj["\x70\141\x74\x68"]);
update_post_meta($qO, "\155\157\137\163\x70\x73\x5f\146\151\x6c\x65\137\145\144\x69\x74\x5f\x75\162\x6c", $Vj["\x4c\x69\156\153\x69\x6e\147\x55\x72\151"]);
if (!(strpos($cR[strtolower($Cg)], "\151\155\x61\x67\145") !== false)) {
goto Rp;
}
array_push($vd, ["\151\x64" => $qO, "\146\x69\x6c\145\x5f\x75\x72\154" => $rv]);
Rp:
goto U_;
UV:
$qO = $Ak[$Vj["\151\x64"]];
$rv = admin_url("\141\144\155\x69\x6e\x2d\x61\x6a\141\x78\x2e\x70\x68\x70") . "\x3f\x61\x63\x74\x69\157\156\x3d\155\x6f\x5f\x73\160\x73\137\163\171\x6e\143\137\146\151\x6c\145\46\x66\x69\154\x65\x5f\151\x64\75" . $Vj["\151\144"] . "\46\x64\x6f\x77\x6e\x6c\157\141\144\75\x30";
wp_update_post(array("\111\x44" => $qO, "\x70\x6f\x73\164\x5f\164\151\164\x6c\x65" => $Jf, "\160\157\163\x74\x5f\x6d\151\x6d\145\x5f\x74\171\x70\145" => $cR[strtolower($Cg)]));
wp_set_object_terms((int) $qO, (int) $mg, "\x77\x70\155\146\55\x63\x61\164\145\147\x6f\x72\171", true);
update_post_meta($qO, "\137\x77\x70\137\x61\164\164\141\x63\x68\x65\144\137\146\x69\154\145", $Ya);
update_post_meta($qO, "\167\160\x6d\x66\x5f\x73\151\172\145", $Iu);
update_post_meta($qO, "\155\x6f\x5f\163\160\163\137\x72\145\154\141\x74\x69\x76\x65\137\x70\141\x74\x68", $Vj["\160\141\x74\150"]);
update_post_meta($qO, "\x6d\x6f\x5f\163\x70\163\x5f\x66\151\x6c\145\137\x75\162\154", $rv);
update_post_meta($qO, "\x6d\x6f\x5f\x73\160\163\x5f\x66\151\x6c\x65\137\x65\144\x69\164\x5f\165\x72\154", $Vj["\114\x69\156\x6b\151\156\147\x55\x72\x69"]);
U_:
$Ak[$Vj["\x69\x64"]] = $qO;
sharepointWrapper::mo_sps_update_file_map($Vj["\151\x64"], $qO);
BQ:
$bH--;
goto ca;
K4:
foreach ($lW as $bH => $qO) {
unset($Ak[$bH]);
sharepointWrapper::mo_sps_delete_file_id($Ak[$bH]);
wp_delete_post($qO, true);
F1:
}
hG:
foreach ($vd as $n1) {
$rk = wp_generate_attachment_metadata($n1["\x69\144"], $n1["\146\151\x6c\145\x5f\165\162\x6c"]);
wp_update_attachment_metadata($n1["\151\144"], $rk);
FU:
}
xm:
set_time_limit(120);
error_log("\145\156\144\x2e\56\56\56");
}
public function mo_sps_get_all_site_news()
{
$ri = explode($this->config["\x61\x64\x6d\151\x6e\x5f\165\x72\x69"], $this->config["\163\x70\163\137\x72\145\x6c\x61\x74\x69\166\145\x5f\165\x72\151"]);
if (empty($ri) || empty($ri[1])) {
goto A5;
}
$ri = trailingslashit($ri[1] . '');
goto WU;
A5:
$ri = '';
WU:
$YO = "\x68\x74\x74\160\x73\x3a\57\x2f" . wpWrapper::mo_sps_get_domain_from_url($this->config["\163\x70\x73\137\162\x65\154\x61\x74\x69\x76\145\x5f\165\162\151"]) . "\57\137\x61\x70\x69\57\x77\x65\x62\57\x6c\x69\163\x74\x73\x2f\147\x65\x74\x42\x79\x54\x69\164\x6c\x65\x28\x27\123\x69\x74\x65\40\x50\141\x67\145\x73\x27\51\x2f\x69\164\145\x6d\x73\x2f";
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["\x41\165\164\x68\x6f\162\151\172\x61\x74\151\x6f\x6e" => "\x42\x65\141\x72\145\x72\x20" . $this->access_token, "\101\x63\x63\x65\160\164" => "\141\x70\x70\x6c\x69\x63\x61\164\x69\x6f\x6e\x2f\x6a\163\157\156\73\40\x6f\144\x61\164\141\75\166\x65\x72\142\x6f\x73\x65"];
$Xj = $this->handler->mo_sps_get_request($YO, $i9);
return $Xj;
}
public function mo_sps_get_all_site_events()
{
$ri = explode($this->config["\141\144\155\151\x6e\137\x75\162\151"], $this->config["\x73\x70\x73\x5f\162\x65\154\141\164\151\x76\x65\137\165\x72\x69"]);
if (empty($ri) || empty($ri[1])) {
goto we;
}
$ri = trailingslashit($ri[1] . '');
goto OM;
we:
$ri = '';
OM:
$yJ = "\150\164\x74\x70\x73\x3a\x2f\x2f" . wpWrapper::mo_sps_get_domain_from_url($this->config["\x73\160\163\x5f\x72\x65\154\141\164\x69\x76\x65\x5f\x75\x72\151"]) . "\x2f\137\x61\160\x69\x2f\x77\145\142\x2f\154\151\x73\164\163\57\x67\145\164\x42\x79\x54\151\164\154\145\x28\x27\105\x76\145\x6e\x74\163\x27\x29\x2f\x69\164\x65\155\163";
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["\x41\x75\164\x68\x6f\x72\151\x7a\x61\x74\151\157\x6e" => "\102\145\141\x72\145\x72\x20" . $this->access_token, "\101\143\x63\x65\160\164" => "\x61\160\x70\x6c\x69\143\x61\164\x69\157\x6e\57\152\163\157\156\73\x20\157\144\141\x74\x61\x3d\x76\x65\162\x62\157\x73\145"];
$Xj = $this->handler->mo_sps_get_request($yJ, $i9);
return $Xj;
}
public function mo_sps_get_banerurl_for_an_artcile($DD)
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["\101\165\164\150\157\162\151\x7a\141\164\x69\157\156" => "\102\145\141\x72\145\x72\x20" . $this->access_token];
$Xj = $this->handler->mo_sps_get_media_request($DD, $i9);
return $Xj;
}
public function mo_sps_get_specific_user_detail()
{
$ri = explode($this->config["\x61\x64\x6d\x69\x6e\137\165\x72\151"], $this->config["\x73\160\163\137\162\x65\x6c\141\x74\151\166\145\137\165\162\151"]);
if (empty($ri) || empty($ri[1])) {
goto Db;
}
$ri = trailingslashit($ri[1] . '');
goto b4;
Db:
$ri = '';
b4:
$Fe = "\x68\x74\x74\160\x73\72\x2f\57" . wpWrapper::mo_sps_get_domain_from_url($this->config["\x73\x70\x73\x5f\162\x65\154\x61\x74\151\166\x65\137\x75\162\x69"]) . "\x2f\x5f\141\x70\x69\57\x77\x65\142\x2f\x47\145\x74\106\157\x6c\x64\x65\x72\x42\x79\x53\x65\x72\x76\x65\x72\x52\x65\154\141\164\x69\x76\145\x55\x72\x6c\50\x27\x2f" . $ri . "\x27\51\x2f\x3f\44\x65\x78\160\141\156\x64\x3d\106\x6f\154\144\145\162\163\x2c\106\151\x6c\145\x73";
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
$i9 = ["\x41\x75\164\150\x6f\162\x69\172\141\164\x69\157\156" => "\x42\145\x61\x72\x65\x72\40" . $this->access_token, "\x41\x63\x63\x65\x70\x74" => "\x61\x70\160\x6c\x69\143\x61\164\151\157\x6e\57\152\x73\157\x6e\73\x20\x6f\144\x61\164\141\x3d\166\x65\162\142\x6f\163\x65"];
$Xj = $this->handler->mo_sps_get_request($Fe, $i9);
return $Xj;
}
public function mo_sps_sync_doc_media_lib()
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_grpah_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if (!(!$this->access_token || isset($this->access_token["\145\x72\162\157\162"]))) {
goto qx;
}
return;
qx:
$ll = wpWrapper::mo_sps_get_option("\155\x6f\x5f\x73\160\x73\137\x73\x65\x6c\145\143\x74\145\144\137\163\151\x74\145");
$UM = wpWrapper::mo_sps_get_option("\x6d\x6f\137\x73\160\x73\137\163\x65\x6c\145\x63\x74\145\144\137\144\x72\x69\x76\x65");
$o7 = "\150\x74\164\160\x73\x3a\57\x2f\x67\x72\141\160\150\x2e\155\151\143\162\157\x73\157\x66\x74\56\143\x6f\155\x2f\166\61\x2e\x30\57\x73\x69\164\145\163\x2f" . $ll["\163\151\164\x65\x5f\x69\144"] . "\57\x64\162\151\166\x65\163\x2f" . $UM["\144\162\x69\166\x65\137\x69\x64"] . "\57\162\x6f\157\x74\57\x63\x68\151\x6c\144\162\x65\156";
$i9 = ["\101\165\164\x68\157\162\151\x7a\x61\164\151\157\156" => "\x42\x65\141\162\145\162\x20" . $this->access_token, "\103\x6f\156\164\145\156\x74\x2d\x74\x79\160\145" => "\x61\160\160\154\x69\x63\x61\164\x69\x6f\156\57\152\163\x6f\x6e"];
$dw = $this->handler->mo_sps_get_media_request($o7, $i9);
$dw = json_decode($dw["\x64\x61\164\141"], true);
$St = $dw["\x76\x61\x6c\x75\145"];
foreach ($St as $R4) {
if (isset($R4["\x66\x6f\x6c\x64\x65\x72"])) {
goto RZ;
}
if (isset($R4["\146\x69\154\145"])) {
goto gN;
}
goto p4;
RZ:
wp_schedule_single_event(time(), "\x6d\157\137\x73\160\163\x5f\146\x6f\154\x64\145\162\x5f\x73\171\156\x63\x5f\x61\143\x74\x69\x6f\x6e", ["\146\157\x6c\x64\145\x72\x5f\x69\144" => $R4["\151\144"]]);
goto p4;
gN:
$Qw = wp_upload_dir();
$Kw = $Qw["\160\x61\164\150"];
$rm = $Qw["\165\x72\154"];
$Ya = $R4["\x6e\141\155\145"];
$Cg = pathinfo($R4["\x6e\141\155\145"], PATHINFO_EXTENSION);
$Jf = basename($R4["\156\141\x6d\x65"], "\56" . $Cg);
$cR = pluginConstants::MIME_TYPES;
$rv = admin_url("\x61\144\x6d\151\156\55\x61\152\141\x78\56\x70\x68\x70") . "\x3f\x61\143\164\151\157\156\x3d\155\x6f\137\163\x70\163\137\x67\x65\x6e\145\x72\141\164\x65\x5f\165\162\x6c\46\146\x69\x6c\x65\x5f\x69\x64\x3d" . $R4["\x69\144"] . "\x26\x64\x72\x69\x76\145\x5f\151\x64\75" . $R4["\x70\141\x72\x65\x6e\x74\122\145\146\145\162\145\x6e\143\145"]["\144\162\x69\x76\145\x49\x64"];
$Vo = $Kw . "\x2f" . $Ya;
$Ep = $this->mo_sps_post_exists_already($R4["\151\x64"]);
if ($Ep) {
goto l6;
}
$this->mp_sps_insert_in_media_library($rm, $Ya, $Jf, $cR, $Cg, $rv, $Vo, $R4["\x69\x64"]);
goto Kz;
l6:
$qO = get_post_thumbnail_id($Ep);
$jj = array("\x70\x6f\163\164\137\x74\x69\x74\154\145" => $Jf, "\160\x6f\163\164\x5f\x73\164\x61\x74\165\x73" => "\x69\156\x68\145\162\x69\164", "\x70\157\x73\164\137\x6d\151\155\x65\137\164\171\160\145" => $cR[strtolower($Cg)], "\155\x65\164\x61\137\151\156\x70\165\164" => array("\155\157\x5f\x73\160\163\x5f\x66\x69\154\145\x5f\x75\x72\x6c" => $rv, "\x6d\157\x5f\x73\x70\x73\x5f\x66\x69\154\145\x5f\151\x64" => $R4["\x69\x64"]));
wp_update_attachment_metadata($qO, $jj);
Kz:
p4:
Hh:
}
gr:
}
public function mo_sps_sync_folder_files_in_media($K2)
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_grpah_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if (!(!$this->access_token || isset($this->access_token["\145\162\162\x6f\x72"]))) {
goto uX;
}
return;
uX:
$UM = wpWrapper::mo_sps_get_option("\x6d\157\137\163\x70\163\x5f\x73\x65\154\145\x63\164\145\x64\x5f\144\162\151\x76\145");
$o7 = "\150\164\164\x70\163\72\57\57\147\162\141\160\x68\56\x6d\x69\x63\x72\x6f\163\x6f\146\x74\56\143\x6f\x6d\x2f\166\61\x2e\60\x2f\x64\162\151\x76\145\x73\57" . $UM["\144\162\x69\x76\x65\137\151\144"] . "\x2f\151\164\x65\x6d\163\57" . $K2 . "\57\143\x68\x69\x6c\144\162\145\x6e";
$i9 = ["\101\165\x74\x68\157\x72\x69\x7a\x61\x74\151\x6f\x6e" => "\102\x65\x61\162\x65\x72\40" . $this->access_token, "\103\x6f\156\x74\x65\156\x74\x2d\x74\x79\160\x65" => "\141\160\x70\x6c\x69\143\x61\x74\x69\157\156\57\152\x73\x6f\x6e"];
$dw = $this->handler->mo_sps_get_media_request($o7, $i9);
$dw = json_decode($dw["\x64\x61\164\141"], true);
$St = $dw["\166\x61\x6c\165\x65"];
foreach ($St as $R4) {
if (!empty($R4["\x66\157\x6c\144\145\162"]) && $R4["\x66\157\x6c\144\145\162"]["\143\x68\151\x6c\x64\x43\x6f\165\156\164"]) {
goto ol;
}
if (isset($R4["\146\151\x6c\145"])) {
goto hv;
}
goto eD;
ol:
wp_schedule_single_event(time(), "\155\x6f\x5f\x73\160\163\x5f\146\x6f\154\x64\145\x72\x5f\x73\171\156\x63\x5f\x61\x63\164\x69\x6f\x6e", ["\146\157\154\144\145\162\x5f\151\144" => $R4["\151\144"]]);
goto eD;
hv:
$Qw = wp_upload_dir();
$Kw = $Qw["\160\x61\164\150"];
$rm = $Qw["\x75\162\x6c"];
$Ya = $R4["\156\x61\x6d\x65"];
$Cg = pathinfo($R4["\156\141\155\x65"], PATHINFO_EXTENSION);
$Jf = basename($R4["\x6e\141\x6d\145"], "\56" . $Cg);
$cR = pluginConstants::MIME_TYPES;
$rv = admin_url("\141\144\x6d\151\x6e\x2d\x61\152\x61\x78\x2e\x70\x68\160") . "\77\141\x63\x74\x69\x6f\x6e\75\155\157\x5f\x73\160\x73\137\x67\145\156\x65\162\141\164\x65\x5f\165\x72\154\x26\146\x69\x6c\145\x5f\151\144\75" . $R4["\x69\x64"] . "\46\x64\162\151\166\145\x5f\151\x64\x3d" . $R4["\x70\x61\162\x65\156\x74\x52\x65\x66\145\x72\x65\156\143\145"]["\x64\162\151\x76\145\x49\144"];
$Vo = $Kw . "\x2f" . $Ya;
$Ep = $this->mo_sps_post_exists_already($R4["\151\x64"]);
if ($Ep) {
goto MV;
}
$this->mp_sps_insert_in_media_library($rm, $Ya, $Jf, $cR, $Cg, $rv, $Vo, $R4["\151\144"]);
goto IP;
MV:
$qO = get_post_thumbnail_id($Ep);
$jj = array("\x70\157\163\x74\x5f\x74\x69\164\x6c\145" => $Jf, "\160\157\x73\x74\x5f\x73\164\x61\x74\165\x73" => "\151\156\150\145\x72\x69\x74", "\160\157\x73\x74\x5f\155\151\x6d\x65\x5f\x74\x79\x70\x65" => $cR[strtolower($Cg)], "\x6d\145\x74\x61\137\151\156\160\x75\164" => array("\x6d\x6f\x5f\x73\160\x73\137\146\x69\154\145\x5f\165\x72\x6c" => $rv, "\155\157\137\x73\x70\x73\x5f\146\151\x6c\145\x5f\x69\144" => $R4["\x69\144"]));
wp_update_attachment_metadata($qO, $jj);
IP:
eD:
pJ:
}
Py:
}
public function mp_sps_insert_in_media_library($rm, $Ya, $Jf, $cR, $Cg, $rv, $Vo, $bH)
{
$qO = wp_insert_attachment(array("\x67\x75\151\144" => $rm . "\57" . $Ya, "\x70\157\163\x74\137\164\x69\164\154\x65" => $Jf, "\160\157\163\x74\x5f\x73\164\x61\164\165\163" => "\x69\156\150\145\x72\x69\164", "\x70\157\163\164\x5f\155\151\x6d\145\137\164\x79\160\145" => $cR[strtolower($Cg)], "\x6d\x65\x74\x61\137\151\156\x70\165\x74" => array("\x6d\157\x5f\163\160\x73\137\x66\151\154\x65\x5f\165\162\x6c" => $rv, "\x6d\157\137\x73\x70\x73\x5f\146\151\x6c\145\x5f\x69\144" => $bH)), $Vo);
update_post_meta($qO, "\x5f\x77\160\x5f\141\x74\x74\141\143\x68\155\x65\156\x74\x5f\146\151\154\145\x5f\165\162\x6c\x73", $rv);
return $qO;
}
public function mo_sps_post_exists_already($Vh)
{
$Rr = "\x6d\157\137\163\x70\x73\x5f\x66\x69\x6c\x65\x5f\x69\144";
$i9 = array("\x70\x6f\x73\164\137\164\x79\160\145" => "\141\164\164\x61\x63\x68\155\x65\156\x74", "\155\145\164\141\137\x6b\x65\171" => $Rr, "\155\145\164\141\x5f\166\x61\154\x75\x65" => $Vh, "\x70\x6f\x73\x74\163\x5f\x70\x65\x72\137\x70\x61\x67\x65" => 1);
$ug = get_posts($i9);
if (!empty($ug)) {
goto gT;
}
return false;
goto PS;
gT:
$Ep = $ug[0]->ID;
return $Ep;
PS:
}
public function mo_sps_get_file_download_url($bH, $xc)
{
$this->access_token = sanitize_text_field($this->handler->mo_sps_get_grpah_access_token_using_client_credentials($this->endpoints, $this->config, $this->scope));
if (!(!$this->access_token || isset($this->access_token["\x65\162\x72\x6f\162"]))) {
goto Ez;
}
return;
Ez:
$o7 = "\150\x74\164\160\x73\72\57\57\147\x72\141\160\x68\x2e\x6d\x69\143\162\157\163\x6f\x66\164\56\143\x6f\155\57\x76\x31\56\60\x2f\x64\x72\x69\166\145\163\57" . $xc . "\x2f\x69\164\145\x6d\x73\x2f" . $bH;
$i9 = ["\101\x75\x74\x68\x6f\162\x69\172\141\x74\151\x6f\156" => "\102\145\x61\x72\x65\x72\40" . $this->access_token, "\103\157\156\164\x65\x6e\x74\x2d\164\x79\160\x65" => "\141\x70\x70\x6c\x69\143\x61\164\151\157\x6e\x2f\152\163\157\x6e"];
$dw = $this->handler->mo_sps_get_media_request($o7, $i9);
$dw = json_decode($dw["\144\141\164\141"], true);
$o2["\x64\x6f\167\156\154\x6f\141\144\137\x75\162\x6c"] = $dw["\100\x6d\151\x63\x72\157\163\157\x66\164\x2e\x67\162\141\160\150\56\144\157\x77\156\154\157\x61\144\x55\x72\x6c"];
$o2["\x66\151\154\145\137\x74\x79\160\145"] = $dw["\x66\151\x6c\x65"]["\x6d\151\155\145\x54\x79\x70\145"];
return $o2;
}
}
Function Calls
None |
Stats
MD5 | 293e427e322b1b14ec367fbbafd8237b |
Eval Count | 0 |
Decode Time | 104 ms |