Bearsampp 2025.8.29
Loading...
Searching...
No Matches
ajax.php.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
25
34$result = array(
35 'status' => '',
36 'versions' => '',
37 'extscount' => '',
38 'pearversion' => '',
39 'extslist' => '',
40);
41
45if ($bearsamppBins->getPhp()->isEnable()) {
46 $result['status'] = '<span class="float-end badge text-bg-success">' . $bearsamppLang->getValue(Lang::ENABLED) . '</span>';
47} else {
48 $result['status'] = '<span class="float-end badge text-bg-danger">' . $bearsamppLang->getValue(Lang::DISABLED) . '</span>';
49}
50
54foreach ($bearsamppBins->getPhp()->getVersionList() as $version) {
55 if ($version != $bearsamppBins->getPhp()->getVersion()) {
56 $result['versions'] .= '<span class="m-1 badge text-bg-secondary">' . $version . '</span>';
57 } else {
58 $result['versions'] .= '<span class="m-1 badge text-bg-primary">' . $bearsamppBins->getPhp()->getVersion() . '</span>';
59 }
60}
61
65$exts = count($bearsamppBins->getPhp()->getExtensions());
66$extsLoaded = count($bearsamppBins->getPhp()->getExtensionsLoaded());
67$result['extscount'] .= '<span class="m-1 float-end badge text-bg-primary">' . $extsLoaded . ' / ' . $exts . '</span>';
68
72$result['pearversion'] .= '<span class="m-1 float-end badge text-bg-primary">' . $bearsamppBins->getPhp()->getPearVersion(true) . '</span>';
73
77foreach ($bearsamppBins->getPhp()->getExtensionsFromConf() as $extName => $extStatus) {
78 if ($extStatus == ActionSwitchPhpExtension::SWITCH_ON) {
79 $result['extslist'] .= '<span class="p-1 col-xs-12 col-md-2"><i class="fa-regular fa-circle-check"></i> <strong>' . $extName . ' <sup>' . phpversion(substr($extName, 4)) . '</sup></strong></span>';
80 } else {
81 $result['extslist'] .= '<span class="p-1 col-xs-12 col-md-2"><i class="fa-regular fa-circle"></i> ' . $extName . '</span>';
82 }
83}
84
88echo json_encode($result);
$result
global $bearsamppBins
global $bearsamppLang
foreach($bearsamppBins->getPhp() ->getVersionList() as $version) $exts
Definition ajax.php.php:65
$extsLoaded
Definition ajax.php.php:66
const DISABLED
const ENABLED