/**
 * Counts the files and directories in a directory that are not php or html files.
 *
 * @param   string  $dir  Directory name
 *
 * @return  array  The number of media files and directories in the given directory
 *
 * @since   3.2
 */
public function countFiles($dir)
{
    $total_file = 0;
    $total_dir = 0;
    if (is_dir($dir)) {
        $d = dir($dir);
        while (($entry = $d->read()) !== false) {
            if ($entry[0] !== '.' && strpos($entry, '.html') === false && strpos($entry, '.php') === false && is_file($dir . DIRECTORY_SEPARATOR . $entry)) {
                $total_file++;
            }
            if ($entry[0] !== '.' && is_dir($dir . DIRECTORY_SEPARATOR . $entry)) {
                $total_dir++;
            }
        }
        $d->close();
    }
    return array($total_file, $total_dir);
}