Plugin Directory

Changeset 1895519


Ignore:
Timestamp:
06/20/2018 04:50:34 AM (8 years ago)
Author:
olasearch
Message:

ability to use different servers using dev option

Location:
olasearch/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • olasearch/trunk/README.txt

    r1894890 r1895519  
    66Tested up to: 4.9.4
    77Requires PHP: 5.2.4
    8 Stable tag: 2.0.3
     8Stable tag: 2.0.4
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8888== Changelog ==
    8989
    90 = [2.0.3] 2018-06-14 =
     90= [2.0.4] 2018-06-20 =
     91
     92* Feature - bug fixes
     93
     94= [2.0.3] 2018-06-19 =
    9195
    9296* Compatibility - Now supports The Events Calendar Version 4.1 and above
  • olasearch/trunk/admin/class-olasearch-admin.php

    r1892543 r1895519  
    5252     */
    5353    const OLA_HOST = 'https://admin.olasearch.com';
     54    const OLA_HOST_INTERNAL = 'https://admin-staging.olasearch.com';
     55    const OLA_HOST_LOCAL = 'http://localhost:3333';
     56
     57    const OLA_ASSET_HOST = 'https://cdn.olasearch.com';
     58    const OLA_ASSET_HOST_INTERNAL = 'https://s3-ap-southeast-1.amazonaws.com/configs.internal.olasearch.com';
     59    const OLA_ASSET_HOST_LOCAL = 'https://s3-ap-southeast-1.amazonaws.com/configs.local.olasearch.com';
     60
     61    const OLA_SERVER = 'production';
     62    const OLA_SERVER_INTERNAL = 'internal';
     63    const OLA_SERVER_LOCAL = 'local';
     64
    5465    const OLA_ENVIRONMENT = 'production';
     66
    5567    const API_KEY_LABEL = 'API Key';
    5668    const SETTINGS_TAB = 'olasearch';
     
    320332        }
    321333
     334        if ( ! empty( $input['api_server'] ) ) {
     335            $valid['api_server'] = sanitize_text_field( $input['api_server'] );
     336        }
     337
    322338        if ( empty( $valid['api_key'] ) && ( empty( $_GET['page'] || $_GET['page'] == self::SETTINGS_TAB ) ) ) {
    323339            $error = 'Please provide a valid ' . self::API_KEY_LABEL;
     
    822838                }
    823839                $options['enable_search'] = $input['enable_search'];
     840                if ( isset( $input['api_server'] ) ) {
     841                    $options['api_server'] = $input['api_server'];
     842                }
    824843                break;
    825844
  • olasearch/trunk/admin/partials/olasearch-admin-display-olasearch.php

    r1846062 r1895519  
    4444                            <br>
    4545                        </li>
     46                        <?php if ( isset($_GET['server']) ) { ?>
     47                            <li>
     48                                <fieldset>
     49                                    <label><strong>Server:</strong></label><?php echo $this->options['api_server']; ?>
     50                                    <legend class="screen-reader-text"><span>Production</span></legend>
     51                                    <label for="api_server_production">
     52                                        <input type="radio" id="api_server_production" name="api_server" value="<?php echo OlaSearch_Admin::OLA_SERVER ?>" <?php echo !isset( $this->options['api_server'] ) || $this->options['api_server'] == OlaSearch_Admin::OLA_SERVER ? 'checked' : '' ?>>
     53                                        <span>Production</span>
     54                                    </label>
     55
     56                                    <legend class="screen-reader-text"><span>Internal</span></legend>
     57                                    <label for="api_server_internal">
     58                                        <input type="radio" id="api_server_internal" name="api_server" value="<?php echo OlaSearch_Admin::OLA_SERVER_INTERNAL ?>" <?php echo isset( $this->options['api_server'] ) && $this->options['api_server'] == OlaSearch_Admin::OLA_SERVER_INTERNAL ? 'checked' : '' ?>>
     59                                        <span>Internal</span>
     60                                    </label>
     61
     62                                    <legend class="screen-reader-text"><span>Local</span></legend>
     63                                    <label for="api_server_local">
     64                                        <input type="radio" id="api_server_local" name="api_server" value="<?php echo OlaSearch_Admin::OLA_SERVER_LOCAL ?>" <?php echo isset( $this->options['api_server'] ) && $this->options['api_server'] == OlaSearch_Admin::OLA_SERVER_LOCAL ? 'checked' : '' ?>>
     65                                        <span>Local</span>
     66                                    </label>
     67                                </fieldset>
     68                            </li>
     69                        <?php } ?>
    4670                        <li>
    4771                            <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
  • olasearch/trunk/includes/class-olasearch-indexer.php

    r1894890 r1895519  
    5959
    6060    public static function ola_host() {
    61         return OlaSearch_Admin::OLA_HOST;
     61        $options = static::options();
     62        if ( isset( $options['api_server'] ) && $options['api_server'] == OlaSearch_Admin::OLA_SERVER_INTERNAL ) {
     63            return OlaSearch_Admin::OLA_HOST_INTERNAL;
     64        } else if ( isset( $options['api_server'] ) && $options['api_server'] == OlaSearch_Admin::OLA_SERVER_LOCAL ) {
     65            return OlaSearch_Admin::OLA_HOST_LOCAL;
     66        } else {
     67            return OlaSearch_Admin::OLA_HOST;
     68        }
    6269    }
    6370
    6471    public static function ola_env() {
    6572        return OlaSearch_Admin::OLA_ENVIRONMENT;
     73    }
     74
     75    public static function ola_asset_host() {
     76        $options = static::options();
     77        if ( isset( $options['api_server'] ) && $options['api_server'] == OlaSearch_Admin::OLA_SERVER_INTERNAL ) {
     78            return OlaSearch_Admin::OLA_ASSET_HOST_INTERNAL;
     79        } else if ( isset( $options['api_server'] ) && $options['api_server'] == OlaSearch_Admin::OLA_SERVER_LOCAL ) {
     80            return OlaSearch_Admin::OLA_ASSET_HOST_LOCAL;
     81        } else {
     82            return OlaSearch_Admin::OLA_ASSET_HOST;
     83        }
    6684    }
    6785
  • olasearch/trunk/includes/class-olasearch.php

    r1894890 r1895519  
    7070
    7171        $this->plugin_name = 'olasearch';
    72         $this->version     = '2.0.3';
     72        $this->version     = '2.0.4';
    7373
    7474        $this->load_dependencies();
  • olasearch/trunk/olasearch.php

    r1894890 r1895519  
    1717 * Plugin URI:        https://olasearch.com/products/searchbot-wordpress
    1818 * Description:       Use our conversational searchbot to increase engagement by allowing your visitors to find and explore more of your website.
    19  * Version:           2.0.3
     19 * Version:           2.0.4
    2020 * Author:            Ola Search
    2121 * Author URI:        https://olasearch.com
  • olasearch/trunk/public/class-olasearch-public.php

    r1892543 r1895519  
    231231        wp_enqueue_script(
    232232            $this->plugin_name,
    233             esc_url_raw( 'https://cdn.olasearch.com/' . OlaSearch_Indexer::ola_env() . '/' . OlaSearch_Indexer::api_key() . '/olasearch.min.js' )
     233            esc_url_raw( OlaSearch_Indexer::ola_asset_host() . '/' . OlaSearch_Indexer::ola_env() . '/' . OlaSearch_Indexer::api_key() . '/olasearch.min.js' )
    234234        );
    235235    }
Note: See TracChangeset for help on using the changeset viewer.