You are here

function _phantomjs_capture_get_version in PhantomJS Capture 7

Returns the version number of the currently install PhantomJS.

Parameters

string $binary: Optional absolute path with the PhantomJS binary. If not given the default location is used.

Return value

string|boolean If PhantomJS is found and executable the version number is returned else FALSE is returned.

1 call to _phantomjs_capture_get_version()
phantomjs_capture_admin_form_validate in ./phantomjs_capture.module
Validation of the administration form.

File

./phantomjs_capture.module, line 193
Defines the administration interface and utility functions to use PhantomJS and test screen shot capture functions.

Code

function _phantomjs_capture_get_version($binary = NULL) {

  // If the binary is not given try the default path.
  if (is_null($binary)) {
    $binary = _phantomjs_capture_get_binary();
    if (!$binary) {
      drupal_set_message(t('PhantomJS binary was not found. Plase intall PhantomJS on the system.'));
      return FALSE;
    }
  }

  // Execute PhantomJS to get its version, if PhantomJS was found.
  $output = array();
  exec($binary . ' -v', $output);
  return $output[0];
}