[ Index ]

PHP Cross Reference of phpBB-3.3.7-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Plugins/MediaEmbed/ -> Parser.php (summary)

(no description)

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

Defines 1 class

Parser:: (10 methods):
  parse()
  filterTag()
  addNamedCaptures()
  createTag()
  getAttributes()
  getHttpClient()
  getSiteIdFromUrl()
  interpolateVars()
  scrape()
  wget()


Class: Parser  - X-Ref


parse($text, array $matches)   X-Ref
{@inheritdoc}


filterTag(Tag $tag, TagStack $tagStack, array $hosts, array $sites, $cacheDir)   X-Ref
Filter a MEDIA tag

This will always invalidate the original tag, and possibly replace it with the tag that
corresponds to the media site

param: Tag         $tag      The original tag
param: TagStack    $tagStack Parser instance, so that we can add the new tag to the stack
param: array       $hosts    Map of [hostname => siteId]
param: array       $sites    Map of [siteId => siteConfig]
param: string|null $cacheDir Path to the cache directory
return: void

addNamedCaptures(array &$attributes, $string, array $regexps)   X-Ref
Add named captures from a set of regular expressions to a set of attributes

param: array   &$attributes Associative array of strings
param: string   $string     Text to match
param: array[]  $regexps    List of [regexp, map] pairs
return: bool                 Whether any regexp matched

createTag($tagName, TagStack $tagStack, Tag $tag)   X-Ref
Create a tag for a media embed

param: string   $tagName  Tag's name
param: TagStack $tagStack
param: Tag      $tag      Reference tag
return: Tag                New tag

getAttributes($url, array $config, $cacheDir)   X-Ref
Return a set of attributes for given URL based on a site's config

param: string      $url      Original URL
param: array       $config   Site config
param: string|null $cacheDir Path to the cache directory
return: array                 Associative array of attributes

getHttpClient($cacheDir)   X-Ref
Return a cached instance of the HTTP client

param: string|null $cacheDir
return: \s9e\TextFormatter\Utils\Http\Client

getSiteIdFromUrl($url, array $hosts)   X-Ref
Return the siteId that corresponds to given URL

param: string  $url   Original URL
param: array   $hosts Map of [hostname => siteId]
return: string         URL's siteId, or an empty string

interpolateVars($str, array $vars)   X-Ref
Interpolate {@vars} in given string

param: string $str  Original string
param: array  $vars Associative array
return: string       Interpolated string

scrape(array &$attributes, $url, array $config, $cacheDir)   X-Ref
No description

wget($url, $cacheDir, $config)   X-Ref
Retrieve external content

param: string      $url      URL
param: string|null $cacheDir Path to the cache directory
param: array       $config   Scraping config
return: string                Response body



Generated: Thu Mar 24 21:31:15 2022 Cross-referenced by PHPXref 0.7.1