2024.8.23
Loading...
Searching...
No Matches
TplAppFilezilla Class Reference

Static Public Member Functions

static getActionChangeFilezillaPort ()
 
static getActionEnableFilezilla ($enable)
 
static getActionInstallFilezillaService ()
 
static getActionRemoveFilezillaService ()
 
static getActionSwitchFilezillaVersion ($version)
 
static getMenuFilezilla ()
 
static getMenuFilezillaService ()
 
static getMenuFilezillaVersions ()
 
static process ()
 

Data Fields

const ACTION_CHANGE_PORT = 'changeFilezillaPort'
 
const ACTION_ENABLE = 'enableFilezilla'
 
const ACTION_INSTALL_SERVICE = 'installFilezillaService'
 
const ACTION_REMOVE_SERVICE = 'removeFilezillaService'
 
const ACTION_SWITCH_VERSION = 'switchFilezillaVersion'
 
const MENU = 'filezilla'
 
const MENU_SERVICE = 'filezillaService'
 
const MENU_VERSIONS = 'filezillaVersions'
 

Detailed Description

Class TplAppFilezilla

This class provides methods to generate actions and menu items for managing the Filezilla module in the Bearsampp application. It includes functionalities for enabling/disabling Filezilla, switching versions, changing ports, and managing services.

Definition at line 16 of file class.tpl.app.filezilla.php.

Member Function Documentation

◆ getActionChangeFilezillaPort()

static TplAppFilezilla::getActionChangeFilezillaPort ( )
static

Generates the action to change the Filezilla port.

This method creates the action string for changing the Filezilla port, and includes a command to reload the application.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
string The generated action string for changing the Filezilla port.

Definition at line 242 of file class.tpl.app.filezilla.php.

243 {
244 global $bearsamppBins;
245
246 return TplApp::getActionRun(Action::CHANGE_PORT, array($bearsamppBins->getFilezilla()->getName())) . PHP_EOL .
248 }
global $bearsamppBins
const CHANGE_PORT
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)

References $bearsamppBins, Action\CHANGE_PORT, TplAppReload\getActionReload(), and TplApp\getActionRun().

◆ getActionEnableFilezilla()

static TplAppFilezilla::getActionEnableFilezilla ( $enable)
static

Generates the action to enable or disable Filezilla.

This method creates the action string for enabling or disabling Filezilla, and includes a command to reload the application.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Parameters
int$enableThe enable/disable flag (1 for enable, 0 for disable).
Returns
string The generated action string for enabling/disabling Filezilla.

Definition at line 147 of file class.tpl.app.filezilla.php.

148 {
149 global $bearsamppBins;
150
151 return TplApp::getActionRun(Action::ENABLE, array($bearsamppBins->getFilezilla()->getName(), $enable)) . PHP_EOL .
153 }
const ENABLE

References $bearsamppBins, Action\ENABLE, TplAppReload\getActionReload(), and TplApp\getActionRun().

◆ getActionInstallFilezillaService()

static TplAppFilezilla::getActionInstallFilezillaService ( )
static

Generates the action to install the Filezilla service.

This method creates the action string for installing the Filezilla service, and includes a command to reload the application.

Returns
string The generated action string for installing the Filezilla service.

Definition at line 257 of file class.tpl.app.filezilla.php.

References TplAppReload\getActionReload(), TplApp\getActionRun(), ActionService\INSTALL, Action\SERVICE, and BinFilezilla\SERVICE_NAME.

◆ getActionRemoveFilezillaService()

static TplAppFilezilla::getActionRemoveFilezillaService ( )
static

Generates the action to remove the Filezilla service.

This method creates the action string for removing the Filezilla service, and includes a command to reload the application.

Returns
string The generated action string for removing the Filezilla service.

Definition at line 270 of file class.tpl.app.filezilla.php.

References TplAppReload\getActionReload(), TplApp\getActionRun(), ActionService\REMOVE, Action\SERVICE, and BinFilezilla\SERVICE_NAME.

◆ getActionSwitchFilezillaVersion()

static TplAppFilezilla::getActionSwitchFilezillaVersion ( $version)
static

Generates the action to switch Filezilla versions.

This method creates the action string for switching Filezilla versions, and includes a command to reload the application.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Parameters
string$versionThe version to switch to.
Returns
string The generated action string for switching Filezilla versions.

