Last active
January 29, 2019 10:40
-
-
Save hans2103/e4f322fe7c7d31a48a4e635bfc2c9534 to your computer and use it in GitHub Desktop.
add class to label in RSForm Pro Payment plugin for Joomla
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package RSForm!Pro | |
* @copyright (C) 2007-2019 www.rsjoomla.com | |
* @license GPL, http://www.gnu.org/copyleft/gpl.html | |
*/ | |
// no direct access | |
defined('_JEXEC') or die('Restricted access'); | |
define('RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT', 21); | |
define('RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS', 22); | |
define('RSFORM_FIELD_PAYMENT_DONATION', 28); | |
define('RSFORM_FIELD_PAYMENT_TOTAL', 23); | |
define('RSFORM_FIELD_PAYMENT_CHOOSE', 27); | |
class plgSystemRsfppayment extends JPlugin | |
{ | |
protected $_products = array(); | |
protected $newComponents = array( | |
RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT, | |
RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS, | |
RSFORM_FIELD_PAYMENT_TOTAL, | |
RSFORM_FIELD_PAYMENT_CHOOSE, | |
RSFORM_FIELD_PAYMENT_DONATION | |
); | |
public function __construct( &$subject, $config ) { | |
parent::__construct( $subject, $config ); | |
$this->loadLanguage(); | |
} | |
public function rsfp_bk_onAfterShowComponents() { | |
JFactory::getLanguage()->load('plg_system_rsfppayment'); | |
$formId = JFactory::getApplication()->input->getInt('formId'); | |
$link1 = "displayTemplate('" . RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT . "')"; | |
$link2 = "displayTemplate('" . RSFORM_FIELD_PAYMENT_TOTAL . "')"; | |
$link3 = "displayTemplate('" . RSFORM_FIELD_PAYMENT_CHOOSE . "')"; | |
$link4 = "displayTemplate('" . RSFORM_FIELD_PAYMENT_DONATION . "')"; | |
if ($components = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT)) | |
$link1 = "displayTemplate('" . RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT . "', '".$components[0]."')"; | |
if ($components = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_TOTAL)) | |
$link2 = "displayTemplate('" . RSFORM_FIELD_PAYMENT_TOTAL . "', '".$components[0]."')"; | |
if ($components = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_CHOOSE)) | |
$link3 = "displayTemplate('" . RSFORM_FIELD_PAYMENT_CHOOSE . "', '".$components[0]."')"; | |
if ($components = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_DONATION)) | |
$link4 = "displayTemplate('" . RSFORM_FIELD_PAYMENT_DONATION . "', '".$components[0]."')"; | |
?> | |
<li class="rsform_navtitle"><?php echo JText::_('RSFP_PAYMENT'); ?></li> | |
<li><a href="javascript: void(0);" onclick="<?php echo $link1; ?>" id="rsfpc<?php echo RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT; ?>"><span class="rsficon rsficon-dollar2"></span><span class="inner-text"><?php echo JText::_('RSFP_SPRODUCT'); ?></span></a></li> | |
<li><a href="javascript: void(0);" onclick="displayTemplate('<?php echo RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS; ?>')" id="rsfpc<?php echo RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS; ?>"><span class="rsficon rsficon-dollar2"></span><span class="inner-text"><?php echo JText::_('RSFP_MPRODUCT'); ?></span></a></li> | |
<li><a href="javascript: void(0);" onclick="<?php echo $link4; ?>" id="rsfpc<?php echo RSFORM_FIELD_PAYMENT_DONATION; ?>"><span class="rsficon rsficon-moneybag"></span><span class="inner-text"><?php echo JText::_('RSFP_DONATION'); ?></span></a></li> | |
<li><a href="javascript: void(0);" onclick="<?php echo $link2; ?>" id="rsfpc<?php echo RSFORM_FIELD_PAYMENT_TOTAL; ?>"><span class="rsficon rsficon-dollar"></span><span class="inner-text"><?php echo JText::_('RSFP_TOTAL'); ?></span></a></li> | |
<li><a href="javascript: void(0);" onclick="<?php echo $link3; ?>" id="rsfpc<?php echo RSFORM_FIELD_PAYMENT_CHOOSE; ?>"><span class="rsficon rsficon-list-alt"></span><span class="inner-text"><?php echo JText::_('RSFP_CHOOSE_PAYMENT'); ?></span></a></li> | |
<?php | |
} | |
public function rsfp_bk_onAfterShowFormEditTabs() { | |
$formId = JFactory::getApplication()->input->getInt('formId'); | |
$lang = JFactory::getLanguage(); | |
$lang->load('plg_system_rsfppayment'); | |
$row = JTable::getInstance('RSForm_Payment', 'Table'); | |
if (!$row) | |
return; | |
$row->load($formId); | |
$row->params = !empty($row->params) ? unserialize($row->params) : new stdClass(); | |
$def_params = array('UserEmail', 'AdminEmail', 'AdditionalEmails'); | |
foreach ($def_params as $def_param) | |
if (!isset($row->params->{$def_param})) | |
$row->params->{$def_param} = 0; | |
$lists['UserEmail'] = RSFormProHelper::renderHTML('select.booleanlist','payment[UserEmail]','class="inputbox"',$row->params->UserEmail); | |
$lists['AdminEmail'] = RSFormProHelper::renderHTML('select.booleanlist','payment[AdminEmail]','class="inputbox"',$row->params->AdminEmail); | |
$lists['AdditionalEmails'] = RSFormProHelper::renderHTML('select.booleanlist','payment[AdditionalEmails]','class="inputbox"',$row->params->AdditionalEmails); | |
echo '<div id="paymentdiv">'; | |
include JPATH_ADMINISTRATOR.'/components/com_rsform/helpers/payment.php'; | |
echo '</div>'; | |
} | |
public function rsfp_bk_onAfterShowFormEditTabsTab() { | |
$lang = JFactory::getLanguage(); | |
$lang->load('plg_system_rsfppayment'); | |
echo '<li><a href="javascript: void(0);"><span class="rsficon rsficon-dollar2"></span><span class="inner-text">'.JText::_('RSFP_PAYMENT_EMAIL_SETTINGS').'</span></a></li>'; | |
} | |
public function rsfp_onFormSave($form) { | |
$post = JRequest::get('post', JREQUEST_ALLOWRAW); | |
$row = JTable::getInstance('RSForm_Payment', 'Table'); | |
if (!$row) | |
return; | |
$row->form_id = $post['formId']; | |
$params = new stdClass(); | |
if (isset($post['payment']) && is_array($post['payment'])) | |
foreach ($post['payment'] as $key => $value) | |
$params->{$key} = $value; | |
$row->params = serialize($params); | |
$db = JFactory::getDbo(); | |
$db->setQuery("SELECT form_id FROM #__rsform_payment WHERE form_id='".(int) $post['formId']."'"); | |
if (!$db->loadResult()) | |
{ | |
$db->setQuery("INSERT INTO #__rsform_payment SET form_id='".(int) $post['formId']."'"); | |
$db->execute(); | |
} | |
if ($row->store()) | |
{ | |
return true; | |
} | |
else | |
{ | |
JError::raiseWarning(500, $row->getError()); | |
return false; | |
} | |
} | |
public function rsfp_bk_onFormCopy($args){ | |
$formId = $args['formId']; | |
$newFormId = $args['newFormId']; | |
if ($row = JTable::getInstance('RSForm_Payment', 'Table') ) | |
{ | |
if ($row->load($formId)) { | |
if (!$row->bind(array('form_id'=>$newFormId))) { | |
JError::raiseWarning(500, $row->getError()); | |
return false; | |
} | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true) | |
->select($db->qn('form_id')) | |
->from($db->qn('#__rsform_payment')) | |
->where($db->qn('form_id').'='.$db->q($newFormId)); | |
if (!$db->setQuery($query)->loadResult()) { | |
$query = $db->getQuery(true) | |
->insert($db->qn('#__rsform_payment')) | |
->set($db->qn('form_id').'='.$db->q($newFormId)); | |
$db->setQuery($query)->execute(); | |
} | |
if ($row->store()) | |
{ | |
return true; | |
} | |
else | |
{ | |
JError::raiseWarning(500, $row->getError()); | |
return false; | |
} | |
} | |
} | |
} | |
public function rsfp_onAfterCreateQuickAddPlaceholders(& $placeholders, $componentId) | |
{ | |
if (in_array($componentId, $this->newComponents)) | |
{ | |
switch ($componentId) | |
{ | |
case RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT: | |
case RSFORM_FIELD_PAYMENT_TOTAL: | |
case RSFORM_FIELD_PAYMENT_DONATION: | |
$placeholders['display'][] = '{' . $placeholders['name'] . ':price}'; | |
break; | |
case RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS: | |
$placeholders['display'][] = '{' . $placeholders['name'] . ':text}'; | |
$placeholders['display'][] = '{' . $placeholders['name'] . ':price}'; | |
break; | |
case RSFORM_FIELD_PAYMENT_CHOOSE: | |
$placeholders['display'][] = '{' . $placeholders['name'] . ':text}'; | |
break; | |
} | |
} | |
return $placeholders; | |
} | |
public function rsfp_bk_onAfterCreateComponentPreview($args = array()) { | |
$nodecimals = RSFormProHelper::getConfig('payment.nodecimals'); | |
$decimal = RSFormProHelper::getConfig('payment.decimal'); | |
$thousands = RSFormProHelper::getConfig('payment.thousands'); | |
$currency = RSFormProHelper::getConfig('payment.currency'); | |
switch ($args['ComponentTypeName']) | |
{ | |
case 'singleProduct': | |
if (!$args['data']['PRICE']) { | |
$args['data']['PRICE'] = 0; | |
} | |
$args['out'] = '<td>'.$args['data']['CAPTION'].'</td>'; | |
$args['out'].= '<td><span class="rsficon rsficon-dollar2" style="font-size:24px;margin-right:5px"></span> '.$args['data']['CAPTION'].' - '.number_format($args['data']['PRICE'], $nodecimals, $decimal, $thousands).' '.$currency.'</td>'; | |
break; | |
case 'multipleProducts': | |
$out =& $args['out']; | |
$data =& $args['data']; | |
$out = '<td>'.$data['CAPTION'].'</td>'; | |
$out .= '<td><span class="rsficon rsficon-dollar2" style="font-size:24px;margin-right:5px"></span>'; | |
$items = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS'])); | |
if ($data['VIEW_TYPE'] == 'DROPDOWN') { | |
$out .= '<select '.($data['MULTIPLE']=='YES' ? 'multiple="multiple"' : '').'>'; | |
$special = array('[c]', '[g]', '[d]'); | |
foreach ($items as $item) { | |
$strippedItem = str_replace($special, '', $item); | |
if (strpos($item, '|') !== false) | |
{ | |
list($val, $txt) = explode('|', $strippedItem, 2); | |
} | |
else | |
{ | |
$val = 0; | |
$txt = $strippedItem; | |
} | |
if ($val) { | |
$txt_price = $this->_getPriceMask($txt, $val); | |
} else { | |
$txt_price = $txt; | |
} | |
// <optgroup> | |
if (strpos($item, '[g]') !== false) { | |
$out .= '<optgroup label="'.$this->_escape($val).'">'; | |
continue; | |
} | |
// </optgroup> | |
if(strpos($item, '[/g]') !== false) { | |
$out .= '</optgroup>'; | |
continue; | |
} | |
$additional = ''; | |
// selected | |
if (strpos($item, '[c]') !== false) | |
$additional .= 'selected="selected"'; | |
// disabled | |
if (strpos($item, '[d]') !== false) | |
$additional .= 'disabled="disabled"'; | |
$out .= '<option '.$additional.' value="'.($val ? $this->_escape($txt) : '').'">'.$this->_escape($txt_price).'</option>'; | |
} | |
$out .= '</select>'; | |
} elseif ($data['VIEW_TYPE'] == 'CHECKBOX' || $data['VIEW_TYPE'] == 'RADIOGROUP') { | |
$i = 0; | |
$special = array('[c]', '[d]'); | |
$type = $data['VIEW_TYPE'] == 'CHECKBOX' ? 'checkbox' : 'radio'; | |
foreach ($items as $item) { | |
$strippedItem = str_replace($special, '', $item); | |
if (strpos($item, '|') !== false) | |
{ | |
list($val, $txt) = explode('|', $strippedItem, 2); | |
} | |
else | |
{ | |
$val = 0; | |
$txt = $strippedItem; | |
} | |
$txt_price = $this->_getPriceMask($txt, $val); | |
$additional = ''; | |
// checked | |
if (strpos($item, '[c]') !== false) | |
$additional .= 'checked="checked"'; | |
// disabled | |
if (strpos($item, '[d]') !== false) | |
$additional .= 'disabled="disabled"'; | |
$out .= '<label class="'.$type.($data['FLOW'] != 'VERTICAL' ? ' inline':'').'"><input '.$additional.' type="'.$type.'" value="'.$this->_escape($txt).'" />'.$txt_price.'</label>'; | |
$i++; | |
} | |
} | |
$out .= '</td>'; | |
break; | |
case 'total': | |
$args['out'] = '<td>'.$args['data']['CAPTION'].'</td>'; | |
$args['out'].= '<td><span class="rsficon rsficon-dollar" style="font-size:24px;margin-right:5px"></span> '.number_format(0, $nodecimals, $decimal, $thousands).' '.$currency.'</td>'; | |
break; | |
case 'choosePayment': | |
$out =& $args['out']; | |
$data =& $args['data']; | |
$out = '<td>'.$data['CAPTION'].'</td>'; | |
$out .= '<td><span class="rsficon rsficon-list-alt" style="font-size:24px;margin-right:5px"></span> '; | |
$items = $this->_getPayments($args['formId']); | |
if ($data['VIEW_TYPE'] == 'DROPDOWN') { | |
$out .= '<select>'; | |
foreach ($items as $item) { | |
$out .= '<option>'.$this->_escape($item->text).'</option>'; | |
} | |
$out .= '</select>'; | |
} elseif ($data['VIEW_TYPE'] == 'RADIOGROUP') { | |
$i = 0; | |
foreach ($items as $item) | |
{ | |
$selectDefault = false; | |
if ((!empty($data['SELECT_FIRST_ITEM']) && $data['SELECT_FIRST_ITEM'] == 'YES') || empty($data['SELECT_FIRST_ITEM'])) | |
{ | |
$selectDefault = $i == 0; | |
} | |
$checked = $selectDefault ? 'checked="checked"' : ''; | |
$out .= '<label for="'.$data['NAME'].$i.'" class="radio'.($data['FLOW'] != 'VERTICAL' ? ' inline': '').'"><input '.$checked.' type="radio" value="'.$this->_escape($item->value).'" id="'.$data['NAME'].$i.'" />'.$this->_escape($item->text).'</label>'; | |
$i++; | |
} | |
} | |
$out .= '</td>'; | |
break; | |
case 'donationProduct': | |
$defaultValue = RSFormProHelper::isCode($args['data']['DEFAULTVALUE']); | |
$args['out'] = '<td>'.$args['data']['CAPTION'].'</td>'; | |
$args['out'] .= '<td><span class="rsficon rsficon-moneybag" style="font-size:24px;margin-right:5px"></span> <input type="text" value="'.$this->_escape($defaultValue).'" size="'.$args['data']['SIZE'].'" /></td>'; | |
break; | |
} | |
} | |
public function rsfp_bk_onAfterShowConfigurationTabs($tabs) { | |
$lang = JFactory::getLanguage(); | |
$lang->load('plg_system_rsfppayment'); | |
$tabs->addTitle(JText::_('RSFP_PAYMENT'), 'form-payment'); | |
$tabs->addContent($this->paymentConfigurationScreen()); | |
} | |
public function rsfp_bk_onCreateConditionOptionFields($args) | |
{ | |
$args['types'][] = RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS; | |
} | |
public function rsfp_bk_onCreateConditionOptionFieldItem($args) | |
{ | |
if ($args['field']->ComponentTypeId == RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS) | |
{ | |
$args['item']->value = $args['item']->label; | |
} | |
} | |
protected function addOnChange(&$attributes, $onChange) | |
{ | |
if (preg_match('#onchange="(.*?)"#is', $attributes, $matches)) | |
$attributes = str_replace($matches[0], str_replace($matches[1], $matches[1].'; '.$onChange, $matches[0]), $attributes); | |
else | |
$attributes .= ' onchange="'.$onChange.'"'; | |
return $attributes; | |
} | |
public static function addOnClick(&$attributes, $onClick) | |
{ | |
if (preg_match('#onclick="(.*?)"#is', $attributes, $matches)) | |
$attributes = str_replace($matches[0], str_replace($matches[1], $matches[1].'; '.$onClick, $matches[0]), $attributes); | |
else | |
$attributes .= ' onclick="'.$onClick.'"'; | |
return $attributes; | |
} | |
public function rsfp_bk_onAfterCreateFrontComponentBody($args) { | |
$db = JFactory::getDbo(); | |
$nodecimals = RSFormProHelper::getConfig('payment.nodecimals'); | |
$decimal = RSFormProHelper::getConfig('payment.decimal'); | |
$thousands = RSFormProHelper::getConfig('payment.thousands'); | |
$currency = RSFormProHelper::getConfig('payment.currency'); | |
$totalMask = RSFormProHelper::getConfig('payment.totalmask'); | |
$showPaymentIcons = true; //RSFormProHelper::getConfig('payment.paymenticon', 1); | |
$value = $args['value']; | |
$formId = (int) $args['formId']; | |
$query = $db->getQuery(true) | |
->select($db->qn('FormLayoutName')) | |
->from($db->qn('#__rsform_forms')) | |
->where($db->qn('FormId') . ' = ' . $db->q($formId)); | |
$layoutName = $db->setQuery($query)->loadResult(); | |
$out =& $args['out']; | |
$data =& $args['data']; | |
$invalid =& $args['invalid']; | |
switch($args['r']['ComponentTypeId']) | |
{ | |
case RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT: | |
{ | |
$out = '<input type="hidden" value="'.$this->_escape($data['PRICE']).'" />'; | |
$out .= '<input type="hidden" name="form['.$data['NAME'].']" id="'.$data['NAME'].'" value="'.$this->_escape($data['CAPTION']).'" />'; | |
if ($data['SHOW'] == 'YES') | |
{ | |
$out .= $this->_getPriceMask($data['CAPTION'], $data['PRICE']); | |
} | |
} | |
break; | |
case RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS: | |
{ | |
if (!isset($this->_products[$args['componentId']])) { | |
$this->_products[$args['componentId']] = array(); | |
} | |
switch($args['data']['VIEW_TYPE']) | |
{ | |
case 'DROPDOWN': | |
{ | |
$className = 'rsform-select-box'; | |
switch ($layoutName) | |
{ | |
case 'bootstrap3': | |
$className .= ' form-control'; | |
break; | |
case 'bootstrap4': | |
$className .= ' form-control custom-select'; | |
break; | |
case 'uikit3': | |
$className .= ' uk-select'; | |
break; | |
} | |
if ($invalid) | |
$className .= ' rsform-error'; | |
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className); | |
$onChange = 'getPrice_'.$args['formId'].'();'; | |
$this->addOnChange($data['ADDITIONALATTRIBUTES'], $onChange); | |
$out .= '<select '.($data['MULTIPLE']=='YES' ? 'multiple="multiple"' : '').' name="form['.$data['NAME'].'][]" '.((int) $data['SIZE'] > 0 ? 'size="'.(int) $data['SIZE'].'"' : '').' id="payment-'.$args['componentId'].'" '.$data['ADDITIONALATTRIBUTES'].'>'; | |
$items = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS'])); | |
$special = array('[c]', '[g]', '[d]'); | |
foreach ($items as $item) | |
{ | |
$price = 0; | |
$strippedItem = str_replace($special, '', $item); | |
if (strpos($item, '|') !== false) | |
{ | |
list($val, $txt) = explode('|', $strippedItem, 2); | |
} | |
else | |
{ | |
$val = $txt = $strippedItem; | |
} | |
if ((float) $val > 0) | |
{ | |
$price = (float) $val; | |
$txt_price = $this->_getPriceMask($txt, $val); | |
} | |
else | |
{ | |
// No point showing - 0.00 | |
$txt_price = $txt; | |
if ((string) $val === '0') | |
{ | |
$val = $txt; | |
} | |
} | |
// <optgroup> | |
if (strpos($item, '[g]') !== false) { | |
$out .= '<optgroup label="'.$this->_escape($val).'">'; | |
continue; | |
} | |
// </optgroup> | |
if(strpos($item, '[/g]') !== false) { | |
$out .= '</optgroup>'; | |
continue; | |
} | |
$additional = ''; | |
// selected | |
if ((strpos($item, '[c]') !== false && empty($value)) || (isset($value[$data['NAME']]) && in_array($txt, (array) $value[$data['NAME']]))) | |
$additional .= 'selected="selected"'; | |
// disabled | |
if (strpos($item, '[d]') !== false) | |
$additional .= 'disabled="disabled"'; | |
$out .= '<option '.$additional.' value="'.($val ? $this->_escape($txt) : '').'">'.$this->_escape($txt_price).'</option>'; | |
$this->_products[$args['componentId']][] = array( | |
'val' => $price, | |
'txt' => $txt | |
); | |
} | |
$out .= '</select>'; | |
} | |
break; | |
case 'CHECKBOX': | |
{ | |
$i = 0; | |
$items = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS'])); | |
$special = array('[c]', '[d]'); | |
$onClick = 'getPrice_'.$args['formId'].'();'; | |
$this->addOnClick($data['ADDITIONALATTRIBUTES'], $onClick); | |
foreach ($items as $item) | |
{ | |
$price = 0; | |
$strippedItem = str_replace($special, '', $item); | |
if (strpos($item, '|') !== false) | |
{ | |
list($val, $txt) = explode('|', $strippedItem, 2); | |
} | |
else | |
{ | |
$val = $txt = $strippedItem; | |
} | |
if ((float) $val > 0) | |
{ | |
$price = (float) $val; | |
$txt_price = $this->_getPriceMask($txt, $val); | |
} | |
else | |
{ | |
// No point showing - 0.00 | |
$txt_price = $txt; | |
if ((string) $val === '0') | |
{ | |
$val = $txt; | |
} | |
} | |
$additional = ''; | |
// checked | |
if ((strpos($item, '[c]') !== false && empty($value)) || (isset($value[$data['NAME']]) && in_array($txt, (array) $value[$data['NAME']]))) | |
$additional .= 'checked="checked"'; | |
// disabled | |
if (strpos($item, '[d]') !== false) | |
$additional .= 'disabled="disabled"'; | |
$input = '<input '.$additional.' name="form['.$data['NAME'].'][]" type="checkbox" value="'.$this->_escape($txt).'" id="payment-'.$args['componentId'].'-'.$i.'" '.$data['ADDITIONALATTRIBUTES'].' />'; | |
$labelClass = $showPaymentIcons ? ' icon icon--' . $this->_escape($txt) : null; | |
switch ($layoutName) | |
{ | |
case 'bootstrap2': | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="checkbox'.($data['FLOW'] != 'VERTICAL' ? ' inline' : '').'">'.$input.$txt_price.'</label>'; | |
break; | |
case 'bootstrap3': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<div class="checkbox"><label for="payment-'.$args['componentId'].'-'.$i.'" class="checkbox' . $labelClass . '">'.$input.$txt_price.'</label></div>'; | |
} | |
else | |
{ | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="checkbox-inline' . $labelClass . '">'.$input.$txt_price.'</label>'; | |
} | |
break; | |
case 'bootstrap4': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$input = str_replace('type="checkbox"', 'type="checkbox" class="form-check-input"', $input); | |
$out .= '<div class="form-check"><label for="payment-'.$args['componentId'].'-'.$i.'" class="form-check-label">'.$input.$txt_price.'</label></div>'; | |
} | |
else | |
{ | |
$input = str_replace('type="checkbox"', 'type="checkbox" class="form-check-input"', $input); | |
$out .= '<div class="form-check form-check-inline"><label for="payment-'.$args['componentId'].'-'.$i.'" class="form-check-label">'.$input.$txt_price.'</label></div>'; | |
} | |
break; | |
case 'uikit': | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="' . $labelClass . '">'.$input.$txt_price.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
case 'uikit3': | |
$input = str_replace('type="checkbox"', 'type="checkbox" class="uk-checkbox"', $input); | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="' . $labelClass . '">'.$input.$txt_price.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
case 'responsive': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<p class="rsformVerticalClear">'; | |
} | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="' . $labelClass . '">' . $input . $txt_price.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '</p>'; | |
} | |
break; | |
default: | |
$out .= $input.'<label for="payment-'.$args['componentId'].'-'.$i.'" class="' .$labelClass . '">'.$txt_price.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
} | |
$this->_products[$args['componentId']][] = array( | |
'val' => $price, | |
'txt' => $txt | |
); | |
$i++; | |
} | |
} | |
break; | |
case 'RADIOGROUP': | |
{ | |
$i = 0; | |
$items = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS'])); | |
$special = array('[c]', '[d]'); | |
$onClick = 'getPrice_'.$args['formId'].'();'; | |
$this->addOnClick($data['ADDITIONALATTRIBUTES'], $onClick); | |
foreach ($items as $item) | |
{ | |
$price = 0; | |
$strippedItem = str_replace($special, '', $item); | |
if (strpos($item, '|') !== false) | |
{ | |
list($val, $txt) = explode('|', $strippedItem, 2); | |
} | |
else | |
{ | |
$val = $txt = $strippedItem; | |
} | |
if ((float) $val > 0) | |
{ | |
$price = (float) $val; | |
$txt_price = $this->_getPriceMask($txt, $val); | |
} | |
else | |
{ | |
// No point showing - 0.00 | |
$txt_price = $txt; | |
if ((string) $val === '0') | |
{ | |
$val = $txt; | |
} | |
} | |
$additional = ''; | |
// checked | |
if ((strpos($item, '[c]') !== false && empty($value)) || (isset($value[$data['NAME']]) && in_array($txt, (array) $value[$data['NAME']]))) | |
$additional .= 'checked="checked"'; | |
// disabled | |
if (strpos($item, '[d]') !== false) | |
$additional .= 'disabled="disabled"'; | |
$input = '<input '.$additional.' name="form['.$data['NAME'].']" type="radio" value="'.$this->_escape($txt).'" id="payment-'.$args['componentId'].'-'.$i.'" '.$data['ADDITIONALATTRIBUTES'].' />'; | |
$labelClass = $showPaymentIcons ? ' icon icon--' . $this->_escape($txt) : null; | |
switch ($layoutName) | |
{ | |
case 'bootstrap2': | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="radio'.($data['FLOW'] != 'VERTICAL' ? ' inline' : '').$labelClass.'">'.$input.$txt_price.'</label>'; | |
break; | |
case 'bootstrap3': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<div class="radio"><label for="payment-'.$args['componentId'].'-'.$i.'" class="radio' . $labelClass . '">'.$input.$txt_price.'</label></div>'; | |
} | |
else | |
{ | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="radio-inline' . $labelClass . '">'.$input.$txt_price.'</label>'; | |
} | |
break; | |
case 'bootstrap4': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$input = str_replace('type="radio"', 'type="radio" class="form-check-input"', $input); | |
$out .= '<div class="form-check"><label for="payment-'.$args['componentId'].'-'.$i.'" class="form-check-label' . $labelClass . '">'.$input.$txt_price.'</label></div>'; | |
} | |
else | |
{ | |
$input = str_replace('type="radio"', 'type="radio" class="form-check-input"', $input); | |
$out .= '<div class="form-check form-check-inline"><label for="payment-'.$args['componentId'].'-'.$i.'" class="form-check-label' . $labelClass . '">'.$input.$txt_price.'</label></div>'; | |
} | |
break; | |
case 'uikit': | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="' . $labelClass . '">'.$input.$txt_price.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
case 'uikit3': | |
$input = str_replace('type="radio"', 'type="radio" class="uk-radio"', $input); | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="' . $labelClass . '">'.$input.$txt_price.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
case 'responsive': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<p class="rsformVerticalClear">'; | |
} | |
$out .= '<label for="payment-'.$args['componentId'].'-'.$i.'" class="' . $labelClass . '">' . $input . $txt_price . '</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '</p>'; | |
} | |
break; | |
default: | |
$out .= $input.'<label for="payment-'.$args['componentId'].'-'.$i.'" class="' . $labelClass . '">'.$txt_price.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
} | |
$this->_products[$args['componentId']][] = array( | |
'val' => $price, | |
'txt' => $txt | |
); | |
$i++; | |
} | |
} | |
break; | |
} | |
} | |
break; | |
case RSFORM_FIELD_PAYMENT_TOTAL: | |
{ | |
$price = number_format(0, $nodecimals, $decimal, $thousands); | |
$total = str_replace(array('{price}', '{currency}'), array($price, $currency), $totalMask); | |
$args['out'] = '<span id="payment_total_'.$args['formId'].'" class="rsform_payment_total">'.$total.'</span> <input type="hidden" id="'.$args['data']['NAME'].'" value="0" name="form['.$args['data']['NAME'].']" />'; | |
} | |
break; | |
case RSFORM_FIELD_PAYMENT_DONATION: | |
{ | |
$defaultValue = RSFormProHelper::isCode($data['DEFAULTVALUE']); | |
$className = 'rsform-input-box'; | |
if ($layoutName == 'bootstrap3') { | |
$className .= ' form-control'; | |
} | |
if ($invalid) | |
$className .= ' rsform-error'; | |
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className); | |
$out .= '<input type="text" value="'.(isset($value[$data['NAME']]) ? $this->_escape($value[$data['NAME']]) : $this->_escape($defaultValue)).'" size="'.$data['SIZE'].'" '.((int) $data['MAXSIZE'] > 0 ? 'maxlength="'.(int) $data['MAXSIZE'].'"' : '').' onkeyup="getPrice_'.$formId.'()" name="form['.$data['NAME'].']" id="'.$data['NAME'].'" '.$data['ADDITIONALATTRIBUTES'].'/>'; | |
} | |
break; | |
case RSFORM_FIELD_PAYMENT_CHOOSE: | |
{ | |
$data = $args['data']; | |
$out =& $args['out']; | |
$value = $args['value']; | |
if (isset($data['SHOW']) && $data['SHOW'] == 'NO') { | |
RSFormProAssets::addStyleDeclaration('.rsform-block-'.JFilterOutput::stringURLSafe($data['NAME']).' { display: none !important; }'); | |
} | |
$items = $this->_getPayments($args['formId']); | |
if ($data['VIEW_TYPE'] == 'DROPDOWN') { | |
$className = 'rsform-select-box'; | |
switch ($layoutName) | |
{ | |
case 'bootstrap3': | |
$className .= ' form-control'; | |
break; | |
case 'bootstrap4': | |
$className .= ' form-control custom-select'; | |
break; | |
case 'uikit3': | |
$className .= ' uk-select'; | |
break; | |
} | |
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className); | |
$out .= '<select name="form['.$data['NAME'].'][]" id="'.$data['NAME'].'" '.$data['ADDITIONALATTRIBUTES'].' >'; | |
foreach ($items as $item) | |
{ | |
$selected = ''; | |
if (isset($value[$data['NAME']]) && in_array($item->value, (array) $value[$data['NAME']])) | |
$selected = 'selected="selected"'; | |
$out .= '<option '.$selected.' value="'.$this->_escape($item->value).'">'.$this->_escape($item->text).'</option>'; | |
} | |
$out .= '</select>'; | |
} elseif ($data['VIEW_TYPE'] == 'RADIOGROUP') { | |
$i = 0; | |
foreach ($items as $item) | |
{ | |
$selectDefault = false; | |
if ((!empty($data['SELECT_FIRST_ITEM']) && $data['SELECT_FIRST_ITEM'] == 'YES') || empty($data['SELECT_FIRST_ITEM'])) | |
{ | |
$selectDefault = $i == 0; | |
} | |
$checked = ''; | |
if (isset($value[$data['NAME']]) && $item->value == $value[$data['NAME']]) | |
$checked = 'checked="checked"'; | |
elseif (!isset($value[$data['NAME']]) && $selectDefault) | |
$checked = 'checked="checked"'; | |
$input = '<input name="form['.$data['NAME'].']" type="radio" '.$checked.' value="'.$this->_escape($item->value).'" id="'.$data['NAME'].$i.'" '.$data['ADDITIONALATTRIBUTES'].' />'; | |
$text = $this->_escape($item->text); | |
$labelClass = $showPaymentIcons ? ' icon icon--' . $this->_escape($item->value) : null; | |
switch ($layoutName) | |
{ | |
case 'bootstrap2': | |
$out .= '<label for="'.$data['NAME'].$i.'" class="radio'.($data['FLOW'] != 'VERTICAL' ? ' inline' : '').$labelClass.'">'.$input.$text.'</label>'; | |
break; | |
case 'bootstrap3': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<div class="radio"><label for="'.$data['NAME'].$i.'" class="radio' . $labelClass . '">'.$input.$text.'</label></div>'; | |
} | |
else | |
{ | |
$out .= '<label for="'.$data['NAME'].$i.'" class="radio-inline' . $labelClass . '">'.$input.$text.'</label>'; | |
} | |
break; | |
case 'bootstrap4': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$input = str_replace('type="radio"', 'type="radio" class="form-check-input"', $input); | |
$out .= '<div class="form-check"><label for="'.$data['NAME'].$i.'" class="form-check-label' . $labelClass . '">'.$input.$text.'</label></div>'; | |
} | |
else | |
{ | |
$input = str_replace('type="radio"', 'type="radio" class="form-check-input"', $input); | |
$out .= '<div class="form-check form-check-inline"><label for="'.$data['NAME'].$i.'" class="form-check-label' . $labelClass . '">'.$input.$text.'</label></div>'; | |
} | |
break; | |
case 'uikit': | |
$out .= '<label for="'.$data['NAME'].$i.'">'.$input.$text.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
case 'uikit3': | |
$input = str_replace('type="radio"', 'type="radio" class="uk-radio"', $input); | |
$out .= '<label for="'.$data['NAME'].$i.'" class="' . $labelClass . '">'.$input.$text.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
case 'responsive': | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<p class="rsformVerticalClear">'; | |
} | |
$out .= '<label for="'.$data['NAME'].$i.'" class="' . $labelClass . '">' . $input . $text . '</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '</p>'; | |
} | |
break; | |
default: | |
$out .= $input.'<label for="'.$data['NAME'].$i.'" class="' . $labelClass . '">'.$text.'</label>'; | |
if ($data['FLOW'] == 'VERTICAL') | |
{ | |
$out .= '<br />'; | |
} | |
break; | |
} | |
$out .= ' '; | |
$i++; | |
} | |
} | |
} | |
break; | |
} | |
} | |
protected function _escape($string) { | |
return RSFormProHelper::htmlEscape($string); | |
} | |
protected function _getPayments($formId) { | |
$items = array(); | |
$mainframe = JFactory::getApplication(); | |
$mainframe->triggerEvent('rsfp_getPayment', array(&$items, $formId)); | |
return $items; | |
} | |
public function rsfp_afterConfirmPayment($SubmissionId) { | |
RSFormProHelper::sendSubmissionEmails($SubmissionId); | |
} | |
public function rsfp_f_onBeforeFormDisplay($args) { | |
$formId = $args['formId']; | |
$formLayout = &$args['formLayout']; | |
$nodecimals = RSFormProHelper::getConfig('payment.nodecimals'); | |
$decimal = RSFormProHelper::getConfig('payment.decimal'); | |
$thousands = RSFormProHelper::getConfig('payment.thousands'); | |
$currency = RSFormProHelper::getConfig('payment.currency'); | |
$totalMask = RSFormProHelper::getConfig('payment.totalmask'); | |
$donation = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_DONATION); | |
$single = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT); | |
$multiple = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS); | |
$total = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_TOTAL); | |
$allComponents = array(); | |
if ($donation) { | |
$allComponents = array_merge($allComponents, $donation); | |
} | |
if ($single) { | |
$allComponents = array_merge($allComponents, $single); | |
} | |
if ($multiple) { | |
$allComponents = array_merge($allComponents, $multiple); | |
} | |
if ($total) { | |
$allComponents = array_merge($allComponents, $total); | |
} | |
// no point going ahead if we have no fields added | |
if (!$allComponents) { | |
return; | |
} | |
$properties = RSFormProHelper::getComponentProperties($allComponents); | |
$script = 'function getPrice_'.$formId.'() {'."\n"; | |
$script .= 'var total = 0;'."\n"; | |
// Single product | |
if ($single) { | |
$data = $properties[$single[0]]; | |
$script .= "var singlePrice = parseFloat('".addslashes($data['PRICE'])."');\n"; | |
$script .= "if (!isNaN(singlePrice)) {\n"; | |
$script .= "total += singlePrice;\n"; | |
$script .= "}\n"; | |
} | |
// Donation field | |
if ($donation) { | |
$data = $properties[$donation[0]]; | |
$script .= "var donationField = rsfp_getFieldsByName($formId, '".addslashes($data['NAME'])."');\n"; | |
$script .= "if (donationField) {\n"; | |
$script .= "var donationPrice = donationField[0].value;\n"; | |
$script .= "while (donationPrice.indexOf(".json_encode($thousands).") > -1) {\n"; | |
$script .= "donationPrice = donationPrice.replace(".json_encode($thousands).", '');\n"; | |
$script .= "}\n"; | |
$script .= "donationPrice = parseFloat(donationPrice.replace(".json_encode($decimal).", '.'));"; | |
$script .= "if (!isNaN(donationPrice)) {\n"; | |
$script .= "total += donationPrice;\n"; | |
$script .= "}\n"; | |
$script .= "}\n"; | |
} | |
// Multiple products | |
if ($multiple) { | |
$script .= 'var products = {};'."\n"; | |
foreach ($multiple as $componentId) { | |
$data = $properties[$componentId]; | |
$script .= 'products['.$componentId.'] = [];'."\n"; | |
if (isset($this->_products[$componentId])) { | |
foreach ($this->_products[$componentId] as $item) { | |
$val = $item['val']; | |
$script .= "products[".$componentId."].push(parseFloat('".addslashes($val)."'));\n"; | |
} | |
$script .= "var fields = rsfp_getFieldsByName($formId, '".addslashes($data['NAME'])."');\n"; | |
if ($data['VIEW_TYPE'] == 'DROPDOWN') { | |
$script .= "for (var i=0; i<fields[0].options.length; i++) {\n"; | |
$script .= "if (fields[0].options[i].selected && typeof products[".$componentId."][i] != 'undefined') {\n"; | |
$script .= "var price = products[".$componentId."][i];\n"; | |
$script .= "if (!isNaN(price)) {\n"; | |
$script .= "total += price;\n"; | |
$script .= "}\n"; | |
$script .= "}\n"; | |
$script .= "}\n"; | |
} elseif ($data['VIEW_TYPE'] == 'CHECKBOX' || $data['VIEW_TYPE'] == 'RADIOGROUP') { | |
$script .= "for (var i=0; i<fields.length; i=i+2) {\n"; | |
$script .= "if (fields[i].checked && typeof products[".$componentId."][i/2] != 'undefined') {\n"; | |
$script .= "var price = products[".$componentId."][i/2];\n"; | |
$script .= "if (!isNaN(price)) {\n"; | |
$script .= "total += price;\n"; | |
$script .= "}\n"; | |
$script .= "}\n"; | |
$script .= "}\n"; | |
} | |
} | |
} | |
} | |
// Format the price | |
$script .= "var formattedTotal = number_format(total, '".addslashes($nodecimals)."', '".addslashes($decimal)."', '".addslashes($thousands)."');\n"; | |
$script .= "var hiddenFormattedTotal = number_format(total, 2, '.', '');\n"; | |
// Total field - populate it | |
if ($total) { | |
$data = $properties[$total[0]]; | |
$script .= "var totalMask = '".addslashes($totalMask)."';\n"; | |
$script .= "totalMask = totalMask.replace('{price}', formattedTotal);\n"; | |
$script .= "totalMask = totalMask.replace('{currency}', '".addslashes($currency)."');\n"; | |
$script .= "document.getElementById('payment_total_".$formId."').innerHTML = totalMask;\n"; | |
$script .= "document.getElementById('".addslashes($data['NAME'])."').value = hiddenFormattedTotal;\n"; | |
} | |
$formLayout = str_replace('</form>', '<input type="hidden" name="form[rsfp_Total]" value="0" />'."\n".'</form>', $formLayout); | |
$script .= "var field = rsfp_getFieldsByName($formId, 'rsfp_Total');\n"; | |
$script .= "field[0].value = hiddenFormattedTotal;\n"; | |
$script .= '}'."\n"; | |
$script .= | |
"RSFormProUtils.addEvent(window, 'load', function() {\n" . | |
"\tRSFormProUtils.addEvent(RSFormPro.getForm({$formId}), 'reset', function() {\n" . | |
"\t\twindow.setTimeout(getPrice_{$formId}, 10);\n" . | |
"\t});\n" . | |
"});\n"; | |
RSFormProAssets::addScriptDeclaration($script); | |
$formLayout .= "\n".'<script>getPrice_'.$formId.'();</script>'."\n"; | |
} | |
public function rsfp_f_onBeforeStoreSubmissions($args) | |
{ | |
if ($this->_hasPaymentFields($args['formId'])) | |
{ | |
$args['post']['_STATUS'] = '0'; | |
} | |
} | |
public function rsfp_f_onBeforeFormValidation($args) | |
{ | |
if ($componentId = RSFormProHelper::componentExists($args['formId'], RSFORM_FIELD_PAYMENT_CHOOSE)) | |
{ | |
$properties = RSFormProHelper::getComponentProperties($componentId[0]); | |
$fieldName = $properties['NAME']; | |
if (empty($args['post'][$fieldName])) | |
{ | |
$args['invalid'][] = $componentId[0]; | |
} | |
} | |
} | |
public function rsfp_f_onAfterFormProcess($args) { | |
if ($this->_hasPaymentFields($args['formId'])) | |
{ | |
$db = JFactory::getDbo(); | |
$products = array(); | |
$donation = RSFormProHelper::componentExists($args['formId'], RSFORM_FIELD_PAYMENT_DONATION); | |
$single = RSFormProHelper::componentExists($args['formId'], RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT); | |
$multiple = RSFormProHelper::componentExists($args['formId'], RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS); | |
$total = RSFormProHelper::componentExists($args['formId'], RSFORM_FIELD_PAYMENT_TOTAL); | |
$choosePayment = RSFormProHelper::componentExists($args['formId'], RSFORM_FIELD_PAYMENT_CHOOSE); | |
$allComponents = array(); | |
if ($donation) { | |
$allComponents = array_merge($allComponents, $donation); | |
} | |
if ($single) { | |
$allComponents = array_merge($allComponents, $single); | |
} | |
if ($multiple) { | |
$allComponents = array_merge($allComponents, $multiple); | |
} | |
if ($total) { | |
$allComponents = array_merge($allComponents, $total); | |
} | |
$properties = RSFormProHelper::getComponentProperties($allComponents); | |
// PayPal, for legacy reasons | |
$hasPayPal = RSFormProHelper::componentExists($args['formId'], 500); | |
// Total price | |
$price = $this->_getSubmissionValue($args['SubmissionId'], 'rsfp_Total'); | |
// Build products information | |
// Single product | |
if ($single) { | |
$data = $properties[$single[0]]; | |
$products[] = strip_tags($data['CAPTION']); | |
} | |
// Multiple product | |
if ($multiple) { | |
foreach ($multiple as $componentId) { | |
$data = $properties[$componentId]; | |
$bought = $this->_getSubmissionValue($args['SubmissionId'], $data['NAME']); | |
if ($bought) { | |
$products[] = strip_tags($data['CAPTION'].' - '.$bought); | |
} | |
} | |
} | |
// Donation product | |
if ($donation) { | |
$data = $properties[$donation[0]]; | |
$donated = $this->_getSubmissionValue($args['SubmissionId'], $data['NAME']); | |
if ($donated) { | |
$products[] = strip_tags($data['CAPTION']); | |
} | |
} | |
if (($choosePayment && ($payValue = $this->_getSubmissionValue($args['SubmissionId'], $choosePayment[0]))) || ($hasPayPal && !$choosePayment && $payValue = 'paypal')) | |
{ | |
$query = $db->getQuery(true) | |
->select($db->qn('DateSubmitted')) | |
->from($db->qn('#__rsform_submissions')) | |
->where($db->qn('SubmissionId') . ' = ' . $db->q($args['SubmissionId'])); | |
//build verification code | |
$db->setQuery($query); | |
$code = md5($args['SubmissionId'].$db->loadResult()); | |
$mainframe = JFactory::getApplication(); | |
$mainframe->triggerEvent('rsfp_doPayment', array($payValue, $args['formId'], $args['SubmissionId'], $price, $products, $code)); | |
} | |
} | |
} | |
protected function _getComponentName($componentId) { | |
if ($data = RSFormProHelper::getComponentProperties($componentId)) | |
{ | |
if (isset($data['NAME'])) | |
{ | |
return $data['NAME']; | |
} | |
} | |
return false; | |
} | |
protected function _getSubmissionValue($submissionId, $componentId) | |
{ | |
static $cache = array(); | |
if (is_numeric($componentId)) { | |
$name = $this->_getComponentName($componentId); | |
} else { | |
$name = $componentId; | |
} | |
if (!isset($cache[$submissionId])) { | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true) | |
->select($db->qn(array('FieldName', 'FieldValue'))) | |
->from($db->qn('#__rsform_submission_values')) | |
->where($db->qn('SubmissionId') . ' = ' . $db->q($submissionId)); | |
$cache[$submissionId] = (array) $db->setQuery($query)->loadAssocList('FieldName'); | |
} | |
// The _STATUS field can change, so don't cache it, grab a fresh version every time we need it. | |
if ($name == '_STATUS') | |
{ | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true) | |
->select($db->qn('FieldValue')) | |
->from($db->qn('#__rsform_submission_values')) | |
->where($db->qn('SubmissionId') . ' = ' . $db->q($submissionId)) | |
->where($db->qn('FieldName') . ' = ' . $db->q($name)); | |
$cache[$submissionId][$name]['FieldValue'] = $db->setQuery($query)->loadResult(); | |
} | |
if (!empty($cache[$submissionId]) && isset($cache[$submissionId][$name])) { | |
return $cache[$submissionId][$name]['FieldValue']; | |
} | |
return null; | |
} | |
protected function _hasPaymentFields($formId) | |
{ | |
static $cache = array(); | |
if (!isset($cache[$formId])) | |
{ | |
$cache[$formId] = RSFormProHelper::componentExists($formId, $this->newComponents); | |
} | |
return $cache[$formId]; | |
} | |
protected function _getPaymentSettings($formId) | |
{ | |
static $cache = array(); | |
if (!isset($cache[$formId])) | |
{ | |
$cache[$formId] = new stdClass(); | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true) | |
->select($db->qn('params')) | |
->from($db->qn('#__rsform_payment')) | |
->where($db->qn('form_id') . ' = ' . $db->q($formId)); | |
if ($params = $db->setQuery($query)->loadResult()) | |
{ | |
$params = @unserialize($params); | |
if (is_object($params)) | |
{ | |
$cache[$formId] = $params; | |
} | |
} | |
} | |
return $cache[$formId]; | |
} | |
protected function paymentConfigurationScreen() { | |
ob_start(); | |
?> | |
<div id="page-payments"> | |
<table class="admintable"> | |
<tr> | |
<td width="200" style="width: 200px;" align="right" class="key"><label for="currency"><?php echo JText::_( 'RSFP_PAYMENT_CURRENCY' ); ?></label></td> | |
<td><input type="text" name="rsformConfig[payment.currency]" value="<?php echo $this->_escape(RSFormProHelper::getConfig('payment.currency')); ?>" size="4" maxlength="50"></td> | |
</tr> | |
<tr> | |
<td width="200" style="width: 200px;" align="right" class="key"><label for="thousands"><?php echo JText::_( 'RSFP_PAYMENT_THOUSANDS' ); ?></label></td> | |
<td><input type="text" name="rsformConfig[payment.thousands]" value="<?php echo $this->_escape(RSFormProHelper::getConfig('payment.thousands')); ?>" size="4" maxlength="50"></td> | |
</tr> | |
<tr> | |
<td width="200" style="width: 200px;" align="right" class="key"><label for="decimal"><?php echo JText::_( 'RSFP_PAYMENT_DECIMAL_SEPARATOR' ); ?></label></td> | |
<td><input type="text" name="rsformConfig[payment.decimal]" value="<?php echo $this->_escape(RSFormProHelper::getConfig('payment.decimal')); ?>" size="4" maxlength="50"></td> | |
</tr> | |
<tr> | |
<td width="200" style="width: 200px;" align="right" class="key"><label for="nr.decimal"><?php echo JText::_( 'RSFP_PAYMENT_NR_DECIMALS' ); ?></label></td> | |
<td><input type="text" name="rsformConfig[payment.nodecimals]" value="<?php echo $this->_escape(RSFormProHelper::getConfig('payment.nodecimals')); ?>" size="4" maxlength="50"></td> | |
</tr> | |
<tr> | |
<td width="200" style="width: 200px;" align="right" class="key hasTip" title="<?php echo JText::_( 'RSFP_PAYMENT_MASK_DESC' ); ?>"><label for="nr.decimal"><?php echo JText::_( 'RSFP_PAYMENT_MASK' ); ?></label></td> | |
<td><input type="text" name="rsformConfig[payment.mask]" value="<?php echo $this->_escape(RSFormProHelper::getConfig('payment.mask')); ?>" size="100"></td> | |
</tr> | |
<tr> | |
<td width="200" style="width: 200px;" align="right" class="key hasTip" title="<?php echo JText::_( 'RSFP_PAYMENT_TOTAL_MASK_DESC' ); ?>"><label for="nr.decimal"><?php echo JText::_( 'RSFP_PAYMENT_TOTAL_MASK' ); ?></label></td> | |
<td><input type="text" name="rsformConfig[payment.totalmask]" value="<?php echo $this->_escape(RSFormProHelper::getConfig('payment.totalmask')); ?>" size="100"></td> | |
</tr> | |
</table> | |
</div> | |
<?php | |
$contents = ob_get_contents(); | |
ob_end_clean(); | |
return $contents; | |
} | |
public function rsfp_beforeUserEmail($args) { | |
if (!$this->_hasPaymentFields($args['form']->FormId)) | |
{ | |
return; | |
} | |
if ($params = $this->_getPaymentSettings($args['form']->FormId)) { | |
if (isset($params->UserEmail)) { | |
$status = $this->_getSubmissionValue($args['submissionId'], '_STATUS'); | |
// defer sending if | |
// - user email is defered && the payment is not confirmed (send email only when payment is confirmed) | |
if ($params->UserEmail == 1 && $status == 0) { | |
$args['userEmail']['to'] = ''; | |
} | |
// - user email is not defered && the payment is confirmed (don't send the email once again, it has already been sent) | |
if ($params->UserEmail == 0 && $status == 1) { | |
$args['userEmail']['to'] = ''; | |
} | |
} | |
} | |
} | |
public function rsfp_beforeAdminEmail($args) { | |
if (!$this->_hasPaymentFields($args['form']->FormId)) | |
{ | |
return; | |
} | |
if ($params = $this->_getPaymentSettings($args['form']->FormId)) { | |
if (isset($params->AdminEmail)) { | |
$status = $this->_getSubmissionValue($args['submissionId'], '_STATUS'); | |
// defer sending if | |
// - admin email is defered && the payment is not confirmed (send email only when payment is confirmed) | |
if ($params->AdminEmail == 1 && $status == 0) { | |
$args['adminEmail']['to'] = ''; | |
} | |
// - admin email is not defered && the payment is confirmed (don't send the email once again, it has already been sent) | |
if ($params->AdminEmail == 0 && $status == 1) { | |
$args['adminEmail']['to'] = ''; | |
} | |
} | |
} | |
} | |
public function rsfp_beforeAdditionalEmail($args) { | |
if (!$this->_hasPaymentFields($args['form']->FormId)) | |
{ | |
return; | |
} | |
if ($params = $this->_getPaymentSettings($args['form']->FormId)) { | |
if (isset($params->AdditionalEmails)) | |
{ | |
$status = $this->_getSubmissionValue($args['submissionId'], '_STATUS'); | |
// defer sending if | |
// - admin email is defered && the payment is not confirmed (send email only when payment is confirmed) | |
if ($params->AdditionalEmails == 1 && $status == 0) { | |
$args['additionalEmail']['to'] = ''; | |
} | |
// - admin email is not defered && the payment is confirmed (don't send the email once again, it has already been sent) | |
if ($params->AdditionalEmails == 0 && $status == 1) { | |
$args['additionalEmail']['to'] = ''; | |
} | |
} | |
} | |
} | |
private function translate(&$properties, $translations) | |
{ | |
foreach ($properties as $componentId => $componentProperties) | |
{ | |
foreach ($componentProperties as $property => $value) | |
{ | |
$reference_id = $componentId.'.'.$property; | |
if (isset($translations[$reference_id])) | |
$componentProperties[$property] = $translations[$reference_id]; | |
} | |
$properties[$componentId] = $componentProperties; | |
} | |
} | |
public function rsfp_onAfterCreatePlaceholders($args) { | |
$formId = $args['form']->FormId; | |
$submissionId = $args['submission']->SubmissionId; | |
$multipleSeparator = $args['form']->MultipleSeparator; | |
if ($this->_hasPaymentFields($formId)) | |
{ | |
// language | |
$translations = RSFormProHelper::getTranslations('properties', $formId, $args['submission']->Lang); | |
$singleProduct = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_SINGLE_PRODUCT); | |
$multipleProducts = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_MULTIPLE_PRODUCTS); | |
$total = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_TOTAL); | |
$donationProduct = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_DONATION); | |
$choosePayment = RSFormProHelper::componentExists($formId, RSFORM_FIELD_PAYMENT_CHOOSE); | |
// choose payment | |
if (!empty($choosePayment)) { | |
$data = RSFormProHelper::getComponentProperties($choosePayment[0]); | |
$items = $this->_getPayments($formId); | |
$value = $this->_getSubmissionValue($submissionId, $choosePayment[0]); | |
$text = ''; | |
if ($items) { | |
foreach ($items as $item) { | |
if ($item->value == $value) { | |
$text = $item->text; | |
break; | |
} | |
} | |
} | |
$args['placeholders'][] = '{'.$data['NAME'].':text}'; | |
$args['values'][] = $text; | |
} | |
// multiple products | |
if (!empty($multipleProducts)) | |
{ | |
$properties = RSFormProHelper::getComponentProperties($multipleProducts, false); | |
$this->translate($properties, $translations); | |
$special = array('[c]', '[g]', '[d]'); | |
foreach ($multipleProducts as $product) | |
{ | |
$data = $properties[$product]; | |
$value = $this->_getSubmissionValue($submissionId, $product); | |
if ($value == '') | |
{ | |
continue; | |
} | |
$value = explode("\n", $value); | |
$items = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS'])); | |
$replace = '{'.$data['NAME'].':price}'; | |
$with = array(); | |
foreach ($items as $item) | |
{ | |
$strippedItem = str_replace($special, '', $item); | |
if (strpos($item, '|') !== false) | |
{ | |
list($val, $txt) = explode('|', $strippedItem, 2); | |
} | |
else | |
{ | |
$val = 0; | |
$txt = $strippedItem; | |
} | |
if (in_array($txt, $value)) { | |
$txt_price = $this->_getPriceMask($txt, $val); | |
$with[] = $txt_price; | |
} | |
} | |
$args['placeholders'][] = $replace; | |
$args['values'][] = implode($multipleSeparator, $with); | |
} | |
} | |
// donation | |
if (!empty($donationProduct)) | |
{ | |
$price = $this->_getSubmissionValue($submissionId, $donationProduct[0]); | |
$properties = RSFormProHelper::getComponentProperties($donationProduct, false); | |
$this->translate($properties, $translations); | |
$data = $properties[$donationProduct[0]]; | |
$args['placeholders'][] = '{'.$data['NAME'].':price}'; | |
$args['values'][] = $this->_getPriceMask($data['CAPTION'], $price); | |
} | |
// single product | |
if (!empty($singleProduct)) | |
{ | |
$properties = RSFormProHelper::getComponentProperties($singleProduct, false); | |
$this->translate($properties, $translations); | |
$data = $properties[$singleProduct[0]]; | |
$price = $data['PRICE']; | |
$args['placeholders'][] = '{rsfp_Product:price}'; | |
$args['values'][] = $this->_getPriceMask($data['CAPTION'], $price); | |
} | |
if (!empty($total)) | |
{ | |
$price = $this->_getSubmissionValue($submissionId, $total[0]); | |
$properties = RSFormProHelper::getComponentProperties($total, false); | |
$this->translate($properties, $translations); | |
$data = $properties[$total[0]]; | |
$args['placeholders'][] = '{'.$data['NAME'].':price}'; | |
$args['values'][] = $this->_getPriceMask($data['CAPTION'], $price); | |
} | |
$args['placeholders'][] = '{_STATUS:value}'; | |
$args['values'][] = isset($args['submission']->values['_STATUS']) ? JText::_('RSFP_PAYPAL_STATUS_' . $args['submission']->values['_STATUS']) : ''; | |
$args['placeholders'][] = '{_STATUS:caption}'; | |
$args['values'][] = JText::_('RSFP_PAYMENT_STATUS'); | |
} | |
} | |
public function rsfp_bk_onGetSubmissionHeaders(&$headers, $formId) | |
{ | |
if ($this->_hasPaymentFields($formId)) | |
{ | |
$headers[] = '_STATUS'; | |
} | |
} | |
public function rsfp_bk_onGetHeaderLabel(&$header, $formId) | |
{ | |
if ($this->_hasPaymentFields($formId)) | |
{ | |
if ($header == '_STATUS') | |
{ | |
$header = JText::_('RSFP_PAYMENT_STATUS'); | |
} | |
elseif ($header == 'rsfp_Product') | |
{ | |
$header = JText::_('RSFP_SPRODUCT'); | |
} | |
} | |
} | |
public function rsfp_f_onGetEditFields(&$return, $submission) | |
{ | |
// This is for the frontend editing (Directory), we use mostly the same code | |
if ($this->_hasPaymentFields($submission->FormId)) | |
{ | |
// PayPal | |
if (isset($submission->values['_STATUS']) && isset($return[-RSFORM_FIELD_PAYMENT_CHOOSE])) | |
{ | |
$return[-RSFORM_FIELD_PAYMENT_CHOOSE][0] = JText::_('RSFP_PAYMENT_STATUS'); | |
$name = '_STATUS'; | |
$value = $submission->values['_STATUS']; | |
$options = array( | |
JHtml::_('select.option', -1, JText::_('RSFP_PAYPAL_STATUS_-1')), | |
JHtml::_('select.option', 0, JText::_('RSFP_PAYPAL_STATUS_0')), | |
JHtml::_('select.option', 1, JText::_('RSFP_PAYPAL_STATUS_1')) | |
); | |
$return[-RSFORM_FIELD_PAYMENT_CHOOSE][1] = JHtml::_('select.genericlist', $options, 'form['.$name.'][]', null, 'value', 'text', $value); | |
} | |
} | |
} | |
public function rsfp_bk_onGetEditFields(&$return, $submission) | |
{ | |
if ($this->_hasPaymentFields($submission->FormId)) | |
{ | |
// PayPal | |
if (isset($submission->values['_STATUS'])) | |
{ | |
$isPDF = JFactory::getApplication()->input->get('format') == 'pdf'; | |
$name = '_STATUS'; | |
$value = $submission->values['_STATUS']; | |
$new_field[0] = JText::_('RSFP_PAYMENT_STATUS'); | |
if ($isPDF) | |
{ | |
$new_field[1] = JText::_('RSFP_PAYPAL_STATUS_' . $value); | |
} | |
else | |
{ | |
$options = array( | |
JHtml::_('select.option', -1, JText::_('RSFP_PAYPAL_STATUS_-1')), | |
JHtml::_('select.option', 0, JText::_('RSFP_PAYPAL_STATUS_0')), | |
JHtml::_('select.option', 1, JText::_('RSFP_PAYPAL_STATUS_1')) | |
); | |
$new_field[1] = JHtml::_('select.genericlist', $options, 'form['.$name.'][]', null, 'value', 'text', $value); | |
} | |
$return[] = $new_field; | |
} | |
} | |
} | |
public function rsfp_b_onManageSubmissions($args) | |
{ | |
if ($this->_hasPaymentFields($args['formId'])) | |
{ | |
foreach ($args['submissions'] as $SubmissionId => $submission) | |
{ | |
if (isset($submission['SubmissionValues']['_STATUS']['Value'])) | |
{ | |
$args['submissions'][$SubmissionId]['SubmissionValues']['_STATUS']['Value'] = JText::_('RSFP_PAYPAL_STATUS_' . $submission['SubmissionValues']['_STATUS']['Value']); | |
} | |
} | |
} | |
} | |
public function rsfp_bk_onGetAllDirectoryFields(&$cache, $formId) | |
{ | |
if ($this->_hasPaymentFields($formId)) | |
{ | |
$cache[-RSFORM_FIELD_PAYMENT_CHOOSE] = (object) array( | |
'FieldName' => '_STATUS', | |
'FieldId' => -RSFORM_FIELD_PAYMENT_CHOOSE, | |
'FieldType' => 0, | |
'FieldCaption' => JText::_('RSFP_PAYMENT_STATUS') | |
); | |
} | |
} | |
public function rsfp_onAfterManageDirectoriesQuery(&$items, $formId) | |
{ | |
if ($this->_hasPaymentFields($formId)) | |
{ | |
foreach ($items as $item) | |
{ | |
if (isset($item->{'_STATUS'})) | |
{ | |
$item->{'_STATUS'} = JText::_('RSFP_PAYPAL_STATUS_' . $item->{'_STATUS'}); | |
} | |
} | |
} | |
} | |
public function rsfp_f_onDownloadCSV(&$submissions, $formId) | |
{ | |
if ($this->_hasPaymentFields($formId)) | |
{ | |
foreach ($submissions as $item) | |
{ | |
if (isset($item->values['_STATUS'])) | |
{ | |
$item->values['_STATUS'] = JText::_('RSFP_PAYPAL_STATUS_' . $item->values['_STATUS']); | |
} | |
} | |
} | |
} | |
private function _getPriceMask($txt, $val) { | |
static $init, $nodecimals, $decimal, $thousands, $currency, $mask; | |
if (!$init) { | |
$init = true; | |
$nodecimals = RSFormProHelper::getConfig('payment.nodecimals'); | |
$decimal = RSFormProHelper::getConfig('payment.decimal'); | |
$thousands = RSFormProHelper::getConfig('payment.thousands'); | |
$currency = RSFormProHelper::getConfig('payment.currency'); | |
$mask = RSFormProHelper::getConfig('payment.mask'); | |
} | |
$formattedPrice = number_format((float) $val, $nodecimals, $decimal, $thousands); | |
$replacements = array( | |
'{product}' => $txt, | |
'{price}' => $formattedPrice, | |
'{currency}' => $currency, | |
); | |
return str_replace(array_keys($replacements), array_values($replacements), $mask); | |
} | |
public function rsfp_onFormDelete($formId) { | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true); | |
$query->delete('#__rsform_payment') | |
->where($db->qn('form_id').'='.$db->q($formId)); | |
$db->setQuery($query)->execute(); | |
} | |
public function rsfp_onFormBackup($form, $xml, $fields) { | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true); | |
$query->select('*') | |
->from($db->qn('#__rsform_payment')) | |
->where($db->qn('form_id').'='.$db->q($form->FormId)); | |
$db->setQuery($query); | |
if ($payment = $db->loadObject()) { | |
// No need for a form_id | |
unset($payment->form_id); | |
$xml->add('payment'); | |
foreach ($payment as $property => $value) { | |
$xml->add($property, $value); | |
} | |
$xml->add('/payment'); | |
} | |
} | |
public function rsfp_onFormRestore($form, $xml, $fields) { | |
if (isset($xml->payment)) { | |
$data = array( | |
'form_id' => $form->FormId | |
); | |
foreach ($xml->payment->children() as $property => $value) { | |
$data[$property] = (string) $value; | |
} | |
$row = JTable::getInstance('RSForm_Payment', 'Table'); | |
if (!$row->load($form->FormId)) { | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true); | |
$query ->insert('#__rsform_payment') | |
->set(array( | |
$db->qn('form_id') .'='. $db->q($form->FormId), | |
)); | |
$db->setQuery($query)->execute(); | |
} | |
$row->save($data); | |
} | |
} | |
public function rsfp_bk_onFormRestoreTruncate() { | |
JFactory::getDbo()->truncateTable('#__rsform_payment'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.form--betalen .rsform-block-betaalwijze .rsformVerticalClear label { | |
height: 40px; | |
} | |
.form--betalen .icon { | |
display: inline-block; | |
padding-top: 0; | |
padding-left: 40px; | |
} | |
.form--betalen .icon--bancontact { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect width='32' height='32' fill='%23FFF' rx='10'%3E%3C/rect%3E%3Cpath fill='%23D9D9D9' fill-rule='nonzero' d='M1 7.992v16.016A6.992 6.992 0 0 0 7.992 31h16.016A6.992 6.992 0 0 0 31 24.008V7.992A6.992 6.992 0 0 0 24.008 1H7.992A6.992 6.992 0 0 0 1 7.992zm-1 0A7.992 7.992 0 0 1 7.992 0h16.016A7.992 7.992 0 0 1 32 7.992v16.016A7.992 7.992 0 0 1 24.008 32H7.992A7.992 7.992 0 0 1 0 24.008V7.992z'%3E%3C/path%3E%3Cpath fill='%2300549D' fill-rule='nonzero' d='M3.077 17.838a1.22 1.22 0 0 1 1.217-1.223H8l-1.846 1.847h7.384l3.693-4.308h8l-5.337 5.87c-.451.497-1.368.9-2.033.9H4.293A1.218 1.218 0 0 1 3.077 19.7v-1.862z'%3E%3C/path%3E%3Cpath fill='%23FFD800' fill-rule='nonzero' d='M28.923 14.783A1.22 1.22 0 0 1 27.708 16h-4.323l1.846-1.846h-8l-3.077 4.308h-8l5.374-6.45c.43-.516 1.333-.935 2.001-.935h14.172a1.22 1.22 0 0 1 1.222 1.217v2.49z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--belfius { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect width='32' height='32' fill='%23D50043' rx='8'%3E%3C/rect%3E%3Cpath fill='%23FFF' d='M9 11.36A2.357 2.357 0 0 1 11.36 9h9.28A2.357 2.357 0 0 1 23 11.36V23H11.36A2.357 2.357 0 0 1 9 20.64v-9.28zm3 2.523v.234c0 .478.397.883.887.883h6.226c.49 0 .887-.395.887-.883v-.234a.891.891 0 0 0-.887-.883h-6.226a.885.885 0 0 0-.887.883zm0 4v.234c0 .478.397.883.887.883h6.226c.49 0 .887-.395.887-.883v-.234a.891.891 0 0 0-.887-.883h-6.226a.885.885 0 0 0-.887.883z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--creditcard { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='creditcard-b' x1='0%25' y1='100%25' y2='0%25'%3E%3Cstop offset='0%25' stop-color='%23060B0E'%3E%3C/stop%3E%3Cstop offset='100%25' stop-color='%23254764'%3E%3C/stop%3E%3C/linearGradient%3E%3Crect id='creditcard-a' width='32' height='32' rx='8'%3E%3C/rect%3E%3ClinearGradient id='creditcard-c' x1='27.635%25' x2='22.59%25' y1='25.476%25' y2='11.652%25'%3E%3Cstop offset='0%25' stop-color='%23FFF' stop-opacity='0'%3E%3C/stop%3E%3Cstop offset='100%25' stop-color='%23FFF'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient id='creditcard-e' x1='50%25' x2='38.943%25' y1='100%25' y2='55.528%25'%3E%3Cstop offset='0%25' stop-color='%23FFF' stop-opacity='0'%3E%3C/stop%3E%3Cstop offset='100%25' stop-color='%23FFF'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient id='creditcard-f' x1='38.943%25' x2='50%25' y1='55.528%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23FFF' stop-opacity='0'%3E%3C/stop%3E%3Cstop offset='100%25' stop-color='%23FFF'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient id='creditcard-i' x1='50%25' x2='50%25' y1='0%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23FAD961'%3E%3C/stop%3E%3Cstop offset='100%25' stop-color='%23F7955D'%3E%3C/stop%3E%3C/linearGradient%3E%3Crect id='creditcard-h' width='7' height='5' rx='1'%3E%3C/rect%3E%3Cfilter id='creditcard-g' width='157.1%25' height='180%25' x='-28.6%25' y='-20%25' filterUnits='objectBoundingBox'%3E%3CfeOffset dy='1' in='SourceAlpha' result='shadowOffsetOuter1'%3E%3C/feOffset%3E%3CfeGaussianBlur in='shadowOffsetOuter1' result='shadowBlurOuter1' stdDeviation='.5'%3E%3C/feGaussianBlur%3E%3CfeColorMatrix in='shadowBlurOuter1' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0'%3E%3C/feColorMatrix%3E%3C/filter%3E%3C/defs%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cmask id='creditcard-d' fill='%23fff'%3E%3Cuse xlink:href='%23creditcard-a'%3E%3C/use%3E%3C/mask%3E%3Cuse fill='url(%23creditcard-b)' xlink:href='%23creditcard-a'%3E%3C/use%3E%3Ccircle cx='37.5' cy='40.5' r='31.5' fill='url(%23creditcard-c)' mask='url(%23creditcard-d)' opacity='.1'%3E%3C/circle%3E%3Ccircle cx='6.5' cy='31.5' r='16.5' fill='url(%23creditcard-e)' mask='url(%23creditcard-d)' opacity='.1'%3E%3C/circle%3E%3Ccircle cx='42.5' cy='-1.5' r='26.5' fill='url(%23creditcard-f)' mask='url(%23creditcard-d)' opacity='.1'%3E%3C/circle%3E%3Cg mask='url(%23creditcard-d)'%3E%3Cg transform='translate(4 14)'%3E%3Cuse fill='%23000' filter='url(%23creditcard-g)' xlink:href='%23creditcard-h'%3E%3C/use%3E%3Cuse fill='url(%23creditcard-i)' xlink:href='%23creditcard-h'%3E%3C/use%3E%3C/g%3E%3Cpath fill='%237A3802' opacity='.3' d='M5 15h1v3H5zM7 15h1v3H7zM9 15h1v3H9z'%3E%3C/path%3E%3C/g%3E%3Cpath fill='%23FFF' fill-opacity='.8' mask='url(%23creditcard-d)' d='M4 22h5v1H4zM4 24h3v1H4zM8 24h3v1H8zM12 24h3v1h-3zM10 22h5v1h-5zM16 22h5v1h-5zM22 22h5v1h-5z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--eps { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect fill='%23DE378C' width='32' height='32' rx='8'%3E%3C/rect%3E%3Cpath d='M11.598 19.924s-.14-.673-.14-1.117c0-.444.132-1.124.132-1.124.49-2.033 2.28-3.547 4.41-3.547 2.505 0 4.56 2.09 4.56 4.66v1.13h-6.654c.392.788 1.187 1.232 2.104 1.232h5.982L22 14.492c0-.994-.792-1.807-1.76-1.807h-8.48c-.968 0-1.76.789-1.76 1.782v8.701c0 .994.792 1.832 1.76 1.832h8.48c.868 0 1.593-.64 1.733-1.478H16.01c-2.133 0-3.927-1.56-4.412-3.598z' fill='%23FFF'%3E%3C/path%3E%3Cpath d='M15.829 16.204c-.894 0-1.671.615-2.058 1.407h4.115c-.387-.792-1.164-1.407-2.057-1.407M19.6 9.905C19.6 7.748 17.911 6 15.828 6c-2.05 0-3.716 1.691-3.77 3.798V11c0 .14.107.279.243.279h1.388c.135 0 .254-.139.254-.28V9.906c0-1.077.845-1.953 1.886-1.953 1.04 0 1.885.876 1.885 1.953v1.094c0 .14.11.279.246.279h1.388c.135 0 .252-.139.252-.28V9.906' fill='%23FFF'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--giropay { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect fill='%230F4CA1' width='32' height='32' rx='8'%3E%3C/rect%3E%3Cpath d='M17 23h3v-4.951c.581 1.085 1.855 1.487 2.932 1.487 2.65 0 4.068-2.24 4.068-4.935C27 12.397 25.65 10 23.189 10c-1.402 0-2.574.577-3.189 1.855V10h-3v13zm6.821-8.328c0 1.452-.701 2.45-1.863 2.45-1.026 0-1.881-.998-1.881-2.328 0-1.364.752-2.38 1.881-2.38 1.196 0 1.863 1.05 1.863 2.258zM15 10.207h-2.826v1.618h-.034C11.482 10.723 10.407 10 9.073 10 6.265 10 5 11.997 5 14.666c0 2.653 1.542 4.51 4.021 4.51 1.248 0 2.287-.48 3.032-1.532h.035v.483c0 1.757-.97 2.6-2.772 2.6-1.3 0-2.098-.275-3.05-.74l-.157 2.445c.728.257 1.959.568 3.449.568C13.198 23 15 21.811 15 18.127v-7.92zm-6.776 4.407c0-1.222.606-2.238 1.767-2.238 1.404 0 1.993 1.118 1.993 2.117 0 1.379-.884 2.308-1.993 2.308-.935 0-1.767-.793-1.767-2.187z' fill='%23FFFFFE'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--ideal { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect fill='%23FD6EB6' width='32' height='32' rx='8'%3E%3C/rect%3E%3Cpath d='M8 23V9h9.6C23 9 24 14.83 24 16.538c0 1.924-.708 3.772-2.133 5.385-1.044.48-2.514.982-4.267 1.077H8z' fill='%23FFF'%3E%3C/path%3E%3Cpath fill='%23000' d='M11 20h2v-4h-2zM13 12.667c0 .885-.448 1.333-1.333 1.333-.22 0-.667-.448-.667-1.333 0-.22.448-.667.667-.667.885 0 1.333.448 1.333.667'%3E%3C/path%3E%3Cpath d='M16.467 10.923c1.941 0 3.215.405 3.733.923 1.361 1.117 1.867 2.43 1.867 4.616 0 2.954-1.697 4.615-5.6 4.615H9.933V10.923h6.534zM9 10v12h8.4c1.407-.026 2.8-.455 3.733-.923C22.391 19.713 23 18.125 23 16.462c0-1.478-.085-6.339-5.6-6.462H9z' fill='%23000'%3E%3C/path%3E%3Cpath d='M16.583 20.048H14V12h2.583-.104c2.154 0 4.446.856 4.446 4.035 0 3.36-2.292 4.013-4.446 4.013h.104z' fill='%23CD0067'%3E%3C/path%3E%3Cg fill='%23FFF'%3E%3Cpath d='M13.444 14.369v1.439h.332c.124 0 .214-.007.27-.02a.413.413 0 0 0 .179-.091.459.459 0 0 0 .116-.21c.03-.097.045-.23.045-.398a1.28 1.28 0 0 0-.045-.387.496.496 0 0 0-.126-.21.426.426 0 0 0-.206-.102 2.05 2.05 0 0 0-.365-.021h-.2zM13 14h.812a1.6 1.6 0 0 1 .418.042c.13.037.24.104.332.2a.95.95 0 0 1 .21.353c.048.139.072.31.072.514 0 .18-.023.334-.068.464a.958.958 0 0 1-.235.384.783.783 0 0 1-.312.174c-.098.03-.23.046-.393.046H13V14z'%3E%3C/path%3E%3Cpath d='M13.872 14.119c.176 0 .311.013.401.04a.68.68 0 0 1 .305.184c.086.089.152.2.197.33.045.133.069.3.069.496 0 .172-.022.321-.065.444a.904.904 0 0 1-.22.361.727.727 0 0 1-.289.16 1.306 1.306 0 0 1-.374.043h-.776V14.12h.752zM13 14v2.296h.896c.17 0 .307-.016.41-.049a.845.845 0 0 0 .337-.188c.108-.104.192-.24.25-.407.047-.136.07-.298.07-.483 0-.21-.024-.39-.074-.534a1.012 1.012 0 0 0-.224-.374.8.8 0 0 0-.358-.217 1.64 1.64 0 0 0-.435-.044H13z'%3E%3C/path%3E%3Cpath d='M13.26 14.119c.22 0 .313.01.352.02a.37.37 0 0 1 .178.087.44.44 0 0 1 .11.186c.029.083.043.207.043.368s-.014.289-.043.38a.405.405 0 0 1-.099.183.356.356 0 0 1-.154.077c-.05.013-.136.019-.255.019h-.272v-1.32h.14zM13 14v1.558h.392c.131 0 .224-.007.284-.023a.474.474 0 0 0 .206-.103.51.51 0 0 0 .133-.237 1.44 1.44 0 0 0 .048-.415c0-.176-.016-.309-.048-.406a.556.556 0 0 0-.142-.235.487.487 0 0 0-.235-.117A2.07 2.07 0 0 0 13.26 14H13zM15 16.177V14h1.629v.369h-1.185v.482h1.102v.37h-1.102v.587h1.227v.37z'%3E%3C/path%3E%3Cpath d='M16.629 14.119v.25h-1.185v.601h1.102v.25h-1.102v.707h1.227v.25h-1.55V14.12h1.508zM15 14v2.296h1.791v-.488h-1.227v-.469h1.102v-.488h-1.102v-.363h1.185V14H15zM18.39 15.314l-.304-.807-.297.807h.6zm.818.863h-.484l-.192-.494h-.879l-.182.494H17L17.855 14h.473l.88 2.177z'%3E%3C/path%3E%3Cpath d='M18.375 14.119l.832 2.058h-.354l-.192-.494H17.7l-.182.494h-.341l.808-2.058h.39zM17.902 14L17 16.296h.601l.182-.494h.796l.192.494h.613L18.456 14h-.554z'%3E%3C/path%3E%3Cpath d='M18.384 14.344l.216.575h-.428l.212-.575zm-.384.694h.773L18.383 14 18 15.038zM20 16.16V14h.444v1.79h1.105v.37z'%3E%3C/path%3E%3Cpath d='M20.444 14.119v1.79h1.105v.25H20.12v-2.04h.324zM20 14v2.278h1.67v-.488h-1.106V14H20z'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--inghomepay { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect fill='%23F36717' width='32' height='32' rx='8'%3E%3C/rect%3E%3Cpath d='M15.793 12.462c1.05 0 1.022.463 1.022 1.552v2.694c0 .19 0 .272.027.408l-4.888-4.953H9.33v.3c1.105 0 1.105.68 1.105 1.306v4.19c0 1.061 0 1.551-1.05 1.551v.3h2.79v-.3c-1.05 0-1.05-.408-1.05-1.55v-3.674c0-.163 0-.3-.027-.463l5.938 6.04h.47v-5.85c0-1.115.054-1.55 1.076-1.55v-.3h-2.79v.3zM4 12.462c.773 0 1.132.028 1.132 1.007v5.035c0 .952-.47 1.006-1.132 1.006v.3h3.922v-.3c-.718 0-1.133-.054-1.133-1.006v-5.035c0-.98.332-1.007 1.133-1.007v-.299H4v.3zm20.493 3.375v.3c.938 0 1.05.244 1.05.897v2.014c-.553.245-.995.353-1.493.353-1.657 0-2.9-1.387-2.9-3.401 0-2.04 1.023-3.401 2.762-3.401.829 0 1.547.272 2.072.789.331.299.58.735.718 1.251h.331L26.785 12h-.276c-.028.19-.083.517-.277.517-.22 0-.441-.136-.8-.245A4.806 4.806 0 0 0 23.83 12c-2.541 0-4.53 1.905-4.53 4.19 0 2.123 1.74 3.81 4.64 3.81 1.05 0 2.1-.272 3.204-.816v-1.96c0-.816-.028-1.088.856-1.088v-.3h-3.507z' fill='%23FFF' fill-rule='nonzero'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--kbc { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect width='32' height='32' fill='%231A5698' rx='8'%3E%3C/rect%3E%3Cpath fill='%23FFF' d='M13.086 18.265L5 19v2h22v-4l-8.318.756C17.91 18.512 16.875 19 15.8 19a5.21 5.21 0 0 1-2.714-.735zM16.5 17a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--paypal { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect width='32' height='32' fill='%23FFF' rx='10'%3E%3C/rect%3E%3Cpath fill='%23D9D9D9' fill-rule='nonzero' d='M1 7.992v16.016A6.992 6.992 0 0 0 7.992 31h16.016A6.992 6.992 0 0 0 31 24.008V7.992A6.992 6.992 0 0 0 24.008 1H7.992A6.992 6.992 0 0 0 1 7.992zm-1 0A7.992 7.992 0 0 1 7.992 0h16.016A7.992 7.992 0 0 1 32 7.992v16.016A7.992 7.992 0 0 1 24.008 32H7.992A7.992 7.992 0 0 1 0 24.008V7.992z'%3E%3C/path%3E%3Cpath fill='%23009DDD' fill-rule='nonzero' d='M22.188 11.387a9.969 9.969 0 0 1-.055.326c-.714 3.765-3.155 5.066-6.274 5.066h-1.587a.778.778 0 0 0-.762.67l-.813 5.298-.23 1.502a.414.414 0 0 0 .4.482h2.816a.684.684 0 0 0 .67-.587l.027-.147.53-3.457.035-.19a.683.683 0 0 1 .669-.588h.421c2.728 0 4.864-1.138 5.488-4.432.261-1.375.126-2.524-.564-3.332a2.703 2.703 0 0 0-.77-.61z'%3E%3C/path%3E%3Cpath fill='%23202C69' fill-rule='nonzero' d='M21.448 10.039a5.717 5.717 0 0 0-.786-.2 8.722 8.722 0 0 0-1.586-.134h-4.805c-.119 0-.231.031-.332.087a.877.877 0 0 0-.426.658l-1.022 7.44-.03.217c.068-.49.432-.85.864-.85h1.799c3.533 0 6.299-1.649 7.107-6.418.024-.14.045-.278.063-.413a4.028 4.028 0 0 0-.846-.387z'%3E%3C/path%3E%3Cpath fill='%231F3A85' fill-rule='nonzero' d='M14.547 11.222a.645.645 0 0 1 .376-.48.705.705 0 0 1 .292-.063h4.242c.502 0 .971.03 1.4.097a5.869 5.869 0 0 1 .854.194c.21.066.406.144.586.234.213-1.287-.001-2.163-.733-2.956C20.757 7.374 19.3 7 17.436 7h-5.412c-.38 0-.705.263-.764.621L9.006 21.202c-.045.269.173.511.458.511h3.341l.84-5.059.902-5.432z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} | |
.form--betalen .icon--sofort { | |
background-image: url("data:image/svg+xml,%3Csvg style='fill: transparent;' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Crect width='32' height='32' fill='%23FF9500' rx='8'%3E%3C/rect%3E%3Cpath fill='%23FFF' d='M19.983 9c-1.264 0-2.493 0-3.593.559s-2.071 1.678-2.819 3.915c-.162.481-.247.896-.259 1.256-.01.36.052.667.188.934.168.325.441.631.782.889.342.259.75.468 1.19.602l.529.151c.28.08.606.177.813.24.12.037.254.085.374.158.121.071.23.168.298.301a.667.667 0 0 1 .071.29.944.944 0 0 1-.055.335c-.103.304-.259.5-.555.62-.296.119-.731.157-1.392.162h-8.25L6 23h8.831c.831 0 2.35 0 3.81-.622 1.46-.62 2.861-1.861 3.454-4.346.223-.933.154-1.693-.211-2.291-.367-.597-1.03-1.03-1.994-1.307l-.47-.136-.695-.2a.933.933 0 0 1-.55-.396.78.78 0 0 1-.081-.628.92.92 0 0 1 .458-.551c.232-.129.537-.2.893-.2h5.134c.036-.052.069-.109.105-.16C25.622 10.832 26.757 9.758 28 9h-8.017z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E"); | |
background-position: left top; | |
background-repeat: no-repeat; | |
background-size: 32px 32px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.form--betalen { | |
.formRow { | |
&:last-child { | |
display: none; | |
} | |
} | |
.rsform-block-betaalwijze { | |
.rsformVerticalClear { | |
height: 40px; | |
overflow: visible; | |
label { | |
height: 40px; | |
} | |
} | |
} | |
.icon { | |
display: inline-block; | |
padding-top: 0; | |
padding-left: 40px; | |
} | |
$icon-background-color: transparent; | |
$icon-width: 32; | |
$icon-background-position: left top; | |
$icon-viewboxWidth: 32; | |
.icon--bancontact { | |
@include svg-background($payment--bancontact, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
.icon--belfius { | |
@include svg-background($payment--belfius, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
.icon--creditcard { | |
@include svg-background($payment--creditcard, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position, $attribute: "xmlns:xlink=\"http://www.w3.org/1999/xlink\""); | |
} | |
.icon--eps { | |
@include svg-background($payment--eps, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
.icon--giropay { | |
@include svg-background($payment--giropay, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
.icon--ideal { | |
@include svg-background($payment--ideal, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
.icon--inghomepay { | |
@include svg-background($payment--inghomepay, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
.icon--kbc { | |
@include svg-background($payment--kbccbc, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
.icon--paypal { | |
@include svg-background($payment--paypal, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
.icon--sofort { | |
@include svg-background($payment--sofort, $icon-background-color, $icon-width, $viewboxWidth: $icon-viewboxWidth, $background-position: $icon-background-position); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example | |
// | |
// @include svg-background('<g transform="matrix(2.18679,0,0,2.18679,5.43964,-0.0421697)"><path d="M5.9 5.3L0.5 0.1C0.4 0 0.2 0 0.1 0.1 0 0.2 0 0.4 0.1 0.5L5.2 5.5 0.1 10.5C0 10.6 0 10.8 0.1 10.9 0.2 11 0.2 11 0.3 11 0.4 11 0.5 11 0.5 10.9L5.9 5.7C6 5.6 6 5.4 5.9 5.3Z"/></g>', black, 16); | |
@mixin svg-background($svg, $color: $illusion-svg-background-color, $width: $illusion-svg-background-width, $height: $illusion-svg-background-height, $viewboxWidth: $illusion-svg-background-viewboxWidth, $viewboxHeight: $illusion-svg-background-viewboxHeight, $background-position: $illusion-svg-background-position, $background-repeat: $illusion-svg-background-repeat, $attributes: $illusion-svg-attributes) { | |
@if $height == false { | |
$height: $width; | |
} | |
@if $viewboxHeight == false { | |
$viewboxHeight: $viewboxWidth; | |
} | |
$svg-url: svg-url('<svg style="fill: #{$color};" xmlns="http://www.w3.org/2000/svg" #{$attributes} width="#{$width}" height="#{$height}" viewBox="0 0 #{$viewboxWidth} #{$viewboxHeight}">#{$svg}</svg>'); | |
background-image: $svg-url; | |
background-position: $background-position; | |
background-repeat: $background-repeat; | |
background-size: #{$width}px #{$height}px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment