Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeffsee55/leads
https://github.com/jeffsee55/leads
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jeffsee55/leads
- Owner: jeffsee55
- Created: 2017-02-01T14:28:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-01T14:30:56.000Z (almost 8 years ago)
- Last Synced: 2024-10-04T19:44:29.710Z (about 1 month ago)
- Language: PHP
- Size: 288 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Heidi-Plugin
___
Heidi-Plugin is a Wordpress plugin framework with the idea that every piece of code should have a home. Heidi takes an opinionated approach about how your hooks should be organized & delegated. Heidi relies extensively on the Wordpress hooks API, mimicking an MVC framework to compute, delegate, and render plugin functionality.
>Please note: This is not an MVC framework. There is no concept of REST, it is merely a structure that flows in a similar fashion.### Routing
Every action hook is registered in the `plugin/routes.php` fileIn `plugin/routes.php`
```php
$router->register([
'admin_menu' => [
'AdminController@registerSettingsPage'
]
]);
```### Controllers
Wordpress will now look for a class called `AdminController` which should provide the `registerSettingsPage()` function.In `plugin/Contollers/AdminController.php`
```php
namespace Heidi\Plugin\Controllers;use Heidi\Plugin\Callbacks\AdminView;
class AdminController
{
function registerSettingsPage()
{
add_menu_page(
'Special Settings',
'Special Settings',
'manage_options',
'special-settings',
[new AdminView, 'render']
);
}
}
```### Callback handlers
After defining the callback in the controller, Wordpress will now look for an `AdminView` class with the `render` function.In `plugin/Callbacks/AdminView.php`
```php
namespace Heidi\Plugin\Callbacks;class AdminView
{
public function render()
{
$welcomeMessage = 'Hello, world!';
view('admin.admin_settings', compact('welcomeMessage'));
}
}
```### Blade view templating
Finally, the view can be rendered with the Blade templating engineIn `plugin/view/admin/admin_settings.php`
```blade
@extends('admin.admin_layout')
@section('content')
{{ $welcomeMessage }}
@endsection
```## Contributing
Thank you for considering contributing to the Heidi framework! The contribution guide can be found in the [Heidi documentation](http://q4vr.com/docs/contributions).
## Security Vulnerabilities
If you discover a security vulnerability within Heidi, please send an e-mail to Jeff See at [email protected]. All security vulnerabilities will be promptly addressed.
## License
The Heidi framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).