Merge pull request #3 from alllinux/v0.9.3

V0.9.3
This commit is contained in:
Stephan Kasdorf
2019-11-09 18:42:07 +01:00
committed by GitHub
8 changed files with 57 additions and 65 deletions

View File

@@ -1,6 +1,6 @@
# Nibiru # Nibiru
### Rapid Prototyping PHP Framework ### Rapid Prototyping PHP Framework
Version 0.7.0 beta Version 0.9.3 beta
## Introduction ## Introduction
<div style="word-spacing: 2px; letter-spacing: 0.1px; font-size: 12px; margin-bottom: 15px;">Nibiru is a rapid prototyping framework written in PHP and based on the MVC design pattern. Now one may say that writing <br> <div style="word-spacing: 2px; letter-spacing: 0.1px; font-size: 12px; margin-bottom: 15px;">Nibiru is a rapid prototyping framework written in PHP and based on the MVC design pattern. Now one may say that writing <br>
@@ -100,7 +100,6 @@ Engine Implementation.</div>
<li>A soap extension will not be part of the system anymore, since that is just a bad habit, so this will be replaced with a REST api.</li> <li>A soap extension will not be part of the system anymore, since that is just a bad habit, so this will be replaced with a REST api.</li>
</ul> </ul>
<h1>Update</h1>
<p>Version 0.7.0 beta 27.01.2018</p> <p>Version 0.7.0 beta 27.01.2018</p>
<ul> <ul>
<li>Class generator for the database models can now be used, and are configured in the settings file</li> <li>Class generator for the database models can now be used, and are configured in the settings file</li>
@@ -113,12 +112,28 @@ Engine Implementation.</div>
<li>Added a class mask file in the settings folder in order to have the chance to pre-configure the autmatic generated database model files.</li> <li>Added a class mask file in the settings folder in order to have the chance to pre-configure the autmatic generated database model files.</li>
</ul> </ul>
<h1>TODO</h1> <p>Version 0.7.0 beta</p>
<p>Version 0.7.1 beta</p>
<ul> <ul>
<li>Add autoated class generator for MySQL database models</li> <li>Add autoated class generator for MySQL database models</li>
</ul> </ul>
<h1>Update</h1>
<p>Version 0.9.3 beta 09.11.2019</p>
<ul>
<li>Autoloader is now supporting a better module structure</li>
<li>Some minor bugfixes</li>
<li>Updated the annotations for better autocompletion</li>
<li>removed the Twig and Dwoo engines, they are not needed anymore</li>
</ul>
<h1>TODO</h1>
<p>Still in progress for the next version</p>
<ul>
<li>framework documentation</li>
<li>class documentation</li>
<li>soap interface to a given SOAP server (canceled, not needed to old)</li>
<li>bitcoin api, and payment gateway</li>
</ul>
<div style="word-spacing: 2px; letter-spacing: 0.1px; font-size: 15px; margin-bottom: 15px;">The start is done, have success with PHP prototyping, and always remember to have fun!</div> <div style="word-spacing: 2px; letter-spacing: 0.1px; font-size: 15px; margin-bottom: 15px;">The start is done, have success with PHP prototyping, and always remember to have fun!</div>
Author: Stephan Kasdorf<br><br> Author: Stephan Kasdorf<br><br>

View File

@@ -1,5 +1,5 @@
<?php <?php
namespace Nibiru\Adapter; namespace Nibiru\Module\Users\Interfaces;
/** /**
* @desc this file is for the autoloader to function properly, * @desc this file is for the autoloader to function properly,
* you might as well use it as the primary user interface for your * you might as well use it as the primary user interface for your

View File

@@ -1,5 +1,5 @@
<?php <?php
namespace Nibiru\Messages; namespace Nibiru\Module\Users\Traits;
/** /**
* @desc this file is for the autoloader to function properly, * @desc this file is for the autoloader to function properly,
* you might as well use it as the primary user trait for your * you might as well use it as the primary user trait for your

View File

@@ -1,5 +1,5 @@
<?php <?php
namespace Nibiru\Module; namespace Nibiru\Module\Users;
/** /**
* @desc this file is for the autoloader to function properly, * @desc this file is for the autoloader to function properly,
* you might as well use it as the primary user class for your * you might as well use it as the primary user class for your
@@ -9,10 +9,10 @@ namespace Nibiru\Module;
* Date: 28.08.18 * Date: 28.08.18
* Time: 11:22 * Time: 11:22
*/ */
use Nibiru\Adapter; use Nibiru\Module\Users\Interfaces;
use Nibiru\Messages; use Nibiru\Module\Users\Traits;
class Users implements Adapter\Users class Users implements Interfaces\Users
{ {
use Messages\Users; use Traits\Users;
} }

View File

@@ -26,9 +26,9 @@ register.text = "PATHTOYOURHTMLTEMPLATE"
pageurl = "YOURPAGEURLWITHPROTOCOL" pageurl = "YOURPAGEURLWITHPROTOCOL"
navigation = "navigation.json" navigation = "navigation.json"
dbmodel = "/../../application/model/" dbmodel = "/../../application/model/"
module = "/../../application/module/" module = "/../../application/module/[NAME]"
interfaces = "/../../application/interfaces/" interfaces = "/../../application/module/[NAME]/interfaces/"
trait = "/../../application/trait/" traits = "/../../application/module/[NAME]/traits/"
entriesperpage = 4 entriesperpage = 4
background.img[] = "public/img/nibiru3.jpg" background.img[] = "public/img/nibiru3.jpg"
smarty.css[] = "public/css/v3/roboto.css" smarty.css[] = "public/css/v3/roboto.css"

