Better Click To Tweet - Version 5.8.0

Version Description

  • new adding a filter and various other enhancements to support a new UTM tags add-on
  • fix testing with the newest version of the block-based editor (Gutenberg)
  • new added a constant to define the core BCTT version, allowing add-ons to make sure that BCTT core is up to date before activating.
Download this release

Release Info

Developer ben.meredith@gmail.com
Plugin Icon 128x128 Better Click To Tweet
Version 5.8.0
Comparing to
See all releases

Code changes from version 5.7.2 to 5.8.0

assets/block/build/script.js CHANGED
@@ -1,6 +1,1029 @@
1
- this.bctt=this.bctt||{},this.bctt.main=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=11)}([function(t,e){!function(){t.exports=this.wp.i18n}()},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n=t.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(7),o=n(8);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(33);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){!function(){t.exports=this.wp.editor}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=(n.n(r),n(12)),u=(n.n(o),n(13)),c=n(14),i=n(49);e.default=Object(o.registerBlockType)("bctt/clicktotweet",{title:Object(r.__)("Better Click to Tweet"),description:Object(r.__)("Add text for your readers to tweet, calling them to action on your behalf."),category:"widgets",icon:"twitter",keywords:[Object(r.__)("Twitter"),Object(r.__)("Tweet")],attributes:u.a,edit:c.a,save:i.a})},function(t,e){!function(){t.exports=this.wp.blocks}()},function(t,e,n){"use strict";var r=n(0),o=(n.n(r),{tweet:{type:"string"},username:{type:"string",default:bctt_options_js.username},via:{type:"boolean",default:!0},url:{type:"boolean",default:!0},urlcustom:{type:"string"},nofollow:{type:"boolean",default:!1},prompt:{type:"string",default:Object(r.__)("Click To Tweet")}});e.a=o},function(t,e,n){"use strict";var r=n(15),o=n.n(r),u=n(44),c=n.n(u),i=n(0),a=(n.n(i),n(45)),f=(n.n(a),n(10)),l=(n.n(f),n(46)),s=n(48),p=(n.n(s),function(t){var e=t.attributes,n=t.setAttributes,r=t.className,u=e.tweet,s=e.prompt,p=function(t){n({tweet:t})},v=function(){return!1};return wp.element.createElement(a.Fragment,null,wp.element.createElement(l.a,o()({},t)),wp.element.createElement("span",{className:c()(r,"bctt-click-to-tweet")},wp.element.createElement("span",{className:"bctt-ctt-text"},wp.element.createElement(f.RichText,{format:"string",formattingControls:[],tagName:"div",placeholder:Object(i.__)("Enter text for readers to Tweet"),onChange:p,value:u})),wp.element.createElement("a",{href:"#",onClick:v,className:"bctt-ctt-btn"},s)))});e.a=p},function(t,e,n){"use strict";e.__esModule=!0;var r=n(16),o=function(t){return t&&t.__esModule?t:{default:t}}(r);e.default=o.default||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e,n){t.exports={default:n(17),__esModule:!0}},function(t,e,n){n(18),t.exports=n(5).Object.assign},function(t,e,n){var r=n(19);r(r.S+r.F,"Object",{assign:n(29)})},function(t,e,n){var r=n(1),o=n(5),u=n(20),c=n(22),i=function(t,e,n){var a,f,l,s=t&i.F,p=t&i.G,v=t&i.S,b=t&i.P,m=t&i.B,h=t&i.W,y=p?o:o[e]||(o[e]={}),w=y.prototype,_=p?r:v?r[e]:(r[e]||{}).prototype;p&&(n=e);for(a in n)(f=!s&&_&&void 0!==_[a])&&a in y||(l=f?_[a]:n[a],y[a]=p&&"function"!=typeof _[a]?n[a]:m&&f?u(l,r):h&&_[a]==l?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):b&&"function"==typeof l?u(Function.call,l):l,b&&((y.virtual||(y.virtual={}))[a]=l,t&i.R&&w&&!w[a]&&c(w,a,l)))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,i.U=64,i.R=128,t.exports=i},function(t,e,n){var r=n(21);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(23),o=n(28);t.exports=n(3)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(24),o=n(25),u=n(27),c=Object.defineProperty;e.f=n(3)?Object.defineProperty:function(t,e,n){if(r(t),e=u(e,!0),r(n),o)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(2);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){t.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(26)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(2),o=n(1).document,u=r(o)&&r(o.createElement);t.exports=function(t){return u?o.createElement(t):{}}},function(t,e,n){var r=n(2);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(30),o=n(41),u=n(42),c=n(43),i=n(7),a=Object.assign;t.exports=!a||n(4)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=a({},t)[n]||Object.keys(a({},e)).join("")!=r})?function(t,e){for(var n=c(t),a=arguments.length,f=1,l=o.f,s=u.f;a>f;)for(var p,v=i(arguments[f++]),b=l?r(v).concat(l(v)):r(v),m=b.length,h=0;m>h;)s.call(v,p=b[h++])&&(n[p]=v[p]);return n}:a},function(t,e,n){var r=n(31),o=n(40);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(32),o=n(6),u=n(34)(!1),c=n(37)("IE_PROTO");t.exports=function(t,e){var n,i=o(t),a=0,f=[];for(n in i)n!=c&&r(i,n)&&f.push(n);for(;e.length>a;)r(i,n=e[a++])&&(~u(f,n)||f.push(n));return f}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(6),o=n(35),u=n(36);t.exports=function(t){return function(e,n,c){var i,a=r(e),f=o(a.length),l=u(c,f);if(t&&n!=n){for(;f>l;)if((i=a[l++])!=i)return!0}else for(;f>l;l++)if((t||l in a)&&a[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var r=n(9),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(9),o=Math.max,u=Math.min;t.exports=function(t,e){return t=r(t),t<0?o(t+e,0):u(t,e)}},function(t,e,n){var r=n(38)("keys"),o=n(39);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(1),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(8);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r,o;/*!
2
Copyright (c) 2016 Jed Watson.
3
Licensed under the MIT License (MIT), see
4
http://jedwatson.github.io/classnames
5
*/
6
- !function(){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++){var r=arguments[e];if(r){var o=typeof r;if("string"===o||"number"===o)t.push(r);else if(Array.isArray(r))t.push(n.apply(null,r));else if("object"===o)for(var c in r)u.call(r,c)&&r[c]&&t.push(c)}}return t.join(" ")}var u={}.hasOwnProperty;void 0!==t&&t.exports?t.exports=n:(r=[],void 0!==(o=function(){return n}.apply(e,r))&&(t.exports=o))}()},function(t,e){!function(){t.exports=this.wp.element}()},function(t,e,n){"use strict";var r=n(0),o=(n.n(r),n(10)),u=(n.n(o),n(47)),c=(n.n(u),function(t){var e=t.attributes,n=t.setAttributes,c=e.username,i=e.via,a=e.url,f=e.urlcustom,l=e.nofollow,s=e.prompt,p=function(t){n({username:t})},v=function(){n({via:!i})},b=function(){n({url:!a})},m=function(t){n({urlcustom:t})},h=function(){n({nofollow:!l})},y=function(t){n({prompt:t})};return wp.element.createElement(o.InspectorControls,{key:"inspector"},wp.element.createElement(u.PanelBody,{Title:Object(r.__)("Tweet Settings")},wp.element.createElement(u.TextControl,{label:Object(r.__)("Twitter Username"),value:c,onChange:p}),wp.element.createElement(u.ToggleControl,{label:Object(r.__)("Include the username in Tweet?"),checked:!!i,onChange:v}),wp.element.createElement(u.ToggleControl,{label:Object(r.__)("Include URL in tweet?"),checked:!!a,onChange:b}),wp.element.createElement(u.TextControl,{label:Object(r.__)("Custom URL"),value:f,onChange:m,help:Object(r.__)("Custom URL to use instead of post")}),wp.element.createElement(u.ToggleControl,{label:Object(r.__)("Nofollow"),checked:!!l,onChange:h,help:Object(r.__)("Make links nofollow")}),wp.element.createElement(u.TextControl,{label:Object(r.__)("Prompt"),value:s,onChange:y,help:Object(r.__)("Text for action/prompt link")})))});e.a=c},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){},function(t,e,n){"use strict";var r=function(){return null};e.a=r}]);
1
+ this["bctt"] = this["bctt"] || {}; this["bctt"]["main"] =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId]) {
11
+ /******/ return installedModules[moduleId].exports;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ i: moduleId,
16
+ /******/ l: false,
17
+ /******/ exports: {}
18
+ /******/ };
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+ /******/
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.l = true;
25
+ /******/
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+ /******/
30
+ /******/
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+ /******/
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+ /******/
37
+ /******/ // define getter function for harmony exports
38
+ /******/ __webpack_require__.d = function(exports, name, getter) {
39
+ /******/ if(!__webpack_require__.o(exports, name)) {
40
+ /******/ Object.defineProperty(exports, name, {
41
+ /******/ configurable: false,
42
+ /******/ enumerable: true,
43
+ /******/ get: getter
44
+ /******/ });
45
+ /******/ }
46
+ /******/ };
47
+ /******/
48
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
49
+ /******/ __webpack_require__.n = function(module) {
50
+ /******/ var getter = module && module.__esModule ?
51
+ /******/ function getDefault() { return module['default']; } :
52
+ /******/ function getModuleExports() { return module; };
53
+ /******/ __webpack_require__.d(getter, 'a', getter);
54
+ /******/ return getter;
55
+ /******/ };
56
+ /******/
57
+ /******/ // Object.prototype.hasOwnProperty.call
58
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
59
+ /******/
60
+ /******/ // __webpack_public_path__
61
+ /******/ __webpack_require__.p = "";
62
+ /******/
63
+ /******/ // Load entry module and return exports
64
+ /******/ return __webpack_require__(__webpack_require__.s = 13);
65
+ /******/ })
66
+ /************************************************************************/
67
+ /******/ ([
68
+ /* 0 */
69
+ /***/ (function(module, exports, __webpack_require__) {
70
+
71
+ // Thank's IE8 for his funny defineProperty
72
+ module.exports = !__webpack_require__(5)(function () {
73
+ return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
74
+ });
75
+
76
+
77
+ /***/ }),
78
+ /* 1 */
79
+ /***/ (function(module, exports) {
80
+
81
+ (function() { module.exports = this["wp"]["i18n"]; }());
82
+
83
+ /***/ }),
84
+ /* 2 */
85
+ /***/ (function(module, exports) {
86
+
87
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
88
+ var global = module.exports = typeof window != 'undefined' && window.Math == Math
89
+ ? window : typeof self != 'undefined' && self.Math == Math ? self
90
+ // eslint-disable-next-line no-new-func
91
+ : Function('return this')();
92
+ if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
93
+
94
+
95
+ /***/ }),
96
+ /* 3 */
97
+ /***/ (function(module, exports) {
98
+
99
+ var core = module.exports = { version: '2.5.3' };
100
+ if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
101
+
102
+
103
+ /***/ }),
104
+ /* 4 */
105
+ /***/ (function(module, exports) {
106
+
107
+ module.exports = function (it) {
108
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
109
+ };
110
+
111
+
112
+ /***/ }),
113
+ /* 5 */
114
+ /***/ (function(module, exports) {
115
+
116
+ module.exports = function (exec) {
117
+ try {
118
+ return !!exec();
119
+ } catch (e) {
120
+ return true;
121
+ }
122
+ };
123
+
124
+
125
+ /***/ }),
126
+ /* 6 */
127
+ /***/ (function(module, exports, __webpack_require__) {
128
+
129
+ var global = __webpack_require__(2);
130
+ var core = __webpack_require__(3);
131
+ var ctx = __webpack_require__(20);
132
+ var hide = __webpack_require__(22);
133
+ var PROTOTYPE = 'prototype';
134
+
135
+ var $export = function (type, name, source) {
136
+ var IS_FORCED = type & $export.F;
137
+ var IS_GLOBAL = type & $export.G;
138
+ var IS_STATIC = type & $export.S;
139
+ var IS_PROTO = type & $export.P;
140
+ var IS_BIND = type & $export.B;
141
+ var IS_WRAP = type & $export.W;
142
+ var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
143
+ var expProto = exports[PROTOTYPE];
144
+ var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
145
+ var key, own, out;
146
+ if (IS_GLOBAL) source = name;
147
+ for (key in source) {
148
+ // contains in native
149
+ own = !IS_FORCED && target && target[key] !== undefined;
150
+ if (own && key in exports) continue;
151
+ // export native or passed
152
+ out = own ? target[key] : source[key];
153
+ // prevent global pollution for namespaces
154
+ exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
155
+ // bind timers to global for call from export context
156
+ : IS_BIND && own ? ctx(out, global)
157
+ // wrap global constructors for prevent change them in library
158
+ : IS_WRAP && target[key] == out ? (function (C) {
159
+ var F = function (a, b, c) {
160
+ if (this instanceof C) {
161
+ switch (arguments.length) {
162
+ case 0: return new C();
163
+ case 1: return new C(a);
164
+ case 2: return new C(a, b);
165
+ } return new C(a, b, c);
166
+ } return C.apply(this, arguments);
167
+ };
168
+ F[PROTOTYPE] = C[PROTOTYPE];
169
+ return F;
170
+ // make static versions for prototype methods
171
+ })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
172
+ // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
173
+ if (IS_PROTO) {
174
+ (exports.virtual || (exports.virtual = {}))[key] = out;
175
+ // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
176
+ if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
177
+ }
178
+ }
179
+ };
180
+ // type bitmap
181
+ $export.F = 1; // forced
182
+ $export.G = 2; // global
183
+ $export.S = 4; // static
184
+ $export.P = 8; // proto
185
+ $export.B = 16; // bind
186
+ $export.W = 32; // wrap
187
+ $export.U = 64; // safe
188
+ $export.R = 128; // real proto method for `library`
189
+ module.exports = $export;
190
+
191
+
192
+ /***/ }),
193
+ /* 7 */
194
+ /***/ (function(module, exports, __webpack_require__) {
195
+
196
+ var anObject = __webpack_require__(23);
197
+ var IE8_DOM_DEFINE = __webpack_require__(24);
198
+ var toPrimitive = __webpack_require__(26);
199
+ var dP = Object.defineProperty;
200
+
201
+ exports.f = __webpack_require__(0) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
202
+ anObject(O);
203
+ P = toPrimitive(P, true);
204
+ anObject(Attributes);
205
+ if (IE8_DOM_DEFINE) try {
206
+ return dP(O, P, Attributes);
207
+ } catch (e) { /* empty */ }
208
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
209
+ if ('value' in Attributes) O[P] = Attributes.value;
210
+ return O;
211
+ };
212
+
213
+
214
+ /***/ }),
215
+ /* 8 */
216
+ /***/ (function(module, exports, __webpack_require__) {
217
+
218
+ // to indexed object, toObject with fallback for non-array-like ES3 strings
219
+ var IObject = __webpack_require__(9);
220
+ var defined = __webpack_require__(10);
221
+ module.exports = function (it) {
222
+ return IObject(defined(it));
223
+ };
224
+
225
+
226
+ /***/ }),
227
+ /* 9 */
228
+ /***/ (function(module, exports, __webpack_require__) {
229
+
230
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
231
+ var cof = __webpack_require__(32);
232
+ // eslint-disable-next-line no-prototype-builtins
233
+ module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
234
+ return cof(it) == 'String' ? it.split('') : Object(it);
235
+ };
236
+
237
+
238
+ /***/ }),
239
+ /* 10 */
240
+ /***/ (function(module, exports) {
241
+
242
+ // 7.2.1 RequireObjectCoercible(argument)
243
+ module.exports = function (it) {
244
+ if (it == undefined) throw TypeError("Can't call method on " + it);
245
+ return it;
246
+ };
247
+
248
+
249
+ /***/ }),
250
+ /* 11 */
251
+ /***/ (function(module, exports) {
252
+
253
+ // 7.1.4 ToInteger
254
+ var ceil = Math.ceil;
255
+ var floor = Math.floor;
256
+ module.exports = function (it) {
257
+ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
258
+ };
259
+
260
+
261
+ /***/ }),
262
+ /* 12 */
263
+ /***/ (function(module, exports) {
264
+
265
+ (function() { module.exports = this["wp"]["editor"]; }());
266
+
267
+ /***/ }),
268
+ /* 13 */
269
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
270
+
271
+ "use strict";
272
+ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
273
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__wordpress_i18n__ = __webpack_require__(1);
274
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__wordpress_i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__wordpress_i18n__);
275
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__wordpress_blocks__ = __webpack_require__(14);
276
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__wordpress_blocks___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__wordpress_blocks__);
277
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__editor__ = __webpack_require__(15);
278
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__render__ = __webpack_require__(52);
279
+ /**
280
+ * WordPress dependencies
281
+ */
282
+
283
+
284
+
285
+ /**
286
+ * Internal dependencies
287
+ */
288
+
289
+
290
+
291
+ /**
292
+ * Register block
293
+ */
294
+ /* harmony default export */ __webpack_exports__["default"] = (Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_blocks__["registerBlockType"])("bctt/clicktotweet", {
295
+ title: Object(__WEBPACK_IMPORTED_MODULE_0__wordpress_i18n__["__"])("Better Click to Tweet"),
296
+ description: Object(__WEBPACK_IMPORTED_MODULE_0__wordpress_i18n__["__"])("Add text for your readers to tweet, calling them to action on your behalf."),
297
+ category: "widgets",
298
+ icon: "twitter",
299
+ keywords: [Object(__WEBPACK_IMPORTED_MODULE_0__wordpress_i18n__["__"])("Twitter"), Object(__WEBPACK_IMPORTED_MODULE_0__wordpress_i18n__["__"])("Tweet")],
300
+ edit: __WEBPACK_IMPORTED_MODULE_2__editor__["a" /* default */],
301
+ save: __WEBPACK_IMPORTED_MODULE_3__render__["a" /* default */]
302
+ }));
303
+
304
+ /***/ }),
305
+ /* 14 */
306
+ /***/ (function(module, exports) {
307
+
308
+ (function() { module.exports = this["wp"]["blocks"]; }());
309
+
310
+ /***/ }),
311
+ /* 15 */
312
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
313
+
314
+ "use strict";
315
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__ = __webpack_require__(16);
316
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__);
317
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_classnames__ = __webpack_require__(43);
318
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_classnames__);
319
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__wordpress_i18n__ = __webpack_require__(1);
320
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__wordpress_i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__wordpress_i18n__);
321
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__wordpress_element__ = __webpack_require__(44);
322
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__wordpress_element___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__wordpress_element__);
323
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__wordpress_editor__ = __webpack_require__(12);
324
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__wordpress_editor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__wordpress_editor__);
325
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__inspector__ = __webpack_require__(45);
326
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__editor_scss__ = __webpack_require__(51);
327
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__editor_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__editor_scss__);
328
+
329
+ /**
330
+ * External dependecies
331
+ */
332
+
333
+
334
+ /**
335
+ * WordPress dependencies
336
+ */
337
+
338
+
339
+
340
+
341
+ /**
342
+ * Internal dependencies
343
+ */
344
+
345
+
346
+
347
+ /**
348
+ * Block edit component
349
+ */
350
+ var editor = function editor(props) {
351
+ var attributes = props.attributes,
352
+ setAttributes = props.setAttributes,
353
+ className = props.className;
354
+ var tweet = attributes.tweet,
355
+ prompt = attributes.prompt;
356
+ // Events
357
+
358
+ var onChangeTweet = function onChangeTweet(value) {
359
+ setAttributes({ tweet: value });
360
+ };
361
+
362
+ var onClickPrompt = function onClickPrompt() {
363
+ return false;
364
+ };
365
+ // Render block editor
366
+ return wp.element.createElement(
367
+ __WEBPACK_IMPORTED_MODULE_3__wordpress_element__["Fragment"],
368
+ null,
369
+ wp.element.createElement(__WEBPACK_IMPORTED_MODULE_5__inspector__["a" /* default */], __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, props)),
370
+ wp.element.createElement(
371
+ "span",
372
+ { className: __WEBPACK_IMPORTED_MODULE_1_classnames___default()(className, "bctt-click-to-tweet") },
373
+ wp.element.createElement(
374
+ "span",
375
+ { className: "bctt-ctt-text" },
376
+ wp.element.createElement(__WEBPACK_IMPORTED_MODULE_4__wordpress_editor__["RichText"], {
377
+ format: "string",
378
+ formattingControls: [],
379
+ tagName: "div",
380
+ placeholder: Object(__WEBPACK_IMPORTED_MODULE_2__wordpress_i18n__["__"])("Enter text for readers to Tweet"),
381
+ onChange: onChangeTweet,
382
+ value: tweet
383
+ })
384
+ ),
385
+ wp.element.createElement(
386
+ "a",
387
+ { href: "#", onClick: onClickPrompt, className: "bctt-ctt-btn" },
388
+ prompt
389
+ )
390
+ )
391
+ );
392
+ };
393
+
394
+ /* harmony default export */ __webpack_exports__["a"] = (editor);
395
+
396
+ /***/ }),
397
+ /* 16 */
398
+ /***/ (function(module, exports, __webpack_require__) {
399
+
400
+ "use strict";
401
+
402
+
403
+ exports.__esModule = true;
404
+
405
+ var _assign = __webpack_require__(17);
406
+
407
+ var _assign2 = _interopRequireDefault(_assign);
408
+
409
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
410
+
411
+ exports.default = _assign2.default || function (target) {
412
+ for (var i = 1; i < arguments.length; i++) {
413
+ var source = arguments[i];
414
+
415
+ for (var key in source) {
416
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
417
+ target[key] = source[key];
418
+ }
419
+ }
420
+ }
421
+
422
+ return target;
423
+ };
424
+
425
+ /***/ }),
426
+ /* 17 */
427
+ /***/ (function(module, exports, __webpack_require__) {
428
+
429
+ module.exports = { "default": __webpack_require__(18), __esModule: true };
430
+
431
+ /***/ }),
432
+ /* 18 */
433
+ /***/ (function(module, exports, __webpack_require__) {
434
+
435
+ __webpack_require__(19);
436
+ module.exports = __webpack_require__(3).Object.assign;
437
+
438
+
439
+ /***/ }),
440
+ /* 19 */
441
+ /***/ (function(module, exports, __webpack_require__) {
442
+
443
+ // 19.1.3.1 Object.assign(target, source)
444
+ var $export = __webpack_require__(6);
445
+
446
+ $export($export.S + $export.F, 'Object', { assign: __webpack_require__(28) });
447
+
448
+
449
+ /***/ }),
450
+ /* 20 */
451
+ /***/ (function(module, exports, __webpack_require__) {
452
+
453
+ // optional / simple context binding
454
+ var aFunction = __webpack_require__(21);
455
+ module.exports = function (fn, that, length) {
456
+ aFunction(fn);
457
+ if (that === undefined) return fn;
458
+ switch (length) {
459
+ case 1: return function (a) {
460
+ return fn.call(that, a);
461
+ };
462
+ case 2: return function (a, b) {
463
+ return fn.call(that, a, b);
464
+ };
465
+ case 3: return function (a, b, c) {
466
+ return fn.call(that, a, b, c);
467
+ };
468
+ }
469
+ return function (/* ...args */) {
470
+ return fn.apply(that, arguments);
471
+ };
472
+ };
473
+
474
+
475
+ /***/ }),
476
+ /* 21 */
477
+ /***/ (function(module, exports) {
478
+
479
+ module.exports = function (it) {
480
+ if (typeof it != 'function') throw TypeError(it + ' is not a function!');
481
+ return it;
482
+ };
483
+
484
+
485
+ /***/ }),
486
+ /* 22 */
487
+ /***/ (function(module, exports, __webpack_require__) {
488
+
489
+ var dP = __webpack_require__(7);
490
+ var createDesc = __webpack_require__(27);
491
+ module.exports = __webpack_require__(0) ? function (object, key, value) {
492
+ return dP.f(object, key, createDesc(1, value));
493
+ } : function (object, key, value) {
494
+ object[key] = value;
495
+ return object;
496
+ };
497
+
498
+
499
+ /***/ }),
500
+ /* 23 */
501
+ /***/ (function(module, exports, __webpack_require__) {
502
+
503
+ var isObject = __webpack_require__(4);
504
+ module.exports = function (it) {
505
+ if (!isObject(it)) throw TypeError(it + ' is not an object!');
506
+ return it;
507
+ };
508
+
509
+
510
+ /***/ }),
511
+ /* 24 */
512
+ /***/ (function(module, exports, __webpack_require__) {
513
+
514
+ module.exports = !__webpack_require__(0) && !__webpack_require__(5)(function () {
515
+ return Object.defineProperty(__webpack_require__(25)('div'), 'a', { get: function () { return 7; } }).a != 7;
516
+ });
517
+
518
+
519
+ /***/ }),
520
+ /* 25 */
521
+ /***/ (function(module, exports, __webpack_require__) {
522
+
523
+ var isObject = __webpack_require__(4);
524
+ var document = __webpack_require__(2).document;
525
+ // typeof document.createElement is 'object' in old IE
526
+ var is = isObject(document) && isObject(document.createElement);
527
+ module.exports = function (it) {
528
+ return is ? document.createElement(it) : {};
529
+ };
530
+
531
+
532
+ /***/ }),
533
+ /* 26 */
534
+ /***/ (function(module, exports, __webpack_require__) {
535
+
536
+ // 7.1.1 ToPrimitive(input [, PreferredType])
537
+ var isObject = __webpack_require__(4);
538
+ // instead of the ES6 spec version, we didn't implement @@toPrimitive case
539
+ // and the second argument - flag - preferred type is a string
540
+ module.exports = function (it, S) {
541
+ if (!isObject(it)) return it;
542
+ var fn, val;
543
+ if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
544
+ if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
545
+ if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
546
+ throw TypeError("Can't convert object to primitive value");
547
+ };
548
+
549
+
550
+ /***/ }),
551
+ /* 27 */
552
+ /***/ (function(module, exports) {
553
+
554
+ module.exports = function (bitmap, value) {
555
+ return {
556
+ enumerable: !(bitmap & 1),
557
+ configurable: !(bitmap & 2),
558
+ writable: !(bitmap & 4),
559
+ value: value
560
+ };
561
+ };
562
+
563
+
564
+ /***/ }),
565
+ /* 28 */
566
+ /***/ (function(module, exports, __webpack_require__) {
567
+
568
+ "use strict";
569
+
570
+ // 19.1.2.1 Object.assign(target, source, ...)
571
+ var getKeys = __webpack_require__(29);
572
+ var gOPS = __webpack_require__(40);
573
+ var pIE = __webpack_require__(41);
574
+ var toObject = __webpack_require__(42);
575
+ var IObject = __webpack_require__(9);
576
+ var $assign = Object.assign;
577
+
578
+ // should work with symbols and should have deterministic property order (V8 bug)
579
+ module.exports = !$assign || __webpack_require__(5)(function () {
580
+ var A = {};
581
+ var B = {};
582
+ // eslint-disable-next-line no-undef
583
+ var S = Symbol();
584
+ var K = 'abcdefghijklmnopqrst';
585
+ A[S] = 7;
586
+ K.split('').forEach(function (k) { B[k] = k; });
587
+ return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
588
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
589
+ var T = toObject(target);
590
+ var aLen = arguments.length;
591
+ var index = 1;
592
+ var getSymbols = gOPS.f;
593
+ var isEnum = pIE.f;
594
+ while (aLen > index) {
595
+ var S = IObject(arguments[index++]);
596
+ var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
597
+ var length = keys.length;
598
+ var j = 0;
599
+ var key;
600
+ while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
601
+ } return T;
602
+ } : $assign;
603
+
604
+
605
+ /***/ }),
606
+ /* 29 */
607
+ /***/ (function(module, exports, __webpack_require__) {
608
+
609
+ // 19.1.2.14 / 15.2.3.14 Object.keys(O)
610
+ var $keys = __webpack_require__(30);
611
+ var enumBugKeys = __webpack_require__(39);
612
+
613
+ module.exports = Object.keys || function keys(O) {
614
+ return $keys(O, enumBugKeys);
615
+ };
616
+
617
+
618
+ /***/ }),
619
+ /* 30 */
620
+ /***/ (function(module, exports, __webpack_require__) {
621
+
622
+ var has = __webpack_require__(31);
623
+ var toIObject = __webpack_require__(8);
624
+ var arrayIndexOf = __webpack_require__(33)(false);
625
+ var IE_PROTO = __webpack_require__(36)('IE_PROTO');
626
+
627
+ module.exports = function (object, names) {
628
+ var O = toIObject(object);
629
+ var i = 0;
630
+ var result = [];
631
+ var key;
632
+ for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
633
+ // Don't enum bug & hidden keys
634
+ while (names.length > i) if (has(O, key = names[i++])) {
635
+ ~arrayIndexOf(result, key) || result.push(key);
636
+ }
637
+ return result;
638
+ };
639
+
640
+
641
+ /***/ }),
642
+ /* 31 */
643
+ /***/ (function(module, exports) {
644
+
645
+ var hasOwnProperty = {}.hasOwnProperty;
646
+ module.exports = function (it, key) {
647
+ return hasOwnProperty.call(it, key);
648
+ };
649
+
650
+
651
+ /***/ }),
652
+ /* 32 */
653
+ /***/ (function(module, exports) {
654
+
655
+ var toString = {}.toString;
656
+
657
+ module.exports = function (it) {
658
+ return toString.call(it).slice(8, -1);
659
+ };
660
+
661
+
662
+ /***/ }),
663
+ /* 33 */
664
+ /***/ (function(module, exports, __webpack_require__) {
665
+
666
+ // false -> Array#indexOf
667
+ // true -> Array#includes
668
+ var toIObject = __webpack_require__(8);
669
+ var toLength = __webpack_require__(34);
670
+ var toAbsoluteIndex = __webpack_require__(35);
671
+ module.exports = function (IS_INCLUDES) {
672
+ return function ($this, el, fromIndex) {
673
+ var O = toIObject($this);
674
+ var length = toLength(O.length);
675
+ var index = toAbsoluteIndex(fromIndex, length);
676
+ var value;
677
+ // Array#includes uses SameValueZero equality algorithm
678
+ // eslint-disable-next-line no-self-compare
679
+ if (IS_INCLUDES && el != el) while (length > index) {
680
+ value = O[index++];
681
+ // eslint-disable-next-line no-self-compare
682
+ if (value != value) return true;
683
+ // Array#indexOf ignores holes, Array#includes - not
684
+ } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
685
+ if (O[index] === el) return IS_INCLUDES || index || 0;
686
+ } return !IS_INCLUDES && -1;
687
+ };
688
+ };
689
+
690
+
691
+ /***/ }),
692
+ /* 34 */
693
+ /***/ (function(module, exports, __webpack_require__) {
694
+
695
+ // 7.1.15 ToLength
696
+ var toInteger = __webpack_require__(11);
697
+ var min = Math.min;
698
+ module.exports = function (it) {
699
+ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
700
+ };
701
+
702
+
703
+ /***/ }),
704
+ /* 35 */
705
+ /***/ (function(module, exports, __webpack_require__) {
706
+
707
+ var toInteger = __webpack_require__(11);
708
+ var max = Math.max;
709
+ var min = Math.min;
710
+ module.exports = function (index, length) {
711
+ index = toInteger(index);
712
+ return index < 0 ? max(index + length, 0) : min(index, length);
713
+ };
714
+
715
+
716
+ /***/ }),
717
+ /* 36 */
718
+ /***/ (function(module, exports, __webpack_require__) {
719
+
720
+ var shared = __webpack_require__(37)('keys');
721
+ var uid = __webpack_require__(38);
722
+ module.exports = function (key) {
723
+ return shared[key] || (shared[key] = uid(key));
724
+ };
725
+
726
+
727
+ /***/ }),
728
+ /* 37 */
729
+ /***/ (function(module, exports, __webpack_require__) {
730
+
731
+ var global = __webpack_require__(2);
732
+ var SHARED = '__core-js_shared__';
733
+ var store = global[SHARED] || (global[SHARED] = {});
734
+ module.exports = function (key) {
735
+ return store[key] || (store[key] = {});
736
+ };
737
+
738
+
739
+ /***/ }),
740
+ /* 38 */
741
+ /***/ (function(module, exports) {
742
+
743
+ var id = 0;
744
+ var px = Math.random();
745
+ module.exports = function (key) {
746
+ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
747
+ };
748
+
749
+
750
+ /***/ }),
751
+ /* 39 */
752
+ /***/ (function(module, exports) {
753
+
754
+ // IE 8- don't enum bug keys
755
+ module.exports = (
756
+ 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
757
+ ).split(',');
758
+
759
+
760
+ /***/ }),
761
+ /* 40 */
762
+ /***/ (function(module, exports) {
763
+
764
+ exports.f = Object.getOwnPropertySymbols;
765
+
766
+
767
+ /***/ }),
768
+ /* 41 */
769
+ /***/ (function(module, exports) {
770
+
771
+ exports.f = {}.propertyIsEnumerable;
772
+
773
+
774
+ /***/ }),
775
+ /* 42 */
776
+ /***/ (function(module, exports, __webpack_require__) {
777
+
778
+ // 7.1.13 ToObject(argument)
779
+ var defined = __webpack_require__(10);
780
+ module.exports = function (it) {
781
+ return Object(defined(it));
782
+ };
783
+
784
+
785
+ /***/ }),
786
+ /* 43 */
787
+ /***/ (function(module, exports, __webpack_require__) {
788
+
789
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
790
Copyright (c) 2016 Jed Watson.
791
Licensed under the MIT License (MIT), see
792
http://jedwatson.github.io/classnames
793
*/
794
+ /* global define */
795
+
796
+ (function () {
797
+ 'use strict';
798
+
799
+ var hasOwn = {}.hasOwnProperty;
800
+
801
+ function classNames () {
802
+ var classes = [];
803
+
804
+ for (var i = 0; i < arguments.length; i++) {
805
+ var arg = arguments[i];
806
+ if (!arg) continue;
807
+
808
+ var argType = typeof arg;
809
+
810
+ if (argType === 'string' || argType === 'number') {
811
+ classes.push(arg);
812
+ } else if (Array.isArray(arg)) {
813
+ classes.push(classNames.apply(null, arg));
814
+ } else if (argType === 'object') {
815
+ for (var key in arg) {
816
+ if (hasOwn.call(arg, key) && arg[key]) {
817
+ classes.push(key);
818
+ }
819
+ }
820
+ }
821
+ }
822
+
823
+ return classes.join(' ');
824
+ }
825
+
826
+ if (typeof module !== 'undefined' && module.exports) {
827
+ module.exports = classNames;
828
+ } else if (true) {
829
+ // register as 'classnames', consistent with npm package name
830
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
831
+ return classNames;
832
+ }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
833
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
834
+ } else {
835
+ window.classNames = classNames;
836
+ }
837
+ }());
838
+
839
+
840
+ /***/ }),
841
+ /* 44 */
842
+ /***/ (function(module, exports) {
843
+
844
+ (function() { module.exports = this["wp"]["element"]; }());
845
+
846
+ /***/ }),
847
+ /* 45 */
848
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
849
+
850
+ "use strict";
851
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty__ = __webpack_require__(46);
852
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty__);
853
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__ = __webpack_require__(1);
854
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__wordpress_i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__);
855
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__wordpress_editor__ = __webpack_require__(12);
856
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__wordpress_editor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__wordpress_editor__);
857
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__wordpress_components__ = __webpack_require__(50);
858
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__wordpress_components___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__wordpress_components__);
859
+
860
+ /**
861
+ * WordPress dependencies
862
+ */
863
+
864
+
865
+
866
+
867
+ /**
868
+ * Create an Inspector Controls wrapper Component
869
+ */
870
+ var Inspector = function Inspector(_ref) {
871
+ var attributes = _ref.attributes,
872
+ setAttributes = _ref.setAttributes;
873
+ var username = attributes.username,
874
+ via = attributes.via,
875
+ url = attributes.url,
876
+ urlcustom = attributes.urlcustom,
877
+ nofollow = attributes.nofollow,
878
+ prompt = attributes.prompt;
879
+
880
+
881
+ var updateAttribute = function updateAttribute(name, value) {
882
+ setAttributes(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default()({}, name, value));
883
+ };
884
+
885
+ return wp.element.createElement(
886
+ __WEBPACK_IMPORTED_MODULE_2__wordpress_editor__["InspectorControls"],
887
+ null,
888
+ wp.element.createElement(
889
+ __WEBPACK_IMPORTED_MODULE_3__wordpress_components__["PanelBody"],
890
+ { title: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("General") },
891
+ wp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__wordpress_components__["TextControl"], {
892
+ label: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Twitter Username"),
893
+ value: username,
894
+ onChange: function onChange(value) {
895
+ return updateAttribute("username", value);
896
+ }
897
+ }),
898
+ wp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__wordpress_components__["ToggleControl"], {
899
+ label: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Include the username in Tweet?"),
900
+ checked: via,
901
+ onChange: function onChange(value) {
902
+ return updateAttribute("via", value);
903
+ }
904
+ }),
905
+ wp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__wordpress_components__["TextControl"], {
906
+ label: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Prompt"),
907
+ value: prompt,
908
+ onChange: function onChange(value) {
909
+ return updateAttribute("prompt", value);
910
+ },
911
+ help: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Text for action/prompt link")
912
+ })
913
+ ),
914
+ wp.element.createElement(
915
+ __WEBPACK_IMPORTED_MODULE_3__wordpress_components__["PanelBody"],
916
+ { title: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("URL"), initialOpen: false },
917
+ wp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__wordpress_components__["ToggleControl"], {
918
+ label: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Include URL in tweet?"),
919
+ checked: url,
920
+ onChange: function onChange(value) {
921
+ return updateAttribute("url", value);
922
+ }
923
+ }),
924
+ wp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__wordpress_components__["TextControl"], {
925
+ label: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Custom URL"),
926
+ value: urlcustom,
927
+ onChange: function onChange(value) {
928
+ return updateAttribute("urlcustom", value);
929
+ },
930
+ help: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Custom URL to use instead of post")
931
+ }),
932
+ wp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__wordpress_components__["ToggleControl"], {
933
+ label: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Nofollow"),
934
+ checked: nofollow,
935
+ onChange: function onChange(value) {
936
+ return updateAttribute("nofollow", value);
937
+ },
938
+ help: Object(__WEBPACK_IMPORTED_MODULE_1__wordpress_i18n__["__"])("Make links nofollow")
939
+ })
940
+ )
941
+ );
942
+ };
943
+
944
+ /* harmony default export */ __webpack_exports__["a"] = (Inspector);
945
+
946
+ /***/ }),
947
+ /* 46 */
948
+ /***/ (function(module, exports, __webpack_require__) {
949
+
950
+ "use strict";
951
+
952
+
953
+ exports.__esModule = true;
954
+
955
+ var _defineProperty = __webpack_require__(47);
956
+
957
+ var _defineProperty2 = _interopRequireDefault(_defineProperty);
958
+
959
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
960
+
961
+ exports.default = function (obj, key, value) {
962
+ if (key in obj) {
963
+ (0, _defineProperty2.default)(obj, key, {
964
+ value: value,
965
+ enumerable: true,
966
+ configurable: true,
967
+ writable: true
968
+ });
969
+ } else {
970
+ obj[key] = value;
971
+ }
972
+
973
+ return obj;
974
+ };
975
+
976
+ /***/ }),
977
+ /* 47 */
978
+ /***/ (function(module, exports, __webpack_require__) {
979
+
980
+ module.exports = { "default": __webpack_require__(48), __esModule: true };
981
+
982
+ /***/ }),
983
+ /* 48 */
984
+ /***/ (function(module, exports, __webpack_require__) {
985
+
986
+ __webpack_require__(49);
987
+ var $Object = __webpack_require__(3).Object;
988
+ module.exports = function defineProperty(it, key, desc) {
989
+ return $Object.defineProperty(it, key, desc);
990
+ };
991
+
992
+
993
+ /***/ }),
994
+ /* 49 */
995
+ /***/ (function(module, exports, __webpack_require__) {
996
+
997
+ var $export = __webpack_require__(6);
998
+ // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
999
+ $export($export.S + $export.F * !__webpack_require__(0), 'Object', { defineProperty: __webpack_require__(7).f });
1000
+
1001
+
1002
+ /***/ }),
1003
+ /* 50 */
1004
+ /***/ (function(module, exports) {
1005
+
1006
+ (function() { module.exports = this["wp"]["components"]; }());
1007
+
1008
+ /***/ }),
1009
+ /* 51 */
1010
+ /***/ (function(module, exports) {
1011
+
1012
+ // removed by extract-text-webpack-plugin
1013
+
1014
+ /***/ }),
1015
+ /* 52 */
1016
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
1017
+
1018
+ "use strict";
1019
+ /**
1020
+ * Block save component
1021
+ */
1022
+ var render = function render() {
1023
+ return null;
1024
+ };
1025
+
1026
+ /* harmony default export */ __webpack_exports__["a"] = (render);
1027
+
1028
+ /***/ })
1029
+ /******/ ]);
assets/block/init.php CHANGED
@@ -35,9 +35,10 @@ add_action( 'enqueue_block_editor_assets', 'bctt_block_editor_assets' );
35
// Server side rendering callback to output shortcode
36
register_block_type( 'bctt/clicktotweet', array(
37
'render_callback' => 'bctt_block_callback',
38
- 'attributes' => array(
39
'tweet' => array(
40
'type' => 'string',
41
),
42
'username' => array(
43
'type' => 'string',
@@ -53,7 +54,6 @@ register_block_type( 'bctt/clicktotweet', array(
53
),
54
'urlcustom' => array(
55
'type' => 'string',
56
- 'default' => false
57
),
58
'nofollow' => array(
59
'type' => 'boolean',
@@ -63,21 +63,24 @@ register_block_type( 'bctt/clicktotweet', array(
63
'type' => 'string',
64
'default' => sprintf( _x( 'Click To Tweet', 'Text for the box on the reader-facing box', 'better-click-to-tweet' ) )
65
),
66
- ),
67
)
68
);
69
70
// Callback function to render bctt on frontend
71
function bctt_block_callback( $attributes ) {
72
-
73
- //echo var_dump($attributes);
74
- //exit;
75
extract( $attributes );
76
77
$url = ( $url ? 'yes' : 'no' );
78
79
- $shortcode_string = '[bctt tweet="%s" url="%s" via="%s" username="%s" nofollow="%s" prompt="%s"]';
80
-
81
- return sprintf( $shortcode_string, $tweet, ( $urlcustom ? $urlcustom : $url ), ( $via ? 'yes' : 'no' ), $username, ( $nofollow ? 'yes' : 'no' ), $prompt );
82
- }
83
35
// Server side rendering callback to output shortcode
36
register_block_type( 'bctt/clicktotweet', array(
37
'render_callback' => 'bctt_block_callback',
38
+ 'attributes' => apply_filters ( 'bctt_block_attributes' ,array(
39
'tweet' => array(
40
'type' => 'string',
41
+ 'default' => ''
42
),
43
'username' => array(
44
'type' => 'string',
54
),
55
'urlcustom' => array(
56
'type' => 'string',
57
),
58
'nofollow' => array(
59
'type' => 'boolean',
63
'type' => 'string',
64
'default' => sprintf( _x( 'Click To Tweet', 'Text for the box on the reader-facing box', 'better-click-to-tweet' ) )
65
),
66
+ )),
67
)
68
);
69
70
// Callback function to render bctt on frontend
71
function bctt_block_callback( $attributes ) {
72
extract( $attributes );
73
74
$url = ( $url ? 'yes' : 'no' );
75
76
+ $shortcode_attributes = apply_filters ( 'bctt_block_render_attributes', array(
77
+ 'tweet' => $tweet,
78
+ 'via' => $via ? 'yes' : 'no',
79
+ 'username' => $username,
80
+ 'url' => $urlcustom ? $urlcustom : $url,
81
+ 'nofollow' => $nofollow ? 'yes' : 'no',
82
+ 'prompt' => $prompt
83
+ ), $attributes );
84
85
+ return bctt_shortcode( $shortcode_attributes );
86
+ }
better-click-to-tweet.php CHANGED
@@ -2,7 +2,7 @@
2
/**
3
* Plugin Name: Better Click To Tweet
4
* Description: Add Click to Tweet boxes simply and elegantly to your posts or pages. All the features of a premium plugin, for FREE!
5
- * Version: 5.7.2
6
* Author: Ben Meredith
7
* Author URI: https://www.betterclicktotweet.com
8
* Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
@@ -12,6 +12,8 @@
12
13
defined( 'ABSPATH' ) or die( "No soup for you. You leave now." );
14
15
include 'i18n-module.php';
16
include 'bctt_options.php';
17
include 'bctt-i18n.php';
@@ -140,17 +142,17 @@ function bctt_shortcode( $atts ) {
140
141
if ( filter_var( $atts['url'], FILTER_VALIDATE_URL ) ) {
142
143
- $bcttURL = $atts['url'];
144
145
} elseif ( $atts['url'] != 'no' ) {
146
147
if ( get_option( 'bctt-short-url' ) != false ) {
148
149
- $bcttURL = apply_filters( 'bctturl', wp_get_shortlink());
150
151
} else {
152
153
- $bcttURL = apply_filters( 'bctturl', get_permalink());
154
155
}
156
2
/**
3
* Plugin Name: Better Click To Tweet
4
* Description: Add Click to Tweet boxes simply and elegantly to your posts or pages. All the features of a premium plugin, for FREE!
5
+ * Version: 5.8.0
6
* Author: Ben Meredith
7
* Author URI: https://www.betterclicktotweet.com
8
* Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
12
13
defined( 'ABSPATH' ) or die( "No soup for you. You leave now." );
14
15
+ define ( 'BCTT_VERSION', '5.8.0' );
16
+
17
include 'i18n-module.php';
18
include 'bctt_options.php';
19
include 'bctt-i18n.php';
142
143
if ( filter_var( $atts['url'], FILTER_VALIDATE_URL ) ) {
144
145
+ $bcttURL = apply_filters( 'bctturl', $atts['url'], $atts );
146
147
} elseif ( $atts['url'] != 'no' ) {
148
149
if ( get_option( 'bctt-short-url' ) != false ) {
150
151
+ $bcttURL = apply_filters( 'bctturl', wp_get_shortlink(), $atts );
152
153
} else {
154
155
+ $bcttURL = apply_filters( 'bctturl', get_permalink(), $atts);
156
157
}
158
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: ben.meredith@gmail.com, wpsteward
3
Donate link: https://www.wpsteward.com/donations/plugin-support/
4
Tags: click to tweet, twitter, tweet,
5
Requires at least: 3.8
6
- Tested up to: 5.0
7
- Stable tag: 5.7.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -97,6 +97,11 @@ Donations: http://benlikes.us/donate
97
98
== Changelog ==
99
100
= 5.7.2 =
101
102
* fix — two spelling typos in the new License activation page. Thanks to @garrett-eclipse on Github for the fix.
@@ -345,6 +350,9 @@ Donations: http://benlikes.us/donate
345
* Initial release.
346
347
== Upgrade Notice ==
348
= 4.3 =
349
* added translation support, updated three languages.
350
3
Donate link: https://www.wpsteward.com/donations/plugin-support/
4
Tags: click to tweet, twitter, tweet,
5
Requires at least: 3.8
6
+ Tested up to: 5.1
7
+ Stable tag: 5.8.0
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
97
98
== Changelog ==
99
100
+ = 5.8.0 =
101
+ * new — adding a filter and various other enhancements to support a new UTM tags add-on
102
+ * fix — testing with the newest version of the block-based editor (Gutenberg)
103
+ * new — added a constant to define the core BCTT version, allowing add-ons to make sure that BCTT core is up to date before activating.
104
+
105
= 5.7.2 =
106
107
* fix — two spelling typos in the new License activation page. Thanks to @garrett-eclipse on Github for the fix.
350
* Initial release.
351
352
== Upgrade Notice ==
353
+ = 5.8.0 =
354
+ Refinements to the Gutenberg block, and compatibility for the new Better Click To Tweet UTM Tags add-on.
355
+
356
= 4.3 =
357
* added translation support, updated three languages.
358