| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/new-saint-martin/plugins/pagebuilderck/contact2/ |
Upload File : |
<?php
/**
* @copyright Copyright (C) 2016 Cédric KEIFLIN alias ced1870
* https://www.template-creator.com
* https://www.joomlack.fr
* @license GNU/GPL
* */
defined('_JEXEC') or die('Restricted access');
jimport('joomla.event.plugin');
class plgPagebuilderckContact2 extends \Joomla\CMS\Plugin\CMSPlugin {
private $context = 'PLG_PAGEBUILDERCK_CONTACT';
private $type = 'contact2';
function __construct(&$subject, $params) {
$lang = \Joomla\CMS\Factory::getLanguage();
$lang->load('plg_pagebuilderck_contact2', JPATH_ADMINISTRATOR, $lang->getTag(), false);
$this->loadLanguage();
// loads the language files from the contact component
// $lang->load('com_contact', JPATH_SITE, $lang->getTag(), false);
$app = \Joomla\CMS\Factory::getApplication();
if ($app->isClient('site') && $app->input->get('pagebuilderckoption', '', 'string') === 'plg_contact2' && $app->input->get('pagebuildercktask', '', 'cmd') === 'plg.contact2.submit') {
$this->processSubmit();
}
parent::__construct($subject, $params);
}
private function callAssets() {
$css = '.contactck .contactck-label, .contactck .contactck-field {
float: left;
box-sizing: border-box;
width: 50%;
}
.contactck.verticalck .contactck-label, .contactck.verticalck .contactck-field {
float: none;
width: 100%;
}
.contactck-field input[type="text"], .contactck-field select, .contactck-field input[type="email"], .contactck-field textarea {
width: 100%;
box-sizing: border-box;
' . (version_compare(JVERSION, 4) > 0 ? '' : 'height: 100%;') . '
}';
// $doc = \Joomla\CMS\Factory::getDocument();
PagebuilderckFrontHelper::addStyleDeclaration($css);
PagebuilderckFrontHelper::addStylesheet(\Joomla\CMS\Uri\Uri::root(true) . '/plugins/pagebuilderck/contact2/assets/contact.css');
}
private function processSubmit() {
$this->loadLanguage();
require_once(JPATH_SITE . '/plugins/pagebuilderck/' . $this->type . '/contact2helper.php');
plgPagebuilderckContact2Helper::processSubmit();
}
/*
* Construct the Menu Item to drag into the interface
*
* Return Object with item data
*/
public function onPagebuilderckAddItemToMenu() {
$this->callAssets();
// load the language files of the plugin
$this->loadLanguage();
// create the menu item
$menuitem = new stdClass();
$menuitem->type = $this->type;
$menuitem->group = 'other';
$menuitem->title = \Joomla\CMS\Language\Text::_($this->context . '_MENUITEM_TITLE');
$menuitem->description = \Joomla\CMS\Language\Text::_($this->context . '_MENUITEM_DESC');
$menuitem->image = \Joomla\CMS\Uri\Uri::root(true) . '/plugins/pagebuilderck/contact2/assets/images/contact.svg';
return $menuitem;
}
/*
* Display the html code for the item to be used into the interface
*
* Return String the html code
*/
public function onPagebuilderckLoadItemContentContact2() {
$this->loadLanguage();
// ckstyle and inner classes are needed to get the styles from the interface
$input = \Joomla\CMS\Factory::getApplication()->input;
$id = $input->get('ckid', '', 'string');
?>
<div id="<?php echo $id; ?>" class="cktype" data-type="<?php echo $this->type ?>">
<div class="tab_rowstyles ckprops" contactckrowsmarginbottom="10" fieldslist="contactckrowsmarginbottom"></div>
<div class="tab_inputstyles ckprops" contactckinputspaddingtop="6" contactckinputspaddingright="6" contactckinputspaddingbottom="6" contactckinputspaddingleft="6" fieldslist="contactckinputspaddingtop,contactckinputspaddingright,contactckinputspaddingbottom,contactckinputspaddingleft"></div>
<div class="tab_contact ckprops" contactcklayout="vertical" contactckshowlabels="1" fieldslist="contactcklayout,contactckshowlabels"></div>
<div class="tab_buttonstyles ckprops" contactckbuttonsbackgroundcolorstart="#e8e8e8" contactckbuttonspaddingtop="5" contactckbuttonspaddingright="12" contactckbuttonspaddingbottom="5" contactckbuttonspaddingleft="12" contactckbuttonsborderscolor="#c7c7c7" contactckbuttonsborderssize="1" contactckbuttonsbordersstyle="solid" fieldslist="contactckbuttonsbackgroundcolorstart,contactckbuttonspaddingtop,contactckbuttonspaddingright,contactckbuttonspaddingbottom,contactckbuttonspaddingleft,contactckbuttonsborderscolor,contactckbuttonsborderssize,contactckbuttonsbordersstyle"></div>
<div class="ckstyle">
<style>
#<?php echo $id; ?> .contactck .contactck-group { margin-bottom: 10px; }
#<?php echo $id; ?> .contactck input, #<?php echo $id; ?> .contactck textarea { padding: 6px 6px; }
#<?php echo $id; ?> .contactck .contactck-button {
background: #e8e8e8;
border: #c7c7c7 1px solid;
padding-top: 5px;
padding-right: 12px;
padding-bottom: 5px;
padding-left: 12px;
}
</style>
</div>
<div class="inner">
<div class="contactck verticalck">
<div id="contactck<?php echo $id ?>" class="form-horizontal">
<div class="contactck-column" style="width: calc(100%); margin-bottom: 10px;">
<div class="contactck-group clearfix">
<div class="contactck-label">
<label id="<?php echo $id ?>_name-lbl" class="" title="" for="<?php echo $id ?>_name" >
Name
</label>
</div>
<div class="contactck-field" data-placeholder="Name">
<input id="<?php echo $id ?>_name" data-id="<?php echo $id ?>_name" name="<?php echo $id ?>[name]" class="ckcontactfield" type="text" size="30" value="" data-name="name">
</div>
</div>
<div class="contactck-group clearfix">
<div class="contactck-label">
<label id="<?php echo $id ?>_email-lbl" class="" title="" for="<?php echo $id ?>_email" >
E-mail
</label>
</div>
<div class="contactck-field" data-placeholder="E-mail">
<input id="<?php echo $id ?>_email" data-id="<?php echo $id ?>_email" name="<?php echo $id ?>[email]" class="ckcontactfield" type="text" size="30" value=""data-name="email">
</div>
</div>
<div class="contactck-group clearfix">
<div class="contactck-label">
<label id="<?php echo $id ?>_subject-lbl" class="" title="" for="<?php echo $id ?>_subject" >
Subject
</label>
</div>
<div class="contactck-field" data-placeholder="Subject">
<input id="<?php echo $id ?>_subject" data-id="<?php echo $id ?>_subject" name="<?php echo $id ?>[subject]" class="ckcontactfield" type="text" size="30" value="" data-name="subject">
</div>
</div>
<div class="contactck-group clearfix">
<div class="contactck-label">
<label id="<?php echo $id ?>_message-lbl" class="" title="" for="<?php echo $id ?>_message" >
Message
<span class="star"> *</span>
</label>
</div>
<div class="contactck-field" data-placeholder="Message">
<textarea id="<?php echo $id ?>_message" data-id="<?php echo $id ?>_message" name="<?php echo $id ?>[message]" class="ckcontactfield" type="textarea" size="30" value="" data-name="message" data-required="1" ></textarea>
</div>
</div>
<div class="contactck-group clearfix captcha" data-type="captcha">
<div style="text-align: left;">
<img src="<?php echo \Joomla\CMS\Uri\Uri::root(true) ?>/plugins/pagebuilderck/contact2/assets/images/captcha.png" width="302" height="76" />
</div>
</div>
<div class="contactck-actions">
<button class="contactck-button" type="submit" onclick="javascript:void(0)"><?php echo \Joomla\CMS\Language\Text::_('PLG_PAGEBUILDERCK_CONTACT_SEND'); ?></button>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
/*
* Display the html code for the item to be used into the interface
*
* Return String the html code
*/
public function onPagebuilderckLoadItemOptionsContact2() {
// load the language files of the plugin
$this->loadLanguage();
// load the interface for the options
$tpl = JPATH_SITE . '/plugins/pagebuilderck/contact2/layouts/edit_contact2.php';
return $tpl;
}
private function addPlaceholders() {
$js = "jQuery(document).ready(function() {
jQuery('.contactck-field').each(function() {
let field = jQuery(this).find('input, textarea');
let placeholder = jQuery(this).attr('data-placeholder');
if (field.attr('required')) placeholder += '*';
field.attr('placeholder', placeholder);
});
});";
$doc = \Joomla\CMS\Factory::getDocument();
$doc->addScriptDeclaration($js);
}
/*
* Display the html code for the item to be used into the frontend page
* @param string the item object from simple_html_dom
*
* Return String the html code
*/
public function onPagebuilderckRenderItemContact2($item) {
// load the language files of the plugin
$this->loadLanguage();
$this->callAssets();
// load the helper to help us to use the parameters
include_once JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/helpers/pagebuilderckfront.php';
// get params from page builder interface
$attrs = $item->find('.tab_contact'); // this is the tab id in the interface which contains the map options
$pbckParams = PagebuilderckFrontHelper::createParamsFromElement($attrs);
// get params from page builder interface
$attrs = $item->find('.tab_contactemail'); // this is the tab id in the interface which contains the map options
$pbckParamsEmail = PagebuilderckFrontHelper::createParamsFromElement($attrs);
$app = \Joomla\CMS\Factory::getApplication();
// add the validation script
$doc = \Joomla\CMS\Factory::getDocument();
$doc->addScript(\Joomla\CMS\Uri\Uri::root(true) . '/media/system/js/validate.js');
if ($pbckParams->get('contactckshowlabels') == 'placeholder') {
$this->addPlaceholders();
}
$systemMessages = array();
$showLabels = $pbckParams->get('contactckshowlabels', '1');
$buttonAlign = 'left';
if ($pbckParams->get('buttonalignementleft', '') == 'checked') $buttonAlign = 'left';
if ($pbckParams->get('buttonalignementcenter', '') == 'checked') $buttonAlign = 'center';
if ($pbckParams->get('buttonalignementright', '') == 'checked') $buttonAlign = 'right';
// ckstyle and inner classes are needed to get the styles from the interface
$ckstyle = $item->find('.ckstyle');
$styles = count($ckstyle) ? $ckstyle[0]->innertext : '';
$styles .= '@media only screen and (max-width:' . (int)$pbckParams->get('responsiveresolution', '640') . 'px){
#'.$item->attr['id'].' div.contactck > div {
display: block;
}
#'.$item->attr['id'].' .contactck-column {
width: 100% !important;
}
}';
// find all types in the page
foreach($item->find('.contactck-label label') as $e) {
$e->innertext = \Joomla\CMS\Language\Text::_($e->innertext);
}
$item->find('.captcha')[0]->innertext = '';
// replace the captcha
// get info from the plugin options
$plugin = \Joomla\CMS\Plugin\PluginHelper::getPlugin('pagebuilderck', 'contact2');
$pluginParams = new \Joomla\Registry\Registry($plugin->params);
$captcha = $pluginParams->get('enablecaptcha', '1');
if ($captcha == '1') {
$plugin = \Joomla\CMS\Factory::getConfig()->get('captcha');
if ($plugin !== '0') {
$captcha = \Joomla\CMS\Captcha\Captcha::getInstance($plugin, array('namespace' => 'plg_pagebuilderck_contact'));
if ($captcha != null) {
$item->find('.captcha')[0]->innertext = $captcha->display('contactck_captcha', 'contactck_captcha', 'g-recaptcha required');
}
} else {
$systemMessages[] = array(\Joomla\CMS\Language\Text::_('PLG_PAGEBUILDERCK_CONTACT_CAPTCHA_NOT_LOADED'), 'danger');
}
}
// else {
// $item->find('.captcha')[0]->innertext = '';
// }
$input = \Joomla\CMS\Factory::getApplication()->input;
$id = $input->get('ckid', '', 'string');
// check if the recipient has been set
if ($pbckParamsEmail->get('contactemail') == '') {
$systemMessages[] = array(\Joomla\CMS\Language\Text::_('PLG_PAGEBUILDERCK_CONTACT_RECIPIENT_EMPTY'), 'warning');
}
ob_start();
?>
<div class="ckstyle">
<?php echo $styles ?>
</div>
<div class="inner">
<?php
$session = \Joomla\CMS\Factory::getSession();
$successMessage = $session->get('pagebuilderck_contact_successmessage_' . $item->attr['id']);
if ($successMessage) $systemMessages[] = $successMessage;
$session->set('pagebuilderck_contact_successmessage_' . $item->attr['id'], '');
foreach ($systemMessages as $m) {
$text = $m[0];
$type = isset($m[1]) ? ' alert-' . $m[1] : '';
if ($text) {
?>
<div class="alert<?php echo $type ?>"><?php echo $text ?></div>
<?php
}
}
?>
<form id="contactck<?php echo $item->attr['id'] ?>" method="post" class="form-validate form-horizontal">
<div class="contactck <?php echo ($pbckParams->get('contactcklayout') == 'vertical' ? 'verticalck' : ''); ?>">
<?php
$text = $pbckParams->get('sendbuttontext') ? \Joomla\CMS\Language\Text::_($pbckParams->get('sendbuttontext')) : \Joomla\CMS\Language\Text::_('PLG_PAGEBUILDERCK_CONTACT_SEND');
$item->find('.contactck-button')[0]->innertext = $text;
// store the labels names
$labels = array();
foreach ($item->find('.contactck-field') as $f) {
$fieldid = addslashes($f->find('.ckcontactfield')[0]->{'data-name'});
$labels[$fieldid] = addslashes($f->{'data-placeholder'});
}
?>
<input type="hidden" id="labels" name="labels" value="<?php echo htmlspecialchars(serialize($labels)) ?>" />
<?php
// fix issue with duplicate ID
$div = $item->find('.contactck')[0];
$div->children(0)->id .= '_wrap';
// render the form
echo str_replace('data-required="1"', 'required', $div->innertext);
?>
<?php
if ($pbckParamsEmail->get('show_email_copy_1', '') === 'checked'
|| $pbckParamsEmail->get('show_email_copy', '') === '1'
) { ?>
<div class="contactck-group clearfix">
<div class="contactck-field" data-placeholder="<?php echo \Joomla\CMS\Language\Text::_('PLG_PAGEBUILDERCK_CONTACT_EMAIL_A_COPY_LABEL') ?>">
<div>
<label class="contactck-label-checkbox" style="display: inline-block;float: none;" for="<?php echo $item->attr['id'] ?>_copyemail"><?php echo \Joomla\CMS\Language\Text::_('PLG_PAGEBUILDERCK_CONTACT_EMAIL_A_COPY_LABEL') ?></label>
<input type="checkbox" data-name="copyemail" data-id="<?php echo $item->attr['id'] ?>_copyemail" name="<?php echo $item->attr['id'] ?>[copyemail][]" id="<?php echo $item->attr['id'] ?>_copyemail" class="ckcontactfield" value="1">
</div>
</div>
</div>
<?php } else if ($pbckParamsEmail->get('show_email_copy', '') === '2') { ?>
<input type="hidden" data-name="copyemail" data-id="<?php echo $item->attr['id'] ?>_copyemail" name="<?php echo $item->attr['id'] ?>[copyemail][]" id="<?php echo $item->attr['id'] ?>_copyemail" class="ckcontactfield" value="1">
<?php } ?>
<input type="hidden" name="pagebuilderckoption" value="plg_contact2" />
<input type="hidden" name="pagebuildercktask" value="plg.contact2.submit" />
<input type="hidden" name="pagebuilderckid" value="<?php echo $item->attr['id'] ?>" />
<input type="hidden" name="return" value="" />
<?php echo \Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
</div>
</form>
</div>
<?php
$html = ob_get_clean();
return $html;
}
}