Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

class ThemeController extends Controller { use Authorizable; public function al..

Decoded Output download

<?  class ThemeController extends Controller 
{ 
    use Authorizable; 
    public function all() 
    { 
        $storeFrontThemes = collect($this->storeFrontThemes()); 
        $t_theme = active_theme(); 
        $active_theme = $storeFrontThemes->firstWhere("slug", $t_theme); 
        $storeFrontThemes = $storeFrontThemes->filter(function ($value, $key) use ($t_theme) { 
            return $value["slug"] != $t_theme; 
        }); 
        $sellingThemes = collect($this->sellingThemes()); 
        return view("admin.theme.index", compact("storeFrontThemes", "active_theme", "sellingThemes")); 
    } 
    public function initiate(Request $request, $theme) 
    { 
        if (!(config("app.demo") == true && config("app.debug") !== true)) { 
            goto wqNUM; 
        } 
        return back()->with("warning", trans("messages.demo_restriction")); 
        wqNUM: 
        return view("admin.theme._initiate", compact("theme")); 
    } 
    public function activate(ThemeInstallationRequest $request, $theme, $type = "storefront") 
    { 
        if (!(config("app.demo") == true)) { 
            goto fBfXd; 
        } 
        Session::put("theme", $theme); 
        return back()->with("success", trans("messages.theme_activated", ["theme" => $theme])); 
        fBfXd: 
        $system = SystemConfig::orderBy("id", "asc")->first(); 
        $this->authorize("update", $system); 
        Log::info("Installing theme " . $theme); 
        try { 
            if ($type == "selling") { 
                goto U9tca; 
            } 
            $installable = $this->storeFrontThemes($theme); 
            $system->active_theme = $theme; 
            goto dAau0; 
            U9tca: 
            $installable = $this->sellingThemes($theme); 
            $system->selling_theme = $theme; 
            dAau0: 
            preparePackageInstallation(array_merge($request->all(), $installable)); 
        } catch (\Exception $exception) { 
            Log::info("Theme installation failed " . $theme); 
            Log::error(get_exception_message($exception)); 
            return back()->with("error", $exception->getMessage()); 
        } 
        if (!$system->save()) { 
            goto gthhs; 
        } 
        event(new SystemConfigUpdated($system)); 
        return back()->with("success", trans("messages.theme_activated", ["theme" => $theme])); 
        gthhs: 
        return back()->with("error", trans("messages.failed")); 
    } 
    private function storeFrontThemes($slug = null) 
    { 
        $storeFrontThemes = []; 
        foreach (glob(theme_path("*"), GLOB_ONLYDIR) as $themeFolder) { 
            $themeFolder = realpath($themeFolder); 
            if (!file_exists($jsonFilename = $themeFolder . "/" . "theme.json")) { 
                goto vnYdG; 
            } 
            $folders = explode(DIRECTORY_SEPARATOR, $themeFolder); 
            $themeName = end($folders); 
            $data = []; 
            $json = file_get_contents($jsonFilename); 
            if (!($json !== '')) { 
                goto Efz6n; 
            } 
            $data = json_decode($json, true); 
            if (!($data === null)) { 
                goto w3I78; 
            } 
            throw new \Exception("Invalid theme.json file at [{$themeFolder}]"); 
            w3I78: 
            if (!(!$data["released"] && App::environment(["production"]))) { 
                goto iM5UO; 
            } 
            goto UgcPW; 
            iM5UO: 
            Efz6n: 
            if (!($slug && $data["slug"] == $slug)) { 
                goto uTFJ_; 
            } 
            $data["path"] = $themeFolder; 
            return $data; 
            uTFJ_: 
            $data["assets-path"] = theme_assets_path($data["slug"]); 
            $data["views-path"] = theme_views_path($data["slug"]); 
            $storeFrontThemes[] = $data; 
            vnYdG: 
            UgcPW: 
        } 
        oj_to: 
        usort($storeFrontThemes, function ($x, $y) { 
            return strnatcmp($x["name"], $y["name"]); 
        }); 
        return $storeFrontThemes; 
    } 
    private function sellingThemes($slug = null) 
    { 
        $sellingThemes = []; 
        foreach (glob(selling_theme_path("*"), GLOB_ONLYDIR) as $themeFolder) { 
            $themeFolder = realpath($themeFolder); 
            if (!file_exists($jsonFilename = $themeFolder . "/" . "theme.json")) { 
                goto BqKfr; 
            } 
            $folders = explode(DIRECTORY_SEPARATOR, $themeFolder); 
            $themeName = end($folders); 
            $data = []; 
            $json = file_get_contents($jsonFilename); 
            if (!($json !== '')) { 
                goto eT1SV; 
            } 
            $data = json_decode($json, true); 
            if (!($data === null)) { 
                goto WA4yr; 
            } 
            throw new \Exception("Invalid theme.json file at [{$themeFolder}]"); 
            WA4yr: 
            eT1SV: 
            if (!($slug && $data["slug"] == $slug)) { 
                goto qbkAq; 
            } 
            $data["path"] = $themeFolder; 
            return $data; 
            qbkAq: 
            $data["assets-path"] = selling_theme_assets_path($data["slug"]); 
            $data["views-path"] = selling_theme_views_path($data["slug"]); 
            $sellingThemes[] = $data; 
            BqKfr: 
            e80Lo: 
        } 
        mPQoB: 
        usort($sellingThemes, function ($x, $y) { 
            return strnatcmp($x["name"], $y["name"]); 
        }); 
        return $sellingThemes; 
    } 
} 
 ?>

Did this file decode correctly?

Original Code

class ThemeController extends Controller
{
    use Authorizable;
    public function all()
    {
        $storeFrontThemes = collect($this->storeFrontThemes());
        $t_theme = active_theme();
        $active_theme = $storeFrontThemes->firstWhere("\163\x6c\x75\147", $t_theme);
        $storeFrontThemes = $storeFrontThemes->filter(function ($value, $key) use ($t_theme) {
            return $value["\163\x6c\x75\x67"] != $t_theme;
        });
        $sellingThemes = collect($this->sellingThemes());
        return view("\x61\x64\x6d\x69\x6e\x2e\x74\150\x65\155\145\56\151\156\x64\x65\170", compact("\x73\164\157\162\x65\x46\x72\x6f\156\x74\124\150\x65\155\x65\163", "\x61\x63\x74\151\x76\145\x5f\x74\150\x65\155\x65", "\163\x65\x6c\x6c\151\x6e\x67\124\x68\x65\x6d\145\163"));
    }
    public function initiate(Request $request, $theme)
    {
        if (!(config("\141\160\160\56\144\x65\x6d\157") == true && config("\x61\160\160\56\144\x65\x62\x75\x67") !== true)) {
            goto wqNUM;
        }
        return back()->with("\x77\x61\x72\156\x69\156\147", trans("\155\145\x73\x73\141\x67\x65\x73\56\x64\145\155\157\x5f\162\x65\163\x74\x72\x69\143\x74\x69\157\156"));
        wqNUM:
        return view("\x61\144\155\151\x6e\56\x74\x68\x65\x6d\145\56\137\151\x6e\151\164\x69\x61\164\x65", compact("\164\150\x65\155\145"));
    }
    public function activate(ThemeInstallationRequest $request, $theme, $type = "\163\164\157\162\145\x66\162\x6f\x6e\164")
    {
        if (!(config("\141\160\x70\56\x64\x65\155\x6f") == true)) {
            goto fBfXd;
        }
        Session::put("\x74\150\145\x6d\x65", $theme);
        return back()->with("\163\x75\x63\143\x65\x73\163", trans("\155\x65\163\163\x61\x67\x65\163\56\164\x68\x65\155\145\137\141\x63\x74\x69\166\141\164\x65\144", ["\x74\x68\x65\155\145" => $theme]));
        fBfXd:
        $system = SystemConfig::orderBy("\151\x64", "\x61\163\x63")->first();
        $this->authorize("\x75\160\144\x61\x74\x65", $system);
        Log::info("\111\156\163\164\x61\x6c\x6c\151\x6e\147\40\164\150\x65\155\x65\40" . $theme);
        try {
            if ($type == "\163\145\x6c\154\x69\156\147") {
                goto U9tca;
            }
            $installable = $this->storeFrontThemes($theme);
            $system->active_theme = $theme;
            goto dAau0;
            U9tca:
            $installable = $this->sellingThemes($theme);
            $system->selling_theme = $theme;
            dAau0:
            preparePackageInstallation(array_merge($request->all(), $installable));
        } catch (\Exception $exception) {
            Log::info("\124\x68\145\155\145\x20\151\156\163\164\x61\154\x6c\x61\x74\x69\x6f\x6e\40\x66\141\x69\154\145\x64\40" . $theme);
            Log::error(get_exception_message($exception));
            return back()->with("\145\162\162\x6f\x72", $exception->getMessage());
        }
        if (!$system->save()) {
            goto gthhs;
        }
        event(new SystemConfigUpdated($system));
        return back()->with("\163\x75\143\x63\145\163\163", trans("\155\x65\x73\163\x61\x67\x65\x73\56\164\x68\145\155\x65\x5f\x61\143\x74\151\166\x61\164\x65\x64", ["\x74\x68\145\x6d\145" => $theme]));
        gthhs:
        return back()->with("\145\x72\x72\x6f\x72", trans("\x6d\145\163\163\x61\147\145\163\x2e\x66\141\151\154\x65\144"));
    }
    private function storeFrontThemes($slug = null)
    {
        $storeFrontThemes = [];
        foreach (glob(theme_path("\x2a"), GLOB_ONLYDIR) as $themeFolder) {
            $themeFolder = realpath($themeFolder);
            if (!file_exists($jsonFilename = $themeFolder . "\x2f" . "\164\x68\145\155\x65\x2e\x6a\x73\157\156")) {
                goto vnYdG;
            }
            $folders = explode(DIRECTORY_SEPARATOR, $themeFolder);
            $themeName = end($folders);
            $data = [];
            $json = file_get_contents($jsonFilename);
            if (!($json !== '')) {
                goto Efz6n;
            }
            $data = json_decode($json, true);
            if (!($data === null)) {
                goto w3I78;
            }
            throw new \Exception("\x49\156\x76\x61\154\x69\144\40\164\x68\x65\155\x65\x2e\152\163\157\x6e\40\x66\151\154\145\40\141\164\x20\133{$themeFolder}\x5d");
            w3I78:
            if (!(!$data["\162\145\154\145\x61\163\145\x64"] && App::environment(["\x70\x72\x6f\144\x75\x63\164\151\157\x6e"]))) {
                goto iM5UO;
            }
            goto UgcPW;
            iM5UO:
            Efz6n:
            if (!($slug && $data["\x73\x6c\x75\147"] == $slug)) {
                goto uTFJ_;
            }
            $data["\x70\x61\164\150"] = $themeFolder;
            return $data;
            uTFJ_:
            $data["\x61\163\x73\145\164\x73\55\160\141\164\x68"] = theme_assets_path($data["\163\x6c\x75\x67"]);
            $data["\166\x69\145\167\x73\55\x70\x61\164\150"] = theme_views_path($data["\163\154\x75\147"]);
            $storeFrontThemes[] = $data;
            vnYdG:
            UgcPW:
        }
        oj_to:
        usort($storeFrontThemes, function ($x, $y) {
            return strnatcmp($x["\x6e\x61\155\x65"], $y["\156\x61\155\x65"]);
        });
        return $storeFrontThemes;
    }
    private function sellingThemes($slug = null)
    {
        $sellingThemes = [];
        foreach (glob(selling_theme_path("\52"), GLOB_ONLYDIR) as $themeFolder) {
            $themeFolder = realpath($themeFolder);
            if (!file_exists($jsonFilename = $themeFolder . "\x2f" . "\164\x68\x65\155\x65\x2e\x6a\163\157\156")) {
                goto BqKfr;
            }
            $folders = explode(DIRECTORY_SEPARATOR, $themeFolder);
            $themeName = end($folders);
            $data = [];
            $json = file_get_contents($jsonFilename);
            if (!($json !== '')) {
                goto eT1SV;
            }
            $data = json_decode($json, true);
            if (!($data === null)) {
                goto WA4yr;
            }
            throw new \Exception("\111\156\166\141\x6c\151\x64\x20\164\x68\x65\155\x65\x2e\x6a\163\157\156\40\146\x69\x6c\145\x20\x61\164\x20\x5b{$themeFolder}\x5d");
            WA4yr:
            eT1SV:
            if (!($slug && $data["\x73\x6c\x75\147"] == $slug)) {
                goto qbkAq;
            }
            $data["\x70\141\x74\150"] = $themeFolder;
            return $data;
            qbkAq:
            $data["\141\163\163\145\164\163\x2d\160\x61\x74\150"] = selling_theme_assets_path($data["\163\154\x75\147"]);
            $data["\166\151\x65\x77\163\x2d\160\141\x74\150"] = selling_theme_views_path($data["\x73\154\x75\147"]);
            $sellingThemes[] = $data;
            BqKfr:
            e80Lo:
        }
        mPQoB:
        usort($sellingThemes, function ($x, $y) {
            return strnatcmp($x["\x6e\x61\155\x65"], $y["\x6e\141\x6d\x65"]);
        });
        return $sellingThemes;
    }
}

Function Calls

None

Variables

None

Stats

MD5 37cad73420f93a4364f7b2916d14ab38
Eval Count 0
Decode Time 39 ms