Edit File by line
/home/zeestwma/richards.../wp-inclu.../js/dist
File: plugins.js
/******/ (() => { // webpackBootstrap
[0] Fix | Delete
/******/ "use strict";
[1] Fix | Delete
/******/ // The require scope
[2] Fix | Delete
/******/ var __webpack_require__ = {};
[3] Fix | Delete
/******/
[4] Fix | Delete
/************************************************************************/
[5] Fix | Delete
/******/ /* webpack/runtime/compat get default export */
[6] Fix | Delete
/******/ (() => {
[7] Fix | Delete
/******/ // getDefaultExport function for compatibility with non-harmony modules
[8] Fix | Delete
/******/ __webpack_require__.n = (module) => {
[9] Fix | Delete
/******/ var getter = module && module.__esModule ?
[10] Fix | Delete
/******/ () => (module['default']) :
[11] Fix | Delete
/******/ () => (module);
[12] Fix | Delete
/******/ __webpack_require__.d(getter, { a: getter });
[13] Fix | Delete
/******/ return getter;
[14] Fix | Delete
/******/ };
[15] Fix | Delete
/******/ })();
[16] Fix | Delete
/******/
[17] Fix | Delete
/******/ /* webpack/runtime/define property getters */
[18] Fix | Delete
/******/ (() => {
[19] Fix | Delete
/******/ // define getter functions for harmony exports
[20] Fix | Delete
/******/ __webpack_require__.d = (exports, definition) => {
[21] Fix | Delete
/******/ for(var key in definition) {
[22] Fix | Delete
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
[23] Fix | Delete
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
[24] Fix | Delete
/******/ }
[25] Fix | Delete
/******/ }
[26] Fix | Delete
/******/ };
[27] Fix | Delete
/******/ })();
[28] Fix | Delete
/******/
[29] Fix | Delete
/******/ /* webpack/runtime/hasOwnProperty shorthand */
[30] Fix | Delete
/******/ (() => {
[31] Fix | Delete
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
[32] Fix | Delete
/******/ })();
[33] Fix | Delete
/******/
[34] Fix | Delete
/******/ /* webpack/runtime/make namespace object */
[35] Fix | Delete
/******/ (() => {
[36] Fix | Delete
/******/ // define __esModule on exports
[37] Fix | Delete
/******/ __webpack_require__.r = (exports) => {
[38] Fix | Delete
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
[39] Fix | Delete
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
[40] Fix | Delete
/******/ }
[41] Fix | Delete
/******/ Object.defineProperty(exports, '__esModule', { value: true });
[42] Fix | Delete
/******/ };
[43] Fix | Delete
/******/ })();
[44] Fix | Delete
/******/
[45] Fix | Delete
/************************************************************************/
[46] Fix | Delete
var __webpack_exports__ = {};
[47] Fix | Delete
// ESM COMPAT FLAG
[48] Fix | Delete
__webpack_require__.r(__webpack_exports__);
[49] Fix | Delete
[50] Fix | Delete
// EXPORTS
[51] Fix | Delete
__webpack_require__.d(__webpack_exports__, {
[52] Fix | Delete
PluginArea: () => (/* reexport */ plugin_area),
[53] Fix | Delete
getPlugin: () => (/* reexport */ getPlugin),
[54] Fix | Delete
getPlugins: () => (/* reexport */ getPlugins),
[55] Fix | Delete
registerPlugin: () => (/* reexport */ registerPlugin),
[56] Fix | Delete
unregisterPlugin: () => (/* reexport */ unregisterPlugin),
[57] Fix | Delete
usePluginContext: () => (/* reexport */ usePluginContext),
[58] Fix | Delete
withPluginContext: () => (/* reexport */ withPluginContext)
[59] Fix | Delete
});
[60] Fix | Delete
[61] Fix | Delete
;// ./node_modules/memize/dist/index.js
[62] Fix | Delete
/**
[63] Fix | Delete
* Memize options object.
[64] Fix | Delete
*
[65] Fix | Delete
* @typedef MemizeOptions
[66] Fix | Delete
*
[67] Fix | Delete
* @property {number} [maxSize] Maximum size of the cache.
[68] Fix | Delete
*/
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* Internal cache entry.
[72] Fix | Delete
*
[73] Fix | Delete
* @typedef MemizeCacheNode
[74] Fix | Delete
*
[75] Fix | Delete
* @property {?MemizeCacheNode|undefined} [prev] Previous node.
[76] Fix | Delete
* @property {?MemizeCacheNode|undefined} [next] Next node.
[77] Fix | Delete
* @property {Array<*>} args Function arguments for cache
[78] Fix | Delete
* entry.
[79] Fix | Delete
* @property {*} val Function result.
[80] Fix | Delete
*/
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* Properties of the enhanced function for controlling cache.
[84] Fix | Delete
*
[85] Fix | Delete
* @typedef MemizeMemoizedFunction
[86] Fix | Delete
*
[87] Fix | Delete
* @property {()=>void} clear Clear the cache.
[88] Fix | Delete
*/
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* Accepts a function to be memoized, and returns a new memoized function, with
[92] Fix | Delete
* optional options.
[93] Fix | Delete
*
[94] Fix | Delete
* @template {(...args: any[]) => any} F
[95] Fix | Delete
*
[96] Fix | Delete
* @param {F} fn Function to memoize.
[97] Fix | Delete
* @param {MemizeOptions} [options] Options object.
[98] Fix | Delete
*
[99] Fix | Delete
* @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
[100] Fix | Delete
*/
[101] Fix | Delete
function memize(fn, options) {
[102] Fix | Delete
var size = 0;
[103] Fix | Delete
[104] Fix | Delete
/** @type {?MemizeCacheNode|undefined} */
[105] Fix | Delete
var head;
[106] Fix | Delete
[107] Fix | Delete
/** @type {?MemizeCacheNode|undefined} */
[108] Fix | Delete
var tail;
[109] Fix | Delete
[110] Fix | Delete
options = options || {};
[111] Fix | Delete
[112] Fix | Delete
function memoized(/* ...args */) {
[113] Fix | Delete
var node = head,
[114] Fix | Delete
len = arguments.length,
[115] Fix | Delete
args,
[116] Fix | Delete
i;
[117] Fix | Delete
[118] Fix | Delete
searchCache: while (node) {
[119] Fix | Delete
// Perform a shallow equality test to confirm that whether the node
[120] Fix | Delete
// under test is a candidate for the arguments passed. Two arrays
[121] Fix | Delete
// are shallowly equal if their length matches and each entry is
[122] Fix | Delete
// strictly equal between the two sets. Avoid abstracting to a
[123] Fix | Delete
// function which could incur an arguments leaking deoptimization.
[124] Fix | Delete
[125] Fix | Delete
// Check whether node arguments match arguments length
[126] Fix | Delete
if (node.args.length !== arguments.length) {
[127] Fix | Delete
node = node.next;
[128] Fix | Delete
continue;
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
// Check whether node arguments match arguments values
[132] Fix | Delete
for (i = 0; i < len; i++) {
[133] Fix | Delete
if (node.args[i] !== arguments[i]) {
[134] Fix | Delete
node = node.next;
[135] Fix | Delete
continue searchCache;
[136] Fix | Delete
}
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
// At this point we can assume we've found a match
[140] Fix | Delete
[141] Fix | Delete
// Surface matched node to head if not already
[142] Fix | Delete
if (node !== head) {
[143] Fix | Delete
// As tail, shift to previous. Must only shift if not also
[144] Fix | Delete
// head, since if both head and tail, there is no previous.
[145] Fix | Delete
if (node === tail) {
[146] Fix | Delete
tail = node.prev;
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
// Adjust siblings to point to each other. If node was tail,
[150] Fix | Delete
// this also handles new tail's empty `next` assignment.
[151] Fix | Delete
/** @type {MemizeCacheNode} */ (node.prev).next = node.next;
[152] Fix | Delete
if (node.next) {
[153] Fix | Delete
node.next.prev = node.prev;
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
node.next = head;
[157] Fix | Delete
node.prev = null;
[158] Fix | Delete
/** @type {MemizeCacheNode} */ (head).prev = node;
[159] Fix | Delete
head = node;
[160] Fix | Delete
}
[161] Fix | Delete
[162] Fix | Delete
// Return immediately
[163] Fix | Delete
return node.val;
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
// No cached value found. Continue to insertion phase:
[167] Fix | Delete
[168] Fix | Delete
// Create a copy of arguments (avoid leaking deoptimization)
[169] Fix | Delete
args = new Array(len);
[170] Fix | Delete
for (i = 0; i < len; i++) {
[171] Fix | Delete
args[i] = arguments[i];
[172] Fix | Delete
}
[173] Fix | Delete
[174] Fix | Delete
node = {
[175] Fix | Delete
args: args,
[176] Fix | Delete
[177] Fix | Delete
// Generate the result from original function
[178] Fix | Delete
val: fn.apply(null, args),
[179] Fix | Delete
};
[180] Fix | Delete
[181] Fix | Delete
// Don't need to check whether node is already head, since it would
[182] Fix | Delete
// have been returned above already if it was
[183] Fix | Delete
[184] Fix | Delete
// Shift existing head down list
[185] Fix | Delete
if (head) {
[186] Fix | Delete
head.prev = node;
[187] Fix | Delete
node.next = head;
[188] Fix | Delete
} else {
[189] Fix | Delete
// If no head, follows that there's no tail (at initial or reset)
[190] Fix | Delete
tail = node;
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
// Trim tail if we're reached max size and are pending cache insertion
[194] Fix | Delete
if (size === /** @type {MemizeOptions} */ (options).maxSize) {
[195] Fix | Delete
tail = /** @type {MemizeCacheNode} */ (tail).prev;
[196] Fix | Delete
/** @type {MemizeCacheNode} */ (tail).next = null;
[197] Fix | Delete
} else {
[198] Fix | Delete
size++;
[199] Fix | Delete
}
[200] Fix | Delete
[201] Fix | Delete
head = node;
[202] Fix | Delete
[203] Fix | Delete
return node.val;
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
memoized.clear = function () {
[207] Fix | Delete
head = null;
[208] Fix | Delete
tail = null;
[209] Fix | Delete
size = 0;
[210] Fix | Delete
};
[211] Fix | Delete
[212] Fix | Delete
// Ignore reason: There's not a clear solution to create an intersection of
[213] Fix | Delete
// the function with additional properties, where the goal is to retain the
[214] Fix | Delete
// function signature of the incoming argument and add control properties
[215] Fix | Delete
// on the return value.
[216] Fix | Delete
[217] Fix | Delete
// @ts-ignore
[218] Fix | Delete
return memoized;
[219] Fix | Delete
}
[220] Fix | Delete
[221] Fix | Delete
[222] Fix | Delete
[223] Fix | Delete
;// external ["wp","element"]
[224] Fix | Delete
const external_wp_element_namespaceObject = window["wp"]["element"];
[225] Fix | Delete
;// external ["wp","hooks"]
[226] Fix | Delete
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
[227] Fix | Delete
;// external ["wp","isShallowEqual"]
[228] Fix | Delete
const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
[229] Fix | Delete
var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
[230] Fix | Delete
;// external ["wp","compose"]
[231] Fix | Delete
const external_wp_compose_namespaceObject = window["wp"]["compose"];
[232] Fix | Delete
;// external ["wp","deprecated"]
[233] Fix | Delete
const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
[234] Fix | Delete
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
[235] Fix | Delete
;// external "ReactJSXRuntime"
[236] Fix | Delete
const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
[237] Fix | Delete
;// ./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js
[238] Fix | Delete
/**
[239] Fix | Delete
* WordPress dependencies
[240] Fix | Delete
*/
[241] Fix | Delete
[242] Fix | Delete
[243] Fix | Delete
[244] Fix | Delete
[245] Fix | Delete
/**
[246] Fix | Delete
* Internal dependencies
[247] Fix | Delete
*/
[248] Fix | Delete
[249] Fix | Delete
const Context = (0,external_wp_element_namespaceObject.createContext)({
[250] Fix | Delete
name: null,
[251] Fix | Delete
icon: null
[252] Fix | Delete
});
[253] Fix | Delete
const PluginContextProvider = Context.Provider;
[254] Fix | Delete
[255] Fix | Delete
/**
[256] Fix | Delete
* A hook that returns the plugin context.
[257] Fix | Delete
*
[258] Fix | Delete
* @return {PluginContext} Plugin context
[259] Fix | Delete
*/
[260] Fix | Delete
function usePluginContext() {
[261] Fix | Delete
return (0,external_wp_element_namespaceObject.useContext)(Context);
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
/**
[265] Fix | Delete
* A Higher Order Component used to inject Plugin context to the
[266] Fix | Delete
* wrapped component.
[267] Fix | Delete
*
[268] Fix | Delete
* @deprecated 6.8.0 Use `usePluginContext` hook instead.
[269] Fix | Delete
*
[270] Fix | Delete
* @param mapContextToProps Function called on every context change,
[271] Fix | Delete
* expected to return object of props to
[272] Fix | Delete
* merge with the component's own props.
[273] Fix | Delete
*
[274] Fix | Delete
* @return {Component} Enhanced component with injected context as props.
[275] Fix | Delete
*/
[276] Fix | Delete
const withPluginContext = mapContextToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => {
[277] Fix | Delete
external_wp_deprecated_default()('wp.plugins.withPluginContext', {
[278] Fix | Delete
since: '6.8.0',
[279] Fix | Delete
alternative: 'wp.plugins.usePluginContext'
[280] Fix | Delete
});
[281] Fix | Delete
return props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Context.Consumer, {
[282] Fix | Delete
children: context => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, {
[283] Fix | Delete
...props,
[284] Fix | Delete
...mapContextToProps(context, props)
[285] Fix | Delete
})
[286] Fix | Delete
});
[287] Fix | Delete
}, 'withPluginContext');
[288] Fix | Delete
[289] Fix | Delete
;// ./node_modules/@wordpress/plugins/build-module/components/plugin-error-boundary/index.js
[290] Fix | Delete
/**
[291] Fix | Delete
* WordPress dependencies
[292] Fix | Delete
*/
[293] Fix | Delete
[294] Fix | Delete
class PluginErrorBoundary extends external_wp_element_namespaceObject.Component {
[295] Fix | Delete
/**
[296] Fix | Delete
* @param {Object} props
[297] Fix | Delete
*/
[298] Fix | Delete
constructor(props) {
[299] Fix | Delete
super(props);
[300] Fix | Delete
this.state = {
[301] Fix | Delete
hasError: false
[302] Fix | Delete
};
[303] Fix | Delete
}
[304] Fix | Delete
static getDerivedStateFromError() {
[305] Fix | Delete
return {
[306] Fix | Delete
hasError: true
[307] Fix | Delete
};
[308] Fix | Delete
}
[309] Fix | Delete
[310] Fix | Delete
/**
[311] Fix | Delete
* @param {Error} error Error object passed by React.
[312] Fix | Delete
*/
[313] Fix | Delete
componentDidCatch(error) {
[314] Fix | Delete
const {
[315] Fix | Delete
name,
[316] Fix | Delete
onError
[317] Fix | Delete
} = this.props;
[318] Fix | Delete
if (onError) {
[319] Fix | Delete
onError(name, error);
[320] Fix | Delete
}
[321] Fix | Delete
}
[322] Fix | Delete
render() {
[323] Fix | Delete
if (!this.state.hasError) {
[324] Fix | Delete
return this.props.children;
[325] Fix | Delete
}
[326] Fix | Delete
return null;
[327] Fix | Delete
}
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
;// external ["wp","primitives"]
[331] Fix | Delete
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
[332] Fix | Delete
;// ./node_modules/@wordpress/icons/build-module/library/plugins.js
[333] Fix | Delete
/**
[334] Fix | Delete
* WordPress dependencies
[335] Fix | Delete
*/
[336] Fix | Delete
[337] Fix | Delete
[338] Fix | Delete
const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[339] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[340] Fix | Delete
viewBox: "0 0 24 24",
[341] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
[342] Fix | Delete
d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"
[343] Fix | Delete
})
[344] Fix | Delete
});
[345] Fix | Delete
/* harmony default export */ const library_plugins = (plugins);
[346] Fix | Delete
[347] Fix | Delete
;// ./node_modules/@wordpress/plugins/build-module/api/index.js
[348] Fix | Delete
/* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */
[349] Fix | Delete
/**
[350] Fix | Delete
* External dependencies
[351] Fix | Delete
*/
[352] Fix | Delete
[353] Fix | Delete
/**
[354] Fix | Delete
* WordPress dependencies
[355] Fix | Delete
*/
[356] Fix | Delete
[357] Fix | Delete
[358] Fix | Delete
[359] Fix | Delete
/**
[360] Fix | Delete
* Defined behavior of a plugin type.
[361] Fix | Delete
*/
[362] Fix | Delete
[363] Fix | Delete
/**
[364] Fix | Delete
* Plugin definitions keyed by plugin name.
[365] Fix | Delete
*/
[366] Fix | Delete
const api_plugins = {};
[367] Fix | Delete
[368] Fix | Delete
/**
[369] Fix | Delete
* Registers a plugin to the editor.
[370] Fix | Delete
*
[371] Fix | Delete
* @param name A string identifying the plugin. Must be
[372] Fix | Delete
* unique across all registered plugins.
[373] Fix | Delete
* @param settings The settings for this plugin.
[374] Fix | Delete
*
[375] Fix | Delete
* @example
[376] Fix | Delete
* ```js
[377] Fix | Delete
* // Using ES5 syntax
[378] Fix | Delete
* var el = React.createElement;
[379] Fix | Delete
* var Fragment = wp.element.Fragment;
[380] Fix | Delete
* var PluginSidebar = wp.editor.PluginSidebar;
[381] Fix | Delete
* var PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem;
[382] Fix | Delete
* var registerPlugin = wp.plugins.registerPlugin;
[383] Fix | Delete
* var moreIcon = React.createElement( 'svg' ); //... svg element.
[384] Fix | Delete
*
[385] Fix | Delete
* function Component() {
[386] Fix | Delete
* return el(
[387] Fix | Delete
* Fragment,
[388] Fix | Delete
* {},
[389] Fix | Delete
* el(
[390] Fix | Delete
* PluginSidebarMoreMenuItem,
[391] Fix | Delete
* {
[392] Fix | Delete
* target: 'sidebar-name',
[393] Fix | Delete
* },
[394] Fix | Delete
* 'My Sidebar'
[395] Fix | Delete
* ),
[396] Fix | Delete
* el(
[397] Fix | Delete
* PluginSidebar,
[398] Fix | Delete
* {
[399] Fix | Delete
* name: 'sidebar-name',
[400] Fix | Delete
* title: 'My Sidebar',
[401] Fix | Delete
* },
[402] Fix | Delete
* 'Content of the sidebar'
[403] Fix | Delete
* )
[404] Fix | Delete
* );
[405] Fix | Delete
* }
[406] Fix | Delete
* registerPlugin( 'plugin-name', {
[407] Fix | Delete
* icon: moreIcon,
[408] Fix | Delete
* render: Component,
[409] Fix | Delete
* scope: 'my-page',
[410] Fix | Delete
* } );
[411] Fix | Delete
* ```
[412] Fix | Delete
*
[413] Fix | Delete
* @example
[414] Fix | Delete
* ```js
[415] Fix | Delete
* // Using ESNext syntax
[416] Fix | Delete
* import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/editor';
[417] Fix | Delete
* import { registerPlugin } from '@wordpress/plugins';
[418] Fix | Delete
* import { more } from '@wordpress/icons';
[419] Fix | Delete
*
[420] Fix | Delete
* const Component = () => (
[421] Fix | Delete
* <>
[422] Fix | Delete
* <PluginSidebarMoreMenuItem
[423] Fix | Delete
* target="sidebar-name"
[424] Fix | Delete
* >
[425] Fix | Delete
* My Sidebar
[426] Fix | Delete
* </PluginSidebarMoreMenuItem>
[427] Fix | Delete
* <PluginSidebar
[428] Fix | Delete
* name="sidebar-name"
[429] Fix | Delete
* title="My Sidebar"
[430] Fix | Delete
* >
[431] Fix | Delete
* Content of the sidebar
[432] Fix | Delete
* </PluginSidebar>
[433] Fix | Delete
* </>
[434] Fix | Delete
* );
[435] Fix | Delete
*
[436] Fix | Delete
* registerPlugin( 'plugin-name', {
[437] Fix | Delete
* icon: more,
[438] Fix | Delete
* render: Component,
[439] Fix | Delete
* scope: 'my-page',
[440] Fix | Delete
* } );
[441] Fix | Delete
* ```
[442] Fix | Delete
*
[443] Fix | Delete
* @return The final plugin settings object.
[444] Fix | Delete
*/
[445] Fix | Delete
function registerPlugin(name, settings) {
[446] Fix | Delete
if (typeof settings !== 'object') {
[447] Fix | Delete
console.error('No settings object provided!');
[448] Fix | Delete
return null;
[449] Fix | Delete
}
[450] Fix | Delete
if (typeof name !== 'string') {
[451] Fix | Delete
console.error('Plugin name must be string.');
[452] Fix | Delete
return null;
[453] Fix | Delete
}
[454] Fix | Delete
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
[455] Fix | Delete
console.error('Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".');
[456] Fix | Delete
return null;
[457] Fix | Delete
}
[458] Fix | Delete
if (api_plugins[name]) {
[459] Fix | Delete
console.error(`Plugin "${name}" is already registered.`);
[460] Fix | Delete
}
[461] Fix | Delete
settings = (0,external_wp_hooks_namespaceObject.applyFilters)('plugins.registerPlugin', settings, name);
[462] Fix | Delete
const {
[463] Fix | Delete
render,
[464] Fix | Delete
scope
[465] Fix | Delete
} = settings;
[466] Fix | Delete
if (typeof render !== 'function') {
[467] Fix | Delete
console.error('The "render" property must be specified and must be a valid function.');
[468] Fix | Delete
return null;
[469] Fix | Delete
}
[470] Fix | Delete
if (scope) {
[471] Fix | Delete
if (typeof scope !== 'string') {
[472] Fix | Delete
console.error('Plugin scope must be string.');
[473] Fix | Delete
return null;
[474] Fix | Delete
}
[475] Fix | Delete
if (!/^[a-z][a-z0-9-]*$/.test(scope)) {
[476] Fix | Delete
console.error('Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".');
[477] Fix | Delete
return null;
[478] Fix | Delete
}
[479] Fix | Delete
}
[480] Fix | Delete
api_plugins[name] = {
[481] Fix | Delete
name,
[482] Fix | Delete
icon: library_plugins,
[483] Fix | Delete
...settings
[484] Fix | Delete
};
[485] Fix | Delete
(0,external_wp_hooks_namespaceObject.doAction)('plugins.pluginRegistered', settings, name);
[486] Fix | Delete
return settings;
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
/**
[490] Fix | Delete
* Unregisters a plugin by name.
[491] Fix | Delete
*
[492] Fix | Delete
* @param name Plugin name.
[493] Fix | Delete
*
[494] Fix | Delete
* @example
[495] Fix | Delete
* ```js
[496] Fix | Delete
* // Using ES5 syntax
[497] Fix | Delete
* var unregisterPlugin = wp.plugins.unregisterPlugin;
[498] Fix | Delete
*
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function