__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package SP Page Builder
* @author JoomShaper http://www.joomshaper.com
* @copyright Copyright (c) 2010 - 2024 JoomShaper
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
use Joomla\CMS\Factory;
// No direct access
defined('_JEXEC') or die('Restricted access');
/**
* Trait for managing export layout API endpoint.
*/
trait ExportTrait
{
public function export()
{
$method = $this->getInputMethod();
$this->checkNotAllowedMethods(['GET', 'DELETE', 'PUT', 'PATCH'], $method);
if ($method === 'POST') {
$this->exportLayout();
}
}
/**
* Export template layout.
*
* @return void
* @since 1.0.0
*/
public function exportLayout()
{
$user = Factory::getUser();
$authorised = $user->authorise('core.edit', 'com_sppagebuilder');
$canEditOwn = $user->authorise('core.edit.own', 'com_sppagebuilder');
$model = $this->getModel('Editor');
$pageId = $this->getInput('pageId', '', 'STRING');
$isSeoChecked = $this->getInput('isSeoChecked', '', 'STRING');
if(empty($pageId)) {
$this->sendResponse(['message' => 'Page Id missing.'], 400);
}
if ($canEditOwn && !empty($pageId)) {
JLoader::register('SppagebuilderModelPage', JPATH_ADMINISTRATOR . '/components/com_sppagebuilder/models/page.php');
$item_info = SppagebuilderModelPage::getPageInfoById($pageId);
$canEditOwn = $item_info->created_by == $user->id;
}
if (!$authorised && !$canEditOwn) {
die('Restricted Access');
}
$content = $model->getPageContent($pageId);
if (empty($content)) {
$this->sendResponse(['message' => 'Requesting page not found!'], 404);
}
$content = ApplicationHelper::preparePageData($content);
$seoSettings = [];
if ($isSeoChecked) {
$seoSettings = [
'og_description' => isset($content->og_description) ? $content->og_description : '',
'og_image' => '',
'og_title' => isset($content->og_title) ? $content->og_title : '',
'meta_description' => isset($content->attribs) && isset($content->attribs->meta_description) ? $content->attribs->meta_description : '',
'meta_keywords' => isset($content->attribs) && isset($content->attribs->meta_keywords) ? $content->attribs->meta_keywords : '',
'og_type' => isset($content->attribs) && isset($content->attribs->og_type) ? $content->attribs->og_type : '',
'robots' => isset($content->attribs) && isset($content->attribs->robots) ? $content->attribs->robots : '',
'seo_spacer' => isset($content->attribs) && isset($content->attribs->seo_spacer) ? $content->attribs->seo_spacer : '',
];
}
$pageContent = (object) [
'template' => isset($content->content) ? $content->content : $content->text,
'css' => isset($content->css) ? $content->css : '',
'seo' => json_encode($seoSettings),
'title' => $content->title,
'language' => isset($content->language) ? $content->language : '*',
];
if (isset($content->extension_view) && $content->extension_view === 'popup') {
$pageContent->attribs = isset($content->attribs) ? json_encode($content->attribs) : '';
$pageContent->type = 'popup';
}
$this->sendResponse($pageContent);
}
}
| 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 |
|