Commit b9ba6302 authored by Administrator's avatar Administrator 💬

chore: clean up

parent 210cd2ec
<?php
<?php /** @noinspection PhpUnused */
namespace Grav\Plugin;
use Exception;
use Grav\Common\Grav;
use Grav\Common\Page\Page;
use Grav\Common\Page\Pages;
......@@ -9,6 +11,7 @@ use Grav\Common\Uri;
use Symfony\Component\EventDispatcher\Event;
/**
* Features:
* - /sync Cheap git-sync (did not knew about it at the time)
......@@ -169,19 +172,17 @@ class M3P2Plugin extends Plugin
if ( ! $page) {
try {
$page = $pages->get($path);
} catch (\Exception $e) {}
} catch (Exception $e) {}
}
if ( ! $page) {
try {
$cwd = $pages->root()->filePath(); // ends with /
if (0 === strpos($path, '/')) {
$page = $pages->get($cwd . substr($path, 1));
} else {
$page = $pages->get($cwd . $path);
}
// die($cwd . $path);
} catch (\Exception $e) {}
} catch (Exception $e) {}
}
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