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 class Setting extends ControllerExtensionModuleOCFilter { protected $PEwvNF..
Decoded Output download
<?php
class Setting extends ControllerExtensionModuleOCFilter
{
protected $PEwvNF0M5vr2wa3F;
protected $q0FeneXJzeOHe87H = [];
protected function hasPermissionEdit() {
if ($this->user->hasPermission("modify", "extension/module/ocfilter")) {
return !$this->q0FeneXJzeOHe87H;
} else {
$this->q0FeneXJzeOHe87H["warning"] = $this->language->get("error_permission");
return false;
}
}
protected function itsLocalhost() {
if (array_key_exists("SERVER_ADDR", $_SERVER)) {
$ip = $_SERVER["SERVER_ADDR"];
} elseif (array_key_exists("LOCAL_ADDR", $_SERVER)) {
$ip = $_SERVER["LOCAL_ADDR"];
} elseif (array_key_exists("SERVER_NAME", $_SERVER)) {
$ip = gethostbyname($_SERVER["SERVER_NAME"]);
} else {
$ip= false;
}
return $ip == "127.0.0.1" || $ip == "::1";
}
//$UMIt23YjQ6uq9EjW = "";
protected function getDomain($url) {
$url = trim(str_replace(["http://", "https://", "www."], '', $url), "/");
$Punycode = new Punycode();
$url = $Punycode->decode($url);
$url = preg_replace("/\/.+\$/", '', $url);
$url = preg_replace("/:\d+\$/", '', $url);
if (preg_match("/(?P<domain>[a-a-z0-9][a-a-z0-9\-]{1,63}\.[a-a-z\.]{2,6})\$/iu", $url, $Ags)) {
return $Ags["domain"];
}
return $url;
}
// $fGz9VZhWEcJ2sRcF = '';
protected function checkDomain($rb3UU61Mengyh5wp) {
if (!($this->itsLocalhost() === true)) {
return false;
}
if (!(array_key_exists("HTTP_HOST", $_SERVER) && $_SERVER["HTTP_HOST"])) {
return false;
}
$Domain = $this->getDomain($_SERVER["HTTP_HOST"]);
if (stripos($this->getDomain(constant("HTTPS_SERVER")), $Domain) !== false) {
return false;
}
$OYWt4tO1pdsRw8uO = hash_hmac("md5", $Domain, "070a5bf355e404891f4ccaee8ae93143");
return hash_equals($rb3UU61Mengyh5wp, $OYWt4tO1pdsRw8uO);
}
protected function Cfbc31e610620b2a4()
{
parent::checkInstall();
$this->load->language("extension/module/ocfilter");
$this->load->model("extension/module/ocfilter/setting");
$this->ocfilter->admin->setControllerEntityConfig(!0);
$R64CWyu5Nif9DGfG = $this->load->language("extension/module/ocfilter");
$this->load->model("setting/setting");
if ($this->ocfilter->opencart->version>= 30) {
$uG06cxqOHgn3IjOu = "module_ocfilter";
goto nW3HEE3hfsR0uFoF;
}
$uG06cxqOHgn3IjOu = "ocfilter";
nW3HEE3hfsR0uFoF:
$UMIt23YjQ6uq9EjW = function ($anna05IfEMEausST) {
$anna05IfEMEausST = trim(str_replace(["http://", "https://", "www."], '', $anna05IfEMEausST), "/");
$Punycode = new Punycode();
$anna05IfEMEausST = $Punycode->decode($anna05IfEMEausST);
$anna05IfEMEausST = preg_replace("/\/.+\$/", '', $anna05IfEMEausST);
$anna05IfEMEausST = preg_replace("/:\d+\$/", '', $anna05IfEMEausST);
if (preg_match("/(?P<domain>[a-a-z0-9][a-a-z0-9\-]{1,63}\.[a-a-z\.]{2,6})\$/iu", $anna05IfEMEausST, $AgsYrc3KCr_OuwZi)) {
return $AgsYrc3KCr_OuwZi["domain"];
}
return $anna05IfEMEausST;
};
$rodFDfuV2C_7dY_O = function () {
if (!true === $this->itsLocalhost()) {
return true;
}
$rb3UU61Mengyh5wp = $this->request->post['license'] ?? '';
if (!$rb3UU61Mengyh5wp && $this->request->server['REQUEST_METHOD'] == 'POST') {
return false;
}
if ($rb3UU61Mengyh5wp && !$this->checkDomain($rb3UU61Mengyh5wp)) {
return false;
}
$this->ocfilter->setting->add("status", 0);
$this->ocfilter->setting->add("license", '');
if ($this->q0FeneXJzeOHe87H) {
$this->q0FeneXJzeOHe87H['license'] = $this->language->get("error_license");
return false;
}
$this->model_setting_setting->editSetting("ocfilter", ["ocfilter_status" => 0]);
$this->ocfilter->setting->add("use_multi_currency", $this->model_extension_module_ocfilter_setting->isUseMultiCurrency());
$this->ocfilter->setting->add("use_tmd_currency", $this->model_extension_module_ocfilter_setting->isUseTMDCurrency());
$this->ocfilter->setting->add("use_kj_series", $this->model_extension_module_ocfilter_setting->isUseKJseries());
$this->ocfilter->setting->add("use_manufacturer_description", $this->model_extension_module_ocfilter_setting->isUseManufacturerDescription());
$this->ocfilter->setting->add("use_main_category", $this->model_extension_module_ocfilter_setting->isUseMainCategory());
$this->ocfilter->setting->add("use_hpmodel", $this->model_extension_module_ocfilter_setting->isUseHPModel());
$this->ocfilter->setting->add("use_product_master", $this->model_extension_module_ocfilter_setting->isUseProductMaster());
return true;
};
if ($this->request->server["REQUEST_METHOD"] == "POST" && $this->hasPermissionEdit() && $rodFDfuV2C_7dY_O()) {
if (isset($this->request->post["copy_attribute_id_exclude"])) {
goto oJAmm86GMzPOznNS;
}
$this->request->post["copy_attribute_id_exclude"] = 0;
oJAmm86GMzPOznNS:
if (isset($this->request->post["copy_attribute_group_id_exclude"])) {
goto Ng4Ww3Z0rdZBY0fQ;
}
$this->request->post["copy_attribute_group_id_exclude"] = 0;
Ng4Ww3Z0rdZBY0fQ:
if (isset($this->request->post["copy_attribute_category_id_exclude"])) {
goto pIS5kZ7qtNTNTI55;
}
$this->request->post["copy_attribute_category_id_exclude"] = 0;
pIS5kZ7qtNTNTI55:
$this->ocfilter->setting->set($this->request->post);
$this->ocfilter->setting->add("use_multi_currency", $this->model_extension_module_ocfilter_setting->isUseMultiCurrency());
$this->ocfilter->setting->add("use_tmd_currency", $this->model_extension_module_ocfilter_setting->isUseTMDCurrency());
$this->ocfilter->setting->add("use_kj_series", $this->model_extension_module_ocfilter_setting->isUseKJseries());
$this->ocfilter->setting->add("use_manufacturer_description", $this->model_extension_module_ocfilter_setting->isUseManufacturerDescription());
$this->ocfilter->setting->add("use_main_category", $this->model_extension_module_ocfilter_setting->isUseMainCategory());
$this->ocfilter->setting->add("use_hpmodel", $this->model_extension_module_ocfilter_setting->isUseHPModel());
$this->ocfilter->setting->add("use_product_master", $this->model_extension_module_ocfilter_setting->isUseProductMaster());
$this->ocfilter->setting->add("use_product_multistore", $this->model_extension_module_ocfilter_setting->isUseProductMultistore());
$this->ocfilter->setting->add("use_special_prefix", $this->model_extension_module_ocfilter_setting->isUseSpecialPrefix());
$this->ocfilter->setting->add("time_offset", $this->model_extension_module_ocfilter_setting->getTime() - time());
if (empty($this->model_setting_setting->getSetting("fx"))) {
goto J51fA7E9Htg6o_ky;
}
$vtUlXc9ZbBdishZj = explode(",", (string) $this->model_extension_module_ocfilter_setting->getSettingValue("fx_gets_exclude"));
$vtUlXc9ZbBdishZj = array_merge($vtUlXc9ZbBdishZj, ["ocf", "ocfilter_placement", "ocfilter_page_id"]);
$OyPiV91CVhdRHtgk = implode(",", array_unique($vtUlXc9ZbBdishZj));
$this->model_extension_module_ocfilter_setting->editSettingValue("fx", "fx_gets_exclude", $OyPiV91CVhdRHtgk);
J51fA7E9Htg6o_ky:
if (empty($this->model_setting_setting->getSetting("fx_sitemap"))) {
goto TVdZRCHffaDvB_6q;
}
$vTzrVqBe4x1gdCAb = json_decode($this->model_extension_module_ocfilter_setting->getSettingValue("fx_sitemap_settings"), true);
$vTzrVqBe4x1gdCAb["ocfilter_on"] = 0;
$this->model_extension_module_ocfilter_setting->editSettingValue("fx_sitemap", "fx_sitemap_settings", json_encode($vTzrVqBe4x1gdCAb));
TVdZRCHffaDvB_6q:
if (empty($this->model_setting_setting->getSetting("fx_brands"))) {
goto awk0Y87gDGNqzojR;
}
$eECWrxa2XUSyJMm6 = json_decode($this->model_extension_module_ocfilter_setting->getSettingValue("fx_brands_settings"), true);
$eECWrxa2XUSyJMm6["fx_brands_status"] = 0;
$this->model_extension_module_ocfilter_setting->editSettingValue("fx_brands", "fx_brands_settings", json_encode($eECWrxa2XUSyJMm6));
awk0Y87gDGNqzojR:
$this->model_setting_setting->editSetting($uG06cxqOHgn3IjOu, [$uG06cxqOHgn3IjOu . "_status" => $this->request->post["status"]]);
$this->ocfilter->cache->delete("*");
$this->model_extension_module_ocfilter_setting->setSitemapKeyword();
$this->session->data["success"] = $this->language->get("text_success");
if (isset($this->request->get["apply"])) {
$this->response->redirect($this->url->link("extension/module/ocfilter", $this->ocfilter->admin->getToken(!0), "SSL"));
goto d5NLBWwzalJ_X4_u;
}
if ($this->ocfilter->opencart->version>= 30) {
$this->response->redirect($this->url->link("marketplace/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0));
goto Laz652GllpMJbYMM;
}
if ($this->ocfilter->opencart->version== 23) {
$this->response->redirect($this->url->link("extension/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0));
goto NziCxATRbYgnRi1f;
}
$this->response->redirect($this->url->link("extension/module", $this->ocfilter->admin->getToken(!0), "SSL"));
NziCxATRbYgnRi1f:
Laz652GllpMJbYMM:
d5NLBWwzalJ_X4_u:
goto GvFRy0pKN_iqjsEo;
}
if (!($this->request->server["REQUEST_METHOD"] != "POST")) {
goto sHPvLl8Jg5UhVC44;
}
$rodFDfuV2C_7dY_O();
sHPvLl8Jg5UhVC44:
GvFRy0pKN_iqjsEo:
$U0WKAj8kGGEudiWI = "constant";
$this->document->addStyle("view/stylesheet/ocfilter/ocfilter.css?v=" . constant("OCF_VERSION"));
$this->document->addScript("view/javascript/ocfilter/ocfilter.js?v=" . constant("OCF_VERSION"));
$this->document->setTitle($this->language->get("heading_title_setting"));
if (isset($this->q0FeneXJzeOHe87H["warning"])) {
$R64CWyu5Nif9DGfG["error_warning"] = $this->q0FeneXJzeOHe87H["warning"];
goto jys_StferQbb7mnq;
}
$R64CWyu5Nif9DGfG["error_warning"] = '';
jys_StferQbb7mnq:
if (isset($this->q0FeneXJzeOHe87H["license"])) {
$R64CWyu5Nif9DGfG["error_license"] = $this->q0FeneXJzeOHe87H["license"];
goto aiZOLOULUJ2ZxprR;
}
$R64CWyu5Nif9DGfG["error_license"] = '';
aiZOLOULUJ2ZxprR:
if (isset($this->session->data["success"])) {
$R64CWyu5Nif9DGfG["success"] = $this->session->data["success"];
unset($this->session->data["success"]);
goto vnKlwOwTIZ6_BouO;
}
$R64CWyu5Nif9DGfG["success"] = '';
vnKlwOwTIZ6_BouO:
$R64CWyu5Nif9DGfG["breadcrumbs"] = [];
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("text_home"), "href" => $this->url->link("common/dashboard", $this->ocfilter->admin->getToken(!0), "SSL")];
if ($this->ocfilter->opencart->version>= 30) {
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("text_module"), "href" => $this->url->link("marketplace/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0)];
goto j7wJpFRdfN5dveRQ;
}
if ($this->ocfilter->opencart->version== 23) {
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("text_module"), "href" => $this->url->link("extension/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0)];
goto umSC6QJiyMZhXoKw;
}
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("text_module"), "href" => $this->url->link("extension/module", $this->ocfilter->admin->getToken(!0), "SSL")];
umSC6QJiyMZhXoKw:
j7wJpFRdfN5dveRQ:
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("heading_title_setting"), "href" => $this->url->link("extension/module/ocfilter", $this->ocfilter->admin->getToken(!0), "SSL")];
$R64CWyu5Nif9DGfG["text_edit"] = sprintf($this->language->get("text_edit"), date($this->language->get("date_format_short"), strtotime($U0WKAj8kGGEudiWI("OCF_RELEASE_DATE"))), $U0WKAj8kGGEudiWI("OCF_VERSION"));
$R64CWyu5Nif9DGfG["text_placement"] = sprintf($this->language->get("text_placement"), $this->url->link("design/layout", $this->ocfilter->admin->getToken(!0), "SSL"));
$R64CWyu5Nif9DGfG["text_cache_system"] = sprintf($this->language->get("text_cache_system"), $this->config->get("cache_engine") ? $this->config->get("cache_engine") : $this->config->get("cache_type"));
$R64CWyu5Nif9DGfG["save"] = $this->url->link("extension/module/ocfilter", $this->ocfilter->admin->getToken(!0), "SSL");
$R64CWyu5Nif9DGfG["apply"] = $this->url->link("extension/module/ocfilter", $this->ocfilter->admin->getToken(!0) . "&apply=1", "SSL");
if ($this->ocfilter->opencart->version>= 30) {
$R64CWyu5Nif9DGfG["cancel"] = $this->url->link("marketplace/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0);
goto v8dgBczMGhEeTf3m;
}
if ($this->ocfilter->opencart->version== 23) {
$R64CWyu5Nif9DGfG["cancel"] = $this->url->link("extension/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0);
goto cLW_p911iDHf04GK;
}
$R64CWyu5Nif9DGfG["cancel"] = $this->url->link("extension/module", $this->ocfilter->admin->getToken(!0), "SSL");
cLW_p911iDHf04GK:
v8dgBczMGhEeTf3m:
$R64CWyu5Nif9DGfG["filter_list"] = $this->url->link("extension/module/ocfilter/filter", $this->ocfilter->admin->getToken(!0), "SSL");
$R64CWyu5Nif9DGfG["filter_page_list"] = $this->url->link("extension/module/ocfilter/page", $this->ocfilter->admin->getToken(!0), "SSL");
$R64CWyu5Nif9DGfG[$this->ocfilter->admin->getTokenIndex()] = $this->ocfilter->admin->getToken();
$this->load->model("localisation/language");
$R64CWyu5Nif9DGfG["languages"] = $this->model_localisation_language->getLanguages();
foreach ($R64CWyu5Nif9DGfG["languages"] as $FP6gDrBONoVxbBkU => $Hr1aSfZkSvnT9JBM) {
if (is_file($U0WKAj8kGGEudiWI("DIR_LANGUAGE") . strtolower($Hr1aSfZkSvnT9JBM["code"]) . "/" . strtolower($Hr1aSfZkSvnT9JBM["code"]) . ".png")) {
$R64CWyu5Nif9DGfG["languages"][$FP6gDrBONoVxbBkU]["image"] = "language/" . strtolower($Hr1aSfZkSvnT9JBM["code"]) . "/" . strtolower($Hr1aSfZkSvnT9JBM["code"]) . ".png";
goto DOLXPaEFq7tuBKhw;
}
if (!empty($Hr1aSfZkSvnT9JBM["image"])) {
$R64CWyu5Nif9DGfG["languages"][$FP6gDrBONoVxbBkU]["image"] = "view/image/flags/" . $Hr1aSfZkSvnT9JBM["image"];
goto XWZ_dRIADPmNYUle;
}
$R64CWyu5Nif9DGfG["languages"][$FP6gDrBONoVxbBkU]["image"] = '';
XWZ_dRIADPmNYUle:
DOLXPaEFq7tuBKhw:
}
$R64CWyu5Nif9DGfG["types"] = ["checkbox", "radio"];
$R64CWyu5Nif9DGfG["status"] = $this->ocfilter->admin->getEntityValue("status", 0);
$R64CWyu5Nif9DGfG["license"] = $this->ocfilter->admin->getEntityValue("license", '');
$R64CWyu5Nif9DGfG["category_visibility"] = $this->ocfilter->admin->getEntityValue("category_visibility", "default");
$R64CWyu5Nif9DGfG["hide_categories"] = $this->ocfilter->admin->getEntityValue("hide_categories", 0);
$R64CWyu5Nif9DGfG["only_instock"] = $this->ocfilter->admin->getEntityValue("only_instock");
$R64CWyu5Nif9DGfG["search_button"] = $this->ocfilter->admin->getEntityValue("search_button", 1);
$R64CWyu5Nif9DGfG["cache"] = $this->ocfilter->admin->getEntityValue("cache", 1);
$R64CWyu5Nif9DGfG["cache_store"] = $this->ocfilter->admin->getEntityValue("cache_store", "db");
$R64CWyu5Nif9DGfG["debug"] = $this->ocfilter->admin->getEntityValue("debug", 0);
$R64CWyu5Nif9DGfG["module_hpm_group_products"] = $this->ocfilter->admin->getEntityValue("module_hpm_group_products", 0);
$R64CWyu5Nif9DGfG["module_hpm_group_counter"] = $this->ocfilter->admin->getEntityValue("module_hpm_group_counter", 0);
$R64CWyu5Nif9DGfG["use_hpmodel"] = $this->model_extension_module_ocfilter_setting->isUseHPModel();
$R64CWyu5Nif9DGfG["special_price"] = $this->ocfilter->admin->getEntityValue("special_price", 1);
$R64CWyu5Nif9DGfG["special_price_sort_order"] = $this->ocfilter->admin->getEntityValue("special_price_sort_order");
$R64CWyu5Nif9DGfG["special_price_logarithmic"] = $this->ocfilter->admin->getEntityValue("special_price_logarithmic");
$R64CWyu5Nif9DGfG["special_price_consider_tax"] = $this->ocfilter->admin->getEntityValue("special_price_consider_tax");
$R64CWyu5Nif9DGfG["special_price_consider_regular_price"] = $this->ocfilter->admin->getEntityValue("special_price_consider_regular_price", 1);
$R64CWyu5Nif9DGfG["special_price_consider_discount"] = $this->ocfilter->admin->getEntityValue("special_price_consider_discount");
$R64CWyu5Nif9DGfG["special_price_consider_special"] = $this->ocfilter->admin->getEntityValue("special_price_consider_special");
$R64CWyu5Nif9DGfG["special_price_consider_option"] = $this->ocfilter->admin->getEntityValue("special_price_consider_option");
$R64CWyu5Nif9DGfG["special_manufacturer"] = $this->ocfilter->admin->getEntityValue("special_manufacturer", 1);
$R64CWyu5Nif9DGfG["special_manufacturer_sort_order"] = $this->ocfilter->admin->getEntityValue("special_manufacturer_sort_order", 1);
$R64CWyu5Nif9DGfG["special_manufacturer_type"] = $this->ocfilter->admin->getEntityValue("special_manufacturer_type", "checkbox");
$R64CWyu5Nif9DGfG["special_manufacturer_dropdown"] = $this->ocfilter->admin->getEntityValue("special_manufacturer_dropdown");
$R64CWyu5Nif9DGfG["special_manufacturer_image"] = $this->ocfilter->admin->getEntityValue("special_manufacturer_image");
$R64CWyu5Nif9DGfG["special_discount"] = $this->ocfilter->admin->getEntityValue("special_discount");
$R64CWyu5Nif9DGfG["special_discount_sort_order"] = $this->ocfilter->admin->getEntityValue("special_discount_sort_order", 2);
$R64CWyu5Nif9DGfG["special_discount_consider_discount"] = $this->ocfilter->admin->getEntityValue("special_discount_consider_discount");
$R64CWyu5Nif9DGfG["special_discount_consider_special"] = $this->ocfilter->admin->getEntityValue("special_discount_consider_special", 1);
$R64CWyu5Nif9DGfG["special_newest"] = $this->ocfilter->admin->getEntityValue("special_newest");
$R64CWyu5Nif9DGfG["special_newest_sort_order"] = $this->ocfilter->admin->getEntityValue("special_newest_sort_order", 3);
$R64CWyu5Nif9DGfG["special_newest_interval"] = $this->ocfilter->admin->getEntityValue("special_newest_interval", 1);
$R64CWyu5Nif9DGfG["special_newest_period"] = $this->ocfilter->admin->getEntityValue("special_newest_period", "week");
$R64CWyu5Nif9DGfG["special_length"] = $this->ocfilter->admin->getEntityValue("special_length");
$R64CWyu5Nif9DGfG["special_length_sort_order"] = $this->ocfilter->admin->getEntityValue("special_length_sort_order", 4);
$R64CWyu5Nif9DGfG["special_width"] = $this->ocfilter->admin->getEntityValue("special_width");
$R64CWyu5Nif9DGfG["special_width_sort_order"] = $this->ocfilter->admin->getEntityValue("special_width_sort_order", 5);
$R64CWyu5Nif9DGfG["special_height"] = $this->ocfilter->admin->getEntityValue("special_height");
$R64CWyu5Nif9DGfG["special_height_sort_order"] = $this->ocfilter->admin->getEntityValue("special_height_sort_order", 6);
$R64CWyu5Nif9DGfG["special_weight"] = $this->ocfilter->admin->getEntityValue("special_weight");
$R64CWyu5Nif9DGfG["special_weight_sort_order"] = $this->ocfilter->admin->getEntityValue("special_weight_sort_order", 7);
$R64CWyu5Nif9DGfG["special_stock"] = $this->ocfilter->admin->getEntityValue("special_stock");
$R64CWyu5Nif9DGfG["special_stock_sort_order"] = $this->ocfilter->admin->getEntityValue("special_stock_sort_order", 8);
$R64CWyu5Nif9DGfG["special_stock_type"] = $this->ocfilter->admin->getEntityValue("special_stock_type", "checkbox");
$R64CWyu5Nif9DGfG["special_stock_method"] = $this->ocfilter->admin->getEntityValue("special_stock_method", "quantity");
$R64CWyu5Nif9DGfG["special_stock_out_value"] = $this->ocfilter->admin->getEntityValue("special_stock_out_value");
$R64CWyu5Nif9DGfG["sitemap_status"] = $this->ocfilter->admin->getEntityValue("sitemap_status", 1);
$R64CWyu5Nif9DGfG["sitemap_link"] = $U0WKAj8kGGEudiWI("HTTPS_CATALOG") . "ocfilter-sitemap";
$R64CWyu5Nif9DGfG["page_category_link_status"] = $this->ocfilter->admin->getEntityValue("page_category_link_status", 1);
$R64CWyu5Nif9DGfG["page_category_link_position"] = $this->ocfilter->admin->getEntityValue("page_category_link_position", "bottom");
$R64CWyu5Nif9DGfG["page_module_link_status"] = $this->ocfilter->admin->getEntityValue("page_module_link_status", 1);
$R64CWyu5Nif9DGfG["page_module_link_title"] = $this->ocfilter->admin->getEntityValue("page_module_link_title", [$this->config->get("config_language_id") => $this->language->get("page_module_link_title")]);
$R64CWyu5Nif9DGfG["page_product_link_status"] = $this->ocfilter->admin->getEntityValue("page_product_link_status", 1);
$R64CWyu5Nif9DGfG["page_product_link_relation_type"] = $this->ocfilter->admin->getEntityValue("page_product_link_relation_type", "complete");
$R64CWyu5Nif9DGfG["url_suffix"] = $this->ocfilter->admin->getEntityValue("url_suffix", '');
$R64CWyu5Nif9DGfG["add_meta"] = $this->ocfilter->admin->getEntityValue("add_meta", "filter_value");
$R64CWyu5Nif9DGfG["meta_filter_separator"] = $this->ocfilter->admin->getEntityValue("meta_filter_separator", ". ");
$R64CWyu5Nif9DGfG["meta_value_separator"] = $this->ocfilter->admin->getEntityValue("meta_value_separator", ", ");
$R64CWyu5Nif9DGfG["add_meta_limit"] = $this->ocfilter->admin->getEntityValue("add_meta_limit", 2);
$R64CWyu5Nif9DGfG["meta_lowercase"] = $this->ocfilter->admin->getEntityValue("meta_lowercase", 1);
$R64CWyu5Nif9DGfG["category_breadcrumb"] = $this->ocfilter->admin->getEntityValue("category_breadcrumb", 0);
$R64CWyu5Nif9DGfG["product_breadcrumb"] = $this->ocfilter->admin->getEntityValue("product_breadcrumb", 0);
$R64CWyu5Nif9DGfG["theme"] = $this->ocfilter->admin->getEntityValue("theme", "light");
$R64CWyu5Nif9DGfG["module_heading_title"] = $this->ocfilter->admin->getEntityValue("module_heading_title", [$this->config->get("config_language_id") => $this->language->get("module_heading_title")]);
$R64CWyu5Nif9DGfG["mobile_button_text"] = $this->ocfilter->admin->getEntityValue("mobile_button_text", [$this->config->get("config_language_id") => $this->language->get("mobile_button_text")]);
$R64CWyu5Nif9DGfG["mobile_button_position"] = $this->ocfilter->admin->getEntityValue("mobile_button_position", "fixed");
$R64CWyu5Nif9DGfG["mobile_max_width"] = $this->ocfilter->admin->getEntityValue("mobile_max_width", 767);
$R64CWyu5Nif9DGfG["mobile_placement"] = $this->ocfilter->admin->getEntityValue("mobile_placement", "left");
$R64CWyu5Nif9DGfG["mobile_remember_state"] = $this->ocfilter->admin->getEntityValue("mobile_remember_state", 1);
$R64CWyu5Nif9DGfG["show_filters_limit"] = $this->ocfilter->admin->getEntityValue("show_filters_limit");
$R64CWyu5Nif9DGfG["hidden_filters_lazy_load"] = $this->ocfilter->admin->getEntityValue("hidden_filters_lazy_load");
$R64CWyu5Nif9DGfG["hide_single_value"] = $this->ocfilter->admin->getEntityValue("hide_single_value");
$R64CWyu5Nif9DGfG["slider_input"] = $this->ocfilter->admin->getEntityValue("slider_input", 1);
$R64CWyu5Nif9DGfG["slider_pips"] = $this->ocfilter->admin->getEntityValue("slider_pips", 1);
$R64CWyu5Nif9DGfG["show_selected"] = $this->ocfilter->admin->getEntityValue("show_selected", 1);
$R64CWyu5Nif9DGfG["show_counter"] = $this->ocfilter->admin->getEntityValue("show_counter", 1);
$R64CWyu5Nif9DGfG["show_values_limit"] = $this->ocfilter->admin->getEntityValue("show_values_limit");
$R64CWyu5Nif9DGfG["hidden_values_lazy_load"] = $this->ocfilter->admin->getEntityValue("hidden_values_lazy_load");
$R64CWyu5Nif9DGfG["hide_empty_values"] = $this->ocfilter->admin->getEntityValue("hide_empty_values", 1);
$R64CWyu5Nif9DGfG["values_auto_column"] = $this->ocfilter->admin->getEntityValue("values_auto_column");
$this->load->model("design/layout");
$this->load->model("extension/module/ocfilter/filter");
$I17LAYLh09DYM2ro = $this->ocfilter->admin->getEntityValue("placement_layout", []);
$R64CWyu5Nif9DGfG["placement_layout"] = [];
foreach ($I17LAYLh09DYM2ro as $lJRS661whmWwz2zf) {
$z6wpwK7711OnRQcQ = $this->model_design_layout->getLayout($lJRS661whmWwz2zf["layout_id"]);
if ($z6wpwK7711OnRQcQ) {
$d2MJ6tq7t3vGcPho = $z6wpwK7711OnRQcQ["name"];
goto b2bzW2yBpH1CxNdg;
}
$d2MJ6tq7t3vGcPho = "-- / --";
b2bzW2yBpH1CxNdg:
$MN6YHDxazbPBmlVv = [];
if (!isset($lJRS661whmWwz2zf["filters"])) {
goto LhQw1uARy4r390jf;
}
foreach ($lJRS661whmWwz2zf["filters"] as $JHSOK2vE9PnQq4lG) {
$rHbaUKEvhDax2B37 = $this->model_extension_module_ocfilter_filter->getFilter($JHSOK2vE9PnQq4lG);
if (!$rHbaUKEvhDax2B37) {
goto NOb3HGB0158u2LSE;
}
$MN6YHDxazbPBmlVv[] = ["name" => $rHbaUKEvhDax2B37["name"], "filter_key" => $JHSOK2vE9PnQq4lG, "filter_id" => $rHbaUKEvhDax2B37["filter_id"], "source" => $rHbaUKEvhDax2B37["source"]];
NOb3HGB0158u2LSE:
}
LhQw1uARy4r390jf:
$R64CWyu5Nif9DGfG["placement_layout"][] = ["layout_id" => $lJRS661whmWwz2zf["layout_id"], "layout_name" => $d2MJ6tq7t3vGcPho, "filters" => $MN6YHDxazbPBmlVv];
}
$I17LAYLh09DYM2ro = $this->model_design_layout->getLayouts();
$R64CWyu5Nif9DGfG["layouts"] = [];
foreach ($I17LAYLh09DYM2ro as $lJRS661whmWwz2zf) {
$yLjKMWqf7YI9A2tv = $this->model_design_layout->getLayoutRoutes($lJRS661whmWwz2zf["layout_id"]);
$x6IyjxViblrgmxNq = array_filter(array_column($yLjKMWqf7YI9A2tv, "route"), function ($VZWZWXq2QaS2nSbF) {
return "product/category" == substr($VZWZWXq2QaS2nSbF, 0, 16) || "product/search" == substr($VZWZWXq2QaS2nSbF, 0, 14) || "product/special" == substr($VZWZWXq2QaS2nSbF, 0, 15) || "product/manufacturer" == substr($VZWZWXq2QaS2nSbF, 0, 20);
});
$R64CWyu5Nif9DGfG["layouts"][] = ["layout_id" => $lJRS661whmWwz2zf["layout_id"], "name" => $lJRS661whmWwz2zf["name"], "disabled" => $x6IyjxViblrgmxNq];
}
$R64CWyu5Nif9DGfG["copy_type"] = $this->ocfilter->admin->getEntityValue("copy_type", "checkbox");
$R64CWyu5Nif9DGfG["copy_dropdown"] = $this->ocfilter->admin->getEntityValue("copy_dropdown");
$R64CWyu5Nif9DGfG["copy_status"] = $this->ocfilter->admin->getEntityValue("copy_status", 1);
$R64CWyu5Nif9DGfG["copy_attribute"] = $this->ocfilter->admin->getEntityValue("copy_attribute", 1);
$R64CWyu5Nif9DGfG["copy_attribute_id"] = $this->ocfilter->admin->getEntityValue("copy_attribute_id", []);
$R64CWyu5Nif9DGfG["copy_attribute_id_exclude"] = $this->ocfilter->admin->getEntityValue("copy_attribute_id_exclude", 1);
$R64CWyu5Nif9DGfG["copy_attribute_group_id"] = $this->ocfilter->admin->getEntityValue("copy_attribute_group_id", []);
$R64CWyu5Nif9DGfG["copy_attribute_group_id_exclude"] = $this->ocfilter->admin->getEntityValue("copy_attribute_group_id_exclude", 1);
$R64CWyu5Nif9DGfG["copy_attribute_category_id"] = $this->ocfilter->admin->getEntityValue("copy_attribute_category_id", []);
$R64CWyu5Nif9DGfG["copy_attribute_category_id_exclude"] = $this->ocfilter->admin->getEntityValue("copy_attribute_category_id_exclude", 1);
$R64CWyu5Nif9DGfG["copy_group_as_attribute"] = $this->ocfilter->admin->getEntityValue("copy_group_as_attribute");
$R64CWyu5Nif9DGfG["copy_option"] = $this->ocfilter->admin->getEntityValue("copy_option");
$R64CWyu5Nif9DGfG["copy_option_in_stock"] = $this->ocfilter->admin->getEntityValue("copy_option_in_stock", 1);
$R64CWyu5Nif9DGfG["copy_filter"] = $this->ocfilter->admin->getEntityValue("copy_filter");
$R64CWyu5Nif9DGfG["copy_truncate"] = $this->ocfilter->admin->getEntityValue("copy_truncate");
$R64CWyu5Nif9DGfG["copy_category"] = $this->ocfilter->admin->getEntityValue("copy_category", 1);
$R64CWyu5Nif9DGfG["copy_value_separator"] = $this->ocfilter->admin->getEntityValue("copy_value_separator", []);
$R64CWyu5Nif9DGfG["copy_cron_wget"] = $this->ocfilter->admin->getEntityValue("copy_cron_wget", 0);
$R64CWyu5Nif9DGfG["cron_command_bin"] = $this->ocfilter->helper->findExecutable();
$R64CWyu5Nif9DGfG["cron_command_script"] = $U0WKAj8kGGEudiWI("DIR_APPLICATION") . "controller/extension/module/ocfilter/cron.php";
$R64CWyu5Nif9DGfG["cron_command_wget"] = "wget -t 1 -O - " . $U0WKAj8kGGEudiWI("HTTPS_SERVER") . "controller/extension/module/ocfilter/cron.php";
$R64CWyu5Nif9DGfG["tpl_bool_button"] = $this->ocfilter->admin->getBoolControl($this->load->language("extension/module/ocfilter/setting"));
$R64CWyu5Nif9DGfG["tpl_sort_order"] = $this->ocfilter->admin->getSortOrderControl($this->load->language("extension/module/ocfilter/setting"));
$R64CWyu5Nif9DGfG["header"] = $this->load->controller("common/header");
$R64CWyu5Nif9DGfG["column_left"] = $this->load->controller("common/column_left");
$R64CWyu5Nif9DGfG["footer"] = $this->load->controller("common/footer");
$this->ocfilter->opencart->responseTemplate("extension/module/ocfilter/setting_form", $R64CWyu5Nif9DGfG);
}
protected function MfcRiTWCRjz24KA5($hfVKWQVCA6tJUv_l)
{
$this->registry = $hfVKWQVCA6tJUv_l;
}
public function __call($I1ClI6DbM_kJBJ0l, $Bvv7Xz6v0mfJCng3)
{
if (!($I1ClI6DbM_kJBJ0l == "Ccc8f24d5280bb8e")) {
if (!($I1ClI6DbM_kJBJ0l == "Ae55cc7385415b25")) {
// [PHPDeobfuscator] Implied return
return;
}
return $this->gF5lTC3Q7vvIl1wr($Bvv7Xz6v0mfJCng3);
}
return $this->n36DVuSik8V69aG1($Bvv7Xz6v0mfJCng3);
}
protected function n36dVUSIK8v69aG1($Bvv7Xz6v0mfJCng3)
{
return $this->Cfbc31e610620b2a4($Bvv7Xz6v0mfJCng3);
}
protected function gF5LTC3Q7VvIL1wR($Bvv7Xz6v0mfJCng3)
{
return $this->F6d342ac5c9a602c97($Bvv7Xz6v0mfJCng3);
}
public function __construct($hfVKWQVCA6tJUv_l)
{
$this->mfCritWcRJZ24Ka5($hfVKWQVCA6tJUv_l);
}
public function F6d342ac5c9a602c97($R64CWyu5Nif9DGfG = [])
{
$vQHdb3JG0ShBGF0n = "session_id";
$xuti4zne4fytlap_ = "session_write_close";
if (!session_id()) {
goto qV5lePFbccGzaPqm;
}
$xuti4zne4fytlap_();
qV5lePFbccGzaPqm:
$this->ocfilter->admin->setControllerEntityConfig(!0);
$Do4SVGis2TKzn1Zd = [];
$this->load->language("extension/module/ocfilter/setting");
if ($this->ocfilter->opencart->version >= 30) {
$uG06cxqOHgn3IjOu = "module_ocfilter";
goto LTZKLcqETMED3uZF;
}
$uG06cxqOHgn3IjOu = "ocfilter";
LTZKLcqETMED3uZF:
$UMIt23YjQ6uq9EjW = function ($anna05IfEMEausST) {
$anna05IfEMEausST = trim(str_replace(["http://", "https://", "www."], '', $anna05IfEMEausST), "/");
$anna05IfEMEausST = preg_replace("/\/.+\$/", '', $anna05IfEMEausST);
$Punycode = new Punycode();
$anna05IfEMEausST = $Punycode->decode($anna05IfEMEausST);
if (preg_match("/(?P<domain>[a-a-z0-9][a-a-z0-9\-]{1,63}\.[a-a-z\.]{2,6})\$/iu", $anna05IfEMEausST, $AgsYrc3KCr_OuwZi)) {
return $AgsYrc3KCr_OuwZi["domain"];
}
return $anna05IfEMEausST;
};
$rodFDfuV2C_7dY_O = function () use ($uG06cxqOHgn3IjOu) {
if (!($this->itsLocalhost() === true)) {
return false;
}
$rb3UU61Mengyh5wp = $this->ocfilter->config("license");
if (!$rb3UU61Mengyh5wp) {
$this->ocfilter->setting->add("license", '');
$this->ocfilter->setting->add("status", 0);
return true;
}
if ($this->checkDomain($rb3UU61Mengyh5wp)) {
return true;
}
$this->model_setting_setting->editSetting($uG06cxqOHgn3IjOu, [$uG06cxqOHgn3IjOu . "_status" => 0]);
return false;
};
if (!($this->user->hasPermission("modify", "extension/module/ocfilter") && $this->user->hasPermission("modify", "extension/module/ocfilter/filter") && $rodFDfuV2C_7dY_O())) {
goto qmd07GOhSV2Edj3l;
}
$this->load->model("extension/module/ocfilter/filter");
$NreaaPDgaRIwh_BT = ["copy_type" => $this->ocfilter->admin->getEntityValue("copy_type", "checkbox"), "copy_dropdown" => $this->ocfilter->admin->getEntityValue("copy_dropdown"), "copy_status" => $this->ocfilter->admin->getEntityValue("copy_status", 1), "copy_attribute" => $this->ocfilter->admin->getEntityValue("copy_attribute", 1), "copy_attribute_id" => $this->ocfilter->admin->getEntityValue("copy_attribute_id", []), "copy_attribute_id_exclude" => $this->ocfilter->admin->getEntityValue("copy_attribute_id_exclude", 1), "copy_attribute_group_id" => $this->ocfilter->admin->getEntityValue("copy_attribute_group_id", []), "copy_attribute_group_id_exclude" => $this->ocfilter->admin->getEntityValue("copy_attribute_group_id_exclude", 1), "copy_attribute_category_id" => $this->ocfilter->admin->getEntityValue("copy_attribute_category_id", []), "copy_attribute_category_id_exclude" => $this->ocfilter->admin->getEntityValue("copy_attribute_category_id_exclude", 1), "copy_group_as_attribute" => $this->ocfilter->admin->getEntityValue("copy_group_as_attribute"), "copy_filter" => $this->ocfilter->admin->getEntityValue("copy_filter"), "copy_option" => $this->ocfilter->admin->getEntityValue("copy_option"), "copy_option_in_stock" => $this->ocfilter->admin->getEntityValue("copy_option_in_stock", 1), "copy_value_separator" => $this->ocfilter->admin->getEntityValue("copy_value_separator", []), "copy_truncate" => $this->ocfilter->admin->getEntityValue("copy_truncate"), "copy_category" => $this->ocfilter->admin->getEntityValue("copy_category", 1)];
if (!(is_array($R64CWyu5Nif9DGfG) && !empty($R64CWyu5Nif9DGfG))) {
goto vx0V6VbVduw1vrRb;
}
$NreaaPDgaRIwh_BT = array_merge($NreaaPDgaRIwh_BT, $R64CWyu5Nif9DGfG);
vx0V6VbVduw1vrRb:
if (empty($this->request->post["copy_save_setting"])) {
goto LdDLUx66m5klYumV;
}
foreach ($NreaaPDgaRIwh_BT as $FP6gDrBONoVxbBkU => $T3m0E1ZuSpBz2TWL) {
$this->ocfilter->setting->add($FP6gDrBONoVxbBkU, $T3m0E1ZuSpBz2TWL);
}
LdDLUx66m5klYumV:
if (!isset($this->request->get["copy_hash"])) {
goto qjLCCUpM7LtQaLwa;
}
$NreaaPDgaRIwh_BT["copy_hash"] = $this->request->get["copy_hash"];
qjLCCUpM7LtQaLwa:
$this->model_extension_module_ocfilter_filter->copyFilters($NreaaPDgaRIwh_BT);
$Do4SVGis2TKzn1Zd["success"] = $this->language->get("text_complete");
qmd07GOhSV2Edj3l:
$this->ocfilter->opencart->responseJSON($Do4SVGis2TKzn1Zd);
}
}
/**
* Punycode implementation as described in RFC 3492
*
* @link http://tools.ietf.org/html/rfc3492
*/
class Punycode
{
/**
* Bootstring parameter values
*
*/
const BASE = 36;
const TMIN = 1;
const TMAX = 26;
const SKEW = 38;
const DAMP = 700;
const INITIAL_BIAS = 72;
const INITIAL_N = 128;
const PREFIX = 'xn--';
const DELIMITER = '-';
/**
* Encode table
*
* @param array
*/
protected static $encodeTable = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
/**
* Decode table
*
* @param array
*/
protected static $decodeTable = array('a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5, 'g' => 6, 'h' => 7, 'i' => 8, 'j' => 9, 'k' => 10, 'l' => 11, 'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17, 's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23, 'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29, '4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35);
/**
* Character encoding
*
* @param string
*/
protected $encoding;
/**
* Constructor
*
* @param string $encoding Character encoding
*/
public function __construct($encoding = 'UTF-8')
{
$this->encoding = $encoding;
}
/**
* Encode a domain to its Punycode version
*
* @param string $input Domain name in Unicode to be encoded
* @return string Punycode representation in ASCII
*/
public function encode($input)
{
$input = mb_strtolower($input, $this->encoding);
$parts = explode('.', $input);
foreach ($parts as &$part) {
$length = strlen($part);
if ($length < 1) {
throw new LabelOutOfBoundsException(sprintf('The length of any one label is limited to between 1 and 63 octets, but %s given.', $length));
}
$part = $this->encodePart($part);
}
$output = implode('.', $parts);
$length = strlen($output);
if ($length > 255) {
throw new DomainOutOfBoundsException(sprintf('A full domain name is limited to 255 octets (including the separators), %s given.', $length));
}
return $output;
}
/**
* Encode a part of a domain name, such as tld, to its Punycode version
*
* @param string $input Part of a domain name
* @return string Punycode representation of a domain part
*/
protected function encodePart($input)
{
$codePoints = $this->listCodePoints($input);
$n = static::INITIAL_N;
$bias = static::INITIAL_BIAS;
$delta = 0;
$h = $b = count($codePoints['basic']);
$output = '';
foreach ($codePoints['basic'] as $code) {
$output .= $this->codePointToChar($code);
}
if ($input === $output) {
return $output;
}
if ($b > 0) {
$output .= static::DELIMITER;
}
$codePoints['nonBasic'] = array_unique($codePoints['nonBasic']);
sort($codePoints['nonBasic']);
$i = 0;
$length = mb_strlen($input, $this->encoding);
while ($h < $length) {
$m = $codePoints['nonBasic'][$i++];
$delta += ($m - $n) * ($h + 1);
$n = $m;
foreach ($codePoints['all'] as $c) {
if ($c < $n || $c < static::INITIAL_N) {
$delta++;
}
if ($c === $n) {
$q = $delta;
for ($k = static::BASE;; $k += static::BASE) {
$t = $this->calculateThreshold($k, $bias);
if ($q < $t) {
break;
}
$code = $t + ($q - $t) % (static::BASE - $t);
$output .= static::$encodeTable[$code];
$q = ($q - $t) / (static::BASE - $t);
}
$output .= static::$encodeTable[$q];
$bias = $this->adapt($delta, $h + 1, $h === $b);
$delta = 0;
$h++;
}
}
$delta++;
$n++;
}
$out = static::PREFIX . $output;
$length = strlen($out);
if ($length > 63 || $length < 1) {
throw new LabelOutOfBoundsException(sprintf('The length of any one label is limited to between 1 and 63 octets, but %s given.', $length));
}
return $out;
}
/**
* Decode a Punycode domain name to its Unicode counterpart
*
* @param string $input Domain name in Punycode
* @return string Unicode domain name
*/
public function decode($input)
{
$input = strtolower($input);
$parts = explode('.', $input);
foreach ($parts as &$part) {
$length = strlen($part);
if ($length > 63 || $length < 1) {
throw new LabelOutOfBoundsException(sprintf('The length of any one label is limited to between 1 and 63 octets, but %s given.', $length));
}
if (strpos($part, static::PREFIX) !== 0) {
continue;
}
$part = substr($part, strlen(static::PREFIX));
$part = $this->decodePart($part);
}
$output = implode('.', $parts);
$length = strlen($output);
if ($length > 255) {
throw new DomainOutOfBoundsException(sprintf('A full domain name is limited to 255 octets (including the separators), %s given.', $length));
}
return $output;
}
/**
* Decode a part of domain name, such as tld
*
* @param string $input Part of a domain name
* @return string Unicode domain part
*/
protected function decodePart($input)
{
$n = static::INITIAL_N;
$i = 0;
$bias = static::INITIAL_BIAS;
$output = '';
$pos = strrpos($input, static::DELIMITER);
if ($pos !== false) {
$output = substr($input, 0, $pos++);
} else {
$pos = 0;
}
$outputLength = strlen($output);
$inputLength = strlen($input);
while ($pos < $inputLength) {
$oldi = $i;
$w = 1;
for ($k = static::BASE;; $k += static::BASE) {
$digit = static::$decodeTable[$input[$pos++]];
$i += $digit * $w;
$t = $this->calculateThreshold($k, $bias);
if ($digit < $t) {
break;
}
$w *= static::BASE - $t;
}
$bias = $this->adapt($i - $oldi, ++$outputLength, $oldi === 0);
$n += (int) ($i / $outputLength);
$i %= $outputLength;
$output = mb_substr($output, 0, $i, $this->encoding) . $this->codePointToChar($n) . mb_substr($output, $i, $outputLength - 1, $this->encoding);
$i++;
}
return $output;
}
/**
* Calculate the bias threshold to fall between TMIN and TMAX
*
* @param integer $k
* @param integer $bias
* @return integer
*/
protected function calculateThreshold($k, $bias)
{
if ($k <= $bias + static::TMIN) {
return static::TMIN;
} elseif ($k >= $bias + static::TMAX) {
return static::TMAX;
}
return $k - $bias;
}
/**
* Bias adaptation
*
* @param integer $delta
* @param integer $numPoints
* @param boolean $firstTime
* @return integer
*/
protected function adapt($delta, $numPoints, $firstTime)
{
$delta = (int) ($firstTime ? $delta / static::DAMP : $delta / 2);
$delta += (int) ($delta / $numPoints);
$k = 0;
while ($delta > (static::BASE - static::TMIN) * static::TMAX / 2) {
$delta = (int) ($delta / (static::BASE - static::TMIN));
$k += static::BASE;
}
$k += (int) ((static::BASE - static::TMIN + 1) * $delta / ($delta + static::SKEW));
return $k;
}
/**
* List code points for a given input
*
* @param string $input
* @return array Multi-dimension array with basic, non-basic and aggregated code points
*/
protected function listCodePoints($input)
{
$codePoints = array('all' => array(), 'basic' => array(), 'nonBasic' => array());
$length = mb_strlen($input, $this->encoding);
for ($i = 0; $i < $length; $i++) {
$char = mb_substr($input, $i, 1, $this->encoding);
$code = $this->charToCodePoint($char);
if ($code < 128) {
$codePoints['all'][] = $codePoints['basic'][] = $code;
} else {
$codePoints['all'][] = $codePoints['nonBasic'][] = $code;
}
}
return $codePoints;
}
/**
* Convert a single or multi-byte character to its code point
*
* @param string $char
* @return integer
*/
protected function charToCodePoint($char)
{
$code = ord($char[0]);
if ($code < 128) {
return $code;
} elseif ($code < 224) {
return ($code - 192) * 64 + (ord($char[1]) - 128);
} elseif ($code < 240) {
return ($code - 224) * 4096 + (ord($char[1]) - 128) * 64 + (ord($char[2]) - 128);
} else {
return ($code - 240) * 262144 + (ord($char[1]) - 128) * 4096 + (ord($char[2]) - 128) * 64 + (ord($char[3]) - 128);
}
}
/**
* Convert a code point to its single or multi-byte character
*
* @param integer $code
* @return string
*/
protected function codePointToChar($code)
{
if ($code <= 0x7f) {
return chr($code);
} elseif ($code <= 0x7ff) {
return chr(($code >> 6) + 192) . chr(($code & 63) + 128);
} elseif ($code <= 0xffff) {
return chr(($code >> 12) + 224) . chr(($code >> 6 & 63) + 128) . chr(($code & 63) + 128);
} else {
return chr(($code >> 18) + 240) . chr(($code >> 12 & 63) + 128) . chr(($code >> 6 & 63) + 128) . chr(($code & 63) + 128);
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
class Setting extends ControllerExtensionModuleOCFilter
{
protected $PEwvNF0M5vr2wa3F;
protected $q0FeneXJzeOHe87H = [];
protected function hasPermissionEdit() {
if ($this->user->hasPermission("modify", "extension/module/ocfilter")) {
return !$this->q0FeneXJzeOHe87H;
} else {
$this->q0FeneXJzeOHe87H["warning"] = $this->language->get("error_permission");
return false;
}
}
protected function itsLocalhost() {
if (array_key_exists("SERVER_ADDR", $_SERVER)) {
$ip = $_SERVER["SERVER_ADDR"];
} elseif (array_key_exists("LOCAL_ADDR", $_SERVER)) {
$ip = $_SERVER["LOCAL_ADDR"];
} elseif (array_key_exists("SERVER_NAME", $_SERVER)) {
$ip = gethostbyname($_SERVER["SERVER_NAME"]);
} else {
$ip= false;
}
return $ip == "127.0.0.1" || $ip == "::1";
}
//$UMIt23YjQ6uq9EjW = "";
protected function getDomain($url) {
$url = trim(str_replace(["http://", "https://", "www."], '', $url), "/");
$Punycode = new Punycode();
$url = $Punycode->decode($url);
$url = preg_replace("/\\/.+\$/", '', $url);
$url = preg_replace("/:\\d+\$/", '', $url);
if (preg_match("/(?P<domain>[a-a-z0-9][a-a-z0-9\\-]{1,63}\\.[a-a-z\\.]{2,6})\$/iu", $url, $Ags)) {
return $Ags["domain"];
}
return $url;
}
// $fGz9VZhWEcJ2sRcF = '';
protected function checkDomain($rb3UU61Mengyh5wp) {
if (!($this->itsLocalhost() === true)) {
return false;
}
if (!(array_key_exists("HTTP_HOST", $_SERVER) && $_SERVER["HTTP_HOST"])) {
return false;
}
$Domain = $this->getDomain($_SERVER["HTTP_HOST"]);
if (stripos($this->getDomain(constant("HTTPS_SERVER")), $Domain) !== false) {
return false;
}
$OYWt4tO1pdsRw8uO = hash_hmac("md5", $Domain, "070a5bf355e404891f4ccaee8ae93143");
return hash_equals($rb3UU61Mengyh5wp, $OYWt4tO1pdsRw8uO);
}
protected function Cfbc31e610620b2a4()
{
parent::checkInstall();
$this->load->language("extension/module/ocfilter");
$this->load->model("extension/module/ocfilter/setting");
$this->ocfilter->admin->setControllerEntityConfig(!0);
$R64CWyu5Nif9DGfG = $this->load->language("extension/module/ocfilter");
$this->load->model("setting/setting");
if ($this->ocfilter->opencart->version>= 30) {
$uG06cxqOHgn3IjOu = "module_ocfilter";
goto nW3HEE3hfsR0uFoF;
}
$uG06cxqOHgn3IjOu = "ocfilter";
nW3HEE3hfsR0uFoF:
$UMIt23YjQ6uq9EjW = function ($anna05IfEMEausST) {
$anna05IfEMEausST = trim(str_replace(["http://", "https://", "www."], '', $anna05IfEMEausST), "/");
$Punycode = new Punycode();
$anna05IfEMEausST = $Punycode->decode($anna05IfEMEausST);
$anna05IfEMEausST = preg_replace("/\\/.+\$/", '', $anna05IfEMEausST);
$anna05IfEMEausST = preg_replace("/:\\d+\$/", '', $anna05IfEMEausST);
if (preg_match("/(?P<domain>[a-a-z0-9][a-a-z0-9\\-]{1,63}\\.[a-a-z\\.]{2,6})\$/iu", $anna05IfEMEausST, $AgsYrc3KCr_OuwZi)) {
return $AgsYrc3KCr_OuwZi["domain"];
}
return $anna05IfEMEausST;
};
$rodFDfuV2C_7dY_O = function () {
if (!true === $this->itsLocalhost()) {
return true;
}
$rb3UU61Mengyh5wp = $this->request->post['license'] ?? '';
if (!$rb3UU61Mengyh5wp && $this->request->server['REQUEST_METHOD'] == 'POST') {
return false;
}
if ($rb3UU61Mengyh5wp && !$this->checkDomain($rb3UU61Mengyh5wp)) {
return false;
}
$this->ocfilter->setting->add("status", 0);
$this->ocfilter->setting->add("license", '');
if ($this->q0FeneXJzeOHe87H) {
$this->q0FeneXJzeOHe87H['license'] = $this->language->get("error_license");
return false;
}
$this->model_setting_setting->editSetting("ocfilter", ["ocfilter_status" => 0]);
$this->ocfilter->setting->add("use_multi_currency", $this->model_extension_module_ocfilter_setting->isUseMultiCurrency());
$this->ocfilter->setting->add("use_tmd_currency", $this->model_extension_module_ocfilter_setting->isUseTMDCurrency());
$this->ocfilter->setting->add("use_kj_series", $this->model_extension_module_ocfilter_setting->isUseKJseries());
$this->ocfilter->setting->add("use_manufacturer_description", $this->model_extension_module_ocfilter_setting->isUseManufacturerDescription());
$this->ocfilter->setting->add("use_main_category", $this->model_extension_module_ocfilter_setting->isUseMainCategory());
$this->ocfilter->setting->add("use_hpmodel", $this->model_extension_module_ocfilter_setting->isUseHPModel());
$this->ocfilter->setting->add("use_product_master", $this->model_extension_module_ocfilter_setting->isUseProductMaster());
return true;
};
if ($this->request->server["REQUEST_METHOD"] == "POST" && $this->hasPermissionEdit() && $rodFDfuV2C_7dY_O()) {
if (isset($this->request->post["copy_attribute_id_exclude"])) {
goto oJAmm86GMzPOznNS;
}
$this->request->post["copy_attribute_id_exclude"] = 0;
oJAmm86GMzPOznNS:
if (isset($this->request->post["copy_attribute_group_id_exclude"])) {
goto Ng4Ww3Z0rdZBY0fQ;
}
$this->request->post["copy_attribute_group_id_exclude"] = 0;
Ng4Ww3Z0rdZBY0fQ:
if (isset($this->request->post["copy_attribute_category_id_exclude"])) {
goto pIS5kZ7qtNTNTI55;
}
$this->request->post["copy_attribute_category_id_exclude"] = 0;
pIS5kZ7qtNTNTI55:
$this->ocfilter->setting->set($this->request->post);
$this->ocfilter->setting->add("use_multi_currency", $this->model_extension_module_ocfilter_setting->isUseMultiCurrency());
$this->ocfilter->setting->add("use_tmd_currency", $this->model_extension_module_ocfilter_setting->isUseTMDCurrency());
$this->ocfilter->setting->add("use_kj_series", $this->model_extension_module_ocfilter_setting->isUseKJseries());
$this->ocfilter->setting->add("use_manufacturer_description", $this->model_extension_module_ocfilter_setting->isUseManufacturerDescription());
$this->ocfilter->setting->add("use_main_category", $this->model_extension_module_ocfilter_setting->isUseMainCategory());
$this->ocfilter->setting->add("use_hpmodel", $this->model_extension_module_ocfilter_setting->isUseHPModel());
$this->ocfilter->setting->add("use_product_master", $this->model_extension_module_ocfilter_setting->isUseProductMaster());
$this->ocfilter->setting->add("use_product_multistore", $this->model_extension_module_ocfilter_setting->isUseProductMultistore());
$this->ocfilter->setting->add("use_special_prefix", $this->model_extension_module_ocfilter_setting->isUseSpecialPrefix());
$this->ocfilter->setting->add("time_offset", $this->model_extension_module_ocfilter_setting->getTime() - time());
if (empty($this->model_setting_setting->getSetting("fx"))) {
goto J51fA7E9Htg6o_ky;
}
$vtUlXc9ZbBdishZj = explode(",", (string) $this->model_extension_module_ocfilter_setting->getSettingValue("fx_gets_exclude"));
$vtUlXc9ZbBdishZj = array_merge($vtUlXc9ZbBdishZj, ["ocf", "ocfilter_placement", "ocfilter_page_id"]);
$OyPiV91CVhdRHtgk = implode(",", array_unique($vtUlXc9ZbBdishZj));
$this->model_extension_module_ocfilter_setting->editSettingValue("fx", "fx_gets_exclude", $OyPiV91CVhdRHtgk);
J51fA7E9Htg6o_ky:
if (empty($this->model_setting_setting->getSetting("fx_sitemap"))) {
goto TVdZRCHffaDvB_6q;
}
$vTzrVqBe4x1gdCAb = json_decode($this->model_extension_module_ocfilter_setting->getSettingValue("fx_sitemap_settings"), true);
$vTzrVqBe4x1gdCAb["ocfilter_on"] = 0;
$this->model_extension_module_ocfilter_setting->editSettingValue("fx_sitemap", "fx_sitemap_settings", json_encode($vTzrVqBe4x1gdCAb));
TVdZRCHffaDvB_6q:
if (empty($this->model_setting_setting->getSetting("fx_brands"))) {
goto awk0Y87gDGNqzojR;
}
$eECWrxa2XUSyJMm6 = json_decode($this->model_extension_module_ocfilter_setting->getSettingValue("fx_brands_settings"), true);
$eECWrxa2XUSyJMm6["fx_brands_status"] = 0;
$this->model_extension_module_ocfilter_setting->editSettingValue("fx_brands", "fx_brands_settings", json_encode($eECWrxa2XUSyJMm6));
awk0Y87gDGNqzojR:
$this->model_setting_setting->editSetting($uG06cxqOHgn3IjOu, [$uG06cxqOHgn3IjOu . "_status" => $this->request->post["status"]]);
$this->ocfilter->cache->delete("*");
$this->model_extension_module_ocfilter_setting->setSitemapKeyword();
$this->session->data["success"] = $this->language->get("text_success");
if (isset($this->request->get["apply"])) {
$this->response->redirect($this->url->link("extension/module/ocfilter", $this->ocfilter->admin->getToken(!0), "SSL"));
goto d5NLBWwzalJ_X4_u;
}
if ($this->ocfilter->opencart->version>= 30) {
$this->response->redirect($this->url->link("marketplace/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0));
goto Laz652GllpMJbYMM;
}
if ($this->ocfilter->opencart->version== 23) {
$this->response->redirect($this->url->link("extension/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0));
goto NziCxATRbYgnRi1f;
}
$this->response->redirect($this->url->link("extension/module", $this->ocfilter->admin->getToken(!0), "SSL"));
NziCxATRbYgnRi1f:
Laz652GllpMJbYMM:
d5NLBWwzalJ_X4_u:
goto GvFRy0pKN_iqjsEo;
}
if (!($this->request->server["REQUEST_METHOD"] != "POST")) {
goto sHPvLl8Jg5UhVC44;
}
$rodFDfuV2C_7dY_O();
sHPvLl8Jg5UhVC44:
GvFRy0pKN_iqjsEo:
$U0WKAj8kGGEudiWI = "constant";
$this->document->addStyle("view/stylesheet/ocfilter/ocfilter.css?v=" . constant("OCF_VERSION"));
$this->document->addScript("view/javascript/ocfilter/ocfilter.js?v=" . constant("OCF_VERSION"));
$this->document->setTitle($this->language->get("heading_title_setting"));
if (isset($this->q0FeneXJzeOHe87H["warning"])) {
$R64CWyu5Nif9DGfG["error_warning"] = $this->q0FeneXJzeOHe87H["warning"];
goto jys_StferQbb7mnq;
}
$R64CWyu5Nif9DGfG["error_warning"] = '';
jys_StferQbb7mnq:
if (isset($this->q0FeneXJzeOHe87H["license"])) {
$R64CWyu5Nif9DGfG["error_license"] = $this->q0FeneXJzeOHe87H["license"];
goto aiZOLOULUJ2ZxprR;
}
$R64CWyu5Nif9DGfG["error_license"] = '';
aiZOLOULUJ2ZxprR:
if (isset($this->session->data["success"])) {
$R64CWyu5Nif9DGfG["success"] = $this->session->data["success"];
unset($this->session->data["success"]);
goto vnKlwOwTIZ6_BouO;
}
$R64CWyu5Nif9DGfG["success"] = '';
vnKlwOwTIZ6_BouO:
$R64CWyu5Nif9DGfG["breadcrumbs"] = [];
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("text_home"), "href" => $this->url->link("common/dashboard", $this->ocfilter->admin->getToken(!0), "SSL")];
if ($this->ocfilter->opencart->version>= 30) {
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("text_module"), "href" => $this->url->link("marketplace/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0)];
goto j7wJpFRdfN5dveRQ;
}
if ($this->ocfilter->opencart->version== 23) {
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("text_module"), "href" => $this->url->link("extension/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0)];
goto umSC6QJiyMZhXoKw;
}
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("text_module"), "href" => $this->url->link("extension/module", $this->ocfilter->admin->getToken(!0), "SSL")];
umSC6QJiyMZhXoKw:
j7wJpFRdfN5dveRQ:
$R64CWyu5Nif9DGfG["breadcrumbs"][] = ["text" => $this->language->get("heading_title_setting"), "href" => $this->url->link("extension/module/ocfilter", $this->ocfilter->admin->getToken(!0), "SSL")];
$R64CWyu5Nif9DGfG["text_edit"] = sprintf($this->language->get("text_edit"), date($this->language->get("date_format_short"), strtotime($U0WKAj8kGGEudiWI("OCF_RELEASE_DATE"))), $U0WKAj8kGGEudiWI("OCF_VERSION"));
$R64CWyu5Nif9DGfG["text_placement"] = sprintf($this->language->get("text_placement"), $this->url->link("design/layout", $this->ocfilter->admin->getToken(!0), "SSL"));
$R64CWyu5Nif9DGfG["text_cache_system"] = sprintf($this->language->get("text_cache_system"), $this->config->get("cache_engine") ? $this->config->get("cache_engine") : $this->config->get("cache_type"));
$R64CWyu5Nif9DGfG["save"] = $this->url->link("extension/module/ocfilter", $this->ocfilter->admin->getToken(!0), "SSL");
$R64CWyu5Nif9DGfG["apply"] = $this->url->link("extension/module/ocfilter", $this->ocfilter->admin->getToken(!0) . "&apply=1", "SSL");
if ($this->ocfilter->opencart->version>= 30) {
$R64CWyu5Nif9DGfG["cancel"] = $this->url->link("marketplace/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0);
goto v8dgBczMGhEeTf3m;
}
if ($this->ocfilter->opencart->version== 23) {
$R64CWyu5Nif9DGfG["cancel"] = $this->url->link("extension/extension", $this->ocfilter->admin->getToken(!0) . "&type=module", !0);
goto cLW_p911iDHf04GK;
}
$R64CWyu5Nif9DGfG["cancel"] = $this->url->link("extension/module", $this->ocfilter->admin->getToken(!0), "SSL");
cLW_p911iDHf04GK:
v8dgBczMGhEeTf3m:
$R64CWyu5Nif9DGfG["filter_list"] = $this->url->link("extension/module/ocfilter/filter", $this->ocfilter->admin->getToken(!0), "SSL");
$R64CWyu5Nif9DGfG["filter_page_list"] = $this->url->link("extension/module/ocfilter/page", $this->ocfilter->admin->getToken(!0), "SSL");
$R64CWyu5Nif9DGfG[$this->ocfilter->admin->getTokenIndex()] = $this->ocfilter->admin->getToken();
$this->load->model("localisation/language");
$R64CWyu5Nif9DGfG["languages"] = $this->model_localisation_language->getLanguages();
foreach ($R64CWyu5Nif9DGfG["languages"] as $FP6gDrBONoVxbBkU => $Hr1aSfZkSvnT9JBM) {
if (is_file($U0WKAj8kGGEudiWI("DIR_LANGUAGE") . strtolower($Hr1aSfZkSvnT9JBM["code"]) . "/" . strtolower($Hr1aSfZkSvnT9JBM["code"]) . ".png")) {
$R64CWyu5Nif9DGfG["languages"][$FP6gDrBONoVxbBkU]["image"] = "language/" . strtolower($Hr1aSfZkSvnT9JBM["code"]) . "/" . strtolower($Hr1aSfZkSvnT9JBM["code"]) . ".png";
goto DOLXPaEFq7tuBKhw;
}
if (!empty($Hr1aSfZkSvnT9JBM["image"])) {
$R64CWyu5Nif9DGfG["languages"][$FP6gDrBONoVxbBkU]["image"] = "view/image/flags/" . $Hr1aSfZkSvnT9JBM["image"];
goto XWZ_dRIADPmNYUle;
}
$R64CWyu5Nif9DGfG["languages"][$FP6gDrBONoVxbBkU]["image"] = '';
XWZ_dRIADPmNYUle:
DOLXPaEFq7tuBKhw:
}
$R64CWyu5Nif9DGfG["types"] = ["checkbox", "radio"];
$R64CWyu5Nif9DGfG["status"] = $this->ocfilter->admin->getEntityValue("status", 0);
$R64CWyu5Nif9DGfG["license"] = $this->ocfilter->admin->getEntityValue("license", '');
$R64CWyu5Nif9DGfG["category_visibility"] = $this->ocfilter->admin->getEntityValue("category_visibility", "default");
$R64CWyu5Nif9DGfG["hide_categories"] = $this->ocfilter->admin->getEntityValue("hide_categories", 0);
$R64CWyu5Nif9DGfG["only_instock"] = $this->ocfilter->admin->getEntityValue("only_instock");
$R64CWyu5Nif9DGfG["search_button"] = $this->ocfilter->admin->getEntityValue("search_button", 1);
$R64CWyu5Nif9DGfG["cache"] = $this->ocfilter->admin->getEntityValue("cache", 1);
$R64CWyu5Nif9DGfG["cache_store"] = $this->ocfilter->admin->getEntityValue("cache_store", "db");
$R64CWyu5Nif9DGfG["debug"] = $this->ocfilter->admin->getEntityValue("debug", 0);
$R64CWyu5Nif9DGfG["module_hpm_group_products"] = $this->ocfilter->admin->getEntityValue("module_hpm_group_products", 0);
$R64CWyu5Nif9DGfG["module_hpm_group_counter"] = $this->ocfilter->admin->getEntityValue("module_hpm_group_counter", 0);
$R64CWyu5Nif9DGfG["use_hpmodel"] = $this->model_extension_module_ocfilter_setting->isUseHPModel();
$R64CWyu5Nif9DGfG["special_price"] = $this->ocfilter->admin->getEntityValue("special_price", 1);
$R64CWyu5Nif9DGfG["special_price_sort_order"] = $this->ocfilter->admin->getEntityValue("special_price_sort_order");
$R64CWyu5Nif9DGfG["special_price_logarithmic"] = $this->ocfilter->admin->getEntityValue("special_price_logarithmic");
$R64CWyu5Nif9DGfG["special_price_consider_tax"] = $this->ocfilter->admin->getEntityValue("special_price_consider_tax");
$R64CWyu5Nif9DGfG["special_price_consider_regular_price"] = $this->ocfilter->admin->getEntityValue("special_price_consider_regular_price", 1);
$R64CWyu5Nif9DGfG["special_price_consider_discount"] = $this->ocfilter->admin->getEntityValue("special_price_consider_discount");
$R64CWyu5Nif9DGfG["special_price_consider_special"] = $this->ocfilter->admin->getEntityValue("special_price_consider_special");
$R64CWyu5Nif9DGfG["special_price_consider_option"] = $this->ocfilter->admin->getEntityValue("special_price_consider_option");
$R64CWyu5Nif9DGfG["special_manufacturer"] = $this->ocfilter->admin->getEntityValue("special_manufacturer", 1);
$R64CWyu5Nif9DGfG["special_manufacturer_sort_order"] = $this->ocfilter->admin->getEntityValue("special_manufacturer_sort_order", 1);
$R64CWyu5Nif9DGfG["special_manufacturer_type"] = $this->ocfilter->admin->getEntityValue("special_manufacturer_type", "checkbox");
$R64CWyu5Nif9DGfG["special_manufacturer_dropdown"] = $this->ocfilter->admin->getEntityValue("special_manufacturer_dropdown");
$R64CWyu5Nif9DGfG["special_manufacturer_image"] = $this->ocfilter->admin->getEntityValue("special_manufacturer_image");
$R64CWyu5Nif9DGfG["special_discount"] = $this->ocfilter->admin->getEntityValue("special_discount");
$R64CWyu5Nif9DGfG["special_discount_sort_order"] = $this->ocfilter->admin->getEntityValue("special_discount_sort_order", 2);
$R64CWyu5Nif9DGfG["special_discount_consider_discount"] = $this->ocfilter->admin->getEntityValue("special_discount_consider_discount");
$R64CWyu5Nif9DGfG["special_discount_consider_special"] = $this->ocfilter->admin->getEntityValue("special_discount_consider_special", 1);
$R64CWyu5Nif9DGfG["special_newest"] = $this->ocfilter->admin->getEntityValue("special_newest");
$R64CWyu5Nif9DGfG["special_newest_sort_order"] = $this->ocfilter->admin->getEntityValue("special_newest_sort_order", 3);
$R64CWyu5Nif9DGfG["special_newest_interval"] = $this->ocfilter->admin->getEntityValue("special_newest_interval", 1);
$R64CWyu5Nif9DGfG["special_newest_period"] = $this->ocfilter->admin->getEntityValue("special_newest_period", "week");
$R64CWyu5Nif9DGfG["special_length"] = $this->ocfilter->admin->getEntityValue("special_length");
$R64CWyu5Nif9DGfG["special_length_sort_order"] = $this->ocfilter->admin->getEntityValue("special_length_sort_order", 4);
$R64CWyu5Nif9DGfG["special_width"] = $this->ocfilter->admin->getEntityValue("special_width");
$R64CWyu5Nif9DGfG["special_width_sort_order"] = $this->ocfilter->admin->getEntityValue("special_width_sort_order", 5);
$R64CWyu5Nif9DGfG["special_height"] = $this->ocfilter->admin->getEntityValue("special_height");
$R64CWyu5Nif9DGfG["special_height_sort_order"] = $this->ocfilter->admin->getEntityValue("special_height_sort_order", 6);
$R64CWyu5Nif9DGfG["special_weight"] = $this->ocfilter->admin->getEntityValue("special_weight");
$R64CWyu5Nif9DGfG["special_weight_sort_order"] = $this->ocfilter->admin->getEntityValue("special_weight_sort_order", 7);
$R64CWyu5Nif9DGfG["special_stock"] = $this->ocfilter->admin->getEntityValue("special_stock");
$R64CWyu5Nif9DGfG["special_stock_sort_order"] = $this->ocfilter->admin->getEntityValue("special_stock_sort_order", 8);
$R64CWyu5Nif9DGfG["special_stock_type"] = $this->ocfilter->admin->getEntityValue("special_stock_type", "checkbox");
$R64CWyu5Nif9DGfG["special_stock_method"] = $this->ocfilter->admin->getEntityValue("special_stock_method", "quantity");
$R64CWyu5Nif9DGfG["special_stock_out_value"] = $this->ocfilter->admin->getEntityValue("special_stock_out_value");
$R64CWyu5Nif9DGfG["sitemap_status"] = $this->ocfilter->admin->getEntityValue("sitemap_status", 1);
$R64CWyu5Nif9DGfG["sitemap_link"] = $U0WKAj8kGGEudiWI("HTTPS_CATALOG") . "ocfilter-sitemap";
$R64CWyu5Nif9DGfG["page_category_link_status"] = $this->ocfilter->admin->getEntityValue("page_category_link_status", 1);
$R64CWyu5Nif9DGfG["page_category_link_position"] = $this->ocfilter->admin->getEntityValue("page_category_link_position", "bottom");
$R64CWyu5Nif9DGfG["page_module_link_status"] = $this->ocfilter->admin->getEntityValue("page_module_link_status", 1);
$R64CWyu5Nif9DGfG["page_module_link_title"] = $this->ocfilter->admin->getEntityValue("page_module_link_title", [$this->config->get("config_language_id") => $this->language->get("page_module_link_title")]);
$R64CWyu5Nif9DGfG["page_product_link_status"] = $this->ocfilter->admin->getEntityValue("page_product_link_status", 1);
$R64CWyu5Nif9DGfG["page_product_link_relation_type"] = $this->ocfilter->admin->getEntityValue("page_product_link_relation_type", "complete");
$R64CWyu5Nif9DGfG["url_suffix"] = $this->ocfilter->admin->getEntityValue("url_suffix", '');
$R64CWyu5Nif9DGfG["add_meta"] = $this->ocfilter->admin->getEntityValue("add_meta", "filter_value");
$R64CWyu5Nif9DGfG["meta_filter_separator"] = $this->ocfilter->admin->getEntityValue("meta_filter_separator", ". ");
$R64CWyu5Nif9DGfG["meta_value_separator"] = $this->ocfilter->admin->getEntityValue("meta_value_separator", ", ");
$R64CWyu5Nif9DGfG["add_meta_limit"] = $this->ocfilter->admin->getEntityValue("add_meta_limit", 2);
$R64CWyu5Nif9DGfG["meta_lowercase"] = $this->ocfilter->admin->getEntityValue("meta_lowercase", 1);
$R64CWyu5Nif9DGfG["category_breadcrumb"] = $this->ocfilter->admin->getEntityValue("category_breadcrumb", 0);
$R64CWyu5Nif9DGfG["product_breadcrumb"] = $this->ocfilter->admin->getEntityValue("product_breadcrumb", 0);
$R64CWyu5Nif9DGfG["theme"] = $this->ocfilter->admin->getEntityValue("theme", "light");
$R64CWyu5Nif9DGfG["module_heading_title"] = $this->ocfilter->admin->getEntityValue("module_heading_title", [$this->config->get("config_language_id") => $this->language->get("module_heading_title")]);
$R64CWyu5Nif9DGfG["mobile_button_text"] = $this->ocfilter->admin->getEntityValue("mobile_button_text", [$this->config->get("config_language_id") => $this->language->get("mobile_button_text")]);
$R64CWyu5Nif9DGfG["mobile_button_position"] = $this->ocfilter->admin->getEntityValue("mobile_button_position", "fixed");
$R64CWyu5Nif9DGfG["mobile_max_width"] = $this->ocfilter->admin->getEntityValue("mobile_max_width", 767);
$R64CWyu5Nif9DGfG["mobile_placement"] = $this->ocfilter->admin->getEntityValue("mobile_placement", "left");
$R64CWyu5Nif9DGfG["mobile_remember_state"] = $this->ocfilter->admin->getEntityValue("mobile_remember_state", 1);
$R64CWyu5Nif9DGfG["show_filters_limit"] = $this->ocfilter->admin->getEntityValue("show_filters_limit");
$R64CWyu5Nif9DGfG["hidden_filters_lazy_load"] = $this->ocfilter->admin->getEntityValue("hidden_filters_lazy_load");
$R64CWyu5Nif9DGfG["hide_single_value"] = $this->ocfilter->admin->getEntityValue("hide_single_value");
$R64CWyu5Nif9DGfG["slider_input"] = $this->ocfilter->admin->getEntityValue("slider_input", 1);
$R64CWyu5Nif9DGfG["slider_pips"] = $this->ocfilter->admin->getEntityValue("slider_pips", 1);
$R64CWyu5Nif9DGfG["show_selected"] = $this->ocfilter->admin->getEntityValue("show_selected", 1);
$R64CWyu5Nif9DGfG["show_counter"] = $this->ocfilter->admin->getEntityValue("show_counter", 1);
$R64CWyu5Nif9DGfG["show_values_limit"] = $this->ocfilter->admin->getEntityValue("show_values_limit");
$R64CWyu5Nif9DGfG["hidden_values_lazy_load"] = $this->ocfilter->admin->getEntityValue("hidden_values_lazy_load");
$R64CWyu5Nif9DGfG["hide_empty_values"] = $this->ocfilter->admin->getEntityValue("hide_empty_values", 1);
$R64CWyu5Nif9DGfG["values_auto_column"] = $this->ocfilter->admin->getEntityValue("values_auto_column");
$this->load->model("design/layout");
$this->load->model("extension/module/ocfilter/filter");
$I17LAYLh09DYM2ro = $this->ocfilter->admin->getEntityValue("placement_layout", []);
$R64CWyu5Nif9DGfG["placement_layout"] = [];
foreach ($I17LAYLh09DYM2ro as $lJRS661whmWwz2zf) {
$z6wpwK7711OnRQcQ = $this->model_design_layout->getLayout($lJRS661whmWwz2zf["layout_id"]);
if ($z6wpwK7711OnRQcQ) {
$d2MJ6tq7t3vGcPho = $z6wpwK7711OnRQcQ["name"];
goto b2bzW2yBpH1CxNdg;
}
$d2MJ6tq7t3vGcPho = "-- / --";
b2bzW2yBpH1CxNdg:
$MN6YHDxazbPBmlVv = [];
if (!isset($lJRS661whmWwz2zf["filters"])) {
goto LhQw1uARy4r390jf;
}
foreach ($lJRS661whmWwz2zf["filters"] as $JHSOK2vE9PnQq4lG) {
$rHbaUKEvhDax2B37 = $this->model_extension_module_ocfilter_filter->getFilter($JHSOK2vE9PnQq4lG);
if (!$rHbaUKEvhDax2B37) {
goto NOb3HGB0158u2LSE;
}
$MN6YHDxazbPBmlVv[] = ["name" => $rHbaUKEvhDax2B37["name"], "filter_key" => $JHSOK2vE9PnQq4lG, "filter_id" => $rHbaUKEvhDax2B37["filter_id"], "source" => $rHbaUKEvhDax2B37["source"]];
NOb3HGB0158u2LSE:
}
LhQw1uARy4r390jf:
$R64CWyu5Nif9DGfG["placement_layout"][] = ["layout_id" => $lJRS661whmWwz2zf["layout_id"], "layout_name" => $d2MJ6tq7t3vGcPho, "filters" => $MN6YHDxazbPBmlVv];
}
$I17LAYLh09DYM2ro = $this->model_design_layout->getLayouts();
$R64CWyu5Nif9DGfG["layouts"] = [];
foreach ($I17LAYLh09DYM2ro as $lJRS661whmWwz2zf) {
$yLjKMWqf7YI9A2tv = $this->model_design_layout->getLayoutRoutes($lJRS661whmWwz2zf["layout_id"]);
$x6IyjxViblrgmxNq = array_filter(array_column($yLjKMWqf7YI9A2tv, "route"), function ($VZWZWXq2QaS2nSbF) {
return "product/category" == substr($VZWZWXq2QaS2nSbF, 0, 16) || "product/search" == substr($VZWZWXq2QaS2nSbF, 0, 14) || "product/special" == substr($VZWZWXq2QaS2nSbF, 0, 15) || "product/manufacturer" == substr($VZWZWXq2QaS2nSbF, 0, 20);
});
$R64CWyu5Nif9DGfG["layouts"][] = ["layout_id" => $lJRS661whmWwz2zf["layout_id"], "name" => $lJRS661whmWwz2zf["name"], "disabled" => $x6IyjxViblrgmxNq];
}
$R64CWyu5Nif9DGfG["copy_type"] = $this->ocfilter->admin->getEntityValue("copy_type", "checkbox");
$R64CWyu5Nif9DGfG["copy_dropdown"] = $this->ocfilter->admin->getEntityValue("copy_dropdown");
$R64CWyu5Nif9DGfG["copy_status"] = $this->ocfilter->admin->getEntityValue("copy_status", 1);
$R64CWyu5Nif9DGfG["copy_attribute"] = $this->ocfilter->admin->getEntityValue("copy_attribute", 1);
$R64CWyu5Nif9DGfG["copy_attribute_id"] = $this->ocfilter->admin->getEntityValue("copy_attribute_id", []);
$R64CWyu5Nif9DGfG["copy_attribute_id_exclude"] = $this->ocfilter->admin->getEntityValue("copy_attribute_id_exclude", 1);
$R64CWyu5Nif9DGfG["copy_attribute_group_id"] = $this->ocfilter->admin->getEntityValue("copy_attribute_group_id", []);
$R64CWyu5Nif9DGfG["copy_attribute_group_id_exclude"] = $this->ocfilter->admin->getEntityValue("copy_attribute_group_id_exclude", 1);
$R64CWyu5Nif9DGfG["copy_attribute_category_id"] = $this->ocfilter->admin->getEntityValue("copy_attribute_category_id", []);
$R64CWyu5Nif9DGfG["copy_attribute_category_id_exclude"] = $this->ocfilter->admin->getEntityValue("copy_attribute_category_id_exclude", 1);
$R64CWyu5Nif9DGfG["copy_group_as_attribute"] = $this->ocfilter->admin->getEntityValue("copy_group_as_attribute");
$R64CWyu5Nif9DGfG["copy_option"] = $this->ocfilter->admin->getEntityValue("copy_option");
$R64CWyu5Nif9DGfG["copy_option_in_stock"] = $this->ocfilter->admin->getEntityValue("copy_option_in_stock", 1);
$R64CWyu5Nif9DGfG["copy_filter"] = $this->ocfilter->admin->getEntityValue("copy_filter");
$R64CWyu5Nif9DGfG["copy_truncate"] = $this->ocfilter->admin->getEntityValue("copy_truncate");
$R64CWyu5Nif9DGfG["copy_category"] = $this->ocfilter->admin->getEntityValue("copy_category", 1);
$R64CWyu5Nif9DGfG["copy_value_separator"] = $this->ocfilter->admin->getEntityValue("copy_value_separator", []);
$R64CWyu5Nif9DGfG["copy_cron_wget"] = $this->ocfilter->admin->getEntityValue("copy_cron_wget", 0);
$R64CWyu5Nif9DGfG["cron_command_bin"] = $this->ocfilter->helper->findExecutable();
$R64CWyu5Nif9DGfG["cron_command_script"] = $U0WKAj8kGGEudiWI("DIR_APPLICATION") . "controller/extension/module/ocfilter/cron.php";
$R64CWyu5Nif9DGfG["cron_command_wget"] = "wget -t 1 -O - " . $U0WKAj8kGGEudiWI("HTTPS_SERVER") . "controller/extension/module/ocfilter/cron.php";
$R64CWyu5Nif9DGfG["tpl_bool_button"] = $this->ocfilter->admin->getBoolControl($this->load->language("extension/module/ocfilter/setting"));
$R64CWyu5Nif9DGfG["tpl_sort_order"] = $this->ocfilter->admin->getSortOrderControl($this->load->language("extension/module/ocfilter/setting"));
$R64CWyu5Nif9DGfG["header"] = $this->load->controller("common/header");
$R64CWyu5Nif9DGfG["column_left"] = $this->load->controller("common/column_left");
$R64CWyu5Nif9DGfG["footer"] = $this->load->controller("common/footer");
$this->ocfilter->opencart->responseTemplate("extension/module/ocfilter/setting_form", $R64CWyu5Nif9DGfG);
}
protected function MfcRiTWCRjz24KA5($hfVKWQVCA6tJUv_l)
{
$this->registry = $hfVKWQVCA6tJUv_l;
}
public function __call($I1ClI6DbM_kJBJ0l, $Bvv7Xz6v0mfJCng3)
{
if (!($I1ClI6DbM_kJBJ0l == "Ccc8f24d5280bb8e")) {
if (!($I1ClI6DbM_kJBJ0l == "Ae55cc7385415b25")) {
// [PHPDeobfuscator] Implied return
return;
}
return $this->gF5lTC3Q7vvIl1wr($Bvv7Xz6v0mfJCng3);
}
return $this->n36DVuSik8V69aG1($Bvv7Xz6v0mfJCng3);
}
protected function n36dVUSIK8v69aG1($Bvv7Xz6v0mfJCng3)
{
return $this->Cfbc31e610620b2a4($Bvv7Xz6v0mfJCng3);
}
protected function gF5LTC3Q7VvIL1wR($Bvv7Xz6v0mfJCng3)
{
return $this->F6d342ac5c9a602c97($Bvv7Xz6v0mfJCng3);
}
public function __construct($hfVKWQVCA6tJUv_l)
{
$this->mfCritWcRJZ24Ka5($hfVKWQVCA6tJUv_l);
}
public function F6d342ac5c9a602c97($R64CWyu5Nif9DGfG = [])
{
$vQHdb3JG0ShBGF0n = "session_id";
$xuti4zne4fytlap_ = "session_write_close";
if (!session_id()) {
goto qV5lePFbccGzaPqm;
}
$xuti4zne4fytlap_();
qV5lePFbccGzaPqm:
$this->ocfilter->admin->setControllerEntityConfig(!0);
$Do4SVGis2TKzn1Zd = [];
$this->load->language("extension/module/ocfilter/setting");
if ($this->ocfilter->opencart->version >= 30) {
$uG06cxqOHgn3IjOu = "module_ocfilter";
goto LTZKLcqETMED3uZF;
}
$uG06cxqOHgn3IjOu = "ocfilter";
LTZKLcqETMED3uZF:
$UMIt23YjQ6uq9EjW = function ($anna05IfEMEausST) {
$anna05IfEMEausST = trim(str_replace(["http://", "https://", "www."], '', $anna05IfEMEausST), "/");
$anna05IfEMEausST = preg_replace("/\\/.+\$/", '', $anna05IfEMEausST);
$Punycode = new Punycode();
$anna05IfEMEausST = $Punycode->decode($anna05IfEMEausST);
if (preg_match("/(?P<domain>[a-a-z0-9][a-a-z0-9\\-]{1,63}\\.[a-a-z\\.]{2,6})\$/iu", $anna05IfEMEausST, $AgsYrc3KCr_OuwZi)) {
return $AgsYrc3KCr_OuwZi["domain"];
}
return $anna05IfEMEausST;
};
$rodFDfuV2C_7dY_O = function () use ($uG06cxqOHgn3IjOu) {
if (!($this->itsLocalhost() === true)) {
return false;
}
$rb3UU61Mengyh5wp = $this->ocfilter->config("license");
if (!$rb3UU61Mengyh5wp) {
$this->ocfilter->setting->add("license", '');
$this->ocfilter->setting->add("status", 0);
return true;
}
if ($this->checkDomain($rb3UU61Mengyh5wp)) {
return true;
}
$this->model_setting_setting->editSetting($uG06cxqOHgn3IjOu, [$uG06cxqOHgn3IjOu . "_status" => 0]);
return false;
};
if (!($this->user->hasPermission("modify", "extension/module/ocfilter") && $this->user->hasPermission("modify", "extension/module/ocfilter/filter") && $rodFDfuV2C_7dY_O())) {
goto qmd07GOhSV2Edj3l;
}
$this->load->model("extension/module/ocfilter/filter");
$NreaaPDgaRIwh_BT = ["copy_type" => $this->ocfilter->admin->getEntityValue("copy_type", "checkbox"), "copy_dropdown" => $this->ocfilter->admin->getEntityValue("copy_dropdown"), "copy_status" => $this->ocfilter->admin->getEntityValue("copy_status", 1), "copy_attribute" => $this->ocfilter->admin->getEntityValue("copy_attribute", 1), "copy_attribute_id" => $this->ocfilter->admin->getEntityValue("copy_attribute_id", []), "copy_attribute_id_exclude" => $this->ocfilter->admin->getEntityValue("copy_attribute_id_exclude", 1), "copy_attribute_group_id" => $this->ocfilter->admin->getEntityValue("copy_attribute_group_id", []), "copy_attribute_group_id_exclude" => $this->ocfilter->admin->getEntityValue("copy_attribute_group_id_exclude", 1), "copy_attribute_category_id" => $this->ocfilter->admin->getEntityValue("copy_attribute_category_id", []), "copy_attribute_category_id_exclude" => $this->ocfilter->admin->getEntityValue("copy_attribute_category_id_exclude", 1), "copy_group_as_attribute" => $this->ocfilter->admin->getEntityValue("copy_group_as_attribute"), "copy_filter" => $this->ocfilter->admin->getEntityValue("copy_filter"), "copy_option" => $this->ocfilter->admin->getEntityValue("copy_option"), "copy_option_in_stock" => $this->ocfilter->admin->getEntityValue("copy_option_in_stock", 1), "copy_value_separator" => $this->ocfilter->admin->getEntityValue("copy_value_separator", []), "copy_truncate" => $this->ocfilter->admin->getEntityValue("copy_truncate"), "copy_category" => $this->ocfilter->admin->getEntityValue("copy_category", 1)];
if (!(is_array($R64CWyu5Nif9DGfG) && !empty($R64CWyu5Nif9DGfG))) {
goto vx0V6VbVduw1vrRb;
}
$NreaaPDgaRIwh_BT = array_merge($NreaaPDgaRIwh_BT, $R64CWyu5Nif9DGfG);
vx0V6VbVduw1vrRb:
if (empty($this->request->post["copy_save_setting"])) {
goto LdDLUx66m5klYumV;
}
foreach ($NreaaPDgaRIwh_BT as $FP6gDrBONoVxbBkU => $T3m0E1ZuSpBz2TWL) {
$this->ocfilter->setting->add($FP6gDrBONoVxbBkU, $T3m0E1ZuSpBz2TWL);
}
LdDLUx66m5klYumV:
if (!isset($this->request->get["copy_hash"])) {
goto qjLCCUpM7LtQaLwa;
}
$NreaaPDgaRIwh_BT["copy_hash"] = $this->request->get["copy_hash"];
qjLCCUpM7LtQaLwa:
$this->model_extension_module_ocfilter_filter->copyFilters($NreaaPDgaRIwh_BT);
$Do4SVGis2TKzn1Zd["success"] = $this->language->get("text_complete");
qmd07GOhSV2Edj3l:
$this->ocfilter->opencart->responseJSON($Do4SVGis2TKzn1Zd);
}
}
/**
* Punycode implementation as described in RFC 3492
*
* @link http://tools.ietf.org/html/rfc3492
*/
class Punycode
{
/**
* Bootstring parameter values
*
*/
const BASE = 36;
const TMIN = 1;
const TMAX = 26;
const SKEW = 38;
const DAMP = 700;
const INITIAL_BIAS = 72;
const INITIAL_N = 128;
const PREFIX = 'xn--';
const DELIMITER = '-';
/**
* Encode table
*
* @param array
*/
protected static $encodeTable = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
/**
* Decode table
*
* @param array
*/
protected static $decodeTable = array('a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5, 'g' => 6, 'h' => 7, 'i' => 8, 'j' => 9, 'k' => 10, 'l' => 11, 'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17, 's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23, 'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29, '4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35);
/**
* Character encoding
*
* @param string
*/
protected $encoding;
/**
* Constructor
*
* @param string $encoding Character encoding
*/
public function __construct($encoding = 'UTF-8')
{
$this->encoding = $encoding;
}
/**
* Encode a domain to its Punycode version
*
* @param string $input Domain name in Unicode to be encoded
* @return string Punycode representation in ASCII
*/
public function encode($input)
{
$input = mb_strtolower($input, $this->encoding);
$parts = explode('.', $input);
foreach ($parts as &$part) {
$length = strlen($part);
if ($length < 1) {
throw new LabelOutOfBoundsException(sprintf('The length of any one label is limited to between 1 and 63 octets, but %s given.', $length));
}
$part = $this->encodePart($part);
}
$output = implode('.', $parts);
$length = strlen($output);
if ($length > 255) {
throw new DomainOutOfBoundsException(sprintf('A full domain name is limited to 255 octets (including the separators), %s given.', $length));
}
return $output;
}
/**
* Encode a part of a domain name, such as tld, to its Punycode version
*
* @param string $input Part of a domain name
* @return string Punycode representation of a domain part
*/
protected function encodePart($input)
{
$codePoints = $this->listCodePoints($input);
$n = static::INITIAL_N;
$bias = static::INITIAL_BIAS;
$delta = 0;
$h = $b = count($codePoints['basic']);
$output = '';
foreach ($codePoints['basic'] as $code) {
$output .= $this->codePointToChar($code);
}
if ($input === $output) {
return $output;
}
if ($b > 0) {
$output .= static::DELIMITER;
}
$codePoints['nonBasic'] = array_unique($codePoints['nonBasic']);
sort($codePoints['nonBasic']);
$i = 0;
$length = mb_strlen($input, $this->encoding);
while ($h < $length) {
$m = $codePoints['nonBasic'][$i++];
$delta += ($m - $n) * ($h + 1);
$n = $m;
foreach ($codePoints['all'] as $c) {
if ($c < $n || $c < static::INITIAL_N) {
$delta++;
}
if ($c === $n) {
$q = $delta;
for ($k = static::BASE;; $k += static::BASE) {
$t = $this->calculateThreshold($k, $bias);
if ($q < $t) {
break;
}
$code = $t + ($q - $t) % (static::BASE - $t);
$output .= static::$encodeTable[$code];
$q = ($q - $t) / (static::BASE - $t);
}
$output .= static::$encodeTable[$q];
$bias = $this->adapt($delta, $h + 1, $h === $b);
$delta = 0;
$h++;
}
}
$delta++;
$n++;
}
$out = static::PREFIX . $output;
$length = strlen($out);
if ($length > 63 || $length < 1) {
throw new LabelOutOfBoundsException(sprintf('The length of any one label is limited to between 1 and 63 octets, but %s given.', $length));
}
return $out;
}
/**
* Decode a Punycode domain name to its Unicode counterpart
*
* @param string $input Domain name in Punycode
* @return string Unicode domain name
*/
public function decode($input)
{
$input = strtolower($input);
$parts = explode('.', $input);
foreach ($parts as &$part) {
$length = strlen($part);
if ($length > 63 || $length < 1) {
throw new LabelOutOfBoundsException(sprintf('The length of any one label is limited to between 1 and 63 octets, but %s given.', $length));
}
if (strpos($part, static::PREFIX) !== 0) {
continue;
}
$part = substr($part, strlen(static::PREFIX));
$part = $this->decodePart($part);
}
$output = implode('.', $parts);
$length = strlen($output);
if ($length > 255) {
throw new DomainOutOfBoundsException(sprintf('A full domain name is limited to 255 octets (including the separators), %s given.', $length));
}
return $output;
}
/**
* Decode a part of domain name, such as tld
*
* @param string $input Part of a domain name
* @return string Unicode domain part
*/
protected function decodePart($input)
{
$n = static::INITIAL_N;
$i = 0;
$bias = static::INITIAL_BIAS;
$output = '';
$pos = strrpos($input, static::DELIMITER);
if ($pos !== false) {
$output = substr($input, 0, $pos++);
} else {
$pos = 0;
}
$outputLength = strlen($output);
$inputLength = strlen($input);
while ($pos < $inputLength) {
$oldi = $i;
$w = 1;
for ($k = static::BASE;; $k += static::BASE) {
$digit = static::$decodeTable[$input[$pos++]];
$i += $digit * $w;
$t = $this->calculateThreshold($k, $bias);
if ($digit < $t) {
break;
}
$w *= static::BASE - $t;
}
$bias = $this->adapt($i - $oldi, ++$outputLength, $oldi === 0);
$n += (int) ($i / $outputLength);
$i %= $outputLength;
$output = mb_substr($output, 0, $i, $this->encoding) . $this->codePointToChar($n) . mb_substr($output, $i, $outputLength - 1, $this->encoding);
$i++;
}
return $output;
}
/**
* Calculate the bias threshold to fall between TMIN and TMAX
*
* @param integer $k
* @param integer $bias
* @return integer
*/
protected function calculateThreshold($k, $bias)
{
if ($k <= $bias + static::TMIN) {
return static::TMIN;
} elseif ($k >= $bias + static::TMAX) {
return static::TMAX;
}
return $k - $bias;
}
/**
* Bias adaptation
*
* @param integer $delta
* @param integer $numPoints
* @param boolean $firstTime
* @return integer
*/
protected function adapt($delta, $numPoints, $firstTime)
{
$delta = (int) ($firstTime ? $delta / static::DAMP : $delta / 2);
$delta += (int) ($delta / $numPoints);
$k = 0;
while ($delta > (static::BASE - static::TMIN) * static::TMAX / 2) {
$delta = (int) ($delta / (static::BASE - static::TMIN));
$k += static::BASE;
}
$k += (int) ((static::BASE - static::TMIN + 1) * $delta / ($delta + static::SKEW));
return $k;
}
/**
* List code points for a given input
*
* @param string $input
* @return array Multi-dimension array with basic, non-basic and aggregated code points
*/
protected function listCodePoints($input)
{
$codePoints = array('all' => array(), 'basic' => array(), 'nonBasic' => array());
$length = mb_strlen($input, $this->encoding);
for ($i = 0; $i < $length; $i++) {
$char = mb_substr($input, $i, 1, $this->encoding);
$code = $this->charToCodePoint($char);
if ($code < 128) {
$codePoints['all'][] = $codePoints['basic'][] = $code;
} else {
$codePoints['all'][] = $codePoints['nonBasic'][] = $code;
}
}
return $codePoints;
}
/**
* Convert a single or multi-byte character to its code point
*
* @param string $char
* @return integer
*/
protected function charToCodePoint($char)
{
$code = ord($char[0]);
if ($code < 128) {
return $code;
} elseif ($code < 224) {
return ($code - 192) * 64 + (ord($char[1]) - 128);
} elseif ($code < 240) {
return ($code - 224) * 4096 + (ord($char[1]) - 128) * 64 + (ord($char[2]) - 128);
} else {
return ($code - 240) * 262144 + (ord($char[1]) - 128) * 4096 + (ord($char[2]) - 128) * 64 + (ord($char[3]) - 128);
}
}
/**
* Convert a code point to its single or multi-byte character
*
* @param integer $code
* @return string
*/
protected function codePointToChar($code)
{
if ($code <= 0x7f) {
return chr($code);
} elseif ($code <= 0x7ff) {
return chr(($code >> 6) + 192) . chr(($code & 63) + 128);
} elseif ($code <= 0xffff) {
return chr(($code >> 12) + 224) . chr(($code >> 6 & 63) + 128) . chr(($code & 63) + 128);
} else {
return chr(($code >> 18) + 240) . chr(($code >> 12 & 63) + 128) . chr(($code >> 6 & 63) + 128) . chr(($code & 63) + 128);
}
}
}
Function Calls
None |
Stats
MD5 | ee07b7739617db42cc8c7af6077b0dc7 |
Eval Count | 0 |
Decode Time | 80 ms |