__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Version;
/**
* Trait for managing app configs
*/
trait AppConfig
{
/**
* App config
* @TODO: will be implemented later.
*
* @return void
*/
public function appConfig()
{
$method = $this->getInputMethod();
$this->checkNotAllowedMethods(['POST', 'PUT', 'DELETE', 'PATCH'], $method);
$this->getAppConfig();
}
private function getAppConfig()
{
if (!\class_exists('SpPgaeBuilderBase'))
{
require_once JPATH_ROOT . '/components/com_sppagebuilder/builder/classes/base.php';
}
if (!\class_exists('SppagebuilderHelper'))
{
require_once JPATH_ROOT . '/administrator/components/com_sppagebuilder/helpers/sppagebuilder.php';
}
$mediaParams = ComponentHelper::getParams('com_media');
$cParams = ComponentHelper::getParams('com_sppagebuilder');
$model = $this->getModel('Appconfig');
$pages = $model->getPageList();
$menus = $model->getMenus();
$popups = $model->getPopupList();
$categories = $model->getCategories();
$easyStoreCategories = $model->getEasyStoreCategories();
$accessLevels = $model->getAccessLevels();
$languages = $model->getLanguages();
$modules = SpPgaeBuilderBase::getModuleAttributes();
$languageOptions = $this->convertToOptions($languages);
$allLanguage = (object) [
'label' => Text::_('JALL'),
'value' => '*'
];
array_unshift($languageOptions, $allLanguage);
$version = SppagebuilderHelper::getVersion();
$preReleaseVersions = ['alpha', 'beta', 'rc'];
$isPreRelease = false;
foreach ($preReleaseVersions as $preReleaseVersion)
{
if (\stripos($version, $preReleaseVersion) !== false)
{
$isPreRelease = true;
break;
}
}
$googleFontCategories = [
(object) [
'label' => Text::_('COM_SPPAGEBUILDER_FONT_CATEGORY_SERIF'),
'value' => 'serif'
],
(object) [
'label' => Text::_('COM_SPPAGEBUILDER_FONT_CATEGORY_SANS_SERIF'),
'value' => 'sans-serif'
],
(object) [
'label' => Text::_('COM_SPPAGEBUILDER_FONT_CATEGORY_DISPLAY'),
'value' => 'display'
],
(object) [
'label' => Text::_('COM_SPPAGEBUILDER_FONT_CATEGORY_HANDWRITING'),
'value' => 'handwriting'
],
(object) [
'label' => Text::_('COM_SPPAGEBUILDER_FONT_CATEGORY_MONOSPACE'),
'value' => 'monospace'
]
];
$version = new Version();
$JoomlaVersion = $version->getShortVersion();
$response = (object) [
'pages' => $this->convertToOptions($pages),
'menus' => $this->convertToOptions($menus),
'popups' => $this->convertToOptions($popups),
'categories' => $this->convertCategoriesToOptions($categories),
'easystore_categories' => $easyStoreCategories,
'modules' => $modules['moduleName'] ?? [],
'module_positions' => $modules['modulePosition'] ?? [],
'access_levels' => $this->convertToOptions($accessLevels),
'article_categories' => SpPgaeBuilderBase::getArticleCategories(),
'languages' => $languageOptions,
'font_awesome_icons' => SpPgaeBuilderBase::getIconList(),
'version' => SppagebuilderHelper::getVersion(),
'editor' => (object) [
'theme' => $JoomlaVersion < 4 ? 'modern' : 'silver',
],
'media_path' => '/' . $mediaParams->get('file_path', 'images'),
'media_upload_max_size' => $mediaParams->get('upload_maxsize', 0) * 1024 * 1024,
'is_pre_release' => $isPreRelease,
'google_font_categories' => $googleFontCategories,
'has_google_font_api_key' => !empty($cParams->get('google_font_api_key', '')),
'is_google_fonts_disabled' => (bool) $cParams->get('disable_google_fonts', 0),
'enable_frontend_editing' => (bool) $cParams->get('enable_frontend_editing', 1),
'enable_ai' => (bool) $cParams->get('enable_ai', 1),
'permissions' => $model->getUserPermissions(),
'user_id' => Factory::getUser()->id ?? null,
'is_easystore_installed' => ApplicationHelper::isEasyStoreInstalled(),
'list_product_page_id' => ApplicationHelper::getStorePageId('storefront'),
'single_product_page_id' => ApplicationHelper::getStorePageId('single'),
'is_pro' => ApplicationHelper::isProVersion(),
];
$this->sendResponse($response);
}
public function getPermissions()
{
$pageId = $this->getInput('page_id', 0, 'INT');
$model = $this->getModel('Appconfig');
$this->sendResponse($model->getUserPermissions($pageId));
}
private function convertToOptions(array $values)
{
$options = [];
foreach ($values as $value)
{
$option = (object) [
'label' => $value->title,
'value' => $value->id
];
$options[] = $option;
}
return $options;
}
private function convertCategoriesToOptions(array $categories)
{
$options = [];
foreach ($categories as $category)
{
$option = (object) [
'label' => str_repeat('- ', max(0, $category->level - 1)) . $category->title,
'value' => $category->id
];
$options[] = $option;
}
return $options;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AddToMenuTrait.php | File | 2.69 KB | 0664 |
|
| AddonsTrait.php | File | 6.97 KB | 0664 |
|
| AiContentTrait.php | File | 10 KB | 0664 |
|
| AiContentUploadTrait.php | File | 8.14 KB | 0664 |
|
| AllFontsTrait.php | File | 1.32 KB | 0664 |
|
| AppConfig.php | File | 4.82 KB | 0664 |
|
| ApplicationSettingsTrait.php | File | 8.47 KB | 0664 |
|
| BulkExportTrait.php | File | 6.04 KB | 0664 |
|
| BulkImportTrait.php | File | 5.87 KB | 0664 |
|
| ExportTrait.php | File | 3.07 KB | 0664 |
|
| FontsTrait.php | File | 12.44 KB | 0664 |
|
| GlobalColorsTrait.php | File | 1.12 KB | 0664 |
|
| IconProvidersTrait.php | File | 928 B | 0664 |
|
| IconsListTrait.php | File | 1.39 KB | 0664 |
|
| IconsTrait.php | File | 14.71 KB | 0664 |
|
| ImageShapesTrait.php | File | 5.56 KB | 0664 |
|
| ImportTrait.php | File | 2.5 KB | 0664 |
|
| IntegrationTrait.php | File | 4.64 KB | 0664 |
|
| LanguageTrait.php | File | 5.27 KB | 0664 |
|
| LayoutImportTrait.php | File | 2.38 KB | 0664 |
|
| Media.php | File | 16.6 KB | 0664 |
|
| MediaFolderTrait.php | File | 9.5 KB | 0664 |
|
| MenuByPageIdTrait.php | File | 952 B | 0664 |
|
| MenuListTrait.php | File | 791 B | 0664 |
|
| PageContentById.php | File | 1.22 KB | 0664 |
|
| PageDuplicateTrait.php | File | 1.35 KB | 0664 |
|
| PageOrderTrait.php | File | 1.16 KB | 0664 |
|
| PageTemplateTrait.php | File | 3.1 KB | 0664 |
|
| PageTrait.php | File | 8.26 KB | 0664 |
|
| ParentItemsTrait.php | File | 1.01 KB | 0664 |
|
| PluginsTrait.php | File | 2.93 KB | 0664 |
|
| PopupTemplateTrait.php | File | 2.34 KB | 0664 |
|
| ProductPageContentById.php | File | 2 KB | 0664 |
|
| PurgeCssTrait.php | File | 810 B | 0664 |
|
| SaveIgTokenTrait.php | File | 2.01 KB | 0664 |
|
| SavedAddonsOrderTrait.php | File | 1.19 KB | 0664 |
|
| SavedAddonsTrait.php | File | 4.06 KB | 0664 |
|
| SavedPresetsTrait.php | File | 3.17 KB | 0664 |
|
| SavedSectionsOrderTrait.php | File | 1.21 KB | 0664 |
|
| SavedSectionsTrait.php | File | 4.12 KB | 0664 |
|
| SectionLibraryTrait.php | File | 2.84 KB | 0664 |
|
| SettingsTrait.php | File | 1.07 KB | 0664 |
|
| UploadFontTrait.php | File | 5.48 KB | 0664 |
|