File manager - Edit - /home/verseaumee/ptitsanes/plugins/solidres/customfield/solidres.scriptfile.php
Back
<?php /*------------------------------------------------------------------------ Solidres - Hotel booking extension for Joomla ------------------------------------------------------------------------ @Author Solidres Team @Website http://www.solidres.com @Copyright Copyright (C) 2013 - 2017 Solidres. All Rights Reserved. @License GNU General Public License version 3, or later ------------------------------------------------------------------------*/ defined('_JEXEC') or die; class plgSolidresCustomfieldInstallerScript { public function postflight($type, $parent) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->update($db->qn('#__extensions')) ->set($db->qn('enabled') . ' = 1') ->where($db->qn('element') . ' = ' . $db->q('customfield')) ->where($db->qn('type') . ' = ' . $db->q('plugin')) ->where($db->qn('folder') . ' = ' . $db->q('solidres')); $result = $db->setQuery($query) ->execute(); if ($result) { echo '<p>' . JText::_('Customfield - Solidres plugin is published successfully.') . '</p>'; } else { JError::raiseWarning(-1, 'plgSolidresCustomfield: publishing failed'); } $contentElementPath = JPATH_ADMINISTRATOR . '/components/com_falang/contentelements'; $pluginElementPath = $parent->getParent()->getPath('source') . '/administrator/components/com_solidres/falang'; if (JFolder::exists($contentElementPath) && JFolder::exists($pluginElementPath)) { $files = JFolder::files($pluginElementPath, '(xml|php)$', false, true); foreach ($files as $file) { JFile::copy($file, $contentElementPath . '/' . basename($file)); } } if (JFolder::exists(JPATH_PLUGINS . '/solidres/customfield/components/com_solidres/layouts/asset')) { @JFolder::delete(JPATH_PLUGINS . '/solidres/customfield/components/com_solidres/layouts/asset'); } } public function uninstall($adapter) { $contentElementPath = JPATH_ADMINISTRATOR . '/components/com_falang/contentelements'; $files = array( $contentElementPath . '/sr_customfields.xml', $contentElementPath . '/translationSr_customfields_contextFilter.php', ); foreach ($files as $file) { if (file_exists($file)) { @chmod($file, 0777); @unlink($file); } } } public function update($adapter) { // Update add new confirm email field if not exists $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('*') ->from($db->quoteName('#__sr_customfields')) ->where($db->quoteName('context') . ' = ' . $db->quote('com_solidres.customer')) ->order($db->quoteName('ordering') . ' ASC'); $db->setQuery($query); $willUpdateFields = []; $ordering = 0; foreach ($db->loadObjectList() as $field) { if ($field->field_name === 'customer_email2') { $willUpdateFields = false; break; } // Update ordering $field->ordering = ++$ordering; $willUpdateFields[] = $field; if ($field->field_name === 'customer_email') { $confirmEmailField = clone $field; $confirmEmailField->id = 0; $confirmEmailField->title = 'Confirm Email'; $confirmEmailField->description = 'Confirm your email address.'; $confirmEmailField->field_name = 'customer_email2'; $confirmEmailField->ordering = ++$ordering; $willUpdateFields[] = $confirmEmailField; } } if (false !== $willUpdateFields) { foreach ($willUpdateFields as $willUpdateField) { if ($willUpdateField->id) { $db->updateObject('#__sr_customfields', $willUpdateField, 'id'); } else { $db->insertObject('#__sr_customfields', $willUpdateField, 'id'); } } } } }
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings