styleid = $styleid; $this->define_user = $user; $this->database = new \OXI_ACCORDIONS_PLUGINS\Helper\Database(); $this->get_data(); endif; } /** * Confirm Transient * * @since 2.0.1 */ public function get_transient() { if ($this->define_user == 'admin') : $response = get_transient('accordions-or-faqs-template-' . $this->styleid); if ($response) : $new = [ 'rawdata' => $response, 'stylesheet' => '', 'font_family' => '' ]; $this->style_table = array_merge($this->style_table, $new); endif; endif; } public function render_html() { $CLASS = '\OXI_ACCORDIONS_PLUGINS\Layouts\Template'; if (class_exists($CLASS)) : new $CLASS($this->style_table, $this->child_table, $this->define_user); endif; } /** * Get Data From Database * * @since 2.0.1 */ public function get_data() { //style Data $this->style_table = $this->database->wpdb->get_row($this->database->wpdb->prepare('SELECT * FROM ' . $this->database->parent_table . ' WHERE id = %d ', $this->styleid), ARRAY_A); if (!is_array($this->style_table)) : return; endif; //Trasient $this->get_transient(); //Child Data $this->child_table = $this->database->wpdb->get_results($this->database->wpdb->prepare("SELECT * FROM {$this->database->child_table} WHERE styleid = %d ORDER by id ASC", $this->styleid), ARRAY_A); $this->render_html(); } }