first commit

This commit is contained in:
CHIEFSOFT\ameye
2023-11-30 13:20:54 -05:00
commit e9e5c0546c
5833 changed files with 1801865 additions and 0 deletions
@@ -0,0 +1,6 @@
!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=3)}([function(e,t,n){var r;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var u=o.apply(null,r);u&&e.push(u)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}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){!function(e){"use strict";function t(e,t,n,r){var o,i=!1,u=0;function a(){o&&clearTimeout(o)}function c(){for(var c=arguments.length,l=new Array(c),f=0;f<c;f++)l[f]=arguments[f];var p=this,s=Date.now()-u;function b(){u=Date.now(),n.apply(p,l)}function d(){o=void 0}i||(r&&!o&&b(),a(),void 0===r&&s>e?b():!0!==t&&(o=setTimeout(r?d:b,void 0===r?e-s:e)))}return"boolean"!=typeof t&&(r=n,n=t,t=void 0),c.cancel=function(){a(),i=!0},c}e.debounce=function(e,n,r){return void 0===r?t(e,n,!1):t(e,r,!1!==n)},e.throttle=t,Object.defineProperty(e,"__esModule",{value:!0})}(t)},,function(e,t,n){e.exports=n(7)},,,,function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(1);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?s(e):t}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=wp.i18n.__,y=wp.element,m=y.Component,v=y.Fragment,h=wp.components,w=h.Placeholder,O=h.Disabled,j=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(p,e);var t,n,r,u=f(p);function p(){var e;return a(this,p),(e=u.apply(this,arguments)).state={pinApi:!1},e.maybeFindGlobalPinObj=e.maybeFindGlobalPinObj.bind(s(e)),e.maybeInit=Object(i.debounce)(300,e.maybeInit.bind(s(e))),e}return t=p,(n=[{key:"componentDidMount",value:function(){this.maybeInit()}},{key:"componentDidUpdate",value:function(){this.maybeInit()}},{key:"maybeFindGlobalPinObj",value:function(){var e=this;Object.keys(window).forEach((function(t){/^PIN_\d+$/.test(t)&&window[t].f&&window[t].f.build&&e.setState({pinApi:t})}))}},{key:"maybeInit",value:function(){this.state.pinApi?window[this.state.pinApi].f.build():this.maybeFindGlobalPinObj()}},{key:"render",value:function(){var e=this.props.className,t=this.props.attributes,n=t.href,r=t.canvasClassName;return e=o()("pinterest-board-wrapper pk-block-pinterest-board",r,e),wp.element.createElement(v,null,n?wp.element.createElement(O,null,wp.element.createElement("div",{className:e,key:"pin-board-".concat(n)},wp.element.createElement("a",{"data-pin-do":"embedBoard","data-pin-board-width":"100%",href:n}))):wp.element.createElement(w,null,d("Please, enter Pinterest Board URL.")))}}])&&c(t.prototype,n),r&&c(t,r),p}(m);(0,wp.hooks.addFilter)("canvas.customBlock.editRender","canvas/pinterest-board/editRender",(function(e,t){return"canvas/pinterest-board"===t.name?wp.element.createElement(j,t):e}))}]);
@@ -0,0 +1,31 @@
/**
* WordPress dependencies
*/
const {
addFilter,
} = wp.hooks;
/**
* Internal dependencies
*/
import PinterestBoardBlockEdit from './edit.jsx';
/**
* Custom block Edit output for PinterestBoard block.
*
* @param {JSX} edit Original block edit.
* @param {Object} blockProps Block data.
*
* @return {JSX} Block edit.
*/
function editRender( edit, blockProps ) {
if ( 'canvas/pinterest-board' === blockProps.name ) {
return (
<PinterestBoardBlockEdit { ...blockProps } />
);
}
return edit;
}
addFilter( 'canvas.customBlock.editRender', 'canvas/pinterest-board/editRender', editRender );
@@ -0,0 +1,106 @@
/**
* External dependencies
*/
import classnames from 'classnames';
import { debounce } from 'throttle-debounce';
/**
* WordPress dependencies
*/
const { __ } = wp.i18n;
const {
Component,
Fragment,
} = wp.element;
const {
Placeholder,
Disabled,
} = wp.components;
/**
* Component
*/
export default class PinterestBoardBlockEdit extends Component {
constructor() {
super( ...arguments );
this.state = {
pinApi: false,
};
this.maybeFindGlobalPinObj = this.maybeFindGlobalPinObj.bind( this );
this.maybeInit = debounce( 300, this.maybeInit.bind( this ) );
}
componentDidMount() {
this.maybeInit();
}
componentDidUpdate() {
this.maybeInit();
}
/**
* Try to find global Pinterest object.
*/
maybeFindGlobalPinObj() {
Object.keys( window ).forEach( ( k ) => {
if ( /^PIN_\d+$/.test( k ) && window[ k ].f && window[ k ].f.build ) {
this.setState( {
pinApi: k,
} );
}
} );
}
maybeInit() {
if ( ! this.state.pinApi ) {
this.maybeFindGlobalPinObj();
return;
}
window[ this.state.pinApi ].f.build();
}
render() {
let {
className,
} = this.props;
const {
href,
canvasClassName,
} = this.props.attributes;
className = classnames(
'pinterest-board-wrapper pk-block-pinterest-board',
canvasClassName,
className
);
return (
<Fragment>
{ href ? (
<Disabled>
<div
className={ className }
key={ `pin-board-${ href }` }
>
<a
data-pin-do="embedBoard"
data-pin-board-width="100%"
href={ href }
/>
</div>
</Disabled>
) : (
<Placeholder>
{ __( 'Please, enter Pinterest Board URL.' ) }
</Placeholder>
) }
</Fragment>
);
}
}
@@ -0,0 +1,21 @@
<?php
/**
* Pinterest Board block template
*
* @var $attributes - block attributes
* @var $options - layout options
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package PowerKit
* @subpackage PowerKit/templates
*/
$attributes['className'] .= ' pinterest-board-wrapper';
?>
<div class="<?php echo esc_attr( $attributes[ 'className' ] ); ?>" <?php echo ( isset( $attributes[ 'anchor' ] ) ? ' id="' . esc_attr( $attributes[ 'anchor' ] ) . '"' : '' ); ?>>
<a href="<?php echo esc_url( $attributes['href'] ); ?>" data-pin-do="embedBoard" data-pin-board-width="100%"></a>
</div>