0, 'label' => get_option( 'acquis_button_label', 'Download File' ), 'form' => 0, ), $atts, 'acquisitionsuite_download' ); $file_id = absint( $atts['id'] ); $form_id = absint( $atts['form'] ); $label = sanitize_text_field( $atts['label'] ); // Phase 3: analytics tracking if ( class_exists( 'ACQUIS_P3_DB' ) ) { ACQUIS_P3_DB::track_event( 'form_view', array( 'form_id' => $form_id, 'file_id' => $file_id, 'source_post' => get_the_ID() ?: 0, 'source_url' => get_permalink() ?: home_url( '/' ), 'ip' => sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ?? '' ) ), ) ); } if ( ! $file_id ) { return '

' . esc_html__( '[AcquisitionSuite] No file ID provided.', 'acquisitionsuite' ) . '

'; } $file = ACQUIS_File_Manager::get_file_data( $file_id ); if ( ! $file ) { return '

' . esc_html__( '[AcquisitionSuite] File not found.', 'acquisitionsuite' ) . '

'; } $is_url_file = 'url' === ( $file['source_type'] ?? 'upload' ); $ext = $is_url_file ? '' : strtoupper( esc_html( $file['ext'] ) ); $size = $is_url_file ? '' : ACQUIS_File_Manager::format_bytes( $file['size'] ); $name = esc_html( $file['title'] ); $pay_config = class_exists( 'ACQUIS_Pay_DB' ) ? ACQUIS_Pay_DB::get_file_pay_config( $file_id ) : array( 'download_type' => 'free' ); $is_paid = 'paid' === ( $pay_config['download_type'] ?? 'free' ); if ( $is_paid ) { $label = $pay_config['button_label'] ?: $label; } ob_start(); ?>
get_url_file_icon() : $this->get_file_icon( $file['ext'] ); ?>
• 0 && $sale > 0 && $sale < $regular; $cur = strtoupper( (string) ( $pay_config['currency'] ?? '' ) ); ?> •
'; } private function get_file_icon( $ext ) { $icons = array( 'pdf' => '', 'zip' => '', 'mp4' => '', 'mp3' => '', 'jpg' => '', 'png' => '', ); $ext = strtolower( $ext ); if ( isset( $icons[ $ext ] ) ) return $icons[ $ext ]; // Default document icon return ''; } }