Changeset 2776279
- Timestamp:
- 08/26/2022 07:50:54 PM (4 years ago)
- Location:
- cloudtables/trunk
- Files:
-
- 8 edited
-
Api.php (modified) (7 diffs)
-
build/index.asset.php (modified) (1 diff)
-
build/index.js (modified) (1 diff)
-
cloudtables.php (modified) (12 diffs)
-
package-lock.json (modified) (1 diff)
-
package.json (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
src/index.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cloudtables/trunk/Api.php
r2726861 r2776279 11 11 private $_key; 12 12 private $_roles = []; 13 private $_secure = true; 13 private $_ssl = true; 14 private $_selfSigned = false; 14 15 private $_subdomain; 15 16 private $_clientId = null; … … 52 53 } 53 54 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']; 56 61 } 57 62 … … 177 182 178 183 return [ 179 'url' => "https://{$this->_subdomain}.{$this->_domain}/loader/{$datasetId}/table/{$style}?insert=".$rnd,184 'url' => $this->_url("/loader/{$datasetId}/table/{$style}?insert=".$rnd), 180 185 'unique' => $rnd, 181 186 'token' => $token … … 211 216 $response = wp_remote_get( $url, [ 212 217 'body' => $data, 213 'sslverify' => $this->_secure218 'sslverify' => ! $this->_selfSigned 214 219 ] ); 215 220 } … … 217 222 $response = wp_remote_post( $url, [ 218 223 'body' => $data, 219 'sslverify' => $this->_secure224 'sslverify' => ! $this->_selfSigned 220 225 ] ); 221 226 } … … 224 229 $json = json_decode($result, true); 225 230 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; 230 234 } 231 235 … … 237 241 */ 238 242 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; 240 251 } 241 252 } 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,""")+'"'),a+="]",Object(o.createElement)("div",null,Object(o.createElement)("p",null,a))}})}]); -
cloudtables/trunk/cloudtables.php
r2726861 r2776279 7 7 * Requires PHP: 5.4 8 8 * Author: SpryMedia Ltd 9 * Version: 1. 0.09 * Version: 1.2.0 10 10 * License: GPLv2 or later 11 11 */ … … 29 29 */ 30 30 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 }); 32 34 add_action( 'init', [$this, 'register_block'] ); 33 35 add_action( 'enqueue_block_editor_assets', [$this, 'editor_variables'] ); … … 87 89 */ 88 90 public function admin_page() { 91 $opts = $this->_cloudtables_options; 92 89 93 ?> 90 94 <div class="wrap"> … … 100 104 ?> 101 105 </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> 102 146 <?php 103 147 $this->_display_datasets(); … … 115 159 array( $this, function ($input) { 116 160 $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 } 128 176 } 129 177 … … 135 183 'cloudtables_setting_section', // id 136 184 'Settings', // title 137 array( $this, 'cloudtables_section_info' ), // callback185 function () {}, 138 186 'cloudtables-admin' // page 139 187 ); 140 188 141 189 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 ); 170 280 } 171 281 … … 199 309 200 310 /** 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='') { 204 340 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 233 348 ); 234 349 } … … 274 389 275 390 if (isset($attrs['conditions'])) { 276 $api->conditions($attrs['conditions']); 391 // Unescape the HTML entities 392 $api->conditions(str_replace('"', '"', $attrs['conditions'])); 277 393 } 278 394 … … 313 429 ? $options['subdomain'] 314 430 : ''; 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 } 315 456 316 457 if ($apikey === null) { 317 458 if (current_user_can( 'edit_posts' )) { 318 $a pikey = isset($options['apikey_editor'])459 $active_key = isset($options['apikey_editor']) 319 460 ? $options['apikey_editor'] 320 461 : ''; 321 462 } 322 463 else { 323 $a pikey = isset($options['apikey'])464 $active_key = isset($options['apikey']) 324 465 ? $options['apikey'] 325 466 : ''; 326 467 } 327 468 } 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 )); 339 486 } 340 487 … … 362 509 <p style="color: green">Good.</p> 363 510 <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> 365 512 366 513 <table class="widefat"> … … 394 541 } 395 542 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>'; 397 544 } 398 545 } … … 408 555 register_deactivation_hook( __FILE__, 'CloudTables::deactivate' ); 409 556 register_uninstall_hook( __FILE__, 'CloudTables::uninstall' ); 410 -
cloudtables/trunk/package-lock.json
r2324965 r2776279 1 1 { 2 2 "name": "cloudtables-wordpress", 3 "version": "1. 0.0",3 "version": "1.2.0", 4 4 "lockfileVersion": 1, 5 5 "requires": true, -
cloudtables/trunk/package.json
r2726861 r2776279 1 1 { 2 2 "name": "cloudtables-wordpress", 3 "version": "1. 1.0",3 "version": "1.2.0", 4 4 "description": "CloudTables easy integration plug-in for WordPress", 5 5 "main": "block.js", -
cloudtables/trunk/readme.txt
r2726861 r2776279 2 2 Tags: CloudTables, DataTables, Editor, SpryMedia 3 3 Requires at least: 5.0 4 Tested up to: 5.95 Stable tag: 1. 1.04 Tested up to: 6.0 5 Stable tag: 1.2.0 6 6 Requires PHP: 5.5.0 7 7 License: GPLv2 or later … … 37 37 38 38 1. Download the CloudTables plugin for WordPress. 39 2. Upload the 'cloudtables' directory to your '/wp-content/plugins/' directory, using your favo rite method (ftp, sftp, scp, etc...).39 2. Upload the 'cloudtables' directory to your '/wp-content/plugins/' directory, using your favourite method (ftp, sftp, scp, etc...). 40 40 41 41 = Post-install 42 42 43 43 1. Activate CloudTables from your Plugins page. 44 2. In 'Settings > CloudTables' enter your CloudTables' sub-domain name and API keys45 * 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.44 2. 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) 47 47 48 48 49 49 == Changelog == 50 51 = 1.2.0 - 18 August 2022 = 52 53 * Add support for self-hosted CloudTables installs 54 * Conditions option in block editor 50 55 51 56 = 1.1.0 - 19 May 2022 = -
cloudtables/trunk/src/index.js
r2324965 r2776279 11 11 apikey: { type: 'string' }, 12 12 datasetId: { type: 'string' }, 13 conditions: { type: 'string' }, 13 14 }, 14 15 edit: (props) => { 15 16 let datasetId = props.attributes.datasetId || ''; 16 17 let apikey = props.attributes.apikey || ''; 18 let conditions = props.attributes.conditions || ''; 17 19 let options = window.cloudtables_data 18 20 .datasets … … 58 60 /> 59 61 </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> 60 70 </PanelBody> 61 71 </InspectorControls>, … … 68 78 let datasetId = props.attributes.datasetId || ''; 69 79 let apikey = props.attributes.apikey || ''; 80 let conditions = props.attributes.conditions || ''; 70 81 let shortcode = datasetId 71 82 ? '[cloudtable id="' + datasetId + '"' … … 76 87 } 77 88 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, '"') + '"' 94 } 95 78 96 shortcode += ']'; 79 97
Note: See TracChangeset
for help on using the changeset viewer.