This commit is contained in:
Joey Kimsey
2024-12-24 22:15:01 -05:00
parent f8e75e847d
commit 900ca8a691
110 changed files with 1065 additions and 113 deletions

View File

@ -18,6 +18,7 @@ use TheTempusProject\Models\Bookmarks as Bookmark;
use TheTempusProject\Models\Folders;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Houdini\Classes\Template;
use TheTempusProject\TheTempusProject as App;
class Bookmarks extends Plugin {
public $pluginName = 'TP Bookmarks';
@ -43,11 +44,22 @@ class Bookmarks extends Plugin {
'url' => '{ROOT_URL}bookmarks/index',
'filter' => 'loggedin',
],
[
'text' => 'Tutorials',
'url' => '{ROOT_URL}bookmarks/tutorials',
'filter' => 'bkmtuts',
],
[
'text' => 'Extensions',
'url' => '{ROOT_URL}extensions/index',
],
];
public $info_footer_links = [
[
'text' => 'Tutorials',
'url' => '{ROOT_URL}bookmarks/tutorials',
],
];
public $configMatrix = [
'enabled' => [
'type' => 'radio',
@ -96,9 +108,12 @@ class Bookmarks extends Plugin {
'type' => 'checkbox',
'default' => 'true',
],
'bookmarkTutorials' => [
'pretty' => 'Show tutorials for the bookmark feature',
'type' => 'checkbox',
'default' => 'true',
],
];
public $resourceMatrix = [
'routes' => [
[
@ -134,17 +149,32 @@ class Bookmarks extends Plugin {
]
];
public $bookmarks;
public $folders;
protected static $loaded = false;
public function __construct( $load = false ) {
$this->bookmarks = new Bookmark;
$this->folders = new Folders;
if ( ! self::$loaded && $load ) {
$tutpref = true;
if ( App::$isLoggedIn ) {
if ( empty( App::$activeUser->prefs['bookmarkTutorials'] ) ) {
$tutpref = false;
}
}
$this->filters[] = [
'name' => 'bkmtuts',
'find' => '#{BKMTUTS}(.*?){/BKMTUTS}#is',
'replace' => ( $tutpref ? '$1' : '' ),
'enabled' => true,
];
}
parent::__construct( $load );
if ( ! self::$loaded && $load ) {
self::$loaded = true;
}
}
}