[ 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

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

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

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

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

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

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.

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

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.

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

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

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

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

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

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

param: string  HTML special char
return: string  encoded 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'.

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

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: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1