[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/ -> twemoji.js (summary)

Given an HEX codepoint, returns UTF16 surrogate pairs.

File Size: 568 lines (32 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 15 functions

  createText()
  escapeHTML()
  defaultImageSrcGenerator()
  grabAllTextNodes()
  grabTheRightIcon()
  parseNode()
  parseString()
  replacer()
  returnNull()
  toSizeSquaredAsset()
  fromCodePoint()
  parse()
  replace()
  test()
  toCodePoint()

Functions
Functions that are not part of a class:

createText(text, clean)   X-Ref
Shortcut to create text nodes

return: Node  a DOM node with that text
param: string  text used to create DOM text node

escapeHTML(s)   X-Ref
Utility function to escape html attribute text

return: string  text encoded to use in HTML attribute
param: string  text use in HTML attribute

defaultImageSrcGenerator(icon, options)   X-Ref
Default callback used to generate emoji src
based on Twitter CDN

return: string    the image source to use
param: string    the emoji codepoint string
param: string    the default size to use, i.e. "36x36"

grabAllTextNodes(node, allText)   X-Ref
Given a generic DOM nodeType 1, walk through all children
and store every nodeType 3 (#text) found in the tree.

return: Array same list with new discovered nodes, if any
param: Element a DOM Element with probably some text in it
param: Array the list of previously discovered text nodes

grabTheRightIcon(rawText)   X-Ref
Used to both remove the possible variant
and to convert utf16 into code points.
If there is a zero-width-joiner (U+200D), leave the variants in.

return: string    the code point
param: string    the raw text of the emoji match

parseNode(node, options)   X-Ref
DOM version of the same logic / parser:
emojify all found sub-text nodes placing images node instead.

return: Element same generic node with emoji in place, if any.
param: Element   generic DOM node with some text in some child node
param: Object    options  containing info about how to parse

parseString(str, options)   X-Ref
String/HTML version of the same logic / parser:
emojify a generic text placing images tags instead of surrogates pair.

return: the string with <img tags> replacing all found and parsed emoji
param: string    generic string with possibly some emoji in it
param: Object    options  containing info about how to parse

replacer(m)   X-Ref
Function used to actually replace HTML special chars

return: string  encoded HTML special char
param: string  HTML special char

returnNull()   X-Ref
Default options.attribute callback

return: null

toSizeSquaredAsset(value)   X-Ref
Given a generic value, creates its squared counterpart if it's a number.
As example, number 36 will return '36x36'.

return: any     a string representing asset size, i.e. "36x36"
param: any     a generic value.

fromCodePoint(codepoint)   X-Ref
No description

parse(what, how)   X-Ref
No description

replace(text, callback)   X-Ref
No description

test(text)   X-Ref
No description

toCodePoint(unicodeSurrogates, sep)   X-Ref
No description



Generated: Fri Mar 29 01:00:02 2024 Cross-referenced by PHPXref 0.7.1