Pix_Prompt::addOften PHP Method

addOften() public static method

public static addOften ( $prefix = '' )
    public static function addOften($prefix = '')
    {
        if (isset(self::$_walked_prefix[$prefix]) and self::$_walked_prefix[$prefix]) {
            return;
        }
        self::$_walked_prefix[$prefix] = true;
        foreach (self::$_paths as $path) {
            $dir = rtrim($path, '/') . '/' . str_replace('_', '/', $prefix) . '/';
            if (!file_exists($dir) or !is_dir($dir)) {
                continue;
            }
            $d = opendir($dir);
            while ($f = readdir($d)) {
                if (strpos($f, '.') === 0) {
                    continue;
                }
                if (!is_file($dir . $f)) {
                    continue;
                }
                if (preg_match('#^(.*)\\.php$#', $f, $matches)) {
                    self::$_often[] = ltrim($prefix . '_' . $matches[1], '_') . '::';
                }
            }
        }
    }