Bearsampp 2026.3.26
API documentation
Loading...
Searching...
No Matches
class.tpl.aestan.php
Go to the documentation of this file.
1<?php
2/*
3 *
4 * * Copyright (c) 2021-2024 Bearsampp
5 * * License: GNU General Public License version 3 or later; see LICENSE.txt
6 * * Website: https://bearsampp.com
7 * * Github: https://github.com/Bearsampp
8 *
9 */
10
47{
48 // Glyph constants
50 const GLYPH_ADD = 1;
53 const GLYPH_BROWSER = 5;
54 const GLYPH_FILE = 6;
57 const GLYPH_START = 9;
58 const GLYPH_PAUSE = 10;
59 const GLYPH_STOP = 11;
60 const GLYPH_RELOAD = 12;
61 const GLYPH_CHECK = 13;
65 const GLYPH_WARNING = 19;
66 const GLYPH_EXIT = 20;
67 const GLYPH_ABOUT = 21;
71 const GLYPH_LIGHT = 25;
72 const GLYPH_GIT = 26;
73 const GLYPH_NODEJS = 28;
74 const GLYPH_NETWORK = 29;
75 const GLYPH_WEB_PAGE = 30;
76 const GLYPH_DEBUG = 31;
77 const GLYPH_TRASHCAN = 32;
78 const GLYPH_UPDATE = 33;
79 const GLYPH_RESTART = 34;
81 const GLYPH_RED_LIGHT = 36;
82 const GLYPH_COMPOSER = 37;
83 const GLYPH_PEAR = 38;
86 const GLYPH_NOTEPAD2 = 42;
87 const GLYPH_PASSWORD = 45;
90 const GLYPH_PYTHON = 50;
91 const GLYPH_RUBY = 52;
92 const GLYPH_PERL = 55;
94 const GLYPH_NGROK = 57;
95 const GLYPH_PWGEN = 58;
96 const GLYPH_XLIGHT = 59;
98 const GLYPH_BRUNO = 61;
99
100 // Service actions
101 const SERVICE_START = 'startresume';
102 const SERVICE_STOP = 'stop';
103 const SERVICE_RESTART = 'restart';
104 const SERVICES_CLOSE = 'closeservices';
105
106 // Image files
107 const IMG_BAR_PICTURE = 'bar.dat';
108 const IMG_GLYPH_SPRITES = 'sprites.dat';
109
116 public static function getGlyphFlah($lang)
117 {
118 }
119
125 public static function getItemSeparator()
126 {
127 return 'Type: separator';
128 }
129
141 public static function getItemPowerShell($caption, $glyph, $id = null, $title = null, $initDir = null, $command = null)
142 {
143 global $bearsamppTools;
144
145 // PowerShell uses the launch batch file which handles the command execution
146 // We use Windows Terminal command-line arguments:
147 // --title or -w for window title
148 // --startingDirectory or -d for starting directory
149 $launchExe = $bearsamppTools->getPowerShell()->getLaunchExe();
150
151 // Build the parameters using Windows Terminal switches
152 $params = '';
153
154 // Add title if provided (using -w for compatibility)
155 if ($title != null) {
156 $params .= '--title ""' . $title . '""';
157 }
158
159 // Add starting directory if provided (using -d for compatibility)
160 if ($initDir != null) {
161 if (!empty($params)) $params .= ' ';
162 $params .= '--startingDirectory ""' . $initDir . '""';
163 }
164
165 // Add command to execute if provided
166 if ($command != null) {
167 if (!empty($params)) $params .= ' ';
168 $params .= '--command ""' . $command . '""';
169 }
170
171 return self::getItemExe(
172 $caption,
173 $launchExe,
174 $glyph,
175 $params
176 );
177 }
178
188 public static function getItemLink($caption, $link, $local = false, $glyph = self::GLYPH_WEB_PAGE)
189 {
191
192 if ($local) {
193 $link = $bearsamppRoot->getLocalUrl($link);
194 }
195
196 return self::getItemExe(
197 $caption,
198 $bearsamppConfig->getBrowser(),
199 $glyph,
200 $link
201 );
202 }
203
211 public static function getItemNotepad($caption, $path)
212 {
213 global $bearsamppConfig;
214
215 return self::getItemExe(
216 $caption,
217 $bearsamppConfig->getNotepad(),
218 self::GLYPH_FILE,
219 $path
220 );
221 }
222
232 public static function getItemExe($caption, $exe, $glyph, $params = null)
233 {
234 return 'Type: item; ' .
235 'Caption: "' . $caption . '"; ' .
236 'Action: run; ' .
237 'FileName: "' . $exe . '"; ' .
238 (!empty($params) ? 'Parameters: "' . $params . '"; ' : '') .
239 'Glyph: ' . $glyph;
240 }
241
249 public static function getItemExplore($caption, $path)
250 {
251 return 'Type: item; ' .
252 'Caption: "' . $caption . '"; ' .
253 'Action: shellexecute; ' .
254 'FileName: "' . $path . '"; ' .
255 'Glyph: ' . self::GLYPH_FOLDER_OPEN;
256 }
257
266 private static function getActionService($service, $action, $item = false)
267 {
268 global $bearsamppLang;
269 $result = 'Action: ' . $action;
270
271 if ($service != null) {
272 $result = 'Action: service; ' .
273 'Service: ' . $service . '; ' .
274 'ServiceAction: ' . $action;
275 }
276
277 if ($item) {
278 $result = 'Type: item; ' . $result;
279 if ($action == self::SERVICE_START) {
280 $result .= '; Caption: "' . $bearsamppLang->getValue(Lang::MENU_START_SERVICE) . '"' .
281 '; Glyph: ' . self::GLYPH_START;
282 } elseif ($action == self::SERVICE_STOP) {
283 $result .= '; Caption: "' . $bearsamppLang->getValue(Lang::MENU_STOP_SERVICE) . '"' .
284 '; Glyph: ' . self::GLYPH_STOP;
285 } elseif ($action == self::SERVICE_RESTART) {
286 $result .= '; Caption: "' . $bearsamppLang->getValue(Lang::MENU_RESTART_SERVICE) . '"' .
287 '; Glyph: ' . self::GLYPH_RELOAD;
288 }
289 } elseif ($action != self::SERVICES_CLOSE) {
290 $result .= '; Flags: ignoreerrors waituntilterminated';
291 }
292
293 return $result;
294 }
295
302 public static function getActionServiceStart($service)
303 {
304 return self::getActionService($service, self::SERVICE_START, false);
305 }
306
313 public static function getItemActionServiceStart($service)
314 {
315 return self::getActionService($service, self::SERVICE_STOP, true);
316 }
317
324 public static function getActionServiceStop($service)
325 {
326 return self::getActionService($service, self::SERVICE_STOP, false);
327 }
328
335 public static function getItemActionServiceStop($service)
336 {
337 return self::getActionService($service, self::SERVICE_START, true);
338 }
339
346 public static function getActionServiceRestart($service)
347 {
348 return self::getActionService($service, self::SERVICE_RESTART, false);
349 }
350
357 public static function getItemActionServiceRestart($service)
358 {
359 return self::getActionService($service, self::SERVICE_RESTART, true);
360 }
361
367 public static function getActionServicesClose()
368 {
369 return self::getActionService(null, self::SERVICES_CLOSE, false);
370 }
371
377 public static function getItemActionServicesClose()
378 {
379 return self::getActionService(null, self::SERVICES_CLOSE, true);
380 }
381
387 public static function getSectionMessages()
388 {
389 global $bearsamppLang;
390
391 return '[Messages]' . PHP_EOL .
392 'AllRunningHint=' . $bearsamppLang->getValue(Lang::ALL_RUNNING_HINT) . PHP_EOL .
393 'SomeRunningHint=' . $bearsamppLang->getValue(Lang::SOME_RUNNING_HINT) . PHP_EOL .
394 'NoneRunningHint=' . $bearsamppLang->getValue(Lang::NONE_RUNNING_HINT) . PHP_EOL;
395 }
396
402 public static function getSectionConfig()
403 {
404 global $bearsamppCore;
405 return '[Config]' . PHP_EOL .
406 'ImageList=' . self::IMG_GLYPH_SPRITES . PHP_EOL .
407 'ServiceCheckInterval=1' . PHP_EOL .
408 'TrayIconAllRunning=' . self::GLYPH_SERVICE_ALL_RUNNING . PHP_EOL .
409 'TrayIconSomeRunning=' . self::GLYPH_SERVICE_SOME_RUNNING . PHP_EOL .
410 'TrayIconNoneRunning=' . self::GLYPH_SERVICE_NONE_RUNNING . PHP_EOL .
411 'ID={' . strtolower(APP_TITLE) . '}' . PHP_EOL .
412 'AboutHeader=' . APP_TITLE . PHP_EOL .
413 'AboutVersion=Version ' . $bearsamppCore->getAppVersion() . PHP_EOL;
414 }
415
421 public static function getSectionMenuRightSettings()
422 {
423 return '[Menu.Right.Settings]' . PHP_EOL .
424 'BarVisible=no' . PHP_EOL .
425 'SeparatorsAlignment=center' . PHP_EOL .
426 'SeparatorsFade=yes' . PHP_EOL .
427 'SeparatorsFadeColor=clBtnShadow' . PHP_EOL .
428 'SeparatorsFlatLines=yes' . PHP_EOL .
429 'SeparatorsGradientEnd=clSilver' . PHP_EOL .
430 'SeparatorsGradientStart=clGray' . PHP_EOL .
431 'SeparatorsGradientStyle=horizontal' . PHP_EOL .
432 'SeparatorsSeparatorStyle=shortline' . PHP_EOL;
433 }
434
441 public static function getSectionMenuLeftSettings($caption)
442 {
443 return '[Menu.Left.Settings]' . PHP_EOL .
444 'AutoLineReduction=no' . PHP_EOL .
445 'BarVisible=yes' . PHP_EOL .
446 'BarCaptionAlignment=bottom' . PHP_EOL .
447 'BarCaptionCaption=' . $caption . PHP_EOL .
448 'BarCaptionDepth=1' . PHP_EOL .
449 'BarCaptionDirection=downtoup' . PHP_EOL .
450 'BarCaptionFont=Tahoma,14,clWhite' . PHP_EOL .
451 'BarCaptionHighlightColor=clNone' . PHP_EOL .
452 'BarCaptionOffsetY=0' . PHP_EOL .
453 'BarCaptionShadowColor=clNone' . PHP_EOL .
454 'BarPictureHorzAlignment=center' . PHP_EOL .
455 'BarPictureOffsetX=0' . PHP_EOL .
456 'BarPictureOffsetY=0' . PHP_EOL .
457 'BarPicturePicture=' . self::IMG_BAR_PICTURE . PHP_EOL .
458 'BarPictureTransparent=yes' . PHP_EOL .
459 'BarPictureVertAlignment=bottom' . PHP_EOL .
460 'BarBorder=clNone' . PHP_EOL .
461 'BarGradientEnd=$00c07840' . PHP_EOL .
462 'BarGradientStart=$00c07840' . PHP_EOL .
463 'BarGradientStyle=horizontal' . PHP_EOL .
464 'BarSide=left' . PHP_EOL .
465 'BarSpace=0' . PHP_EOL .
466 'BarWidth=32' . PHP_EOL .
467 'SeparatorsAlignment=center' . PHP_EOL .
468 'SeparatorsFade=yes' . PHP_EOL .
469 'SeparatorsFadeColor=clBtnShadow' . PHP_EOL .
470 'SeparatorsFlatLines=yes' . PHP_EOL .
471 'SeparatorsFont=Arial,8,clWhite,bold' . PHP_EOL .
472 'SeparatorsGradientEnd=$00FFAA55' . PHP_EOL .
473 'SeparatorsGradientStart=$00550000' . PHP_EOL .
474 'SeparatorsGradientStyle=horizontal' . PHP_EOL .
475 'SeparatorsSeparatorStyle=caption' . PHP_EOL;
476 }
477}
$result
global $bearsamppLang
global $bearsamppRoot
global $bearsamppCore
const NONE_RUNNING_HINT
const MENU_STOP_SERVICE
const ALL_RUNNING_HINT
const MENU_RESTART_SERVICE
const SOME_RUNNING_HINT
const MENU_START_SERVICE
static getActionService($service, $action, $item=false)
static getActionServiceStop($service)
const GLYPH_SERVICE_SOME_RUNNING
static getItemPowerShell($caption, $glyph, $id=null, $title=null, $initDir=null, $command=null)
static getItemExe($caption, $exe, $glyph, $params=null)
const GLYPH_SERVICE_NONE_RUNNING
static getSectionConfig()
const GLYPH_SERVICES_STOP
const GLYPH_POWERSHELL
const GLYPH_FOLDER_DISABLED
const IMG_GLYPH_SPRITES
const GLYPH_RED_LIGHT
const GLYPH_SERVICES_RESTART
const GLYPH_FOLDER_CLOSE
const GLYPH_SERVICE_REMOVE
static getItemActionServicesClose()
static getGlyphFlah($lang)
static getActionServiceStart($service)
const GLYPH_GHOSTSCRIPT
const GLYPH_FOLDER_ENABLED
static getSectionMessages()
static getItemActionServiceStop($service)
const GLYPH_SERVICES_START
const GLYPH_SERVICE_ALL_RUNNING
const GLYPH_HOSTSEDITOR
static getActionServiceRestart($service)
static getSectionMenuLeftSettings($caption)
static getItemExplore($caption, $path)
const GLYPH_FOLDER_OPEN
const GLYPH_SERVICE_INSTALL
static getItemLink($caption, $link, $local=false, $glyph=self::GLYPH_WEB_PAGE)
static getItemNotepad($caption, $path)
const GLYPH_IMAGEMAGICK
static getSectionMenuRightSettings()
const GLYPH_SSL_CERTIFICATE
static getActionServicesClose()
static getItemActionServiceStart($service)
const GLYPH_REBUILD_INI
static getItemSeparator()
static getItemActionServiceRestart($service)
global $bearsamppConfig
Definition homepage.php:41
const APP_TITLE
Definition root.php:13