PluginProbe
CSS & JavaScript Toolbox / 9.3.1
CSS & JavaScript Toolbox v9.3.1
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / framework / installer / dbfile.class.php

dbfile.class.php in CSS & JavaScript Toolbox 9.3.1, at framework/installer/dbfile.class.php

104 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 /**
10 *
11 */
12 class CJTDBFileInstaller {
13
14 /**
15 * put your comment there...
16 *
17 * @var mixed
18 */
19 protected $file;
20
21 /**
22 * put your comment there...
23 *
24 * @var mixed
25 */
26 protected $name;
27
28 /**
29 * put your comment there...
30 *
31 * @var mixed
32 */
33 protected $statements;
34
35 /**
36 * put your comment there...
37 *
38 * @param mixed $file
39 * @param mixed $name
40 * @return CJTDBFileInstaller
41 */
42 public function __construct($file, $name= null) {
43 // Get content of the file!
44 $this->file = is_file($file) ? file_get_contents($file) : $file;
45 $this->name = $name;
46 // Parse DB file ststements!
47 $this->parse();
48 }
49
50 /**
51 * put your comment there...
52 *
53 */
54 public function exec() {
55 // Initialize!
56 $driver = cssJSToolbox::getInstance()->getDBDriver();
57 // Execute all statements!
58 foreach ($this->statements as $statement) {
59 // Terminate the statement with ;
60 $statement = "{$statement};";
61 // Execute statement!
62 $driver->exec($statement);
63 }
64 }
65
66 /**
67 * put your comment there...
68 *
69 * @param mixed $file
70 * @param mixed $name
71 */
72 public static function getInstance($file, $name = null) {
73 return new CJTDBFileInstaller($file, $name);
74 }
75
76 /**
77 * put your comment there...
78 *
79 */
80 public function getName() {
81 return $this->name;
82 }
83
84 /**
85 * put your comment there...
86 *
87 */
88 protected function parse() {
89 // Initialize!
90 $statementEndChar = ';';
91 // SIMPLY! get statements!
92 $this->statements = explode($statementEndChar, $this->file);
93 }
94
95 /**
96 * put your comment there...
97 *
98 */
99 public function &statements() {
100 return $this->statements;
101 }
102
103 } // End class.
104