Skip to content

Commit

Permalink
MVCExtensionv1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsoffice committed Aug 11, 2023
1 parent b9a199f commit 75df966
Show file tree
Hide file tree
Showing 34 changed files with 844 additions and 237 deletions.
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

2 changes: 2 additions & 0 deletions app/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Option -Indexes

118 changes: 77 additions & 41 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
<?php

/**
* @copyright (c) 2023 MVCExtensionm v1.0.0 Cooked by nielsoffice
*
* GPL-2.0+ License
*
* PHPWine\VanillaFlavour v1.4.0.0 free software: you can redistribute it and/or modify.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @category PHP MVC Framework for WordPress
* @package Plugin boilterplate by wpbb.me
*
*
* @author Leinner Zednanref <nielsoffice.wordpress.php@gmail.com>
* @license GPL-2.0+ License
* @link https://github.com/WPExtension/MVCExtension
* @link https://github.com/WPExtension/MVCExtension/blob/main/README.txt
* @link https://linktree.com/nielsoffice
* @version v1.0.0
* @since 08.11.2023
*
*/

if ( ! defined( 'WPINC' ) ) {
die;
}

/**
* Initialized core file framework config
* Register file config to be load
Expand All @@ -24,6 +66,39 @@ function func_file($__rs) {
func_file($___requires);
}

/**
* Default Autoloader
* # Primary or root folder
* namespace PHPAutoloader\Classes;
* # Sub folder
* namespace PHPAutoloader\Classes\system;
* Instantiate Default
* $PHPLoader = NEW \PHPAutoloader\Classes\system\DataClass();
* Instantiate Alias
* USE \PHPAutoloader\Classes\system\DataClass AS PHPLoader();
* Calling the classe instantiated
* $DataClass = new PHPLoader();
* @since 1.0.0
* @return MVC_Framework_For_WordPress
*/
spl_autoload_register(function($class) {

// File name space
$systemFileRequest = AUTH_DIRECTORY_FILE_REQUEST;

// base directory system file
$sourceFileRquest = BASE_DIR_SYSTEM_FILE;
if (strncmp($systemFileRequest, $class, strlen($systemFileRequest)) !== 0) return;

// Directory system data files
$dataRequest = $sourceFileRquest . str_replace('\\', '/', substr($class, strlen($systemFileRequest))) . PHP_EXTENSION;

// if the file exists, require it
(file_exists($dataRequest)) ? require $dataRequest : false;

});


