File manager - Edit - /home/jardides/www/Jardi-design/old/administrator/components/com_templateck/views/template/tmpl/ajaxxml.php
Back
<?php /** * @name Template Creator CK 3 * @package com_templateck * @copyright Copyright (C) 2013. 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 to this file defined('_JEXEC') or die('Restricted access'); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); $app = JFactory::getApplication(); // retrieve variables $templatename = $app->input->get('templatename'); $joomlaversion = $app->input->get('joomlaversion'); $creationdate = $app->input->get('creationdate', '', 'string'); $author = $app->input->get('author', '', 'string'); $authorEmail = $app->input->get('authorEmail', '', 'string'); $authorUrl = $app->input->get('authorUrl', '', 'string'); $copyright = $app->input->get('copyright', '', 'string'); $license = $app->input->get('license', '', 'string'); $version = $app->input->get('version'); $description = $app->input->get('description', '', 'string'); $positions = $app->input->get('positions', '', 'array'); $blocs = $app->input->get('blocs', null, null); $blocs = stripslashes(str_replace("|di|", "#", $blocs)); $blocs = json_decode($blocs); $loadBootstrap = (isset($blocs[0]->blocloadboostrap) && $blocs[0]->blocloadboostrap == '1') ? '1' : '0'; $googleanalytics = (isset($blocs[0]->blocloadgoogleanalytics)) ? $blocs[0]->blocloadgoogleanalytics : false; // save root folder $path = TEMPLATECREATORCK_PROJECTS_PATH . '/' . $templatename; $templatepath = JPATH_SITE . '/templates/' . $templatename; // check if there is some logos in the template $logos_id = array(); $positionsforlang = array(); foreach ($blocs as $i => $bloc) { if (isset($bloc->ckmoduleposition)) { $positionsforlang[$bloc->ckmoduleposition] = $bloc->ckid; } if (stristr($bloc->class, 'bannerlogo')) { $logos_id[$bloc->ckid] = new stdClass(); $logos_id[$bloc->ckid]->imgsrc = $bloc->blocbackgroundimageurl; $logos_id[$bloc->ckid]->height = isset($bloc->logoheight) ? $bloc->logoheight : 'auto'; $logos_id[$bloc->ckid]->width = isset($bloc->logowidth) ? $bloc->logowidth : '100%'; } } // write the language file .sys.ini $langbuffer = ''; foreach ($positionsforlang as $positionforlang => $idforlang) { $langbuffer .= "TPL_" . strtoupper($templatename) . "_POSITION_" . strtoupper($positionforlang) . "=\"" . str_replace('"', '"', $idforlang) . "\"\n"; } if (! JFolder::exists($path . '/language/en-GB')) { JFolder::create($path . '/language/en-GB'); } // write the content of the language file file_put_contents($path . '/language/en-GB/en-GB.tpl_' . $templatename . '.sys.ini', $langbuffer); // write the language file .ini $langbuffer = ''; $langbuffer .= "TPL_" . strtoupper($templatename) . "_ERROR_REQUEST=\"Oops! That page can’t be found.\"\n"; $langbuffer .= "TPL_" . strtoupper($templatename) . "_SEARCH_FIELD=\"It looks like nothing was found at this location. Maybe try a search?\"\n"; $langbuffer .= "TPL_" . strtoupper($templatename) . "_CONTACT_ADMINISTRATOR=\"If difficulties persist, please contact the System Administrator of this site and report the error 404.\"\n"; $langbuffer .= "TPL_" . strtoupper($templatename) . "_ERROR_MESSAGE=\"Page not found\"\n"; // write the content of the language file file_put_contents($path . '/language/en-GB/en-GB.tpl_' . $templatename . '.ini', $langbuffer); // copy the preview images if already exists if (file_exists($templatepath . '/template_preview.png') && (isset($blocs[0]->template_previewsystemimageurl) && !$blocs[0]->template_previewsystemimageurl)) { JFile::copy($templatepath . '/template_preview.png', $path . '/template_preview.png'); } if (file_exists($templatepath . '/template_thumbnail.png') && (isset($blocs[0]->template_thumbnailsystemimageurl) && !$blocs[0]->template_thumbnailsystemimageurl)) { JFile::copy($templatepath . '/template_thumbnail.png', $path . '/template_thumbnail.png'); } // create head lines $xmltext = '<?xml version="1.0" encoding="utf-8"?>'; if ($joomlaversion == 'j15') { $xmltext .= ' <!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.5/template-install.dtd"> <install version="1.5" type="template" method="upgrade">'; } elseif ($joomlaversion == 'j17') { $xmltext .= ' <!DOCTYPE install PUBLIC "-//Joomla! 1.7//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.7/template-install.dtd"> <extension version="1.7" type="template" client="site" method="upgrade">'; } elseif ($joomlaversion == 'j25') { $xmltext .= ' <!DOCTYPE install PUBLIC "-//Joomla! 2.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/2.5/template-install.dtd"> <extension version="2.5" type="template" client="site" method="upgrade">'; } else { $xmltext .= ' <!DOCTYPE install PUBLIC "-//Joomla! 2.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/2.5/template-install.dtd"> <extension version="3.0" type="template" client="site" method="upgrade">'; } $xmltext .=' <name>' . $templatename . '</name> <creationDate>' . $creationdate . '</creationDate> <author>' . $author . '</author> <authorEmail>' . $authorEmail . '</authorEmail> <authorUrl>' . $authorUrl . '</authorUrl> <copyright>' . $copyright . '</copyright> <license>' . $license . '</license> <version>' . $version . '</version> <description>' . $description . '</description> '; // list files to archive $files = JFolder::files($path, false, false, true); $folders = JFolder::folders($path, false, false, true); $xmltext .= "\t<files>\r\n"; $tmppath = str_replace('\\', '/', $path); foreach ($files as $file) { $tmpfile = str_replace('\\', '/', $file); $tmpfile = str_replace($tmppath, '', $tmpfile); $tmpfile = trim($tmpfile, '/'); $xmltext .= "\t\t<filename>" . $tmpfile . "</filename>\r\n"; } foreach ($folders as $folder) { $tmpfolder = str_replace('\\', '/', $folder); $tmpfolder = str_replace($tmppath, '', $tmpfolder); $tmpfolder = trim($tmpfolder, '/'); $xmltext .= "\t\t<folder>" . $tmpfolder . "</folder>\r\n"; } $xmltext .= "\t</files>\r\n"; // list all positions $xmltext .= "\t<positions>\r\n"; foreach ($positions as $position) { if ($position) $xmltext .= "\t\t<position>" . $position . "</position>\r\n"; } $xmltext .= "\t</positions>\r\n"; // add the language definition only for the module position translation $xmltext .= "\t<languages folder=\"language\">\r\n"; $xmltext .= "\t\t<language tag=\"en-GB\">en-GB/en-GB.tpl_" . $templatename . ".sys.ini</language>\n"; $xmltext .= "\t</languages>\r\n"; // add admin params if ($joomlaversion == 'j15') { $openparams = "\t<params>\r\n"; $openfield = "\t\t<param"; $closefield = "\t\t</param>\r\n"; $closeparams = "\t</params>\r\n"; } else { $openparams = "\t<config> <fields name=\"params\"> <fieldset name=\"advanced\">\r\n"; $openfield = "\t\t\t\t<field"; $closefield = "\t\t\t\t</field>\r\n"; $closeparams = "\t\t\t</fieldset> </fields> </config>\r\n"; } $xmltext .= $openparams; // save the logo settings in the database if (count($logos_id)) { JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_templates/tables'); $template_table = JTable::getInstance('Style', 'TemplatesTable'); $template_table->load(array( 'template' => $templatename )); } foreach ($logos_id as $id => $logo) { $imageurl = explode("/", $logo->imgsrc); $imageurl = end($imageurl); $imageurl = "templates/" . $templatename . "/images/" . $imageurl; $xmltext .= $openfield . " name=\"" . $id . "_spacer\" type=\"spacer\" label=\"-- [ Logo image for " . $id . " ] --\" />\r\n"; $xmltext .= $openfield . " name=\"" . $id . "_logoimgsrc\" type=\"media\" default=\"\" label=\"Logo image\" description=\"If you want to redirect the page on the logo click\" />\r\n"; $xmltext .= $openfield . " name=\"" . $id . "_logoheight\" type=\"text\" default=\"" . $logo->height . "\" label=\"Logo height\" description=\"If you want to redirect the page on the logo click\" />\r\n"; $xmltext .= $openfield . " name=\"" . $id . "_logowidth\" type=\"text\" default=\"" . $logo->width . "\" label=\"Logo width\" description=\"If you want to redirect the page on the logo click\" />\r\n"; $xmltext .= $openfield . " name=\"" . $id . "_logolink\" type=\"text\" default=\"\" label=\"Logo link\" description=\"If you want to redirect the page on the logo click\" />\r\n"; $xmltext .= $openfield . " name=\"" . $id . "_logotitle\" type=\"text\" default=\"\" label=\"Logo title\" description=\"Choose the alt tag that will be added to the image\" />\r\n"; $xmltext .= $openfield . " name=\"" . $id . "_logodescription\" type=\"text\" default=\"\" label=\"Logo description\" description=\"Text that will be added under the logo\" />\r\n"; $params = new JRegistry($template_table->params); $params->set($id . '_logoimgsrc', $imageurl); $params->set($id . '_logoheight', $logo->height); $params->set($id . '_logowidth', $logo->width); $params = $params->toString(); $template_table->set('params', $params); $template_table->store($template_table); } $xmltext .= $openfield . " name=\"other_spacer\" type=\"spacer\" label=\"-- [ Other options ] --\" />\r\n"; $xmltext .= $openfield . " name=\"usecsspie\" type=\"radio\" default=\"1\" label=\"Use CSS PIE\" description=\"Launch a script to emulate the CSS3 styles for Internet Explorer\" class=\"btn-group\">\r\n" . "\t\t\t\t\t\t<option value=\"1\">JYES</option>\r\n" . "\t\t\t\t\t\t<option value=\"0\">JNO</option>\r\n" . $closefield; $xmltext .= $openfield . " name=\"useresponsive\" type=\"radio\" default=\"1\" label=\"Use Responsive mode\" description=\"Adapt your template design for mobile resolutions\" class=\"btn-group\">\r\n" . "\t\t\t\t\t\t<option value=\"1\">JYES</option>\r\n" . "\t\t\t\t\t\t<option value=\"0\">JNO</option>\r\n" . $closefield; //if ($joomlaversion == 'j3') { // $xmltext .= $openfield . " name=\"usebootstrap\" type=\"radio\" default=\"" . $loadBootstrap . "\" label=\"Load Bootstrap\" description=\"Add the Bootstrap framework into the template\" class=\"btn-group\">\r\n" // . "\t\t\t\t\t\t<option value=\"1\">JYES</option>\r\n" // . "\t\t\t\t\t\t<option value=\"0\">JNO</option>\r\n" // . $closefield; //} if ($googleanalytics) { $xmltext .= $openfield . " name=\"googleanalyticscode\" type=\"text\" default=\"\" label=\"Google analytics code\" description=\"Add the google analytics into the template. Set it like this : UA-xxxxxxxx-x. If you don't want to use it, leave the field blank.\" />\r\n"; } $xmltext .= $closeparams; // close the file if ($joomlaversion == 'j15') { $xmltext .= '</install>'; } else { $xmltext .= '</extension>'; } // define path to file $xmldest = $path . '/templateDetails.xml'; // create the file templateDetails.xml if (!JFile::write($xmldest, $xmltext)) { $msg = '<p class="error">' . JText::_('CK_ERROR_CREATING_TEMPLATEDETAILSXML') . '</p>'; } else { $msg = '<p class="successck">' . JText::_('CK_SUCCESS_CREATING_TEMPLATEDETAILSXML') . '</p>'; } echo $msg;
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings