[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 this["wp"] = this["wp"] || {}; this["wp"]["wordcount"] = 2 /******/ (function(modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ var installedModules = {}; 5 /******/ 6 /******/ // The require function 7 /******/ function __webpack_require__(moduleId) { 8 /******/ 9 /******/ // Check if module is in cache 10 /******/ if(installedModules[moduleId]) { 11 /******/ return installedModules[moduleId].exports; 12 /******/ } 13 /******/ // Create a new module (and put it into the cache) 14 /******/ var module = installedModules[moduleId] = { 15 /******/ i: moduleId, 16 /******/ l: false, 17 /******/ exports: {} 18 /******/ }; 19 /******/ 20 /******/ // Execute the module function 21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 /******/ 23 /******/ // Flag the module as loaded 24 /******/ module.l = true; 25 /******/ 26 /******/ // Return the exports of the module 27 /******/ return module.exports; 28 /******/ } 29 /******/ 30 /******/ 31 /******/ // expose the modules object (__webpack_modules__) 32 /******/ __webpack_require__.m = modules; 33 /******/ 34 /******/ // expose the module cache 35 /******/ __webpack_require__.c = installedModules; 36 /******/ 37 /******/ // define getter function for harmony exports 38 /******/ __webpack_require__.d = function(exports, name, getter) { 39 /******/ if(!__webpack_require__.o(exports, name)) { 40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 /******/ } 42 /******/ }; 43 /******/ 44 /******/ // define __esModule on exports 45 /******/ __webpack_require__.r = function(exports) { 46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 /******/ } 49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 /******/ }; 51 /******/ 52 /******/ // create a fake namespace object 53 /******/ // mode & 1: value is a module id, require it 54 /******/ // mode & 2: merge all properties of value into the ns 55 /******/ // mode & 4: return value when already ns object 56 /******/ // mode & 8|1: behave like require 57 /******/ __webpack_require__.t = function(value, mode) { 58 /******/ if(mode & 1) value = __webpack_require__(value); 59 /******/ if(mode & 8) return value; 60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 /******/ var ns = Object.create(null); 62 /******/ __webpack_require__.r(ns); 63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 /******/ return ns; 66 /******/ }; 67 /******/ 68 /******/ // getDefaultExport function for compatibility with non-harmony modules 69 /******/ __webpack_require__.n = function(module) { 70 /******/ var getter = module && module.__esModule ? 71 /******/ function getDefault() { return module['default']; } : 72 /******/ function getModuleExports() { return module; }; 73 /******/ __webpack_require__.d(getter, 'a', getter); 74 /******/ return getter; 75 /******/ }; 76 /******/ 77 /******/ // Object.prototype.hasOwnProperty.call 78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 /******/ 80 /******/ // __webpack_public_path__ 81 /******/ __webpack_require__.p = ""; 82 /******/ 83 /******/ 84 /******/ // Load entry module and return exports 85 /******/ return __webpack_require__(__webpack_require__.s = "./node_modules/@wordpress/wordcount/build-module/index.js"); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ({ 89 90 /***/ "./node_modules/@wordpress/wordcount/build-module/defaultSettings.js": 91 /*!***************************************************************************!*\ 92 !*** ./node_modules/@wordpress/wordcount/build-module/defaultSettings.js ***! 93 \***************************************************************************/ 94 /*! exports provided: defaultSettings */ 95 /***/ (function(module, __webpack_exports__, __webpack_require__) { 96 97 "use strict"; 98 __webpack_require__.r(__webpack_exports__); 99 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultSettings", function() { return defaultSettings; }); 100 var defaultSettings = { 101 HTMLRegExp: /<\/?[a-z][^>]*?>/gi, 102 HTMLcommentRegExp: /<!--[\s\S]*?-->/g, 103 spaceRegExp: / | /gi, 104 HTMLEntityRegExp: /&\S+?;/g, 105 // \u2014 = em-dash 106 connectorRegExp: /--|\u2014/g, 107 // Characters to be removed from input text. 108 removeRegExp: new RegExp(['[', // Basic Latin (extract) 109 "!-@[-`{-~", // Latin-1 Supplement (extract) 110 "\x80-\xBF\xD7\xF7", 111 /* 112 * The following range consists of: 113 * General Punctuation 114 * Superscripts and Subscripts 115 * Currency Symbols 116 * Combining Diacritical Marks for Symbols 117 * Letterlike Symbols 118 * Number Forms 119 * Arrows 120 * Mathematical Operators 121 * Miscellaneous Technical 122 * Control Pictures 123 * Optical Character Recognition 124 * Enclosed Alphanumerics 125 * Box Drawing 126 * Block Elements 127 * Geometric Shapes 128 * Miscellaneous Symbols 129 * Dingbats 130 * Miscellaneous Mathematical Symbols-A 131 * Supplemental Arrows-A 132 * Braille Patterns 133 * Supplemental Arrows-B 134 * Miscellaneous Mathematical Symbols-B 135 * Supplemental Mathematical Operators 136 * Miscellaneous Symbols and Arrows 137 */ 138 "\u2000-\u2BFF", // Supplemental Punctuation 139 "\u2E00-\u2E7F", ']'].join(''), 'g'), 140 // Remove UTF-16 surrogate points, see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF 141 astralRegExp: /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 142 wordsRegExp: /\S\s+/g, 143 characters_excluding_spacesRegExp: /\S/g, 144 145 /* 146 * Match anything that is not a formatting character, excluding: 147 * \f = form feed 148 * \n = new line 149 * \r = carriage return 150 * \t = tab 151 * \v = vertical tab 152 * \u00AD = soft hyphen 153 * \u2028 = line separator 154 * \u2029 = paragraph separator 155 */ 156 characters_including_spacesRegExp: /[^\f\n\r\t\v\u00AD\u2028\u2029]/g, 157 l10n: { 158 type: 'words' 159 } 160 }; 161 162 163 /***/ }), 164 165 /***/ "./node_modules/@wordpress/wordcount/build-module/index.js": 166 /*!*****************************************************************!*\ 167 !*** ./node_modules/@wordpress/wordcount/build-module/index.js ***! 168 \*****************************************************************/ 169 /*! exports provided: count */ 170 /***/ (function(module, __webpack_exports__, __webpack_require__) { 171 172 "use strict"; 173 __webpack_require__.r(__webpack_exports__); 174 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "count", function() { return count; }); 175 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash"); 176 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); 177 /* harmony import */ var _defaultSettings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./defaultSettings */ "./node_modules/@wordpress/wordcount/build-module/defaultSettings.js"); 178 /* harmony import */ var _stripTags__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stripTags */ "./node_modules/@wordpress/wordcount/build-module/stripTags.js"); 179 /* harmony import */ var _transposeAstralsToCountableChar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./transposeAstralsToCountableChar */ "./node_modules/@wordpress/wordcount/build-module/transposeAstralsToCountableChar.js"); 180 /* harmony import */ var _stripHTMLEntities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stripHTMLEntities */ "./node_modules/@wordpress/wordcount/build-module/stripHTMLEntities.js"); 181 /* harmony import */ var _stripConnectors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stripConnectors */ "./node_modules/@wordpress/wordcount/build-module/stripConnectors.js"); 182 /* harmony import */ var _stripRemovables__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stripRemovables */ "./node_modules/@wordpress/wordcount/build-module/stripRemovables.js"); 183 /* harmony import */ var _stripHTMLComments__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stripHTMLComments */ "./node_modules/@wordpress/wordcount/build-module/stripHTMLComments.js"); 184 /* harmony import */ var _stripShortcodes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./stripShortcodes */ "./node_modules/@wordpress/wordcount/build-module/stripShortcodes.js"); 185 /* harmony import */ var _stripSpaces__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./stripSpaces */ "./node_modules/@wordpress/wordcount/build-module/stripSpaces.js"); 186 /* harmony import */ var _transposeHTMLEntitiesToCountableChars__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./transposeHTMLEntitiesToCountableChars */ "./node_modules/@wordpress/wordcount/build-module/transposeHTMLEntitiesToCountableChars.js"); 187 188 189 190 191 192 193 194 195 196 197 198 /** 199 * Private function to manage the settings. 200 * 201 * @param {string} type The type of count to be done. 202 * @param {Object} userSettings Custom settings for the count. 203 * 204 * @return {void|Object|*} The combined settings object to be used. 205 */ 206 207 function loadSettings(type, userSettings) { 208 var settings = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["extend"])(_defaultSettings__WEBPACK_IMPORTED_MODULE_1__["defaultSettings"], userSettings); 209 settings.shortcodes = settings.l10n.shortcodes || {}; 210 211 if (settings.shortcodes && settings.shortcodes.length) { 212 settings.shortcodesRegExp = new RegExp('\\[\\/?(?:' + settings.shortcodes.join('|') + ')[^\\]]*?\\]', 'g'); 213 } 214 215 settings.type = type || settings.l10n.type; 216 217 if (settings.type !== 'characters_excluding_spaces' && settings.type !== 'characters_including_spaces') { 218 settings.type = 'words'; 219 } 220 221 return settings; 222 } 223 /** 224 * Match the regex for the type 'words' 225 * 226 * @param {string} text The text being processed 227 * @param {string} regex The regular expression pattern being matched 228 * @param {Object} settings Settings object containing regular expressions for each strip function 229 * 230 * @return {Array|{index: number, input: string}} The matched string. 231 */ 232 233 234 function matchWords(text, regex, settings) { 235 text = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["flow"])(_stripTags__WEBPACK_IMPORTED_MODULE_2__["default"].bind(this, settings), _stripHTMLComments__WEBPACK_IMPORTED_MODULE_7__["default"].bind(this, settings), _stripShortcodes__WEBPACK_IMPORTED_MODULE_8__["default"].bind(this, settings), _stripSpaces__WEBPACK_IMPORTED_MODULE_9__["default"].bind(this, settings), _stripHTMLEntities__WEBPACK_IMPORTED_MODULE_4__["default"].bind(this, settings), _stripConnectors__WEBPACK_IMPORTED_MODULE_5__["default"].bind(this, settings), _stripRemovables__WEBPACK_IMPORTED_MODULE_6__["default"].bind(this, settings))(text); 236 text = text + '\n'; 237 return text.match(regex); 238 } 239 /** 240 * Match the regex for either 'characters_excluding_spaces' or 'characters_including_spaces' 241 * 242 * @param {string} text The text being processed 243 * @param {string} regex The regular expression pattern being matched 244 * @param {Object} settings Settings object containing regular expressions for each strip function 245 * 246 * @return {Array|{index: number, input: string}} The matched string. 247 */ 248 249 250 function matchCharacters(text, regex, settings) { 251 text = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["flow"])(_stripTags__WEBPACK_IMPORTED_MODULE_2__["default"].bind(this, settings), _stripHTMLComments__WEBPACK_IMPORTED_MODULE_7__["default"].bind(this, settings), _stripShortcodes__WEBPACK_IMPORTED_MODULE_8__["default"].bind(this, settings), _stripSpaces__WEBPACK_IMPORTED_MODULE_9__["default"].bind(this, settings), _transposeAstralsToCountableChar__WEBPACK_IMPORTED_MODULE_3__["default"].bind(this, settings), _transposeHTMLEntitiesToCountableChars__WEBPACK_IMPORTED_MODULE_10__["default"].bind(this, settings))(text); 252 text = text + '\n'; 253 return text.match(regex); 254 } 255 /** 256 * Count some words. 257 * 258 * @param {String} text The text being processed 259 * @param {String} type The type of count. Accepts ;words', 'characters_excluding_spaces', or 'characters_including_spaces'. 260 * @param {Object} userSettings Custom settings object. 261 * 262 * @return {Number} The word or character count. 263 */ 264 265 266 function count(text, type, userSettings) { 267 var settings = loadSettings(type, userSettings); 268 269 if (text) { 270 var matchRegExp = settings[type + 'RegExp']; 271 var results = 'words' === settings.type ? matchWords(text, matchRegExp, settings) : matchCharacters(text, matchRegExp, settings); 272 return results ? results.length : 0; 273 } 274 } 275 276 277 /***/ }), 278 279 /***/ "./node_modules/@wordpress/wordcount/build-module/stripConnectors.js": 280 /*!***************************************************************************!*\ 281 !*** ./node_modules/@wordpress/wordcount/build-module/stripConnectors.js ***! 282 \***************************************************************************/ 283 /*! exports provided: default */ 284 /***/ (function(module, __webpack_exports__, __webpack_require__) { 285 286 "use strict"; 287 __webpack_require__.r(__webpack_exports__); 288 /** 289 * Replaces items matched in the regex with spaces. 290 * 291 * @param {Object} settings The main settings object containing regular expressions 292 * @param {string} text The string being counted. 293 * 294 * @return {string} The manipulated text. 295 */ 296 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 297 if (settings.connectorRegExp) { 298 return text.replace(settings.connectorRegExp, ' '); 299 } 300 301 return text; 302 }); 303 304 305 /***/ }), 306 307 /***/ "./node_modules/@wordpress/wordcount/build-module/stripHTMLComments.js": 308 /*!*****************************************************************************!*\ 309 !*** ./node_modules/@wordpress/wordcount/build-module/stripHTMLComments.js ***! 310 \*****************************************************************************/ 311 /*! exports provided: default */ 312 /***/ (function(module, __webpack_exports__, __webpack_require__) { 313 314 "use strict"; 315 __webpack_require__.r(__webpack_exports__); 316 /** 317 * Removes items matched in the regex. 318 * 319 * @param {Object} settings The main settings object containing regular expressions 320 * @param {string} text The string being counted. 321 * 322 * @return {string} The manipulated text. 323 */ 324 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 325 if (settings.HTMLcommentRegExp) { 326 return text.replace(settings.HTMLcommentRegExp, ''); 327 } 328 329 return text; 330 }); 331 332 333 /***/ }), 334 335 /***/ "./node_modules/@wordpress/wordcount/build-module/stripHTMLEntities.js": 336 /*!*****************************************************************************!*\ 337 !*** ./node_modules/@wordpress/wordcount/build-module/stripHTMLEntities.js ***! 338 \*****************************************************************************/ 339 /*! exports provided: default */ 340 /***/ (function(module, __webpack_exports__, __webpack_require__) { 341 342 "use strict"; 343 __webpack_require__.r(__webpack_exports__); 344 /** 345 * Removes items matched in the regex. 346 * 347 * @param {Object} settings The main settings object containing regular expressions 348 * @param {string} text The string being counted. 349 * 350 * @return {string} The manipulated text. 351 */ 352 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 353 if (settings.HTMLEntityRegExp) { 354 return text.replace(settings.HTMLEntityRegExp, ''); 355 } 356 357 return text; 358 }); 359 360 361 /***/ }), 362 363 /***/ "./node_modules/@wordpress/wordcount/build-module/stripRemovables.js": 364 /*!***************************************************************************!*\ 365 !*** ./node_modules/@wordpress/wordcount/build-module/stripRemovables.js ***! 366 \***************************************************************************/ 367 /*! exports provided: default */ 368 /***/ (function(module, __webpack_exports__, __webpack_require__) { 369 370 "use strict"; 371 __webpack_require__.r(__webpack_exports__); 372 /** 373 * Removes items matched in the regex. 374 * 375 * @param {Object} settings The main settings object containing regular expressions 376 * @param {string} text The string being counted. 377 * 378 * @return {string} The manipulated text. 379 */ 380 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 381 if (settings.removeRegExp) { 382 return text.replace(settings.removeRegExp, ''); 383 } 384 385 return text; 386 }); 387 388 389 /***/ }), 390 391 /***/ "./node_modules/@wordpress/wordcount/build-module/stripShortcodes.js": 392 /*!***************************************************************************!*\ 393 !*** ./node_modules/@wordpress/wordcount/build-module/stripShortcodes.js ***! 394 \***************************************************************************/ 395 /*! exports provided: default */ 396 /***/ (function(module, __webpack_exports__, __webpack_require__) { 397 398 "use strict"; 399 __webpack_require__.r(__webpack_exports__); 400 /** 401 * Replaces items matched in the regex with a new line. 402 * 403 * @param {Object} settings The main settings object containing regular expressions 404 * @param {string} text The string being counted. 405 * 406 * @return {string} The manipulated text. 407 */ 408 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 409 if (settings.shortcodesRegExp) { 410 return text.replace(settings.shortcodesRegExp, '\n'); 411 } 412 413 return text; 414 }); 415 416 417 /***/ }), 418 419 /***/ "./node_modules/@wordpress/wordcount/build-module/stripSpaces.js": 420 /*!***********************************************************************!*\ 421 !*** ./node_modules/@wordpress/wordcount/build-module/stripSpaces.js ***! 422 \***********************************************************************/ 423 /*! exports provided: default */ 424 /***/ (function(module, __webpack_exports__, __webpack_require__) { 425 426 "use strict"; 427 __webpack_require__.r(__webpack_exports__); 428 /** 429 * Replaces items matched in the regex with spaces. 430 * 431 * @param {Object} settings The main settings object containing regular expressions 432 * @param {string} text The string being counted. 433 * 434 * @return {string} The manipulated text. 435 */ 436 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 437 if (settings.spaceRegExp) { 438 return text.replace(settings.spaceRegExp, ' '); 439 } 440 }); 441 442 443 /***/ }), 444 445 /***/ "./node_modules/@wordpress/wordcount/build-module/stripTags.js": 446 /*!*********************************************************************!*\ 447 !*** ./node_modules/@wordpress/wordcount/build-module/stripTags.js ***! 448 \*********************************************************************/ 449 /*! exports provided: default */ 450 /***/ (function(module, __webpack_exports__, __webpack_require__) { 451 452 "use strict"; 453 __webpack_require__.r(__webpack_exports__); 454 /** 455 * Replaces items matched in the regex with new line 456 * 457 * @param {Object} settings The main settings object containing regular expressions 458 * @param {string} text The string being counted. 459 * 460 * @return {string} The manipulated text. 461 */ 462 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 463 if (settings.HTMLRegExp) { 464 return text.replace(settings.HTMLRegExp, '\n'); 465 } 466 }); 467 468 469 /***/ }), 470 471 /***/ "./node_modules/@wordpress/wordcount/build-module/transposeAstralsToCountableChar.js": 472 /*!*******************************************************************************************!*\ 473 !*** ./node_modules/@wordpress/wordcount/build-module/transposeAstralsToCountableChar.js ***! 474 \*******************************************************************************************/ 475 /*! exports provided: default */ 476 /***/ (function(module, __webpack_exports__, __webpack_require__) { 477 478 "use strict"; 479 __webpack_require__.r(__webpack_exports__); 480 /** 481 * Replaces items matched in the regex with character. 482 * 483 * @param {Object} settings The main settings object containing regular expressions 484 * @param {string} text The string being counted. 485 * 486 * @return {string} The manipulated text. 487 */ 488 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 489 if (settings.astralRegExp) { 490 return text.replace(settings.astralRegExp, 'a'); 491 } 492 493 return text; 494 }); 495 496 497 /***/ }), 498 499 /***/ "./node_modules/@wordpress/wordcount/build-module/transposeHTMLEntitiesToCountableChars.js": 500 /*!*************************************************************************************************!*\ 501 !*** ./node_modules/@wordpress/wordcount/build-module/transposeHTMLEntitiesToCountableChars.js ***! 502 \*************************************************************************************************/ 503 /*! exports provided: default */ 504 /***/ (function(module, __webpack_exports__, __webpack_require__) { 505 506 "use strict"; 507 __webpack_require__.r(__webpack_exports__); 508 /** 509 * Replaces items matched in the regex with a single character. 510 * 511 * @param {Object} settings The main settings object containing regular expressions 512 * @param {string} text The string being counted. 513 * 514 * @return {string} The manipulated text. 515 */ 516 /* harmony default export */ __webpack_exports__["default"] = (function (settings, text) { 517 if (settings.HTMLEntityRegExp) { 518 return text.replace(settings.HTMLEntityRegExp, 'a'); 519 } 520 521 return text; 522 }); 523 524 525 /***/ }), 526 527 /***/ "lodash": 528 /*!*************************!*\ 529 !*** external "lodash" ***! 530 \*************************/ 531 /*! no static exports found */ 532 /***/ (function(module, exports) { 533 534 (function() { module.exports = this["lodash"]; }()); 535 536 /***/ }) 537 538 /******/ }); 539 //# sourceMappingURL=wordcount.js.map
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Jan 7 01:00:05 2019 | Cross-referenced by PHPXref 0.7.1 |