Bearsampp
2026.7.11
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-2024 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
Log::initClass
($this);
42
$this->
reload
(
$id
,
$type
);
43
}
44
51
public
function
reload
(
$id
=
null
,
$type
=
null
) {
52
global
$bearsamppConfig
,
$bearsamppLang
;
53
Log::reloadClass
($this);
54
55
$this->name =
$bearsamppLang
->getValue(
Lang::NGROK
);
56
$this->version =
$bearsamppConfig
->getRaw(self::ROOT_CFG_VERSION);
57
parent::reload(
$id
,
$type
);
58
59
if
($this->bearsamppConfRaw !==
false
) {
60
$this->exe = $this->symlinkPath .
'/'
. $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
61
}
62
63
if
(!$this->enable) {
64
Log::info
($this->name .
' is not enabled!'
);
65
return
;
66
}
67
if
(!is_dir($this->currentPath)) {
68
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->currentPath));
69
}
70
if
(!is_dir($this->symlinkPath)) {
71
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->symlinkPath));
72
return
;
73
}
74
if
(!is_file($this->bearsamppConf)) {
75
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_CONF_NOT_FOUND
), $this->name .
' '
. $this->version, $this->bearsamppConf));
76
}
77
if
(!is_file($this->exe)) {
78
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_EXE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->exe));
79
}
80
}
81
87
public
function
setVersion
(
$version
) {
88
global
$bearsamppConfig
;
89
$this->version =
$version
;
90
$bearsamppConfig
->replace(self::ROOT_CFG_VERSION,
$version
);
91
$this->
reload
();
92
}
93
99
public
function
getExe
() {
100
return
$this->exe
;
101
}
102
}
103
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
Lang\ERROR_EXE_NOT_FOUND
const ERROR_EXE_NOT_FOUND
Definition
class.lang.php:154
Lang\ERROR_CONF_NOT_FOUND
const ERROR_CONF_NOT_FOUND
Definition
class.lang.php:153
Lang\NGROK
const NGROK
Definition
class.lang.php:147
Lang\ERROR_FILE_NOT_FOUND
const ERROR_FILE_NOT_FOUND
Definition
class.lang.php:155
Log\info
static info($data, $file=null)
Definition
class.log.php:627
Log\reloadClass
static reloadClass($classInstance)
Definition
class.log.php:670
Log\error
static error($data, $file=null)
Definition
class.log.php:650
Log\initClass
static initClass($classInstance)
Definition
class.log.php:660
Module
Definition
class.module.php:15
Module\$version
$version
Definition
class.module.php:24
Module\$type
$type
Definition
class.module.php:20
Module\$id
$id
Definition
class.module.php:21
ToolNgrok
Definition
class.tool.ngrok.php:18
ToolNgrok\getExe
getExe()
Definition
class.tool.ngrok.php:99
ToolNgrok\LOCAL_CFG_EXE
const LOCAL_CFG_EXE
Definition
class.tool.ngrok.php:27
ToolNgrok\setVersion
setVersion($version)
Definition
class.tool.ngrok.php:87
ToolNgrok\reload
reload($id=null, $type=null)
Definition
class.tool.ngrok.php:51
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:41
sandbox
core
classes
tools
class.tool.ngrok.php
Generated by
1.17.0