Definition at line 165 of file class.tpl.app.filezilla.php.

166 {
167 global $bearsamppBins;
168
169 return TplApp::getActionRun(Action::SWITCH_VERSION, array($bearsamppBins->getFilezilla()->getName(), $version)) . PHP_EOL .
171 }
const SWITCH_VERSION

References $bearsamppBins, TplAppReload\getActionReload(), TplApp\getActionRun(), and Action\SWITCH_VERSION.

◆ getMenuFilezilla()

static TplAppFilezilla::getMenuFilezilla ( )
static

Generates the menu items and actions for managing Filezilla.

This method creates menu items for downloading, enabling/disabling, switching versions, managing services, accessing the admin interface, and viewing logs for Filezilla.

@global object $bearsamppBins Provides access to system binaries and their configurations. @global object $bearsamppLang Provides language support for retrieving language-specific values.

Returns
string The generated menu items and actions for managing Filezilla.

Definition at line 54 of file class.tpl.app.filezilla.php.

55 {
57 $resultItems = $resultActions = '';
58
59 $isEnabled = $bearsamppBins->getFilezilla()->isEnable();
60
61 // Download
62 $resultItems .= TplAestan::getItemLink(
64 Util::getWebsiteUrl('module/filezilla', '#releases'),
65 false,
67 ) . PHP_EOL;
68
69 // Enable
70 $tplEnable = TplApp::getActionMulti(
71 self::ACTION_ENABLE, array($isEnabled ? Config::DISABLED : Config::ENABLED),
72 array($bearsamppLang->getValue(Lang::MENU_ENABLE), $isEnabled ? TplAestan::GLYPH_CHECK : ''),
73 false, get_called_class()
74 );
75 $resultItems .= $tplEnable[TplApp::SECTION_CALL] . PHP_EOL;
76 $resultActions .= $tplEnable[TplApp::SECTION_CONTENT] . PHP_EOL;
77
78 if ($isEnabled) {
79 $resultItems .= TplAestan::getItemSeparator() . PHP_EOL;
80
81 // Versions
82 $tplVersions = TplApp::getMenu($bearsamppLang->getValue(Lang::VERSIONS), self::MENU_VERSIONS, get_called_class());
83 $resultItems .= $tplVersions[TplApp::SECTION_CALL] . PHP_EOL;
84 $resultActions .= $tplVersions[TplApp::SECTION_CONTENT] . PHP_EOL;
85
86 // Service
87 $tplService = TplApp::getMenu($bearsamppLang->getValue(Lang::SERVICE), self::MENU_SERVICE, get_called_class());
88 $resultItems .= $tplService[TplApp::SECTION_CALL] . PHP_EOL;
89 $resultActions .= $tplService[TplApp::SECTION_CONTENT];
90
91 // Admin interface
92 $resultItems .= TplAestan::getItemExe(
94 $bearsamppBins->getFilezilla()->getItfExe(),
96 ) . PHP_EOL;
97
98 // Log
99 $resultItems .= TplAestan::getItemNotepad($bearsamppLang->getValue(Lang::MENU_LOGS), $bearsamppBins->getFilezilla()->getLog()) . PHP_EOL;
100 }
101
102 return $resultItems . PHP_EOL . $resultActions;
103 }
global $bearsamppLang
const DISABLED
const MENU_LOGS
const VERSIONS
const DOWNLOAD_MORE
const ADMINISTRATION
const SERVICE
static getItemSeparator()
const GLYPH_FILEZILLA
static getItemLink($caption, $link, $local=false, $glyph=self::GLYPH_WEB_PAGE)
static getItemExe($caption, $exe, $glyph, $params=null)
static getItemNotepad($caption, $path)
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
const SECTION_CALL
const SECTION_CONTENT
static getMenu($caption, $menu, $class)
static getWebsiteUrl($path='', $fragment='', $utmSource=true)

