public static function startTheApplicationVariables() { $branch = trim($_SERVER['REQUEST_URI'], '/'); $countScriptName = String::countExplode('/', $_SERVER['SCRIPT_NAME']); $ServerName = "{$_SERVER['SERVER_NAME']}/"; if ($countScriptName > 2) { $scriptFileName = substr($_SERVER['SCRIPT_NAME'], 1, strlen($_SERVER['SCRIPT_NAME']) - 10); $ServerName .= $scriptFileName; $branch = trim(str_replace($scriptFileName, '', $_SERVER['REQUEST_URI']), '/'); } $branch = String::getFirstExplodeString('.', $branch); $branch = String::getFirstExplodeString('?', $branch); self::setBranch($branch); ## self::setBase(Url::addHttpIntoUrl($ServerName)); self::setUrl(self::getBase(self::getBranch())); self::setMethod(strtolower($_SERVER['REQUEST_METHOD'])); self::setUri(str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME'])); ## Dir::setVendor(self::getUri('vendor/')); Dir::setCore(self::getUri('vendor/tadeubarbosa/teed-php-frame/core/')); foreach (Files::getData('src/data/globals.php', true)['paths'] as $type => $path) { $pathname = $type == 'src' ? self::getUri() : self::getBase(); Dir::$data[$type] = "{$pathname}{$type}/"; foreach ($path as $name => $value) { if (!preg_match('/(\\/$)/', $value)) { $value .= '/'; } Dir::$data[$name] = "{$pathname}{$value}"; } } }
public function getFileRobots() { $file = DIR . '/' . PATH . 'robots.txt'; if (!file_exists($file)) { file_put_contents($file); } return Files::getData($file); }
public static function renderFile($file) { $string = Files::getFile($file); $variables = Files::getData(Dir::getCore('Engine/Variables.php'), true); foreach ($variables as $value) { $value = (array) $value; $value[0] = str_replace(['(', ')'], ['\\(', '\\)'], $value[0]); $value[0] = str_replace(['*'], ['(.*)'], $value[0]); $value[0] = "/({$value[0]})/" . (isset($value[2]) ? '' : 'U'); $string = preg_replace($value[0], $value[1], $string); } return $string; }
public function getFileCSS($fileCss) { $path = DIR . '/' . PATH . 'app/css/'; return Files::getData($path . $fileCss); }
# Configura as datas setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese'); date_default_timezone_set('America/Sao_Paulo'); Carbon\CarbonInterval::setLocale('pt_BR'); ## # Configura os dados do Input Input::configureInputData(); ## # Inicia as variaveis da aplicação App::startTheApplicationVariables(); ## # Adiciona as informações do arquivo a class `site` Site::all(Files::getData('website.php')); ## # Busca pelo enviromet e seta-o foreach (Files::getData('enviroment.php') as $name => $value) { $match = str_replace('*', '(.*)', $value->match); # Busca pelo host atual if (preg_match("/{$match}/", $_SERVER['HTTP_HOST'])) { $value->name = $name; App::setEnv($value); break; } } ## # Busca pelas configuraçoes das Rotas: id, name etc require_once Dir::getCore('Routers/configurations.php'); # Busca pelas rotas setadas pelo programador require_once Dir::getSrc('routes.php'); # Inicializa o TeedCss TeedCss\Initialize::start();