# Core Classes

## CodePressCMS.php

Main CMS class in `cms/core/class/CodePressCMS.php`:

```php
$cms = new CodePressCMS($config);
$cms->renderPage($pagePath);
```

Key methods: `renderPage()`, `getMenu()`, `getPage()`, `parseMarkdown()`, `generateBreadcrumb()`, `getAvailableLanguages()`.

## ThemeManager.php

Theme management in `cms/core/class/ThemeManager.php`:

```php
$themeManager = new ThemeManager($config);
$themeManager->renderTwig($template, $data);
```

Compiles `assets/scss/theme.scss` at runtime to CSS and renders Twig templates.

## PluginManager.php

Plugin system in `cms/core/plugin/PluginManager.php`:

```php
$pluginManager = new PluginManager($pluginsPath, $enabledPlugins);
$pluginManager->setAPI($api);
$pluginManager->doAction('onPageLoad', $args);
$result = $pluginManager->applyFilters('onContentFilter', $content);
$pluginManager->getAdminMenuItems();
```

Key methods: `setAPI()`, `doAction()`, `applyFilters()`, `getPlugin()`, `getAllPlugins()`, `getEnabledPlugins()`, `isEnabled()`, `getSidebarContent()`, `getPluginCssUrls()`, `getAdminMenuItems()`, `dispatchAdminRoute()`, `resolveAdminRoute()`.

## CMSAPI.php

Front-end plugin API in `cms/core/plugin/CMSAPI.php`. Implements `PluginAPIInterface`. Provides access to the CMS instance for plugins in the front-end context.

```php
$api->getCurrentPageTitle();
$api->getMenu();
$api->getConfig('site_title');
$api->createUrl('about-us');
```

## AdminPluginAPI.php

Admin plugin API in `cms/core/plugin/AdminPluginAPI.php`. Implements `PluginAPIInterface`. Lightweight wrapper with config-only access (no CMS instance needed).

```php
$api->getConfig('analytics.enabled');
$api->getContentDir();
$api->getEnabledPlugins();
```

## AdminAuth.php

Authentication in `admin/src/AdminAuth.php`. Manages sessions, bcrypt passwords, CSRF tokens, brute-force lockout, and role-based permissions.

## LogManager.php

Logging system in `cms/core/class/LogManager.php`. Supports SQLite, syslog, and file-based logging. Events: admin, requests, errors, security, content, system.