Esempio n. 1
0
 public function refresh()
 {
     $path = Input::get('key');
     PressFacade::cache()->forget($path);
     try {
         $fileID = PressFacade::urlToID($path);
         // now redirect to the file corresponding to the key
         $document = PressFacade::findFile($fileID);
         $url = $document->url() . '?' . microtime(1);
         return Redirect::to($url, 302);
     } catch (\Exception $e) {
         // it's just not a file but a collection page
         return $this->redirectBack();
     }
 }
Esempio n. 2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function publish(Request $req)
 {
     try {
         // First we need to read the URL path. Then we match it with the url_map
         // in press conf
         $id = PressFacade::urlToID($req->path());
         $document = PressFacade::findFile($id);
         // if we are not at the exact document URL, we redirect
         if (\URL::to($req->path()) !== $document->url()) {
             return Redirect::to($document->url(), 301);
         }
         $layout = $document->meta()->get('layout');
         return \View::make($layout)->with('meta', $document->meta())->with('cacheInfo', PressFacade::editingCacheInfo())->with('themeAssets', PressFacade::getThemeAssets($document->meta()->theme))->with('content', $document->content());
     } catch (FileNotFoundException $e) {
         abort(404);
     }
 }