Commit b9ba6302 authored by Administrator's avatar Administrator 💬

chore: clean up

parent 210cd2ec
<?php <?php /** @noinspection PhpUnused */
namespace Grav\Plugin; namespace Grav\Plugin;
use Exception;
use Grav\Common\Grav; use Grav\Common\Grav;
use Grav\Common\Page\Page; use Grav\Common\Page\Page;
use Grav\Common\Page\Pages; use Grav\Common\Page\Pages;
...@@ -9,6 +11,7 @@ use Grav\Common\Uri; ...@@ -9,6 +11,7 @@ use Grav\Common\Uri;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
/** /**
* Features: * Features:
* - /sync Cheap git-sync (did not knew about it at the time) * - /sync Cheap git-sync (did not knew about it at the time)
...@@ -169,19 +172,17 @@ class M3P2Plugin extends Plugin ...@@ -169,19 +172,17 @@ class M3P2Plugin extends Plugin
if ( ! $page) { if ( ! $page) {
try { try {
$page = $pages->get($path); $page = $pages->get($path);
} catch (\Exception $e) {} } catch (Exception $e) {}
} }
if ( ! $page) { if ( ! $page) {
try { try {
$cwd = $pages->root()->filePath(); // ends with / $cwd = $pages->root()->filePath(); // ends with /
if (0 === strpos($path, '/')) { if (0 === strpos($path, '/')) {
$page = $pages->get($cwd . substr($path, 1)); $page = $pages->get($cwd . substr($path, 1));
} else { } else {
$page = $pages->get($cwd . $path); $page = $pages->get($cwd . $path);
} }
// die($cwd . $path); } catch (Exception $e) {}
} catch (\Exception $e) {}
} }
return $page; return $page;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment