You are here

public function WordPressAudioPlayer::getPluginLibraryVersion in AudioField 8

Parses library to get version number of installed library.

Return value

string The version number of the currently installed library.

Overrides AudioFieldPluginBase::getPluginLibraryVersion

File

src/Plugin/AudioPlayer/WordPressAudioPlayer.php, line 103

Class

WordPressAudioPlayer
Implements the WordPress Audio Player plugin.

Namespace

Drupal\audiofield\Plugin\AudioPlayer

Code

public function getPluginLibraryVersion() {

  // Parse the audio-player.js file for version info.
  $library_path = $this->fileSystem
    ->realpath(DRUPAL_ROOT . $this
    ->getPluginLibraryPath() . '/audio-player.js');
  $library_data = file_get_contents($library_path);
  $matches = [];
  preg_match('%SWFObject v([0-9\\.]+).*%', $library_data, $matches);
  return $matches[1];
}