/** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Model.php **/ $origin ]; if( $column ) return Model::getAllValue( $where, $column ); return Model::getAll( $where ); } public static function generate( string $hashid ) { if( !$id = static::resolveHashID( $hashid ) ) return FALSE; if( !$domain = static::get( $id ) ) return FALSE; $domain->generate(); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Domains/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Domains\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => Controller::getRoute(), "label" => Controller::getPlural(), "icon" => Controller::getIcon(), "menu" => "websites", ]; return $routes; }, 50 ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Domains/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Domains\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Domain", "Domains" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::Link45deg )] #[PHP\Attributes\Controller\Route( "domains", Websites\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Websites\Domains\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /websites/domains * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /websites/{origin}/domains * @route.description Listet alle Logeinträge */ public static function getByOriginPrepared( string $origin ) : array { return parent::getByOriginPrepared( $origin ); } /** * @api * @method GET * * @route.path /websites/domains/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /websites/domains/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /websites/domains * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /websites/domains/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/domains/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/domains/{hashid}/generate * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function generate( string $hashid ) : HTTP\Response { Websites\Domains\Model::generate( $hashid ); header("Content-Type: application/json"); header("Cache-Control: no-cache"); header("X-Accel-Buffering: no"); for ($i = 0; $i <= 100; $i += 10) { $data = [ 'value' => $i, // 'color' => $i < 50 ? '#f00' : ($i < 100 ? '#ff0' : '#0f0'), 'label' => "Fortschritt: $i%" ]; echo json_encode($data) . "\n"; ob_flush(); flush(); } exit; } /** * @api * @method GET * * @route.path /websites/domains/{hashid}/generate * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function generateGET( string $hashid ) : HTTP\Response { Websites\Domains\Model::generate( $hashid ); exit; } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /websites/domains * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/websites/domains/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /websites/domains/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/websites/domains" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /websites/domains/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /websites/domains/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", static::getSingular( "%t bearbeiten" ) ) ->setSize( "equal" ) ->setWidth( "lg" ) ->get() ->setApi( "/websites/domains/{$hashid}" ) ->setAction( "/websites/domains/{$hashid}", "PUT" ) ->addTab( static::getSingular() )->get() ->addChildren( static::restConfigInputs() ) ->parent() // ->addCallable( [ Calendars\Entries\API\v1\Controller::class, "restConfigTab" ], $hashid ) // ->addCallable( [ Calendars\Tasks\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /websites/domains/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /websites/{origin}/domains/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreateByOriginPrepared( bool | string $origin = FALSE ) : REST\Generator\Base\BaseGenerator { return parent::restConfigCreateByOriginPrepared( $origin ); } /** * @internal rest * @method GET * * @route.path /websites/domains/{hashid}/directory * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDirectory( string $hashid ) : REST\Generator\Base\BaseGenerator { // show( $hashid ); return REST\Response::addModal( "details", static::getSingular( "%t bearbeiten" ) ) ->get() // ->setApi( "/websites/domains/{$hashid}" ) ->setAction( "/websites/domains/{$hashid}/directory", "PATCH" ) ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "websites/domains" )) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], NULL, "websites/domains" )) ; } /** * @internal rest * @method GET * * @route.path /websites/domains/{hashid}/generate * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigGenerate( string $hashid ) : REST\Generator\Base\BaseGenerator { // show( $hashid ); return REST\Response::addModal( "details", Websites\API\v1\Controller::getSingular( "%t erstellen" ) ) ->get() // ->setApi( "/websites/domains/{$hashid}" ) ->setAction( "/websites/domains/{$hashid}/directory", "PATCH" ) ->addField(...Hooks::filter( "rest.generator::control.type->progress", [ "api" => [ "route" => static::getRoute( $hashid, "generate" ), "method" => "PATCH", ], ], "domain", TRUE, "websites/domains" )) // ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "websites/domains" )) // ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], NULL, "websites/domains" )) ; } /** * @internal rest * @method GET * * @route.path /websites/domains/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTab( REST\Generator\Base\BaseGenerator $rest, null|string $hashid = NULL ) : void { parent::restConfigTabPrepared( $rest, $hashid ); } public static function restConfigTable( null|string $hashid = NULL ) : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( static::getRoute( "1:{$hashid}" ) ) ->setAction( static::getRoute( "{hashid}" ) ) ->setOrder( "title", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/domains" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [ "options" => Websites\Domains\Status::getAll(), ], "status", [], "websites/domains", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "url", TRUE, TRUE, TRUE, "websites/domains" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "target_dir", TRUE, TRUE, TRUE, "websites/domains" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "connection.host", TRUE, TRUE, TRUE, "websites/domains" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", TRUE, FALSE, TRUE, "websites/domains" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "websites/domains" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "websites/domains", "hashid" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "websites/domains", "hashid" )) ->addButton(...Hooks::filter( "rest.generator::action.name->default", [ "label" => Websites\API\v1\Controller::getSingular( "%t erstellen" ), "action" => static::getRoute( "{hashid}", "generate" ), "icon" => REST\Generator\Config\Icon::Gear, "color" => REST\Generator\Config\Color::Warning, ], "websites/domains", "hashid" )) ->addButton(...Hooks::filter( "rest.generator::action.name->link", [ "action" => "{url}", ], "websites/domains", "hashid" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "domain", TRUE, "websites/domains" )) ->addField(...Hooks::filter( "rest.generator::control.type->select", [ "label" => Websites\Connections\API\v1\Controller::getSingular(), "options" => Websites\Connections\Model::getAsOptions( "name" ), ], "connection_id", TRUE, TRUE, "websites/domains" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [ // "action" => static::getRoute( "{hashid}", "directory" ) ], "target_dir", TRUE, "websites/domains" )) ; return $rest->top()->getChildren(); } public static function restConfigOrigin( bool|string $origin ) : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Form::create(); if( $origin === FALSE ) { return $rest->addField(...Hooks::filter( "rest.generator::control.type->select", [ "label" => Websites\API\v1\Controller::getSingular(), "options" => Websites\Model::getAsOptions( "title" ), ], "origin_id", TRUE, FALSE, "websites/domains" )); } $origin_id = Websites\Model::getValue( $origin, "id" ); return $rest->addField(...Hooks::filter( "rest.generator::control.type->hidden", [], "origin_id", $origin_id ?? $origin, "websites/domains" )); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Domains/Entity.php **/ origin_id ); } public function getUrl() : string { return "https://{$this->domain}"; } public function getConnection() : Websites\Connections\Entity { return Websites\Connections\Model::get( $this->connection_id ); } public function checkConnection() : bool|Websites\Connections\Status { $status = Status::NoConnection; if( $connection = $this->getConnection() ) { $status = $connection->check(); if( $status->getValue() == Websites\Connections\Status::Inactive ) { $status = Status::NoConnection; } } $this->status = new Status( $status ); return $this->status == Websites\Connections\Status::Active; } public function generate() { if( $this->status->value != Status::Active || !( $website = $this->origin ) || !( $connection = $this->connection ) ) return FALSE; // $website->generate(); show("STOP"); $ftp = $connection->connect(); if( !$ftp instanceof Connection ) return FALSE; if( ftp_nlist( $ftp, $this->target_dir ) ) { ftp_rmdir_recursive( $ftp, $this->target_dir ); } if( !ftp_mkdir( $ftp, $this->target_dir ) ) return FALSE; $root = $website->generate(); $dirs = glob_recursive( "{$root}/*", GLOB_ONLYDIR ); $dirs = array_map( fn( $dir ) => str_replace( $root, $this->target_dir, $dir ), $dirs ); $files = glob_recursive( "{$root}/*.*" ); $files = array_map( fn( $file ) => [ "from" => $file, "to" => str_replace( $root, $this->target_dir, $file ) ], $files ); if( file_exists( "{$root}/.htaccess" ) ) { $files[] = [ "from" => "{$root}/.htaccess", "to" => "{$this->target_dir}/.htaccess", ]; } // show( $files ); foreach( $dirs as $dir ) { if( !ftp_nlist( $ftp, $dir ) ) { ftp_mkdir( $ftp, $dir ); } } foreach( $files as $file ) { ftp_put( $ftp, $file["to"], $file["from"] ); } show( $root, $dirs, $files ); } /* ### MAGIC FUNCTIONS ########################################## # */ public function __construct() { $this->checkConnection(); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Domains/Status.php **/ $origin, ], $where ); if( $column ) return Model::getAllValue( $where, $column ); return Model::getAll( $where ); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Redirects/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Redirects\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => Controller::getRoute(), "label" => Controller::getPlural(), "icon" => Controller::getIcon(), "menu" => "websites", ]; return $routes; }, 50 ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Redirects/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Redirects\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Weiterleitung", "Weiterleitungen" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::ArrowRepeat )] #[PHP\Attributes\Controller\Route( "redirects", Websites\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Websites\Redirects\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /websites/redirects * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /websites/redirects/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /websites/redirects/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /websites/redirects * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /websites/redirects/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/redirects/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /websites/redirects * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/websites/redirects/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /websites/redirects/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/websites/redirects" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /websites/redirects/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /websites/redirects * @route.description REST-Konfiguration für Logbuch-Tabelle */ public static function restConfigOverview() : REST\Generator\Base\BaseGenerator { $tabs = REST\Response::addWrapper( "details", static::getPlural() )->get(); $tabs = $tabs->addTab( "Übersicht", FALSE )->get() ->setIcon( static::getIcon() ) ->addHeadline( static::getPlural(), 2 ) ->addContent( static::restConfigTable() ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/redirects" )) ) ->parent(); $tabs = $tabs->addTab( Websites\Redirects\API\v1\Controller::getPlural(), "categories" )->get() ->setIcon( Websites\Redirects\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Redirects\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Redirects\API\v1\Controller::restConfigTable() ) ->parent(); // $tabs = $tabs->addTab( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), "templates" )->get() // ->setIcon( Calendars\Tasks\Templates\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), 2 ) // ->addContent( // Calendars\Tasks\Templates\API\v1\Controller::restConfigTable() // ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/tasks/templates" )) // ) // ->parent(); // $tabs = $tabs->addTab( Calendars\Entries\API\v1\Controller::getPlural(), "appointments" )->get() // ->setIcon( Calendars\Entries\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Entries\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Entries\API\v1\Controller::restConfigTable() ) // ->parent(); // // $tabs = $tabs->addTab( Calendars\Tasks\API\v1\Controller::getPlural(), "tasks" )->get() // ->setIcon( Calendars\Tasks\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Tasks\API\v1\Controller::restConfigTable() ) // ->parent(); return $tabs; } /** * @internal rest * @method GET * * @route.path /websites/redirects/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "details", static::getSingular( "%t bearbeiten" ) ) ->setBacklink( "/websites/redirects" ) ->get() ->setApi( "/websites/redirects/{$hashid}" ) ->setAction( "/websites/redirects/{$hashid}", "PUT" ) ->addTab( "Kalender" )->get() ->addHeadline( "Kalender", 2 ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", FALSE, "websites/redirects" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites/redirects" )) ->parent() // ->addCallable( [ Calendars\Entries\API\v1\Controller::class, "restConfigTab" ], $hashid ) // ->addCallable( [ Calendars\Tasks\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /websites/redirects/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /websites/redirects/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( "/websites/redirects" ) ->setAction( "/websites/redirects/{hashid}" ) ->setOrder( "title", "asc" ) ->setSearch( TRUE ) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], "websites/redirects", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "status_code", TRUE, TRUE, TRUE, "websites/redirects" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "source_url", TRUE, TRUE, TRUE, "websites/redirects" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "target_url", TRUE, TRUE, TRUE, "websites/redirects" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", TRUE, FALSE, TRUE, "websites/redirects" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "target_hid", TRUE, "websites/redirects" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "websites/redirects" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites/redirects" )) ; return $rest->top()->getChildren(); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Redirects/Entity.php **/ Attribute\Status::class, "newtab" => Attribute\Status::class, "date_create" => Attribute\DateTime::class, "date_edit" => Attribute\DateTime::class, "hierarchy" => "hierarchy", "page_title" => "page->title", "label_hierarchic" => "hierarchicalLabel", "url" => "url", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function toggleStatus( bool $save = FALSE ) { $this->status->toggle(); if( $save ) $this->save(); } public function toggleNewTab( bool $save = FALSE ) { $this->newtab->toggle(); if( $save ) $this->save(); } public function getParent() { if( $this->parent_id ) { return Model::get( $this->parent_id ); } return NULL; } public function getPage() { if( $this->page_id ) { return Websites\Pages\Model::get( $this->page_id ); } return NULL; } public function getLevel() { return count( explode( ".", $this->hierarchy ) ); } public function getHierarchicalLabel( ?int $start = NULL ) { $start = $start ?? $this->startLevel ?? 3; $label = NULL; $level = count( explode( ".", $this->hierarchy ) ); if( $level > $start ) { for( $x = ++$start; $x <= $level; $x++ ) { $label .= "|   "; } $label .= "|_ "; } return $label . $this->label; } public function getHierarchy() { $hierarchy = []; if( $this->parent_id ) { $hierarchy = explode( ".", $this->parent->hierarchy ); } $hierarchy[] = str_pad( $this->parent_id, 3, 0, STR_PAD_LEFT ); $hierarchy[] = str_pad( $this->id, 3, 0, STR_PAD_LEFT ); $hierarchy = array_unique( $hierarchy ); $hierarchy = implode( ".", $hierarchy ); return $hierarchy; } public function getUrl() { if( !$this->permalink ) return NULL; $permalink = []; if( $this->parent ) { $permalink[] = $this->parent->url() ?? NULL; } $permalink[] = $this->permalink ?? NULL; $permalink = implode( "/", $permalink ); $permalink = explode( "/", $permalink ); $permalink = array_filter( $permalink ); $permalink = implode( "/", $permalink ); return "/{$permalink}"; } public function getItems( int $start = 2 ) { $items = static::$MODELCLASS::getAll([ "parent_id" => $this->id, ]); foreach( $items as $item ) { $item->startLevel = $start; $items = array_merge( $items, $item->getItems( $start ) ); } return $items; } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => Controller::getRoute(), "label" => Controller::getPlural(), "icon" => Controller::getIcon(), "menu" => "content", ]; return $routes; }, 50 ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Webseite", "Webseiten" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::Globe2 )] #[PHP\Attributes\Controller\Route( "websites" )] #[PHP\Attributes\Database\Definitions\Model( Websites\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /websites * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /websites/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /websites/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /websites * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /websites/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /websites * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/websites/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /websites/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/websites" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /websites/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /websites * @route.description REST-Konfiguration für Logbuch-Tabelle */ public static function restConfigOverview() : REST\Generator\Base\BaseGenerator { $tabs = REST\Response::addWrapper( "details", static::getPlural() )->get(); $tabs = $tabs->addTab( "Übersicht", FALSE )->get() ->setIcon( static::getIcon() ) ->addHeadline( static::getPlural(), 2 ) ->addContent( static::restConfigTable() ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites" )) ) ->parent(); $tabs = $tabs->addTab( Websites\Menus\API\v1\Controller::getPlural(), "menus" )->get() ->setIcon( Websites\Menus\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Menus\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Menus\API\v1\Controller::restConfigTable() ) ->parent(); $tabs = $tabs->addTab( Websites\Pages\API\v1\Controller::getPlural(), "pages" )->get() ->setIcon( Websites\Pages\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Pages\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Pages\API\v1\Controller::restConfigTable() ) ->parent(); $tabs = $tabs->addTab( Websites\Themes\API\v1\Controller::getPlural(), "themes" )->get() ->setIcon( Websites\Themes\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Themes\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Themes\API\v1\Controller::restConfigTable() ) ->parent(); $tabs = $tabs->addTab( Websites\Connections\API\v1\Controller::getPlural(), "connections" )->get() ->setIcon( Websites\Connections\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Connections\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Connections\API\v1\Controller::restConfigTable() ) ->parent(); $tabs = $tabs->addTab( Websites\Domains\API\v1\Controller::getPlural(), "domains" )->get() ->setIcon( Websites\Domains\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Domains\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Domains\API\v1\Controller::restConfigTable() ) ->parent(); $tabs = $tabs->addTab( Websites\Redirects\API\v1\Controller::getPlural(), "redirects" )->get() ->setIcon( Websites\Redirects\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Redirects\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Redirects\API\v1\Controller::restConfigTable() ) ->parent(); return $tabs; } /** * @internal rest * @method GET * * @route.path /websites/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "details", static::getSingular( "%t bearbeiten" ) ) ->setBacklink( static::getRoute() ) ->get() ->setApi( static::getRoute( $hashid ) ) ->setAction( static::getRoute( $hashid ), "PUT" ) ->addTab( static::getSingular() )->get() ->addHeadline( static::getSingular(), 2 ) // ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", FALSE, "websites" )) // ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites" )) ->addChildren( static::restConfigInputs( $hashid ) ) ->parent() ->addCallable( [ Websites\Domains\API\v1\Controller::class, "restConfigTab" ], $hashid ) // ->addCallable( [ Calendars\Tasks\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /websites/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /websites/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( "/websites" ) ->setAction( "/websites/{hashid}" ) ->setOrder( "title", "asc" ) ->setSearch( TRUE ) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], "websites", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "title", TRUE, TRUE, TRUE, "websites" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [ "label" => "Startseite", ], "page.title", TRUE, FALSE, TRUE, "websites" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [ "label" => "Theme", ], "theme.name", TRUE, FALSE, TRUE, "websites" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "description", TRUE, TRUE, TRUE, "websites" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", TRUE, FALSE, TRUE, "websites" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "websites" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites" )) ; return $rest->top()->getChildren(); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Menus/Model.php **/ items; // $level = ++$current->level; // } // // $results = array_sort_column( $results, "hierarchy" ); // // foreach( $results as $item ) { // if( in_array( $item->parent_id, $parents ) ) { // $parents[] = $item->id; // } // // $options[] = [ // "value" => $item->id, // "label" => html_entity_decode( $item->getHierarchicalLabel( $level ) ), // "disabled" => in_array( $item->id, $parents ), // ]; // } // // return $options; // } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Menus/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Menus\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => Controller::getRoute(), "label" => Controller::getPlural(), "icon" => Controller::getIcon(), "menu" => "websites", ]; return $routes; }, 50 ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Menus/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Menus\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Menü", "Menüs" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::ListUl )] #[PHP\Attributes\Controller\Route( "menus", Websites\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Websites\Menus\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /websites/menus * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /websites/menus/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /websites/menus/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /websites/menus * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /websites/menus/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/menus/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /websites/menus * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/websites/menus/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /websites/menus/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/websites/menus" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /websites/menus/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /websites/menus * @route.description REST-Konfiguration für Logbuch-Tabelle */ public static function restConfigOverview() : REST\Generator\Base\BaseGenerator { $tabs = REST\Response::addWrapper( "details", static::getPlural() )->get(); $tabs = $tabs->addTab( "Übersicht", FALSE )->get() ->setIcon( static::getIcon() ) ->addHeadline( static::getPlural(), 2 ) ->addContent( static::restConfigTable() ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/menus" )) ) ->parent(); $tabs = $tabs->addTab( Websites\Menus\API\v1\Controller::getPlural(), "categories" )->get() ->setIcon( Websites\Menus\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Menus\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Menus\API\v1\Controller::restConfigTable() ) ->parent(); // $tabs = $tabs->addTab( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), "templates" )->get() // ->setIcon( Calendars\Tasks\Templates\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), 2 ) // ->addContent( // Calendars\Tasks\Templates\API\v1\Controller::restConfigTable() // ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/tasks/templates" )) // ) // ->parent(); // $tabs = $tabs->addTab( Calendars\Entries\API\v1\Controller::getPlural(), "appointments" )->get() // ->setIcon( Calendars\Entries\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Entries\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Entries\API\v1\Controller::restConfigTable() ) // ->parent(); // // $tabs = $tabs->addTab( Calendars\Tasks\API\v1\Controller::getPlural(), "tasks" )->get() // ->setIcon( Calendars\Tasks\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Tasks\API\v1\Controller::restConfigTable() ) // ->parent(); return $tabs; } /** * @internal rest * @method GET * * @route.path /websites/menus/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "details", static::getSingular( "%t bearbeiten" ) ) ->setBacklink( "/websites/menus" ) ->get() ->setApi( "/websites/menus/{$hashid}" ) ->setAction( "/websites/menus/{$hashid}", "PUT" ) ->addTab( "Kalender" )->get() ->addHeadline( "Kalender", 2 ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", FALSE, "websites/menus" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites/menus" )) ->parent() // ->addCallable( [ Calendars\Entries\API\v1\Controller::class, "restConfigTab" ], $hashid ) // ->addCallable( [ Calendars\Tasks\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /websites/menus/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /websites/menus/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( "/websites/menus" ) ->setAction( "/websites/menus/{hashid}" ) ->setOrder( "title", "asc" ) ->setSearch( TRUE ) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], "websites/menus", "hashid" )) // ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ // "label" => FALSE, // "title" => Calendars\Entries\API\v1\Controller::getPlural(), // "icon" => Calendars\Entries\API\v1\Controller::getIcon(), // ], "entries.status.0", TRUE, FALSE, TRUE, "websites/menus" )) // // ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ // "label" => FALSE, // "title" => Calendars\Tasks\API\v1\Controller::getPlural(), // "icon" => "bi-clipboard-check", // ], "tasks.status.0", TRUE, FALSE, TRUE, "websites/menus" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "title", TRUE, TRUE, TRUE, "websites/menus" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "target.name", TRUE, TRUE, TRUE, "websites/menus" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "description", TRUE, TRUE, TRUE, "websites/menus" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_create", TRUE, FALSE, TRUE, "websites/menus" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "target_hid", TRUE, "websites/menus" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "websites/menus" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites/menus" )) ; return $rest->top()->getChildren(); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Menus/Entity.php **/ Attribute\Status::class, "newtab" => Attribute\Status::class, "date_create" => Attribute\DateTime::class, "date_edit" => Attribute\DateTime::class, "hierarchy" => "hierarchy", "page_title" => "page->title", "label_hierarchic" => "hierarchicalLabel", "url" => "url", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function toggleStatus( bool $save = FALSE ) { $this->status->toggle(); if( $save ) $this->save(); } public function toggleNewTab( bool $save = FALSE ) { $this->newtab->toggle(); if( $save ) $this->save(); } public function getParent() { if( $this->parent_id ) { return Model::get( $this->parent_id ); } return NULL; } public function getPage() { if( $this->page_id ) { return Websites\Pages\Model::get( $this->page_id ); } return NULL; } public function getLevel() { return count( explode( ".", $this->hierarchy ) ); } public function getHierarchicalLabel( ?int $start = NULL ) { $start = $start ?? $this->startLevel ?? 3; $label = NULL; $level = count( explode( ".", $this->hierarchy ) ); if( $level > $start ) { for( $x = ++$start; $x <= $level; $x++ ) { $label .= "|   "; } $label .= "|_ "; } return $label . $this->label; } public function getHierarchy() { $hierarchy = []; if( $this->parent_id ) { $hierarchy = explode( ".", $this->parent->hierarchy ); } $hierarchy[] = str_pad( $this->parent_id, 3, 0, STR_PAD_LEFT ); $hierarchy[] = str_pad( $this->id, 3, 0, STR_PAD_LEFT ); $hierarchy = array_unique( $hierarchy ); $hierarchy = implode( ".", $hierarchy ); return $hierarchy; } public function getUrl() { if( !$this->permalink ) return NULL; $permalink = []; if( $this->parent ) { $permalink[] = $this->parent->url() ?? NULL; } $permalink[] = $this->permalink ?? NULL; $permalink = implode( "/", $permalink ); $permalink = explode( "/", $permalink ); $permalink = array_filter( $permalink ); $permalink = implode( "/", $permalink ); return "/{$permalink}"; } public function getItems( int $start = 2 ) { $items = static::$MODELCLASS::getAll([ "parent_id" => $this->id, ]); foreach( $items as $item ) { $item->startLevel = $start; $items = array_merge( $items, $item->getItems( $start ) ); } return $items; } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Assets/Model.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Assets\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\Users; class Routes { public static function register() : void { Router::get('/api/v1/cms', [ Controller::class, 'getAll' ]); Router::get('/api/v1/cms/create', [ Controller::class, 'restConfigCreate' ]); Router::post('/api/v1/cms', [ Controller::class, 'create' ]); Router::get('/api/v1/cms/{id}', [ Controller::class, 'get' ]); Router::put('/api/v1/cms/{id}', [ Controller::class, 'save' ]); Router::patch('/api/v1/cms/{id}/status', [ Controller::class, 'toggleStatus' ]); Router::get('/api/v1/cms/{id}/delete', [ Controller::class, 'restConfigDelete' ]); Router::delete('/api/v1/cms/{id}', [ Controller::class, 'delete' ]); Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => "/cms/assets", "label" => "Assets", "icon" => "bi bi-images", "menu" => "cms", ]; return $routes; }, 20 ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Assets/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Assets\API\v1; use ARUNOX\HTTP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; class Controller extends BaseController { /* ### VARIABLES ################################################ # */ protected static array $NOTIFY = [ "notfound" => "#Template# nicht gefunden", "saved" => "#Template# wurde erfolgreich gespeichert", "deleted" => "#Template# wurde erfolgreich gelöscht", "created" => "#Template# wurde erfolgreich erstellt", "notcreated" => "#Template# konnte nicht erstellt werden", ]; /* ### PUBLIC GET FUNCTIONS ##################################### # */ public function getAll() : HTTP\Response { $results = Websites\Assets\Model::getAll(); static::restConfigOverview( $results ); return REST\Response::jsonResponse(); } public function get( int $id ) : HTTP\Response { if( $result = Websites\Assets\Model::get( $id ) ) { static::restConfigDetails( $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ public function save( int $id, array $data ) : HTTP\Response { if( $result = Websites\Assets\Model::get( $id ) ) { $result->save( $data ); REST\Response::addNotify( "success", static::getNotify("saved") ); REST\Response::closeModals(); REST\Response::addUpdater( [ "data/table/row", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function create( array $data ) : HTTP\Response { if( $id = Websites\Assets\Model::save( $data ) ) { REST\Response::addNotify( "success", static::getNotify("created") ); REST\Response::closeModals(); REST\Response::redirect( "/cms" ); } else REST\Response::addNotify( "danger", static::getNotify("notcreated") ); return REST\Response::jsonResponse(); } public function delete( int $id ) : HTTP\Response { REST\Response::closeModals(); if( Websites\Assets\Model::delete( $id ) ) { REST\Response::addNotify( "success", static::getNotify("deleted") ); REST\Response::redirect( "/cms" ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function toggleStatus( int $id ) : HTTP\Response { if( $result = Websites\Assets\Model::get( $id ) ) { $result->toggleStatus( TRUE ); REST\Response::addUpdater( [ "data/table/row", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST FUNCTIONS #################################### # */ public static function restConfigOverview( array $data = [] ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "overview", "Setting" ) ->setList( $data ) ->get() ->setAction( "/cms/{id}" ) ->setOrder( "name", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "cms" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "name", TRUE, TRUE, TRUE, "cms" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->icon", [], "type", [], "cms" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "setting", TRUE, TRUE, TRUE, "cms" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "cms" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "cms" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "cms" )) ->top(); } public static function restConfigDetails( Websites\Assets\Entity $data ) : REST\Generator\Base\BaseGenerator { $form = REST\Response::addModal( "details", "Setting bearbeiten" ) ->setData( $data ) ->setTitle( $data->type->getLabel() ) ->setIcon( $data->type->getIcon() ) ->setColor( $data->type->getColor() ) ->get() ->setAction( "/api/v1/cms/{id}", "PUT" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Speichern", "cms" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "name", TRUE, "cms" )); switch( $data->type->getValue() ) { case Websites\Assets\Type::Unknown : static::restConfigFormTypeUnknown( $form ); break; case Websites\Assets\Type::Value : static::restConfigFormTypeValue( $form ); break; case Websites\Assets\Type::List : static::restConfigFormTypeList( $form ); break; case Websites\Assets\Type::Switch : static::restConfigFormTypeSwitch( $form ); break; case Websites\Assets\Type::Mail : static::restConfigFormTypeMail( $form ); break; case Websites\Assets\Type::Url : static::restConfigFormTypeUrl( $form ); break; case Websites\Assets\Type::Number : static::restConfigFormTypeNumber( $form ); break; } return $form; } public static function restConfigCreate() : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Setting erstellen" ) ->setData([ "id" => 0 ]) ->get() ->setAction( "/api/v1/cms", "POST" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Erstellen", "cms" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "name", TRUE, "cms" )) ->top(); } public static function restConfigDelete( int $id ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Setting Löschen" ) ->setData([ "id" => $id ]) ->setSize( REST\Wrapper\Modal\Size::sm ) ->get() ->setAction( "/api/v1/cms/{id}", "DELETE" ) ->addText( "Möchtest du wirklich den Datensatz (#{$id}) löschen? " ) ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "cms" )) ->addButton(...Hooks::filter( "rest.generator::button.type->delete", [], NULL, "cms" )) ->top(); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigFormTypeUnknown( REST\Generator\Base\BaseGenerator $form ) : void { $form ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "setting", TRUE, "cms" )) ->top(); } public static function restConfigFormTypeValue( REST\Generator\Base\BaseGenerator $form ) : void { $form ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "setting", TRUE, "cms" )) ->top(); } public static function restConfigFormTypeList( REST\Generator\Base\BaseGenerator $form ) : void { $form ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "setting", TRUE, "cms" )) ->top(); } public static function restConfigFormTypeSwitch( REST\Generator\Base\BaseGenerator $form ) : void { $form ->addField(...Hooks::filter( "rest.generator::control.type->select", [], "setting", TRUE, TRUE, "cms" )) ->top(); } public static function restConfigFormTypeMail( REST\Generator\Base\BaseGenerator $form ) : void { $form ->addField(...Hooks::filter( "rest.generator::control.type->email", [], "setting", TRUE, "cms" )) ->top(); } public static function restConfigFormTypeUrl( REST\Generator\Base\BaseGenerator $form ) : void { $form ->addField(...Hooks::filter( "rest.generator::control.type->url", [], "setting", TRUE, "cms" )) ->top(); } public static function restConfigFormTypeNumber( REST\Generator\Base\BaseGenerator $form ) : void { $form ->addField(...Hooks::filter( "rest.generator::control.type->number", [], "setting", TRUE, "cms" )) ->top(); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Assets/Entity.php **/ Attribute\Status::class, "date_create" => Attribute\DateTime::class, "date_edit" => Attribute\DateTime::class, ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function toggleStatus( bool $save = FALSE ) { $this->status->toggle(); if( $save ) $this->save(); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Pages/Model.php **/ items; // $level = ++$current->level; // } // // $results = array_sort_column( $results, "hierarchy" ); // // foreach( $results as $item ) { // if( in_array( $item->parent_id, $parents ) ) { // $parents[] = $item->id; // } // // $options[] = [ // "value" => $item->id, // "label" => html_entity_decode( $item->getHierarchicalTitle( $level ) ), // "disabled" => in_array( $item->id, $parents ), // ]; // } // // return $options; // } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Pages/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Pages\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => Controller::getRoute(), "label" => Controller::getPlural(), "icon" => Controller::getIcon(), "menu" => "websites", ]; return $routes; }, 50 ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Pages/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Pages\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Seite", "Seiten" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::FileEarmarkText )] #[PHP\Attributes\Controller\Route( "pages", Websites\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Websites\Pages\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /websites/pages * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /websites/pages/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /websites/pages/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /websites/pages * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /websites/pages/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/pages/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /websites/pages * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/websites/pages/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /websites/pages/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/websites/pages" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /websites/pages/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /websites/pages * @route.description REST-Konfiguration für Logbuch-Tabelle */ public static function restConfigOverview() : REST\Generator\Base\BaseGenerator { $tabs = REST\Response::addWrapper( "details", static::getPlural() )->get(); $tabs = $tabs->addTab( "Übersicht", FALSE )->get() ->setIcon( static::getIcon() ) ->addHeadline( static::getPlural(), 2 ) ->addContent( static::restConfigTable() ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/pages" )) ) ->parent(); $tabs = $tabs->addTab( Websites\Menus\API\v1\Controller::getPlural(), "categories" )->get() ->setIcon( Websites\Menus\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Menus\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Menus\API\v1\Controller::restConfigTable() ) ->parent(); // $tabs = $tabs->addTab( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), "templates" )->get() // ->setIcon( Calendars\Tasks\Templates\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), 2 ) // ->addContent( // Calendars\Tasks\Templates\API\v1\Controller::restConfigTable() // ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/tasks/templates" )) // ) // ->parent(); // $tabs = $tabs->addTab( Calendars\Entries\API\v1\Controller::getPlural(), "appointments" )->get() // ->setIcon( Calendars\Entries\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Entries\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Entries\API\v1\Controller::restConfigTable() ) // ->parent(); // // $tabs = $tabs->addTab( Calendars\Tasks\API\v1\Controller::getPlural(), "tasks" )->get() // ->setIcon( Calendars\Tasks\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Tasks\API\v1\Controller::restConfigTable() ) // ->parent(); return $tabs; } /** * @internal rest * @method GET * * @route.path /websites/pages/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "details", static::getSingular( "%t bearbeiten" ) ) ->setBacklink( "/websites/pages" ) ->get() ->setApi( "/websites/pages/{$hashid}" ) ->setAction( "/websites/pages/{$hashid}", "PUT" ) ->addTab( "Kalender" )->get() ->addHeadline( "Kalender", 2 ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", FALSE, "websites/pages" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites/pages" )) ->parent() // ->addCallable( [ Calendars\Entries\API\v1\Controller::class, "restConfigTab" ], $hashid ) // ->addCallable( [ Calendars\Tasks\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /websites/pages/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /websites/pages/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( "/websites/pages" ) ->setAction( "/websites/pages/{hashid}" ) ->setOrder( "title", "asc" ) ->setSearch( TRUE ) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], "websites/pages", "hashid" )) // ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ // "label" => FALSE, // "title" => Calendars\Entries\API\v1\Controller::getPlural(), // "icon" => Calendars\Entries\API\v1\Controller::getIcon(), // ], "entries.status.0", TRUE, FALSE, TRUE, "websites/pages" )) // // ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ // "label" => FALSE, // "title" => Calendars\Tasks\API\v1\Controller::getPlural(), // "icon" => "bi-clipboard-check", // ], "tasks.status.0", TRUE, FALSE, TRUE, "websites/pages" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "title", TRUE, TRUE, TRUE, "websites/pages" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "target.name", TRUE, TRUE, TRUE, "websites/pages" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "description", TRUE, TRUE, TRUE, "websites/pages" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_create", TRUE, FALSE, TRUE, "websites/pages" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "target_hid", TRUE, "websites/pages" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "websites/pages" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites/pages" )) ; return $rest->top()->getChildren(); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Pages/Entity.php **/ status->toggle(); if( $save ) $this->save(); } public function getParent() { return Model::get( $this->parent_id ); } public function getLevel() { return count( explode( ".", $this->hierarchy ) ); } public function getHierarchicalTitle( ?int $start = NULL ) { $start = $start ?? $this->startLevel ?? 2; $title = NULL; $level = count( explode( ".", $this->hierarchy ) ); if( $level > $start ) { for( $x = ++$start; $x <= $level; $x++ ) { $title .= "|   "; } $title .= "|_ "; } return $title . $this->title; } public function getHierarchy() { $hierarchy = []; if( $this->parent_id ) { $hierarchy = explode( ".", $this->parent->hierarchy ); } $hierarchy[] = str_pad( $this->parent_id, 3, 0, STR_PAD_LEFT ); $hierarchy[] = str_pad( $this->id, 3, 0, STR_PAD_LEFT ); $hierarchy = array_unique( $hierarchy ); $hierarchy = implode( ".", $hierarchy ); return $hierarchy; } public function getUrl() { if( !$this->permalink ) return NULL; $permalink = []; if( $this->parent ) { $permalink[] = $this->parent->url ?? NULL; } $permalink[] = $this->permalink ?? NULL; $permalink = implode( "/", $permalink ); $permalink = explode( "/", $permalink ); $permalink = array_filter( $permalink ); $permalink = implode( "/", $permalink ); return "/{$permalink}"; } public function getPages( int $start = 2 ) { $pages = Model::getAll([ "parent_id" => $this->id, ]); foreach( $pages as $page ) { $page->startLevel = $start; $pages = array_merge( $pages, $page->getPages( $start ) ); } $pages = array_sort_column( $pages, "hierarchy" ); return $pages; } public function generate( string $root, callable $wrapper ) { $dirname = "{$root}/de/{$this->url}"; $dirname = preg_replace( "/\/+/", "/", $dirname ); $content = $wrapper( $this ); @mkdir( $dirname, 0755, TRUE ); file_put_contents( "{$dirname}/index.php", $content ); if( $this->parent_id ) return; $pages = $this->pages; foreach( $pages as $index => $page ) { if( $page->status->value !== Attribute\Status::Active ) continue; $page->generate( $root, $wrapper ); } } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Themes/Model.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Themes\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => Controller::getRoute(), "label" => Controller::getPlural(), "icon" => Controller::getIcon(), "menu" => "websites", ]; return $routes; }, 50 ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Themes/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Themes\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Theme", "Themes" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::PaintBucket )] #[PHP\Attributes\Controller\Route( "themes", Websites\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Websites\Themes\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /websites/themes * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /websites/themes/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /websites/themes/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /websites/themes * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /websites/themes/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/themes/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /websites/themes * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/websites/themes/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /websites/themes/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/websites/themes" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /websites/themes/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /websites/themes * @route.description REST-Konfiguration für Logbuch-Tabelle */ public static function restConfigOverview() : REST\Generator\Base\BaseGenerator { $tabs = REST\Response::addWrapper( "details", static::getPlural() )->get(); $tabs = $tabs->addTab( "Übersicht", FALSE )->get() ->setIcon( static::getIcon() ) ->addHeadline( static::getPlural(), 2 ) ->addContent( static::restConfigTable() ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/themes" )) ) ->parent(); $tabs = $tabs->addTab( Websites\Menus\API\v1\Controller::getPlural(), "categories" )->get() ->setIcon( Websites\Menus\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Menus\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Menus\API\v1\Controller::restConfigTable() ) ->parent(); // $tabs = $tabs->addTab( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), "templates" )->get() // ->setIcon( Calendars\Tasks\Templates\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), 2 ) // ->addContent( // Calendars\Tasks\Templates\API\v1\Controller::restConfigTable() // ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/tasks/templates" )) // ) // ->parent(); // $tabs = $tabs->addTab( Calendars\Entries\API\v1\Controller::getPlural(), "appointments" )->get() // ->setIcon( Calendars\Entries\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Entries\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Entries\API\v1\Controller::restConfigTable() ) // ->parent(); // // $tabs = $tabs->addTab( Calendars\Tasks\API\v1\Controller::getPlural(), "tasks" )->get() // ->setIcon( Calendars\Tasks\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Tasks\API\v1\Controller::restConfigTable() ) // ->parent(); return $tabs; } /** * @internal rest * @method GET * * @route.path /websites/themes/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "details", static::getSingular( "%t bearbeiten" ) ) ->setBacklink( Websites\API\v1\Controller::getRoute( "#themes" ) ) ->get() ->setApi( static::getRoute( $hashid ) ) ->setAction( static::getRoute( $hashid ), "PUT" ) ->addTab( static::getSingular() )->get() ->addHeadline( static::getSingular(), 2 ) ->addChildren( static::restConfigInputs() ) ->parent() ->addCallable( [ Websites\Themes\Files\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /websites/themes/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /websites/themes/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( static::getRoute() ) ->setAction( static::getRoute("{hashid}" ) ) ->setOrder( "name", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/themes" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], "websites/themes", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "name", TRUE, TRUE, TRUE, "websites/themes" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "description", TRUE, TRUE, TRUE, "websites/themes" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", TRUE, FALSE, TRUE, "websites/themes" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "name", TRUE, "websites/themes" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "websites/themes" )) ; return $rest->top()->getChildren(); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Themes/Files/Model.php **/ $origin, ], $where ); if( $column ) return Model::getAllValue( $where, $column ); return Model::getAll( $where ); } public static function generate( string $hashid ) { if( !$id = static::resolveHashID( $hashid ) ) return FALSE; if( !$file = static::get( $id ) ) return FALSE; return $file->generate(); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Themes/Files/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Themes\Files\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => Controller::getRoute(), "label" => Controller::getPlural(), "icon" => Controller::getIcon(), "menu" => "websites", ]; return $routes; }, 50 ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Themes/Files/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Themes\Files\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "File", "Files" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::FiletypeCss )] #[PHP\Attributes\Controller\Route( "files", Websites\Themes\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Websites\Themes\Files\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /websites/themes/files * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /websites/themes/{origin}/files * @route.description Listet alle Logeinträge */ public static function getByOriginPrepared( string $origin ) : array { return parent::getByOriginPrepared( $origin ); } /** * @api * @method GET * * @route.path /websites/themes/files/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /websites/themes/files/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /websites/themes/files * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @internal rest * @method GET * * @route.path /websites/themes/{origin}/files/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreateByOriginPrepared( bool | string $origin = FALSE ) : REST\Generator\Base\BaseGenerator { return parent::restConfigCreateByOriginPrepared( $origin ); } /** * @api * @method DELETE * * @route.path /websites/themes/files/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/themes/files/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/themes/files/{hashid}/generate * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function generate( string $hashid ) : HTTP\Response { flush_json([ "value" => 0 ]); Websites\Themes\Files\Model::generate( $hashid ); flush_json([ "value" => 100, "label" => "Kompilierung abgeschlossen" ]); exit; } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /websites/themes/files * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::refresh( "#files" ); } return static::restResponse( $result ); } /** * @internal rest * @method PUT * * @route.path /websites/themes/files/{hashid} * @route.description REST-Antwort nach dem Speichern eines Termins */ public static function restResponseSavePrepared( string $hashid, array $data ) : HTTP\Response { return parent::restResponseSavePrepared( $hashid, $data ); } /** * @internal rest * @method DELETE * * @route.path /websites/themes/files/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDeletePrepared( string $hashid ) : HTTP\Response { return parent::restResponseDeletePrepared( $hashid ); } /** * @internal rest * @method PATCH * * @route.path /websites/themes/files/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /websites/themes/files * @route.description REST-Konfiguration für Logbuch-Tabelle */ public static function restConfigOverview() : REST\Generator\Base\BaseGenerator { $tabs = REST\Response::addWrapper( "details", static::getPlural() )->get(); $tabs = $tabs->addTab( "Übersicht", FALSE )->get() ->setIcon( static::getIcon() ) ->addHeadline( static::getPlural(), 2 ) ->addContent( static::restConfigTable() ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/themes/files" )) ) ->parent(); $tabs = $tabs->addTab( Websites\Menus\API\v1\Controller::getPlural(), "categories" )->get() ->setIcon( Websites\Menus\API\v1\Controller::getIcon() ) ->addHeadline( Websites\Menus\API\v1\Controller::getPlural(), 2 ) ->addContent( Websites\Menus\API\v1\Controller::restConfigTable() ) ->parent(); // $tabs = $tabs->addTab( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), "templates" )->get() // ->setIcon( Calendars\Tasks\Templates\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\Templates\API\v1\Controller::getPlural(), 2 ) // ->addContent( // Calendars\Tasks\Templates\API\v1\Controller::restConfigTable() // ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/tasks/templates" )) // ) // ->parent(); // $tabs = $tabs->addTab( Calendars\Entries\API\v1\Controller::getPlural(), "appointments" )->get() // ->setIcon( Calendars\Entries\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Entries\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Entries\API\v1\Controller::restConfigTable() ) // ->parent(); // // $tabs = $tabs->addTab( Calendars\Tasks\API\v1\Controller::getPlural(), "tasks" )->get() // ->setIcon( Calendars\Tasks\API\v1\Controller::getIcon() ) // ->addHeadline( Calendars\Tasks\API\v1\Controller::getPlural(), 2 ) // ->addContent( Calendars\Tasks\API\v1\Controller::restConfigTable() ) // ->parent(); return $tabs; } /** * @internal rest * @method GET * * @route.path /websites/themes/files/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { $current = Websites\Themes\Files\Model::get( $hashid ); $origin = $current->origin->hashid; return REST\Response::addWrapper( "details", static::getSingular( "%t bearbeiten" ) ) ->setBacklink( Websites\Themes\API\v1\Controller::getRoute( $origin, "#files" ) ) ->get() ->setApi( static::getRoute( $hashid ) ) ->setAction( static::getRoute( $hashid ), "PUT" ) ->addTab( static::getSingular() )->get() ->addHeadline( static::getSingular(), 2 ) ->addChildren( static::restConfigInputs() ) ->parent() ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /websites/themes/files/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /websites/themes/{origin}/files/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigAddByOriginPrepared( bool | string $origin = FALSE ) : REST\Generator\Base\BaseGenerator { return parent::restConfigAddByOriginPrepared( $origin ); } /** * @internal rest * @method GET * * @route.path /websites/themes/files/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /** * @internal rest * @method GET * * @route.path /websites/themes/files/{hashid}/generate * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigCompile( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", static::getSingular( "%t kompilieren" ) ) ->get() ->addField(...Hooks::filter( "rest.generator::control.type->progress", [ "api" => [ "route" => static::getRoute( $hashid, "generate" ), "method" => "PATCH", ], ], "domain", TRUE, "websites/domains" )) ; } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTab( REST\Generator\Base\BaseGenerator $rest, null|string $origin = NULL ) : void { $rest->addTab( static::getLabelGroup(), "files" )->get() ->setIcon( static::getIcon() ) ->addContent( static::restConfigTable( $origin ) ) ; } public static function restConfigTable( null|string $origin = NULL ) : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( Websites\Themes\API\v1\Controller::getRoute( $origin, "files" ) ) ->setAction( static::getRoute("{hashid}" ) ) ->setOrder( "filename", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/themes/{$origin}/files" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [ "options" => Websites\Themes\Files\Status::getAll(), ], "status", [], "websites/themes/files", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->icon", [ "label" => Websites\Themes\Files\Type::getSingular(), "icon" => Websites\Themes\Files\Type::getIcon(), "options" => Websites\Themes\Files\Type::getAll(), ], "type", [], "websites/themes/files", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "filename", TRUE, TRUE, TRUE, "websites/themes/files" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", TRUE, FALSE, TRUE, "websites/themes/files" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "websites/themes/files" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->default", [ "label" => Websites\API\v1\Controller::getSingular( "%t kompilieren" ), "action" => static::getRoute( "{hashid}", "generate" ), "icon" => REST\Generator\Config\Icon::Gear, "color" => REST\Generator\Config\Color::Warning, "visibility" => [ "status" => [ Websites\Themes\Files\Status::Compiling ], "type" => [ Websites\Themes\Files\Type::SCSS ], ], ], "websites/themes/files", "hashid" )) ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "websites/themes/files", "hashid" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "websites/themes/files", "hashid" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->select", [ "options" => Websites\Themes\Files\Type::getAll(), ], "type", TRUE, FALSE, "websites/themes/files" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "filename", TRUE, "websites/themes/files" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "content", FALSE, "websites/themes/files" )) ; return $rest->top()->getChildren(); } public static function restConfigOrigin( bool|string $hashid ) : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Form::create(); if( $hashid === FALSE ) { return $rest->addField(...Hooks::filter( "rest.generator::control.type->select", [ "options" => Websites\Themes\Model::getAsOptions( "title" ), ], "origin_id", TRUE, FALSE, "projects/steps" )); } $origin = Websites\Themes\Model::getValue( $hashid, "id" ); return $rest->addField(...Hooks::filter( "rest.generator::control.type->hidden", [], "origin_id", $origin ?? $hashid, "projects/steps" )); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Themes/Files/Type.php **/ origin_id ); } public function generate( ...$args ) : bool|string { if( $this->type->value == Type::Template ) return $this->generateTemplate( ...$args ); if( $this->status->value != Status::Compiling || $this->type->value != Type::SCSS ) return FALSE; if( !$theme = $this->origin ) return FALSE; $rootAssets = realpath( CACHE_DIR ); $rootAssets = "{$rootAssets}/{$theme->hashid}/assets"; @mkdir( $rootAssets, 0755, TRUE ); if( $this->status->value == Status::Active && $this->type->value != Type::SCSS ) { $ext = match ( $this->type->value ) { Type::CSS => "css", }; $filename = "{$rootAssets}/{$ext}/{$this->filename}.{$ext}"; file_put_contents( $filename, $this->content ); return $filename; } $rootSCSS = "{$rootAssets}/scss"; @mkdir( $rootSCSS, 0755, TRUE ); $files = Model::getByOrigin( $theme->hashid, NULL, [ "status__IN" => [ Status::Active ], "type" => Type::SCSS, ]); foreach( $files as $file ) { $filename = $file->filename; $filename = preg_replace( "/(.*\/)?([a-z_-]+)$/", "\$1_\$2", $filename ); $filename = "{$rootSCSS}/{$filename}.scss"; $dirname = dirname( $filename ); @mkdir( $dirname, 0755, TRUE ); file_put_contents( $filename, $file->content ); } $filename = $this->filename; $filename = "{$rootSCSS}/{$filename}.scss"; $dirname = dirname( $filename ); @mkdir( $dirname, 0755, TRUE ); file_put_contents( $filename, $this->content ); $scss_compiler = new SCSS( "{$rootSCSS}/", "{$rootAssets}/css/" . "/", "{$rootSCSS}/", "expanded", "SOURCE_MAP_NONE" ); $scss_compiler->compile( TRUE ); return "{$rootAssets}/css/{$this->filename}.css"; } /* ### PROTECTED FUNCTIONS ###################################### # */ protected function generateTemplate( $page, $files ) : bool|string { if( $this->status->value != Status::Active ) return FALSE; $variables = [ "page" => $page, "files" => $files, ]; $template = $this->content; $template = Templater::render( $template, $variables ); $template = preg_replace( "/\s+/", " ", $template ); return $template; } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Themes/Files/Status.php **/ parent->type->value === Type::SCSS ) { if( $this->value === static::Active ) { $this->value = Status::Compiling; } } return $this->value; } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Themes/Entity.php **/ status->value != Attribute\Status::Active ) return FALSE; $cssFiles = $this->getFiles( Files\Type::CSS, Files\Status::Active ); $scssFiles = $this->getFiles( Files\Type::SCSS, Files\Status::Compiling ); foreach( $scssFiles as $scssFile ) { $cssFiles[] = $scssFile->generate(); } return $cssFiles; } public function getIndex() { return $this->getTemplate( "index" ); } public function getFiles( array|int $type, array|int $status ) { return Files\Model::getAll([ "origin_id" => $this->id, "status__IN" => $status, "type" => $type, ]); } public function getTemplate( string $name ) : bool|Files\Entity { if( $files = $this->getFiles( Files\Type::Template, Files\Status::Active ) ) { return current( $files ); } return FALSE; } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Entity.php **/ page_id ) { return Websites\Pages\Model::get( $this->page_id ); } return NULL; } public function getPages() { $pages = []; if( $this->page_id ) $pages[] = Websites\Pages\Model::get( $this->page_id ); if( $menu = $this->mainMenu ) { foreach( $menu->items as $item ) { $pages[] = $item->page; } } if( $menu = $this->footerMenu ) { foreach( $menu->items as $item ) { $pages[] = $item->page; } } $pages = array_filter( $pages ); $pages = array_values( $pages ); return $pages; } public function getTheme() { if( $this->theme_id ) { return Websites\Themes\Model::get( $this->theme_id ); } return NULL; } public function getRedirects( array $where = [] ) { return Websites\Redirects\Model::getAll( array_replace_recursive([ "origin_id" => $this->id, ], $where )); } public function getMainMenu() { if( $this->main_menu_id ) { return Websites\Menus\Model::get( $this->main_menu_id ); } return NULL; } public function getFooterMenu() { if( $this->footer_menu_id ) { return Websites\Menus\Model::get( $this->footer_menu_id ); } return NULL; } public function generate() : bool|string { if( $this->status->value != Attribute\Status::Active ) return FALSE; if( !$page = $this->page ) return FALSE; if( !$theme = $this->theme ) return FALSE; if( !$index = $theme->index ) return FALSE; $root = realpath( CACHE_DIR ); $root = "{$root}/{$this->hashid}"; $dirs = [ "", "assets", "pages" ]; foreach( $dirs as $dir ) @mkdir( "{$root}/{$dir}", 0755, TRUE ); $files = $theme->generate(); foreach( $files as &$file ) { $filename = "/assets/" . basename( $file ); copy( $file, "{$root}/{$filename}"); $file = $filename; } $page->generate( "{$root}/pages", function( $page ) use( $files, $index ) { return $index->generate( $page, $files ); }); file_put_contents( "{$root}/.htaccess", $this->generateHtaccess() ); return $root; } public function generateHtaccess() { ob_start(); ?>DirectoryIndex pages/de/index.php AddDefaultCharset utf-8 SetEnv TZ Europe/Berlin Header set Access-Control-Allow-Origin "*" RewriteEngine On RewriteBase / # Permanent URL Redirect Attribute\Status::Active, ]); foreach( $redirects as $redirect ) { echo "Redirect {$redirect->status_code} {$redirect->source_url} {$redirect->target_url}\n"; } ?> # # Umleitung von Permalinks # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ $1 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-z]{2})$ pages/$1/index.php?%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-z]{2})/(.*) pages/$1/$2/index.php?%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) pages/de/$1/index.php?%{QUERY_STRING} [L] * @copyright 2025 ARUNOX * @version 1.0.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Connections; use ARUNOX\API\PHP; use ARUNOX\Plugins\REST; use ARUNOX\Database\BaseModel; #[PHP\Attributes\Database\Definitions\Table( "websites_connections" )] #[PHP\Attributes\Database\Definitions\HashID( "wcon" )] #[PHP\Attributes\Database\Definitions\Entity( Entity::class )] class Model extends BaseModel { /* ### VARIABLES ################################################ # */ /* ### PUBLIC STATIC FUNCTIONS ################################## # */ } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Connections/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Connections\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Connections/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Connections\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Websites; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Verbindung", "Verbindungen" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::Plug )] #[PHP\Attributes\Controller\Route( "connections", Websites\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Websites\Connections\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /websites/connections * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /websites/connections/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /websites/connections/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /websites/connections * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /websites/connections/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /websites/connections/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method PUT * * @route.path /websites/connections/{hashid} * @route.description REST-Antwort nach dem Speichern eines Termins */ public static function restResponseSave( string $hashid, array $data ) : HTTP\Response { $result = static::savePrepared( $hashid, $data ); if( $result->isStatus( 200 ) ) { $data = Websites\Connections\Model::get( $hashid ); REST\Response::closeModals(); REST\Response::addUpdater( [ "data/table/row", $hashid ], $data ); } return static::restResponse( $result ); } /** * @internal rest * @method POST * * @route.path /websites/connections * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/calendars#categories" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /websites/connections/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/calendars#categories" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /websites/connections/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /websites/connections/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", static::getSingular( "%t bearbeiten" ) ) ->setSize( "equal" ) ->setWidth("lg") ->get() ->setApi( "/websites/connections/{$hashid}" ) ->setAction( "/websites/connections/{$hashid}", "PUT" ) ->addTab( static::getSingular() )->get() ->addChildren( Websites\Connections\API\v1\Controller::restConfigInputs() ) ->parent() ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ) ; } /** * @internal rest * @method GET * * @route.path /websites/connections/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /websites/connections/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", static::getSingular( "%t löschen" ) ) ->setSize( REST\Wrapper\Modal\Size::sm ) ->get() ->setAction( "/websites/connections/{$hashid}", "DELETE" ) ->addText( "Möchtest du wirklich den Datensatz (#{$hashid}) löschen? " ) ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "websites/connections" )) ->addButton(...Hooks::filter( "rest.generator::button.type->delete", [], NULL, "websites/connections" )); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTable( null|string $hashid = NULL ) : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( "/websites/connections?origin={$hashid}" ) ->setAction( "/websites/connections/{hashid}" ) ->setOrder( "title", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "websites/connections" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [ "options" => Websites\Connections\Status::getAll(), ], "status", [], "websites/connections", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "host", TRUE, TRUE, TRUE, "websites/connections" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "port", TRUE, TRUE, TRUE, "websites/connections" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "username", TRUE, TRUE, TRUE, "websites/connections" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", TRUE, FALSE, TRUE, "websites/connections" )) // ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "websites/connections" ))->get() // ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "websites/connections", "hashid" )) // ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "websites/connections", "hashid" )); ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addGroup() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "websites/connections" )) ->addField(...Hooks::filter( "rest.generator::control.type->select", [ "options" => REST\Generator\Config\Icon::getAsOptions(), ], "icon_name", TRUE, TRUE, "websites/connections" )) ->addField(...Hooks::filter( "rest.generator::control.type->select", [ "options" => REST\Generator\Config\Color::getAsOptions(), ], "icon_color", TRUE, TRUE, "websites/connections" )) ->parent() ->addGroup() ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [ "lines" => 3, ], "description", FALSE, "websites/connections" )) ; return $rest->top()->getChildren(); } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Connections/Entity.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Websites\Connections; use FTP\Connection; use ARUNOX\API\PHP; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Database\Attributes( "status", Status::class )] #[PHP\Attributes\Database\Attributes( "date_edit" )] #[PHP\Attributes\Database\Attributes( "date_create" )] #[PHP\Attributes\Database\Definitions\Model( Model::class )] class Entity extends BaseEntity { /* ### VARIABLES ################################################ # */ /* ### PUBLIC FUNCTIONS ######################################### # */ public function getName() : string { return "{$this->username}@{$this->host}"; } public function check( bool $force = FALSE ) { if( !$force && !$this->status->isActive() ) return $this->status; $status = $this->connect(); if( is_a( $status, Connection::class ) ) { $this->status = new Status( Status::Active ); } else $this->status = $status; $this->save(); return $this->status; } public function connect() { if( $ftp = @ftp_connect( $this->host, $this->port ?? 21 ) ) { if( @ftp_login( $ftp, $this->username, $this->password ) ) { return $ftp; } else return Status::NoLogin; } else return Status::NoConnection; } } /** Datei: plugins/websites/library/ARUNOX/Plugins/Websites/Connections/Status.php **/ value !== static::Inactive ) { return parent::toggle(); } $status = $this->parent->check( TRUE ); return $status->value; } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/websites/hooks/init.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Websites; Hooks::add('public::api->init', [ Websites\API\v1\Routes::class, "register" ] ); Hooks::add('public::api->init', [ Websites\Assets\API\v1\Routes::class, "register" ] ); Hooks::add('public::api->init', [ Websites\Connections\API\v1\Routes::class, "register" ] ); Hooks::add('public::api->init', [ Websites\Domains\API\v1\Routes::class, "register" ] ); Hooks::add('public::api->init', [ Websites\Menus\API\v1\Routes::class, "register" ] ); Hooks::add('public::api->init', [ Websites\Pages\API\v1\Routes::class, "register" ] ); Hooks::add('public::api->init', [ Websites\Redirects\API\v1\Routes::class, "register" ] ); Hooks::add('public::api->init', [ Websites\Themes\API\v1\Routes::class, "register" ] ); /** Datei: plugins/websites/config.php **/ * @copyright 2025 ARUNOX * @version 0.1.0 * * @dependencies users * * @since 0.1.0 initial version */ /** Datei: plugins/websites/config/schema/v1.0.0.php **/ array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT CURRENT_TIMESTAMP', 'date_edit' => 'DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'status' => 'TINYINT DEFAULT \'0\'', 'label' => 'VARCHAR(255)', 'parent_id' => 'INT DEFAULT \'0\'', 'page_id' => 'INT', 'link' => 'VARCHAR(255)', 'newtab' => 'TINYINT(1) DEFAULT \'0\'', 'sort' => 'INT DEFAULT \'0\'', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( ), ), 'cms_pages' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT CURRENT_TIMESTAMP', 'date_edit' => 'DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'status' => 'TINYINT(1) DEFAULT \'0\'', 'parent_id' => 'INT DEFAULT \'0\'', 'permalink' => 'VARCHAR(255)', 'title' => 'VARCHAR(255)', 'content' => 'LONGTEXT', 'template' => 'VARCHAR(255)', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( 'cms_pages_permalink_uindex' => array ( 0 => 'permalink', ), ), ), 'cms_pages_meta' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT CURRENT_TIMESTAMP', 'date_edit' => 'DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'origin_id' => 'INT NOT NULL', 'meta_key' => 'VARCHAR(255) NOT NULL', 'meta_value' => 'TEXT', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( 'origin_id' => array ( 0 => 'origin_id', 1 => 'meta_key', ), ), ), 'cms_websites' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT CURRENT_TIMESTAMP', 'date_edit' => 'DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'status' => 'TINYINT(1) DEFAULT \'0\'', 'title' => 'VARCHAR(255)', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( ), ), 'cms_websites_meta' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT CURRENT_TIMESTAMP', 'date_edit' => 'DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'origin_id' => 'INT NOT NULL', 'meta_key' => 'VARCHAR(255) NOT NULL', 'meta_value' => 'TEXT', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( 'origin_id' => array ( 0 => 'origin_id', 1 => 'meta_key', ), ), ), );