Bearsampp 2026.7.11
Loading...
Searching...
No Matches
class.tpl.app.tools.php
Go to the documentation of this file.
1<?php
2/*
3 *
4 * * Copyright (c) 2021-2024 Bearsampp
5 * * License: GNU General Public License version 3 or later; see LICENSE.txt
6 * * Website: https://bearsampp.com
7 * * Github: https://github.com/Bearsampp
8 *
9 */
10
19{
20 // Constants for menu and action identifiers
21 const MENU = 'tools';
22 const ACTION_MAKE_ROOT_CA = 'makeRootCA';
23 const ACTION_GEN_SSL_CERTIFICATE = 'genSslCertificate';
24 const ACTION_DEL_SSL_CERTIFICATE = 'delSslCertificate';
25
33 public static function process()
34 {
35 global $bearsamppLang;
36
37 return TplApp::getMenu($bearsamppLang->getValue(Lang::TOOLS), self::MENU, get_called_class());
38 }
39
49 public static function getMenuTools()
50 {
52 $resultItems = $resultActions = '';
53
54 // Git
55 $tplGit = TplAppGit::process();
56 $resultItems .= $tplGit[TplApp::SECTION_CALL] . PHP_EOL;
57 $resultActions .= $tplGit[TplApp::SECTION_CONTENT] . PHP_EOL;
58
59 // Python
60 $tplPython = TplAppPython::process();
61 $resultItems .= $tplPython[TplApp::SECTION_CALL] . PHP_EOL;
62 $resultActions .= $tplPython[TplApp::SECTION_CONTENT] . PHP_EOL;
63
64 // Bruno postman IDE
65 $resultItems .= TplAestan::getItemExe(
66 $bearsamppLang->getValue(Lang::BRUNO),
67 $bearsamppTools->getBruno()->getExe(),
69 ) . PHP_EOL;
70
71 // Composer
72 $resultItems .= TplAestan::getItemPowerShell(
75 null,
76 $bearsamppTools->getPowerShell()->getTabTitleComposer(),
78 null
79 ) . PHP_EOL;
80
81 // Ghostscript
82 $resultItems .= TplAestan::getItemPowerShell(
85 null,
86 $bearsamppTools->getPowerShell()->getTabTitleGhostscript(),
88 null
89 ) . PHP_EOL;
90
91 // Ngrok
92 $resultItems .= TplAestan::getItemPowerShell(
93 $bearsamppLang->getValue(Lang::NGROK),
95 null,
96 $bearsamppTools->getPowerShell()->getTabTitleNgrok(),
98 null
99 ) . PHP_EOL;
100
101 // Pear
102 $resultItems .= TplAestan::getItemPowerShell(
103 $bearsamppLang->getValue(Lang::PEAR),
105 null,
106 $bearsamppTools->getPowerShell()->getTabTitlePear(),
107 Path::getModuleSymlinkPath($bearsamppBins->getPhp()) . '/pear',
108 null
109 ) . PHP_EOL;
110
111 // Perl
112 $resultItems .= TplAestan::getItemPowerShell(
113 $bearsamppLang->getValue(Lang::PERL),
115 null,
116 $bearsamppTools->getPowerShell()->getTabTitlePerl(),
118 null
119 ) . PHP_EOL;
120
121 // Ruby
122 $resultItems .= TplAestan::getItemPowerShell(
123 $bearsamppLang->getValue(Lang::RUBY),
125 null,
126 $bearsamppTools->getPowerShell()->getTabTitleRuby(),
128 null
129 ) . PHP_EOL;
130
131 // Line Separator
132 $resultItems .= TplAestan::getItemSeparator() . PHP_EOL;
133
134 // Console
135 $resultItems .= TplAestan::getItemPowerShell(
136 $bearsamppLang->getValue(Lang::CONSOLE),
138 null,
139 $bearsamppTools->getPowerShell()->getTabTitleDefault(),
141 ) . PHP_EOL;
142
143 // HostsEditor
144 $resultItems .= TplAestan::getItemExe(
148 ) . PHP_EOL;
149
150 // Pwgen password manager
151 $resultItems .= TplAestan::getItemExe(
152 $bearsamppLang->getValue(Lang::PWGEN),
155 ) . PHP_EOL;
156
157 // Line Separator
158 $resultItems .= TplAestan::getItemSeparator() . PHP_EOL;
159
160 // Generate rootCA certificate
161 $tplMakeRootCa = TplApp::getActionMulti(
162 self::ACTION_MAKE_ROOT_CA, null,
164 false, get_called_class()
165 );
166 $resultItems .= $tplMakeRootCa[TplApp::SECTION_CALL] . PHP_EOL;
167 $resultActions .= $tplMakeRootCa[TplApp::SECTION_CONTENT] . PHP_EOL;
168
169 // Generate SSL Certificate
170 $tplGenSslCertificate = TplApp::getActionMulti(
171 self::ACTION_GEN_SSL_CERTIFICATE, null,
173 false, get_called_class()
174 );
175 $resultItems .= $tplGenSslCertificate[TplApp::SECTION_CALL] . PHP_EOL;
176 $resultActions .= $tplGenSslCertificate[TplApp::SECTION_CONTENT] . PHP_EOL;
177
178 // Delete SSL Certificate
179 $tplDelSslCertificate = TplApp::getActionMulti(
180 self::ACTION_DEL_SSL_CERTIFICATE, null,
182 false, get_called_class()
183 );
184 $resultItems .= $tplDelSslCertificate[TplApp::SECTION_CALL] . PHP_EOL;
185 $resultActions .= $tplDelSslCertificate[TplApp::SECTION_CONTENT];
186
187 return $resultItems . PHP_EOL . $resultActions;
188 }
189
195 public static function getActionMakeRootCa()
196 {
198 }
199
205 public static function getActionGenSslCertificate()
206 {
208 }
209
215 public static function getActionDelSslCertificate()
216 {
218 }
219}
global $bearsamppBins
global $bearsamppLang
global $bearsamppRoot
global $bearsamppCore
const DEL_SSL_CERTIFICATE
const MAKE_ROOT_CA
const GEN_SSL_CERTIFICATE
const COMPOSER
const GHOSTSCRIPT
const RUBY
const BRUNO
const CONSOLE
const NGROK
const MENU_GEN_SSL_CERTIFICATE
const HOSTSEDITOR
const TOOLS
const PWGEN
const PEAR
const PERL
const MENU_GEN_ROOT_CA
const DELSSL_TITLE
static getHostsEditorExe($aetrayPath=false)
static getRootPath($aetrayPath=false)
static getWwwPath($aetrayPath=false)
static getModuleSymlinkPath($module)
static getPwgenExe($aetrayPath=false)
static getItemPowerShell($caption, $glyph, $id=null, $title=null, $initDir=null, $command=null)
static getItemExe($caption, $exe, $glyph, $params=null)
const GLYPH_POWERSHELL
const GLYPH_GHOSTSCRIPT
const GLYPH_HOSTSEDITOR
const GLYPH_SSL_CERTIFICATE
static getItemSeparator()
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
static getMenu($caption, $menu, $class)
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)
const SECTION_CALL
const SECTION_CONTENT
static getActionMakeRootCa()
static getActionGenSslCertificate()
static getActionDelSslCertificate()
const ACTION_DEL_SSL_CERTIFICATE
const ACTION_GEN_SSL_CERTIFICATE