You are here

public function EmapiMedia::parse in Embedded Media Field 6.3

File

emapi/includes/emapi.class.media.inc, line 161
Base Embedded Media Object, to be extended by individual providers.

Class

EmapiMedia
@file Base Embedded Media Object, to be extended by individual providers.

Code

public function parse($original) {
  if (is_array($patterns = $this
    ->get_patterns())) {
    foreach ($patterns as $pattern) {
      if (preg_match($pattern, $original, $matches)) {
        $this
          ->set_original($original);

        // Note that we set the value during set_uri.
        return $this
          ->set_uri($this
          ->get_provider() . '://' . $this
          ->get_identifier() . '/' . $matches[1]);
      }
    }
  }
}