private function saveTranslationFile($contents, MutableBag $tr)
    {
        $contents = Input::cleanPostedData($contents) . "\n";

        // Clear any warning for file not found, we are creating it here
        // we'll set an error if someone still submits the form and write is not allowed
        $this->flashes()->clear();

        $file = $this->filesystem()->getFile('bolt://' . $tr->get('shortPath'));
        try {
            $file->put($contents);
        } catch (IOException $e) {
            $msg = Trans::__('general.phrase.file-not-writable', ['%s' => $tr->get('shortPath')]);
            $this->flashes()->error($msg);
            $tr['writeallowed'] = false;

            return false;
        }

        $msg = Trans::__('page.file-management.message.save-success', ['%s' => $tr->get('shortPath')]);
        $this->flashes()->info($msg);

        return $this->redirectToRoute('translation', ['domain' => $tr->get('domain'), 'tr_locale' => $tr->get('locale')]);
    }
private function saveTranslationFile($contents, MutableBag $tr)
    {
        $contents = Input::cleanPostedData($contents) . "\n";

        // Clear any warning for file not found, we are creating it here
        // we'll set an error if someone still submits the form and write is not allowed
        $this->flashes()->clear();

        $file = $this->filesystem()->getFile('bolt://' . $tr->get('shortPath'));
        try {
            $file->put($contents);
        } catch (IOException $e) {
            $msg = Trans::__('general.phrase.file-not-writable', ['%s' => $tr->get('shortPath')]);
            $this->flashes()->error($msg);
            $tr['writeallowed'] = false;

            return false;
        }

        $msg = Trans::__('page.file-management.message.save-success', ['%s' => $tr->get('shortPath')]);
        $this->flashes()->info($msg);

        return $this->redirectToRoute('translation', ['domain' => $tr->get('domain'), 'tr_locale' => $tr->get('locale')]);
    }
private function saveTranslationFile ( $ contents , MutableBag $ tr ) { $ contents = Input :: cleanPostedData ( $ contents ) . "\n" ; // Clear any warning for file not found, we are creating it here // we'll set an error if someone still submits the form and write is not allowed $ this -> flashes ( ) -> clear ( ) ; $ file = $ this -> filesystem ( ) -> getFile ( 'bolt://' . $ tr -> get ( 'shortPath' ) ) ; try { $ file -> put ( $ contents ) ; } catch ( IOException $ e ) { $ msg = Trans :: __ ( 'general.phrase.file-not-writable' , [ '%s' => $ tr -> get ( 'shortPath' ) ] ) ; $ this -> flashes ( ) -> error ( $ msg ) ; $ tr [ 'writeallowed' ] = false ; return false ; } $ msg = Trans :: __ ( 'page.file-management.message.save-success' , [ '%s' => $ tr -> get ( 'shortPath' ) ] ) ; $ this -> flashes ( ) -> info ( $ msg ) ; return $ this -> redirectToRoute ( 'translation' , [ 'domain' => $ tr -> get ( 'domain' ) , 'tr_locale' => $ tr -> get ( 'locale' ) ] ) ; }
Attempt to save the POST data for a translation file edit.

@param string     $contents
@param MutableBag $tr

@return bool|\Symfony\Component\HttpFoundation\RedirectResponse
Attempt to save the POST data for a translation file edit .