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

Static Public Member Functions

static getActionEnablePhp ($enable)
 
static getActionSwitchPhpExtension ($extension, $switch)
 
static getActionSwitchPhpSetting ($setting, $enabled)
 
static getActionSwitchPhpVersion ($version)
 
static getMenuPhp ()
 
static getMenuPhpExtensions ()
 
static getMenuPhpSettings ()
 
static getMenuPhpVersions ()
 
static process ()
 

Data Fields

const ACTION_ENABLE = 'enablePhp'
 
const ACTION_SWITCH_EXTENSION = 'switchPhpExtension'
 
const ACTION_SWITCH_SETTING = 'switchPhpSetting'
 
const ACTION_SWITCH_VERSION = 'switchPhpVersion'
 
const MENU = 'php'
 
const MENU_EXTENSIONS = 'phpExtensions'
 
const MENU_SETTINGS = 'phpSettings'
 
const MENU_VERSIONS = 'phpVersions'
 

Static Private Member Functions

static getSubmenuPhpSettings ($passThr=array(), $result=array(), $settings=array(), $sectionCall=true)
 

Detailed Description

Definition at line 10 of file class.tpl.app.php.php.

Member Function Documentation

◆ getActionEnablePhp()

static TplAppPhp::getActionEnablePhp ( $enable)
static

Generates the action to enable or disable PHP.

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

Parameters
int$enableThe enable flag (1 to enable, 0 to disable).
Returns
string The generated action string to enable or disable PHP.

Definition at line 143 of file class.tpl.app.php.php.

144 {
145 global $bearsamppBins;
146
147 return TplApp::getActionRun(Action::ENABLE, array($bearsamppBins->getPhp()->getName(), $enable)) . PHP_EOL .
149 }
global $bearsamppBins
const ENABLE
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)

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

◆ getActionSwitchPhpExtension()

static TplAppPhp::getActionSwitchPhpExtension ( $extension,
$switch )
static

Generates the action to switch a PHP extension.

Parameters
string$extensionThe PHP extension to switch.
string$switchThe current state of the extension (on or off).
Returns
string The generated action string to switch the PHP extension.

Definition at line 335 of file class.tpl.app.php.php.

References TplAppReload\getActionReload(), TplService\getActionRestart(), TplApp\getActionRun(), BinApache\SERVICE_NAME, ActionSwitchPhpExtension\SWITCH_OFF, ActionSwitchPhpExtension\SWITCH_ON, and Action\SWITCH_PHP_EXTENSION.

◆ getActionSwitchPhpSetting()

static TplAppPhp::getActionSwitchPhpSetting ( $setting,
$enabled )
static

Generates the action to switch a PHP setting.

Parameters
string$settingThe PHP setting to switch.
bool$enabledThe current state of the setting (true if enabled, false otherwise).
Returns
string The generated action string to switch the PHP setting.

Definition at line 289 of file class.tpl.app.php.php.

References TplAppReload\getActionReload(), TplService\getActionRestart(), TplApp\getActionRun(), BinApache\SERVICE_NAME, ActionSwitchPhpParam\SWITCH_OFF, ActionSwitchPhpParam\SWITCH_ON, and Action\SWITCH_PHP_PARAM.

◆ getActionSwitchPhpVersion()

static TplAppPhp::getActionSwitchPhpVersion ( $version)
static

Generates the action to switch the PHP version.

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

Parameters
string$versionThe PHP version to switch to.
Returns
string The generated action string to switch the PHP version.

Definition at line 160 of file class.tpl.app.php.php.

161 {
162 global $bearsamppBins;
163
164 return TplApp::getActionRun(Action::SWITCH_VERSION, array($bearsamppBins->getPhp()->getName(), $version)) . PHP_EOL .
166 }
const SWITCH_VERSION

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

◆ getMenuPhp()

static TplAppPhp::getMenuPhp ( )
static

Generates the PHP menu items and actions.

@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 PHP menu items and actions.

Definition at line 45 of file class.tpl.app.php.php.

