PluginProbe
CSS & JavaScript Toolbox / 10.1
CSS & JavaScript Toolbox v10.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
← All changes | tables/blocks.php +16 -29 trunk10.1 View file →
@@ -11,31 +11,31 @@
11 11 // CJTTable class.
12 12 require_once CJTOOLBOX_FRAMEWORK . '/db/mysql/table.inc.php';
13 13
14 14 /**
15 -*
15 +*
16 16 * @deprecated Use CJTBlockTable instead!
17 17 */
18 18 class CJTBlocksTable extends CJTTable {
19 -
19 +
20 20 /** */
21 21 const BLOCK_META_BOX_ID_META_NAME = '__CJT-BLOCK-ID';
22 -
22 +
23 23 /** */
24 24 const BLOCK_META_BOX_STATUS_META_NAME = '__CJT-BLOCK-STATUS';
25 -
25 +
26 26 /**
27 27 * put your comment there...
28 - *
28 + *
29 29 */
30 30 public function __construct(&$dbDriver) {
31 31 // Inirialize parent class.
32 32 parent::__construct($dbDriver, cssJSToolbox::$config->database->tables->blocks);
33 33 }
34 -
34 +
35 35 /**
36 36 * put your comment there...
37 - *
37 + *
38 38 * @param mixed $ids
39 39 */
40 40 public function delete($ids = array()) {
41 41 $where = '';
@@ -44,12 +44,12 @@
44 44 }
45 45 $query = "DELETE FROM {$this->table}{$where};";
46 46 $this->dbDriver->delete($query);
47 47 }
48 -
48 +
49 49 /**
50 50 * put your comment there...
51 - *
51 + *
52 52 * @param mixed $ids
53 53 * @param mixed $fields
54 54 * @param mixed $filters
55 55 * @deprecated @param mixed $returnType
@@ -103,22 +103,9 @@
103 103 $blocks[$block->id] = $block;
104 104 }
105 105 return $blocks;
106 106 }
107 -
108 - public function getNextIdNEW($offset = 0)
109 - {
110 - // Get post meta table name.
111 - $blocksTable = $this->dbDriver->getTableName('cjtoolbox_blocks');
112 -
113 - // Get all reserved blocks/metaboxes id associated with posts.
114 - $postMetaName = self::BLOCK_META_BOX_ID_META_NAME;
115 - $query = "SELECT id FROM {$blocksTable} ORDER BY id DESC LIMIT 1;";
116 - // Get all ids.
117 - $currentID = current( array_keys( $this->dbDriver->select($query) ) );
118 -
119 - return $currentID + 1;
120 - }
107 +
121 108 /**
122 109 * Override Parent::getNextId().
123 110 */
124 111 public function getNextId($offset = 0) {
@@ -129,9 +116,9 @@
129 116 $query = "SELECT meta_value as `value`
130 117 FROM {$postMetaTable}
131 118 WHERE meta_key = '{$postMetaName}';";
132 119 // Get all ids.
133 - $reservedIds = array_keys($this->dbDriver->select($query, OBJECT_K));
120 + $reservedIds = array_keys($this->dbDriver->select($query, OBJECT_K));
134 121 // Find a unique Id for the new block.
135 122 do {
136 123 // Increase by one until finding new unique id.
137 124 $nextId = parent::getNextId($offset++);
@@ -138,12 +125,12 @@
138 125 } while(in_array($nextId, $reservedIds));
139 126 // Return new id.
140 127 return $nextId;
141 128 }
142 -
129 +
143 130 /**
144 131 * put your comment there...
145 - *
132 + *
146 133 */
147 134 public function insert($data) {
148 135 // Prepare New Record data.
149 136 $data = $this->prepareQueryParameters($data);
@@ -151,12 +138,12 @@
151 138 // Insert statement.
152 139 $query = "INSERT INTO {$this->table} SET {$data};";
153 140 $this->dbDriver->insert($query);
154 141 }
155 -
142 +
156 143 /**
157 144 * put your comment there...
158 - *
145 + *
159 146 * @param mixed $data
160 147 */
161 148 public function update($block) {
162 149 // Get block id copy.
@@ -172,6 +159,6 @@
172 159 $this->dbDriver->update($query);
173 160 }
174 161 return $this;
175 162 }
176 -
163 +
177 164 } // End class.