@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | function dialog(): DialogManager |
| 20 | 20 | { |
| 21 | - return jaxon()->di()->g(DialogManager::class); |
|
| 21 | +return jaxon()->di()->g(DialogManager::class); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -26,63 +26,63 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | function _register(): void |
| 28 | 28 | { |
| 29 | - $jaxon = jaxon(); |
|
| 30 | - $xDi = $jaxon->di(); |
|
| 29 | +$jaxon = jaxon(); |
|
| 30 | +$xDi = $jaxon->di(); |
|
| 31 | 31 | |
| 32 | - // Dialog library manager |
|
| 33 | - $xDi->set(DialogManager::class, function($di) { |
|
| 34 | - // Register the template dir into the template renderer |
|
| 35 | - jaxon()->template()->addNamespace('jaxon::dialogs', dirname(__DIR__) . '/js'); |
|
| 32 | +// Dialog library manager |
|
| 33 | +$xDi->set(DialogManager::class, function($di) { |
|
| 34 | +// Register the template dir into the template renderer |
|
| 35 | +jaxon()->template()->addNamespace('jaxon::dialogs', dirname(__DIR__) . '/js'); |
|
| 36 | 36 | |
| 37 | - $xDialog = new DialogManager($di, $di->g(ConfigManager::class), $di->g(Translator::class)); |
|
| 38 | - // Register the provided libraries. |
|
| 39 | - $aLibraries = [ |
|
| 40 | - Dialog\Library\Alertify::class, // Alertify |
|
| 41 | - Dialog\Library\Bootbox::class, // Bootbox |
|
| 42 | - Dialog\Library\Bootstrap3::class, // Bootstrap 3 |
|
| 43 | - Dialog\Library\Bootstrap4::class, // Bootstrap 4 |
|
| 44 | - Dialog\Library\Bootstrap5::class, // Bootstrap 5 |
|
| 45 | - Dialog\Library\Toastr::class, // Toastr |
|
| 46 | - Dialog\Library\JAlert::class, // JAlert |
|
| 47 | - Dialog\Library\Tingle::class, // Tingle |
|
| 48 | - Dialog\Library\Noty::class, // Noty |
|
| 49 | - Dialog\Library\Notify::class, // Notify |
|
| 50 | - Dialog\Library\SweetAlert::class, // SweetAlert |
|
| 51 | - Dialog\Library\JQueryConfirm::class, // JQuery Confirm |
|
| 52 | - Dialog\Library\CuteAlert::class, // CuteAlert |
|
| 53 | - Dialog\Library\Notyf::class, // Notyf |
|
| 54 | - Dialog\Library\Quantum::class, // QuantumAlert |
|
| 55 | - Dialog\Library\Butterup::class, // Butterup |
|
| 56 | - Dialog\Library\IziToast::class, // IziToast |
|
| 57 | - ]; |
|
| 58 | - foreach($aLibraries as $sClass) |
|
| 59 | - { |
|
| 60 | - try |
|
| 61 | - { |
|
| 62 | - $xDialog->registerLibrary($sClass, $sClass::NAME); |
|
| 63 | - } |
|
| 64 | - catch(SetupException $_){} |
|
| 65 | - } |
|
| 37 | +$xDialog = new DialogManager($di, $di->g(ConfigManager::class), $di->g(Translator::class)); |
|
| 38 | +// Register the provided libraries. |
|
| 39 | +$aLibraries = [ |
|
| 40 | +Dialog\Library\Alertify::class, // Alertify |
|
| 41 | +Dialog\Library\Bootbox::class, // Bootbox |
|
| 42 | +Dialog\Library\Bootstrap3::class, // Bootstrap 3 |
|
| 43 | +Dialog\Library\Bootstrap4::class, // Bootstrap 4 |
|
| 44 | +Dialog\Library\Bootstrap5::class, // Bootstrap 5 |
|
| 45 | +Dialog\Library\Toastr::class, // Toastr |
|
| 46 | +Dialog\Library\JAlert::class, // JAlert |
|
| 47 | +Dialog\Library\Tingle::class, // Tingle |
|
| 48 | +Dialog\Library\Noty::class, // Noty |
|
| 49 | +Dialog\Library\Notify::class, // Notify |
|
| 50 | +Dialog\Library\SweetAlert::class, // SweetAlert |
|
| 51 | +Dialog\Library\JQueryConfirm::class, // JQuery Confirm |
|
| 52 | +Dialog\Library\CuteAlert::class, // CuteAlert |
|
| 53 | +Dialog\Library\Notyf::class, // Notyf |
|
| 54 | +Dialog\Library\Quantum::class, // QuantumAlert |
|
| 55 | +Dialog\Library\Butterup::class, // Butterup |
|
| 56 | +Dialog\Library\IziToast::class, // IziToast |
|
| 57 | +]; |
|
| 58 | +foreach($aLibraries as $sClass) |
|
| 59 | +{ |
|
| 60 | +try |
|
| 61 | +{ |
|
| 62 | + $xDialog->registerLibrary($sClass, $sClass::NAME); |
|
| 63 | +} |
|
| 64 | +catch(SetupException $_){} |
|
| 65 | +} |
|
| 66 | 66 | |
| 67 | - return $xDialog; |
|
| 68 | - }); |
|
| 67 | +return $xDialog; |
|
| 68 | +}); |
|
| 69 | 69 | |
| 70 | - $xDi->alias(LibraryRegistryInterface::class, DialogManager::class); |
|
| 71 | - $xDi->set(Alert::class, fn() => new Alert()); |
|
| 70 | +$xDi->alias(LibraryRegistryInterface::class, DialogManager::class); |
|
| 71 | +$xDi->set(Alert::class, fn() => new Alert()); |
|
| 72 | 72 | |
| 73 | - // Listener for app config changes. |
|
| 74 | - $jaxon->config()->addAppEventListener(DialogManager::class); |
|
| 75 | - // Register the plugin |
|
| 76 | - $jaxon->registerPlugin(DialogPlugin::class, DialogPlugin::NAME, 900); |
|
| 73 | +// Listener for app config changes. |
|
| 74 | +$jaxon->config()->addAppEventListener(DialogManager::class); |
|
| 75 | +// Register the plugin |
|
| 76 | +$jaxon->registerPlugin(DialogPlugin::class, DialogPlugin::NAME, 900); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | function register(): void |
| 80 | 80 | { |
| 81 | - // Do nothing if running in cli. |
|
| 82 | - if(php_sapi_name() !== 'cli') |
|
| 83 | - { |
|
| 84 | - _register(); |
|
| 85 | - }; |
|
| 81 | +// Do nothing if running in cli. |
|
| 82 | +if(php_sapi_name() !== 'cli') |
|
| 83 | +{ |
|
| 84 | +_register(); |
|
| 85 | +}; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | register(); |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | Dialog\Library\Butterup::class, // Butterup |
| 56 | 56 | Dialog\Library\IziToast::class, // IziToast |
| 57 | 57 | ]; |
| 58 | - foreach($aLibraries as $sClass) |
|
| 58 | + foreach ($aLibraries as $sClass) |
|
| 59 | 59 | { |
| 60 | 60 | try |
| 61 | 61 | { |
| 62 | 62 | $xDialog->registerLibrary($sClass, $sClass::NAME); |
| 63 | 63 | } |
| 64 | - catch(SetupException $_){} |
|
| 64 | + catch (SetupException $_) {} |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $xDialog; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | function register(): void |
| 80 | 80 | { |
| 81 | 81 | // Do nothing if running in cli. |
| 82 | - if(php_sapi_name() !== 'cli') |
|
| 82 | + if (php_sapi_name() !== 'cli') |
|
| 83 | 83 | { |
| 84 | 84 | _register(); |
| 85 | 85 | }; |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | try |
| 61 | 61 | { |
| 62 | 62 | $xDialog->registerLibrary($sClass, $sClass::NAME); |
| 63 | - } |
|
| 64 | - catch(SetupException $_){} |
|
| 63 | + } catch(SetupException $_){} |
|
| 65 | 64 | } |
| 66 | 65 | |
| 67 | 66 | return $xDialog; |
@@ -33,147 +33,147 @@ |
||
| 33 | 33 | |
| 34 | 34 | class DialogPlugin extends AbstractPlugin |
| 35 | 35 | { |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * @const The plugin name |
| 38 | 38 | */ |
| 39 | - public const NAME = 'dialog_code'; |
|
| 39 | +public const NAME = 'dialog_code'; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | +/** |
|
| 42 | 42 | * @var array |
| 43 | 43 | */ |
| 44 | - protected $aLibraries = null; |
|
| 44 | +protected $aLibraries = null; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 46 | +/** |
|
| 47 | 47 | * The constructor |
| 48 | 48 | * |
| 49 | 49 | * @param ConfigManager $xConfigManager |
| 50 | 50 | * @param Translator $xTranslator |
| 51 | 51 | * @param DialogManager $xDialogManager |
| 52 | 52 | */ |
| 53 | - public function __construct(private ConfigManager $xConfigManager, |
|
| 54 | - private Translator $xTranslator, private DialogManager $xDialogManager) |
|
| 55 | - {} |
|
| 53 | +public function __construct(private ConfigManager $xConfigManager, |
|
| 54 | +private Translator $xTranslator, private DialogManager $xDialogManager) |
|
| 55 | +{} |
|
| 56 | 56 | |
| 57 | - /** |
|
| 57 | +/** |
|
| 58 | 58 | * @inheritDoc |
| 59 | 59 | */ |
| 60 | - public function getName(): string |
|
| 61 | - { |
|
| 62 | - return self::NAME; |
|
| 63 | - } |
|
| 60 | +public function getName(): string |
|
| 61 | +{ |
|
| 62 | +return self::NAME; |
|
| 63 | +} |
|
| 64 | 64 | |
| 65 | - /** |
|
| 65 | +/** |
|
| 66 | 66 | * @inheritDoc |
| 67 | 67 | */ |
| 68 | - public function getHash(): string |
|
| 69 | - { |
|
| 70 | - // The version number is used as hash |
|
| 71 | - return '5.0.0'; |
|
| 72 | - } |
|
| 68 | +public function getHash(): string |
|
| 69 | +{ |
|
| 70 | +// The version number is used as hash |
|
| 71 | +return '5.0.0'; |
|
| 72 | +} |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | +/** |
|
| 75 | 75 | * @return AbstractLibrary[] |
| 76 | 76 | */ |
| 77 | - private function getLibraries(): array |
|
| 78 | - { |
|
| 79 | - return $this->aLibraries ?: $this->aLibraries = $this->xDialogManager->getLibraries(); |
|
| 80 | - } |
|
| 77 | +private function getLibraries(): array |
|
| 78 | +{ |
|
| 79 | +return $this->aLibraries ?: $this->aLibraries = $this->xDialogManager->getLibraries(); |
|
| 80 | +} |
|
| 81 | 81 | |
| 82 | - /** |
|
| 82 | +/** |
|
| 83 | 83 | * @return LibraryHelper[] |
| 84 | 84 | */ |
| 85 | - private function getHelpers(): array |
|
| 86 | - { |
|
| 87 | - return array_map(fn($xLibrary) => $xLibrary->helper(), $this->getLibraries()); |
|
| 88 | - } |
|
| 85 | +private function getHelpers(): array |
|
| 86 | +{ |
|
| 87 | +return array_map(fn($xLibrary) => $xLibrary->helper(), $this->getLibraries()); |
|
| 88 | +} |
|
| 89 | 89 | |
| 90 | - /** |
|
| 90 | +/** |
|
| 91 | 91 | * @param array $aCodes |
| 92 | 92 | * |
| 93 | 93 | * @return string |
| 94 | 94 | */ |
| 95 | - private function getCode(array $aCodes): string |
|
| 96 | - { |
|
| 97 | - $aCodes = array_filter($aCodes, fn($sScript) => $sScript !== ''); |
|
| 98 | - return implode("\n", $aCodes); |
|
| 99 | - } |
|
| 95 | +private function getCode(array $aCodes): string |
|
| 96 | +{ |
|
| 97 | +$aCodes = array_filter($aCodes, fn($sScript) => $sScript !== ''); |
|
| 98 | +return implode("\n", $aCodes); |
|
| 99 | +} |
|
| 100 | 100 | |
| 101 | - /** |
|
| 101 | +/** |
|
| 102 | 102 | * @param Closure $fGetCode |
| 103 | 103 | * |
| 104 | 104 | * @return string |
| 105 | 105 | */ |
| 106 | - private function getLibCodes(Closure $fGetCode): string |
|
| 107 | - { |
|
| 108 | - return $this->getCode(array_map($fGetCode, $this->getLibraries())); |
|
| 109 | - } |
|
| 106 | +private function getLibCodes(Closure $fGetCode): string |
|
| 107 | +{ |
|
| 108 | +return $this->getCode(array_map($fGetCode, $this->getLibraries())); |
|
| 109 | +} |
|
| 110 | 110 | |
| 111 | - /** |
|
| 111 | +/** |
|
| 112 | 112 | * @inheritDoc |
| 113 | 113 | */ |
| 114 | - public function getJs(): string |
|
| 115 | - { |
|
| 116 | - return $this->getLibCodes(fn($xLibrary) => trim($xLibrary->getJs())); |
|
| 117 | - } |
|
| 114 | +public function getJs(): string |
|
| 115 | +{ |
|
| 116 | +return $this->getLibCodes(fn($xLibrary) => trim($xLibrary->getJs())); |
|
| 117 | +} |
|
| 118 | 118 | |
| 119 | - /** |
|
| 119 | +/** |
|
| 120 | 120 | * @inheritDoc |
| 121 | 121 | */ |
| 122 | - public function getCss(): string |
|
| 123 | - { |
|
| 124 | - return $this->getLibCodes(fn($xLibrary) => trim($xLibrary->getCss())); |
|
| 125 | - } |
|
| 122 | +public function getCss(): string |
|
| 123 | +{ |
|
| 124 | +return $this->getLibCodes(fn($xLibrary) => trim($xLibrary->getCss())); |
|
| 125 | +} |
|
| 126 | 126 | |
| 127 | - /** |
|
| 127 | +/** |
|
| 128 | 128 | * @inheritDoc |
| 129 | 129 | */ |
| 130 | - public function getScript(): string |
|
| 131 | - { |
|
| 132 | - return $this->getLibCodes(fn($xLibrary) => trim($xLibrary->getScript())); |
|
| 133 | - } |
|
| 130 | +public function getScript(): string |
|
| 131 | +{ |
|
| 132 | +return $this->getLibCodes(fn($xLibrary) => trim($xLibrary->getScript())); |
|
| 133 | +} |
|
| 134 | 134 | |
| 135 | - /** |
|
| 135 | +/** |
|
| 136 | 136 | * @inheritDoc |
| 137 | 137 | */ |
| 138 | - private function getConfigScript(): string |
|
| 139 | - { |
|
| 140 | - $aOptions = [ |
|
| 141 | - 'labels' => $this->xTranslator->translations('labels'), |
|
| 142 | - 'defaults' => $this->xConfigManager->getAppOption('dialogs.default', []), |
|
| 143 | - ]; |
|
| 144 | - $aLibrariesOptions = []; |
|
| 145 | - foreach($this->getLibraries() as $xLibrary) |
|
| 146 | - { |
|
| 147 | - $aLibOptions = $xLibrary->helper()->getJsOptions(); |
|
| 148 | - if(count($aLibOptions) > 0) |
|
| 149 | - { |
|
| 150 | - $aLibrariesOptions[$xLibrary->getName()] = $aLibOptions; |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - if(count($aLibrariesOptions) > 0) |
|
| 154 | - { |
|
| 155 | - $aOptions['options'] = $aLibrariesOptions; |
|
| 156 | - } |
|
| 157 | - return "jaxon.dialog.config(" . json_encode($aOptions) . ");\n\n"; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 138 | +private function getConfigScript(): string |
|
| 139 | +{ |
|
| 140 | +$aOptions = [ |
|
| 141 | +'labels' => $this->xTranslator->translations('labels'), |
|
| 142 | +'defaults' => $this->xConfigManager->getAppOption('dialogs.default', []), |
|
| 143 | +]; |
|
| 144 | +$aLibrariesOptions = []; |
|
| 145 | +foreach($this->getLibraries() as $xLibrary) |
|
| 146 | +{ |
|
| 147 | +$aLibOptions = $xLibrary->helper()->getJsOptions(); |
|
| 148 | +if(count($aLibOptions) > 0) |
|
| 149 | +{ |
|
| 150 | + $aLibrariesOptions[$xLibrary->getName()] = $aLibOptions; |
|
| 151 | +} |
|
| 152 | +} |
|
| 153 | +if(count($aLibrariesOptions) > 0) |
|
| 154 | +{ |
|
| 155 | +$aOptions['options'] = $aLibrariesOptions; |
|
| 156 | +} |
|
| 157 | +return "jaxon.dialog.config(" . json_encode($aOptions) . ");\n\n"; |
|
| 158 | +} |
|
| 159 | + |
|
| 160 | +/** |
|
| 161 | 161 | * @inheritDoc |
| 162 | 162 | * @throws SetupException |
| 163 | 163 | */ |
| 164 | - public function getJsCode(): JsCode |
|
| 165 | - { |
|
| 166 | - $xJsCode = new JsCode(); |
|
| 167 | - $xJsCode->sJsBefore = $this->getConfigScript(); |
|
| 168 | - |
|
| 169 | - $aCodes = []; |
|
| 170 | - foreach($this->getHelpers() as $xHelper) |
|
| 171 | - { |
|
| 172 | - $aCodes[] = $xHelper->getScript(); |
|
| 173 | - $xJsCode->aFiles = array_merge($xJsCode->aFiles, $xHelper->getFiles()); |
|
| 174 | - } |
|
| 175 | - $xJsCode->sJs = $this->getCode($aCodes); |
|
| 176 | - |
|
| 177 | - return $xJsCode; |
|
| 178 | - } |
|
| 164 | +public function getJsCode(): JsCode |
|
| 165 | +{ |
|
| 166 | +$xJsCode = new JsCode(); |
|
| 167 | +$xJsCode->sJsBefore = $this->getConfigScript(); |
|
| 168 | + |
|
| 169 | +$aCodes = []; |
|
| 170 | +foreach($this->getHelpers() as $xHelper) |
|
| 171 | +{ |
|
| 172 | +$aCodes[] = $xHelper->getScript(); |
|
| 173 | +$xJsCode->aFiles = array_merge($xJsCode->aFiles, $xHelper->getFiles()); |
|
| 174 | +} |
|
| 175 | +$xJsCode->sJs = $this->getCode($aCodes); |
|
| 176 | + |
|
| 177 | +return $xJsCode; |
|
| 178 | +} |
|
| 179 | 179 | } |
@@ -142,15 +142,15 @@ discard block |
||
| 142 | 142 | 'defaults' => $this->xConfigManager->getAppOption('dialogs.default', []), |
| 143 | 143 | ]; |
| 144 | 144 | $aLibrariesOptions = []; |
| 145 | - foreach($this->getLibraries() as $xLibrary) |
|
| 145 | + foreach ($this->getLibraries() as $xLibrary) |
|
| 146 | 146 | { |
| 147 | 147 | $aLibOptions = $xLibrary->helper()->getJsOptions(); |
| 148 | - if(count($aLibOptions) > 0) |
|
| 148 | + if (count($aLibOptions) > 0) |
|
| 149 | 149 | { |
| 150 | 150 | $aLibrariesOptions[$xLibrary->getName()] = $aLibOptions; |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | - if(count($aLibrariesOptions) > 0) |
|
| 153 | + if (count($aLibrariesOptions) > 0) |
|
| 154 | 154 | { |
| 155 | 155 | $aOptions['options'] = $aLibrariesOptions; |
| 156 | 156 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $xJsCode->sJsBefore = $this->getConfigScript(); |
| 168 | 168 | |
| 169 | 169 | $aCodes = []; |
| 170 | - foreach($this->getHelpers() as $xHelper) |
|
| 170 | + foreach ($this->getHelpers() as $xHelper) |
|
| 171 | 171 | { |
| 172 | 172 | $aCodes[] = $xHelper->getScript(); |
| 173 | 173 | $xJsCode->aFiles = array_merge($xJsCode->aFiles, $xHelper->getFiles()); |
@@ -20,94 +20,94 @@ |
||
| 20 | 20 | |
| 21 | 21 | abstract class AbstractLibrary |
| 22 | 22 | { |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * The dialog library helper |
| 25 | 25 | * |
| 26 | 26 | * @var LibraryHelper |
| 27 | 27 | */ |
| 28 | - private $xHelper = null; |
|
| 28 | +private $xHelper = null; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 30 | +/** |
|
| 31 | 31 | * The css files |
| 32 | 32 | * |
| 33 | 33 | * @var array |
| 34 | 34 | */ |
| 35 | - protected $aCssFiles = []; |
|
| 35 | +protected $aCssFiles = []; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 37 | +/** |
|
| 38 | 38 | * The js files |
| 39 | 39 | * |
| 40 | 40 | * @var array |
| 41 | 41 | */ |
| 42 | - protected $aJsFiles = []; |
|
| 42 | +protected $aJsFiles = []; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | +/** |
|
| 45 | 45 | * Get the library name |
| 46 | 46 | * |
| 47 | 47 | * @return string |
| 48 | 48 | */ |
| 49 | - abstract public function getName(): string; |
|
| 49 | +abstract public function getName(): string; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 51 | +/** |
|
| 52 | 52 | * Get the helper |
| 53 | 53 | * |
| 54 | 54 | * @return LibraryHelper |
| 55 | 55 | */ |
| 56 | - public function helper(): LibraryHelper |
|
| 57 | - { |
|
| 58 | - return $this->xHelper ?: |
|
| 59 | - $this->xHelper = dialog()->getLibraryHelper($this->getName()); |
|
| 60 | - } |
|
| 56 | +public function helper(): LibraryHelper |
|
| 57 | +{ |
|
| 58 | +return $this->xHelper ?: |
|
| 59 | +$this->xHelper = dialog()->getLibraryHelper($this->getName()); |
|
| 60 | +} |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * Get the library base URI |
| 64 | 64 | * |
| 65 | 65 | * @return string |
| 66 | 66 | */ |
| 67 | - public function getUri(): string |
|
| 68 | - { |
|
| 69 | - return ''; |
|
| 70 | - } |
|
| 67 | +public function getUri(): string |
|
| 68 | +{ |
|
| 69 | +return ''; |
|
| 70 | +} |
|
| 71 | 71 | |
| 72 | - /** |
|
| 72 | +/** |
|
| 73 | 73 | * Get the CSS header code and file includes |
| 74 | 74 | * |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - public function getJs(): string |
|
| 78 | - { |
|
| 79 | - return $this->helper()->getJs($this->aJsFiles); |
|
| 80 | - } |
|
| 77 | +public function getJs(): string |
|
| 78 | +{ |
|
| 79 | +return $this->helper()->getJs($this->aJsFiles); |
|
| 80 | +} |
|
| 81 | 81 | |
| 82 | - /** |
|
| 82 | +/** |
|
| 83 | 83 | * Get the javascript header code and file includes |
| 84 | 84 | * |
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | - public function getCss(): string |
|
| 88 | - { |
|
| 89 | - return $this->helper()->getCss($this->aCssFiles); |
|
| 90 | - } |
|
| 87 | +public function getCss(): string |
|
| 88 | +{ |
|
| 89 | +return $this->helper()->getCss($this->aCssFiles); |
|
| 90 | +} |
|
| 91 | 91 | |
| 92 | - /** |
|
| 92 | +/** |
|
| 93 | 93 | * Get the javascript code to be printed into the page |
| 94 | 94 | * |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - public function getScript(): string |
|
| 98 | - { |
|
| 99 | - return ''; |
|
| 100 | - } |
|
| 97 | +public function getScript(): string |
|
| 98 | +{ |
|
| 99 | +return ''; |
|
| 100 | +} |
|
| 101 | 101 | |
| 102 | - /** |
|
| 102 | +/** |
|
| 103 | 103 | * Get the javascript code to be executed on page load |
| 104 | 104 | * |
| 105 | 105 | * @return JsCode|null |
| 106 | 106 | */ |
| 107 | - public function getJsCode(): ?JsCode |
|
| 108 | - { |
|
| 109 | - $xJsCode = new JsCode(); |
|
| 110 | - $xJsCode->sJs = $this->helper()->getScript(); |
|
| 111 | - return $xJsCode; |
|
| 112 | - } |
|
| 107 | +public function getJsCode(): ?JsCode |
|
| 108 | +{ |
|
| 109 | +$xJsCode = new JsCode(); |
|
| 110 | +$xJsCode->sJs = $this->helper()->getScript(); |
|
| 111 | +return $xJsCode; |
|
| 112 | +} |
|
| 113 | 113 | } |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function helper(): LibraryHelper |
| 57 | 57 | { |
| 58 | - return $this->xHelper ?: |
|
| 59 | - $this->xHelper = dialog()->getLibraryHelper($this->getName()); |
|
| 58 | + return $this->xHelper ?: $this->xHelper = dialog()->getLibraryHelper($this->getName()); |
|
| 60 | 59 | } |
| 61 | 60 | |
| 62 | 61 | /** |
@@ -19,38 +19,38 @@ |
||
| 19 | 19 | |
| 20 | 20 | class Tingle extends AbstractLibrary implements ModalInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @const The library name |
| 24 | 24 | */ |
| 25 | - public const NAME = 'tingle'; |
|
| 25 | +public const NAME = 'tingle'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * The css files |
| 29 | 29 | * |
| 30 | 30 | * @var array |
| 31 | 31 | */ |
| 32 | - protected $aCssFiles = ['tingle.min.css']; |
|
| 32 | +protected $aCssFiles = ['tingle.min.css']; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * The js files |
| 36 | 36 | * |
| 37 | 37 | * @var array |
| 38 | 38 | */ |
| 39 | - protected $aJsFiles = ['tingle.min.js']; |
|
| 39 | +protected $aJsFiles = ['tingle.min.js']; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | +/** |
|
| 42 | 42 | * @inheritDoc |
| 43 | 43 | */ |
| 44 | - public function getName(): string |
|
| 45 | - { |
|
| 46 | - return self::NAME; |
|
| 47 | - } |
|
| 44 | +public function getName(): string |
|
| 45 | +{ |
|
| 46 | +return self::NAME; |
|
| 47 | +} |
|
| 48 | 48 | |
| 49 | - /** |
|
| 49 | +/** |
|
| 50 | 50 | * @inheritDoc |
| 51 | 51 | */ |
| 52 | - public function getUri(): string |
|
| 53 | - { |
|
| 54 | - return 'https://cdn.jsdelivr.net/npm/[email protected]/dist'; |
|
| 55 | - } |
|
| 52 | +public function getUri(): string |
|
| 53 | +{ |
|
| 54 | +return 'https://cdn.jsdelivr.net/npm/[email protected]/dist'; |
|
| 55 | +} |
|
| 56 | 56 | } |
@@ -19,16 +19,16 @@ |
||
| 19 | 19 | |
| 20 | 20 | class Bootstrap4 extends AbstractLibrary implements ModalInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @const The library name |
| 24 | 24 | */ |
| 25 | - public const NAME = 'bootstrap4'; |
|
| 25 | +public const NAME = 'bootstrap4'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * @inheritDoc |
| 29 | 29 | */ |
| 30 | - public function getName(): string |
|
| 31 | - { |
|
| 32 | - return self::NAME; |
|
| 33 | - } |
|
| 30 | +public function getName(): string |
|
| 31 | +{ |
|
| 32 | +return self::NAME; |
|
| 33 | +} |
|
| 34 | 34 | } |
@@ -19,31 +19,31 @@ |
||
| 19 | 19 | |
| 20 | 20 | class Notify extends AbstractLibrary implements AlertInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @const The library name |
| 24 | 24 | */ |
| 25 | - public const NAME = 'notify'; |
|
| 25 | +public const NAME = 'notify'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * The js files |
| 29 | 29 | * |
| 30 | 30 | * @var array |
| 31 | 31 | */ |
| 32 | - protected $aJsFiles = ['notify.min.js']; |
|
| 32 | +protected $aJsFiles = ['notify.min.js']; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @inheritDoc |
| 36 | 36 | */ |
| 37 | - public function getName(): string |
|
| 38 | - { |
|
| 39 | - return self::NAME; |
|
| 40 | - } |
|
| 37 | +public function getName(): string |
|
| 38 | +{ |
|
| 39 | +return self::NAME; |
|
| 40 | +} |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | +/** |
|
| 43 | 43 | * @inheritDoc |
| 44 | 44 | */ |
| 45 | - public function getUri(): string |
|
| 46 | - { |
|
| 47 | - return 'https://cdn.jsdelivr.net/npm/[email protected]'; |
|
| 48 | - } |
|
| 45 | +public function getUri(): string |
|
| 46 | +{ |
|
| 47 | +return 'https://cdn.jsdelivr.net/npm/[email protected]'; |
|
| 48 | +} |
|
| 49 | 49 | } |
@@ -21,52 +21,52 @@ |
||
| 21 | 21 | |
| 22 | 22 | class Alertify extends AbstractLibrary implements ModalInterface, AlertInterface, ConfirmInterface |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @const The library name |
| 26 | 26 | */ |
| 27 | - public const NAME = 'alertify'; |
|
| 27 | +public const NAME = 'alertify'; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * The css files |
| 31 | 31 | * |
| 32 | 32 | * @var array |
| 33 | 33 | */ |
| 34 | - protected $aCssFiles = ['css/alertify.min.css', 'css/themes/default.min.css']; |
|
| 34 | +protected $aCssFiles = ['css/alertify.min.css', 'css/themes/default.min.css']; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * The js files |
| 38 | 38 | * |
| 39 | 39 | * @var array |
| 40 | 40 | */ |
| 41 | - protected $aJsFiles = ['alertify.min.js']; |
|
| 41 | +protected $aJsFiles = ['alertify.min.js']; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * @inheritDoc |
| 45 | 45 | */ |
| 46 | - public function getName(): string |
|
| 47 | - { |
|
| 48 | - return self::NAME; |
|
| 49 | - } |
|
| 46 | +public function getName(): string |
|
| 47 | +{ |
|
| 48 | +return self::NAME; |
|
| 49 | +} |
|
| 50 | 50 | |
| 51 | - /** |
|
| 51 | +/** |
|
| 52 | 52 | * @inheritDoc |
| 53 | 53 | */ |
| 54 | - public function getUri(): string |
|
| 55 | - { |
|
| 56 | - return 'https://cdn.jsdelivr.net/npm/[email protected]/build'; |
|
| 57 | - } |
|
| 54 | +public function getUri(): string |
|
| 55 | +{ |
|
| 56 | +return 'https://cdn.jsdelivr.net/npm/[email protected]/build'; |
|
| 57 | +} |
|
| 58 | 58 | |
| 59 | - /** |
|
| 59 | +/** |
|
| 60 | 60 | * @inheritDoc |
| 61 | 61 | */ |
| 62 | - public function getCss(): string |
|
| 63 | - { |
|
| 64 | - return parent::getCss() . ' |
|
| 62 | +public function getCss(): string |
|
| 63 | +{ |
|
| 64 | +return parent::getCss() . ' |
|
| 65 | 65 | <style> |
| 66 | 66 | .ajs-footer .ajs-buttons .btn { |
| 67 | 67 | margin-right: 10px; |
| 68 | 68 | } |
| 69 | 69 | </style> |
| 70 | 70 | '; |
| 71 | - } |
|
| 71 | +} |
|
| 72 | 72 | } |
@@ -20,31 +20,31 @@ |
||
| 20 | 20 | |
| 21 | 21 | class Quantum extends AbstractLibrary implements AlertInterface, ConfirmInterface |
| 22 | 22 | { |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * @const The library name |
| 25 | 25 | */ |
| 26 | - public const NAME = 'quantum'; |
|
| 26 | +public const NAME = 'quantum'; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 28 | +/** |
|
| 29 | 29 | * The js files |
| 30 | 30 | * |
| 31 | 31 | * @var array |
| 32 | 32 | */ |
| 33 | - protected $aJsFiles = ['minfile/quantumalert.js']; |
|
| 33 | +protected $aJsFiles = ['minfile/quantumalert.js']; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 35 | +/** |
|
| 36 | 36 | * @inheritDoc |
| 37 | 37 | */ |
| 38 | - public function getName(): string |
|
| 39 | - { |
|
| 40 | - return self::NAME; |
|
| 41 | - } |
|
| 38 | +public function getName(): string |
|
| 39 | +{ |
|
| 40 | +return self::NAME; |
|
| 41 | +} |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * @inheritDoc |
| 45 | 45 | */ |
| 46 | - public function getUri(): string |
|
| 47 | - { |
|
| 48 | - return 'https://cdn.jsdelivr.net/gh/cosmogicofficial/quantumalert@latest'; |
|
| 49 | - } |
|
| 46 | +public function getUri(): string |
|
| 47 | +{ |
|
| 48 | +return 'https://cdn.jsdelivr.net/gh/cosmogicofficial/quantumalert@latest'; |
|
| 49 | +} |
|
| 50 | 50 | } |
@@ -19,38 +19,38 @@ |
||
| 19 | 19 | |
| 20 | 20 | class Toastr extends AbstractLibrary implements AlertInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @const The library name |
| 24 | 24 | */ |
| 25 | - public const NAME = 'toastr'; |
|
| 25 | +public const NAME = 'toastr'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * The css files |
| 29 | 29 | * |
| 30 | 30 | * @var array |
| 31 | 31 | */ |
| 32 | - protected $aCssFiles = ['build/toastr.min.css']; |
|
| 32 | +protected $aCssFiles = ['build/toastr.min.css']; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * The js files |
| 36 | 36 | * |
| 37 | 37 | * @var array |
| 38 | 38 | */ |
| 39 | - protected $aJsFiles = ['toastr.min.js']; |
|
| 39 | +protected $aJsFiles = ['toastr.min.js']; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | +/** |
|
| 42 | 42 | * @inheritDoc |
| 43 | 43 | */ |
| 44 | - public function getName(): string |
|
| 45 | - { |
|
| 46 | - return self::NAME; |
|
| 47 | - } |
|
| 44 | +public function getName(): string |
|
| 45 | +{ |
|
| 46 | +return self::NAME; |
|
| 47 | +} |
|
| 48 | 48 | |
| 49 | - /** |
|
| 49 | +/** |
|
| 50 | 50 | * @inheritDoc |
| 51 | 51 | */ |
| 52 | - public function getUri(): string |
|
| 53 | - { |
|
| 54 | - return 'https://cdn.jsdelivr.net/npm/[email protected]'; |
|
| 55 | - } |
|
| 52 | +public function getUri(): string |
|
| 53 | +{ |
|
| 54 | +return 'https://cdn.jsdelivr.net/npm/[email protected]'; |
|
| 55 | +} |
|
| 56 | 56 | } |