1. Go to this page and download the library: Download tendoo/cms library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
'ip-banner' => [
'enable' => true,
/**
* describe what is forbidden
* on each request processed
*/
'forbidden' => [
'.php',
],
/**
* if a client makes the same mistake
* "x" times, his ip will be banned
*/
'mistakes-threshold' => 1,
/**
* the ip of the client
* will be recorded
* on the mentionned htaccess file
*/
'htaccess-blocking' => false,
'htaccess-path' => ''
],
'flood' => [
'prevent' => false, // should be enabled
'limit' => 30,
'expiration' => 60
],
use Tendoo\Core\Models\Role;
$role = new Role;
$role->name = __( 'Super Man' );
$role->namespace = 'superman';
$role->description = ''; // whatever relevant to describe the role
$role->save();
use Tendoo\Core\Models\Permission;
// ...
$permission = new Permission;
$permission->name = __( 'Fly' );
$permission->namespace = 'fly';
$permission->description = ''; // once again whatever could be relevant.
$permission->save();
use Tendoo\Core\Models\Role;
// ...
Role::addPermissions( 'superman', 'fly' );
use Tendoo\Core\Models\User;
if ( User::allowedTo( 'snap.infinite.gaunglet' ) ) {
/// you're not strong enough
}
// let's register the event first
use Tendoo\Core\Facades\Hook;
//...
Hook::addFilter( 'public.forms', useThis( Event::class )->method( 'forms' ) );
// useThis() .. is a shorthand to write 'Modules\Events\Event@form'
namespace Modules\YourModule\Events;
class Event
{
public function forms( $forms, $namespace )
{
if ( $namespace === 'your-namespace' ) {
return [
'title' => __( 'Your Form Titlte' ),
'description' => '', // a description here
'sections' => [
{
'title' => '', // section title
'description' => '',
'fields' => [ // here to register as many field as the section has.
{
'label' => 'Field Name',
'name' => 'field-name',
'validation' => '