2024.8.23
Loading...
Searching...
No Matches
ToolConsoleZ Class Reference
+ Inheritance diagram for ToolConsoleZ:
+ Collaboration diagram for ToolConsoleZ:

Public Member Functions

 __construct ($id, $type)
 
 getCols ()
 
 getConf ()
 
 getExe ()
 
 getLaunchExe ()
 
 getRows ()
 
 getShell ($args=null)
 
 getTabTitleComposer ()
 
 getTabTitleDefault ()
 
 getTabTitleGhostscript ()
 
 getTabTitleGit ($repoPath=null)
 
 getTabTitleMariadb ()
 
 getTabTitleMysql ()
 
 getTabTitleNgrok ()
 
 getTabTitleNodejs ()
 
 getTabTitlePear ()
 
 getTabTitlePerl ()
 
 getTabTitlePostgresql ()
 
 getTabTitlePowershell ()
 
 getTabTitlePython ()
 
 getTabTitleRuby ()
 
 getTabTitleYarn ()
 
 reload ($id=null, $type=null)
 
 setVersion ($version)
 
- Public Member Functions inherited from Module
 __toString ()
 
 getCurrentPath ()
 
 getId ()
 
 getName ()
 
 getRelease ()
 
 getRootPath ()
 
 getSymlinkPath ()
 
 getType ()
 
 getVersion ()
 
 getVersionList ()
 
 isEnable ()
 
 update ($sub=0, $showWindow=false)
 

Data Fields

const LOCAL_CFG_COLS = 'consolezCols'
 
const LOCAL_CFG_CONF = 'consolezConf'
 
const LOCAL_CFG_EXE = 'consolezExe'
 
const LOCAL_CFG_LAUNCH_EXE = 'consolezLaunchExe'
 
const LOCAL_CFG_ROWS = 'consolezRows'
 
const ROOT_CFG_VERSION = 'consolezVersion'
 
- Data Fields inherited from Module
const BUNDLE_RELEASE = 'bundleRelease'
 

Private Attributes

 $cols
 
 $conf
 
 $exe
 
 $launchExe
 
 $rows
 

Additional Inherited Members

- Protected Member Functions inherited from Module
 __construct ()
 
 replace ($key, $value)
 
 replaceAll ($params)
 
 updateConfig ($version=null, $sub=0, $showWindow=false)
 
- Protected Attributes inherited from Module
 $bearsamppConf
 
 $bearsamppConfRaw
 
 $currentPath
 
 $enable
 
 $name
 
 $release = 'N/A'
 
 $rootPath
 
 $symlinkPath
 
 $version
 

Detailed Description

Class ToolConsoleZ

This class represents the ConsoleZ tool in the Bearsampp application. It extends the Module class and provides functionalities specific to ConsoleZ.

Definition at line 16 of file class.tool.consolez.php.

Constructor & Destructor Documentation

◆ __construct()

ToolConsoleZ::__construct ( $id,
$type )

Constructor for the ToolConsoleZ class.

Parameters
string$idThe ID of the module.
string$typeThe type of the module.

Definition at line 38 of file class.tool.consolez.php.

38 {
39 Util::logInitClass($this);
40 $this->reload($id, $type);
41 }
reload($id=null, $type=null)
static logInitClass($classInstance)

References Module\$id, Module\$type, Util\logInitClass(), and reload().

Member Function Documentation

◆ getCols()

ToolConsoleZ::getCols ( )

Gets the number of columns for the ConsoleZ window.

Returns
int The number of columns.

Definition at line 149 of file class.tool.consolez.php.

149 {
150 return $this->cols;
151 }

References $cols.

◆ getConf()

ToolConsoleZ::getConf ( )

Gets the configuration file path for ConsoleZ.

Returns
string The configuration file path.

Definition at line 131 of file class.tool.consolez.php.

131 {
132 return $this->conf;
133 }

References $conf.

◆ getExe()

ToolConsoleZ::getExe ( )

Gets the executable path for ConsoleZ.

Returns
string The executable path.

Definition at line 113 of file class.tool.consolez.php.

113 {
114 return $this->exe;
115 }

References $exe.

◆ getLaunchExe()

ToolConsoleZ::getLaunchExe ( )

Gets the launch executable path for ConsoleZ.

Returns
string The launch executable path.

Definition at line 122 of file class.tool.consolez.php.

122 {
123 return $this->launchExe;
124 }

References $launchExe.

Referenced by getShell().

+ Here is the caller graph for this function:

◆ getRows()

