TYPO3 CMS  TYPO3_6-2
MediaWizardProviderManager.php
Go to the documentation of this file.
1 <?php
3 
23 
27  static protected $providers = array();
28 
36  static public function registerMediaWizardProvider($className) {
37  if (!isset(self::$providers[$className])) {
39  if (!$provider instanceof MediaWizardProviderInterface) {
40  throw new \UnexpectedValueException($className . ' is registered as a mediaWizardProvider, so it must implement interface TYPO3\\CMS\\Frontend\\MediaWizard\\MediaWizardProviderInterface', 1285022360);
41  }
42  self::$providers[$className] = $provider;
43  }
44  }
45 
50  static public function getValidMediaWizardProvider($url) {
51  // Go through registered providers in reverse order (last one registered wins)
52  $providers = array_reverse(self::$providers, TRUE);
53  foreach ($providers as $provider) {
55  if ($provider->canHandle($url)) {
56  return $provider;
57  }
58  }
59  // No provider found
60  return NULL;
61  }
62 
63 }