PluginProbe
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager / 10
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager v10
10.56 1.2.1 10 10.1 10.2 10.3 10.31 10.32 10.33 10.34 10.50 10.51 10.52 10.53 10.55 9.0 9.0.1 9.4 trunk 1.0.0 1.1 1.2
easy-code-manager / framework / ServicesFW / DbTable.abstract.php

DbTable.abstract.php in FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager 10, at framework/ServicesFW/DbTable.abstract.php

94 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 /**
7 *
8 */
9 abstract class CJTServicesTable
10 {
11
12 /**
13 * put your comment there...
14 *
15 * @var wpdb
16 */
17 protected $gateway;
18
19 /**
20 * put your comment there...
21 *
22 * @var mixed
23 */
24 protected $tableName;
25
26 /**
27 * put your comment there...
28 *
29 */
30 public function __construct()
31 {
32 $this->gateway =& $GLOBALS['wpdb'];
33 }
34
35 /**
36 * put your comment there...
37 *
38 */
39 public function getInsertedId()
40 {
41 return $this->gateway->insert_id;
42 }
43
44 /**
45 * put your comment there...
46 *
47 */
48 public static function getInstance()
49 {
50
51 $tableClass = get_called_class();
52
53 $table = new $tableClass();
54
55 return $table;
56 }
57
58 /**
59 * put your comment there...
60 *
61 */
62 public function getTableName()
63 {
64 return "{$this->gateway->prefix}{$this->tableName}";
65 }
66
67 /**
68 * put your comment there...
69 *
70 * @param mixed $query
71 * @param mixed $params
72 */
73 protected function prepare($query, $params = array())
74 {
75
76 # Resolve Table name
77 $query = str_replace('#table#', $this->getTableName(), $query);
78
79 if (!empty($params))
80 {
81
82 # Prepare Query parameters
83 array_unshift($params, $query);
84
85 $query = call_user_func_array(
86
87 array($this->gateway, 'prepare'),
88 $params
89 );
90 }
91
92 return $query;
93 }
94 }