ToolConsoleZ::getRows ( )

Gets the number of rows for the ConsoleZ window.

Returns
int The number of rows.

Definition at line 140 of file class.tool.consolez.php.

140 {
141 return $this->rows;
142 }

References $rows.

◆ getShell()

ToolConsoleZ::getShell ( $args = null)

Gets the shell command to launch ConsoleZ.

Parameters
string | null$argsAdditional arguments for the shell command.
Returns
string The shell command.

Definition at line 159 of file class.tool.consolez.php.

159 {
160 if (empty($args)) {
161 return 'cmd /k "' . Util::formatWindowsPath($this->launchExe) . '"';
162 } else {
163 return 'cmd /k ""' . Util::formatWindowsPath($this->getLaunchExe()) . '" & ' . Util::formatWindowsPath($args) . '"';
164 }
165 }
static formatWindowsPath($path)

References Util\formatWindowsPath(), and getLaunchExe().

◆ getTabTitleComposer()

ToolConsoleZ::getTabTitleComposer ( )

Gets the tab title for Composer.

Returns
string The tab title for Composer.

Definition at line 256 of file class.tool.consolez.php.

256 {
257 global $bearsamppLang, $bearsamppTools;
258 return $bearsamppLang->getValue(Lang::COMPOSER) . ' ' . $bearsamppTools->getComposer()->getVersion();
259 }
global $bearsamppLang
const COMPOSER

References $bearsamppLang, and Lang\COMPOSER.

◆ getTabTitleDefault()

ToolConsoleZ::getTabTitleDefault ( )

Gets the default tab title for ConsoleZ.

Returns
string The default tab title.

Definition at line 172 of file class.tool.consolez.php.

172 {
173 global $bearsamppLang;
174 return $bearsamppLang->getValue(Lang::CONSOLE);
175 }
const CONSOLE

References $bearsamppLang, and Lang\CONSOLE.

◆ getTabTitleGhostscript()

ToolConsoleZ::getTabTitleGhostscript ( )

Gets the tab title for Ghostscript.

Returns
string The tab title for Ghostscript.

Definition at line 306 of file class.tool.consolez.php.

306 {
307 global $bearsamppLang, $bearsamppTools;
308 return $bearsamppLang->getValue(Lang::GHOSTSCRIPT) . ' ' . $bearsamppTools->getGhostscript()->getVersion();
309 }
const GHOSTSCRIPT

References $bearsamppLang, and Lang\GHOSTSCRIPT.

◆ getTabTitleGit()

ToolConsoleZ::getTabTitleGit ( $repoPath = null)

Gets the tab title for Git.

Parameters
string | null$repoPathThe repository path.
Returns
string The tab title for Git.

Definition at line 232 of file class.tool.consolez.php.

232 {
233 global $bearsamppLang, $bearsamppTools;
234 $result = $bearsamppLang->getValue(Lang::GIT) . ' ' . $bearsamppTools->getGit()->getVersion();
235 if ($repoPath != null) {
236 $result .= ' - ' . basename($repoPath);
237 }
238 return $result;
239 }
$result
const GIT

References $bearsamppLang, $result, and Lang\GIT.

◆ getTabTitleMariadb()

ToolConsoleZ::getTabTitleMariadb ( )

Gets the tab title for MariaDB.

Returns
string The tab title for MariaDB.

Definition at line 211 of file class.tool.consolez.php.

211 {
213 return $bearsamppLang->getValue(Lang::MARIADB) . ' ' . $bearsamppBins->getMariadb()->getVersion();
214 }
global $bearsamppBins
const MARIADB

References $bearsamppBins, $bearsamppLang, and Lang\MARIADB.

◆ getTabTitleMysql()

ToolConsoleZ::getTabTitleMysql ( )

Gets the tab title for MySQL.

Returns
string The tab title for MySQL.

Definition at line 201 of file class.tool.consolez.php.

201 {
203 return $bearsamppLang->getValue(Lang::MYSQL) . ' ' . $bearsamppBins->getMysql()->getVersion();
204 }
const MYSQL

References $bearsamppBins, $bearsamppLang, and Lang\MYSQL.

◆ getTabTitleNgrok()

ToolConsoleZ::getTabTitleNgrok ( )

Gets the tab title for Ngrok.

Returns
string The tab title for Ngrok.

Definition at line 316 of file class.tool.consolez.php.

316 {
317 global $bearsamppLang, $bearsamppTools;
318 return $bearsamppLang->getValue(Lang::NGROK) . ' ' . $bearsamppTools->getNgrok()->getVersion();
319 }
const NGROK

