public function testMaxDepth() { $finder = new SS_FileFinder(); $finder->setOption('max_depth', 1); $this->assertFinderFinds($finder, array('file1.txt', 'file2.txt', 'dir1/dir1file1.txt', 'dir1/dir1file2.txt'), 'The finder respects the max depth setting.'); }
/** * Gets a list of email templates suitable for populating the email template dropdown. * * @return array */ public function getEmailTemplateDropdownValues() { $templates = array(); $finder = new SS_FileFinder(); $finder->setOption('name_regex', '/^.*\\.ss$/'); $found = $finder->find(BASE_PATH . '/' . UserDefinedForm::config()->email_template_directory); foreach ($found as $key => $value) { $template = pathinfo($value); $templates[$template['filename']] = $template['filename']; } return $templates; }