Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  *
  * @throws \RuntimeException If `m1/env` library is not installed or the file can not be parsed
  */
 public function load()
 {
     try {
         $this->content = Parser::parse(file_get_contents($this->entity));
     } catch (\Exception $e) {
         throw new \RuntimeException(sprintf("%s threw an exception: %s", $this->entity, $e));
     }
     return $this;
 }
Exemplo n.º 2
0
<?php

require_once 'vendor/autoload.php';
use M1\Env\Parser as EnvParser;
define('CONTACT_FORM', true);
if (!file_exists('.env')) {
    exit('.env file does not exists.');
}
$env = EnvParser::parse(file_get_contents('.env'));
if (file_exists('languages/' . $env['APP_LOCALE'] . '/messages.php')) {
    $messages = (require 'languages/' . $env['APP_LOCALE'] . '/messages.php');
} else {
    $messages = (require 'languages/' . $env['APP_LOCALE_FALLBACK'] . '/messages.php');
}
$cdn = 'https://cdnjs.cloudflare.com/ajax/libs';
$assets = ['scripts' => ['html5shiv' => $cdn . '/' . 'html5shiv/3.7.3/html5shiv.min.js', 'jquery' => $cdn . '/' . 'jquery/2.2.4/jquery.min.js', 'respond' => $cdn . '/' . 'respond.js/1.4.2/respond.min.js', 'toastr' => $cdn . '/' . 'toastr.js/2.1.2/toastr.min.js'], 'styles' => ['font-awesome' => $cdn . '/' . 'font-awesome/4.6.3/css/font-awesome.min.css', 'normalize' => $cdn . '/' . 'normalize/4.1.1/normalize.min.css', 'toastr' => $cdn . '/' . 'toastr.js/2.1.2/toastr.min.css']];
$scripts = $assets['scripts'];
$styles = $assets['styles'];
$frm_input_address = $messages['form']['input']['address'];
$frm_input_name = $messages['form']['input']['name'];
$frm_input_subject = $messages['form']['input']['subject'];
$frm_input_body = $messages['form']['input']['body'];
$msg_error = $messages['mail']['sent_error'];
$msg_success = $messages['mail']['sent_success'];
$viewport = 'initial-scale=1, maximum-sca' . 'le=1, user-scalable=no, widt' . 'h=device-width';
?>
<!DOCTYPE html>
<html>
    <head>
        <link href="//cdnjs.cloudflare.com" rel="dns-prefetch" />
        <link href="assets/images/favicon.ico" rel="shortcut icon" />
Exemplo n.º 3
0
Arquivo: Parser.php Projeto: m1/Env
 /**
  * Parses the .env and returns the contents statically
  *
  * @param string $content The content to parse
  *
  * @return array The .env contents
  */
 public static function parse($content)
 {
     $parser = new Parser($content);
     return $parser->getContent();
 }