Plugin Directory

Changeset 2049205


Ignore:
Timestamp:
03/12/2019 05:25:53 PM (7 years ago)
Author:
ken107
Message:

show when widget is live, let use demo api key to lower adoption barrier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sitespeaker-widget/trunk/sitespeaker.php

    r2049081 r2049205  
    4343
    4444function sitespeaker_main_settings_section_text() {
    45     echo "<div style='max-width: 60em;'>You can find your API key in the SiteSpeaker <a target='_blank' href='https://dashboard.sitespeaker.com/'>dashboard</a> under 'Get Code'.  " .
     45    echo "<p style='max-width: 60em;'>You can find your API key in the SiteSpeaker <a target='_blank' href='https://dashboard.sitespeaker.com/'>dashboard</a> under 'Get Code'.  " .
    4646        "If you don't have an account, you can sign up for one <a target='_blank' href='https://dashboard.sitespeaker.com/?p=SignUp'>here</a>.  " .
    47         "Note: your site domain must be whitelisted in the SiteSpeaker dashboard for the API key to work.  " .
    48         "Once you have generated the embedded code, a 'Listen to this article' button will automatically appear at the top of every post.  " .
    49         "You can modify the appearance of the button by editing the embedded code.</div>";
     47        "Note: your site domain must be whitelisted in the SiteSpeaker dashboard for the API key to work.</p>";
     48
     49    $options = get_option('sitespeaker_settings');
     50    if (!empty($options['code'])) {
     51        echo "<p style='color: #080; font-weight: bold;'>Your widget is LIVE.</p>";
     52    }
     53    else {
     54        echo "<p style='max-width: 60em;'>Once you have generated the embedded code, a 'Listen to this article' button will automatically appear at the top of every post.  " .
     55            "You can modify the appearance of the button by editing the embedded code.</p>";
     56    }
    5057}
    5158
    5259function sitespeaker_settings_key() {
    5360    $options = get_option('sitespeaker_settings');
    54     echo "<input id='sitespeaker_key' name='sitespeaker_settings[api_key]' size='32' type='text' value='{$options['api_key']}' />";
     61    $api_key = $options['api_key'] ?? 'demo';
     62    echo "<input id='sitespeaker_key' name='sitespeaker_settings[api_key]' size='32' type='text' value='{$api_key}' />";
    5563}
    5664
Note: See TracChangeset for help on using the changeset viewer.