You are here

function jquery_social_stream_js_filenames in jQuery social stream 8.2

Same name and namespace in other branches
  1. 7.2 jquery_social_stream.module \jquery_social_stream_js_filenames()

Returns names of the plugin js files (with versions).

1 call to jquery_social_stream_js_filenames()
jquery_social_stream_block_content in ./jquery_social_stream.module
Returns content of feed block.

File

./jquery_social_stream.module, line 721
Code for the Campaign social media module.

Code

function jquery_social_stream_js_filenames() {
  $cache = \Drupal::cache()
    ->get('jquery_social_stream:js_filenames');
  if (!$cache) {
    $filenames = array(
      'wall' => '',
      'stream' => '',
    );
    $files = scandir(libraries_get_path('jquery-social-stream') . '/js/');
    foreach ($files as $file) {
      if (preg_match('/jquery.social.stream[\\d\\.]*.min.js/', $file)) {
        $filenames['stream'] = $file;
      }
      elseif (preg_match('/jquery.social.stream.wall[\\d\\.]*.js/', $file)) {
        $filenames['wall'] = $file;
      }
    }
    \Drupal::cache()
      ->set('jquery_social_stream:js_filenames', $filenames);
  }
  else {
    $filenames = $cache->data;
  }
  return $filenames;
}