46 {
48 $resultItems = $resultActions = '';
49
50 $isEnabled = $bearsamppBins->getPhp()->isEnable();
51
52 // Download
54 Util::getWebsiteUrl('module/php', '#releases'),
55 false,
57 ) . PHP_EOL;
58
59 // Enable
60 $tplEnable = TplApp::getActionMulti(
61 self::ACTION_ENABLE, array($isEnabled ? Config::DISABLED : Config::ENABLED),
62 array($bearsamppLang->getValue(Lang::MENU_ENABLE), $isEnabled ? TplAestan::GLYPH_CHECK : ''),
63 false, get_called_class()
64 );
65 $resultItems .= $tplEnable[TplApp::SECTION_CALL] . PHP_EOL;
66 $resultActions .= $tplEnable[TplApp::SECTION_CONTENT] . PHP_EOL;
67
68 if ($isEnabled) {
69 $resultItems .= TplAestan::getItemSeparator() . PHP_EOL;
70
71 // Versions
72 $tplVersions = TplApp::getMenu($bearsamppLang->getValue(Lang::VERSIONS), self::MENU_VERSIONS, get_called_class());
73 $resultItems .= $tplVersions[TplApp::SECTION_CALL] . PHP_EOL;
74 $resultActions .= $tplVersions[TplApp::SECTION_CONTENT] . PHP_EOL;
75
76 // Settings
77 $tplSettings = TplApp::getMenu($bearsamppLang->getValue(Lang::SETTINGS), self::MENU_SETTINGS, get_called_class());
78 $resultItems .= $tplSettings[TplApp::SECTION_CALL] . PHP_EOL;
79 $resultActions .= $tplSettings[TplApp::SECTION_CONTENT] . PHP_EOL;
80
81 // Extensions
82 $tplExtensions = TplApp::getMenu($bearsamppLang->getValue(Lang::EXTENSIONS), self::MENU_EXTENSIONS, get_called_class());
83 $resultItems .= $tplExtensions[TplApp::SECTION_CALL] . PHP_EOL;
84 $resultActions .= $tplExtensions[TplApp::SECTION_CONTENT];
85
86 // Conf
87 $resultItems .= TplAestan::getItemNotepad(basename($bearsamppBins->getPhp()->getConf()), $bearsamppBins->getPhp()->getConf()) . PHP_EOL;
88
89 // Errors log
90 $resultItems .= TplAestan::getItemNotepad($bearsamppLang->getValue(Lang::MENU_ERROR_LOGS), $bearsamppBins->getPhp()->getErrorLog()) . PHP_EOL;
91 }
92
93 return $resultItems . PHP_EOL . $resultActions;
94 }
global $bearsamppLang
const DISABLED
const MENU_ERROR_LOGS
const VERSIONS
const DOWNLOAD_MORE
const EXTENSIONS
const SETTINGS
static getItemSeparator()
static getItemLink($caption, $link, $local=false, $glyph=self::GLYPH_WEB_PAGE)
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, Config\DISABLED, Lang\DOWNLOAD_MORE, Config\ENABLED, Lang\EXTENSIONS, TplApp\getActionMulti(), TplAestan\getItemLink(), TplAestan\getItemNotepad(), TplAestan\getItemSeparator(), TplApp\getMenu(), Util\getWebsiteUrl(), TplAestan\GLYPH_BROWSER, TplAestan\GLYPH_CHECK, Lang\MENU_ENABLE, Lang\MENU_ERROR_LOGS, TplApp\SECTION_CALL, TplApp\SECTION_CONTENT, Lang\SETTINGS, and Lang\VERSIONS.

◆ getMenuPhpExtensions()

static TplAppPhp::getMenuPhpExtensions ( )
static

Generates the PHP extensions menu items and actions.

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

Returns
string The generated PHP extensions menu items and actions.

Definition at line 304 of file class.tpl.app.php.php.

305 {
306 global $bearsamppBins;
307 $items = '';
308 $actions = '';
309
310 foreach ($bearsamppBins->getPhp()->getExtensions() as $extension => $switch) {
311 $tplSwitchPhpExtension = TplApp::getActionMulti(
312 self::ACTION_SWITCH_EXTENSION, array($extension, $switch),
313 array($extension, ($switch == ActionSwitchPhpExtension::SWITCH_ON ? TplAestan::GLYPH_CHECK : '')),
314 false, get_called_class()
315 );
316
317 // Item
318 $items .= $tplSwitchPhpExtension[TplApp::SECTION_CALL] . PHP_EOL;
319
320 // Action
321 $actions .= PHP_EOL . $tplSwitchPhpExtension[TplApp::SECTION_CONTENT];
322 }
323
324 return $items . $actions;
325 }

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

