Ejemplo n.º 1
0
 /**
  * @param $urlFragment string
  * @return Url
  */
 public function Add($urlFragment)
 {
     if (!BookedStringHelper::EndsWith($this->url, '/')) {
         $this->url .= '/';
     }
     $this->url .= urlencode($urlFragment);
     return $this;
 }
Ejemplo n.º 2
0
 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 . '/';
 }
Ejemplo n.º 3
0
 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();"));
             }
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }
Ejemplo n.º 5
0
 /**
  * @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 . '/';
     }
 }