original_string: private static function image_exists($filepath, $svg = false) {
          if ($svg && file_exists("$filepath.svg")) {
              return "$filepath.svg";
          } else  if (file_exists("$filepath.png")) {
              return "$filepath.png";
          } else if (file_exists("$filepath.gif")) {
              return "$filepath.gif";
          } else  if (file_exists("$filepath.jpg")) {
              return "$filepath.jpg";
          } else  if (file_exists("$filepath.jpeg")) {
              return "$filepath.jpeg";
          } else {
              return false;
          }
      }
code: private static function image_exists($filepath, $svg = false) {
          if ($svg && file_exists("$filepath.svg")) {
              return "$filepath.svg";
          } else  if (file_exists("$filepath.png")) {
              return "$filepath.png";
          } else if (file_exists("$filepath.gif")) {
              return "$filepath.gif";
          } else  if (file_exists("$filepath.jpg")) {
              return "$filepath.jpg";
          } else  if (file_exists("$filepath.jpeg")) {
              return "$filepath.jpeg";
          } else {
              return false;
          }
      }
code_tokens: private static function image_exists ( $ filepath , $ svg = false ) { if ( $ svg && file_exists ( "$filepath.svg" ) ) { return "$filepath.svg" ; } else if ( file_exists ( "$filepath.png" ) ) { return "$filepath.png" ; } else if ( file_exists ( "$filepath.gif" ) ) { return "$filepath.gif" ; } else if ( file_exists ( "$filepath.jpg" ) ) { return "$filepath.jpg" ; } else if ( file_exists ( "$filepath.jpeg" ) ) { return "$filepath.jpeg" ; } else { return false ; } }
docstring: Checks if file with any image extension exists.
  
  The order to these images was adjusted prior to the release of 2.4
  At that point the were the following image counts in Moodle core:
  
  - png = 667 in pix dirs (1499 total)
  - gif = 385 in pix dirs (606 total)
  - jpg = 62  in pix dirs (74 total)
  - jpeg = 0  in pix dirs (1 total)
  
  There is work in progress to move towards SVG presently hence that has been prioritiesed.
  
  @param string $filepath
  @param bool $svg If set to true SVG images will also be looked for.
  @return string image name with extension
docstring_tokens: Checks if file with any image extension exists .