storage = $storage; } /** * Add product data tab. * * @param array> $tabs Tabs. * @return array> */ public function add_tab( $tabs ) { $tabs['try3d'] = array( 'label' => __( '3D & AR', 'try3d-viewer' ), 'target' => 'try3d_product_data', 'class' => array( 'show_if_simple', 'show_if_variable', 'show_if_subscription', 'show_if_variable_subscription' ), 'priority' => 75, ); return $tabs; } /** * Render 3D settings panel on WooCommerce product edit screen. * * @return void */ public function render_panel() { global $post; $post_id = $post instanceof WP_Post ? (int) $post->ID : 0; $token = (string) get_post_meta( $post_id, Try3D_Model_Repository::META_TOKEN, true ); $filename = (string) get_post_meta( $post_id, Try3D_Model_Repository::META_FILENAME, true ); $hd_token = (string) get_post_meta( $post_id, Try3D_Model_Repository::META_HD_TOKEN, true ); $hd_filename = (string) get_post_meta( $post_id, Try3D_Model_Repository::META_HD_FILENAME, true ); $fixed = 'yes' === get_post_meta( $post_id, Try3D_Model_Repository::META_AR_FIXED, true ); $btn_text = (string) get_post_meta( $post_id, Try3D_Model_Repository::META_BUTTON_TEXT, true ); ?> ID : 0; $token = (string) get_post_meta( $id, Try3D_Model_Repository::META_TOKEN, true ); $filename = (string) get_post_meta( $id, Try3D_Model_Repository::META_FILENAME, true ); $hd_token = (string) get_post_meta( $id, Try3D_Model_Repository::META_HD_TOKEN, true ); $hd_filename = (string) get_post_meta( $id, Try3D_Model_Repository::META_HD_FILENAME, true ); $color = (string) get_post_meta( $id, Try3D_Model_Repository::META_COLOR, true ); $tinted = (bool) preg_match( '/^#[0-9a-fA-F]{6}$/', $color ); $index = (int) $loop; ?>

render_file_field( 'try3d_variation_token[' . $index . ']', 'try3d_variation_filename[' . $index . ']', $token, $filename ); ?>

render_file_field( 'try3d_variation_hd_token[' . $index . ']', 'try3d_variation_hd_filename[' . $index . ']', $hd_token, $hd_filename ); ?>

storage->is_valid_token( $token ) && $this->storage->exists( $token ); $label = $filename; if ( $known ) { $info = $this->storage->inspect( $token ); if ( ! is_wp_error( $info ) ) { $label = trim( $filename . ' (' . size_format( (int) $info['size'] ) . ')' ); } } elseif ( '' !== $token ) { $label = __( 'File not found. Upload it again.', 'try3d-viewer' ); $token = ''; } ?>