Changeset 3407596
- Timestamp:
- 12/02/2025 07:26:13 AM (3 months ago)
- File:
-
- 1 edited
-
podcast-seo/trunk/podcast-seo.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
podcast-seo/trunk/podcast-seo.php
r3284751 r3407596 5 5 Description: Converts podcast interview transcripts into styled HTML with speech bubbles and avatar support. 6 6 Author: Helmut Naber 7 Version: 1.0. 57 Version: 1.0.6 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 39 39 // Render the main plugin page with tabs 40 40 function audiotyped_podcastseo_render_page() { 41 $tab = isset($_GET['tab']) ? $_GET['tab'] : 'transcript_html'; // Default to 'Transcript HTML' tab 41 // Sicherheitshalber etwas sanitizen 42 $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : 'keyword_analysis'; 42 43 43 44 echo '<div class="wrap">'; 44 45 echo '<h1>Podcast SEO</h1>'; 45 46 46 // Tab Navigation 47 // Tab Navigation – nur noch Keyword Analysis + Help 47 48 echo '<h2 class="nav-tab-wrapper">'; 48 $tabs = ['transcript_html' => 'Transcript HTML', 'keyword_analysis' => 'Keyword Analysis', 'help' => 'Help']; 49 50 foreach ($tabs as $key => $label) { 51 $class = ($tab == $key) ? ' nav-tab-active' : ''; // Highlight the active tab 52 echo '<a href="?page=podcast-seo&tab=' . $key . '" class="nav-tab' . $class . '">' . $label . '</a>'; 49 $tabs = array( 50 'keyword_analysis' => 'Keyword Analysis', 51 'help' => 'Help', 52 ); 53 54 foreach ( $tabs as $key => $label ) { 55 $class = ( $tab === $key ) ? ' nav-tab-active' : ''; 56 echo '<a href="?page=podcast-seo&tab=' . esc_attr( $key ) . '" class="nav-tab' . $class . '">' . esc_html( $label ) . '</a>'; 53 57 } 54 58 echo '</h2>'; 55 59 56 60 // Tab Content 57 switch ($tab) { 58 case 'transcript_html': 59 audiotyped_podcastseo_transcript_html(); 60 break; 61 case 'keyword_analysis': 62 audiotyped_podcastseo_keyword_analysis(); 63 break; 61 switch ( $tab ) { 64 62 case 'help': 65 63 audiotyped_podcastseo_help(); 66 64 break; 65 66 case 'keyword_analysis': 67 67 default: 68 audiotyped_podcastseo_ transcript_html();68 audiotyped_podcastseo_keyword_analysis(); 69 69 break; 70 70 } 71 71 72 72 echo '</div>'; 73 }74 75 // Tab content for Transcript HTML76 function audiotyped_podcastseo_transcript_html() {77 $transcript = '';78 $host_name = '';79 $guest_name = '';80 $host_img = '';81 $guest_img = '';82 $generated_html = '';83 84 if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && check_admin_referer('audiotyped_transcript_save_form') && current_user_can('manage_options')) {85 // Nonce validation and capability check performed here86 $transcript = stripslashes(sanitize_textarea_field(wp_unslash($_POST['transcript'] ?? '')));87 $host_name = sanitize_text_field(wp_unslash($_POST['host_name'] ?? ''));88 $guest_name = sanitize_text_field(wp_unslash($_POST['guest_name'] ?? ''));89 $host_img = esc_url_raw(wp_unslash($_POST['host_img'] ?? ''));90 $guest_img = esc_url_raw(wp_unslash($_POST['guest_img'] ?? ''));91 $generated_html = audiotyped_podcastseo_generate_html($transcript, $host_name, $guest_name, $host_img, $guest_img);92 }93 94 echo '<h3>Generate HTML for Interview Transcript</h3>';95 echo '<form method="post">';96 wp_nonce_field('audiotyped_transcript_save_form');97 echo 'Host Name: <input type="text" name="host_name" value="' . esc_attr($host_name) . '" style="width: 100%;"><br>';98 echo 'Guest Name: <input type="text" name="guest_name" value="' . esc_attr($guest_name) . '" style="width: 100%;"><br>';99 echo 'Host Avatar URL: <input type="text" name="host_img" value="' . esc_url($host_img) . '" style="width: 100%;"><br>';100 echo 'Guest Avatar URL: <input type="text" name="guest_img" value="' . esc_url($guest_img) . '" style="width: 100%;"><br>';101 echo '<br><strong>Transcript Input:</strong><br>';102 echo '<textarea name="transcript" style="width:100%; height:200px;">' . html_entity_decode($transcript) . '</textarea>';103 echo '<br><input type="submit" class="button button-primary" value="Generate HTML">';104 echo '</form>';105 if (!empty($generated_html)) {106 echo '<h2>Generated HTML:</h2>';107 echo '<button onclick="copyToClipboard()" class="button button-secondary">📋 Copy HTML</button><br><br>';108 echo '<textarea id="generated_html" style="width:80%; height:400px; font-family:monospace;">' . html_entity_decode($generated_html) . '</textarea>';109 }110 73 } 111 74
Note: See TracChangeset
for help on using the changeset viewer.