Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * @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/'));
 }