References $bearsamppBins, $bearsamppLang, Lang\ADMINISTRATION, Config\DISABLED, Lang\DOWNLOAD_MORE, Config\ENABLED, TplApp\getActionMulti(), TplAestan\getItemExe(), TplAestan\getItemLink(), TplAestan\getItemNotepad(), TplAestan\getItemSeparator(), TplApp\getMenu(), Util\getWebsiteUrl(), TplAestan\GLYPH_BROWSER, TplAestan\GLYPH_CHECK, TplAestan\GLYPH_FILEZILLA, Lang\MENU_ENABLE, Lang\MENU_LOGS, TplApp\SECTION_CALL, TplApp\SECTION_CONTENT, Lang\SERVICE, and Lang\VERSIONS.

◆ getMenuFilezillaService()

static TplAppFilezilla::getMenuFilezillaService ( )
static

Generates the menu items and actions for managing Filezilla services.

This method creates menu items for starting, stopping, restarting, checking ports, changing ports, and installing/removing the Filezilla service.

@global object $bearsamppLang Provides language support for retrieving language-specific values. @global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
string The generated menu items and actions for managing Filezilla services.

Definition at line 183 of file class.tpl.app.filezilla.php.

184 {
186
187 $tplChangePort = TplApp::getActionMulti(
188 self::ACTION_CHANGE_PORT, null,
190 false, get_called_class()
191 );
192
193 $result = TplAestan::getItemActionServiceStart($bearsamppBins->getFilezilla()->getService()->getName()) . PHP_EOL .
194 TplAestan::getItemActionServiceStop($bearsamppBins->getFilezilla()->getService()->getName()) . PHP_EOL .
195 TplAestan::getItemActionServiceRestart($bearsamppBins->getFilezilla()->getService()->getName()) . PHP_EOL .
196 TplAestan::getItemSeparator() . PHP_EOL .
198 Action::CHECK_PORT, array($bearsamppBins->getFilezilla()->getName(), $bearsamppBins->getFilezilla()->getPort()),
199 array(sprintf($bearsamppLang->getValue(Lang::MENU_CHECK_PORT), $bearsamppBins->getFilezilla()->getPort()), TplAestan::GLYPH_LIGHT)
200 ) . PHP_EOL .
202 Action::CHECK_PORT, array($bearsamppBins->getFilezilla()->getName(), $bearsamppBins->getFilezilla()->getSslPort(), true),
203 array(sprintf($bearsamppLang->getValue(Lang::MENU_CHECK_PORT), $bearsamppBins->getFilezilla()->getSslPort()) . ' (SSL)', TplAestan::GLYPH_RED_LIGHT)
204 ) . PHP_EOL .
205 $tplChangePort[TplApp::SECTION_CALL] . PHP_EOL;
206
207 $isInstalled = $bearsamppBins->getFilezilla()->getService()->isInstalled();
208 if (!$isInstalled) {
209 $tplInstallService = TplApp::getActionMulti(
210 self::ACTION_INSTALL_SERVICE, null,
212 $isInstalled, get_called_class()
213 );
214
215 $result .= $tplInstallService[TplApp::SECTION_CALL] . PHP_EOL . PHP_EOL .
216 $tplInstallService[TplApp::SECTION_CONTENT] . PHP_EOL;
217 } else {
218 $tplRemoveService = TplApp::getActionMulti(
219 self::ACTION_REMOVE_SERVICE, null,
221 !$isInstalled, get_called_class()
222 );
223
224 $result .= $tplRemoveService[TplApp::SECTION_CALL] . PHP_EOL . PHP_EOL .
225 $tplRemoveService[TplApp::SECTION_CONTENT] . PHP_EOL;
226 }
227
228 $result .= $tplChangePort[TplApp::SECTION_CONTENT] . PHP_EOL;
229
230 return $result;
231 }
$result
const CHECK_PORT
const MENU_INSTALL_SERVICE
const MENU_REMOVE_SERVICE
const MENU_CHECK_PORT
const MENU_CHANGE_PORT
const GLYPH_SERVICE_REMOVE
static getItemActionServiceStop($service)
static getItemActionServiceStart($service)
const GLYPH_RED_LIGHT
static getItemActionServiceRestart($service)
const GLYPH_SERVICE_INSTALL

