Open Sencillo  2015.107
Long live the simplicity of PHP
 All Data Structures Namespaces Functions Pages
lib_identificator.php
1 <?php
11 class library
12 {
13  protected $all_data_sencillo;
14  protected $readsql;
15  protected $files;
16  protected $modules;
17 
18  public $lib;
19 
23  private function createStructure()
24  {
25  $this->lib=array("id"=>array(),
26  "function"=>array(),
27  "boxid"=>array(),
28  "status"=>array());
29  $this->all_data_sencillo=array("left"=>array(),
30  "center"=>array(),
31  "right"=>array(),
32  "foot"=>array(),
33  "admin"=>array());
34  $this->readsql="SELECT * FROM cms_boxid";
35  $this->files = scandir('./fw_libraries/');
36  if(file_exists("./fw_modules/"))
37  {
38  $this->modules = scandir('./fw_modules/');
39  }
40  }
41 
45  private function openFiles()
46  {
47  foreach($this->files as $value)
48  {
49  $test=(($value!='.')&&($value!='..')&&($value!='lib_identificator.php')&&($value!='examples')?true:false);
50 
51  if(($value!='.')&&($value!='..')&&($value!='lib_identificator.php')&&($value!='examples'))
52  {
53  $this->lib['id'][]=$value;
54  }
55  }
56 
57  foreach($this->lib['id'] as $value)
58  {
59  try
60  {
61  //require("./fw_libraries/".$value);
62  $NAME=explode(".",$value);
63  $MOD_DESC=$NAME[0].','.$NAME[1];
64  $this->lib['name'][]=$NAME[2];
65  $this->lib['function'][]=$MOD_DESC;
66  $this->lib['version'][]=$VERSION;
67  $this->lib['status'][]='OK:'.$value;
68  $this->lib['path'][]="./fw_libraries/".$value;
69  }
70  catch(Exception $e)
71  {
72  $this->lib['status']=array('ERROR:'.$value.':'.$e);
73  }
74  }
75  }
76 
80  private function openModules()
81  {
82  foreach($this->modules as $value)
83  {
84  $test=((file_exists("./fw_modules/".$value."/"))&&($value!='.')&&($value!='..')&&($value!='lib_identificator.php')&&($value!='examples')?true:false);
85 
86  if((file_exists("./fw_modules/".$value."/"))&&($value!='.')&&($value!='..')&&($value!='lib_identificator.php')&&($value!='examples'))
87  {
88  $this->lib['id'][]=$value;
89  }
90  }
91 
92  foreach($this->lib['id'] as $value)
93  {
94  try
95  {
96  $this->lib['name'][]=$value;
97  $this->lib['function'][]='custom_module';
98  $this->lib['status'][]='OK:'.$value;
99  $this->lib['path'][]="./fw_modules/".$value."/info_".$value.".php";//information about module
100  $this->lib['path'][]="./fw_modules/".$value."/update_".$value.".php";//update database for module
101  $this->lib['path'][]="./fw_modules/".$value."/install_".$value.".php";//installer
102  $this->lib['path'][]="./fw_modules/".$value."/main_".$value.".php";//main module
103  $this->lib['path'][]="./fw_modules/".$value."/".$value.".php";//basic module
104  }
105  catch(Exception $e)
106  {
107  $this->lib['status'][]='ERROR:'.$value.':'.$e;
108  }
109  }
110  }
111 
115  public function start()
116  {
117  $this->createStructure();
118  $this->openFiles();
119  $this->openModules();
120  }
121 
126  public function export()
127  {
128  return $this->all_data_sencillo;
129  }
130 
135  public function status()
136  {
137  return $this->lib;
138  }
139 
144  public function exportPath()
145  {
146  return array_unique($this->lib['path']);
147  }
148 }
149 ?>