Changeset 2792647
- Timestamp:
- 09/30/2022 06:59:33 PM (4 years ago)
- Location:
- wp-strava/trunk
- Files:
-
- 1 deleted
- 11 edited
-
. (modified) (1 prop)
-
build/index.asset.php (modified) (1 diff)
-
build/index.js (modified) (1 diff)
-
build/index.js.map (deleted)
-
css/wp-strava.css (modified) (3 diffs)
-
readme.txt (modified) (5 diffs)
-
src/WPStrava.php (modified) (1 diff)
-
src/WPStrava/API.php (modified) (3 diffs)
-
src/WPStrava/Auth.php (modified) (3 diffs)
-
src/WPStrava/Settings.php (modified) (10 diffs)
-
templates/admin-settings.php (modified) (1 diff)
-
wp-strava.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-strava/trunk
- Property svn:ignore
-
old new 1 .git 2 .gitignore 3 . gitattributes4 php cs.xml5 composer.lock 6 composer. json1 .git* 2 phpcs.* 3 .phpunit* 4 phpunit* 5 tests 6 composer.* 7 7 vendor 8 package.json 9 package-lock.json 10 node_modules 8 11 .vscode 12 .nvmrc 13 .eslintrc
-
- Property svn:ignore
-
wp-strava/trunk/build/index.asset.php
r2651185 r2792647 1 <?php return array('dependencies' => array('wp-blocks', 'wp-editor', 'wp-element', 'wp-polyfill'), 'version' => ' 3fc205c4608dbba755fa2b6d94bc1084');1 <?php return array('dependencies' => array('wp-blocks', 'wp-editor', 'wp-element', 'wp-polyfill'), 'version' => '76f44c0d2c7e826d88715932914fc218'); -
wp-strava/trunk/build/index.js
r2651185 r2792647 1 !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=15)}([function(t,e){t.exports=window.wp.element},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports. default=t.exports,t.exports.__esModule=!0},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.default=t.exports,t.exports.__esModule=!0,r(e)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=window.wp.blocks},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){var n=r(13);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){var n=r(14).default,o=r(1);t.exports=function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t){t.exports=JSON.parse('{"name":"wp-strava/activity","title":"Strava Activity","category":"embed","icon":"chart-line","description":"Embed a Strava Activity","keywords":["activity","ride","map"],"textdomain":"wp-strava","attributes":{"url":{"type":"string","default":""},"imageOnly":{"type":"boolean","default":false},"displayMarkers":{"type":"boolean","default":false},"som":{"type":"string","default":null}},"editorScript":"file:../../../build/index.js","editorStyle":"file:../../../build/editor.css","style":"file:../../../build/style.css"}')},function(t){t.exports=JSON.parse('{"name":"wp-strava/route","title":"Strava Route","category":"embed","icon":"location-alt","description":"Embed a Strava Route","keywords":["route","map"],"textdomain":"wp-strava","attributes":{"url":{"type":"string","default":""},"imageOnly":{"type":"boolean","default":false},"displayMarkers":{"type":"boolean","default":false},"som":{"type":"string","default":null}},"editorScript":"file:../../../build/index.js","editorStyle":"file:../../../build/editor.css","style":"file:../../../build/style.css"}')},function(t){t.exports=JSON.parse('{"name":"wp-strava/segment","title":"Strava Segment","category":"embed","icon":"chart-area","description":"Embed a Strava Segment","keywords":["segment","map"],"textdomain":"wp-strava","attributes":{"url":{"type":"string","default":""},"imageOnly":{"type":"boolean","default":false},"displayMarkers":{"type":"boolean","default":true},"som":{"type":"string","default":null}},"editorScript":"file:../../../build/index.js","editorStyle":"file:../../../build/editor.css","style":"file:../../../build/style.css"}')},function(t){t.exports=JSON.parse('{"name":"wp-strava/activitieslist","title":"Strava Activities List","category":"embed","icon":"editor-ul","description":"List of Strava Activities","keywords":["activity","ride"],"textdomain":"wp-strava","attributes":{"som":{"type":"string","default":null}},"editorScript":"file:../../../build/index.js","editorStyle":"file:../../../build/editor.css","style":"file:../../../build/style.css"}')},function(t,e){t.exports=window.wp.editor},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.default=t.exports,t.exports.__esModule=!0,r(e,n)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=r=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),r(e)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){"use strict";r.r(e);var n=r(3),o=r(4),a=r.n(o),s=r(5),i=r.n(s),l=r(1),c=r.n(l),u=r(6),p=r.n(u),f=r(7),d=r.n(f),y=r(2),m=r.n(y),b=r(0),v=r(12),g=wp.i18n,h=(g.__,g._x),O=wp.components,w=O.Button,k=O.Placeholder,S=function(t){var e=t.icon,r=t.label,n=t.instructions,o=t.placeholder,a=t.value,s=t.onSubmit,i=t.onChange;return Object(b.createElement)(k,{icon:Object(b.createElement)(v.BlockIcon,{icon:e,showColors:!0}),label:r,className:"wp-block-embed",instructions:n},Object(b.createElement)("form",{onSubmit:s},Object(b.createElement)("input",{type:"url",value:a||"",className:"components-placeholder__input","aria-label":r,placeholder:o,onChange:i}),Object(b.createElement)(w,{isPrimary:!0,type:"submit"},h("Embed","button label","wp-strava"))))},x=wp.i18n.__,j=wp.components,M=j.Icon,R=j.Button,E=j.Toolbar,_=function(t){var e=t.switchBackToURLInput;return Object(b.createElement)(b.Fragment,null,Object(b.createElement)(v.BlockControls,null,Object(b.createElement)(E,{label:x("Options","wp-strava")},Object(b.createElement)(R,{label:x("Edit URL","wp-strava"),onClick:e},Object(b.createElement)(M,{icon:"edit"})))))};function U(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m()(t);if(e){var o=m()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return d()(this,r)}}var C=wp.i18n.__,I=wp.element.Component,T=wp.components,B=T.Button,L=T.ButtonGroup,D=function(t){p()(r,t);var e=U(r);function r(){var t;return a()(this,r),(t=e.apply(this,arguments)).onChange=t.onChange.bind(c()(t)),t.state={som:""},t}return i()(r,[{key:"onChange",value:function(t){this.setState({som:t.target.value}),this.props.onChange(t.target.value)}},{key:"render",value:function(){var t=this.state.som;return Object(b.createElement)("div",{className:"wp-block-wp-strava-som-control"},Object(b.createElement)("p",{className:"wp-block-wp-strava-som-control-row"},C("System of Measure (override from settings)")),Object(b.createElement)("div",{className:"wp-block-wp-strava-som-control-row"},Object(b.createElement)(L,{"aria-label":C("System of Measure","wp-strava")},Object(b.createElement)(B,{isSmall:!0,isPrimary:"english"==t,isPressed:"english"==t,value:"english",onClick:this.onChange},C("English","wp-strava")),Object(b.createElement)(B,{isSmall:!0,isPrimary:"metric"==t,isPressed:"metric"==t,value:"metric",onClick:this.onChange},C("Metric","wp-strava"))),Object(b.createElement)(B,{isSmall:!0,value:"",onClick:this.onChange},C("Reset","wp-strava"))))}}]),r}(I);function P(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m()(t);if(e){var o=m()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return d()(this,r)}}var A=wp.i18n.__,N=wp.element.Component,F=wp.editor.InspectorControls,J=wp.components,W=J.PanelBody,G=J.ToggleControl,q=J.ServerSideRender,z=lodash.isEmpty,H=function(t){p()(r,t);var e=P(r);function r(){var t;return a()(this,r),(t=e.apply(this,arguments)).setUrl=t.setUrl.bind(c()(t)),t.switchBackToURLInput=t.switchBackToURLInput.bind(c()(t)),t.toggleImageOnly=t.toggleImageOnly.bind(c()(t)),t.toggleDisplayMarkers=t.toggleDisplayMarkers.bind(c()(t)),t.overrideSOM=t.overrideSOM.bind(c()(t)),t.state={url:t.props.attributes.url,imageOnly:t.props.attributes.imageOnly,displayMarkers:t.props.attributes.displayMarkers,som:t.props.attributes.som,editingURL:!!z(t.props.attributes.url)},t}return i()(r,[{key:"setUrl",value:function(t){t&&t.preventDefault(),this.setState({editingURL:!1}),this.props.setAttributes({url:this.state.url})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"toggleImageOnly",value:function(t){this.setState({imageOnly:t}),this.props.setAttributes({imageOnly:t})}},{key:"toggleDisplayMarkers",value:function(t){this.setState({displayMarkers:t}),this.props.setAttributes({displayMarkers:t})}},{key:"overrideSOM",value:function(t){this.setState({som:t}),this.props.setAttributes({som:t})}},{key:"render",value:function(){var t=this,e=this.state,r=e.url,n=e.editingURL,o=e.imageOnly,a=e.displayMarkers,s=e.som;return n?Object(b.createElement)(S,{icon:"chart-line",label:A("Strava Activity","wp-strava"),instructions:A("Paste a link to the Strava Activity you want to display on your site.","wp-strava"),placeholder:A("Enter Activity URL to embed here…","wp-strava"),onSubmit:this.setUrl,value:r,onChange:function(e){return t.setState({url:e.target.value})}}):Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_,{switchBackToURLInput:this.switchBackToURLInput}),Object(b.createElement)(q,{block:"wp-strava/activity",attributes:{url:r,imageOnly:o,displayMarkers:a,som:s}}),Object(b.createElement)(F,null,Object(b.createElement)(W,{title:A("Display Options","wp-strava")},Object(b.createElement)(G,{label:A("Image Only","wp-strava"),checked:o,onChange:function(e){return t.toggleImageOnly(e)}}),Object(b.createElement)(G,{label:A("Display Markers","wp-strava"),checked:a,onChange:function(e){return t.toggleDisplayMarkers(e)}}),Object(b.createElement)(D,{onChange:this.overrideSOM}))))}}]),r}(N),K=r(8);function Q(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m()(t);if(e){var o=m()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return d()(this,r)}}K.edit=H,K.save=function(){return null},K.transforms={from:[{type:"raw",isMatch:function(t){return"P"===t.nodeName&&t.innerText.startsWith("https://www.strava.com/activities/")},transform:function(t){return Object(n.createBlock)(K.name,{url:t.innerText})}},{type:"block",blocks:["core/paragraph"],isMatch:function(t){return t.content.startsWith("https://www.strava.com/activities/")},transform:function(t){return Object(n.createBlock)(K.name,{url:t.content})}},{type:"shortcode",tag:["activity","ride"],attributes:{url:{type:"string",shortcode:function(t){return"https://www.strava.com/activities/"+t.named.id}}}}],to:[{type:"block",blocks:["core/paragraph"],transform:function(t){return Object(n.createBlock)("core/paragraph",{content:t.url})}}]},Object(n.registerBlockType)(K.name,K);var V=wp.i18n.__,X=wp.element.Component,Y=wp.editor.InspectorControls,Z=wp.components,$=Z.PanelBody,tt=Z.ToggleControl,et=Z.ServerSideRender,rt=lodash.isEmpty,nt=function(t){p()(r,t);var e=Q(r);function r(){var t;return a()(this,r),(t=e.apply(this,arguments)).setUrl=t.setUrl.bind(c()(t)),t.switchBackToURLInput=t.switchBackToURLInput.bind(c()(t)),t.toggleImageOnly=t.toggleImageOnly.bind(c()(t)),t.toggleDisplayMarkers=t.toggleDisplayMarkers.bind(c()(t)),t.overrideSOM=t.overrideSOM.bind(c()(t)),t.state={url:t.props.attributes.url,imageOnly:t.props.attributes.imageOnly,displayMarkers:t.props.attributes.displayMarkers,som:t.props.attributes.som,editingURL:!!rt(t.props.attributes.url)},t}return i()(r,[{key:"setUrl",value:function(t){t&&t.preventDefault(),this.setState({editingURL:!1}),this.props.setAttributes({url:this.state.url})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"toggleImageOnly",value:function(t){this.setState({imageOnly:t}),this.props.setAttributes({imageOnly:t})}},{key:"toggleDisplayMarkers",value:function(t){this.setState({displayMarkers:t}),this.props.setAttributes({displayMarkers:t})}},{key:"overrideSOM",value:function(t){this.setState({som:t}),this.props.setAttributes({som:t})}},{key:"render",value:function(){var t=this,e=this.state,r=e.url,n=e.editingURL,o=e.imageOnly,a=e.displayMarkers,s=e.som;return n?Object(b.createElement)(S,{icon:"location-alt",label:V("Strava Route","wp-strava"),instructions:V("Paste a link to the Strava Route you want to display on your site.","wp-strava"),placeholder:V("Enter Route URL to embed here…","wp-strava"),onSubmit:this.setUrl,value:r,onChange:function(e){return t.setState({url:e.target.value})}}):Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_,{switchBackToURLInput:this.switchBackToURLInput}),Object(b.createElement)(et,{block:"wp-strava/route",attributes:{url:r,imageOnly:o,displayMarkers:a,som:s}}),Object(b.createElement)(Y,null,Object(b.createElement)($,{title:V("Display Options","wp-strava")},Object(b.createElement)(tt,{label:V("Image Only","wp-strava"),checked:o,onChange:function(e){return t.toggleImageOnly(e)}}),Object(b.createElement)(tt,{label:V("Display Markers","wp-strava"),checked:a,onChange:function(e){return t.toggleDisplayMarkers(e)}}),Object(b.createElement)(D,{onChange:this.overrideSOM}))))}}]),r}(X),ot=r(9);function at(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m()(t);if(e){var o=m()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return d()(this,r)}}ot.edit=nt,ot.save=function(){return null},ot.transforms={from:[{type:"raw",priority:10,isMatch:function(t){return"P"===t.nodeName&&t.innerText.startsWith("https://www.strava.com/routes/")},transform:function(t){return Object(n.createBlock)(ot.name,{url:t.innerText})}}]},Object(n.registerBlockType)(ot.name,ot);var st=wp.i18n.__,it=wp.element.Component,lt=wp.editor.InspectorControls,ct=wp.components,ut=ct.PanelBody,pt=(ct.ToggleControl,ct.ServerSideRender),ft=function(t){p()(r,t);var e=at(r);function r(){var t;return a()(this,r),(t=e.apply(this,arguments)).overrideSOM=t.overrideSOM.bind(c()(t)),t.state={som:t.props.attributes.som},t}return i()(r,[{key:"overrideSOM",value:function(t){this.setState({som:t}),this.props.setAttributes({som:t})}},{key:"render",value:function(){var t=this.state.som;return Object(b.createElement)(b.Fragment,null,Object(b.createElement)(pt,{block:"wp-strava/activitieslist",attributes:{som:t}}),Object(b.createElement)(lt,null,Object(b.createElement)(ut,{title:st("Display Options","wp-strava")},Object(b.createElement)(D,{onChange:this.overrideSOM}))))}}]),r}(it),dt=r(11);function yt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m()(t);if(e){var o=m()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return d()(this,r)}}dt.edit=ft,dt.save=function(){return null},Object(n.registerBlockType)(dt.name,dt);var mt=wp.i18n.__,bt=wp.element.Component,vt=wp.editor.InspectorControls,gt=wp.components,ht=gt.PanelBody,Ot=gt.ToggleControl,wt=gt.ServerSideRender,kt=lodash.isEmpty,St=function(t){p()(r,t);var e=yt(r);function r(){var t;return a()(this,r),(t=e.apply(this,arguments)).setUrl=t.setUrl.bind(c()(t)),t.switchBackToURLInput=t.switchBackToURLInput.bind(c()(t)),t.toggleImageOnly=t.toggleImageOnly.bind(c()(t)),t.toggleDisplayMarkers=t.toggleDisplayMarkers.bind(c()(t)),t.overrideSOM=t.overrideSOM.bind(c()(t)),t.state={url:t.props.attributes.url,imageOnly:t.props.attributes.imageOnly,displayMarkers:t.props.attributes.displayMarkers,som:t.props.attributes.som,editingURL:!!kt(t.props.attributes.url)},t}return i()(r,[{key:"setUrl",value:function(t){t&&t.preventDefault(),this.setState({editingURL:!1}),this.props.setAttributes({url:this.state.url})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"toggleImageOnly",value:function(t){this.setState({imageOnly:t}),this.props.setAttributes({imageOnly:t})}},{key:"toggleDisplayMarkers",value:function(t){this.setState({displayMarkers:t}),this.props.setAttributes({displayMarkers:t})}},{key:"overrideSOM",value:function(t){this.setState({som:t}),this.props.setAttributes({som:t})}},{key:"render",value:function(){var t=this,e=this.state,r=e.url,n=e.editingURL,o=e.imageOnly,a=e.displayMarkers,s=e.som;return n?Object(b.createElement)(S,{icon:"location-alt",label:mt("Strava Segment","wp-strava"),instructions:mt("Paste a link to the Strava Segment you want to display on your site.","wp-strava"),placeholder:mt("Enter Segment URL to embed here…","wp-strava"),onSubmit:this.setUrl,value:r,onChange:function(e){return t.setState({url:e.target.value})}}):Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_,{switchBackToURLInput:this.switchBackToURLInput}),Object(b.createElement)(wt,{block:"wp-strava/segment",attributes:{url:r,imageOnly:o,displayMarkers:a,som:s}}),Object(b.createElement)(vt,null,Object(b.createElement)(ht,{title:mt("Display Options","wp-strava")},Object(b.createElement)(Ot,{label:mt("Image Only","wp-strava"),checked:o,onChange:function(e){return t.toggleImageOnly(e)}}),Object(b.createElement)(Ot,{label:mt("Display Markers","wp-strava"),checked:a,onChange:function(e){return t.toggleDisplayMarkers(e)}}),Object(b.createElement)(D,{onChange:this.overrideSOM}))))}}]),r}(bt),xt=r(10);xt.edit=St,xt.save=function(){return null},xt.transforms={from:[{type:"raw",priority:10,isMatch:function(t){return"P"===t.nodeName&&t.innerText.startsWith("https://www.strava.com/segments/")},transform:function(t){return Object(n.createBlock)(xt.name,{url:t.innerText})}}]},Object(n.registerBlockType)(xt.name,xt)}]);1 !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=15)}([function(t,e){t.exports=window.wp.element},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=window.wp.blocks},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(13);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(14).default,o=r(1);t.exports=function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t){t.exports=JSON.parse('{"name":"wp-strava/activity","title":"Strava Activity","category":"embed","icon":"chart-line","description":"Embed a Strava Activity","keywords":["activity","ride","map"],"textdomain":"wp-strava","attributes":{"url":{"type":"string","default":""},"imageOnly":{"type":"boolean","default":false},"displayMarkers":{"type":"boolean","default":false},"som":{"type":"string","default":null}},"editorScript":"file:../../../build/index.js","editorStyle":"file:../../../build/editor.css","style":"file:../../../build/style.css"}')},function(t){t.exports=JSON.parse('{"name":"wp-strava/route","title":"Strava Route","category":"embed","icon":"location-alt","description":"Embed a Strava Route","keywords":["route","map"],"textdomain":"wp-strava","attributes":{"url":{"type":"string","default":""},"imageOnly":{"type":"boolean","default":false},"displayMarkers":{"type":"boolean","default":false},"som":{"type":"string","default":null}},"editorScript":"file:../../../build/index.js","editorStyle":"file:../../../build/editor.css","style":"file:../../../build/style.css"}')},function(t){t.exports=JSON.parse('{"name":"wp-strava/segment","title":"Strava Segment","category":"embed","icon":"chart-area","description":"Embed a Strava Segment","keywords":["segment","map"],"textdomain":"wp-strava","attributes":{"url":{"type":"string","default":""},"imageOnly":{"type":"boolean","default":false},"displayMarkers":{"type":"boolean","default":true},"som":{"type":"string","default":null}},"editorScript":"file:../../../build/index.js","editorStyle":"file:../../../build/editor.css","style":"file:../../../build/style.css"}')},function(t){t.exports=JSON.parse('{"name":"wp-strava/activitieslist","title":"Strava Activities List","category":"embed","icon":"editor-ul","description":"List of Strava Activities","keywords":["activity","ride"],"textdomain":"wp-strava","attributes":{"som":{"type":"string","default":null}},"editorScript":"file:../../../build/index.js","editorStyle":"file:../../../build/editor.css","style":"file:../../../build/style.css"}')},function(t,e){t.exports=window.wp.editor},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e,n)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";r.r(e);var n=r(3),o=r(4),a=r.n(o),s=r(5),i=r.n(s),l=r(1),c=r.n(l),u=r(6),p=r.n(u),f=r(7),d=r.n(f),y=r(2),m=r.n(y),b=r(0),v=r(12),h=wp.i18n,g=(h.__,h._x),O=wp.components,w=O.Button,k=O.Placeholder,S=function(t){var e=t.icon,r=t.label,n=t.instructions,o=t.placeholder,a=t.value,s=t.onSubmit,i=t.onChange;return Object(b.createElement)(k,{icon:Object(b.createElement)(v.BlockIcon,{icon:e,showColors:!0}),label:r,className:"wp-block-embed",instructions:n},Object(b.createElement)("form",{onSubmit:s},Object(b.createElement)("input",{type:"url",value:a||"",className:"components-placeholder__input","aria-label":r,placeholder:o,onChange:i}),Object(b.createElement)(w,{isPrimary:!0,type:"submit"},g("Embed","button label","wp-strava"))))},j=wp.i18n.__,x=wp.components,M=x.Icon,R=x.Button,E=x.Toolbar,_=function(t){var e=t.switchBackToURLInput;return Object(b.createElement)(b.Fragment,null,Object(b.createElement)(v.BlockControls,null,Object(b.createElement)(E,{label:j("Options","wp-strava")},Object(b.createElement)(R,{label:j("Edit URL","wp-strava"),onClick:e},Object(b.createElement)(M,{icon:"edit"})))))};var B=wp.i18n.__,U=wp.element.Component,C=wp.components,I=C.Button,T=C.ButtonGroup,L=function(t){p()(o,t);var e,r,n=(e=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=m()(e);if(r){var o=m()(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return d()(this,t)});function o(){var t;return a()(this,o),(t=n.apply(this,arguments)).onChange=t.onChange.bind(c()(t)),t.state={som:""},t}return i()(o,[{key:"onChange",value:function(t){this.setState({som:t.target.value}),this.props.onChange(t.target.value)}},{key:"render",value:function(){var t=this.state.som;return Object(b.createElement)("div",{className:"wp-block-wp-strava-som-control"},Object(b.createElement)("p",{className:"wp-block-wp-strava-som-control-row"},B("System of Measure (override from settings)")),Object(b.createElement)("div",{className:"wp-block-wp-strava-som-control-row"},Object(b.createElement)(T,{"aria-label":B("System of Measure","wp-strava")},Object(b.createElement)(I,{isSmall:!0,isPrimary:"english"==t,isPressed:"english"==t,value:"english",onClick:this.onChange},B("English","wp-strava")),Object(b.createElement)(I,{isSmall:!0,isPrimary:"metric"==t,isPressed:"metric"==t,value:"metric",onClick:this.onChange},B("Metric","wp-strava"))),Object(b.createElement)(I,{isSmall:!0,value:"",onClick:this.onChange},B("Reset","wp-strava"))))}}]),o}(U);var P=wp.i18n.__,D=wp.element.Component,A=wp.editor.InspectorControls,N=wp.components,F=N.PanelBody,J=N.ToggleControl,W=N.ServerSideRender,G=lodash.isEmpty,q=function(t){p()(o,t);var e,r,n=(e=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=m()(e);if(r){var o=m()(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return d()(this,t)});function o(){var t;return a()(this,o),(t=n.apply(this,arguments)).setUrl=t.setUrl.bind(c()(t)),t.switchBackToURLInput=t.switchBackToURLInput.bind(c()(t)),t.toggleImageOnly=t.toggleImageOnly.bind(c()(t)),t.toggleDisplayMarkers=t.toggleDisplayMarkers.bind(c()(t)),t.overrideSOM=t.overrideSOM.bind(c()(t)),t.state={url:t.props.attributes.url,imageOnly:t.props.attributes.imageOnly,displayMarkers:t.props.attributes.displayMarkers,som:t.props.attributes.som,editingURL:!!G(t.props.attributes.url)},t}return i()(o,[{key:"setUrl",value:function(t){t&&t.preventDefault(),this.setState({editingURL:!1}),this.props.setAttributes({url:this.state.url})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"toggleImageOnly",value:function(t){this.setState({imageOnly:t}),this.props.setAttributes({imageOnly:t})}},{key:"toggleDisplayMarkers",value:function(t){this.setState({displayMarkers:t}),this.props.setAttributes({displayMarkers:t})}},{key:"overrideSOM",value:function(t){this.setState({som:t}),this.props.setAttributes({som:t})}},{key:"render",value:function(){var t=this,e=this.state,r=e.url,n=e.editingURL,o=e.imageOnly,a=e.displayMarkers,s=e.som;return n?Object(b.createElement)(S,{icon:"chart-line",label:P("Strava Activity","wp-strava"),instructions:P("Paste a link to the Strava Activity you want to display on your site.","wp-strava"),placeholder:P("Enter Activity URL to embed here…","wp-strava"),onSubmit:this.setUrl,value:r,onChange:function(e){return t.setState({url:e.target.value})}}):Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_,{switchBackToURLInput:this.switchBackToURLInput}),Object(b.createElement)(W,{block:"wp-strava/activity",attributes:{url:r,imageOnly:o,displayMarkers:a,som:s}}),Object(b.createElement)(A,null,Object(b.createElement)(F,{title:P("Display Options","wp-strava")},Object(b.createElement)(J,{label:P("Image Only","wp-strava"),checked:o,onChange:function(e){return t.toggleImageOnly(e)}}),Object(b.createElement)(J,{label:P("Display Markers","wp-strava"),checked:a,onChange:function(e){return t.toggleDisplayMarkers(e)}}),Object(b.createElement)(L,{onChange:this.overrideSOM}))))}}]),o}(D),z=r(8);z.edit=q,z.save=function(){return null},z.transforms={from:[{type:"raw",isMatch:function(t){return"P"===t.nodeName&&t.innerText.startsWith("https://www.strava.com/activities/")},transform:function(t){return Object(n.createBlock)(z.name,{url:t.innerText})}},{type:"block",blocks:["core/paragraph"],isMatch:function(t){return t.content.startsWith("https://www.strava.com/activities/")},transform:function(t){return Object(n.createBlock)(z.name,{url:t.content})}},{type:"shortcode",tag:["activity","ride"],attributes:{url:{type:"string",shortcode:function(t){return"https://www.strava.com/activities/"+t.named.id}}}}],to:[{type:"block",blocks:["core/paragraph"],transform:function(t){return Object(n.createBlock)("core/paragraph",{content:t.url})}}]},Object(n.registerBlockType)(z.name,z);var H=wp.i18n.__,K=wp.element.Component,Q=wp.editor.InspectorControls,V=wp.components,X=V.PanelBody,Y=V.ToggleControl,Z=V.ServerSideRender,$=lodash.isEmpty,tt=function(t){p()(o,t);var e,r,n=(e=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=m()(e);if(r){var o=m()(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return d()(this,t)});function o(){var t;return a()(this,o),(t=n.apply(this,arguments)).setUrl=t.setUrl.bind(c()(t)),t.switchBackToURLInput=t.switchBackToURLInput.bind(c()(t)),t.toggleImageOnly=t.toggleImageOnly.bind(c()(t)),t.toggleDisplayMarkers=t.toggleDisplayMarkers.bind(c()(t)),t.overrideSOM=t.overrideSOM.bind(c()(t)),t.state={url:t.props.attributes.url,imageOnly:t.props.attributes.imageOnly,displayMarkers:t.props.attributes.displayMarkers,som:t.props.attributes.som,editingURL:!!$(t.props.attributes.url)},t}return i()(o,[{key:"setUrl",value:function(t){t&&t.preventDefault(),this.setState({editingURL:!1}),this.props.setAttributes({url:this.state.url})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"toggleImageOnly",value:function(t){this.setState({imageOnly:t}),this.props.setAttributes({imageOnly:t})}},{key:"toggleDisplayMarkers",value:function(t){this.setState({displayMarkers:t}),this.props.setAttributes({displayMarkers:t})}},{key:"overrideSOM",value:function(t){this.setState({som:t}),this.props.setAttributes({som:t})}},{key:"render",value:function(){var t=this,e=this.state,r=e.url,n=e.editingURL,o=e.imageOnly,a=e.displayMarkers,s=e.som;return n?Object(b.createElement)(S,{icon:"location-alt",label:H("Strava Route","wp-strava"),instructions:H("Paste a link to the Strava Route you want to display on your site.","wp-strava"),placeholder:H("Enter Route URL to embed here…","wp-strava"),onSubmit:this.setUrl,value:r,onChange:function(e){return t.setState({url:e.target.value})}}):Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_,{switchBackToURLInput:this.switchBackToURLInput}),Object(b.createElement)(Z,{block:"wp-strava/route",attributes:{url:r,imageOnly:o,displayMarkers:a,som:s}}),Object(b.createElement)(Q,null,Object(b.createElement)(X,{title:H("Display Options","wp-strava")},Object(b.createElement)(Y,{label:H("Image Only","wp-strava"),checked:o,onChange:function(e){return t.toggleImageOnly(e)}}),Object(b.createElement)(Y,{label:H("Display Markers","wp-strava"),checked:a,onChange:function(e){return t.toggleDisplayMarkers(e)}}),Object(b.createElement)(L,{onChange:this.overrideSOM}))))}}]),o}(K),et=r(9);et.edit=tt,et.save=function(){return null},et.transforms={from:[{type:"raw",priority:10,isMatch:function(t){return"P"===t.nodeName&&t.innerText.startsWith("https://www.strava.com/routes/")},transform:function(t){return Object(n.createBlock)(et.name,{url:t.innerText})}}]},Object(n.registerBlockType)(et.name,et);var rt=wp.i18n.__,nt=wp.element.Component,ot=wp.editor.InspectorControls,at=wp.components,st=at.PanelBody,it=(at.ToggleControl,at.ServerSideRender),lt=function(t){p()(o,t);var e,r,n=(e=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=m()(e);if(r){var o=m()(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return d()(this,t)});function o(){var t;return a()(this,o),(t=n.apply(this,arguments)).overrideSOM=t.overrideSOM.bind(c()(t)),t.state={som:t.props.attributes.som},t}return i()(o,[{key:"overrideSOM",value:function(t){this.setState({som:t}),this.props.setAttributes({som:t})}},{key:"render",value:function(){var t=this.state.som;return Object(b.createElement)(b.Fragment,null,Object(b.createElement)(it,{block:"wp-strava/activitieslist",attributes:{som:t}}),Object(b.createElement)(ot,null,Object(b.createElement)(st,{title:rt("Display Options","wp-strava")},Object(b.createElement)(L,{onChange:this.overrideSOM}))))}}]),o}(nt),ct=r(11);ct.edit=lt,ct.save=function(){return null},Object(n.registerBlockType)(ct.name,ct);var ut=wp.i18n.__,pt=wp.element.Component,ft=wp.editor.InspectorControls,dt=wp.components,yt=dt.PanelBody,mt=dt.ToggleControl,bt=dt.ServerSideRender,vt=lodash.isEmpty,ht=function(t){p()(o,t);var e,r,n=(e=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=m()(e);if(r){var o=m()(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return d()(this,t)});function o(){var t;return a()(this,o),(t=n.apply(this,arguments)).setUrl=t.setUrl.bind(c()(t)),t.switchBackToURLInput=t.switchBackToURLInput.bind(c()(t)),t.toggleImageOnly=t.toggleImageOnly.bind(c()(t)),t.toggleDisplayMarkers=t.toggleDisplayMarkers.bind(c()(t)),t.overrideSOM=t.overrideSOM.bind(c()(t)),t.state={url:t.props.attributes.url,imageOnly:t.props.attributes.imageOnly,displayMarkers:t.props.attributes.displayMarkers,som:t.props.attributes.som,editingURL:!!vt(t.props.attributes.url)},t}return i()(o,[{key:"setUrl",value:function(t){t&&t.preventDefault(),this.setState({editingURL:!1}),this.props.setAttributes({url:this.state.url})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"toggleImageOnly",value:function(t){this.setState({imageOnly:t}),this.props.setAttributes({imageOnly:t})}},{key:"toggleDisplayMarkers",value:function(t){this.setState({displayMarkers:t}),this.props.setAttributes({displayMarkers:t})}},{key:"overrideSOM",value:function(t){this.setState({som:t}),this.props.setAttributes({som:t})}},{key:"render",value:function(){var t=this,e=this.state,r=e.url,n=e.editingURL,o=e.imageOnly,a=e.displayMarkers,s=e.som;return n?Object(b.createElement)(S,{icon:"location-alt",label:ut("Strava Segment","wp-strava"),instructions:ut("Paste a link to the Strava Segment you want to display on your site.","wp-strava"),placeholder:ut("Enter Segment URL to embed here…","wp-strava"),onSubmit:this.setUrl,value:r,onChange:function(e){return t.setState({url:e.target.value})}}):Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_,{switchBackToURLInput:this.switchBackToURLInput}),Object(b.createElement)(bt,{block:"wp-strava/segment",attributes:{url:r,imageOnly:o,displayMarkers:a,som:s}}),Object(b.createElement)(ft,null,Object(b.createElement)(yt,{title:ut("Display Options","wp-strava")},Object(b.createElement)(mt,{label:ut("Image Only","wp-strava"),checked:o,onChange:function(e){return t.toggleImageOnly(e)}}),Object(b.createElement)(mt,{label:ut("Display Markers","wp-strava"),checked:a,onChange:function(e){return t.toggleDisplayMarkers(e)}}),Object(b.createElement)(L,{onChange:this.overrideSOM}))))}}]),o}(pt),gt=r(10);gt.edit=ht,gt.save=function(){return null},gt.transforms={from:[{type:"raw",priority:10,isMatch:function(t){return"P"===t.nodeName&&t.innerText.startsWith("https://www.strava.com/segments/")},transform:function(t){return Object(n.createBlock)(gt.name,{url:t.innerText})}}]},Object(n.registerBlockType)(gt.name,gt)}]); -
wp-strava/trunk/css/wp-strava.css
r2716483 r2792647 10 10 margin: 0 6px 2px 0; 11 11 } 12 12 13 .wp-strava-activity-container { 13 14 display: table; 14 15 margin: 0 auto; 15 16 } 17 16 18 .activity-details-table tr td { 17 19 padding: 5px; 18 20 } 21 19 22 .activity-details-table th { 20 23 padding: 5px; … … 22 25 font-size: 0.8em; 23 26 } 27 28 .activity-details-table td:before { 29 position: relative; 30 } 31 24 32 .activity-details-table td { 25 33 text-align: center; 26 34 border: 1px solid #e7e7e7; 27 35 } 36 28 37 .activity-details-table-info { 29 38 font-size: 1.2em; … … 31 40 text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.4); 32 41 } 42 33 43 .activity-details-table-units { 34 44 font-size: 0.8em; -
wp-strava/trunk/readme.txt
r2716486 r2792647 4 4 Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, paddle, kayak, gps, shortcode, widget, plugin, block, blocks 5 5 Requires at least: 4.6 6 Tested up to: 5.87 Stable tag: 2.1 1.16 Tested up to: 6.0 7 Stable tag: 2.12.0 8 8 Requires PHP: 5.3 9 9 License: GPLv2 or later … … 23 23 = Blocks = 24 24 25 *Available in WordPress 5.0 and up.* 25 *Available in WordPress 5.0 and up.* Embeds described in this section will only work in the WP Block (Gutenberg) editor. Compatibility with WPBakery, Visual Composer, Elementor, Beaver Builder, etc. may differ. 26 26 27 27 == Strava Activity == … … 104 104 = Why is my Google Map not showing up? = 105 105 106 If your API key works with other Google Maps plugins but not WP Strava, you may need to enable the "Static Maps" functionality on your google account. This is especially true for people using G Suite accounts (not just a @gmail.com address). While logged into your G Suite email, visit https://console.developers.google.com/apis/library/static-maps-backend.googleapis.com/?q=static and make sure the "Static Maps API" is enabled. For more details see https://wordpress.org/support/topic/no-data-errors/106 If your API key works with other Google Maps plugins but not WP-Strava, you may need to enable the "Static Maps" functionality on your google account. This is especially true for people using G Suite accounts (not just a @gmail.com address). While logged into your G Suite email, visit https://console.developers.google.com/apis/library/static-maps-backend.googleapis.com/?q=static and make sure the "Static Maps API" is enabled. For more details see https://wordpress.org/support/topic/no-data-errors/ 107 107 108 108 … … 119 119 == Screenshots == 120 120 121 1. WP Strava settings - this walks you through connecting the WPStrava plugin to your Strava account. You can connect multiple accounts by authenticating each one here. Add your Google Maps key for map display here. You can also set the system of measurement (miles/kilometers) and clear any saved data.121 1. WP-Strava settings - this walks you through connecting the WP-Strava plugin to your Strava account. You can connect multiple accounts by authenticating each one here. Add your Google Maps key for map display here. You can also set the system of measurement (miles/kilometers) and clear any saved data. 122 122 2. Strava Activities List Widget - shows a list of the most recent activities for the selected athlete. 123 123 3. Strava Activities List Widget Settings - settings for the Strava Activities List Widget. … … 135 135 == Changelog == 136 136 137 = 2.12.0 = 138 Update documentation around block embeds https://wordpress.org/support/topic/which-editor-to-use-2/ 139 Added debugging for API GET/POST to troubleshoot 401 errors https://wordpress.org/support/topic/wp-strava-error-401-unauthorized/ 140 141 137 142 = 2.11.1 = 138 143 Add class selector to responsive tables https://wordpress.org/support/topic/shortcode-embed-responsive-table-styling-issues/ 144 139 145 140 146 = 2.11.0 = -
wp-strava/trunk/src/WPStrava.php
r2651185 r2792647 244 244 245 245 // automatically load dependencies and version 246 $asset_file = include WPSTRAVA_PLUGIN_DIR . 'build/index.asset.php';246 $asset_file = require WPSTRAVA_PLUGIN_DIR . 'build/index.asset.php'; 247 247 248 248 wp_register_script( -
wp-strava/trunk/src/WPStrava/API.php
r2504177 r2792647 45 45 46 46 $response = wp_remote_post( $url . $uri, $args ); 47 48 if ( WPSTRAVA_DEBUG ) { 49 // phpcs:disable WordPress.PHP.DevelopmentFunctions -- Debug output. 50 error_log( 51 print_r( 52 array( 53 'url' => $url . $uri, 54 'args' => $args, 55 'response' => $response, 56 ), 57 true 58 ) 59 ); 60 // phpcs:enable 61 } 47 62 48 63 if ( is_wp_error( $response ) ) { … … 137 152 138 153 $response = wp_remote_get( $url, $get_args ); 154 155 if ( WPSTRAVA_DEBUG ) { 156 // phpcs:disable WordPress.PHP.DevelopmentFunctions -- Debug output. 157 error_log( 158 print_r( 159 array( 160 'url' => $url, 161 'args' => $get_args, 162 'response' => $response, 163 ), 164 true 165 ) 166 ); 167 // phpcs:enable 168 } 169 139 170 if ( is_wp_error( $response ) ) { 140 171 throw WPStrava_Exception::from_wp_error( $response ); … … 147 178 if ( $auth instanceof WPStrava_AuthRefresh ) { 148 179 $auth->auth_refresh(); 149 $access_token = $this->get_access_token(); 150 if ( $access_token ) { 151 $get_args['headers']['Authorization'] = 'Bearer ' . $access_token; 152 } 153 return $this->remote_get( $uri, $get_args ); 180 // Try again. 181 return $this->remote_get( $uri, $args ); 154 182 } 155 183 } -
wp-strava/trunk/src/WPStrava/Auth.php
r2604596 r2792647 48 48 'flags' => FILTER_REQUIRE_SCALAR, 49 49 ), 50 'strava_client_secret' => FILTER_SANITIZE_ STRING,50 'strava_client_secret' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 51 51 ); 52 52 … … 58 58 59 59 // Redirect only if all the right options are in place. 60 if ( $settings->is_settings_updated( $value ) && $settings->is_option _page() ) {60 if ( $settings->is_settings_updated( $value ) && $settings->is_options_page() ) { 61 61 // Only re-auth if client ID and secret were saved. 62 62 if ( ! empty( $input['strava_client_id'] ) && ! empty( $input['strava_client_secret'] ) ) { … … 72 72 73 73 $input_args = array( 74 'settings-updated' => FILTER_SANITIZE_ STRING,75 'code' => FILTER_SANITIZE_ STRING,74 'settings-updated' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 75 'code' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 76 76 ); 77 77 -
wp-strava/trunk/src/WPStrava/Settings.php
r2651185 r2792647 13 13 private $ids = array(); 14 14 private $page_name = 'wp-strava-options'; 15 private $option_ page= 'wp-strava-settings-group';15 private $option_group = 'wp-strava-settings-group'; 16 16 private $adding_athlete = true; 17 17 … … 59 59 $ids = $this->get_ids(); 60 60 if ( $this->ids_empty( $ids ) ) { 61 register_setting( $this->option_ page, 'strava_client_id', array( $this, 'sanitize_client_id' ) );62 register_setting( $this->option_ page, 'strava_client_secret', array( $this, 'sanitize_client_secret' ) );63 register_setting( $this->option_ page, 'strava_nickname', array( $this, 'sanitize_nickname' ) );61 register_setting( $this->option_group, 'strava_client_id', array( $this, 'sanitize_client_id' ) ); 62 register_setting( $this->option_group, 'strava_client_secret', array( $this, 'sanitize_client_secret' ) ); 63 register_setting( $this->option_group, 'strava_nickname', array( $this, 'sanitize_nickname' ) ); 64 64 65 65 add_settings_field( 'strava_client_id', __( 'Strava Client ID', 'wp-strava' ), array( $this, 'print_client_input' ), 'wp-strava', 'strava_api' ); … … 67 67 add_settings_field( 'strava_nickname', __( 'Strava Nickname', 'wp-strava' ), array( $this, 'print_nickname_input' ), 'wp-strava', 'strava_api' ); 68 68 } else { 69 register_setting( $this->option_ page, 'strava_id', array( $this, 'sanitize_id' ) );69 register_setting( $this->option_group, 'strava_id', array( $this, 'sanitize_id' ) ); 70 70 add_settings_field( 'strava_id', __( 'Saved ID', 'wp-strava' ), array( $this, 'print_id_input' ), 'wp-strava', 'strava_api' ); 71 71 72 72 // Add additional fields 73 register_setting( $this->option_ page, 'strava_client_id', array( $this, 'sanitize_client_id' ) );74 register_setting( $this->option_ page, 'strava_client_secret', array( $this, 'sanitize_client_secret' ) );75 register_setting( $this->option_ page, 'strava_nickname', array( $this, 'sanitize_nickname' ) );73 register_setting( $this->option_group, 'strava_client_id', array( $this, 'sanitize_client_id' ) ); 74 register_setting( $this->option_group, 'strava_client_secret', array( $this, 'sanitize_client_secret' ) ); 75 register_setting( $this->option_group, 'strava_nickname', array( $this, 'sanitize_nickname' ) ); 76 76 77 77 add_settings_field( 'strava_client_id', __( 'Additional Athlete Client ID', 'wp-strava' ), array( $this, 'print_client_input' ), 'wp-strava', 'strava_api' ); … … 83 83 add_settings_section( 'strava_maps', __( 'Maps', 'wp-strava' ), null, 'wp-strava' ); 84 84 85 register_setting( $this->option_ page, 'strava_map_type', array( $this, 'sanitize_map_type' ) );85 register_setting( $this->option_group, 'strava_map_type', array( $this, 'sanitize_map_type' ) ); 86 86 add_settings_field( 'strava_map_type', __( 'Map Type', 'wp-strava' ), array( $this, 'print_map_type_input' ), 'wp-strava', 'strava_maps' ); 87 87 88 register_setting( $this->option_ page, 'strava_gmaps_key', array( $this, 'sanitize_gmaps_key' ) );88 register_setting( $this->option_group, 'strava_gmaps_key', array( $this, 'sanitize_gmaps_key' ) ); 89 89 add_settings_field( 'strava_gmaps_key', __( 'Google Static Maps API Key', 'wp-strava' ), array( $this, 'print_gmaps_key_input' ), 'wp-strava', 'strava_maps' ); 90 90 91 register_setting( $this->option_ page, 'strava_mapbox_token', array( $this, 'sanitize_mapbox_token' ) );91 register_setting( $this->option_group, 'strava_mapbox_token', array( $this, 'sanitize_mapbox_token' ) ); 92 92 add_settings_field( 'strava_mapbox_token', __( 'Mapbox Public Token', 'wp-strava' ), array( $this, 'print_mapbox_token_input' ), 'wp-strava', 'strava_maps' ); 93 93 94 94 // System of Measurement. 95 register_setting( $this->option_ page, 'strava_som', array( $this, 'sanitize_som' ) );95 register_setting( $this->option_group, 'strava_som', array( $this, 'sanitize_som' ) ); 96 96 add_settings_section( 'strava_options', __( 'Options', 'wp-strava' ), null, 'wp-strava' ); 97 97 add_settings_field( 'strava_som', __( 'System of Measurement', 'wp-strava' ), array( $this, 'print_som_input' ), 'wp-strava', 'strava_options' ); 98 98 99 99 // Hide Options. 100 register_setting( $this->option_ page, 'strava_hide_time', array( $this, 'sanitize_hide_time' ) );100 register_setting( $this->option_group, 'strava_hide_time', array( $this, 'sanitize_hide_time' ) ); 101 101 add_settings_field( 'strava_hide_time', __( 'Time', 'wp-strava' ), array( $this, 'print_hide_time_input' ), 'wp-strava', 'strava_options' ); 102 register_setting( $this->option_ page, 'strava_hide_elevation', array( $this, 'sanitize_hide_elevation' ) );102 register_setting( $this->option_group, 'strava_hide_elevation', array( $this, 'sanitize_hide_elevation' ) ); 103 103 add_settings_field( 'strava_hide_elevation', __( 'Elevation', 'wp-strava' ), array( $this, 'print_hide_elevation_input' ), 'wp-strava', 'strava_options' ); 104 104 105 105 // No Activity Links. 106 register_setting( $this->option_ page, 'strava_no_link', array( $this, 'sanitize_no_link' ) );106 register_setting( $this->option_group, 'strava_no_link', array( $this, 'sanitize_no_link' ) ); 107 107 add_settings_field( 'strava_no_link', __( 'Links', 'wp-strava' ), array( $this, 'print_no_link_input' ), 'wp-strava', 'strava_options' ); 108 108 109 109 // Cache lifetime. 110 register_setting( $this->option_ page, 'strava_cache_time', array( $this, 'sanitize_cache_time' ) );110 register_setting( $this->option_group, 'strava_cache_time', array( $this, 'sanitize_cache_time' ) ); 111 111 add_settings_section( 'strava_cache', __( 'Cache', 'wp-strava' ), null, 'wp-strava' ); 112 112 add_settings_field( 'strava_cache_time', __( 'Cache time', 'wp-strava' ), array( $this, 'print_cache_input' ), 'wp-strava', 'strava_cache' ); 113 113 114 114 // Clear cache. 115 register_setting( $this->option_ page, 'strava_cache_clear', array( $this, 'sanitize_cache_clear' ) );115 register_setting( $this->option_group, 'strava_cache_clear', array( $this, 'sanitize_cache_clear' ) ); 116 116 add_settings_field( 'strava_cache_clear', __( 'Clear cache', 'wp-strava' ), array( $this, 'print_clear_input' ), 'wp-strava', 'strava_cache' ); 117 118 if ( WPSTRAVA_DEBUG ) { 119 add_settings_section( 'strava_debug', __( 'Debug', 'wp-strava' ), null, 'wp-strava' ); 120 add_settings_field( 'strava_debug_info', __( 'Connection Info', 'wp-strava' ), array( $this, 'print_debug_info' ), 'wp-strava', 'strava_debug' ); 121 } 117 122 } 118 123 … … 450 455 451 456 foreach ( $infos as $id => $info ) { 452 if ( ! in_array( $id, $ids ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict -- loose OK. 457 // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict -- Loose comparison OK. 458 if ( ! in_array( $id, $ids ) ) { 453 459 $update = true; 454 460 unset( $infos[ $id ] ); … … 676 682 <p class="description"><?php esc_html_e( 'How often to refresh data from the Strava API', 'wp-strava' ); ?></p> 677 683 <?php 684 } 685 686 /** 687 * Print stored connection info. 688 * 689 * @author Justin Foell <justin@foell.org> 690 * @since NEXT 691 */ 692 public function print_debug_info() { 693 // phpcs:ignore Squiz.PHP.EmbeddedPhp, WordPress.PHP.DevelopmentFunctions -- Formatting & debug OK. 694 ?><textarea style="width: 100%;" rows="11" readonly="readonly"><?php var_export( get_option( 'strava_info' ) ); ?></textarea><?php 678 695 } 679 696 … … 869 886 870 887 /** 871 * Whether or not we're on the options page.888 * Whether or not we're on the options.php page (saving options). 872 889 * 873 890 * @return boolean … … 875 892 * @since 2.0.0 876 893 */ 877 public function is_option_page() { 878 return filter_input( INPUT_POST, 'option_page', FILTER_SANITIZE_STRING ) === $this->option_page; 894 public function is_options_page() { 895 $screen = get_current_screen(); 896 return isset( $screen->id ) && 'options' === $screen->id; 879 897 } 880 898 … … 887 905 */ 888 906 public function is_settings_page() { 889 return filter_input( INPUT_GET, 'page', FILTER_SANITIZE_ STRING) === $this->page_name;907 return filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) === $this->page_name; 890 908 } 891 909 … … 909 927 */ 910 928 private function is_adding_athlete() { 911 return filter_input( INPUT_POST, 'strava_client_id', FILTER_SANITIZE_NUMBER_INT ) && filter_input( INPUT_POST, 'strava_client_secret', FILTER_SANITIZE_STRING ); 929 return filter_input( INPUT_POST, 'strava_client_id', FILTER_SANITIZE_NUMBER_INT ) && 930 filter_input( INPUT_POST, 'strava_client_secret', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); 912 931 } 913 932 -
wp-strava/trunk/templates/admin-settings.php
r2184737 r2792647 4 4 5 5 <form method="post" action="<?php echo esc_attr( admin_url( 'options.php' ) ); ?>"> 6 <?php settings_fields( $this->option_ page); ?>6 <?php settings_fields( $this->option_group ); ?> 7 7 <?php do_settings_sections( 'wp-strava' ); ?> 8 8 -
wp-strava/trunk/wp-strava.php
r2716483 r2792647 4 4 * Plugin URI: https://wordpress.org/plugins/wp-strava/ 5 5 * Description: Show your strava.com activity on your WordPress site. Some Icons are Copyright © Yusuke Kamiyamane. All rights reserved. Licensed under a Creative Commons Attribution 3.0 license. 6 * Version: 2.1 1.16 * Version: 2.12.0 7 7 * Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb 8 8 * License: GPL2 … … 28 28 */ 29 29 30 define( 'WPSTRAVA_PLUGIN_VERSION', '2.11.1' ); 30 31 define( 'WPSTRAVA_PLUGIN_VERSION', '2.12.0' ); 31 32 define( 'WPSTRAVA_PLUGIN_FILE', __FILE__ ); 32 33 define( 'WPSTRAVA_PLUGIN_DIR', trailingslashit( dirname( __FILE__ ) ) );
Note: See TracChangeset
for help on using the changeset viewer.