Version Description
- Update readme.txt
- Fix JS error on options page
- Set cookie using secure attribute when accessed via secure connection
- Fix PL Link Inserter jumping to bottom of page on WP 6.1
- Fix Gutenberg deprecation notices
Download this release
Release Info
Developer | cartpauj |
Plugin | Shortlinks by Pretty Links – Best WordPress Link Tracking Plugin |
Version | 3.2.8 |
Comparing to | |
See all releases |
Code changes from version 3.2.7 to 3.2.8
- app/models/PrliUtils.php +2 -2
- app/views/options/form.php +1 -1
- i18n/pretty-link.pot +5 -5
- js/editor.js +2 -2
- js/editor/components/link-editor/index.js +28 -7
- js/editor/formats/pretty-link/index.js +2 -1
- pretty-link.php +1 -1
- readme.txt +93 -28
app/models/PrliUtils.php
CHANGED
@@ -219,7 +219,7 @@ class PrliUtils {
|
|
219 |
$cookie_expire_time = time()+60*60*24*30; // Expire in 30 days
|
220 |
|
221 |
if(!isset($_COOKIE[$cookie_name])) {
|
222 |
-
setcookie($cookie_name
|
223 |
$first_click = 1;
|
224 |
}
|
225 |
|
@@ -231,7 +231,7 @@ class PrliUtils {
|
|
231 |
// Retrieve / Generate visitor id
|
232 |
if(!isset($_COOKIE[$visitor_cookie])) {
|
233 |
$visitor_uid = $prli_click->generateUniqueVisitorId();
|
234 |
-
setcookie($visitor_cookie
|
235 |
}
|
236 |
else {
|
237 |
$visitor_uid = $_COOKIE[$visitor_cookie];
|
219 |
$cookie_expire_time = time()+60*60*24*30; // Expire in 30 days
|
220 |
|
221 |
if(!isset($_COOKIE[$cookie_name])) {
|
222 |
+
setcookie($cookie_name, $slug, $cookie_expire_time, '/', '', is_ssl());
|
223 |
$first_click = 1;
|
224 |
}
|
225 |
|
231 |
// Retrieve / Generate visitor id
|
232 |
if(!isset($_COOKIE[$visitor_cookie])) {
|
233 |
$visitor_uid = $prli_click->generateUniqueVisitorId();
|
234 |
+
setcookie($visitor_cookie, $visitor_uid, $visitor_cookie_expire_time, '/', '', is_ssl());
|
235 |
}
|
236 |
else {
|
237 |
$visitor_uid = $_COOKIE[$visitor_cookie];
|
app/views/options/form.php
CHANGED
@@ -1092,7 +1092,7 @@
|
|
1092 |
var dialog = row.find('.pretty-link-upgrade');
|
1093 |
if ( dialog.data('offset') ) {
|
1094 |
dialog.css('top', '-' + dialog.data('offset') + 'px');
|
1095 |
-
} else {
|
1096 |
var moveUp = row.offset().top - wrap.offset().top;
|
1097 |
dialog.data('offset', moveUp);
|
1098 |
dialog.css('top', '-' + moveUp + 'px');
|
1092 |
var dialog = row.find('.pretty-link-upgrade');
|
1093 |
if ( dialog.data('offset') ) {
|
1094 |
dialog.css('top', '-' + dialog.data('offset') + 'px');
|
1095 |
+
} else if(row.is(':visible')) {
|
1096 |
var moveUp = row.offset().top - wrap.offset().top;
|
1097 |
dialog.data('offset', moveUp);
|
1098 |
dialog.css('top', '-' + moveUp + 'px');
|
i18n/pretty-link.pot
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
# This file is distributed under the same license as the Pretty Links plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Pretty Links 3.2.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pretty-link\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2022-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
-
"X-Generator: WP-CLI 2.
|
15 |
"X-Domain: pretty-link\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
@@ -262,7 +262,7 @@ msgstr ""
|
|
262 |
|
263 |
#: app/controllers/PrliLinksController.php:62
|
264 |
#: js/editor.js:12
|
265 |
-
#: js/editor/components/link-editor/index.js:
|
266 |
msgid "New Pretty Link"
|
267 |
msgstr ""
|
268 |
|
@@ -2807,7 +2807,7 @@ msgstr ""
|
|
2807 |
|
2808 |
#: app/views/shared/tinymce_form_popup.php:10
|
2809 |
#: js/editor.js:12
|
2810 |
-
#: js/editor/components/link-editor/index.js:
|
2811 |
msgid "Create New Pretty Link"
|
2812 |
msgstr ""
|
2813 |
|
2 |
# This file is distributed under the same license as the Pretty Links plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Pretty Links 3.2.8\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pretty-link\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2022-12-09T11:54:38-06:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
+
"X-Generator: WP-CLI 2.5.0\n"
|
15 |
"X-Domain: pretty-link\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
262 |
|
263 |
#: app/controllers/PrliLinksController.php:62
|
264 |
#: js/editor.js:12
|
265 |
+
#: js/editor/components/link-editor/index.js:400
|
266 |
msgid "New Pretty Link"
|
267 |
msgstr ""
|
268 |
|
2807 |
|
2808 |
#: app/views/shared/tinymce_form_popup.php:10
|
2809 |
#: js/editor.js:12
|
2810 |
+
#: js/editor/components/link-editor/index.js:453
|
2811 |
msgid "Create New Pretty Link"
|
2812 |
msgstr ""
|
2813 |
|
js/editor.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=38)}([function(t,e){!function(){t.exports=this.wp.element}()},function(t,e){!function(){t.exports=this.wp.i18n}()},function(t,e){!function(){t.exports=this.wp.richText}()},function(t,e){!function(){t.exports=this.wp.url}()},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}},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){!function(){t.exports=this.wp.keycodes}()},function(t,e){!function(){t.exports=this.wp.blockEditor}()},function(t,e,n){var o=n(35);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&&o(t,e)}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var o=n(36),r=n(4);t.exports=function(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?r(t):e}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}t.exports=function(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){!function(){t.exports=this.lodash}()},function(t,e,n){"use strict";n.r(e);var o=n(12),r=n.n(o),i=n(11),s=n.n(i),a=n(10),
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
@@ -9,4 +9,4 @@
|
|
9 |
Licensed under the MIT License (MIT), see
|
10 |
http://jedwatson.github.io/classnames
|
11 |
*/
|
12 |
-
!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var t=[],e=0;e<arguments.length;e++){var o=arguments[e];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)&&o.length){var s=r.apply(null,o);s&&t.push(s)}else if("object"===i)for(var a in o)n.call(o,a)&&o[a]&&t.push(a)}}return t.join(" ")}void 0!==t&&t.exports?(r.default=r,t.exports=r):void 0===(o=function(){return r}.apply(e,[]))||(t.exports=o)}()},function(t,e,n){var o=n(32);t.exports=function(t,e){if(null==t)return{};var n,r,i=o(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}},function(t,e){!function(){t.exports=this.wp.compose}()},function(t,e,n){"use strict";n.r(e);var o=n(12),r=n.n(o),i=n(11),s=n.n(i),a=n(10),l=n.n(a),c=n(9),u=n.n(c),f=n(4),p=n.n(f),d=n(8),h=n.n(d),b=n(23),v=n.n(b),g=n(16),m=n.n(g),y=n(0),w=n(15),k=n.n(w),O=n(1),j=n(5),S=n(6),L=n(22),x=n(3),E=n(2),_=n(7),C=(n(19),n(14)),T=(n(31),n(13));function R(t){if(!t)return!1;var e=t.trim();if(!e)return!1;if(/^\S+:/.test(e)){var n=Object(x.getProtocol)(e);if(!Object(x.isValidProtocol)(n))return!1;if(Object(T.startsWith)(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(e))return!1;var o=Object(x.getAuthority)(e);if(!Object(x.isValidAuthority)(o))return!1;var r=Object(x.getPath)(e);if(r&&!Object(x.isValidPath)(r))return!1;var i=Object(x.getQueryString)(e);if(i&&!Object(x.isValidQueryString)(i))return!1;var s=Object(x.getFragment)(e);if(s&&!Object(x.isValidFragment)(s))return!1}return!(Object(T.startsWith)(e,"#")&&!Object(x.isValidFragment)(e))}function N(t){var e=t.url,n=t.opensInNewWindow,o=t.text,r=t.noFollow,i=t.isSponsored,s={type:"core/link",attributes:{url:e}};if(s.attributes.rel="",r&&(s.attributes.rel+="nofollow noindex "),i&&(s.attributes.rel+="sponsored "),n){var a=Object(O.sprintf)(Object(O.__)("%s (opens in a new tab)"),o);s.attributes.target="_blank",s.attributes.rel+="noreferrer noopener",s.attributes["aria-label"]=a}return""===s.attributes.rel&&delete s.attributes.rel,s}var P=function(t){return t.stopPropagation()};function I(t,e){return t.addingLink||e.editLink}var F=function(t){var e=t.value,n=t.onChangeInputValue,o=t.onKeyDown,r=t.submitLink,i=t.autocompleteRef;return Object(y.createElement)("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:P,onKeyDown:o,onSubmit:r},Object(y.createElement)(C.default,{value:e,onChange:n,autocompleteRef:i}),Object(y.createElement)(j.IconButton,{icon:"editor-break",label:Object(O.__)("Insert Pretty Link"),type:"submit"}))},A=function(t){var e=t.url,n=Object(x.prependHTTP)(e),o=k()("editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value",{"has-invalid-link":!R(n)});return e?Object(y.createElement)(j.ExternalLink,{className:o,href:e},Object(x.filterURLForDisplay)(Object(x.safeDecodeURI)(e))):Object(y.createElement)("span",{className:o})},W=function(t){var e=t.isActive,n=t.addingLink,o=t.value,r=m()(t,["isActive","addingLink","value"]),i=Object(y.useMemo)(function(){var t=window.getSelection(),e=t.rangeCount>0?t.getRangeAt(0):null;if(e){if(n)return Object(L.getRectangleFromRange)(e);var o=e.startContainer;for(o=o.nextElementSibling||o;o.nodeType!==window.Node.ELEMENT_NODE;)o=o.parentNode;var r=o.closest("a");return r?r.getBoundingClientRect():void 0}},[e,n,o.start,o.end]);return i?Object(y.createElement)(_.URLPopover,v()({anchorRect:i},r)):null},U=function(t){var e=t.url,n=t.editLink;return Object(y.createElement)("div",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:P},Object(y.createElement)(A,{url:e}),Object(y.createElement)(j.IconButton,{icon:"edit",label:Object(O.__)("Edit"),onClick:n}))},D=function(t){function e(){var t;return r()(this,e),(t=l()(this,u()(e).apply(this,arguments))).editLink=t.editLink.bind(p()(t)),t.submitLink=t.submitLink.bind(p()(t)),t.onKeyDown=t.onKeyDown.bind(p()(t)),t.onChangeInputValue=t.onChangeInputValue.bind(p()(t)),t.setNoFollow=t.setNoFollow.bind(p()(t)),t.setIsSponsored=t.setIsSponsored.bind(p()(t)),t.setLinkTarget=t.setLinkTarget.bind(p()(t)),t.onClickOutside=t.onClickOutside.bind(p()(t)),t.resetState=t.resetState.bind(p()(t)),t.autocompleteRef=Object(y.createRef)(),t.state={noFollow:!1,opensInNewWindow:!1,isSponsored:!1,inputValue:"",newLinkUrl:"",newLinkSlug:"",creatingLink:!1,createdLink:!1,createdLinkError:!1},t}return h()(e,t),s()(e,[{key:"onKeyDown",value:function(t){[S.LEFT,S.DOWN,S.RIGHT,S.UP,S.BACKSPACE,S.ENTER].indexOf(t.keyCode)>-1&&t.stopPropagation()}},{key:"onChangeInputValue",value:function(t){this.setState({inputValue:t})}},{key:"setLinkTarget",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({opensInNewWindow:t}),!I(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,N({url:o,opensInNewWindow:t,text:s})))}}},{key:"setNoFollow",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({noFollow:t}),!I(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,N({url:o,opensInNewWindow:opensInNewWindow,text:s,noFollow:t,isSponsored:isSponsored})))}}},{key:"setIsSponsored",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({isSponsored:t}),!I(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,N({url:o,opensInNewWindow:opensInNewWindow,text:s,noFollow:noFollow,isSponsored:t})))}}},{key:"editLink",value:function(t){this.setState({editLink:!0}),t.preventDefault()}},{key:"submitLink",value:function(t){var e=this.props,n=e.isActive,o=e.value,r=e.onChange,i=e.speak,s=this.state,a=s.inputValue,l=s.opensInNewWindow,c=s.noFollow,u=s.isSponsored,f=Object(x.prependHTTP)(a),p=N({url:f,opensInNewWindow:l,text:Object(E.getTextContent)(Object(E.slice)(o)),noFollow:c,isSponsored:u});if(t.preventDefault(),Object(E.isCollapsed)(o)&&!n){var d=Object(E.applyFormat)(Object(E.create)({text:f}),p,0,f.length);r(Object(E.insert)(o,d))}else r(Object(E.applyFormat)(o,p));this.resetState(),R(f)?i(n?Object(O.__)("Link edited."):Object(O.__)("Link inserted."),"assertive"):i(Object(O.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}},{key:"onClickOutside",value:function(t){var e=this.autocompleteRef.current;e&&e.contains(t.target)||this.resetState()}},{key:"resetState",value:function(){this.props.stopAddingLink(),this.setState({editLink:!1})}},{key:"render",value:function(){var t=this,e=this.props,n=e.isActive,o=e.activeAttributes.url,r=e.addingLink,i=e.value;if(!n&&!r)return null;var s=this.state,a=s.inputValue,l=s.noFollow,c=s.opensInNewWindow,u=s.isSponsored,f=s.newLinkUrl,p=s.newLinkSlug,d=s.creatingLink,h=s.createdLink,b=s.createdLinkError,v=I(this.props,this.state);return Object(y.createElement)(W,{className:"pretty-link-inserter",value:i,isActive:n,addingLink:r,onClickOutside:this.onClickOutside,onClose:this.resetState,focusOnMount:!!v&&"firstElement",renderSettings:function(){return Object(y.createElement)(y.Fragment,null,Object(y.createElement)("div",null,Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Open in New Tab"),checked:c,onChange:t.setLinkTarget}),Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Nofollow"),checked:l,onChange:t.setNoFollow}),Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Sponsored Link"),checked:u,onChange:t.setIsSponsored})),Object(y.createElement)("div",{className:"pretty-link-inserter-form-container"},h&&Object(y.createElement)(j.Notice,{status:"success",onRemove:function(){return t.setState({createdLink:!1})}},Object(y.createElement)("p",null,Object(O.__)("Pretty Link created successfully.","memberpress"))),b&&Object(y.createElement)(j.Notice,{status:"error",onRemove:function(){return t.setState({createdLink:!1,createdLinkError:!1})}},Object(y.createElement)("p",null,Object(O.__)("Pretty Link could not be created. Please try a slug that is not already used.","memberpress"))),Object(y.createElement)("strong",null,Object(O.__)("New Pretty Link","pretty-link")),Object(y.createElement)("form",{onSubmit:function(e){e.preventDefault(),t.setState({creatingLink:!0,createdLinkError:!1}),function(t,e){return new Promise(function(n,o){jQuery.post(ajaxurl,{action:"prli_create_pretty_link",target:t,slug:e,redirect:"",nofollow:1,tracking:1,sponsored:0},function(t,e,r){"true"===t?n(t):o(t)}).fail(function(t){o(t)})})}(f,p).then(function(e){t.setState({createdLink:!0,creatingLink:!1,inputValue:plEditor.homeUrl+p,newLinkUrl:"",newLinkSlug:""})}).catch(function(e){t.setState({createdLink:!1,creatingLink:!1,createdLinkError:!0})})}},Object(y.createElement)("p",null,Object(y.createElement)(j.TextControl,{placeholder:"URL",className:"pretty-link-new-link-url",value:f,onChange:function(e){t.setState({newLinkUrl:e})}})),Object(y.createElement)("p",null,Object(y.createElement)(j.TextControl,{placeholder:"Slug",className:"pretty-link-new-link-slug",value:p,onChange:function(e){t.setState({newLinkSlug:e})}})),Object(y.createElement)("p",null,Object(y.createElement)("button",{className:"pretty-link-submit-new-link components-button is-button is-primary",onClick:function(){console.log("Creating new Pretty Link...")}},Object(O.__)("Create New Pretty Link","pretty-link")),d&&Object(y.createElement)(j.Spinner,null)))))}},v?Object(y.createElement)(F,{value:a,onChangeInputValue:this.onChangeInputValue,onKeyDown:this.onKeyDown,submitLink:this.submitLink,autocompleteRef:this.autocompleteRef}):Object(y.createElement)(U,{url:o,editLink:this.editLink}))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n=t.activeAttributes,o=n.url,r=n.target,i=(n.isSponsored,"_blank"===r);if(!I(t,e)){if(o!==e.inputValue)return{inputValue:o};if(i!==e.opensInNewWindow)return{opensInNewWindow:i}}return null}}]),e}(y.Component);e.default=Object(j.withSpokenMessages)(D)},function(t,e){!function(){t.exports=this.wp.apiFetch}()},function(t,e){!function(){t.exports=this.wp.htmlEntities}()},function(t,e){!function(){t.exports=this.regeneratorRuntime}()},function(t,e){!function(){t.exports=this.wp.dom}()},function(t,e){function n(){return t.exports=n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n.apply(this,arguments)}t.exports=n},function(t,e){!function(){t.exports=this.wp.data}()},function(t,e,n){"use strict";t.exports=n(34)},function(t,e){function n(t,e,n,o,r,i,s){try{var a=t[i](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(o,r)}t.exports=function(t){return function(){var e=this,o=arguments;return new Promise(function(r,i){var s=t.apply(e,o);function a(t){n(s,r,i,a,l,"next",t)}function l(t){n(s,r,i,a,l,"throw",t)}a(void 0)})}}},function(t,e,n){"use strict";n.r(e),n.d(e,"prettyLink",function(){return x});var o=n(16),r=n.n(o),i=n(12),s=n.n(i),a=n(11),l=n.n(a),c=n(10),u=n.n(c),f=n(9),p=n.n(f),d=n(4),h=n.n(d),b=n(8),v=n.n(b),g=n(0),m=n(1),y=n(5),w=n(2),k=n(3),O=n(7),j=n(18),S="pretty-link/pretty-link",L=Object(m.__)("Pretty Link"),x={name:S,title:L,tagName:"a",className:"pretty-link",attributes:{url:"href",target:"target"},edit:Object(y.withSpokenMessages)(function(t){function e(){var t;return s()(this,e),(t=u()(this,p()(e).apply(this,arguments))).addLink=t.addLink.bind(h()(t)),t.stopAddingLink=t.stopAddingLink.bind(h()(t)),t.onRemoveFormat=t.onRemoveFormat.bind(h()(t)),t.state={addingLink:!1},t}return v()(e,t),l()(e,[{key:"addLink",value:function(){var t=this.props,e=t.value,n=t.onChange,o=Object(w.getTextContent)(Object(w.slice)(e));o&&Object(k.isURL)(o)?n(Object(w.applyFormat)(e,{type:S,attributes:{url:o}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1})}},{key:"onRemoveFormat",value:function(){var t=this.props,e=t.value,n=t.onChange,o=t.speak;n(Object(w.removeFormat)(e,S)),o(Object(m.__)("Link removed."),"assertive")}},{key:"render",value:function(){var t=this.props,e=t.isActive,n=t.activeAttributes,o=t.value,r=t.onChange;return Object(g.createElement)(g.Fragment,null,Object(g.createElement)(O.RichTextShortcut,{type:"primary",character:"p",onUse:this.addLink}),Object(g.createElement)(O.RichTextShortcut,{type:"primaryShift",character:"p",onUse:this.onRemoveFormat}),e&&Object(g.createElement)(O.RichTextToolbarButton,{icon:"star-filled",title:Object(m.__)("Unlink"),onClick:this.onRemoveFormat,isActive:e,shortcutType:"primaryShift",shortcutCharacter:"p"}),!e&&Object(g.createElement)(O.RichTextToolbarButton,{icon:"star-filled",title:L,onClick:this.addLink,isActive:e,shortcutType:"primary",shortcutCharacter:"p"}),Object(g.createElement)(j.default,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:e,activeAttributes:n,value:o,onChange:r}))}}]),e}(g.Component))};[x].forEach(function(t){var e=t.name,n=r()(t,["name"]);return Object(w.registerFormatType)(e,n)})},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r,i=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(t,e,n){var o={},r=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),i=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var o=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(t){o=null}e[t]=o}return e[t]}}(),s=null,a=0,l=[],c=n(28);function u(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=o[r.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](r.parts[s]);for(;s<r.parts.length;s++)i.parts.push(v(r.parts[s],e))}else{var a=[];for(s=0;s<r.parts.length;s++)a.push(v(r.parts[s],e));o[r.id]={id:r.id,refs:1,parts:a}}}}function f(t,e){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],s=e.base?i[0]+e.base:i[0],a={css:i[1],media:i[2],sourceMap:i[3]};o[s]?o[s].parts.push(a):n.push(o[s]={id:s,parts:[a]})}return n}function p(t,e){var n=i(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=l[l.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=i(t.insertAt.before,n);n.insertBefore(e,r)}}function d(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function h(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var o=function(){0;return n.nc}();o&&(t.attrs.nonce=o)}return b(e,t.attrs),p(t,e),e}function b(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function v(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var l=a++;n=s||(s=h(e)),o=m.bind(null,n,l,!1),r=m.bind(null,n,l,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),p(t,e),e}(e),o=function(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=c(o));r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var s=new Blob([o],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}.bind(null,n,e),r=function(){d(n),n.href&&URL.revokeObjectURL(n.href)}):(n=h(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){d(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return u(n,e),function(t){for(var r=[],i=0;i<n.length;i++){var s=n[i];(a=o[s.id]).refs--,r.push(a)}t&&u(f(t,e),e);for(i=0;i<r.length;i++){var a;if(0===(a=r[i]).refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete o[a.id]}}}};var g=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}();function m(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=g(e,r);else{var i=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(i,s[e]):t.appendChild(i)}}},function(t,e){t.exports=".pretty-link-inserter .block-editor-url-popover__settings {\n display: block; }\n\n.pretty-link-inserter .pretty-link-inserter-form-container {\n margin-top: 30px; }\n"},function(t,e,n){var o=n(30);"string"==typeof o&&(o=[[t.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(29)(o,r);o.locals&&(t.exports=o.locals)},function(t,e){t.exports=function(t,e){if(null==t)return{};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)n=i[o],e.indexOf(n)>=0||(r[n]=t[n]);return r}},function(t,e,n){"use strict";var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function i(t,e){var n=t["page"+(e?"Y":"X")+"Offset"],o="scroll"+(e?"Top":"Left");if("number"!=typeof n){var r=t.document;"number"!=typeof(n=r.documentElement[o])&&(n=r.body[o])}return n}function s(t){return i(t)}function a(t){return i(t,!0)}function l(t){var e=function(t){var e,n=void 0,o=void 0,r=t.ownerDocument,i=r.body,s=r&&r.documentElement;return n=(e=t.getBoundingClientRect()).left,o=e.top,{left:n-=s.clientLeft||i.clientLeft||0,top:o-=s.clientTop||i.clientTop||0}}(t),n=t.ownerDocument,o=n.defaultView||n.parentWindow;return e.left+=s(o),e.top+=a(o),e}var c=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),u=/^(top|right|bottom|left)$/,f="currentStyle",p="runtimeStyle",d="left",h="px";var b=void 0;function v(t,e){for(var n=0;n<t.length;n++)e(t[n])}function g(t){return"border-box"===b(t,"boxSizing")}"undefined"!=typeof window&&(b=window.getComputedStyle?function(t,e,n){var o="",r=t.ownerDocument,i=n||r.defaultView.getComputedStyle(t,null);return i&&(o=i.getPropertyValue(e)||i[e]),o}:function(t,e){var n=t[f]&&t[f][e];if(c.test(n)&&!u.test(e)){var o=t.style,r=o[d],i=t[p][d];t[p][d]=t[f][d],o[d]="fontSize"===e?"1em":n||0,n=o.pixelLeft+h,o[d]=r,t[p][d]=i}return""===n?"auto":n});var m=["margin","border","padding"],y=-1,w=2,k=1;function O(t,e,n){var o=0,r=void 0,i=void 0,s=void 0;for(i=0;i<e.length;i++)if(r=e[i])for(s=0;s<n.length;s++){var a=void 0;a="border"===r?r+n[s]+"Width":r+n[s],o+=parseFloat(b(t,a))||0}return o}function j(t){return null!=t&&t==t.window}var S={};function L(t,e,n){if(j(t))return"width"===e?S.viewportWidth(t):S.viewportHeight(t);if(9===t.nodeType)return"width"===e?S.docWidth(t):S.docHeight(t);var o="width"===e?["Left","Right"]:["Top","Bottom"],r="width"===e?t.offsetWidth:t.offsetHeight,i=(b(t),g(t)),s=0;(null==r||r<=0)&&(r=void 0,(null==(s=b(t,e))||Number(s)<0)&&(s=t.style[e]||0),s=parseFloat(s)||0),void 0===n&&(n=i?k:y);var a=void 0!==r||i,l=r||s;if(n===y)return a?l-O(t,["border","padding"],o):s;if(a){var c=n===w?-O(t,["border"],o):O(t,["margin"],o);return l+(n===k?0:c)}return s+O(t,m.slice(n),o)}v(["Width","Height"],function(t){S["doc"+t]=function(e){var n=e.document;return Math.max(n.documentElement["scroll"+t],n.body["scroll"+t],S["viewport"+t](n))},S["viewport"+t]=function(e){var n="client"+t,o=e.document,r=o.body,i=o.documentElement[n];return"CSS1Compat"===o.compatMode&&i||r&&r[n]||i}});var x={position:"absolute",visibility:"hidden",display:"block"};function E(t){var e=void 0,n=arguments;return 0!==t.offsetWidth?e=L.apply(void 0,n):function(t,e,n){var o={},r=t.style,i=void 0;for(i in e)e.hasOwnProperty(i)&&(o[i]=r[i],r[i]=e[i]);for(i in n.call(t),e)e.hasOwnProperty(i)&&(r[i]=o[i])}(t,x,function(){e=L.apply(void 0,n)}),e}function _(t,e,n){var o=n;if("object"!==(void 0===e?"undefined":r(e)))return void 0!==o?("number"==typeof o&&(o+="px"),void(t.style[e]=o)):b(t,e);for(var i in e)e.hasOwnProperty(i)&&_(t,i,e[i])}v(["width","height"],function(t){var e=t.charAt(0).toUpperCase()+t.slice(1);S["outer"+e]=function(e,n){return e&&E(e,t,n?0:k)};var n="width"===t?["Left","Right"]:["Top","Bottom"];S[t]=function(e,o){if(void 0===o)return e&&E(e,t,y);if(e){b(e);return g(e)&&(o+=O(e,["padding","border"],n)),_(e,t,o)}}}),t.exports=o({getWindow:function(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow},offset:function(t,e){if(void 0===e)return l(t);!function(t,e){"static"===_(t,"position")&&(t.style.position="relative");var n=l(t),o={},r=void 0,i=void 0;for(i in e)e.hasOwnProperty(i)&&(r=parseFloat(_(t,i))||0,o[i]=r+e[i]-n[i]);_(t,o)}(t,e)},isWindow:j,each:v,css:_,clone:function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);if(t.overflow)for(var n in t)t.hasOwnProperty(n)&&(e.overflow[n]=t.overflow[n]);return e},scrollLeft:function(t,e){if(j(t)){if(void 0===e)return s(t);window.scrollTo(e,a(t))}else{if(void 0===e)return t.scrollLeft;t.scrollLeft=e}},scrollTop:function(t,e){if(j(t)){if(void 0===e)return a(t);window.scrollTo(s(t),e)}else{if(void 0===e)return t.scrollTop;t.scrollTop=e}},viewportWidth:0,viewportHeight:0},S)},function(t,e,n){"use strict";var o=n(33);t.exports=function(t,e,n){n=n||{},9===e.nodeType&&(e=o.getWindow(e));var r=n.allowHorizontalScroll,i=n.onlyScrollIfNeeded,s=n.alignWithTop,a=n.alignWithLeft,l=n.offsetTop||0,c=n.offsetLeft||0,u=n.offsetBottom||0,f=n.offsetRight||0;r=void 0===r||r;var p=o.isWindow(e),d=o.offset(t),h=o.outerHeight(t),b=o.outerWidth(t),v=void 0,g=void 0,m=void 0,y=void 0,w=void 0,k=void 0,O=void 0,j=void 0,S=void 0,L=void 0;p?(O=e,L=o.height(O),S=o.width(O),j={left:o.scrollLeft(O),top:o.scrollTop(O)},w={left:d.left-j.left-c,top:d.top-j.top-l},k={left:d.left+b-(j.left+S)+f,top:d.top+h-(j.top+L)+u},y=j):(v=o.offset(e),g=e.clientHeight,m=e.clientWidth,y={left:e.scrollLeft,top:e.scrollTop},w={left:d.left-(v.left+(parseFloat(o.css(e,"borderLeftWidth"))||0))-c,top:d.top-(v.top+(parseFloat(o.css(e,"borderTopWidth"))||0))-l},k={left:d.left+b-(v.left+m+(parseFloat(o.css(e,"borderRightWidth"))||0))+f,top:d.top+h-(v.top+g+(parseFloat(o.css(e,"borderBottomWidth"))||0))+u}),w.top<0||k.top>0?!0===s?o.scrollTop(e,y.top+w.top):!1===s?o.scrollTop(e,y.top+k.top):w.top<0?o.scrollTop(e,y.top+w.top):o.scrollTop(e,y.top+k.top):i||((s=void 0===s||!!s)?o.scrollTop(e,y.top+w.top):o.scrollTop(e,y.top+k.top)),r&&(w.left<0||k.left>0?!0===a?o.scrollLeft(e,y.left+w.left):!1===a?o.scrollLeft(e,y.left+k.left):w.left<0?o.scrollLeft(e,y.left+w.left):o.scrollLeft(e,y.left+k.left):i||((a=void 0===a||!!a)?o.scrollLeft(e,y.left+w.left):o.scrollLeft(e,y.left+k.left)))}},function(t,e){function n(e,o){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,o)}t.exports=n},function(t,e){function n(t){return(n="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)}function o(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=o=function(t){return n(t)}:t.exports=o=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},o(e)}t.exports=o},function(t,e,n){"use strict";n.r(e);var o=n(14);n.d(e,"URLInput",function(){return o.default})},function(t,e,n){n(37),n(18),n(14),t.exports=n(27)}]);
|
1 |
+
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=38)}([function(t,e){!function(){t.exports=this.wp.element}()},function(t,e){!function(){t.exports=this.wp.i18n}()},function(t,e){!function(){t.exports=this.wp.richText}()},function(t,e){!function(){t.exports=this.wp.url}()},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}},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){!function(){t.exports=this.wp.keycodes}()},function(t,e){!function(){t.exports=this.wp.blockEditor}()},function(t,e,n){var o=n(35);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&&o(t,e)}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var o=n(36),r=n(4);t.exports=function(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?r(t):e}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}t.exports=function(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){!function(){t.exports=this.lodash}()},function(t,e,n){"use strict";n.r(e);var o=n(12),r=n.n(o),i=n(11),s=n.n(i),a=n(10),c=n.n(a),l=n(9),u=n.n(l),f=n(4),p=n.n(f),d=n(8),h=n.n(d),b=n(21),v=n.n(b),g=n(26),m=n.n(g),y=n(0),w=n(13),k=n(15),O=n.n(k),j=n(25),S=n.n(j),L=n(1),x=n(6),E=n(5),_=n(17),C=n(24),R=n(19),T=n.n(R),N=n(3),P=n(20),F=function(t){return t.stopPropagation()},A=function(){var t=m()(v.a.mark(function t(e){var n;return v.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,T()({url:Object(N.addQueryArgs)(ajaxurl,{action:"prli_search_for_links",term:e})});case 2:return n=t.sent,t.abrupt("return",Object(w.map)(n,function(t){return{url:t.pretty_url,title:Object(P.decodeEntities)(t.value)+" ("+Object(P.decodeEntities)(t.slug)+")"||Object(L.__)("(no title)")}}));case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),I=function(t){function e(t){var n,o=t.autocompleteRef;return r()(this,e),(n=c()(this,u()(e).apply(this,arguments))).onChange=n.onChange.bind(p()(n)),n.onKeyDown=n.onKeyDown.bind(p()(n)),n.autocompleteRef=o||Object(y.createRef)(),n.inputRef=Object(y.createRef)(),n.updateSuggestions=Object(w.throttle)(n.updateSuggestions.bind(p()(n)),200),n.suggestionNodes=[],n.state={suggestions:[],showSuggestions:!1,selectedSuggestion:null},n}return h()(e,t),s()(e,[{key:"componentDidUpdate",value:function(){var t=this,e=this.state,n=e.showSuggestions,o=e.selectedSuggestion;n&&null!==o&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,S()(this.suggestionNodes[o],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),this.props.setTimeout(function(){t.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(t){var e=this;return function(n){e.suggestionNodes[t]=n}}},{key:"updateSuggestions",value:function(t){var e=this;if(t.length<2||/^https?:/.test(t))this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});else{this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=A(t);n.then(function(t){e.suggestionsRequest===n&&(e.setState({suggestions:t,loading:!1}),t.length?e.props.debouncedSpeak(Object(L.sprintf)(Object(L._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",t.length),t.length),"assertive"):e.props.debouncedSpeak(Object(L.__)("No results."),"assertive"))}).catch(function(){e.suggestionsRequest===n&&e.setState({loading:!1})}),this.suggestionsRequest=n}}},{key:"onChange",value:function(t){var e=t.target.value;this.props.onChange(e),this.updateSuggestions(e)}},{key:"onKeyDown",value:function(t){var e=this.state,n=e.showSuggestions,o=e.selectedSuggestion,r=e.suggestions,i=e.loading;if(n&&r.length&&!i){var s=this.state.suggestions[this.state.selectedSuggestion];switch(t.keyCode){case x.UP:t.stopPropagation(),t.preventDefault();var a=o?o-1:r.length-1;this.setState({selectedSuggestion:a});break;case x.DOWN:t.stopPropagation(),t.preventDefault();var c=null===o||o===r.length-1?0:o+1;this.setState({selectedSuggestion:c});break;case x.TAB:null!==this.state.selectedSuggestion&&(this.selectLink(s),this.props.speak(Object(L.__)("Link selected.")));break;case x.ENTER:null!==this.state.selectedSuggestion&&(t.stopPropagation(),this.selectLink(s))}}else switch(t.keyCode){case x.UP:0!==t.target.selectionStart&&(t.stopPropagation(),t.preventDefault(),t.target.setSelectionRange(0,0));break;case x.DOWN:this.props.value.length!==t.target.selectionStart&&(t.stopPropagation(),t.preventDefault(),t.target.setSelectionRange(this.props.value.length,this.props.value.length))}}},{key:"selectLink",value:function(t){this.props.onChange(t.url,t),this.setState({selectedSuggestion:null,showSuggestions:!1})}},{key:"handleOnClick",value:function(t){this.selectLink(t),this.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.value,o=void 0===n?"":n,r=e.autoFocus,i=void 0===r||r,s=e.instanceId,a=e.className,c=this.state,l=c.showSuggestions,u=c.suggestions,f=c.selectedSuggestion,p=c.loading,d="block-editor-url-input-suggestions-".concat(s),h="block-editor-url-input-suggestion-".concat(s);return Object(y.createElement)("div",{className:O()("editor-url-input block-editor-url-input",a)},Object(y.createElement)("input",{autoFocus:i,type:"text","aria-label":Object(L.__)("URL"),required:!0,value:o,onChange:this.onChange,onInput:F,placeholder:Object(L.__)("Paste or type to search for your Pretty Link"),onKeyDown:this.onKeyDown,role:"combobox","aria-expanded":l,"aria-autocomplete":"list","aria-owns":d,"aria-activedescendant":null!==f?"".concat(h,"-").concat(f):void 0,ref:this.inputRef}),p&&Object(y.createElement)(E.Spinner,null),l&&!!u.length&&Object(y.createElement)(E.Popover,{position:"bottom",noArrow:!0,focusOnMount:!1},Object(y.createElement)("div",{className:"editor-url-input__suggestions block-editor-url-input__suggestions",id:d,ref:this.autocompleteRef,role:"listbox"},u.map(function(e,n){return Object(y.createElement)("button",{key:e.id,role:"option",tabIndex:"-1",id:"".concat(h,"-").concat(n),ref:t.bindSuggestionNode(n),className:O()("editor-url-input__suggestion block-editor-url-input__suggestion",{"is-selected":n===f}),onClick:function(){return t.handleOnClick(e)},"aria-selected":n===f},e.title)}))))}}]),e}(y.Component);e.default=Object(_.compose)(_.withSafeTimeout,E.withSpokenMessages,_.withInstanceId,Object(C.withSelect)(function(t){return{fetchLinkSuggestions:(0,t("core/block-editor").getSettings)().__experimentalFetchLinkSuggestions}}))(I)},function(t,e,n){var o;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
9 |
Licensed under the MIT License (MIT), see
|
10 |
http://jedwatson.github.io/classnames
|
11 |
*/
|
12 |
+
!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var t=[],e=0;e<arguments.length;e++){var o=arguments[e];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)&&o.length){var s=r.apply(null,o);s&&t.push(s)}else if("object"===i)for(var a in o)n.call(o,a)&&o[a]&&t.push(a)}}return t.join(" ")}void 0!==t&&t.exports?(r.default=r,t.exports=r):void 0===(o=function(){return r}.apply(e,[]))||(t.exports=o)}()},function(t,e,n){var o=n(32);t.exports=function(t,e){if(null==t)return{};var n,r,i=o(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}},function(t,e){!function(){t.exports=this.wp.compose}()},function(t,e,n){"use strict";n.r(e);var o=n(12),r=n.n(o),i=n(11),s=n.n(i),a=n(10),c=n.n(a),l=n(9),u=n.n(l),f=n(4),p=n.n(f),d=n(8),h=n.n(d),b=n(23),v=n.n(b),g=n(16),m=n.n(g),y=n(0),w=n(15),k=n.n(w),O=n(1),j=n(5),S=n(6),L=n(22),x=n(3),E=n(2),_=n(7),C=(n(19),n(14)),R=(n(31),n(13));function T(t){if(!t)return!1;var e=t.trim();if(!e)return!1;if(/^\S+:/.test(e)){var n=Object(x.getProtocol)(e);if(!Object(x.isValidProtocol)(n))return!1;if(Object(R.startsWith)(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(e))return!1;var o=Object(x.getAuthority)(e);if(!Object(x.isValidAuthority)(o))return!1;var r=Object(x.getPath)(e);if(r&&!Object(x.isValidPath)(r))return!1;var i=Object(x.getQueryString)(e);if(i&&!Object(x.isValidQueryString)(i))return!1;var s=Object(x.getFragment)(e);if(s&&!Object(x.isValidFragment)(s))return!1}return!(Object(R.startsWith)(e,"#")&&!Object(x.isValidFragment)(e))}function N(t){var e=t.url,n=t.opensInNewWindow,o=t.text,r=t.noFollow,i=t.isSponsored,s={type:"core/link",attributes:{url:e}};if(s.attributes.rel="",r&&(s.attributes.rel+="nofollow noindex "),i&&(s.attributes.rel+="sponsored "),n){var a=Object(O.sprintf)(Object(O.__)("%s (opens in a new tab)"),o);s.attributes.target="_blank",s.attributes.rel+="noreferrer noopener",s.attributes["aria-label"]=a}return""===s.attributes.rel&&delete s.attributes.rel,s}var P=function(t){return t.stopPropagation()},F=wp.richText.useAnchor;function A(t,e){return t.addingLink||e.editLink}var I=function(t){var e=t.value,n=t.onChangeInputValue,o=t.onKeyDown,r=t.submitLink,i=t.autocompleteRef;return Object(y.createElement)("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:P,onKeyDown:o,onSubmit:r},Object(y.createElement)(C.default,{value:e,onChange:n,autocompleteRef:i,autoFocus:!1}),Object(y.createElement)(j.Button,{icon:"editor-break",label:Object(O.__)("Insert Pretty Link"),type:"submit"}))},W=function(t){var e=t.url,n=Object(x.prependHTTP)(e),o=k()("editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value",{"has-invalid-link":!T(n)});return e?Object(y.createElement)(j.ExternalLink,{className:o,href:e},Object(x.filterURLForDisplay)(Object(x.safeDecodeURI)(e))):Object(y.createElement)("span",{className:o})},U=function(t){var e,n=t.isActive,o=t.addingLink,r=t.value,i=t.contentRef,s=m()(t,["isActive","addingLink","value","contentRef"]),a=Object(y.useMemo)(function(){var t=window.getSelection(),e=t.rangeCount>0?t.getRangeAt(0):null;if(e){if(o)return Object(L.getRectangleFromRange)(e);var n=e.startContainer;for(n=n.nextElementSibling||n;n.nodeType!==window.Node.ELEMENT_NODE;)n=n.parentNode;var r=n.closest("a");return r?r.getBoundingClientRect():void 0}},[n,o,r.start,r.end]);return a||F?(e=F?{anchor:F({editableContentElement:i.current,value:r,settings:{tagName:"a"}})}:{anchorRect:a},Object(y.createElement)(_.URLPopover,v()({},e,s))):null},D=function(t){var e=t.url,n=t.editLink;return Object(y.createElement)("div",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:P},Object(y.createElement)(W,{url:e}),Object(y.createElement)(j.Button,{icon:"edit",label:Object(O.__)("Edit"),onClick:n}))},V=function(t){function e(){var t;return r()(this,e),(t=c()(this,u()(e).apply(this,arguments))).editLink=t.editLink.bind(p()(t)),t.submitLink=t.submitLink.bind(p()(t)),t.onKeyDown=t.onKeyDown.bind(p()(t)),t.onChangeInputValue=t.onChangeInputValue.bind(p()(t)),t.setNoFollow=t.setNoFollow.bind(p()(t)),t.setIsSponsored=t.setIsSponsored.bind(p()(t)),t.setLinkTarget=t.setLinkTarget.bind(p()(t)),t.onClickOutside=t.onClickOutside.bind(p()(t)),t.resetState=t.resetState.bind(p()(t)),t.autocompleteRef=Object(y.createRef)(),t.state={noFollow:!1,opensInNewWindow:!1,isSponsored:!1,inputValue:"",newLinkUrl:"",newLinkSlug:"",creatingLink:!1,createdLink:!1,createdLinkError:!1},t}return h()(e,t),s()(e,[{key:"onKeyDown",value:function(t){[S.LEFT,S.DOWN,S.RIGHT,S.UP,S.BACKSPACE,S.ENTER].indexOf(t.keyCode)>-1&&t.stopPropagation()}},{key:"onChangeInputValue",value:function(t){this.setState({inputValue:t})}},{key:"setLinkTarget",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({opensInNewWindow:t}),!A(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,N({url:o,opensInNewWindow:t,text:s})))}}},{key:"setNoFollow",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({noFollow:t}),!A(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,N({url:o,opensInNewWindow:opensInNewWindow,text:s,noFollow:t,isSponsored:isSponsored})))}}},{key:"setIsSponsored",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({isSponsored:t}),!A(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,N({url:o,opensInNewWindow:opensInNewWindow,text:s,noFollow:noFollow,isSponsored:t})))}}},{key:"editLink",value:function(t){this.setState({editLink:!0}),t.preventDefault()}},{key:"submitLink",value:function(t){var e=this.props,n=e.isActive,o=e.value,r=e.onChange,i=e.speak,s=this.state,a=s.inputValue,c=s.opensInNewWindow,l=s.noFollow,u=s.isSponsored,f=Object(x.prependHTTP)(a),p=N({url:f,opensInNewWindow:c,text:Object(E.getTextContent)(Object(E.slice)(o)),noFollow:l,isSponsored:u});if(t.preventDefault(),Object(E.isCollapsed)(o)&&!n){var d=Object(E.applyFormat)(Object(E.create)({text:f}),p,0,f.length);r(Object(E.insert)(o,d))}else r(Object(E.applyFormat)(o,p));this.resetState(),T(f)?i(n?Object(O.__)("Link edited."):Object(O.__)("Link inserted."),"assertive"):i(Object(O.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}},{key:"onClickOutside",value:function(t){var e=this.autocompleteRef.current;e&&e.contains(t.target)||this.resetState()}},{key:"resetState",value:function(){this.props.stopAddingLink(),this.setState({editLink:!1})}},{key:"render",value:function(){var t=this,e=this.props,n=e.isActive,o=e.activeAttributes.url,r=e.addingLink,i=e.value,s=e.contentRef;if(!n&&!r)return null;var a=this.state,c=a.inputValue,l=a.noFollow,u=a.opensInNewWindow,f=a.isSponsored,p=a.newLinkUrl,d=a.newLinkSlug,h=a.creatingLink,b=a.createdLink,v=a.createdLinkError,g=A(this.props,this.state);return Object(y.createElement)(U,{className:"pretty-link-inserter",value:i,isActive:n,addingLink:r,onClickOutside:this.onClickOutside,onClose:this.resetState,focusOnMount:!!g&&"firstElement",contentRef:s,renderSettings:function(){return Object(y.createElement)(y.Fragment,null,Object(y.createElement)("div",null,Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Open in New Tab"),checked:u,onChange:t.setLinkTarget}),Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Nofollow"),checked:l,onChange:t.setNoFollow}),Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Sponsored Link"),checked:f,onChange:t.setIsSponsored})),Object(y.createElement)("div",{className:"pretty-link-inserter-form-container"},b&&Object(y.createElement)(j.Notice,{status:"success",onRemove:function(){return t.setState({createdLink:!1})}},Object(y.createElement)("p",null,Object(O.__)("Pretty Link created successfully.","memberpress"))),v&&Object(y.createElement)(j.Notice,{status:"error",onRemove:function(){return t.setState({createdLink:!1,createdLinkError:!1})}},Object(y.createElement)("p",null,Object(O.__)("Pretty Link could not be created. Please try a slug that is not already used.","memberpress"))),Object(y.createElement)("strong",null,Object(O.__)("New Pretty Link","pretty-link")),Object(y.createElement)("form",{onSubmit:function(e){e.preventDefault(),t.setState({creatingLink:!0,createdLinkError:!1}),function(t,e){return new Promise(function(n,o){jQuery.post(ajaxurl,{action:"prli_create_pretty_link",target:t,slug:e,redirect:"",nofollow:1,tracking:1,sponsored:0},function(t,e,r){"true"===t?n(t):o(t)}).fail(function(t){o(t)})})}(p,d).then(function(e){t.setState({createdLink:!0,creatingLink:!1,inputValue:plEditor.homeUrl+d,newLinkUrl:"",newLinkSlug:""})}).catch(function(e){t.setState({createdLink:!1,creatingLink:!1,createdLinkError:!0})})}},Object(y.createElement)("p",null,Object(y.createElement)(j.TextControl,{placeholder:"URL",className:"pretty-link-new-link-url",value:p,onChange:function(e){t.setState({newLinkUrl:e})}})),Object(y.createElement)("p",null,Object(y.createElement)(j.TextControl,{placeholder:"Slug",className:"pretty-link-new-link-slug",value:d,onChange:function(e){t.setState({newLinkSlug:e})}})),Object(y.createElement)("p",null,Object(y.createElement)("button",{className:"pretty-link-submit-new-link components-button is-button is-primary",onClick:function(){console.log("Creating new Pretty Link...")}},Object(O.__)("Create New Pretty Link","pretty-link")),h&&Object(y.createElement)(j.Spinner,null)))))}},g?Object(y.createElement)(I,{value:c,onChangeInputValue:this.onChangeInputValue,onKeyDown:this.onKeyDown,submitLink:this.submitLink,autocompleteRef:this.autocompleteRef}):Object(y.createElement)(D,{url:o,editLink:this.editLink}))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n=t.activeAttributes,o=n.url,r=n.target,i=(n.isSponsored,"_blank"===r);if(!A(t,e)){if(o!==e.inputValue)return{inputValue:o};if(i!==e.opensInNewWindow)return{opensInNewWindow:i}}return null}}]),e}(y.Component);e.default=Object(j.withSpokenMessages)(V)},function(t,e){!function(){t.exports=this.wp.apiFetch}()},function(t,e){!function(){t.exports=this.wp.htmlEntities}()},function(t,e){!function(){t.exports=this.regeneratorRuntime}()},function(t,e){!function(){t.exports=this.wp.dom}()},function(t,e){function n(){return t.exports=n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n.apply(this,arguments)}t.exports=n},function(t,e){!function(){t.exports=this.wp.data}()},function(t,e,n){"use strict";t.exports=n(34)},function(t,e){function n(t,e,n,o,r,i,s){try{var a=t[i](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(o,r)}t.exports=function(t){return function(){var e=this,o=arguments;return new Promise(function(r,i){var s=t.apply(e,o);function a(t){n(s,r,i,a,c,"next",t)}function c(t){n(s,r,i,a,c,"throw",t)}a(void 0)})}}},function(t,e,n){"use strict";n.r(e),n.d(e,"prettyLink",function(){return x});var o=n(16),r=n.n(o),i=n(12),s=n.n(i),a=n(11),c=n.n(a),l=n(10),u=n.n(l),f=n(9),p=n.n(f),d=n(4),h=n.n(d),b=n(8),v=n.n(b),g=n(0),m=n(1),y=n(5),w=n(2),k=n(3),O=n(7),j=n(18),S="pretty-link/pretty-link",L=Object(m.__)("Pretty Link"),x={name:S,title:L,tagName:"a",className:"pretty-link",attributes:{url:"href",target:"target"},edit:Object(y.withSpokenMessages)(function(t){function e(){var t;return s()(this,e),(t=u()(this,p()(e).apply(this,arguments))).addLink=t.addLink.bind(h()(t)),t.stopAddingLink=t.stopAddingLink.bind(h()(t)),t.onRemoveFormat=t.onRemoveFormat.bind(h()(t)),t.state={addingLink:!1},t}return v()(e,t),c()(e,[{key:"addLink",value:function(){var t=this.props,e=t.value,n=t.onChange,o=Object(w.getTextContent)(Object(w.slice)(e));o&&Object(k.isURL)(o)?n(Object(w.applyFormat)(e,{type:S,attributes:{url:o}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1})}},{key:"onRemoveFormat",value:function(){var t=this.props,e=t.value,n=t.onChange,o=t.speak;n(Object(w.removeFormat)(e,S)),o(Object(m.__)("Link removed."),"assertive")}},{key:"render",value:function(){var t=this.props,e=t.isActive,n=t.activeAttributes,o=t.value,r=t.onChange,i=t.contentRef;return Object(g.createElement)(g.Fragment,null,Object(g.createElement)(O.RichTextShortcut,{type:"primary",character:"p",onUse:this.addLink}),Object(g.createElement)(O.RichTextShortcut,{type:"primaryShift",character:"p",onUse:this.onRemoveFormat}),e&&Object(g.createElement)(O.RichTextToolbarButton,{icon:"star-filled",title:Object(m.__)("Unlink"),onClick:this.onRemoveFormat,isActive:e,shortcutType:"primaryShift",shortcutCharacter:"p"}),!e&&Object(g.createElement)(O.RichTextToolbarButton,{icon:"star-filled",title:L,onClick:this.addLink,isActive:e,shortcutType:"primary",shortcutCharacter:"p"}),Object(g.createElement)(j.default,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:e,activeAttributes:n,value:o,onChange:r,contentRef:i}))}}]),e}(g.Component))};[x].forEach(function(t){var e=t.name,n=r()(t,["name"]);return Object(w.registerFormatType)(e,n)})},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r,i=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(t,e,n){var o={},r=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),i=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var o=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(t){o=null}e[t]=o}return e[t]}}(),s=null,a=0,c=[],l=n(28);function u(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=o[r.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](r.parts[s]);for(;s<r.parts.length;s++)i.parts.push(v(r.parts[s],e))}else{var a=[];for(s=0;s<r.parts.length;s++)a.push(v(r.parts[s],e));o[r.id]={id:r.id,refs:1,parts:a}}}}function f(t,e){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],s=e.base?i[0]+e.base:i[0],a={css:i[1],media:i[2],sourceMap:i[3]};o[s]?o[s].parts.push(a):n.push(o[s]={id:s,parts:[a]})}return n}function p(t,e){var n=i(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=c[c.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),c.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=i(t.insertAt.before,n);n.insertBefore(e,r)}}function d(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=c.indexOf(t);e>=0&&c.splice(e,1)}function h(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var o=function(){0;return n.nc}();o&&(t.attrs.nonce=o)}return b(e,t.attrs),p(t,e),e}function b(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function v(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var c=a++;n=s||(s=h(e)),o=m.bind(null,n,c,!1),r=m.bind(null,n,c,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),p(t,e),e}(e),o=function(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=l(o));r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var s=new Blob([o],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}.bind(null,n,e),r=function(){d(n),n.href&&URL.revokeObjectURL(n.href)}):(n=h(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){d(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return u(n,e),function(t){for(var r=[],i=0;i<n.length;i++){var s=n[i];(a=o[s.id]).refs--,r.push(a)}t&&u(f(t,e),e);for(i=0;i<r.length;i++){var a;if(0===(a=r[i]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete o[a.id]}}}};var g=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}();function m(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=g(e,r);else{var i=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(i,s[e]):t.appendChild(i)}}},function(t,e){t.exports=".pretty-link-inserter .block-editor-url-popover__settings {\n display: block; }\n\n.pretty-link-inserter .pretty-link-inserter-form-container {\n margin-top: 30px; }\n"},function(t,e,n){var o=n(30);"string"==typeof o&&(o=[[t.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(29)(o,r);o.locals&&(t.exports=o.locals)},function(t,e){t.exports=function(t,e){if(null==t)return{};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)n=i[o],e.indexOf(n)>=0||(r[n]=t[n]);return r}},function(t,e,n){"use strict";var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function i(t,e){var n=t["page"+(e?"Y":"X")+"Offset"],o="scroll"+(e?"Top":"Left");if("number"!=typeof n){var r=t.document;"number"!=typeof(n=r.documentElement[o])&&(n=r.body[o])}return n}function s(t){return i(t)}function a(t){return i(t,!0)}function c(t){var e=function(t){var e,n=void 0,o=void 0,r=t.ownerDocument,i=r.body,s=r&&r.documentElement;return n=(e=t.getBoundingClientRect()).left,o=e.top,{left:n-=s.clientLeft||i.clientLeft||0,top:o-=s.clientTop||i.clientTop||0}}(t),n=t.ownerDocument,o=n.defaultView||n.parentWindow;return e.left+=s(o),e.top+=a(o),e}var l=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),u=/^(top|right|bottom|left)$/,f="currentStyle",p="runtimeStyle",d="left",h="px";var b=void 0;function v(t,e){for(var n=0;n<t.length;n++)e(t[n])}function g(t){return"border-box"===b(t,"boxSizing")}"undefined"!=typeof window&&(b=window.getComputedStyle?function(t,e,n){var o="",r=t.ownerDocument,i=n||r.defaultView.getComputedStyle(t,null);return i&&(o=i.getPropertyValue(e)||i[e]),o}:function(t,e){var n=t[f]&&t[f][e];if(l.test(n)&&!u.test(e)){var o=t.style,r=o[d],i=t[p][d];t[p][d]=t[f][d],o[d]="fontSize"===e?"1em":n||0,n=o.pixelLeft+h,o[d]=r,t[p][d]=i}return""===n?"auto":n});var m=["margin","border","padding"],y=-1,w=2,k=1;function O(t,e,n){var o=0,r=void 0,i=void 0,s=void 0;for(i=0;i<e.length;i++)if(r=e[i])for(s=0;s<n.length;s++){var a=void 0;a="border"===r?r+n[s]+"Width":r+n[s],o+=parseFloat(b(t,a))||0}return o}function j(t){return null!=t&&t==t.window}var S={};function L(t,e,n){if(j(t))return"width"===e?S.viewportWidth(t):S.viewportHeight(t);if(9===t.nodeType)return"width"===e?S.docWidth(t):S.docHeight(t);var o="width"===e?["Left","Right"]:["Top","Bottom"],r="width"===e?t.offsetWidth:t.offsetHeight,i=(b(t),g(t)),s=0;(null==r||r<=0)&&(r=void 0,(null==(s=b(t,e))||Number(s)<0)&&(s=t.style[e]||0),s=parseFloat(s)||0),void 0===n&&(n=i?k:y);var a=void 0!==r||i,c=r||s;if(n===y)return a?c-O(t,["border","padding"],o):s;if(a){var l=n===w?-O(t,["border"],o):O(t,["margin"],o);return c+(n===k?0:l)}return s+O(t,m.slice(n),o)}v(["Width","Height"],function(t){S["doc"+t]=function(e){var n=e.document;return Math.max(n.documentElement["scroll"+t],n.body["scroll"+t],S["viewport"+t](n))},S["viewport"+t]=function(e){var n="client"+t,o=e.document,r=o.body,i=o.documentElement[n];return"CSS1Compat"===o.compatMode&&i||r&&r[n]||i}});var x={position:"absolute",visibility:"hidden",display:"block"};function E(t){var e=void 0,n=arguments;return 0!==t.offsetWidth?e=L.apply(void 0,n):function(t,e,n){var o={},r=t.style,i=void 0;for(i in e)e.hasOwnProperty(i)&&(o[i]=r[i],r[i]=e[i]);for(i in n.call(t),e)e.hasOwnProperty(i)&&(r[i]=o[i])}(t,x,function(){e=L.apply(void 0,n)}),e}function _(t,e,n){var o=n;if("object"!==(void 0===e?"undefined":r(e)))return void 0!==o?("number"==typeof o&&(o+="px"),void(t.style[e]=o)):b(t,e);for(var i in e)e.hasOwnProperty(i)&&_(t,i,e[i])}v(["width","height"],function(t){var e=t.charAt(0).toUpperCase()+t.slice(1);S["outer"+e]=function(e,n){return e&&E(e,t,n?0:k)};var n="width"===t?["Left","Right"]:["Top","Bottom"];S[t]=function(e,o){if(void 0===o)return e&&E(e,t,y);if(e){b(e);return g(e)&&(o+=O(e,["padding","border"],n)),_(e,t,o)}}}),t.exports=o({getWindow:function(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow},offset:function(t,e){if(void 0===e)return c(t);!function(t,e){"static"===_(t,"position")&&(t.style.position="relative");var n=c(t),o={},r=void 0,i=void 0;for(i in e)e.hasOwnProperty(i)&&(r=parseFloat(_(t,i))||0,o[i]=r+e[i]-n[i]);_(t,o)}(t,e)},isWindow:j,each:v,css:_,clone:function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);if(t.overflow)for(var n in t)t.hasOwnProperty(n)&&(e.overflow[n]=t.overflow[n]);return e},scrollLeft:function(t,e){if(j(t)){if(void 0===e)return s(t);window.scrollTo(e,a(t))}else{if(void 0===e)return t.scrollLeft;t.scrollLeft=e}},scrollTop:function(t,e){if(j(t)){if(void 0===e)return a(t);window.scrollTo(s(t),e)}else{if(void 0===e)return t.scrollTop;t.scrollTop=e}},viewportWidth:0,viewportHeight:0},S)},function(t,e,n){"use strict";var o=n(33);t.exports=function(t,e,n){n=n||{},9===e.nodeType&&(e=o.getWindow(e));var r=n.allowHorizontalScroll,i=n.onlyScrollIfNeeded,s=n.alignWithTop,a=n.alignWithLeft,c=n.offsetTop||0,l=n.offsetLeft||0,u=n.offsetBottom||0,f=n.offsetRight||0;r=void 0===r||r;var p=o.isWindow(e),d=o.offset(t),h=o.outerHeight(t),b=o.outerWidth(t),v=void 0,g=void 0,m=void 0,y=void 0,w=void 0,k=void 0,O=void 0,j=void 0,S=void 0,L=void 0;p?(O=e,L=o.height(O),S=o.width(O),j={left:o.scrollLeft(O),top:o.scrollTop(O)},w={left:d.left-j.left-l,top:d.top-j.top-c},k={left:d.left+b-(j.left+S)+f,top:d.top+h-(j.top+L)+u},y=j):(v=o.offset(e),g=e.clientHeight,m=e.clientWidth,y={left:e.scrollLeft,top:e.scrollTop},w={left:d.left-(v.left+(parseFloat(o.css(e,"borderLeftWidth"))||0))-l,top:d.top-(v.top+(parseFloat(o.css(e,"borderTopWidth"))||0))-c},k={left:d.left+b-(v.left+m+(parseFloat(o.css(e,"borderRightWidth"))||0))+f,top:d.top+h-(v.top+g+(parseFloat(o.css(e,"borderBottomWidth"))||0))+u}),w.top<0||k.top>0?!0===s?o.scrollTop(e,y.top+w.top):!1===s?o.scrollTop(e,y.top+k.top):w.top<0?o.scrollTop(e,y.top+w.top):o.scrollTop(e,y.top+k.top):i||((s=void 0===s||!!s)?o.scrollTop(e,y.top+w.top):o.scrollTop(e,y.top+k.top)),r&&(w.left<0||k.left>0?!0===a?o.scrollLeft(e,y.left+w.left):!1===a?o.scrollLeft(e,y.left+k.left):w.left<0?o.scrollLeft(e,y.left+w.left):o.scrollLeft(e,y.left+k.left):i||((a=void 0===a||!!a)?o.scrollLeft(e,y.left+w.left):o.scrollLeft(e,y.left+k.left)))}},function(t,e){function n(e,o){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,o)}t.exports=n},function(t,e){function n(t){return(n="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)}function o(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=o=function(t){return n(t)}:t.exports=o=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},o(e)}t.exports=o},function(t,e,n){"use strict";n.r(e);var o=n(14);n.d(e,"URLInput",function(){return o.default})},function(t,e,n){n(37),n(18),n(14),t.exports=n(27)}]);
|
js/editor/components/link-editor/index.js
CHANGED
@@ -10,7 +10,6 @@ import { __ } from '@wordpress/i18n';
|
|
10 |
import { Component, Fragment, createRef, useMemo } from '@wordpress/element';
|
11 |
import {
|
12 |
ExternalLink,
|
13 |
-
IconButton,
|
14 |
ToggleControl,
|
15 |
Button,
|
16 |
TextControl,
|
@@ -41,6 +40,7 @@ import './style.scss';
|
|
41 |
import { createLinkFormat, isValidHref } from './utils';
|
42 |
|
43 |
const stopKeyPropagation = ( event ) => event.stopPropagation();
|
|
|
44 |
|
45 |
function isShowingInput( props, state ) {
|
46 |
return props.addingLink || state.editLink;
|
@@ -59,8 +59,9 @@ const LinkEditor = ( { value, onChangeInputValue, onKeyDown, submitLink, autocom
|
|
59 |
value={ value }
|
60 |
onChange={ onChangeInputValue }
|
61 |
autocompleteRef={ autocompleteRef }
|
|
|
62 |
/>
|
63 |
-
<
|
64 |
</form>
|
65 |
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
|
66 |
);
|
@@ -85,7 +86,7 @@ const LinkViewerUrl = ( { url } ) => {
|
|
85 |
);
|
86 |
};
|
87 |
|
88 |
-
const URLPopoverAtLink = ( { isActive, addingLink, value, ...props } ) => {
|
89 |
const anchorRect = useMemo( () => {
|
90 |
const selection = window.getSelection();
|
91 |
const range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;
|
@@ -112,11 +113,30 @@ const URLPopoverAtLink = ( { isActive, addingLink, value, ...props } ) => {
|
|
112 |
}
|
113 |
}, [ isActive, addingLink, value.start, value.end ] );
|
114 |
|
115 |
-
if ( ! anchorRect ) {
|
116 |
return null;
|
117 |
}
|
118 |
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
};
|
121 |
|
122 |
const LinkViewer = ( { url, editLink } ) => {
|
@@ -128,7 +148,7 @@ const LinkViewer = ( { url, editLink } ) => {
|
|
128 |
onKeyPress={ stopKeyPropagation }
|
129 |
>
|
130 |
<LinkViewerUrl url={ url } />
|
131 |
-
<
|
132 |
</div>
|
133 |
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
134 |
);
|
@@ -324,7 +344,7 @@ class InlineLinkUI extends Component {
|
|
324 |
}
|
325 |
|
326 |
render() {
|
327 |
-
const { isActive, activeAttributes: { url }, addingLink, value } = this.props;
|
328 |
|
329 |
if ( ! isActive && ! addingLink ) {
|
330 |
return null;
|
@@ -342,6 +362,7 @@ class InlineLinkUI extends Component {
|
|
342 |
onClickOutside={ this.onClickOutside }
|
343 |
onClose={ this.resetState }
|
344 |
focusOnMount={ showInput ? 'firstElement' : false }
|
|
|
345 |
renderSettings={ () => (
|
346 |
<Fragment>
|
347 |
<div>
|
10 |
import { Component, Fragment, createRef, useMemo } from '@wordpress/element';
|
11 |
import {
|
12 |
ExternalLink,
|
|
|
13 |
ToggleControl,
|
14 |
Button,
|
15 |
TextControl,
|
40 |
import { createLinkFormat, isValidHref } from './utils';
|
41 |
|
42 |
const stopKeyPropagation = ( event ) => event.stopPropagation();
|
43 |
+
const { useAnchor } = wp.richText;
|
44 |
|
45 |
function isShowingInput( props, state ) {
|
46 |
return props.addingLink || state.editLink;
|
59 |
value={ value }
|
60 |
onChange={ onChangeInputValue }
|
61 |
autocompleteRef={ autocompleteRef }
|
62 |
+
autoFocus={ false }
|
63 |
/>
|
64 |
+
<Button icon="editor-break" label={ __( 'Insert Pretty Link' ) } type="submit" />
|
65 |
</form>
|
66 |
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
|
67 |
);
|
86 |
);
|
87 |
};
|
88 |
|
89 |
+
const URLPopoverAtLink = ( { isActive, addingLink, value, contentRef, ...props } ) => {
|
90 |
const anchorRect = useMemo( () => {
|
91 |
const selection = window.getSelection();
|
92 |
const range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;
|
113 |
}
|
114 |
}, [ isActive, addingLink, value.start, value.end ] );
|
115 |
|
116 |
+
if ( ! anchorRect && ! useAnchor ) {
|
117 |
return null;
|
118 |
}
|
119 |
|
120 |
+
let anchorProps;
|
121 |
+
|
122 |
+
if ( useAnchor ) {
|
123 |
+
// Prefer useAnchor over useAnchorRef, this is WP 6.1+ only
|
124 |
+
anchorProps = {
|
125 |
+
anchor: useAnchor( {
|
126 |
+
editableContentElement: contentRef.current,
|
127 |
+
value,
|
128 |
+
settings: {
|
129 |
+
tagName: 'a'
|
130 |
+
},
|
131 |
+
} )
|
132 |
+
};
|
133 |
+
} else {
|
134 |
+
anchorProps = {
|
135 |
+
anchorRect: anchorRect,
|
136 |
+
};
|
137 |
+
}
|
138 |
+
|
139 |
+
return <URLPopover { ...anchorProps } { ...props } />;
|
140 |
};
|
141 |
|
142 |
const LinkViewer = ( { url, editLink } ) => {
|
148 |
onKeyPress={ stopKeyPropagation }
|
149 |
>
|
150 |
<LinkViewerUrl url={ url } />
|
151 |
+
<Button icon="edit" label={ __( 'Edit' ) } onClick={ editLink } />
|
152 |
</div>
|
153 |
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
154 |
);
|
344 |
}
|
345 |
|
346 |
render() {
|
347 |
+
const { isActive, activeAttributes: { url }, addingLink, value, contentRef } = this.props;
|
348 |
|
349 |
if ( ! isActive && ! addingLink ) {
|
350 |
return null;
|
362 |
onClickOutside={ this.onClickOutside }
|
363 |
onClose={ this.resetState }
|
364 |
focusOnMount={ showInput ? 'firstElement' : false }
|
365 |
+
contentRef={ contentRef }
|
366 |
renderSettings={ () => (
|
367 |
<Fragment>
|
368 |
<div>
|
js/editor/formats/pretty-link/index.js
CHANGED
@@ -71,7 +71,7 @@ export const prettyLink = {
|
|
71 |
}
|
72 |
|
73 |
render() {
|
74 |
-
const { isActive, activeAttributes, value, onChange } = this.props;
|
75 |
|
76 |
return (
|
77 |
<>
|
@@ -112,6 +112,7 @@ export const prettyLink = {
|
|
112 |
activeAttributes={activeAttributes}
|
113 |
value={value}
|
114 |
onChange={onChange}
|
|
|
115 |
/>
|
116 |
</>
|
117 |
);
|
71 |
}
|
72 |
|
73 |
render() {
|
74 |
+
const { isActive, activeAttributes, value, onChange, contentRef } = this.props;
|
75 |
|
76 |
return (
|
77 |
<>
|
112 |
activeAttributes={activeAttributes}
|
113 |
value={value}
|
114 |
onChange={onChange}
|
115 |
+
contentRef={contentRef}
|
116 |
/>
|
117 |
</>
|
118 |
);
|
pretty-link.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Pretty Links
|
4 |
Plugin URI: https://prettylinks.com/pl/plugin-uri
|
5 |
Description: Shrink, track and share any URL using your website and brand!
|
6 |
-
Version: 3.2.
|
7 |
Author: Pretty Links
|
8 |
Author URI: http://prettylinks.com
|
9 |
Text Domain: pretty-link
|
3 |
Plugin Name: Pretty Links
|
4 |
Plugin URI: https://prettylinks.com/pl/plugin-uri
|
5 |
Description: Shrink, track and share any URL using your website and brand!
|
6 |
+
Version: 3.2.8
|
7 |
Author: Pretty Links
|
8 |
Author URI: http://prettylinks.com
|
9 |
Text Domain: pretty-link
|
readme.txt
CHANGED
@@ -3,20 +3,20 @@ Contributors: supercleanse, cartpauj
|
|
3 |
Donate link: https://prettylinks.com
|
4 |
Tags: affiliate links, link branding, link shortner, link tracking, redirects, affiliate, affiliate marketing, affiliates, short links, shorten, shortening, shortlink, shortlinks, shorturl, shrinking, marketing, marketing plugin, cloak, cloaker, cloaking, 301, 302, 307, 404, bit.ly, bitly, tinyurl, link cloaking, link redirection, link shortener, links, pretty links, url redirection, url shortener, urls, seo, slug, slugs
|
5 |
Requires at least: 5.1
|
6 |
-
Tested up to: 6.
|
7 |
-
Stable tag: 3.2.
|
8 |
|
9 |
-
The best WordPress link management, branding, tracking & sharing plugin.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
Pretty Links helps you shrink, beautify, track, manage and share any URL on or off of your WordPress website. Create links that look how you want using your own domain name!
|
14 |
|
15 |
-
|
16 |
|
17 |
-
Pretty Links enables you to shorten links using your own domain name (as opposed to using tinyurl.com, bit.ly, or any other link shrinking service)! In addition to creating clean links, Pretty Links tracks each hit on your URL and provides a full, detailed report of where the hit came from, the browser,
|
18 |
|
19 |
-
|
20 |
|
21 |
This is a link setup using Pretty Links that redirects to the Pretty Links Homepage where you can find more info about this Plugin:
|
22 |
|
@@ -30,32 +30,69 @@ Here's a link that Pretty Links generated a random slug for (similar to what bit
|
|
30 |
|
31 |
http://blairwilliams.com/w7a
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
* Tracks the Number of Clicks per link
|
38 |
-
* Tracks the Number of Unique Clicks per link
|
39 |
-
* Provides a reporting interface where you can see a configurable chart of clicks per day. This report can be filtered by the specific link clicked, date range, and/or unique clicks.
|
40 |
-
* View click details including ip address, remote host, browser (including browser version), operating system, and referring site
|
41 |
-
* Download hit details in CSV format
|
42 |
-
* Intuitive Javascript / AJAX Admin User Interface
|
43 |
-
* Pass custom parameters to your scripts through pretty link and still have full tracking ability
|
44 |
-
* Exclude IP Addresses from Stats
|
45 |
-
* Enables you to send your pretty links via Email directly from your WordPress admin
|
46 |
-
* Select Temporary (302 or 307) or Permanent (301) redirection for your pretty links
|
47 |
-
* Cookie based system for tracking visitor activity across clicks
|
48 |
-
* Create nofollow/noindex links
|
49 |
-
* Turn tracking on / off on each link
|
50 |
-
* Pretty Links Bookmarklet
|
51 |
|
52 |
-
|
|
|
53 |
|
54 |
-
[
|
|
|
55 |
|
56 |
-
|
|
|
57 |
|
58 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
== Installation ==
|
61 |
|
@@ -65,7 +102,36 @@ http://blairwilliams.com/w7a
|
|
65 |
|
66 |
3. Make sure you have changed your permalink Common Settings in Settings -> Permalinks away from "Default" to something else. I prefer using custom and then "/%year%/%month%/%postname%/" for the simplest possible URL slugs with the best performance.
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
= 3.2.7 =
|
70 |
* Fix index replacements
|
71 |
|
@@ -174,4 +240,3 @@ http://blairwilliams.com/w7a
|
|
174 |
* PRO ONLY: Added Pretty Link Tags
|
175 |
* PRO ONLY: Fixed some issues with Pretty Link Imports and Exports
|
176 |
* Many other small fixes and enhancements
|
177 |
-
|
3 |
Donate link: https://prettylinks.com
|
4 |
Tags: affiliate links, link branding, link shortner, link tracking, redirects, affiliate, affiliate marketing, affiliates, short links, shorten, shortening, shortlink, shortlinks, shorturl, shrinking, marketing, marketing plugin, cloak, cloaker, cloaking, 301, 302, 307, 404, bit.ly, bitly, tinyurl, link cloaking, link redirection, link shortener, links, pretty links, url redirection, url shortener, urls, seo, slug, slugs
|
5 |
Requires at least: 5.1
|
6 |
+
Tested up to: 6.1.1
|
7 |
+
Stable tag: 3.2.8
|
8 |
|
9 |
+
🌠 The best WordPress link management, branding, tracking & sharing plugin. Easily make pretty & trackable shortlinks. 🔗
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
Pretty Links helps you shrink, beautify, track, manage and share any URL on or off of your WordPress website. Create links that look how you want using your own domain name!
|
14 |
|
15 |
+
## Pretty Links 🌠
|
16 |
|
17 |
+
Pretty Links enables you to shorten links using your own domain name (as opposed to using tinyurl.com, bit.ly, or any other link shrinking service)! In addition to creating clean links, Pretty Links tracks each hit on your URL and provides a full, detailed report of where the hit came from, the browser, OS, and host. Pretty Links is a killer plugin for people who want to clean up their affiliate links, track clicks from emails, their links on Twitter to come from their own domain, or generally increase the reach of their website by spreading these links on forums or comments on other blogs.
|
18 |
|
19 |
+
## Examples 👇
|
20 |
|
21 |
This is a link setup using Pretty Links that redirects to the Pretty Links Homepage where you can find more info about this Plugin:
|
22 |
|
30 |
|
31 |
http://blairwilliams.com/w7a
|
32 |
|
33 |
+
## Features ✔️
|
34 |
|
35 |
+
**[🔗 Create clean, simple URLs that redirect to any other URL](https://prettylinks.com/about#pl-link-setup?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=features)**
|
36 |
+
Easily turn your long URLs into short ones within a matter of seconds.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
**[🔃 Supports 301, 302, and 307 redirects](https://prettylinks.com/about#pl-redirect-types?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=features)**
|
39 |
+
Redirect users using one of our three redirect types: 301 (Permanent), 302 (Temporary), and 307 (Temporary).
|
40 |
|
41 |
+
**[🖱️ One-Click Link Sharing](https://prettylinks.com/about#pl-dashboard?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=features)**
|
42 |
+
Copy and manage your pretty links all in one centralized area.
|
43 |
|
44 |
+
**[⚙️ Fully configurable slugs](https://prettylinks.com/about#pl-link-setup?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=features)**
|
45 |
+
Pretty Links will automatically generate 3-4 random characters to use as the slug, but you can also create your own slug to use for your URL.
|
46 |
|
47 |
+
**[🔎 Track the Number of Clicks and Unique Clicks per link](https://prettylinks.com/about#pl-dashboard?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=features)**
|
48 |
+
Track how well your pretty links are performing by viewing the number of overall clicks and unique clicks on your links.
|
49 |
+
|
50 |
+
**[📊 Generate Highly Customizable Reports](https://prettylinks.com/about#pl-dashboard?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=features)**
|
51 |
+
Create reports where you can see a configurable chart of clicks per day. The report can be filtered by the specific link clicked, date range, and/or unique clicks.
|
52 |
+
|
53 |
+
**[💡 Extremely Intuitive Admin User Interface](https://prettylinks.com/about#pl-dashboard?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=features)**
|
54 |
+
No need to guess where everything is located. Pretty Links makes the setup and link management process as simple as possible.
|
55 |
+
|
56 |
+
**[⬇️ Download Click Details](https://prettylinks.com/about#pl-dashboard?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=features)**
|
57 |
+
Need to download click data for your links? Pretty Links has you covered. The plugin will generate a CSV containing all the information you need to successfully manage your links.
|
58 |
+
|
59 |
+
... and so much more! [Visit our site](https://prettylinks.com?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=home) to learn more about what Pretty Links can do for you.
|
60 |
+
|
61 |
+
## Pretty Links Pro 💪
|
62 |
+
|
63 |
+
*Pretty Links Pro* is a **significant upgrade** that adds many tools and redirection types. Here's a glimpse at some of the different features that Pretty Links Pro offers:
|
64 |
+
|
65 |
+
* [**Keyword & URL Replacements**](https://prettylinks.com/features?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=pro_features)
|
66 |
+
Using one of Pretty Link's automation features, you can define a list of keywords and URLs, then Pretty Links will automatically scan your site's content and replace them with your pretty link.
|
67 |
+
|
68 |
+
* [**Advanced Redirect Types**](https://prettylinks.com/features?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=pro_features)
|
69 |
+
Take full control over how your users are redirected. With the Pro version, you can now offer Cloaked redirects, Pretty Bar redirects, JavaScript redirects, Meta-Refresh redirects, Tracking Pixel redirects, and Geographic redirects.
|
70 |
+
|
71 |
+
* [**Automatically Create Pretty Links for Posts/Pages**](https://prettylinks.com/features?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=pro_features)
|
72 |
+
Another one of Pretty Link's powerful automation features. Whenever a new page or post is published, Pretty Links will automatically create a pretty link for it.
|
73 |
+
|
74 |
+
* [**Link Categories & Tags**](https://prettylinks.com/features?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=pro_features)
|
75 |
+
Make link management easier by grouping your links together and assigning them a category or tag.
|
76 |
+
|
77 |
+
* [**Expiring Links**](https://prettylinks.com/features?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=pro_features)
|
78 |
+
Set an expiration date on your links and decide where the user is redirected to after clicking an expired link.
|
79 |
+
|
80 |
+
You can learn more about *Pretty Links Pro* here:
|
81 |
+
|
82 |
+
[Learn More](https://prettylinks.com/why-upgrade?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=pro "Learn More") | [Pricing](https://prettylinks.com/pricing/plans?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=pro "Pricing")
|
83 |
+
|
84 |
+
## Integrations ⚡
|
85 |
+
* [Google Analytics](https://prettylinks.com/docs/integrating-google-analytics?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=kb) - Easily start tracking your links within Google Analytics
|
86 |
+
* [MonsterInsights](https://prettylinks.com/docs/integrating-pretty-links-with-monsterinsights?utm_source=wordpress.org&utm_medium=lite_plugin_listing&utm_content=kb) - See how well your links are performing with the MonsterInsights plugin
|
87 |
+
|
88 |
+
## What's Next 🤩
|
89 |
+
Enjoying your time with Pretty Links? Consider checking out some of our other projects:
|
90 |
+
|
91 |
+
* [MemberPress](https://memberpress.com/) - Full-featured Membership solution for WordPress. Control who has access to your site and sell content securely through payment gateways such as Stripe, PayPal, and Authorize.net
|
92 |
+
* [EasyAffiliate](https://easyaffiliate.com/) - Complete Affiliate Program management plugin for WordPress. Start an Affiliate Program to dramatically increase traffic, attention, and sales.
|
93 |
+
* [ThirstyAffiliates](https://thirstyaffiliates.com/) - Link cloaking plugin made specifically for affiliate bloggers to start making money.
|
94 |
+
* [Buy Now Plus](https://buynowplus.com/) - Easily start accepting Credit Card payments through a simple buy now button on your website or social media accounts using the Stripe gateway.
|
95 |
+
* [Members](https://members-plugin.com/) - Roles and capabilities management plugin for your WordPress site. This is an excellent plugin to use alongside a Membership solution such as MemberPress.
|
96 |
|
97 |
== Installation ==
|
98 |
|
102 |
|
103 |
3. Make sure you have changed your permalink Common Settings in Settings -> Permalinks away from "Default" to something else. I prefer using custom and then "/%year%/%month%/%postname%/" for the simplest possible URL slugs with the best performance.
|
104 |
|
105 |
+
== Frequently Asked Questions ==
|
106 |
+
= Who will find Pretty Links useful? =
|
107 |
+
Pretty Links is particularly useful to affiliate marketers. It helps them to clean up, brand, group, organize, and track their links. In addition to affiliate marketing, Pretty Links is also useful to bloggers, podcasters, merchants, social media marketers, and anyone else who wants to easily take control of their link strategy.
|
108 |
+
|
109 |
+
= Can I use Pretty Links with any WordPress theme? =
|
110 |
+
Absolutely! Pretty Links operates mainly in the WordPress admin, but the front end features should be totally compatible with any WordPress theme.
|
111 |
+
|
112 |
+
= How do I get started with Pretty Links? =
|
113 |
+
Getting started with Pretty Links is incredibly easy. Everything you need to know you can find on our [Getting Started page](https://prettylinks.com/helpdesk_category/getting-started/).
|
114 |
+
|
115 |
+
= Is Pretty Links Translatable? =
|
116 |
+
Yes! Pretty Links is ready for translation. See our [Translating Pretty Links](https://prettylinks.com/docs/translating-pretty-link-pro/) documentation for more information on how you can translate the plugin into your language.
|
117 |
+
|
118 |
+
= What are the differences in redirect types? =
|
119 |
+
301 (Permanent) redirects are used to tell search engines that a requested URL has been permanently moved to another URL. If you're confident that your target URL will never change, then use this redirect type. 302 and 307 (Temporary) redirects tell search engines that the requested URL has been moved temporarily, but will be back eventually.
|
120 |
+
|
121 |
+
== Screenshots ==
|
122 |
+
1. Setting up a Pretty Link
|
123 |
+
2. Settings Page
|
124 |
+
3. Pretty Links Listing
|
125 |
+
4. Click Tracking
|
126 |
+
|
127 |
== Changelog ==
|
128 |
+
= 3.2.8 =
|
129 |
+
* Update readme.txt
|
130 |
+
* Fix JS error on options page
|
131 |
+
* Set cookie using secure attribute when accessed via secure connection
|
132 |
+
* Fix PL Link Inserter jumping to bottom of page on WP 6.1
|
133 |
+
* Fix Gutenberg deprecation notices
|
134 |
+
|
135 |
= 3.2.7 =
|
136 |
* Fix index replacements
|
137 |
|
240 |
* PRO ONLY: Added Pretty Link Tags
|
241 |
* PRO ONLY: Fixed some issues with Pretty Link Imports and Exports
|
242 |
* Many other small fixes and enhancements
|
|