public function setUp() { $files = \Fuel\Core\File::read_dir(APPPATH . 'tests/files', 1); foreach ($files as $file => $val) { \Fuel\Core\File::delete_dir(APPPATH . 'tests/files' . DS . $file); } $this->pass = Model_Pass::forge(array('name' => 'test name', 'description' => 'desc', 'logo_text' => 'sample', 'barcode_message' => 'message', 'barcode_format' => 0, 'foreground_color' => 'rgb(0,0,0)', 'background_color' => 'rgb(1,1,1)', 'label_color' => 'rgb(2,2,2)')); $this->pass->save(); \Fuel\Core\Config::set('pass.files_dir', APPPATH . 'tests/files'); $this->path = \Fuel\Core\Config::get('pass.files_dir'); \Fuel\Core\Config::set('pass.pkpasses_dir', APPPATH . 'tests/passes'); }
public function setUp() { $files = \Fuel\Core\File::read_dir(APPPATH . 'tests/files', 1); foreach ($files as $file => $val) { \Fuel\Core\File::delete_dir(APPPATH . 'tests/files' . DS . $file); } $this->pass = Model_Pass::forge(array('name' => 'test name', 'description' => 'desc', 'logo_text' => 'sample', 'barcode_message' => 'message', 'barcode_format' => 0, 'offer_label' => 'samaplelabel', 'offer_value' => 'samplevalue')); $this->pass->save(); \Fuel\Core\Config::set('pass.files_dir', APPPATH . 'tests/files'); $this->path = \Fuel\Core\Config::get('pass.files_dir'); $this->manager = new Pass_File_Manager($this->pass); \Fuel\Core\File::copy(APPPATH . 'tests/certificate.p12', $this->manager->file_path('certificate.p12')); }
public function detect_language() { if (!count($this->segments)) { return false; } $first = $this->segments[0]; $locales = Config::get('locales'); if (array_key_exists($first, $locales)) { array_shift($this->segments); $this->uri = implode('/', $this->segments); Config::set('language', $first); Config::set('locale', $locales[$first]); } }
public function __construct($request) { parent::__construct($request); // Using Native PHP Session. If there's ANY problem with those sessions (bug, security breach, etc), see Sébastien Juroszek. session_start(); // Taking the lang frm the URL and removing it from the URL $this->lang = $request->method_params[0]; unset($request->route->segments[2]); $request->route->segments = array_values($request->route->segments); unset($request->route->method_params[0]); $request->route->method_params = array_values($request->route->method_params); unset($request->method_params[0]); $request->method_params = array_values($request->method_params); // Setting the current language if (Lang::get_lang() != $this->lang) { Config::set("language", $this->lang); } }