Plugin Directory

Changeset 1773370


Ignore:
Timestamp:
11/22/2017 05:51:48 PM (8 years ago)
Author:
poliuk
Message:

v1.0.1 released: "env" variable added to advanced settings

Location:
wp-pwa
Files:
16 added
5 edited

Legend:

Unmodified
Added
Removed
  • wp-pwa/trunk/admin/js/wp-pwa-admin.js

    r1773084 r1773370  
    196196        data: {
    197197            action: 'wp_pwa_change_advanced_settings',
     198            wp_pwa_env: jQuery('select#wp-pwa-env').find(":selected").val(),
    198199            wp_pwa_ssr: jQuery('input#wp-pwa-ssr').val(),
    199200            wp_pwa_static: jQuery('input#wp-pwa-static').val()
  • wp-pwa/trunk/admin/wp-pwa-admin-page.php

    r1773084 r1773370  
    319319                    <table class="form-table">
    320320                        <tr>
     321                            <th scope="row">Enviroment</th>
     322                            <td>
     323                                    <fieldset>
     324                                            <label>
     325                                                    <select id="wp-pwa-env">
     326                                                        <?php
     327                                                            $options = array( 'pre', 'prod');
     328                                                            $env = $settings['wp_pwa_env'];
     329                                                            $output = '';
     330                                                            for( $i=0; $i<count($options); $i++ ) {
     331                                                                $output .= '<option '
     332                                                                . ( $env == $options[$i] ? 'selected="selected"' : '' ) . '>'
     333                                                                . $options[$i]
     334                                                                . '</option>';
     335                                                            }
     336                                                            echo $output;
     337                                                        ?>
     338                                                    </select>
     339                                            </label>
     340                                    </fieldset>
     341                            </td>
     342                        </tr>
     343                        <tr>
    321344                            <th scope="row">SSR Server</th>
    322345                            <td>
  • wp-pwa/trunk/injector/wp-pwa-injector.php

    r1773084 r1773370  
    7979}
    8080
     81if (isset($_GET['env']) && ($_GET['env'] === 'pre' || $_GET['env'] === 'prod')) {
     82  $env = $_GET['env'];
     83} elseif (isset($settings['wp_pwa_env'])) {
     84  $env = $settings['wp_pwa_env'];
     85}
     86
    8187if (isset($_GET['ssr'])) {
    8288  $ssr = $_GET['ssr'];
     
    94100}
    95101
    96 if ((isset($_GET['env']) && ($_GET['env'] === 'pre'))) {
    97   $env = 'pre';
    98 }
    99102?>
    100103
  • wp-pwa/trunk/readme.txt

    r1773084 r1773370  
    2323== Changelog ==
    2424
     25= 1.0.1 =
     26* Added "env" variable to advanced settings.
     27
    2528= 1.0.0 =
    2629* First release of the plugin.
    2730
    28 == Useful Links ==
    29 
    3031== Upgrade Notice ==
  • wp-pwa/trunk/wp-pwa.php

    r1773084 r1773370  
    44Plugin URI: https://wordpress.org/plugins/wordpress-pwa/
    55Description: WordPress plugin to turn WordPress blogs into Progressive Web Apps.
    6 Version: 1.0.0
     6Version: 1.0.1
    77Author: WordPress PWA
    88Author URI:
     
    358358    function change_advanced_settings_ajax() {
    359359
     360        $wp_pwa_env = $_POST['wp_pwa_env'];
    360361        $wp_pwa_ssr = $_POST['wp_pwa_ssr'];
    361362        $wp_pwa_static = $_POST['wp_pwa_static'];
    362363
    363364        $settings = get_option('wp_pwa_settings');
     365        $settings['wp_pwa_env'] = $wp_pwa_env;
    364366        $settings['wp_pwa_ssr'] = $wp_pwa_ssr;
    365367        $settings['wp_pwa_static'] = $wp_pwa_static;
     
    496498    }
    497499
     500    if (isset($settings['wp_pwa_env'])) {
     501        $wp_pwa_env = $settings['wp_pwa_env'];
     502    } else {
     503        $wp_pwa_env = 'prod';
     504    }
     505
    498506    if (isset($settings['wp_pwa_ssr'])) {
    499507        $wp_pwa_ssr = $settings['wp_pwa_ssr'];
     
    510518    $defaults = array("synced_with_wp_pwa" => $synced_with_wp_pwa,
    511519                                        "wp_pwa_siteid" => $siteId,
     520                                        "wp_pwa_env" => $wp_pwa_env,
    512521                                        "wp_pwa_ssr" => $wp_pwa_ssr,
    513522                                        "wp_pwa_static" => $wp_pwa_static);
Note: See TracChangeset for help on using the changeset viewer.