/** * @param $urlFragment string * @return Url */ public function Add($urlFragment) { if (!BookedStringHelper::EndsWith($this->url, '/')) { $this->url .= '/'; } $this->url .= urlencode($urlFragment); return $this; }
public function GetPath() { $path = $this->GetConfig('wp_includes.directory'); if (!BookedStringHelper::StartsWith($path, '/')) { $path = ROOT_DIR . "/{$path}"; } if (BookedStringHelper::EndsWith($path, '/')) { return $path; } return $path . '/'; }
private static function AddSuites(PHPUnit_Framework_TestSuite $suite) { $dir = ROOT_DIR . 'tests'; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST); /** @var $path SplFileInfo */ foreach ($iterator as $path) { if (!$path->isDir()) { $file = $path->getFilename(); if (BookedStringHelper::EndsWith($file, 'Suite.php')) { $testName = str_replace('.php', '', $file); $fullPath = "{$path->getPath()}/{$file}"; require_once $fullPath; $suite->addTest(eval("return {$testName}::suite();")); } } } }
/** * Filesystem directory for storing reservation attachments. Always contains trailing slash * * @static * @return string */ public static function ReservationAttachments() { $uploadDir = Configuration::Instance()->GetSectionKey(ConfigSection::UPLOADS, ConfigKeys::UPLOAD_RESERVATION_ATTACHMENTS); if (empty($uploadDir)) { $uploadDir = ROOT_DIR . 'uploads/reservation'; } if (!is_dir($uploadDir)) { $uploadDir = ROOT_DIR . $uploadDir; } if (!BookedStringHelper::EndsWith($uploadDir, '/')) { $uploadDir = $uploadDir . '/'; } if (!is_dir($uploadDir)) { Log::Debug('Could not find directory %s. Attempting to create it', $uploadDir); $created = mkdir($uploadDir); if ($created) { Log::Debug('Created %s', $uploadDir); } else { Log::Debug('Could not create %s', $uploadDir); } } return $uploadDir; }
/** * @param $regex */ private function SetRegex($regex) { $this->regex = $regex; if (empty($this->regex)) { return; } if (!BookedStringHelper::StartsWith($this->regex, '/')) { $this->regex = '/' . $this->regex; } if (!BookedStringHelper::EndsWith($this->regex, '/')) { $this->regex = $this->regex . '/'; } }