/** * Get class instance * * @since 1.3.5 * * @return \Caldera_Forms_Track */ public static function get_instance() { if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Prepare rows to send to remote API * * @since 1.3.5 * * @param $last_row * * @param $highest * * @return array|null */ protected static function prepare_rows_to_send($last_row, $highest) { $ids[] = $last_row + 1; for ($i = 2; $i <= $highest; $i++) { $ids[] = $last_row + $i; } $rows = Caldera_Forms_Track::get_instance()->get_record($ids); if (!empty($rows)) { $fields = Caldera_Forms_Track::get_instance()->get_fields(); $meta_keys = $fields['meta_keys']; foreach ($rows as $i => $row) { $rows[$i]['event_id'] = $row['ID']; unset($rows[$i]['ID']); $rows[$i]['meta'] = array(); foreach ($meta_keys as $meta_key) { if (isset($row[$meta_key])) { $rows[$i]['meta'][$meta_key] = $row[$meta_key]; } unset($rows[$i][$meta_key]); } } return $rows; } return $rows; }