Bearsampp
2026.9.23
Toggle main menu visibility
Loading...
Searching...
No Matches
class.tool.ngrok.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2026 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: Bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
17
class
ToolNgrok
extends
Module
18
{
22
const
ROOT_CFG_VERSION
=
'ngrokVersion'
;
23
27
const
LOCAL_CFG_EXE
=
'ngrokExe'
;
28
32
private
$exe
;
33
40
public
function
__construct
(
$id
,
$type
)
41
{
42
Log::initClass
($this);
43
$this->
reload
(
$id
,
$type
);
44
}
45
52
public
function
reload
(
$id
=
null
,
$type
=
null
)
53
{
54
global
$bearsamppConfig
,
$bearsamppLang
;
55
Log::reloadClass
($this);
56
57
$this->name =
$bearsamppLang
->getValue(
Lang::NGROK
);
58
$this->version =
$bearsamppConfig
->getRaw(self::ROOT_CFG_VERSION);
59
parent::reload(
$id
,
$type
);
60
61
if
($this->bearsamppConfRaw !==
false
) {
62
$this->exe = $this->symlinkPath .
'/'
. $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
63
}
64
65
if
(!$this->enable) {
66
Log::info
($this->name .
' is not enabled!'
);
67
68
return
;
69
}
70
if
(!is_dir($this->currentPath)) {
71
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->currentPath));
72
}
73
if
(!is_dir($this->symlinkPath)) {
74
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->symlinkPath));
75
76
return
;
77
}
78
if
(!is_file($this->bearsamppConf)) {
79
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_CONF_NOT_FOUND
), $this->name .
' '
. $this->version, $this->bearsamppConf));
80
}
81
if
(!is_file($this->exe)) {
82
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_EXE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->exe));
83
}
84
}
85
91
public
function
setVersion
(
$version
)
92
{
93
global
$bearsamppConfig
;
94
$this->version =
$version
;
95
$bearsamppConfig
->replace(self::ROOT_CFG_VERSION,
$version
);
96
$this->
reload
();
97
}
98
104
public
function
getExe
()
105
{
106
return
$this->exe
;
107
}
108
}
109
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
Lang\ERROR_EXE_NOT_FOUND
const ERROR_EXE_NOT_FOUND
Definition
class.lang.php:155
Lang\ERROR_CONF_NOT_FOUND
const ERROR_CONF_NOT_FOUND
Definition
class.lang.php:154
Lang\NGROK
const NGROK
Definition
class.lang.php:148
Lang\ERROR_FILE_NOT_FOUND
const ERROR_FILE_NOT_FOUND
Definition
class.lang.php:156
Log\info
static info($data, $file=null)
Definition
class.log.php:737
Log\reloadClass
static reloadClass($classInstance)
Definition
class.log.php:805
Log\error
static error($data, $file=null)
Definition
class.log.php:760
Log\initClass
static initClass($classInstance)
Definition
class.log.php:784
Module
Definition
class.module.php:15
Module\$version
$version
Definition
class.module.php:29
Module\$type
$type
Definition
class.module.php:20
Module\$id
$id
Definition
class.module.php:23
ToolNgrok
Definition
class.tool.ngrok.php:18
ToolNgrok\getExe
getExe()
Definition
class.tool.ngrok.php:104
ToolNgrok\LOCAL_CFG_EXE
const LOCAL_CFG_EXE
Definition
class.tool.ngrok.php:27
ToolNgrok\setVersion
setVersion($version)
Definition
class.tool.ngrok.php:91
ToolNgrok\reload
reload($id=null, $type=null)
Definition
class.tool.ngrok.php:52
ToolNgrok\ROOT_CFG_VERSION
const ROOT_CFG_VERSION
Definition
class.tool.ngrok.php:22
ToolNgrok\__construct
__construct($id, $type)
Definition
class.tool.ngrok.php:40
ToolNgrok\$exe
$exe
Definition
class.tool.ngrok.php:32
$bearsamppConfig
global $bearsamppConfig
Definition
homepage.php:46
sandbox
core
classes
tools
class.tool.ngrok.php
Generated by
1.17.0