View File

@@ -14,13 +14,16 @@ class Autoloader
{ {
const MY_FILE_NAME = "autoloader.php"; const MY_FILE_NAME = "autoloader.php";
const DB_MODEL_FOLDER = "dbmodel"; const DB_MODEL_FOLDER = "dbmodel";
const MODULE_FOLDER = "module"; const MODULES = [
const INTERFACE_FOLDER = "interfaces"; 'module',
const TRAIT_FOLDER = "trait"; 'interfaces',
'traits'
];
const SETTINGS_SECTION = "AUTOLOADER"; const SETTINGS_SECTION = "AUTOLOADER";
const SETTINGS_CLASS_POS = "class.pos"; const SETTINGS_CLASS_POS = "class.pos";
const SETTINGS_TRAIT_POS = "trait.pos"; const SETTINGS_TRAIT_POS = "trait.pos";
const SETTINGS_IFACE_POS = "iface.pos"; const SETTINGS_IFACE_POS = "iface.pos";
const REGEX_PATH_NAME = "[NAME]";
private static $_filesInFoler = array(); private static $_filesInFoler = array();
private static $_instance; private static $_instance;
@@ -61,6 +64,7 @@ class Autoloader
* @desc will sort the array by a given sort order from the configuration file * @desc will sort the array by a given sort order from the configuration file
* just provided in the AUTOLOADER section. * just provided in the AUTOLOADER section.
* @param array $modules * @param array $modules
* @param mixed $section
* @return array * @return array
*/ */
private static function sortOrderModules( array $modules, $section ): array private static function sortOrderModules( array $modules, $section ): array
@@ -163,6 +167,11 @@ class Autoloader
*/ */
private static function folderContent( string $folderPath ): \RecursiveIteratorIterator private static function folderContent( string $folderPath ): \RecursiveIteratorIterator
{ {
$folderSettings = Config::getInstance()->getConfig()[self::SETTINGS_SECTION][self::SETTINGS_CLASS_POS];
foreach($folderSettings as $moduleFolderName)
{
$folderPath = str_replace(self::REGEX_PATH_NAME, $moduleFolderName, $folderPath);
}
return new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator( $folderPath )); return new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator( $folderPath ));
} }
@@ -205,58 +214,25 @@ class Autoloader
/** /**
* @desc run check on modules that should provide an interface as well as a trait * @desc run check on modules that should provide an interface as well as a trait
*/ */
$iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::INTERFACE_FOLDER] ); foreach(self::MODULES as $module)
foreach ( $iterator as $item )
{ {
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][$module] );
foreach ( $iterator as $item )
{ {
$interfaces[] = array( if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..")
'nfilename' => str_replace('.php', '', $item->getFileName()), {
'filepathname' => $item->getPath() . '/' . $item->getFileName() $moduleFolder[] = array(
); 'nfilename' => str_replace('.php', '', $item->getFileName()),
'filepathname' => $item->getPath() . '/' . $item->getFileName()
);
}
} }
} asort($moduleFolder);
asort($interfaces); $itms = self::sortOrderModules($moduleFolder, self::SETTINGS_IFACE_POS);
$Sinterfaces = self::sortOrderModules($interfaces, self::SETTINGS_IFACE_POS); foreach ($itms as $itm)
foreach ($Sinterfaces as $interface)
{
self::$_filesInFoler[] = $interface['filepathname'];
}
$iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::TRAIT_FOLDER] );
foreach ( $iterator as $item )
{
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..")
{ {
$traits[] = array( self::$_filesInFoler[] = $itm['filepathname'];
'nfilename' => str_replace('.php', '', $item->getFileName()),
'filepathname' => $item->getPath() . '/' . $item->getFileName()
);
} }
} }
asort($traits);
$Straits = self::sortOrderModules($traits, self::SETTINGS_TRAIT_POS);
foreach($Straits as $trait)
{
self::$_filesInFoler[] = $trait['filepathname'];
}
$iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::MODULE_FOLDER] );
foreach ( $iterator as $item )
{
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..")
{
$modules[] = array(
'nfilename' => str_replace('.php', '', $item->getFileName()),
'filepathname' => $item->getPath() . '/' . $item->getFileName()
);
}
}
asort($modules);
$Smodules = self::sortOrderModules($modules, self::SETTINGS_CLASS_POS);
foreach ($Smodules as $module)
{
self::$_filesInFoler[] = $module['filepathname'];
}
} }
} }

View File

@@ -20,6 +20,7 @@ interface IDb
* @desc inserts a rowset into the table, by the given nextInsertIndex return * @desc inserts a rowset into the table, by the given nextInsertIndex return
* value for the table * value for the table
* @param bool $id * @param bool $id
* @param array $rowset
* @return mixed * @return mixed
*/ */
public function insertRowsetById( $rowset = array(), $id = false ); public function insertRowsetById( $rowset = array(), $id = false );

View File

@@ -43,7 +43,7 @@ interface IForm
/** /**
* @desc loads the current Form element to the form * @desc loads the current Form element to the form
* @param $element * @param $attributes
* @return mixed * @return mixed
*/ */
public function loadElement( $attributes ); public function loadElement( $attributes );