References $bearsamppBins, $bearsamppLang, $result, Action\CHECK_PORT, TplApp\getActionMulti(), TplApp\getActionRun(), TplAestan\getItemActionServiceRestart(), TplAestan\getItemActionServiceStart(), TplAestan\getItemActionServiceStop(), TplAestan\getItemSeparator(), TplAestan\GLYPH_LIGHT, TplAestan\GLYPH_NETWORK, TplAestan\GLYPH_RED_LIGHT, TplAestan\GLYPH_SERVICE_INSTALL, TplAestan\GLYPH_SERVICE_REMOVE, Lang\MENU_CHANGE_PORT, Lang\MENU_CHECK_PORT, Lang\MENU_INSTALL_SERVICE, Lang\MENU_REMOVE_SERVICE, TplApp\SECTION_CALL, and TplApp\SECTION_CONTENT.

◆ getMenuFilezillaVersions()

static TplAppFilezilla::getMenuFilezillaVersions ( )
static

Generates the menu items and actions for switching Filezilla versions.

This method creates menu items for each available version of Filezilla, allowing the user to switch between them.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
string The generated menu items and actions for switching Filezilla versions.

Definition at line 114 of file class.tpl.app.filezilla.php.

115 {
116 global $bearsamppBins;
117 $items = '';
118 $actions = '';
119
120 foreach ($bearsamppBins->getFilezilla()->getVersionList() as $version) {
121 $tplSwitchFilezillaVersion = TplApp::getActionMulti(
122 self::ACTION_SWITCH_VERSION, array($version),
123 array($version, $version == $bearsamppBins->getFilezilla()->getVersion() ? TplAestan::GLYPH_CHECK : ''),
124 false, get_called_class()
125 );
126
127 // Item
128 $items .= $tplSwitchFilezillaVersion[TplApp::SECTION_CALL] . PHP_EOL;
129
130 // Action
131 $actions .= PHP_EOL . $tplSwitchFilezillaVersion[TplApp::SECTION_CONTENT];
132 }
133
134 return $items . $actions;
135 }

References $bearsamppBins, TplApp\getActionMulti(), TplAestan\GLYPH_CHECK, TplApp\SECTION_CALL, and TplApp\SECTION_CONTENT.

◆ process()

static TplAppFilezilla::process ( )
static

Generates the menu item and associated actions for enabling/disabling Filezilla.

@global object $bearsamppLang Provides language support for retrieving language-specific values. @global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
array The generated menu item and actions for enabling/disabling Filezilla.

Definition at line 36 of file class.tpl.app.filezilla.php.

37 {
39
40 return TplApp::getMenuEnable($bearsamppLang->getValue(Lang::FILEZILLA), self::MENU, get_called_class(), $bearsamppBins->getFilezilla()->isEnable());
41 }
const FILEZILLA
static getMenuEnable($caption, $menu, $class, $enabled=true)

References $bearsamppBins, $bearsamppLang, Lang\FILEZILLA, and TplApp\getMenuEnable().

Referenced by TplApp\getSectionMenuLeft().

+ Here is the caller graph for this function:

Field Documentation

◆ ACTION_CHANGE_PORT

const TplAppFilezilla::ACTION_CHANGE_PORT = 'changeFilezillaPort'

Definition at line 24 of file class.tpl.app.filezilla.php.

◆ ACTION_ENABLE

const TplAppFilezilla::ACTION_ENABLE = 'enableFilezilla'

Definition at line 22 of file class.tpl.app.filezilla.php.

◆ ACTION_INSTALL_SERVICE

const TplAppFilezilla::ACTION_INSTALL_SERVICE = 'installFilezillaService'

Definition at line 25 of file class.tpl.app.filezilla.php.

◆ ACTION_REMOVE_SERVICE

const TplAppFilezilla::ACTION_REMOVE_SERVICE = 'removeFilezillaService'

Definition at line 26 of file class.tpl.app.filezilla.php.

◆ ACTION_SWITCH_VERSION

const TplAppFilezilla::ACTION_SWITCH_VERSION = 'switchFilezillaVersion'

Definition at line 23 of file class.tpl.app.filezilla.php.

◆ MENU

const TplAppFilezilla::MENU = 'filezilla'

Definition at line 18 of file class.tpl.app.filezilla.php.

◆ MENU_SERVICE

const TplAppFilezilla::MENU_SERVICE = 'filezillaService'

Definition at line 20 of file class.tpl.app.filezilla.php.

◆ MENU_VERSIONS

const TplAppFilezilla::MENU_VERSIONS = 'filezillaVersions'

Definition at line 19 of file class.tpl.app.filezilla.php.


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