References $bearsamppLang, and Lang\NGROK.

◆ getTabTitleNodejs()

ToolConsoleZ::getTabTitleNodejs ( )

Gets the tab title for Node.js.

Returns
string The tab title for Node.js.

Definition at line 246 of file class.tool.consolez.php.

246 {
248 return $bearsamppLang->getValue(Lang::NODEJS) . ' ' . $bearsamppBins->getNodejs()->getVersion();
249 }
const NODEJS

References $bearsamppBins, $bearsamppLang, and Lang\NODEJS.

◆ getTabTitlePear()

ToolConsoleZ::getTabTitlePear ( )

Gets the tab title for PEAR.

Returns
string The tab title for PEAR.

Definition at line 191 of file class.tool.consolez.php.

191 {
193 return $bearsamppLang->getValue(Lang::PEAR) . ' ' . $bearsamppBins->getPhp()->getPearVersion(true);
194 }
const PEAR

References $bearsamppBins, $bearsamppLang, and Lang\PEAR.

◆ getTabTitlePerl()

ToolConsoleZ::getTabTitlePerl ( )

Gets the tab title for Perl.

Returns
string The tab title for Perl.

Definition at line 296 of file class.tool.consolez.php.

296 {
297 global $bearsamppLang, $bearsamppTools;
298 return $bearsamppLang->getValue(Lang::PERL) . ' ' . $bearsamppTools->getPerl()->getVersion();
299 }
const PERL

References $bearsamppLang, and Lang\PERL.

◆ getTabTitlePostgresql()

ToolConsoleZ::getTabTitlePostgresql ( )

Gets the tab title for PostgreSQL.

Returns
string The tab title for PostgreSQL.

Definition at line 221 of file class.tool.consolez.php.

221 {
223 return $bearsamppLang->getValue(Lang::POSTGRESQL) . ' ' . $bearsamppBins->getPostgresql()->getVersion();
224 }
const POSTGRESQL

References $bearsamppBins, $bearsamppLang, and Lang\POSTGRESQL.

◆ getTabTitlePowershell()

ToolConsoleZ::getTabTitlePowershell ( )

Gets the tab title for PowerShell.

Returns
string The tab title for PowerShell.

Definition at line 182 of file class.tool.consolez.php.

182 {
183 return 'PowerShell';
184 }

◆ getTabTitlePython()

ToolConsoleZ::getTabTitlePython ( )

Gets the tab title for Python.

Returns
string The tab title for Python.

Definition at line 266 of file class.tool.consolez.php.

266 {
267 global $bearsamppLang, $bearsamppTools;
268 return $bearsamppLang->getValue(Lang::PYTHON) . ' ' . $bearsamppTools->getPython()->getVersion();
269 }
const PYTHON

References $bearsamppLang, and Lang\PYTHON.

◆ getTabTitleRuby()

ToolConsoleZ::getTabTitleRuby ( )

Gets the tab title for Ruby.

Returns
string The tab title for Ruby.

Definition at line 276 of file class.tool.consolez.php.

276 {
277 global $bearsamppLang, $bearsamppTools;
278 return $bearsamppLang->getValue(Lang::RUBY) . ' ' . $bearsamppTools->getRuby()->getVersion();
279 }
const RUBY

References $bearsamppLang, and Lang\RUBY.

◆ getTabTitleYarn()

ToolConsoleZ::getTabTitleYarn ( )

Gets the tab title for Yarn.

Returns
string The tab title for Yarn.

Definition at line 286 of file class.tool.consolez.php.

286 {
287 global $bearsamppLang, $bearsamppTools;
288 return $bearsamppLang->getValue(Lang::YARN) . ' ' . $bearsamppTools->getYarn()->getVersion();
289 }
const YARN

References $bearsamppLang, and Lang\YARN.

◆ reload()

ToolConsoleZ::reload ( $id = null,
$type = null )

Reloads the configuration for the ConsoleZ tool.

Parameters
string | null$idThe ID of the module. If null, the current ID is used.
string | null$typeThe type of the module. If null, the current type is used.

Reimplemented from Module.

Definition at line 49 of file class.tool.consolez.php.

