forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Component: build public resources (WIP)
- Loading branch information
Showing
740 changed files
with
1,292 additions
and
45,632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,4 +167,4 @@ function unserializesession($serialized_string) | |
} | ||
|
||
return ($variables); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0
public/calendar.php → ...nts/ILIAS/Calendar/resources/calendar.php
100755 → 100644
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
*********************************************************************/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ILIAS\Component\Resource; | ||
|
||
/** | ||
* This is a css file provided by some component. | ||
*/ | ||
class ComponentCSS extends OfComponent | ||
{ | ||
/** | ||
* @param $component this belongs to | ||
* @param $source path relative to the components resource directory | ||
*/ | ||
public function __construct( | ||
\ILIAS\Component\Component $component, | ||
string $source, | ||
) { | ||
parent::__construct($component, $source, "assets/css"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
*********************************************************************/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ILIAS\Component\Resource; | ||
|
||
/** | ||
* This is a js file provided by some component. | ||
*/ | ||
class ComponentJS extends ComponentResource | ||
{ | ||
/** | ||
* @param $component this belongs to | ||
* @param $source path relative to the components resource directory | ||
*/ | ||
public function __construct( | ||
\ILIAS\Component\Component $component, | ||
string $source, | ||
) { | ||
parent::__construct($component, $source, "assets/js"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
*********************************************************************/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ILIAS\Component\Resource; | ||
|
||
/** | ||
* An endpoint is a PHP file that produces output via HTTP. These will be located | ||
* on the toplevel of the public folder. Fall back to ComponentResource if something | ||
* else is needed. | ||
*/ | ||
class Endpoint extends ComponentResource | ||
{ | ||
/** | ||
* @param $component this belongs to | ||
* @param $source path relative to the components resources directory | ||
* @param $target path relative to the ILIAS public directory, filename of resource will be appended. Use one dot for toplevel. Defaults to ".". | ||
*/ | ||
public function __construct( | ||
\ILIAS\Component\Component $component, | ||
string $source, | ||
string $target = "." | ||
) { | ||
parent::__construct($component, $source, $target); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
*********************************************************************/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ILIAS\Component\Resource; | ||
|
||
/** | ||
* An public asset that is a resource of some component. | ||
*/ | ||
class OfComponent implements PublicAsset | ||
{ | ||
public const REGEXP_SOURCE = '%^((\w+(/(\w|.)+)*\.\w{2,4})|(\.htaccess))$%'; | ||
public const REGEXP_TARGET = '%^((\w+(/(\w|.)+)*)|[.])$%'; | ||
|
||
/** | ||
* @param $component this belongs to | ||
* @param $source path relative to the components resources directory | ||
* @param $target path relative to the ILIAS public directory, filename of resource will be appended. Use one dot for toplevel. | ||
*/ | ||
public function __construct( | ||
protected \ILIAS\Component\Component $component, | ||
protected string $source, | ||
protected string $target, | ||
) { | ||
if (!preg_match(self::REGEXP_SOURCE, $this->source)) { | ||
throw new \InvalidArgumentException( | ||
"'{$this->source}' is not a valid source path for a public asset." | ||
); | ||
} | ||
if (!preg_match(self::REGEXP_TARGET, $this->target)) { | ||
throw new \InvalidArgumentException( | ||
"'{$this->target}' is not a valid target path for a public asset." | ||
); | ||
} | ||
} | ||
|
||
public function getSource(): string | ||
{ | ||
list($vendor, $component) = explode("\\", get_class($this->component)); | ||
|
||
return "components/$vendor/$component/resources/{$this->source}"; | ||
} | ||
|
||
public function getTarget(): string | ||
{ | ||
$source = explode("/", $this->source); | ||
if ($this->target === ".") { | ||
return array_pop($source); | ||
} | ||
return $this->target . "/" . array_pop($source); | ||
} | ||
} |
Oops, something went wrong.