_afterGetFromTbl( $row ) { // You can re-define this method in your own model return $row; } protected function _buildQuery($table = null) { if(!$table) $table = frameWcu::_()->getTable( $this->_tbl ); if(!empty($this->_orderBy)) { $order = $this->_orderBy; if(!empty($this->_sortOrder)) $order .= ' '. strtoupper($this->_sortOrder); $table->orderBy( $order ); } if(!empty($this->_groupBy)) { $table->groupBy( $this->_groupBy ); } if(!empty($this->_limit)) { $table->setLimit( $this->_limit ); } } public function removeGroup($ids) { if(!is_array($ids)) $ids = array($ids); // Remove all empty values $ids = array_filter(array_map('intval', $ids)); if(!empty($ids)) { if(frameWcu::_()->getTable( $this->_tbl )->delete(array('additionalCondition' => 'id IN ('. implode(',', $ids). ')'))) { return true; } else $this->pushError (__('Database error detected', WCU_LANG_CODE)); } else $this->pushError(__('Invalid ID', WCU_LANG_CODE)); return false; } public function clear() { return $this->delete(); // Just delete all } public function delete($params = array()) { if(frameWcu::_()->getTable( $this->_tbl )->delete( $params )) { return true; } else $this->pushError (__('Database error detected', WCU_LANG_CODE)); return false; } public function getById($id) { $data = $this->setWhere(array($this->_idField => $id))->getFromTbl(); return empty($data) ? false : array_shift($data); } public function insert($data) { $data = $this->_dataSave($data, false); $id = frameWcu::_()->getTable( $this->_tbl )->insert( $data ); if($id) { return $id; } $this->pushError(frameWcu::_()->getTable( $this->_tbl )->getErrors()); return false; } public function updateById($data, $id = 0) { if(!$id) { $id = isset($data[ $this->_idField ]) ? (int) $data[ $this->_idField ] : 0; } if($id) { return $this->update($data, array($this->_idField => $id)); } else $this->pushError(__('Empty or invalid ID', WCU_LANG_CODE)); return false; } public function update($data, $where) { $data = $this->_dataSave($data, true); if(frameWcu::_()->getTable( $this->_tbl )->update( $data, $where )) { return true; } $this->pushError(frameWcu::_()->getTable( $this->_tbl )->getErrors()); return false; } protected function _dataSave($data, $update = false) { return $data; } public function getTbl() { return $this->_tbl; } /** * We can re-define this method to not retrive all data - for simple tables */ public function setSimpleGetFields() { return $this; } }
Fatal error: Uncaught Error: Class "modelWcu" not found in /htdocs/wp-content/plugins/woo-currency/modules/options/models/options.php:2 Stack trace: #0 /htdocs/wp-content/plugins/woo-currency/functions.php(61): require() #1 /htdocs/wp-content/plugins/woo-currency/classes/controller.php(53): importWcu('/htdocs/wp-cont...') #2 /htdocs/wp-content/plugins/woo-currency/classes/controller.php(45): controllerWcu->_createModel('options') #3 /htdocs/wp-content/plugins/woo-currency/classes/module.php(171): controllerWcu->getModel('options') #4 /htdocs/wp-content/plugins/woo-currency/modules/options/mod.php(21): moduleWcu->getModel() #5 /htdocs/wp-content/plugins/woo-currency/modules/templates/mod.php(12): optionsWcu->get('use_local_cdn') #6 /htdocs/wp-content/plugins/woo-currency/modules/templates/mod.php(8): templatesWcu->getCdnUrl() #7 /htdocs/wp-content/plugins/woo-currency/classes/frame.php(84): templatesWcu->__construct(Array) #8 /htdocs/wp-content/plugins/woo-currency/classes/frame.php(106): frameWcu->_extractModules() #9 /htdocs/wp-content/plugins/woo-currency/wcu.php(71): frameWcu->init() #10 /htdocs/wp-settings.php(560): include_once('/htdocs/wp-cont...') #11 /htdocs/wp-config.php(107): require_once('/htdocs/wp-sett...') #12 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #13 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #14 /htdocs/index.php(17): require('/htdocs/wp-blog...') #15 {main} thrown in /htdocs/wp-content/plugins/woo-currency/modules/options/models/options.php on line 2