You are here

public function MediaInternetTestHandler::parse in D7 Media 7.4

Same name and namespace in other branches
  1. 7.2 modules/media_internet/tests/includes/MediaInternetTestHandler.inc \MediaInternetTestHandler::parse()
  2. 7.3 modules/media_internet/tests/includes/MediaInternetTestHandler.inc \MediaInternetTestHandler::parse()
2 calls to MediaInternetTestHandler::parse()
MediaInternetTestHandler::claim in modules/media_internet/tests/includes/MediaInternetTestHandler.inc
Determines if this handler should claim the item.
MediaInternetTestHandler::getFileObject in modules/media_internet/tests/includes/MediaInternetTestHandler.inc
Returns a file object which can be used for validation.

File

modules/media_internet/tests/includes/MediaInternetTestHandler.inc, line 14
Extends the MediaInternetBaseHandler class to handle videos from an imaginary example.com.

Class

MediaInternetTestHandler
Implementation of MediaInternetBaseHandler.

Code

public function parse($embedCode) {

  // http://example.com/video/*
  $patterns = array(
    '@example\\.com/video/(\\d+)@i',
  );
  foreach ($patterns as $pattern) {
    preg_match($pattern, $embedCode, $matches);
    if (isset($matches[1])) {
      return file_stream_wrapper_uri_normalize('mediainternettest://video/' . $matches[1]);
    }
  }
}