1: <?php
2: /**
3: * This code is licensed under AGPLv3 license or Afterlogic Software License
4: * if commercial version of the product was purchased.
5: * For full statements of the licenses see LICENSE-AFTERLOGIC and LICENSE-AGPL3 files.
6: */
7:
8: namespace Aurora\System\Module;
9:
10: /**
11: * @license https://www.gnu.org/licenses/agpl-3.0.html AGPL-3.0
12: * @license https://afterlogic.com/products/common-licensing Afterlogic Software License
13: * @copyright Copyright (c) 2019, Afterlogic Corp.
14: *
15: * @package Api
16: */
17: abstract class AbstractLicensedModule extends AbstractModule
18: {
19: protected $isValid = null;
20:
21: public function __construct($sPath, $sVersion = '1.0')
22: {
23: parent::__construct($sPath, $sVersion);
24: $this->RequireModule('Licensing');
25: }
26:
27: public function isValid()
28: {
29: if (!isset($this->isValid)) {
30: $oLicensing = \Aurora\System\Api::GetModule('Licensing');
31: $this->isValid = $oLicensing ? ($oLicensing->Validate(self::GetName()) && $oLicensing->ValidatePeriod(self::GetName())) : false;
32: }
33:
34: return $this->isValid;
35: }
36: }
37: