Plugin Directory

Changeset 3407596


Ignore:
Timestamp:
12/02/2025 07:26:13 AM (3 months ago)
Author:
audiotyped
Message:

Update to version 1.0.6 - removed tab and improved settings handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • podcast-seo/trunk/podcast-seo.php

    r3284751 r3407596  
    55Description: Converts podcast interview transcripts into styled HTML with speech bubbles and avatar support.
    66Author: Helmut Naber
    7 Version: 1.0.5
     7Version: 1.0.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3939// Render the main plugin page with tabs
    4040function 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';
    4243
    4344    echo '<div class="wrap">';
    4445    echo '<h1>Podcast SEO</h1>';
    4546
    46     // Tab Navigation
     47    // Tab Navigation – nur noch Keyword Analysis + Help
    4748    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>';
    5357    }
    5458    echo '</h2>';
    5559
    5660    // 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 ) {
    6462        case 'help':
    6563            audiotyped_podcastseo_help();
    6664            break;
     65
     66        case 'keyword_analysis':
    6767        default:
    68             audiotyped_podcastseo_transcript_html();
     68            audiotyped_podcastseo_keyword_analysis();
    6969            break;
    7070    }
    7171
    7272    echo '</div>';
    73 }
    74 
    75 // Tab content for Transcript HTML
    76 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 here
    86         $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     }
    11073}
    11174
Note: See TracChangeset for help on using the changeset viewer.