155. public function __construct(array $config = [])
156. {
157. $this->defaultConfig = Config::default('ZN\Database\DatabaseDefaultConfiguration')
158. ::get('Database', 'database');
159. $this->config = array_merge($this->defaultConfig, $config);
160. $this->db = $this->runDriver();
161. $this->prefix = $this->config['prefix'];
162. Properties::$prefix = $this->prefix;
163.
164. $this->db->connect($this->config);
165. }
166.
167. /**
168. * Magic Debug Info
169. */
170. public function __debugInfo()
171. {
172. return ['return' => $this->stringQuery ?: 'This is a general object, please call the sub method!'];
173. }
174.
130. public function getindexonecikansmallblog() {
131.
132. return DB::orderBy('id', 'DESC')->where("one_cikan_small", 1)->where("status", 1)->blog()->result();
133. }
134.
135.
136. public function blogcount($cat_id = 0){
137.
138. if($cat_id == 0){
139. return DB::where('status', 1)->select('id')->blog()->totalRows();
140. }else{
141. return DB::where('cat_id', $cat_id)->where('status', 1)->select('id, cat_id')->blog()->totalRows();
142. }
143.
144. }
145.
146.
147.
148. public function getByCategory($cat_id = 0){
149. return DB::orderBy('id', 'ASC')->where('status', 1)->where('cat_id', $cat_id)->blog()->result();
41. * protected use class name
42. *
43. * @param string $method
44. * @param array $parameters
45. *
46. * @return mixed
47. */
48. protected static function useClassName($method, $parameters)
49. {
50. return Singleton::class(INTERNAL_ACCESS . static::getClassName())->$method(...$parameters);
51. }
52. }
15. * Magic call static
16. *
17. * @param string $method
18. * @param array $parameters
19. *
20. * @return mixed
21. */
22. public static function __callStatic($method, $parameters)
23. {
24. return self::useClassName($method, $parameters);
25. }
26.
27. /**
28. * Magic call
29. *
30. * @param string $method
31. * @param array $parameters
32. *
33. * @return mixed
34. */
21. *
22. * Loads opening page.
23. * Location: Views/Home/main.wizard.php
24. */
25. public function main(string ...$parameters)
26. {
27.
28. $page = intval(URI::getByName('page')) ? intval(URI::getByName('page')) : 0 ;
29. $start = $page;
30. $say = BlogModel::blogcount();
31.
32. $blogs = BlogModel::getMainBlog($start, 10);
33. $seo_title = "site_title_".Lang::get();
34. $seo_key = "site_key_".Lang::get();
35. $seo_desc = "site_desc_".Lang::get();
36. $ayar = AyarModel::get();
37. $popblogs = BlogModel::getPopulerBlog();
38. $indexbigpopblogs = BlogModel::getHeaderBlog();
39. $indexsmallpopblogs = BlogModel::getindexsmallpopblog();
40. $indexbigonecikanblogs = BlogModel::getindexonecikanbigblog();
145. // @codeCoverageIgnoreEnd
146. else
147. {
148. $this->connect = new MySQLi($host, $user, $pass, $db, $port);
149. }
150. restore_error_handler();
151.
152. if( $this->connect->connect_errno )
153. {
154. throw new ConnectionErrorException(NULL, $this->connect->connect_error); // @codeCoverageIgnore
155. }
156.
157. mysqli_report(MYSQLI_REPORT_OFF);
158.
159. if( ! empty($this->config['charset'] ) ) $this->query("SET NAMES '".$this->config['charset']."'");
160. if( ! empty($this->config['charset'] ) ) $this->query('SET CHARACTER SET '.$this->config['charset']);
161. if( ! empty($this->config['collation']) ) $this->query('SET COLLATION_CONNECTION = "'.$this->config['collation'].'"');
162. }
163.
164. /**