public function add($siteId, array $siteConfig = null)
	{
		// Normalize or retrieve the site definition
		$siteId = $this->normalizeId($siteId);
		if (isset($siteConfig))
		{
			$siteConfig = $this->defaultSites->normalizeValue($siteConfig);
		}
		else
		{
			$siteConfig = $this->defaultSites->get($siteId);
		}
		$siteConfig['extract'] = $this->convertRegexps($siteConfig['extract']);
		$siteConfig['scrape']  = $this->convertScrapes($siteConfig['scrape']);

		// Check the safety of attribute filters
		$this->checkAttributeFilters($siteConfig['attributes']);

		// Create the tag for this site
		$tag = $this->addTag($siteId, $siteConfig);

		// Update the configurator's data
		$this->sites[$siteId] = $siteConfig;
		foreach ($siteConfig['host'] as $host)
		{
			$this->configurator->registeredVars['MediaEmbed.hosts'][$host] = $siteId;
		}
		$this->configurator->registeredVars['MediaEmbed.sites'][$siteId] = [$siteConfig['extract'], $siteConfig['scrape']];

		return $tag;
	}
public function add($siteId, array $siteConfig = null)
	{
		// Normalize or retrieve the site definition
		$siteId = $this->normalizeId($siteId);
		if (isset($siteConfig))
		{
			$siteConfig = $this->defaultSites->normalizeValue($siteConfig);
		}
		else
		{
			$siteConfig = $this->defaultSites->get($siteId);
		}
		$siteConfig['extract'] = $this->convertRegexps($siteConfig['extract']);
		$siteConfig['scrape']  = $this->convertScrapes($siteConfig['scrape']);

		// Check the safety of attribute filters
		$this->checkAttributeFilters($siteConfig['attributes']);

		// Create the tag for this site
		$tag = $this->addTag($siteId, $siteConfig);

		// Update the configurator's data
		$this->sites[$siteId] = $siteConfig;
		foreach ($siteConfig['host'] as $host)
		{
			$this->configurator->registeredVars['MediaEmbed.hosts'][$host] = $siteId;
		}
		$this->configurator->registeredVars['MediaEmbed.sites'][$siteId] = [$siteConfig['extract'], $siteConfig['scrape']];

		return $tag;
	}
public function add ( $ siteId , array $ siteConfig = null ) { // Normalize or retrieve the site definition $ siteId = $ this -> normalizeId ( $ siteId ) ; if ( isset ( $ siteConfig ) ) { $ siteConfig = $ this -> defaultSites -> normalizeValue ( $ siteConfig ) ; } else { $ siteConfig = $ this -> defaultSites -> get ( $ siteId ) ; } $ siteConfig [ 'extract' ] = $ this -> convertRegexps ( $ siteConfig [ 'extract' ] ) ; $ siteConfig [ 'scrape' ] = $ this -> convertScrapes ( $ siteConfig [ 'scrape' ] ) ; // Check the safety of attribute filters $ this -> checkAttributeFilters ( $ siteConfig [ 'attributes' ] ) ; // Create the tag for this site $ tag = $ this -> addTag ( $ siteId , $ siteConfig ) ; // Update the configurator's data $ this -> sites [ $ siteId ] = $ siteConfig ; foreach ( $ siteConfig [ 'host' ] as $ host ) { $ this -> configurator -> registeredVars [ 'MediaEmbed.hosts' ] [ $ host ] = $ siteId ; } $ this -> configurator -> registeredVars [ 'MediaEmbed.sites' ] [ $ siteId ] = [ $ siteConfig [ 'extract' ] , $ siteConfig [ 'scrape' ] ] ; return $ tag ; }
Add a media site

@param  string $siteId     Site's ID
@param  array  $siteConfig Site's config
@return Tag                Tag created for this site
Add a media site