◆ getMenuPhpSettings()

static TplAppPhp::getMenuPhpSettings ( )
static

Generates the PHP settings menu items and actions.

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

Returns
string The generated PHP settings menu items and actions.

Definition at line 175 of file class.tpl.app.php.php.

176 {
177 global $bearsamppBins;
178
179 $menuItems = '';
180 $menuActions = '';
181 foreach ($bearsamppBins->getPhp()->getSettings() as $key => $value) {
182 if (is_array($value)) {
183 $menuItems .= 'Type: submenu; ' .
184 'Caption: "' . $key . '"; ' .
185 'SubMenu: MenuPhpSetting-' . md5($key) . '; ' .
186 'Glyph: ' . TplAestan::GLYPH_FOLDER_CLOSE . PHP_EOL;
187 } else {
188 $glyph = '';
189 $settingEnabled = $bearsamppBins->getPhp()->isSettingActive($value);
190 if (!$bearsamppBins->getPhp()->isSettingExists($value)) {
192 } elseif ($settingEnabled) {
193 $glyph = TplAestan::GLYPH_CHECK;
194 }
195 $tplSwitchPhpSetting = TplApp::getActionMulti(
196 self::ACTION_SWITCH_SETTING, array($value, $settingEnabled),
197 array($key, $glyph),
198 false, get_called_class()
199 );
200
201 $menuItems .= $tplSwitchPhpSetting[TplApp::SECTION_CALL] . PHP_EOL;
202 $menuActions .= $tplSwitchPhpSetting[TplApp::SECTION_CONTENT];
203 }
204 }
205
206 $submenusItems = '';
207 $submenusActions = '';
208 $submenuKeys = self::getSubmenuPhpSettings();
209 foreach ($submenuKeys as $submenuKey) {
210 $submenusItems .= PHP_EOL . '[MenuPhpSetting-' . md5($submenuKey) . ']' .
211 PHP_EOL . self::getSubmenuPhpSettings($submenuKey);
212
213 $submenusActions .= self::getSubmenuPhpSettings($submenuKey, array(), array(), false);
214 }
215
216 return $menuItems . $submenusItems . PHP_EOL . $menuActions . $submenusActions;
217 }
const GLYPH_FOLDER_CLOSE
static getSubmenuPhpSettings($passThr=array(), $result=array(), $settings=array(), $sectionCall=true)

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

◆ getMenuPhpVersions()

static TplAppPhp::getMenuPhpVersions ( )
static

Generates the PHP versions menu items and actions.

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

Returns
string The generated PHP versions menu items and actions.

Definition at line 103 of file class.tpl.app.php.php.

104 {
105 global $bearsamppBins;
106 $items = '';
107 $actions = '';
108
109 foreach ($bearsamppBins->getPhp()->getVersionList() as $version) {
110 $glyph = '';
111 $apachePhpModule = $bearsamppBins->getPhp()->getApacheModule($bearsamppBins->getApache()->getVersion(), $version);
112 if ($apachePhpModule === false) {
114 } elseif ($version == $bearsamppBins->getPhp()->getVersion()) {
115 $glyph = TplAestan::GLYPH_CHECK;
116 }
117
118 $tplSwitchPhpVersion = TplApp::getActionMulti(
119 self::ACTION_SWITCH_VERSION, array($version),
120 array($version, $glyph),
121 false, get_called_class()
122 );
123
124 // Item
125 $items .= $tplSwitchPhpVersion[TplApp::SECTION_CALL] . PHP_EOL;
126
127 // Action
128 $actions .= PHP_EOL . $tplSwitchPhpVersion[TplApp::SECTION_CONTENT];
129 }
130
131 return $items . $actions;
132 }

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

◆ getSubmenuPhpSettings()

static TplAppPhp::getSubmenuPhpSettings ( $passThr = array(),
$result = array(),
$settings = array(),
$sectionCall = true )
staticprivate

Generates the submenu items and actions for PHP settings.

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

Parameters
array$passThrThe pass-through array for nested settings.
array$resultThe result array to store submenu items.
array$settingsThe settings array to process.
bool$sectionCallWhether to generate section calls or content.
Returns
string The generated submenu items and actions for PHP settings.

