File manager - Edit - /home/jardides/www/Jardi-design/j37/plugins/system/pagebuilderckparams/includes/export.php
Back
<?php /** * @name Page Builder CK * @package com_pagebuilderck * @copyright Copyright (C) 2015. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr */ // No direct access defined('_JEXEC') or die; jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); class PagebuilderckParamsExport { private $_doc; private $_app; private $_input; public function __construct() { $this->_doc = JFactory::getDocument(); $this->_app = JFactory::getApplication(); $this->_input = $this->_app->input; PagebuilderckHelper::loadCkbox(); } /** * Load the html code for the */ public function loadexportScript() { ?> <script> /* get the page .pbck file and submit it for download */ function ckExportPage(form) { var cid = jQuery(form).find('input[name="cid[]"]:checked'); if (cid.length) { var id = cid[0].value; ckDoExport(id); } else { alert('<?php echo JText::_('CK_PLEASE_SELECT_ITEM', true) ?>'); } } /* load the .pbck backup file and load it in the page */ function ckDoExport(id) { jQuery('#ckExportPageDownload').addClass('ckwait'); CKBox.open({handler: 'inline', content: 'ckExportModal', fullscreen: false, size: {x: '600px', y: '150px'}}) var myurl = "<?php echo JUri::root(true) ?>/administrator/index.php?option=com_pagebuilderck&task=ajaxParamsCall"; jQuery.ajax({ type: "POST", url: myurl, data: { class: 'export', method: 'ajaxDoExport', params: { id: id } } }).done(function(code) { jQuery('#ckExportPageDownload').removeClass('ckwait').html(code); }).fail(function() { alert(Joomla.JText._('CK_FAILED', 'Failed')); }); } </script> <?php } /** * Load the html code for the export modal */ public function loadExportForm() { $this->loadexportScript(); $input = JFactory::getApplication()->input; // modal popup for export ?> <div id="ckExportModal" class="" style="position:relative;display:none;"> <div style="padding: 10px;"> <div class="ckExportModalContent"> <div class="" id=""> <div class=""><h1><?php echo JText::_('CK_EXPORT'); ?></h1></div> <div id="ckExportPageDownload" style="border-top: 1px solid #ddd;padding: 0.75em;"> </div> </div> </div> </div> </div> <?php } /** * Write the export file */ public function ajaxDoExport($params) { jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); include_once JPATH_ROOT . '/administrator/components/com_pagebuilderck/models/page.php'; $model = JModelLegacy::getInstance('Page', 'PagebuilderckModel'); // path to store the file $path = '/administrator/components/com_pagebuilderck/backup'; $id = (int)$params['id']; // get the item data $item = $model->getItem($id); // get the item encoded to be saved // $exportfiletext = $model->getExportFile($item); $exportfiletext = PagebuilderckHelper::getExportFile($item); // write the export file $exportfiledest = '/export_' . $item->id . '.pbck'; if (JFile::write(JPATH_ROOT . $path . $exportfiledest, $exportfiletext)) { return '<div style="text-align:center;"><a class="btn btn-inverse" href="' . JUri::root(true) . $path . $exportfiledest . '" download="PAGEBUILDERCK' . $exportfiledest . '" target="_blank">' . JText::_('CK_DOWNLOAD') .'</a></div>'; } else { return JText::_('CK_ERROR_CREATING_EXPORT_FILE'); } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings