This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] } | |
class system-update { | |
exec { 'apt-get update': | |
command => 'apt-get update', | |
} | |
$sysPackages = [ "build-essential" ] | |
package { $sysPackages: | |
ensure => "installed", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure("2") do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
config.vm.network :private_network, ip: "192.168.33.101" | |
config.vm.synced_folder "./", "/vagrant", id: "vagrant-root" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__.'/vendor/autoload.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
$app = new Silex\Application(); | |
$app['debug'] = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$app['twig']->addFilter(new Twig_SimpleFilter('truncate', function($string, $size) { | |
if(strlen($string) < $size) | |
return $string; | |
else | |
return array_shift(str_split($string, $size)) . "..."; | |
})); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locale_lang: Português | |
Welcome: Bem Vindo | |
msg_example: Esse é um exemplo de texto traduzido. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$app->get('/lang/{lang}', function($lang) use($app) { | |
/* | |
* check if language exists | |
*/ | |
if (is_dir(__DIR__ . '/locale/' . $lang)) { | |
/* save user selection in session */ | |
$app['session']->set('current_language', $lang); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$lang = "en"; | |
if ($app['session']->get('current_language')) { | |
$lang = $app['session']->get('current_language'); | |
} | |
foreach (glob(__DIR__ . '/locale/'. $lang . '/*.yml') as $locale) { | |
$app['translator']->addResource('yaml', $locale, $lang); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$app->register(new Silex\Provider\TranslationServiceProvider(), array( | |
'locale_fallback' => 'en', | |
)); | |
$app['translator'] = $app->share($app->extend('translator', function($translator, $app) { | |
$translator->addLoader('yaml', new YamlFileLoader()); | |
return $translator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require" : { | |
"silex/silex": "1.0.*@dev", | |
"twig/twig": ">=1.8,<2.0-dev", | |
"symfony/twig-bridge": "~2.1", | |
"symfony/config": "~2.1", | |
"symfony/yaml": "~2.1", | |
"symfony/translation": "~2.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* on config.php you put your initialization stuff, like session start and bd connection */ | |
require_once("includes/config.php"); | |
$uri = $_SERVER['REQUEST_URI']; | |
/* default is index */ | |
$pagina = "index"; | |
if($uri != "/") | |
{ |