Beispiel #1
0
 /**
  * Get the fullpath to the Custom CSS folder
  * Create if not there.
  *
  * @return string fullpath
  */
 static function getCustomCssFolder()
 {
     $path = \PressBooks\Utility\get_media_prefix() . 'custom-css/';
     if (!file_exists($path)) {
         mkdir($path, 0775, true);
     }
     return $path;
 }
 /**
  * Get the fullpath to the Exports folder.
  * Create if not there. Create .htaccess protection if missing.
  *
  * @return string fullpath
  */
 static function getExportFolder()
 {
     $path = \PressBooks\Utility\get_media_prefix() . 'exports/';
     if (!file_exists($path)) {
         mkdir($path, 0775, true);
     }
     $path_to_htaccess = $path . '.htaccess';
     if (!file_exists($path_to_htaccess)) {
         // Restrict access
         file_put_contents($path_to_htaccess, "deny from all\n");
     }
     return $path;
 }
 /**
  * @covers \PressBooks\Utility\get_media_prefix
  */
 public function test_get_media_prefix()
 {
     $prefix = \PressBooks\Utility\get_media_prefix();
     $this->assertTrue(false !== strpos($prefix, '/blogs.dir/') || false !== strpos($prefix, '/uploads/sites/'));
 }