Version Description
- feature adding a blank [bctt] shortcode populates the Better Click To Tweet box with the post/page's title.
- bonus moved to the country. Incorrectly assumed I'd eat a lot more peaches, based on my extensive knowledge of Presidents Of The United States songs from the 90s
- chore confirm compatibility with WordPress 5.7 and PHP 8.0
- sale you should reward yourself with the promo code CHANGELOG at https://benlikes.us/bcttps
Download this release
Release Info
Developer | ben.meredith@gmail.com |
Plugin | Better Click To Tweet |
Version | 5.10.0 |
Comparing to | |
See all releases |
Code changes from version 5.9.5 to 5.10.0
- assets/block/build/index.asset.php +1 -1
- assets/block/build/index.js +3 -3
- assets/block/build/index.js.map +1 -0
- assets/block/build/script.js +6 -0
- assets/block/init.php +8 -10
- assets/block/src/editor.js +11 -3
- assets/block/src/index.js +4 -0
- assets/block/src/inspector.js +1 -1
- better-click-to-tweet.php +5 -4
- readme.txt +9 -2
assets/block/build/index.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-
|
1 |
+
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '88e78214c8d60071907fdacb3b830214');
|
assets/block/build/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){!function(){e.exports=this.wp.
|
2 |
/*!
|
3 |
-
Copyright (c)
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
-
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r))
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t,n){var r;
|
2 |
/*!
|
3 |
+
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var l=o.apply(null,r);l&&e.push(l)}else if("object"===c)for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(5),c=n(3),l=n.n(c),i=n(1),u=n(6),a=n.n(u),s=n(4),f=n(2),b=function(e){var t=e.attributes,n=e.setAttributes,o=t.username,c=t.via,u=t.url,a=t.urlcustom,b=t.nofollow,p=t.prompt,O=function(e,t){n(l()({},e,t))};return Object(i.createElement)(s.InspectorControls,null,Object(i.createElement)(f.PanelBody,{title:Object(r.__)("General")},Object(i.createElement)(f.TextControl,{label:Object(r.__)("Twitter Username"),value:o,onChange:function(e){return O("username",e)}}),Object(i.createElement)(f.ToggleControl,{label:Object(r.__)("Include the username in Tweet?"),checked:c,onChange:function(e){return O("via",e)}}),Object(i.createElement)(f.TextControl,{label:Object(r.__)("Prompt"),value:p,onChange:function(e){return O("prompt",e)},help:Object(r.__)("Text for action/prompt link")})),Object(i.createElement)(f.PanelBody,{title:Object(r.__)("URL"),initialOpen:!1},Object(i.createElement)(f.ToggleControl,{label:Object(r.__)("Include URL in tweet?"),checked:u,onChange:function(e){return O("url",e)}}),Object(i.createElement)(f.TextControl,{label:Object(r.__)("Custom URL"),value:a,onChange:function(e){return O("urlcustom",e)},help:Object(r.__)("Custom URL to use instead of post")}),Object(i.createElement)(f.ToggleControl,{label:Object(r.__)("Nofollow"),checked:b,onChange:function(e){return O("nofollow",e)},help:Object(r.__)("Make links nofollow")})))};function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var O=function(e){var t=e.attributes,n=e.setAttributes,o=e.className,c=t.tweet,u=t.prompt,f=wp.data.select("core/editor").getEditedPostAttribute("title");c||n({tweet:f});return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(b,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){l()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e)),Object(i.createElement)("span",{className:a()(o,"bctt-click-to-tweet")},Object(i.createElement)("span",{className:"bctt-ctt-text"},Object(i.createElement)(s.RichText,{format:"string",allowedFormats:[],tagName:"div",placeholder:Object(r.__)("Enter text for readers to Tweet"),onChange:function(e){n({tweet:e})},value:c})),Object(i.createElement)("a",{href:"#",onClick:function(){return!1},className:"bctt-ctt-btn"},u)))},j=function(){return null};t.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")],supports:{align:!1,alignWide:!1},edit:O,save:j})}]);
|
assets/block/build/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/block/src/editor.js","webpack:///./assets/block/src/index.js","webpack:///./assets/block/src/inspector.js","webpack:///./assets/block/src/render.js","webpack:///./node_modules/@babel/runtime/helpers/defineProperty.js","webpack:///./node_modules/classnames/index.js","webpack:///external {\"this\":[\"wp\",\"blockEditor\"]}","webpack:///external {\"this\":[\"wp\",\"blocks\"]}","webpack:///external {\"this\":[\"wp\",\"components\"]}","webpack:///external {\"this\":[\"wp\",\"element\"]}","webpack:///external {\"this\":[\"wp\",\"i18n\"]}"],"names":["editor","props","attributes","setAttributes","className","tweet","prompt","title","wp","data","select","getEditedPostAttribute","onChangeTweet","value","onClickPrompt","classnames","__","registerBlockType","description","category","icon","keywords","edit","save","render","Inspector","username","via","url","urlcustom","nofollow","updateAttribute","name"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClFA;;;AAGA;AAEA;;;;AAGA;AACA;AACA;AAEA;;;;AAGA;AAEA;;;;AAGA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK,EAAI;AAAA,MACdC,UADc,GAC2BD,KAD3B,CACdC,UADc;AAAA,MACFC,aADE,GAC2BF,KAD3B,CACFE,aADE;AAAA,MACaC,SADb,GAC2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C7DA;AAAA;;;AAGA,IAAMD,MAAM,GAAG,SAATA,MAAS,GAAM;AACnB,SAAO,IAAP;AACD,CAFD;;AAIeA,qEAAf,E;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;;AAEA,iC;;;;;;;;;;;ACfA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAgB;;AAEhB;AACA;;AAEA,iBAAiB,sBAAsB;AACvC;AACA;;AAEA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK,KAA6B;AAClC;AACA;AACA,EAAE,UAAU,IAA4E;AACxF;AACA,EAAE,iCAAqB,EAAE,mCAAE;AAC3B;AACA,GAAG;AAAA,oGAAC;AACJ,EAAE,MAAM,EAEN;AACF,CAAC;;;;;;;;;;;;ACnDD,aAAa,4CAA4C,EAAE,I;;;;;;;;;;;ACA3D,aAAa,uCAAuC,EAAE,I;;;;;;;;;;;ACAtD,aAAa,2CAA2C,EAAE,I;;;;;;;;;;;ACA1D,aAAa,wCAAwC,EAAE,I;;;;;;;;;;;ACAvD,aAAa,qCAAqC,EAAE,I","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./assets/block/src/index.js\");\n","/**\n * External dependecies\n */\nimport classnames from \"classnames\";\n\n/**\n * WordPress dependencies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { Fragment } from \"@wordpress/element\";\nimport { RichText } from \"@wordpress/block-editor\";\n\n/**\n * Internal dependencies\n */\nimport Inspector from \"./inspector\";\n\n/**\n * Block edit component\n */\nconst editor = props => {\n const { attributes, setAttributes, className } = props;\n const { tweet, prompt } = attributes;\n\n // Default tweet content\n const title = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'title' );\n\n if ( !tweet ) {\n setAttributes( { tweet: title } );\n }\n\n // Events\n const onChangeTweet = value => {\n setAttributes({ tweet: value });\n };\n\n const onClickPrompt = () => {\n return false;\n };\n // Render block editor\n return (\n <Fragment>\n <Inspector {...{ ...props }} />\n\n <span className={classnames(className, \"bctt-click-to-tweet\")}>\n <span className=\"bctt-ctt-text\">\n <RichText\n format=\"string\"\n allowedFormats={[]}\n tagName=\"div\"\n placeholder={__(\"Enter text for readers to Tweet\")}\n onChange={onChangeTweet}\n value={ tweet }\n />\n </span>\n <a href=\"#\" onClick={onClickPrompt} className=\"bctt-ctt-btn\">\n {prompt}\n </a>\n </span>\n </Fragment>\n );\n};\n\nexport default editor;\n","/**\n * WordPress dependencies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { registerBlockType } from \"@wordpress/blocks\";\n\n/**\n * Internal dependencies\n */\nimport editor from \"./editor\";\nimport render from \"./render\";\n\n/**\n * Register block\n */\nexport default registerBlockType(\"bctt/clicktotweet\", {\n title: __(\"Better Click to Tweet\"),\n description: __(\n \"Add text for your readers to tweet, calling them to action on your behalf.\"\n ),\n category: \"widgets\",\n icon: \"twitter\",\n keywords: [__(\"Twitter\"), __(\"Tweet\")],\n edit: editor,\n save: render\n});\n","/**\n * WordPress dependencies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { InspectorControls } from \"@wordpress/block-editor\";\nimport { PanelBody, TextControl, ToggleControl } from \"@wordpress/components\";\n\n/**\n * Create an Inspector Controls wrapper Component\n */\nconst Inspector = ({ attributes, setAttributes }) => {\n const { username, via, url, urlcustom, nofollow, prompt } = attributes;\n\n const updateAttribute = (name, value) => {\n setAttributes({ [name]: value });\n };\n\n return (\n <InspectorControls>\n <PanelBody title={__(\"General\")}>\n <TextControl\n label={__(\"Twitter Username\")}\n value={username}\n onChange={value => updateAttribute(\"username\", value)}\n />\n <ToggleControl\n label={__(\"Include the username in Tweet?\")}\n checked={via}\n onChange={value => updateAttribute(\"via\", value)}\n />\n\n <TextControl\n label={__(\"Prompt\")}\n value={prompt}\n onChange={value => updateAttribute(\"prompt\", value)}\n help={__(\"Text for action/prompt link\")}\n />\n </PanelBody>\n <PanelBody title={__(\"URL\")} initialOpen={false}>\n <ToggleControl\n label={__(\"Include URL in tweet?\")}\n checked={url}\n onChange={value => updateAttribute(\"url\", value)}\n />\n <TextControl\n label={__(\"Custom URL\")}\n value={urlcustom}\n onChange={value => updateAttribute(\"urlcustom\", value)}\n help={__(\"Custom URL to use instead of post\")}\n />\n <ToggleControl\n label={__(\"Nofollow\")}\n checked={nofollow}\n onChange={value => updateAttribute(\"nofollow\", value)}\n help={__(\"Make links nofollow\")}\n />\n </PanelBody>\n </InspectorControls>\n );\n};\n\nexport default Inspector;\n","/**\n * Block save component\n */\nconst render = () => {\n return null;\n};\n\nexport default render;\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","(function() { module.exports = this[\"wp\"][\"blockEditor\"]; }());","(function() { module.exports = this[\"wp\"][\"blocks\"]; }());","(function() { module.exports = this[\"wp\"][\"components\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"i18n\"]; }());"],"sourceRoot":""}
|
assets/block/build/script.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
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")],supports:{align:!0,alignWide:!1},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,d=p?r:v?r[e]:(r[e]||{}).prototype;p&&(n=e);for(a in n)(f=!s&&d&&void 0!==d[a])&&a in y||(l=f?d[a]:n[a],y[a]=p&&"function"!=typeof d[a]?n[a]:m&&f?u(l,r):h&&d[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}]);
|
assets/block/init.php
CHANGED
@@ -38,7 +38,7 @@ register_block_type( 'bctt/clicktotweet', array(
|
|
38 |
'attributes' => apply_filters ( 'bctt_block_attributes' ,array(
|
39 |
'tweet' => array(
|
40 |
'type' => 'string',
|
41 |
-
'default' =>
|
42 |
),
|
43 |
'username' => array(
|
44 |
'type' => 'string',
|
@@ -70,16 +70,14 @@ register_block_type( 'bctt/clicktotweet', array(
|
|
70 |
|
71 |
// Callback function to render bctt on frontend
|
72 |
function bctt_block_callback( $attributes ) {
|
73 |
-
|
74 |
-
$
|
75 |
-
$
|
76 |
-
$
|
77 |
-
$url = $attributes['url'];
|
78 |
$urlcustom = $attributes['urlcustom'];
|
79 |
-
$nofollow
|
80 |
-
$prompt
|
81 |
-
|
82 |
-
$showUrl = ( $url ? 'yes' : 'no' );
|
83 |
|
84 |
$shortcode_attributes = apply_filters ( 'bctt_block_render_attributes', array(
|
85 |
'tweet' => $tweet,
|
38 |
'attributes' => apply_filters ( 'bctt_block_attributes' ,array(
|
39 |
'tweet' => array(
|
40 |
'type' => 'string',
|
41 |
+
'default' => get_the_title( get_the_ID() )
|
42 |
),
|
43 |
'username' => array(
|
44 |
'type' => 'string',
|
70 |
|
71 |
// Callback function to render bctt on frontend
|
72 |
function bctt_block_callback( $attributes ) {
|
73 |
+
$tweet = $attributes['tweet'];
|
74 |
+
$via = $attributes['via'];
|
75 |
+
$username = $attributes['username'];
|
76 |
+
$url = $attributes['url'];
|
|
|
77 |
$urlcustom = $attributes['urlcustom'];
|
78 |
+
$nofollow = $attributes['nofollow'];
|
79 |
+
$prompt = $attributes['prompt'];
|
80 |
+
$showUrl = ( $url ? 'yes' : 'no' );
|
|
|
81 |
|
82 |
$shortcode_attributes = apply_filters ( 'bctt_block_render_attributes', array(
|
83 |
'tweet' => $tweet,
|
assets/block/src/editor.js
CHANGED
@@ -8,7 +8,7 @@ import classnames from "classnames";
|
|
8 |
*/
|
9 |
import { __ } from "@wordpress/i18n";
|
10 |
import { Fragment } from "@wordpress/element";
|
11 |
-
import { RichText } from "@wordpress/editor";
|
12 |
|
13 |
/**
|
14 |
* Internal dependencies
|
@@ -21,6 +21,14 @@ import Inspector from "./inspector";
|
|
21 |
const editor = props => {
|
22 |
const { attributes, setAttributes, className } = props;
|
23 |
const { tweet, prompt } = attributes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
// Events
|
25 |
const onChangeTweet = value => {
|
26 |
setAttributes({ tweet: value });
|
@@ -38,11 +46,11 @@ const editor = props => {
|
|
38 |
<span className="bctt-ctt-text">
|
39 |
<RichText
|
40 |
format="string"
|
41 |
-
|
42 |
tagName="div"
|
43 |
placeholder={__("Enter text for readers to Tweet")}
|
44 |
onChange={onChangeTweet}
|
45 |
-
value={tweet}
|
46 |
/>
|
47 |
</span>
|
48 |
<a href="#" onClick={onClickPrompt} className="bctt-ctt-btn">
|
8 |
*/
|
9 |
import { __ } from "@wordpress/i18n";
|
10 |
import { Fragment } from "@wordpress/element";
|
11 |
+
import { RichText } from "@wordpress/block-editor";
|
12 |
|
13 |
/**
|
14 |
* Internal dependencies
|
21 |
const editor = props => {
|
22 |
const { attributes, setAttributes, className } = props;
|
23 |
const { tweet, prompt } = attributes;
|
24 |
+
|
25 |
+
// Default tweet content
|
26 |
+
const title = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'title' );
|
27 |
+
|
28 |
+
if ( !tweet ) {
|
29 |
+
setAttributes( { tweet: title } );
|
30 |
+
}
|
31 |
+
|
32 |
// Events
|
33 |
const onChangeTweet = value => {
|
34 |
setAttributes({ tweet: value });
|
46 |
<span className="bctt-ctt-text">
|
47 |
<RichText
|
48 |
format="string"
|
49 |
+
allowedFormats={[]}
|
50 |
tagName="div"
|
51 |
placeholder={__("Enter text for readers to Tweet")}
|
52 |
onChange={onChangeTweet}
|
53 |
+
value={ tweet }
|
54 |
/>
|
55 |
</span>
|
56 |
<a href="#" onClick={onClickPrompt} className="bctt-ctt-btn">
|
assets/block/src/index.js
CHANGED
@@ -21,6 +21,10 @@ export default registerBlockType("bctt/clicktotweet", {
|
|
21 |
category: "widgets",
|
22 |
icon: "twitter",
|
23 |
keywords: [__("Twitter"), __("Tweet")],
|
|
|
|
|
|
|
|
|
24 |
edit: editor,
|
25 |
save: render
|
26 |
});
|
21 |
category: "widgets",
|
22 |
icon: "twitter",
|
23 |
keywords: [__("Twitter"), __("Tweet")],
|
24 |
+
supports: {
|
25 |
+
align: false,
|
26 |
+
alignWide: false
|
27 |
+
},
|
28 |
edit: editor,
|
29 |
save: render
|
30 |
});
|
assets/block/src/inspector.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* WordPress dependencies
|
3 |
*/
|
4 |
import { __ } from "@wordpress/i18n";
|
5 |
-
import { InspectorControls } from "@wordpress/editor";
|
6 |
import { PanelBody, TextControl, ToggleControl } from "@wordpress/components";
|
7 |
|
8 |
/**
|
2 |
* WordPress dependencies
|
3 |
*/
|
4 |
import { __ } from "@wordpress/i18n";
|
5 |
+
import { InspectorControls } from "@wordpress/block-editor";
|
6 |
import { PanelBody, TextControl, ToggleControl } from "@wordpress/components";
|
7 |
|
8 |
/**
|
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.
|
6 |
* Author: Ben Meredith
|
7 |
* Author URI: https://www.betterclicktotweet.com
|
8 |
* Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
|
@@ -12,7 +12,7 @@
|
|
12 |
|
13 |
defined( 'ABSPATH' ) or die( "No soup for you. You leave now." );
|
14 |
|
15 |
-
define ( 'BCTT_VERSION', '5.
|
16 |
|
17 |
include 'i18n-module.php';
|
18 |
include 'bctt-admin.php';
|
@@ -92,11 +92,12 @@ function bctt_shorten( $input, $length, $ellipsis = true, $strip_html = true ) {
|
|
92 |
*/
|
93 |
|
94 |
function bctt_shortcode( $atts ) {
|
|
|
95 |
|
96 |
$atts = shortcode_atts( apply_filters( 'bctt_atts', array(
|
97 |
-
'tweet' =>
|
98 |
'via' => 'yes',
|
99 |
-
'username' => 'not-a-real-user',
|
100 |
'url' => 'yes',
|
101 |
'nofollow' => 'no',
|
102 |
'prompt' => sprintf( _x( 'Click To Tweet', 'Text for the box on the reader-facing box', 'better-click-to-tweet' ) )
|
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.10.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.10.0' );
|
16 |
|
17 |
include 'i18n-module.php';
|
18 |
include 'bctt-admin.php';
|
92 |
*/
|
93 |
|
94 |
function bctt_shortcode( $atts ) {
|
95 |
+
$twitter_handle = get_option( 'bctt-twitter-handle' );
|
96 |
|
97 |
$atts = shortcode_atts( apply_filters( 'bctt_atts', array(
|
98 |
+
'tweet' => get_the_title( get_the_ID() ),
|
99 |
'via' => 'yes',
|
100 |
+
'username' => $twitter_handle ? $twitter_handle : 'not-a-real-user',
|
101 |
'url' => 'yes',
|
102 |
'nofollow' => 'no',
|
103 |
'prompt' => sprintf( _x( 'Click To Tweet', 'Text for the box on the reader-facing box', 'better-click-to-tweet' ) )
|
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.
|
7 |
-
Stable tag: 5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -96,6 +96,13 @@ Donations: http://benlikes.us/donate
|
|
96 |
1. Becomes this in your blog post!
|
97 |
|
98 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
= 5.9.5 =
|
100 |
* chore — check for compatibility with the upcoming WordPress version 5.6
|
101 |
* enhancement — update some of the links and text on the settings page.
|
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.7
|
7 |
+
Stable tag: 5.10.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
96 |
1. Becomes this in your blog post!
|
97 |
|
98 |
== Changelog ==
|
99 |
+
= 5.10.0 =
|
100 |
+
* feature — adding a blank [bctt] shortcode populates the Better Click To Tweet box with the post/page's title.
|
101 |
+
* bonus — moved to the country. Incorrectly assumed I'd eat a lot more peaches, based on my extensive knowledge of Presidents Of The United States songs from the 90s
|
102 |
+
* chore — confirm compatibility with WordPress 5.7 and PHP 8.0
|
103 |
+
* sale — you should reward yourself with the promo code CHANGELOG at https://benlikes.us/bcttps
|
104 |
+
|
105 |
+
|
106 |
= 5.9.5 =
|
107 |
* chore — check for compatibility with the upcoming WordPress version 5.6
|
108 |
* enhancement — update some of the links and text on the settings page.
|