$path ) { if ( 'wordpress' === $type ) { $check_file = trailingslashit( $path ) . $target_filename; } else { $check_file = ( 'author' === $key ) ? trailingslashit( $path ) . "{$selected_lang}.po" : trailingslashit( $path ) . "{$slug}-{$selected_lang}.po"; } if ( file_exists( $check_file ) ) { $po_file = $check_file; break; } } } // Structural Directory Containment Validation if ( ! empty( $po_file ) ) { // Fall back to config-level containment rule to maintain consistent trailing slash checks if ( class_exists( 'AF_Translate_Project_Config' ) ) { $is_safe = AF_Translate_Project_Config::validate_file_path_containment( $po_file ); } else { $is_safe = AF_Translate_Path_Validator::validate_containment( $po_file, false ); } if ( ! $is_safe ) { wp_die( esc_html__( 'Security Exception: Target data stream layout points outside authorized system space.', 'af-translate' ) ); } } // Parse PO map structures safely using our isolated extraction engine $strings = ! empty( $po_file ) ? AF_Translate_PO_Processor::parse_file( $po_file ) : array(); $total_count = count( $strings ); $mod_time = ! empty( $po_file ) && file_exists( $po_file ) ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), filemtime( $po_file ) ) : esc_html__( 'Unknown Runtime State', 'af-translate' ); // Set up the appropriate return navigation channel mapping context $target_page = 'af-translate'; if ( 'plugin' === $type ) { $target_page = 'af-translate-plugins'; } elseif ( 'theme' === $type ) { $target_page = 'af-translate-themes'; } // Load the detached HTML template $template_path = plugin_dir_path( __FILE__ ) . 'views/html-editor-workbench.php'; if ( file_exists( $template_path ) ) { include $template_path; } else { echo '

' . esc_html__( 'Critical Exception: Editor workspace layout template not found.', 'af-translate' ) . '

'; } } }