Definition at line 231 of file class.tpl.app.php.php.

232 {
233 global $bearsamppBins;
234 $settings = empty($settings) ? $bearsamppBins->getPhp()->getSettings() : $settings;
235
236 foreach ($settings as $key => $value) {
237 if (is_array($value)) {
238 if (is_array($passThr)) {
239 array_push($result, $key);
240 $result = self::getSubmenuPhpSettings($passThr, $result, $value);
241 } else {
242 $result = is_array($result) ? '' : $result;
243 if ($key == $passThr) {
244 foreach ($value as $key2 => $value2) {
245 if (is_array($value2) && $sectionCall) {
246 $result .= 'Type: submenu; ' .
247 'Caption: "' . $key2 . '"; ' .
248 'SubMenu: MenuPhpSetting-' . md5($key2) . '; ' .
249 'Glyph: ' . TplAestan::GLYPH_FOLDER_CLOSE . PHP_EOL;
250 } elseif (!is_array($value2)) {
251 $glyph = '';
252 $settingEnabled = $bearsamppBins->getPhp()->isSettingActive($value2);
253 if (!$bearsamppBins->getPhp()->isSettingExists($value2)) {
255 } elseif ($settingEnabled) {
256 $glyph = TplAestan::GLYPH_CHECK;
257 }
258 $tplSwitchPhpSetting = TplApp::getActionMulti(
259 self::ACTION_SWITCH_SETTING, array($value2, $settingEnabled),
260 array($key2, $glyph),
261 false, get_called_class()
262 );
263
264 if ($sectionCall) {
265 $result .= $tplSwitchPhpSetting[TplApp::SECTION_CALL] . PHP_EOL;
266 } else {
267 $result .= $tplSwitchPhpSetting[TplApp::SECTION_CONTENT] . PHP_EOL;
268 }
269 }
270 }
271 } else {
272 $result .= self::getSubmenuPhpSettings($passThr, null, $value, $sectionCall);
273 }
274 }
275 }
276 }
277
278 return $result;
279 }
$result

References $bearsamppBins, $result, TplApp\getActionMulti(), getSubmenuPhpSettings(), TplAestan\GLYPH_CHECK, TplAestan\GLYPH_FOLDER_CLOSE, TplAestan\GLYPH_WARNING, TplApp\SECTION_CALL, and TplApp\SECTION_CONTENT.

Referenced by getMenuPhpSettings(), and getSubmenuPhpSettings().

+ Here is the caller graph for this function:

◆ process()

static TplAppPhp::process ( )
static

Processes the PHP menu and returns the menu items and actions.

@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 items and actions for the PHP menu.

Definition at line 30 of file class.tpl.app.php.php.

31 {
33
34 return TplApp::getMenuEnable($bearsamppLang->getValue(Lang::PHP), self::MENU, get_called_class(), $bearsamppBins->getPhp()->isEnable());
35 }
const PHP
static getMenuEnable($caption, $menu, $class, $enabled=true)

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

Referenced by TplApp\getSectionMenuLeft().

+ Here is the caller graph for this function:

Field Documentation

◆ ACTION_ENABLE

const TplAppPhp::ACTION_ENABLE = 'enablePhp'

Definition at line 17 of file class.tpl.app.php.php.

◆ ACTION_SWITCH_EXTENSION

const TplAppPhp::ACTION_SWITCH_EXTENSION = 'switchPhpExtension'

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

◆ ACTION_SWITCH_SETTING

const TplAppPhp::ACTION_SWITCH_SETTING = 'switchPhpSetting'

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

◆ ACTION_SWITCH_VERSION

const TplAppPhp::ACTION_SWITCH_VERSION = 'switchPhpVersion'

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

◆ MENU

const TplAppPhp::MENU = 'php'

Definition at line 12 of file class.tpl.app.php.php.

◆ MENU_EXTENSIONS

const TplAppPhp::MENU_EXTENSIONS = 'phpExtensions'

Definition at line 15 of file class.tpl.app.php.php.

◆ MENU_SETTINGS

const TplAppPhp::MENU_SETTINGS = 'phpSettings'

Definition at line 14 of file class.tpl.app.php.php.

◆ MENU_VERSIONS

const TplAppPhp::MENU_VERSIONS = 'phpVersions'

Definition at line 13 of file class.tpl.app.php.php.


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