/**
* Request file to load Helper and Libraries folder
* If sync_class < function > files is NOT allowed
Expand All @@ -32,7 +107,7 @@ function func_file($__rs) {
* @since 1.0.0
* @return MVC_Framework_For_WordPress
*/
if( !function_exists('___syncLoadFunctions') ) {
if( !function_exists('___syncLoadFunctions') ) {

function ___syncLoadFunctions( string|Settings $___directories = null , bool $sc = false ) : void {

Expand Down Expand Up @@ -61,45 +136,6 @@ function ___syncLoadFunctions( string|Settings $___directories = null , bool $sc
/* sync_functions Folder only accept a class NOT a function */
___syncLoadFunctions( ___directories : Settings::sync_class());

}

/**
* Default Autoloader
* # Primary or root folder
* namespace PHPAutoloader\Classes;
* # Sub folder
* namespace PHPAutoloader\Classes\system;
* Instantiate Default
* $PHPLoader = NEW \PHPAutoloader\Classes\system\DataClass();
* Instantiate Alias
* USE \PHPAutoloader\Classes\system\DataClass AS PHPLoader();
* Calling the classe instantiated
* $DataClass = new PHPLoader();
* @since 1.0.0
* @return MVC_Framework_For_WordPress
*/
spl_autoload_register(function($class) {

// File name space
$systemFileRequest = AUTH_DIRECTORY_FILE_REQUEST;

// base directory system file
$sourceFileRquest = BASE_DIR_SYSTEM_FILE;
if (strncmp($systemFileRequest, $class, strlen($systemFileRequest)) !== 0) return;

// Directory system data files
$dataRequest = $sourceFileRquest . str_replace('\\', '/', substr($class, strlen($systemFileRequest))) . PHP_EXTENSION;

// if the file exists, require it
(file_exists($dataRequest)) ? require $dataRequest : false;

});


use \PHPAutoloader\Classes\libraries\Core;

// init Core library
$core = new Core;

}


42 changes: 42 additions & 0 deletions app/config/config-register-path.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
<?php

/**
* @copyright (c) 2023 MVCExtensionm v1.0.0 Cooked by nielsoffice
*
* GPL-2.0+ License
*
* PHPWine\VanillaFlavour v1.4.0.0 free software: you can redistribute it and/or modify.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @category PHP MVC Framework for WordPress
* @package Plugin boilterplate by wpbb.me
*
*
* @author Leinner Zednanref <nielsoffice.wordpress.php@gmail.com>
* @license GPL-2.0+ License
* @link https://github.com/WPExtension/MVCExtension
* @link https://github.com/WPExtension/MVCExtension/blob/main/README.txt
* @link https://linktree.com/nielsoffice
* @version v1.0.0
* @since 08.11.2023
*
*/

if ( ! defined( 'WPINC' ) ) {
die;
}

/**
* Directory VIEW AND MODELS AND CONTROLLER
* Defined constant DIR
Expand Down
42 changes: 42 additions & 0 deletions app/config/config-register-settings.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
<?php

/**
* @copyright (c) 2023 MVCExtensionm v1.0.0 Cooked by nielsoffice
*
* GPL-2.0+ License
*
* PHPWine\VanillaFlavour v1.4.0.0 free software: you can redistribute it and/or modify.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @category PHP MVC Framework for WordPress
* @package Plugin boilterplate by wpbb.me
*
*
* @author Leinner Zednanref <nielsoffice.wordpress.php@gmail.com>
* @license GPL-2.0+ License
* @link https://github.com/WPExtension/MVCExtension
* @link https://github.com/WPExtension/MVCExtension/blob/main/README.txt
* @link https://linktree.com/nielsoffice
* @version v1.0.0
* @since 08.11.2023
*
*/

if ( ! defined( 'WPINC' ) ) {
die;
}

class Settings {

// Load app from apps admin
Expand Down
61 changes: 44 additions & 17 deletions app/config/config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
<?php

/**
* @copyright (c) 2023 MVCExtensionm v1.0.0 Cooked by nielsoffice
*
* GPL-2.0+ License
*
* PHPWine\VanillaFlavour v1.4.0.0 free software: you can redistribute it and/or modify.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @category PHP MVC Framework for WordPress
* @package Plugin boilterplate by wpbb.me
*
*
* @author Leinner Zednanref <nielsoffice.wordpress.php@gmail.com>
* @license GPL-2.0+ License
* @link https://github.com/WPExtension/MVCExtension
* @link https://github.com/WPExtension/MVCExtension/blob/main/README.txt
* @link https://linktree.com/nielsoffice
* @version v1.0.0
* @since 08.11.2023
*
*/

if ( ! defined( 'WPINC' ) ) {
die;
}

define('APP_DBHOST','localhost');
define('APP_DBNAME','postsapp');
define('APP_DBUSER','root');
Expand All @@ -14,22 +56,7 @@
define('BASE_DIR_SYSTEM_FILE', APPROOT . '/' );

// URL ROOT
define('URLROOT', 'http://localhost/apps/wp2/wp-admin/admin.php?page=mvc-extension');
define('URLROOT', 'https://localhost/apps/wp2/wp-admin/admin.php?page=mvc-extension');
// Defined Site name
define('SITENAME','MVC Training/Post app');

/**
* Directory VIEW AND MODELS AND CONTROLLER
* Defined constant DIR
* Date August 10, 2023
* File Path: app/public/<.htaccess >
*
# <.htaccess > RewriteBase /v2/public
# From: RewriteBase /v2/public
# To: htdocs/projectname/public
# Output < inline 4 >: RewriteBase /projectName/public
*
*/


define('SITENAME','MVCExtension');

35 changes: 35 additions & 0 deletions app/controllers/MVCExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
namespace PHPAutoloader\Classes\controllers;

use \PHPAutoloader\Classes\libraries\Controller;
use \PHPAutoloader\Classes\models\Post;

class MVCExtension extends Controller {

private $postModel;

public function __construct() {

$this->postModel = new Post();

add_action('admin_content_extnesion',[$this,'content_extension']);

}

public function content_extension() {

$all = $this->postModel->getPosts();


$data = [
'title' => 'Welcome to Home page',
'description' => 'This is frist app mvc share post' ,
'id' => $all
];

// echo 'Index page load Controller' ;
$this->view('pages/index', $data );

}
}

13 changes: 0 additions & 13 deletions app/controllers/Mvc.php

This file was deleted.

Loading

0 comments on commit 75df966

Please sign in to comment.