function getButtons() { // should maybe but a 'light init' of buttons? $selection = $this->data["selection"]; $buttonsArray = array(); if (count($selection) == 0) { return $buttonsArray; } $table = maxUtils::get_buttons_table_name(); $query_selection = $selection; $selectstring = implode($query_selection, ","); $sql = "SELECT DISTINCT * FROM {$table} WHERE id in (" . $selectstring . ")"; global $wpdb; $results = $wpdb->get_results($sql, ARRAY_A); $data_array = array(); foreach ($results as $result) { $data_array[$result['id']] = $result; } foreach ($selection as $button_id) { $button = MB()->getClass("button"); // performance: bypass the set ( = query ) for every button //$button->set($button_id); $data = isset($data_array[$button_id]) ? $data_array[$button_id] : array(); if (count($data) > 0) { maxButtons::buttonLoad(array("button_id" => $button_id)); // central registration - from button $button->setupData($data); } maxButtons::forceNextID(); $buttonsArray[] = $button; } return $buttonsArray; }