PHP Classes

File: init/init.php

Recommend this page to a friend!
  Classes of Boss Ibrahim Mussa   wepesi PHP Pagination Library   init/init.php   Download  
File: init/init.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: wepesi PHP Pagination Library
Generate pagination for listing of query results
Author: By
Last change:
Date: 7 months ago
Size: 1,533 bytes
 

Contents

Class file image Download
<?php
    session_start
();
   
    require_once
'global.php';
   
//
   
$GLOBALS['config']=array(
       
'mysql'=>array(
           
'host'=> HOST,
           
'username'=> USER,
           
'password'=> PASSWORD,
           
'db'=> DATABASE
       
),
       
'remender'=>array(),
       
'session'=>array(
           
"token_name"=>"token"
       
)
    );
   
    function
getSubDirectories($dir) {
       
$subDir = array();
       
$directories = array_filter(glob($dir), 'is_dir');
       
$subDir = array_merge($subDir, $directories);
        foreach (
$directories as $directory) $subDir = array_merge($subDir, getSubDirectories($directory . '/*'));
        return
$subDir;
    }
   
/**
     * implement autoload module without composer
     */
    // will load all class from the class folder
   
spl_autoload_register(function($className){
       
$check_NameSpace_separator=explode("\\",$className); // explode to get all namespace defined, if there is
       
$len=count($check_NameSpace_separator);//count how much namescpace exist
       
$n_class= $check_NameSpace_separator[$len-1]; // get the last name with is the reel class name
       
$class=str_replace("\\", DIRECTORY_SEPARATOR, $n_class);
       
$dirs = getSubDirectories("class");
        foreach(
$dirs as $dir){
           
$file= $dir."/".str_replace('\\', '/',$class).".php";
            if (
is_file($file)) { // check if the file exist
               
include_once($file); // incluse the file request if it exist
           
}
        }
    });