Plugin Directory

Changeset 2776279


Ignore:
Timestamp:
08/26/2022 07:50:54 PM (4 years ago)
Author:
allanjardine
Message:

Release 1.2.0

Location:
cloudtables/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • cloudtables/trunk/Api.php

    r2726861 r2776279  
    1111    private $_key;
    1212    private $_roles = [];
    13     private $_secure = true;
     13    private $_ssl = true;
     14    private $_selfSigned = false;
    1415    private $_subdomain;
    1516    private $_clientId = null;
     
    5253        }
    5354
    54         if ($options && isset($options['secure'])) {
    55             $this->_secure = $options['secure'];
     55        if ($options && isset($options['ssl'])) {
     56            $this->_ssl = $options['ssl'];
     57        }
     58
     59        if ($options && isset($options['selfSigned'])) {
     60            $this->_selfSigned = $options['selfSigned'];
    5661        }
    5762
     
    177182
    178183        return [
    179             'url' => "https://{$this->_subdomain}.{$this->_domain}/loader/{$datasetId}/table/{$style}?insert=".$rnd,
     184            'url' => $this->_url("/loader/{$datasetId}/table/{$style}?insert=".$rnd),
    180185            'unique' => $rnd,
    181186            'token' => $token
     
    211216            $response = wp_remote_get( $url, [
    212217                'body' => $data,
    213                 'sslverify' => $this->_secure
     218                'sslverify' => ! $this->_selfSigned
    214219            ] );
    215220        }
     
    217222            $response = wp_remote_post( $url, [
    218223                'body' => $data,
    219                 'sslverify' => $this->_secure
     224                'sslverify' => ! $this->_selfSigned
    220225            ] );
    221226        }
     
    224229        $json = json_decode($result, true);
    225230
    226         if (! $json['success']) {
    227             echo 'Warning - CloudTables error: ' . json_encode($json['errors']);
    228         }
    229         return $json;
     231        return $json && isset($json['success'])
     232            ? $json
     233            : false;
    230234    }
    231235   
     
    237241     */
    238242    private function _url($path) {
    239         return 'https://' . $this->_subdomain . '.' . $this->_domain . $path;
     243        $protocol = $this->_ssl
     244            ? 'https://'
     245            : 'http://';
     246        $host = $this->_subdomain
     247            ? $this->_subdomain.'.'.$this->_domain
     248            : $this->_domain.'/io';
     249
     250        return $protocol . $host . $path;
    240251    }
    241252}
    242 
  • cloudtables/trunk/build/index.asset.php

    r2324965 r2776279  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-polyfill'), 'version' => '99468db0ad12f617dc410854b66f9789');
     1<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-polyfill'), 'version' => '6017cc5a1b7daa34111f0d85e76d4d96');
  • cloudtables/trunk/build/index.js

    r2324965 r2776279  
    1 !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(2),l=n(3),a=n(1);Object(o.registerBlockType)("cloudtables/table-block",{title:"CloudTable",icon:"cloud",category:"layout",attributes:{apikey:{type:"string"},datasetId:{type:"string"}},edit:function(e){var t=e.attributes.datasetId||"",n=e.attributes.apikey||"",o=window.cloudtables_data.datasets.map((function(e){return{label:e.name,value:e.id}}));o.unshift({label:"No data set selected",value:""});var i=o.find((function(e){return e.value===t})).label,u={background:'url("'+window.cloudtables_data.img_path+'/logo.png") no-repeat top center',paddingTop:"50px",textAlign:"center"};return[Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)(a.PanelBody,{title:"Properties"},Object(r.createElement)(a.PanelRow,null,Object(r.createElement)(a.SelectControl,{label:"Data set",value:t,options:o,onChange:function(t){return e.setAttributes({datasetId:t})}})),Object(r.createElement)(a.PanelRow,null,Object(r.createElement)(a.TextControl,{label:"API key (optional)",value:n,onChange:function(t){return e.setAttributes({apikey:t})},help:"If you wish to use a specific API key for clients accessing this CloudTable, please set it here. Otherwise, leave this field empty to use the default specified in Settings."})))),Object(r.createElement)("div",{style:u},Object(r.createElement)("p",null,i))]},save:function(e){var t=e.attributes.datasetId||"",n=e.attributes.apikey||"",o=t?'[cloudtable id="'+t+'"':"";return n&&(o+=' key="'+n+'"'),o+="]",Object(r.createElement)("div",null,Object(r.createElement)("p",null,o))}})}]);
     1!function(e){var t={};function n(o){if(t[o])return t[o].exports;var l=t[o]={i:o,l:!1,exports:{}};return e[o].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(o,l,function(t){return e[t]}.bind(null,l));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.blockEditor},function(e,t,n){"use strict";n.r(t);var o=n(0),l=n(2),a=n(3),r=n(1);Object(l.registerBlockType)("cloudtables/table-block",{title:"CloudTable",icon:"cloud",category:"layout",attributes:{apikey:{type:"string"},datasetId:{type:"string"},conditions:{type:"string"}},edit:function(e){var t=e.attributes.datasetId||"",n=e.attributes.apikey||"",l=e.attributes.conditions||"",i=window.cloudtables_data.datasets.map((function(e){return{label:e.name,value:e.id}}));i.unshift({label:"No data set selected",value:""});var u=i.find((function(e){return e.value===t})).label,c={background:'url("'+window.cloudtables_data.img_path+'/logo.png") no-repeat top center',paddingTop:"50px",textAlign:"center"};return[Object(o.createElement)(a.InspectorControls,null,Object(o.createElement)(r.PanelBody,{title:"Properties"},Object(o.createElement)(r.PanelRow,null,Object(o.createElement)(r.SelectControl,{label:"Data set",value:t,options:i,onChange:function(t){return e.setAttributes({datasetId:t})}})),Object(o.createElement)(r.PanelRow,null,Object(o.createElement)(r.TextControl,{label:"API key (optional)",value:n,onChange:function(t){return e.setAttributes({apikey:t})},help:"If you wish to use a specific API key for clients accessing this CloudTable, please set it here. Otherwise, leave this field empty to use the default specified in Settings."})),Object(o.createElement)(r.PanelRow,null,Object(o.createElement)(r.TextControl,{label:"Conditional data loading (optional)",value:l,onChange:function(t){return e.setAttributes({conditions:t})},help:"JSON configuration that can be used to load conditional data. See the documentation on CloudTables.com for full details."})))),Object(o.createElement)("div",{style:c},Object(o.createElement)("p",null,u))]},save:function(e){var t=e.attributes.datasetId||"",n=e.attributes.apikey||"",l=e.attributes.conditions||"",a=t?'[cloudtable id="'+t+'"':"";return n&&(a+=' key="'+n+'"'),l&&(a+=' conditions="'+l.replace(/"/g,"&quot;")+'"'),a+="]",Object(o.createElement)("div",null,Object(o.createElement)("p",null,a))}})}]);
  • cloudtables/trunk/cloudtables.php

    r2726861 r2776279  
    77 * Requires PHP: 5.4
    88 * Author: SpryMedia Ltd
    9  * Version: 1.0.0
     9 * Version: 1.2.0
    1010 * License: GPLv2 or later
    1111 */
     
    2929     */
    3030    public function __construct() {
    31         add_shortcode('cloudtable', [$this, 'shortcode']);
     31        add_shortcode('cloudtable', function($atts, $content, $sc) {
     32            return $this->shortcode($atts, $content, $sc);
     33        });
    3234        add_action( 'init', [$this, 'register_block'] );
    3335        add_action( 'enqueue_block_editor_assets', [$this, 'editor_variables'] );
     
    8789     */
    8890    public function admin_page() {
     91        $opts = $this->_cloudtables_options;
     92
    8993        ?>
    9094        <div class="wrap">
     
    100104                ?>
    101105            </form>
     106            <script type="text/javascript">
     107                function ctSelectsDisplay() {
     108                    var type = jQuery('#type').val();
     109                    var ssl = jQuery('#ssl').val();
     110                   
     111                    if (type === 'hosted') {
     112                        jQuery('#subdomain').closest('tr').css('display', 'table-row');
     113                        jQuery('#host').closest('tr').css('display', 'none');
     114                        jQuery('#port').closest('tr').css('display', 'none');
     115                        jQuery('#ssl').closest('tr').css('display', 'none');
     116                    }
     117                    else {
     118                        jQuery('#subdomain').closest('tr').css('display', 'none');
     119                        jQuery('#host').closest('tr').css('display', 'table-row');
     120                        jQuery('#port').closest('tr').css('display', 'table-row');
     121                        jQuery('#ssl').closest('tr').css('display', 'table-row');
     122                    }
     123
     124                    if (ssl === 'enabled') {
     125                        jQuery('#self_signed').closest('tr').css('display', 'table-row');
     126                    }
     127                    else {
     128                        jQuery('#self_signed').closest('tr').css('display', 'none');
     129                    }
     130                }
     131
     132                jQuery(document).ready(function(){
     133                    ctSelectsDisplay();
     134
     135                    jQuery('select.ct-select').on('change', function () {
     136                        ctSelectsDisplay();
     137                    });
     138                });
     139            </script>
     140            <style>
     141                div.ct-help {
     142                    max-width: 350px;
     143                    font-size: 0.8em;
     144                }
     145            </style>
    102146            <?php
    103147                $this->_display_datasets();
     
    115159            array( $this, function ($input) {
    116160                $sanitary_values = array();
    117 
    118                 if ( isset( $input['apikey'] ) ) {
    119                     $sanitary_values['apikey'] = sanitize_text_field( $input['apikey'] );
    120                 }
    121 
    122                 if ( isset( $input['apikey_editor'] ) ) {
    123                     $sanitary_values['apikey_editor'] = sanitize_text_field( $input['apikey_editor'] );
    124                 }
    125 
    126                 if ( isset( $input['subdomain'] ) ) {
    127                     $sanitary_values['subdomain'] = sanitize_text_field( $input['subdomain'] );
     161                $names = array(
     162                    'apikey',
     163                    'apikey_editor',
     164                    'type',
     165                    'subdomain',
     166                    'host',
     167                    'port',
     168                    'ssl',
     169                    'self_signed'
     170                );
     171
     172                for ($i=0 ; $i<count($names) ; $i++) {
     173                    if ( isset( $input[$names[$i]] ) ) {
     174                        $sanitary_values[$names[$i]] = sanitize_text_field( $input[$names[$i]] );
     175                    }
    128176                }
    129177
     
    135183            'cloudtables_setting_section', // id
    136184            'Settings', // title
    137             array( $this, 'cloudtables_section_info' ), // callback
     185            function () {},
    138186            'cloudtables-admin' // page
    139187        );
    140188
    141189        add_settings_field(
    142             'subdomain', // id
    143             'Sub-domain', // title
    144             array( $this, 'field_subdomain' ), // callback
    145             'cloudtables-admin', // page
    146             'cloudtables_setting_section' // section
    147         );
    148 
    149         add_settings_field(
    150             'apikey_editor', // id
    151             'Editor API Key', // title
    152             array( $this, 'field_apikey_editor' ), // callback
    153             'cloudtables-admin', // page
    154             'cloudtables_setting_section' // section
    155         );
    156 
    157         add_settings_field(
    158             'apikey', // id
    159             'Visitor API Key', // title
    160             array( $this, 'field_apikey_user' ), // callback
    161             'cloudtables-admin', // page
    162             'cloudtables_setting_section' // section
    163         );
    164     }
    165 
    166     /**
    167      * Section header - noop
    168      */
    169     public function cloudtables_section_info() {
     190            'type',
     191            'Hosting type',
     192            function() {
     193                $this->input_select('type', [
     194                    ['label' => 'Hosted (cloudtables.com)', 'value' => 'hosted'],
     195                    ['label' => 'Self-hosted', 'value' => 'self-hosted']
     196                ], 'hosted');
     197            },
     198            'cloudtables-admin',
     199            'cloudtables_setting_section'
     200        );
     201
     202        // Shown for hosted service
     203        add_settings_field(
     204            'subdomain',
     205            'Sub-domain',
     206            function() {
     207                $this->input_field('subdomain', 'The sub-domain name of your CloudTables application (i.e. the part before the <code>.cloudtables.com</code>.');
     208            },
     209            'cloudtables-admin',
     210            'cloudtables_setting_section'
     211        );
     212
     213        // Shown for self-hosted service
     214        add_settings_field(
     215            'host',
     216            'Host',
     217            function() {
     218                $this->input_field('host', 'The address for the server that hosts your self-hosted CloudTables install. It might be an IP address or a network name depending on your setup.');
     219            },
     220            'cloudtables-admin',
     221            'cloudtables_setting_section'
     222        );
     223
     224        add_settings_field(
     225            'port',
     226            'Port',
     227            function() {
     228                $this->input_field('port', 'Port for your self-hosted install. If left empty, a default of 80 will be used.');
     229            },
     230            'cloudtables-admin',
     231            'cloudtables_setting_section'
     232        );
     233
     234        add_settings_field(
     235            'ssl',
     236            'SSL',
     237            function() {
     238                $this->input_select('ssl', [
     239                    ['label' => 'Enabled', 'value' => 'enabled'],
     240                    ['label' => 'Disabled', 'value' => 'disabled']
     241                ], 'disabled', 'When SSL is enabled, a secure connection will be used to your self-hosted CloudTables install.');
     242            },
     243            'cloudtables-admin',
     244            'cloudtables_setting_section'
     245        );
     246
     247        add_settings_field(
     248            'self_signed',
     249            'Certificate signing',
     250            function() {
     251                $this->input_select('self_signed', [
     252                    ['label' => 'Central certificate authority', 'value' => 'central'],
     253                    ['label' => 'Self signed', 'value' => 'self']
     254                ], 'central', 'With SSL enabled, you can improve security by using a certificate from a signing authority that browsers recognise. This isn\'t always possible though, particularly during development. This option allows you to use a self-signed certificate.');
     255            },
     256            'cloudtables-admin',
     257            'cloudtables_setting_section'
     258        );
     259
     260        // Shown for both
     261        add_settings_field(
     262            'apikey_editor',
     263            'Editor API Key',
     264            function() {
     265                $this->input_field('apikey_editor', 'This API key will be used for users who have editing access to your site. Typically you should set this using a read / write access key from CloudTables.');
     266            },
     267            'cloudtables-admin',
     268            'cloudtables_setting_section'
     269        );
     270
     271        add_settings_field(
     272            'apikey',
     273            'Visitor API Key',
     274            function() {
     275                $this->input_field('apikey', 'The API key that will be used for non-editor users of your site (i.e. visitors). This will typically be a readonly key.');
     276            },
     277            'cloudtables-admin',
     278            'cloudtables_setting_section'
     279        );
    170280    }
    171281
     
    199309
    200310    /**
    201      * API key input (editor)
    202      */
    203     public function field_apikey_editor() {
     311     * Select input type
     312     */
     313    public function input_select($name, $values, $default, $info='') {
     314        printf('<select class="regular-text ct-select" name="cloudtables_option_name[%s]" id="%s" style="margin-bottom: 0.5em;">', $name, $name);
     315
     316        $opts = $this->_cloudtables_options;
     317
     318        for ($i=0 ; $i < count($values) ; $i++) {
     319            printf(
     320                '<option value="%s" %s>%s</option>',
     321                $values[$i]['value'],
     322                (
     323                    (isset( $opts[$name] ) && $opts[$name] === $values[$i]['value'] ) ||
     324                    (! isset( $opts[$name] ) && $default === $values[$i]['value'])
     325                )
     326                    ? 'selected="selected"'
     327                    : '',
     328                $values[$i]['label']
     329            );
     330        }
     331
     332        echo '</select>';
     333
     334        if ($info) {
     335            echo '<div class="ct-help">'.$info.'</div>';
     336        }
     337    }
     338
     339    public function input_field($name, $info='') {
    204340        printf(
    205             '<input class="regular-text" type="text" name="cloudtables_option_name[apikey_editor]" id="apikey_editor" value="%s" style="margin-bottom: 0.5em"><br>This API key will be used for users who have editing access to your site. Typically you should set this using a read / write access key from CloudTables.',
    206             isset( $this->_cloudtables_options['apikey_editor'] )
    207                 ? esc_attr( $this->_cloudtables_options['apikey_editor'])
    208                 : ''
    209         );
    210     }
    211 
    212     /**
    213      * API key input (user)
    214      */
    215     public function field_apikey_user() {
    216         printf(
    217             '<input class="regular-text" type="text" name="cloudtables_option_name[apikey]" id="apikey" value="%s" style="margin-bottom: 0.5em"><br>The API key that will be used for non-editor users of your site (i.e. visitors). This will typically be a readonly key.',
    218             isset( $this->_cloudtables_options['apikey'] )
    219                 ? esc_attr( $this->_cloudtables_options['apikey'])
    220                 : ''
    221         );
    222     }
    223 
    224     /**
    225      * Subdomain input
    226      */
    227     public function field_subdomain() {
    228         printf(
    229             '<input class="regular-text" type="text" name="cloudtables_option_name[subdomain]" id="subdomain" value="%s" style="margin-bottom: 0.5em"><br>The sub-domain name of your CloudTables application (i.e. the part before the <code>.cloudtables.com</code>.',
    230             isset( $this->_cloudtables_options['subdomain'] )
    231                 ? esc_attr( $this->_cloudtables_options['subdomain'])
    232                 : ''
     341            '<input class="regular-text" type="text" name="cloudtables_option_name[%s]" id="%s" value="%s" style="margin-bottom: 0.5em"><div class="ct-help">%s</div>',
     342            $name,
     343            $name,
     344            isset( $this->_cloudtables_options[$name] )
     345                ? esc_attr( $this->_cloudtables_options[$name])
     346                : '',
     347            $info
    233348        );
    234349    }
     
    274389
    275390        if (isset($attrs['conditions'])) {
    276             $api->conditions($attrs['conditions']);
     391            // Unescape the HTML entities
     392            $api->conditions(str_replace('&quot;', '"', $attrs['conditions']));
    277393        }
    278394
     
    313429            ? $options['subdomain']
    314430            : '';
     431        $type = isset($options['type'])
     432            ? $options['type']
     433            : 'hosted';
     434        $host = isset($options['host'])
     435            ? $options['host']
     436            : '';
     437        $port = isset($options['port'])
     438            ? $options['port']
     439            : '';
     440        $ssl = isset($options['ssl'])
     441            ? $options['ssl'] === 'enabled'
     442            : true;
     443        $self_signed = isset($options['self_signed'])
     444            ? $options['self_signed'] === 'self'
     445            : false;
     446        $apikey = isset($options['apikey'])
     447            ? $options['apikey']
     448            : '';
     449        $apikey_editor = isset($options['apikey_editor'])
     450            ? $options['apikey_editor']
     451            : '';
     452
     453        if (! $type) {
     454            return false;
     455        }
    315456
    316457        if ($apikey === null) {
    317458            if (current_user_can( 'edit_posts' )) {
    318                 $apikey = isset($options['apikey_editor'])
     459                $active_key = isset($options['apikey_editor'])
    319460                    ? $options['apikey_editor']
    320461                    : '';
    321462            }
    322463            else {
    323                 $apikey = isset($options['apikey'])
     464                $active_key = isset($options['apikey'])
    324465                    ? $options['apikey']
    325466                    : '';
    326467            }
    327468        }
    328 
    329         if ($subdomain && $apikey) {
    330             return new \Cloudtables\Api(
    331                 $subdomain,
    332                 $apikey
    333                 // The following is used for development only
    334                 // ,[
    335                 //  'domain' => 'ct-devel-05.io',
    336                 //  'secure' => false
    337                 // ]
    338             );
     469        else {
     470            $active_key = $apikey;
     471        }
     472
     473        if ($type === 'hosted' && $subdomain && $active_key) {
     474            return new \Cloudtables\Api($subdomain, $active_key);
     475        }
     476        else if ($host && $active_key) {
     477            if ($port) {
     478                $host .= ':'.$port;
     479            }
     480
     481            return new \Cloudtables\Api('', $active_key, array(
     482                'domain' => $host,
     483                'ssl' => $ssl,
     484                'selfSigned' => $self_signed
     485            ));
    339486        }
    340487
     
    362509                    <p style="color: green">Good.</p>
    363510                    <h3>Available datasets</h3>
    364                     <p>The following datasets are available based on the Editor API Key above.</p>
     511                    <p>The following datasets are available based on the editor API Key above.</p>
    365512               
    366513                    <table class="widefat">
     
    394541            }
    395542            else {
    396                 echo '<p style="color: red">Failed - incorrect API access key or sub-domain.</p>';
     543                echo '<p style="color: red">Failed - please check the settings above including the host name and access keys.</p>';
    397544            }
    398545        }
     
    408555register_deactivation_hook( __FILE__, 'CloudTables::deactivate' );
    409556register_uninstall_hook( __FILE__, 'CloudTables::uninstall' );
    410 
  • cloudtables/trunk/package-lock.json

    r2324965 r2776279  
    11{
    22  "name": "cloudtables-wordpress",
    3   "version": "1.0.0",
     3  "version": "1.2.0",
    44  "lockfileVersion": 1,
    55  "requires": true,
  • cloudtables/trunk/package.json

    r2726861 r2776279  
    11{
    22  "name": "cloudtables-wordpress",
    3   "version": "1.1.0",
     3  "version": "1.2.0",
    44  "description": "CloudTables easy integration plug-in for WordPress",
    55  "main": "block.js",
  • cloudtables/trunk/readme.txt

    r2726861 r2776279  
    22Tags: CloudTables, DataTables, Editor, SpryMedia
    33Requires at least: 5.0
    4 Tested up to: 5.9
    5 Stable tag: 1.1.0
     4Tested up to: 6.0
     5Stable tag: 1.2.0
    66Requires PHP: 5.5.0
    77License: GPLv2 or later
     
    3737
    38381. Download the CloudTables plugin for WordPress.
    39 2. Upload the 'cloudtables' directory to your '/wp-content/plugins/' directory, using your favorite method (ftp, sftp, scp, etc...).
     392. Upload the 'cloudtables' directory to your '/wp-content/plugins/' directory, using your favourite method (ftp, sftp, scp, etc...).
    4040
    4141= Post-install
    4242
    43431. Activate CloudTables from your Plugins page.
    44 2. In 'Settings > CloudTables' enter your CloudTables' sub-domain name and API keys
    45   * Your CloudTables API keys can be found in your CloudTables application under 'Security > API Keys'.
    46   * There are two keys that can be entered - one for editors and one for end users. Typically these keys should have read/write access and read-only access, respectively.
     442. In 'Settings > CloudTables' enter the details to connect to your CloudTables server see:
     45  * [Hosted (_cloudtables.com_) documentation](https://cloudtables.com/docs/cloud/cms/wordpress)
     46  * [Self-hosted documentation](https://cloudtables.com/docs/self-hosted/cms/wordpress)
    4747
    4848
    4949== Changelog ==
     50
     51= 1.2.0 - 18 August 2022 =
     52
     53* Add support for self-hosted CloudTables installs
     54* Conditions option in block editor
    5055
    5156= 1.1.0 - 19 May 2022 =
  • cloudtables/trunk/src/index.js

    r2324965 r2776279  
    1111        apikey: { type: 'string' },
    1212        datasetId: { type: 'string' },
     13        conditions: { type: 'string' },
    1314    },
    1415    edit: (props) => {
    1516        let datasetId = props.attributes.datasetId || '';
    1617        let apikey = props.attributes.apikey || '';
     18        let conditions = props.attributes.conditions || '';
    1719        let options = window.cloudtables_data
    1820            .datasets
     
    5860                        /> 
    5961                    </PanelRow>
     62                    <PanelRow>
     63                        <TextControl
     64                            label="Conditional data loading (optional)"
     65                            value={ conditions }
     66                            onChange={ val => props.setAttributes( { conditions: val } ) }
     67                            help="JSON configuration that can be used to load conditional data. See the documentation on CloudTables.com for full details."
     68                        /> 
     69                    </PanelRow>
    6070                </PanelBody>
    6171            </InspectorControls>,
     
    6878        let datasetId = props.attributes.datasetId || '';
    6979        let apikey = props.attributes.apikey || '';
     80        let conditions = props.attributes.conditions || '';
    7081        let shortcode = datasetId
    7182            ? '[cloudtable id="' + datasetId + '"'
     
    7687        }
    7788
     89        if (conditions) {
     90            // Need to replace the quotes with escaped values to allow the
     91            // attributes in the HTML to work. Wordpress doesn't escape
     92            // them automatically
     93            shortcode += ' conditions="' + conditions.replace(/"/g, '&quot;') + '"'
     94        }
     95
    7896        shortcode += ']';
    7997
Note: See TracChangeset for help on using the changeset viewer.