[ Mini Kiebo ]
Server: Windows NT AKFAR_SERVER 10.0 build 26200 (Windows 10) AMD64
Path:
D:
/
xampp
/
htdocs
/
bem2
/
application
/
core
/
[
Home
]
File: MY_Controller.php
<?php defined('BASEPATH') or exit('No direct script access allowed'); class MY_Controller extends CI_Controller { /** * --------------------------------------------------------------------------------------------- * ...:::!!! =============================== VARIABLES =============================== !!!:::... * --------------------------------------------------------------------------------------------- */ /** * Variables */ public $viewFolder = ""; public $viewData = ""; /** * --------------------------------------------------------------------------------------------- * ...:::!!! =============================== VARIABLES =============================== !!!:::... * --------------------------------------------------------------------------------------------- */ public function __construct() { parent::__construct(); $lang = (!empty($this->uri->segment(1)) && mb_strlen($this->uri->segment(1)) == 2 ? $this->uri->segment(1) : null); if (empty(get_cookie("lang", true)) || !isset($_COOKIE["lang"])) : set_cookie("lang", "tr", strtotime("+1 Year")); $lang = "tr"; endif; if (empty($lang)) : $lang = (!empty(get_cookie("lang")) ? get_cookie("lang") : "tr"); endif; /** * Load Lang File */ if (file_exists(dirname(APPPATH, 1) . '/panel/application/language/' . $lang)) : $this->lang->load($lang, $lang, FALSE, TRUE, dirname(APPPATH, 1) . '/panel/application/'); if (empty($this->uri->segment(1))) : redirect(base_url()); endif; else : redirect(base_url("404")); endif; $this->viewData = new stdClass(); /** * Sitemap */ $this->viewData->page_urls = []; $this->viewData->lang = (!empty($this->uri->segment(1) && mb_strlen($this->uri->segment(1)) == 2) ? $this->uri->segment(1) : (!empty(get_cookie("lang")) ? get_cookie("lang") : "tr")); $this->viewData->settings = $this->general_model->get("settings", null, ["isActive" => 1, "lang" => $this->viewData->lang]); $allLanguages = $this->general_model->get_all("settings", null, "rank ASC", ["isActive" => 1]); $languages = []; if (!empty($allLanguages)) : foreach ($allLanguages as $key => $value) : array_push($languages, $value->lang); endforeach; endif; $locales = $this->general_model->get("languages", null, ["code" => strto("lower", $this->viewData->lang)]); setlocale(LC_ALL, $locales->code . "_" . (strto("lower|upper", $locales->code))); $currency = $this->general_model->get("countries", null, ["code" => strto("lower|upper", $this->viewData->lang)]); $this->viewData->currency = $currency->currency_code; $this->viewData->formatter = new NumberFormatter($locales->code, NumberFormatter::CURRENCY); $this->viewData->dateFormatter = new IntlDateFormatter($locales->code . "_" . (strto("lower|upper", ($locales->code == "en" ? "US" : $locales->code))), IntlDateFormatter::LONG, IntlDateFormatter::SHORT); $formattedValue = $this->viewData->formatter->formatCurrency(0, $this->viewData->currency); $this->viewData->symbol = trim(str_replace('0,00', '', str_replace('0.00', '', $formattedValue))); $this->viewData->menus = show_tree('HEADER', $this->viewData->lang); //$this->viewData->mobileMenus = show_tree('MOBILE', $this->viewData->lang); //$this->viewData->rightMenus = show_tree('HEADER_RIGHT', $this->viewData->lang); $this->viewData->footer_menus = show_tree('FOOTER', $this->viewData->lang); $this->viewData->footer_menus2 = show_tree('FOOTER2', $this->viewData->lang); $this->viewData->footer_menus3 = show_tree('FOOTER3', $this->viewData->lang); $this->viewData->footer_service_categories = $this->general_model->get_all("service_categories", null, null, ["isActive" => 1], [], [], [6]); $this->viewData->languages = $languages; /** * Home Items */ $this->viewData->homeitems = $this->general_model->get_all("home_items", null, "rank ASC", ["isActive" => 1, "type" => 1, "lang" => $this->viewData->lang]); /** * Get User Data */ $this->viewData->user = get_active_user() ?? []; /** * Pages */ $this->viewData->pages = $this->general_model->get_all("pages", null, "rank ASC", ["isActive" => 1]); $this->ci_minifier->set_domparser(2); $this->ci_minifier->init(1); } /** * ---------------------------------------------------------------------------------------------- * ...:::!!! ================================= RENDER ================================= !!!:::... * ---------------------------------------------------------------------------------------------- */ /** * Render */ public function render() { //$this->benchmark->mark('head_start'); $this->load->view("includes/head", (array)$this->viewData); //$this->benchmark->mark('head_end'); //$this->benchmark->mark('header_start'); $this->load->view("includes/header"); //$this->benchmark->mark('header_end'); //$this->benchmark->mark('content_start'); $this->load->view($this->viewFolder); //$this->benchmark->mark('content_end'); //$this->benchmark->mark('footer_start'); $this->load->view("includes/footer"); //$this->benchmark->mark('footer_end'); } /** * ----------------------------------------------------------------------------------------------- * ...:::!!! ================================= RENDER ================================== !!!:::... * ----------------------------------------------------------------------------------------------- */ /** * ----------------------------------------------------------------------------------------------- * ...:::!!! ================================== ERROR ================================== !!!:::... * ----------------------------------------------------------------------------------------------- */ /** * Error */ public function error() { $this->viewFolder = "404_v/index"; $this->render(); } /** * ----------------------------------------------------------------------------------------------- * ...:::!!! ================================== ERROR ================================== !!!:::... * ----------------------------------------------------------------------------------------------- */ }