get_material_by_item_id( $thepostid, 0, 0, 1 ) ?? []; $max_file_size = (int) LP_Settings::get_option( 'material_max_file_size', 2 ); $allow_upload_amount = (int) LP_Settings::get_option( 'material_upload_files', 2 ); // check file was uploaded $uploaded_files = count( $course_materials ); // check file amount which can upload $can_upload = $allow_upload_amount - $uploaded_files; $allow_file_type = LP_Settings::get_option( 'material_allow_file_type', array( 'pdf', 'txt' ) ); $accept = ''; $accept_file_type = implode( ', ', $allow_file_type ); $material_mime_types = LP_Settings::lp_material_file_types(); foreach ( $allow_file_type as $ext ) { $accept .= $material_mime_types[ $ext ] . ','; } $accept = rtrim( $accept, ',' ); ?>

delete_material_by_item_id( $post_id ); } catch ( Throwable $e ) { error_log( __METHOD__ . ': ' . $e->getMessage() ); } } /** * Get instance * * @return LP_Addon_Custom_Tab_Meta_Field */ public static function instance(): LP_Meta_Box_Material_Fields { if ( ! self::$instance ) { self::$instance = new self(); } return self::$instance; } } LP_Meta_Box_Material_Fields::instance(); }