49 {
52
53 $this->name = $bearsamppLang->getValue(Lang::CONSOLEZ);
54 $this->version = $bearsamppConfig->getRaw(self::ROOT_CFG_VERSION);
55 parent::reload($id, $type);
56
57 if ($this->bearsamppConfRaw !== false) {
58 $this->exe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
59 $this->launchExe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_LAUNCH_EXE];
60 $this->conf = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_CONF];
61 $this->rows = intval($this->bearsamppConfRaw[self::LOCAL_CFG_ROWS]);
62 $this->cols = intval($this->bearsamppConfRaw[self::LOCAL_CFG_COLS]);
63 }
64
65 if (!$this->enable) {
66 Util::logInfo($this->name . ' is not enabled!');
67 return;
68 }
69 if (!is_dir($this->currentPath)) {
70 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
71 }
72 if (!is_dir($this->symlinkPath)) {
73 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
74 return;
75 }
76 if (!is_file($this->bearsamppConf)) {
77 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
78 }
79 if (!is_file($this->exe)) {
80 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
81 }
82 if (!is_file($this->launchExe)) {
83 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->launchExe));
84 }
85 if (!is_file($this->conf)) {
86 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->conf));
87 }
88 if (!is_numeric($this->rows) || $this->rows <= 0) {
89 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_INVALID_PARAMETER), self::LOCAL_CFG_ROWS, $this->rows));
90 }
91 if (!is_numeric($this->cols) || $this->cols <= 0) {
92 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_INVALID_PARAMETER), self::LOCAL_CFG_COLS, $this->cols));
93 }
94 }
const CONSOLEZ
const ERROR_FILE_NOT_FOUND
const ERROR_INVALID_PARAMETER
const ERROR_CONF_NOT_FOUND
const ERROR_EXE_NOT_FOUND
static logReloadClass($classInstance)
static logError($data, $file=null)
static logInfo($data, $file=null)
global $bearsamppConfig
Definition homepage.php:26

References $bearsamppConfig, $bearsamppLang, Module\$id, Module\$type, Lang\CONSOLEZ, Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, Lang\ERROR_INVALID_PARAMETER, LOCAL_CFG_CONF, LOCAL_CFG_EXE, LOCAL_CFG_LAUNCH_EXE, Util\logError(), Util\logInfo(), and Util\logReloadClass().

Referenced by __construct(), and setVersion().

+ Here is the caller graph for this function:

◆ setVersion()

ToolConsoleZ::setVersion ( $version)

Sets the version of the ConsoleZ tool.

Parameters
string$versionThe version to set.

Reimplemented from Module.

Definition at line 101 of file class.tool.consolez.php.

101 {
102 global $bearsamppConfig;
103 $this->version = $version;
104 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
105 $this->reload();
106 }

References $bearsamppConfig, Module\$version, and reload().

Field Documentation

◆ $cols

ToolConsoleZ::$cols
private

Definition at line 30 of file class.tool.consolez.php.

Referenced by getCols().

◆ $conf

ToolConsoleZ::$conf
private

Definition at line 28 of file class.tool.consolez.php.

Referenced by getConf().

◆ $exe

ToolConsoleZ::$exe
private

Definition at line 26 of file class.tool.consolez.php.

Referenced by getExe().

◆ $launchExe

ToolConsoleZ::$launchExe
private

Definition at line 27 of file class.tool.consolez.php.

Referenced by getLaunchExe().

◆ $rows

ToolConsoleZ::$rows
private

Definition at line 29 of file class.tool.consolez.php.

Referenced by getRows().

◆ LOCAL_CFG_COLS

const ToolConsoleZ::LOCAL_CFG_COLS = 'consolezCols'

Definition at line 24 of file class.tool.consolez.php.

◆ LOCAL_CFG_CONF

const ToolConsoleZ::LOCAL_CFG_CONF = 'consolezConf'

Definition at line 21 of file class.tool.consolez.php.

Referenced by reload().

◆ LOCAL_CFG_EXE

const ToolConsoleZ::LOCAL_CFG_EXE = 'consolezExe'

Definition at line 20 of file class.tool.consolez.php.

Referenced by reload().

◆ LOCAL_CFG_LAUNCH_EXE

const ToolConsoleZ::LOCAL_CFG_LAUNCH_EXE = 'consolezLaunchExe'

Definition at line 22 of file class.tool.consolez.php.

Referenced by reload().

◆ LOCAL_CFG_ROWS

const ToolConsoleZ::LOCAL_CFG_ROWS = 'consolezRows'

Definition at line 23 of file class.tool.consolez.php.

◆ ROOT_CFG_VERSION

const ToolConsoleZ::ROOT_CFG_VERSION = 'consolezVersion'

Definition at line 18 of file class.tool.consolez.php.


The documentation for this class was generated from the following file: