first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
$value = get_post_meta($object->ID, WCPA_FORM_META_KEY, true);
$ml = new WCPA_Ml();
$fb_class = "";
if ($ml->is_active()) {
$my_default_lang = $ml->default_language();
$my_current_lang = $ml->current_language();
if ($ml->is_new_post($object->ID)) {
if (!$ml->is_default_lan()) {
echo '<p class="wcpa_editor_message">' . sprintf(__('You can\'t create new form in current language (%s), Please switch to your default languge (%s) and try again'), $my_current_lang, $my_default_lang) . '</p>';
$fb_class = 'wpml_fb wcpa-disable-new';
}
} else {
if (empty($value) || $value == 'null') {
if ($ml->is_duplicating($object->ID)) {
//copy value from base form or from any existing lang
$value = $ml->default_fb_meta($object->ID);
}
}
if (!$ml->is_default_lan()) {
echo '<p class="wcpa_editor_message">' . __('This editor can use only for translating Labels, Values, Help Text, Place holder and condtional logic value. All other configurations and paramaters will be populating from original form.', 'wcpa-text-domain') . '</p>';
$fb_class = 'wpml_fb lan-';
}
}
}
wp_nonce_field('wcpa_meta_box_nonce', 'wcpa_box_nonce');
echo '<div id="wcpa_editor" class="' . $fb_class . '"></div>';
?>
<textarea style="<?php echo ((wcpa_get_option('wcpa_show_form_json',false)==true)?"":"display:none"); ?>" name="wcpa_fb-editor-json" id="wcpa_fb-editor-json"><?php echo $value; ?></textarea>

View File

@@ -0,0 +1,2 @@
<?php
wp_category_checklist();

View File

@@ -0,0 +1,227 @@
<?php
$ml = new WCPA_Ml();
$fb_class = "";
if ($ml->is_active()) {
if (!$ml->is_default_lan()) {
echo '<p class="wcpa_editor_message">' . __('You can change Content/String settings only from here. All other configurations are taking from base language') . '</p>';
$fb_class = 'wcpa_wpml_set ';
}
}
?>
<ul class="wcpa_g_set_tabs <?php echo $fb_class; ?>">
<li><a href="#wcpa_disp_settings " class="active"><?php _e('Display Settings', 'wcpa-text-domain'); ?></a></li>
<li><a href="#wcpa_price_settings"><?php _e('Pricing Settings', 'wcpa-text-domain'); ?></a></li>
<li><a href="#wcpa_content_settings"><?php _e('Contents/Strings', 'wcpa-text-domain'); ?></a></li>
<li><a href="#wcpa_other_settings"><?php _e('Other settings', 'wcpa-text-domain'); ?></a></li>
<li><a href="#wcpa_import_export"><?php _e('Export Form', 'wcpa-text-domain'); ?></a></li>
</ul>
<div class="wcpa_g_set_tabcontents <?php echo $fb_class; ?>">
<div id="wcpa_disp_settings" class="wcpa_tabcontent">
<div class="options_group">
<input type="checkbox" name="disp_use_global" id="disp_use_global" value="1"
<?php checked(wcpa_get_post_meta($object->ID, 'disp_use_global', true)); ?> >
<label for="disp_use_global"><?php _e('Use Global settings', 'wcpa-text-domain'); ?></label>
</div>
<div class="options_group <?php echo (wcpa_get_post_meta($object->ID, 'disp_use_global', true) == true) ? 'disable' : '' ?>">
<h3><?php _e('Price', 'wcpa-text-domain') ?></h3>
<ul>
<li>
<input type="checkbox" name="disp_show_field_price" id="disp_show_field_price"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'disp_show_field_price', wcpa_get_option('disp_show_field_price', true))); ?>>
<label for="disp_show_field_price"><?php _e('Show price against each fields', 'wcpa-text-domain'); ?></label>
</li>
<li>
<input type="checkbox" name="disp_hide_options_price" id="disp_hide_options_price"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'disp_hide_options_price', wcpa_get_option('disp_hide_options_price', false))); ?>>
<label for="disp_hide_options_price"><?php _e('Hide options price ( applicable for fields having options)', 'wcpa-text-domain'); ?></label>
</li>
</ul>
</div>
<div class="options_group <?php echo (wcpa_get_post_meta($object->ID, 'disp_use_global', true)==true)?'disable':'' ?>">
<h3><?php _e('Price Summary Section', 'wcpa-text-domain') ?></h3>
<ul>
<li>
<input type="checkbox" name="disp_summ_show_total_price" id="disp_summ_show_total_price"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'disp_summ_show_total_price', wcpa_get_option('disp_summ_show_total_price', true))); ?>>
<label for="disp_summ_show_total_price">
<?php _e('Show Total', 'wcpa-text-domain') ?> </label>
</li>
<li>
<input type="checkbox" name="disp_summ_show_product_price" id="disp_summ_show_product_price"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'disp_summ_show_product_price', wcpa_get_option('disp_summ_show_product_price', true))); ?>>
<label for="disp_summ_show_product_price">
<?php _e('Show Product price', 'wcpa-text-domain') ?>
</label>
</li>
<li>
<input type="checkbox" name="disp_summ_show_option_price" id="disp_summ_show_option_price"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'disp_summ_show_option_price', wcpa_get_option('disp_summ_show_option_price', true))); ?>>
<label for="disp_summ_show_option_price">
<?php _e('Show Options Price', 'wcpa-text-domain') ?>
</label>
</li>
</ul>
</div>
</div>
<div id="wcpa_price_settings" class="wcpa_tabcontent" style="display: none">
<div class="options_group">
<ul>
<li>
<input type="checkbox" name="pric_overide_base_price" id="pric_overide_base_price"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'pric_overide_base_price', false)); ?> >
<label for="pric_overide_base_price">
<?php _e(' Overide product base price if options price is higher', 'wcpa-text-domain') ?>
</label>
</li>
<li>
<input type="checkbox" name="pric_overide_base_price_if_gt_zero"
id="pric_overide_base_price_if_gt_zero"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'pric_overide_base_price_if_gt_zero', false)); ?> >
<label for="pric_overide_base_price_if_gt_zero">
<?php _e(' Overide product base price if options price is greater than zero', 'wcpa-text-domain') ?>
</label>
</li>
<li>
<input type="checkbox" name="pric_use_as_fee" id="pric_use_as_fee"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'pric_use_as_fee', false)); ?> >
<label for="pric_use_as_fee">
<?php _e('Set this form price as Fee - Fee will be counted once irrespective of the quntity', 'wcpa-text-domain') ?>
</label>
</li>
<li>
<input type="checkbox" name="exclude_from_discount" id="exclude_from_discount"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'exclude_from_discount', false)); ?> >
<label for="exclude_from_discount">
<?php _e('Exlude this form price from applying discounts', 'wcpa-text-domain') ?>
</label>
</li>
<li style="opacity: .5">
<input type="checkbox" name="pric_cal_option_once" id="pric_cal_option_once"
value="1" <?php checked(wcpa_get_post_meta($object->ID, 'pric_cal_option_once', false)); ?> >
<label for="pric_cal_option_once">
<?php _e('Count the options price only once for a product irrespective of the quantity', 'wcpa-text-domain') ?>
<br>
<smal>Please use fee insted of this feature, This wont be no longer supporting</smal>
</label>
</li>
</ul>
</div>
</div>
<div id="wcpa_content_settings" class="wcpa_tabcontent" style="display: none">
<div class="options_group">
<input type="checkbox" name="cont_use_global" id="cont_use_global" value="1"
<?php checked(wcpa_get_post_meta($object->ID, 'cont_use_global', true)); ?> >
<label for="cont_use_global"><?php _e('Use Global settings', 'wcpa-text-domain'); ?></label>
</div>
<div class="options_group <?php echo (wcpa_get_post_meta($object->ID, 'cont_use_global', true)==true)?'disable':'' ?>">
<ul>
<li>
<label for="options_total_label"> <?php
_e('Options Price Label:', 'wcpa-text-domain');
?></label>
<input type="text" name="options_total_label" id="options_total_label"
value="<?php echo wcpa_get_post_meta($object->ID, 'options_total_label', wcpa_get_option('options_total_label', 'Options Price')); ?>">
</li>
<li>
<label for="options_product_label"> <?php
_e('Product Price Label:', 'wcpa-text-domain');
?></label>
<input type="text" name="options_product_label" id="options_product_label"
value="<?php echo wcpa_get_post_meta($object->ID, 'options_product_label', wcpa_get_option('options_product_label', 'Product Price')); ?>"
>
</li>
<li>
<label for="total_label"><?php
_e('Total Label:', 'wcpa-text-domain');
?> </label>
<input type="text" name="total_label" id="total_label"
value="<?php echo wcpa_get_post_meta($object->ID, 'total_label', wcpa_get_option('total_label', 'Total')); ?>">
</li>
<li>
<label for="fee_label"><?php
_e('Fee:', 'wcpa-text-domain');
?> </label>
<input type="text" name="fee_label" id="fee_label"
value="<?php echo wcpa_get_post_meta($object->ID, 'fee_label', wcpa_get_option('fee_label', 'Fee')); ?>">
</li>
</ul>
</div>
</div>
<div id="wcpa_other_settings" class="wcpa_tabcontent" style="display: none">
<div class="options_group">
<ul>
<li>
<input type="checkbox" name="wcpa_drct_prchsble" id="wcpa_drct_prchsble" value="1"
<?php checked(get_post_meta($object->ID, 'wcpa_drct_prchsble', true)); ?> >
<label for="wcpa_drct_prchsble"> <?php
_e('Allow direct purchase from archive/listing pages without selecting options', 'wcpa-text-domain');
?><br>
</label>
<small>
<?php
_e('Please ensure you have not added any mandatory fields, else it will throw validation errors', 'wcpa-text-domain');
?>
</small>
</li>
<li>
<input type="checkbox" name="enable_recaptcha" id="enable_recaptcha" value="1"
<?php checked(wcpa_get_post_meta($object->ID, 'enable_recaptcha', false)); ?> >
<label for="enable_recaptcha">
<?php _e('Enable reCAPTCHA for this forms', 'wcpa-text-domain'); ?> <br>
</label>
<small><?php echo sprintf(__('You need to configure the reCAPTCHA keys at %s. Enabling Captcha is not recommended always, Avoid using captcha if there is no partcular reason', 'wcpa-text-domain'), '<a href="' . admin_url('options-general.php?page=wcpa_settings') . '" target="_blank">Settings</a>'); ?> </small>
</li>
<li>
<input type="checkbox" name="bind_quantity" id="bind_quantity" value="1"
<?php checked(wcpa_get_post_meta($object->ID, 'bind_quantity', false)); ?> >
<label for="bind_quantity">
<?php _e('Bind field with quantity', 'wcpa-text-domain'); ?> <br>
</label>
<small><?php echo sprintf(__('You can use custom formula for binding to quantity ', 'wcpa-text-domain'), '<a href="' . admin_url('options-general.php?page=wcpa_settings') . '" target="_blank">Settings</a>'); ?> </small>
<input type="text" name="quantity_bind_formula" id="quantity_bind_formula"
value="<?php echo wcpa_get_post_meta($object->ID, 'quantity_bind_formula', wcpa_get_option('quantity_bind_formula', '')); ?>">
<small><?php echo sprintf(__('If you want to bind a field with quantity, You can use %s', 'wcpa-text-domain'), '<span class="wcpa_var_hilight">{field.element_id_of_the_field.value}</span>'); ?> </small>
</li>
</ul>
</div>
</div>
<div id="wcpa_import_export" class="wcpa_tabcontent" style="display: none">
<div class="options_group">
<ul>
<li>
<div>
<label> <?php
_e('You can copy this data to export the form', 'wcpa-text-domain');
?></label>
<textarea onclick="this.focus();this.select()" style="width:80%" readonly="readonly"><?php
echo wcpa_export_form($object->ID);
?></textarea>
</div>
</li>
</ul>
</div>
</div>
</div>
<div style="clear: both">
</div>

View File

@@ -0,0 +1,352 @@
<?php
if (is_array($meta_data) && count($meta_data)) {
?>
<table>
<tr>
<th><?php _e('Options', 'wcpa-text-domain') ?></th>
<th><?php _e('Value', 'wcpa-text-domain') ?></th>
<th><?php _e('Cost', 'wcpa-text-domain') ?></th>
<th></th>
</tr>
<?php
foreach ($meta_data as $k => $data) {
if (in_array($data['type'], array('checkbox-group', 'select', 'radio-group', 'image-group', 'color-group')) && is_array($data['value'])) {
$label_printed = false;
foreach ($data['value'] as $l => $v) {
?>
<tr class="item_wcpa">
<td class="name">
<?php
echo $label_printed ? '' : $data['label'];
$label_printed = true;
?>
</td>
<td class="value" >
<div class="view">
<?php
if ($data['type'] == 'image-group') {
echo '<strong>' . __('Label:', 'wcpa-text-domain') . '</strong> ' . __($v['label'], 'wcpa-text-domain') . '<br>';
if (isset($v['image']) && $v['image'] !== FALSE) {
$img_size_style = ((isset($data['form_data']->disp_size_img) && $data['form_data']->disp_size_img > 0) ? 'style="width:' . $data['form_data']->disp_size_img . 'px"' : '');
echo ' <img class="wcpa_img" '.$img_size_style.' src="' . $v['image'] . '" />';
} else
if (isset($v['value']) && $v['value'] !== FALSE) {
echo ' ' . $v['value'];
}
} else if ($data['type'] == 'color-group') {
echo '<strong>' . __('Label:', 'wcpa-text-domain') . '</strong> ' . __($v['label'], 'wcpa-text-domain') . '<br>';
echo '<strong>' . __('Value:', 'wcpa-text-domain') . '</strong> ' . '<span style="color:' . $v['color'] . ';font-size: 20px;
padding: 0;
line-height: 0;">&#9632;</span>' . $v['value'];
} else if (isset($v['i'])) {
echo '<strong>' . __('Label:', 'wcpa-text-domain') . '</strong> ' . __($v['label'], 'wcpa-text-domain') . '<br>';
echo '<strong>' . __('Value:', 'wcpa-text-domain') . '</strong> ' . $v['value'];
} else {
echo $v;
}
?>
</div>
<div class="edit" style="display: none;">
<?php
if ($data['type'] == 'image-group') {
?>
<?php echo '<strong>' . __('Label:', 'wcpa-text-domain') . '</strong>'; ?>
<input type="text" name="wcpa_meta[value][<?php echo $item_id; ?>][<?php echo $k; ?>][<?php echo $l; ?>][label]"
value="<?php echo $v['label'] ?>"> <br>
<?php
if (isset($v['image']) && $v['image'] !== FALSE) {
echo __('Value:', 'wcpa-text-domain') . '<input type="text" name="wcpa_meta[value][' . $item_id . '][' . $k . '][' . $l . '][value]"
value="' . $v['image'] . '">';
} else
if (isset($v['value']) && $v['value'] !== FALSE) {
echo __('Value:', 'wcpa-text-domain') . ' <input type="text" name="wcpa_meta[value][' . $item_id . '][' . $k . '][' . $l . '][value]"
value="' . $v['value'] . '">';
}
} else if (isset($v['i'])) {
?>
<?php echo '<strong>' . __('Label:', 'wcpa-text-domain') . '</strong>'; ?> <input type="text" name="wcpa_meta[value][<?php echo $item_id; ?>][<?php echo $k; ?>][<?php echo $l; ?>][label]"
value="<?php echo $v['label'] ?>"> <br>
<?php echo '<strong>' . __('Value:', 'wcpa-text-domain') . '</strong>'; ?> <input type="text" name="wcpa_meta[value][<?php echo $item_id; ?>][<?php echo $k; ?>][<?php echo $l; ?>][value]"
value="<?php echo $v['value'] ?>">
<?php
} else {
?>
<input type="text" name="wcpa_meta[value][<?php echo $item_id; ?>][<?php echo $k; ?>][<?php echo $l; ?>]" value="<?php echo $v ?>">
<?php }
?>
</div>
</td>
<td class="item_cost" width="1%">
<?php
if (isset($data['form_data']->enablePrice) && $data['form_data']->enablePrice &&
(!isset($data['is_fee']) || $data['is_fee'] === false)) {
?>
<div class="view">
<?php echo isset($data['price'][$l]) ? $data['price'][$l] : '0'; ?>
</div>
<div class="edit" style="display: none;">
<input type="text"
data-price="<?php echo (isset($data['price'][$l]) ? $data['price'][$l] : '0') ?>"
class="wcpa_has_price"
name="wcpa_meta[price][<?php echo $item_id; ?>][<?php echo $k; ?>][<?php echo $l; ?>]"
value="<?php echo (isset($data['price'][$l]) ? $data['price'][$l] : '0'); ?>">
</div>
<?php
}
?>
</td>
</td>
<td class="wc-order-edit-line-item" width="1%">
<div class = "wc-order-edit-line-item-actions edit" style="display: none;">
<a class="wcpa_delete-order-item tips" href="#" data-tip="<?php esc_attr_e('Delete item', 'woocommerce'); ?>"></a>
</div>
</td>
</tr>
<?php
}
} else if ($data['type'] == 'file') {
?>
<tr class="item_wcpa">
<td class="name"><?php echo $data['label']; ?></td>
<td class="value" >
<div class="view">
<?php
if (isset($data['value']['url'])) {
$display = '<a href="' . $data['value']['url'] . '" target="_blank" download="' . $data['value']['file_name'] . '">';
if (in_array($data['value']['type'], array('image/jpg', 'image/png', 'image/gif', 'image/jpeg'))) {
$display .= '<img class="wcpa_img" style="max-width:100%;" src="' . $data['value']['url'] . '" />';
} else {
$display .= '<img class="wcpa_icon" src="' . wp_mime_type_icon($data['value']['type']) . '" />';
}
$display .= $data['value']['file_name'] . '</a>';
echo $display;
} else {
echo $data['value'];
}
?>
</div>
<div class="edit" style="display: none;">
<?php
if (isset($data['value']['url'])) {
echo '<input type="text"
name="wcpa_meta[value][' . $item_id . '][' . $k . ']" value="' . $data['value']['url'] . '">';
} else {
echo '<input type="text"
name="wcpa_meta[value][' . $item_id . '][' . $k . ']" value="' . ($data['value']) . '">';
}
?>
</div>
</td>
<td class="item_cost" width="1%">
<?php
if (isset($data['form_data']->enablePrice) && $data['form_data']->enablePrice) {
?>
<div class="view">
<?php echo wcpa_price($data['price'], false, ['currency' => $order->get_currency()]); ?>
</div>
<div class="edit" style="display: none;">
<input type="text"
data-price="<?php echo $data['price']; ?>"
class="wcpa_has_price"
name="wcpa_meta[price][<?php echo $item_id; ?>][<?php echo $k; ?>]"
value="<?php echo $data['price'] ?>">
</div>
<?php
}
?>
</td>
<td class = "wc-order-edit-line-item" width = "1%">
<div class = "wc-order-edit-line-item-actions edit" style="display: none;">
<a class="wcpa_delete-order-item tips" href="#" data-tip="<?php esc_attr_e('Delete item', 'woocommerce'); ?>"></a>
</div>
</td>
</tr>
<?php
} else if ($data['type'] === 'placeselector') {
?>
<tr class="item_wcpa">
<td class="name"><?php echo $data['label']; ?></td>
<td class="value" >
<div class="view">
<?php
if (!empty($data['value']['formated'])) {
$display = $data['value']['formated'] . '<br>';
if (!empty($data['value']['splited']['street_number'])) {
$display .= __('Street address:', 'wcpa-text-domain') . ' ' . $data['value']['splited']['street_number'] . ' ' . $data['value']['splited']['route'] . ' <br>';
}
if (!empty($data['value']['splited']['locality'])) {
$display .= __('City:', 'wcpa-text-domain') . ' ' . $data['value']['splited']['locality'] . '<br>';
}
if (!empty($data['value']['splited']['administrative_area_level_1'])) {
$display .= __('State:', 'wcpa-text-domain') . ' ' . $data['value']['splited']['administrative_area_level_1'] . '<br>';
}
if (!empty($data['value']['splited']['postal_code'])) {
$display .= __('Zip code:', 'wcpa-text-domain') . ' ' . $data['value']['splited']['postal_code'] . '<br>';
}
if (!empty($data['value']['splited']['country'])) {
$display .= __('Country:', 'wcpa-text-domain') . ' ' . $data['value']['splited']['country'] . '<br>';
}
if (isset($data['value']['cords']['lat']) && !empty($data['value']['cords']['lat'])) {
$display .= __('Latitude:', 'wcpa-text-domain') . ' ' . $data['value']['cords']['lat'] . '<br>';
$display .= __('Longitude:', 'wcpa-text-domain') . ' ' . $data['value']['cords']['lng'] . '<br>';
$display .= '<a href="https://www.google.com/maps/?q=' . $data['value']['cords']['lat'] . ',' . $data['value']['cords']['lng'] . '" target="_blank">' . __('View on map', 'wcpa-text-domain') . '</a> <br>';
}
echo $display;
}
?>
</div>
<div class="edit" style="display: none;">
<input type="text"
name="wcpa_meta[value][<?php echo $item_id; ?>][<?php echo $k; ?>][formated]"
value="<?php echo $data['value']['formated'] ?>"> <br><br>
<?php
$name = 'wcpa_meta[value][' . $item_id . '][' . $k . ']';
echo __('Street address:', 'wcpa-text-domain') . '
<input type="text" class="street_number" name="' . $name . '[street_number]" value="' . (isset($data['value']['splited']['street_number']) ? $data['value']['splited']['street_number'] : '') . '" >
<input type="text" class="route" name="' . $name . '[route]" value="' . (isset($data['value']['splited']['route']) ? $data['value']['splited']['route'] : '') . '" > <br>
' . __('City:', 'wcpa-text-domain') . '<input type="text" name="' . $name . '[locality]" value="' . (isset($data['value']['splited']['locality']) ? $data['value']['splited']['locality'] : '') . '" ><br>
' . __('State:', 'wcpa-text-domain') . '<input type="text" name="' . $name . '[administrative_area_level_1]" value="' . (isset($data['value']['splited']['administrative_area_level_1']) ? $data['value']['splited']['administrative_area_level_1'] : '') . '" ><br>
' . __('Zip code:', 'wcpa-text-domain') . '<input type="text" name="' . $name . '[postal_code]" value="' . (isset($data['value']['splited']['postal_code']) ? $data['value']['splited']['postal_code'] : '') . '" ><br>
' . __('Country:', 'wcpa-text-domain') . '<input type="text" name="' . $name . '[country]" value="' . (isset($data['value']['splited']['country']) ? $data['value']['splited']['country'] : '') . '" ><br>
' . __('Latitude:', 'wcpa-text-domain') . '<input type="text" name="' . $name . '[lat]" value="' . (isset($data['value']['cords']['lat']) ? $data['value']['cords']['lat'] : '') . '" ><br>
' . __('Longitude:', 'wcpa-text-domain') . '<input type="text" name="' . $name . '[lng]" value="' . (isset($data['value']['cords']['lng']) ? $data['value']['cords']['lng'] : '') . '" >';
?>
</div>
</td>
<td class="item_cost" width="1%">
<?php
if (isset($data['form_data']->enablePrice) && $data['form_data']->enablePrice) {
?>
<div class="view">
<?php echo wcpa_price($data['price'][0], false, ['currency' => $order->get_currency()]); ?>
</div>
<div class="edit" style="display: none;">
<input type="text"
data-price="<?php echo $data['price'][0]; ?>"
class="wcpa_has_price"
name="wcpa_meta[price][<?php echo $item_id; ?>][<?php echo $k; ?>]"
value="<?php echo $data['price'][0] ?>">
</div>
<?php
}
?>
</td>
<td class = "wc-order-edit-line-item" width = "1%">
<div class = "wc-order-edit-line-item-actions edit" style="display: none;">
<a class="wcpa_delete-order-item tips" href="#" data-tip="<?php esc_attr_e('Delete item', 'woocommerce'); ?>"></a>
</div>
</td>
</tr>
<?php
} else {
?>
<tr class="item_wcpa">
<td class="name">
<?php
if ($data['type'] == 'hidden' && empty($data['label'])) {
echo $data['label'] . '[hidden]';
} else {
echo $data['label'];
}
?>
</td>
<td class="value" >
<div class="view">
<?php
if ($data['type'] == 'color') {
echo '<span style = "color:' . $data['value'] . ';font-size: 20px;
padding: 0;
line-height: 0;">&#9632;</span>' . $data['value'];
} else {
echo nl2br($data['value']);
}
?>
</div>
<div class="edit" style="display: none;">
<?php
if ($data['type'] == 'paragraph' || $data['type'] == 'header') {
echo $data['value'];
echo '<input type="hidden"
name="wcpa_meta[value][' . $item_id . '][' . $k . ']"
value="1">';
} else if($data['type'] == 'textarea' ) {
?>
<textarea name="wcpa_meta[value][<?php echo $item_id; ?>][<?php echo $k; ?>]" ><?php echo ($data['value']) ?></textarea>
<?php
}
else {
?>
<input type="text"
name="wcpa_meta[value][<?php echo $item_id; ?>][<?php echo $k; ?>]"
value="<?php echo htmlspecialchars($data['value']) ?>">
<?php
}
?>
</div>
</td>
<td class="item_cost" width="1%">
<?php
if (isset($data['form_data']->enablePrice) && $data['form_data']->enablePrice) {
?>
<div class="view">
<?php echo wcpa_price($data['price'], false, ['currency' => $order->get_currency()]); ?>
</div>
<div class="edit" style="display: none;">
<input type="text"
data-price="<?php echo $data['price']; ?>"
class="wcpa_has_price"
name="wcpa_meta[price][<?php echo $item_id; ?>][<?php echo $k; ?>]"
value="<?php echo $data['price'] ?>">
</div>
<?php
}
?>
</td>
<td class = "wc-order-edit-line-item" width = "1%">
<div class = "wc-order-edit-line-item-actions edit" style="display: none;">
<a class="wcpa_delete-order-item tips" href="#" data-tip="<?php esc_attr_e('Delete item', 'woocommerce'); ?>"></a>
</div>
</td>
</tr>
<?php
}
?>
<?php
}
?>
<tr>
<!-- /* dummy field , it will help to iterate through all data for removing last item*/-->
<input type="hidden" name="wcpa_meta[value][<?php echo $item_id; ?>][<?php echo $k + 99; ?>]" value="">
</tr>
</table>
<?php
}

View File

@@ -0,0 +1,447 @@
<div class="wrap wcpa_settings">
<div id="icon-options-general" class="icon32"></div>
<h1><?php echo WCPA_PLUGIN_NAME; ?></h1>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<!-- main content -->
<div id="post-body-content">
<div class="meta-box-sortables ui-sortable">
<div class="postbox">
<div class="inside ">
<form method="post" id="wcpa_settings_main" action="">
<?php wp_nonce_field('wcpa_save_settings', 'wcpa_nonce'); ?>
<ul class="wcpa_g_set_tabs ">
<li><a href="#wcpa_disp_settings" class="active">
<span class="icon_display"></span>
<?php _e('Display Settings', 'wcpa-text-domain'); ?></a></li>
<!-- <li> <a href="#wcpa_price_settings">Price Settings</a> </li> -->
<li><a href="#wcpa_content_settings">
<span class="icon_content"></span>
<?php _e('Contents/Strings', 'wcpa-text-domain'); ?></a></li>
<li><a href="#wcpa_other_settings">
<span class="icon_other"></span>
<?php _e('Other Settings', 'wcpa-text-domain'); ?></a></li>
<li><a href="#wcpa_import_export">
<span class="icon_import"></span>
<?php _e('Import/Export', 'wcpa-text-domain'); ?></a></li>
<li><a href="#wcpa_license_key">
<span class="icon_license"></span>
<?php _e('License Key', 'wcpa-text-domain'); ?></a></li>
</ul>
<div class="wcpa_g_set_tabcontents">
<div id="wcpa_disp_settings" class="wcpa_tabcontent">
<div class="options_group">
<h3><?php _e('Price', 'wcpa-text-domain') ?></h3>
<ul>
<li>
<input type="checkbox" name="disp_show_field_price" id="disp_show_field_price" value="1" <?php checked(wcpa_get_option('disp_show_field_price', true)); ?>>
<label for="disp_show_field_price"><?php _e('Show price against each fields', 'wcpa-text-domain'); ?>
</label>
</li>
</ul>
<h3><?php _e('Price Summary Section', 'wcpa-text-domain') ?></h3>
<ul>
<li>
<input type="checkbox" name="disp_summ_show_total_price" id="disp_summ_show_total_price" value="1" <?php checked(wcpa_get_option('disp_summ_show_total_price', true)); ?>>
<label for="disp_summ_show_total_price">
<?php _e('Show Total', 'wcpa-text-domain') ?> </label>
</li>
<li>
<input type="checkbox" name="disp_summ_show_product_price" id="disp_summ_show_product_price" value="1" <?php checked(wcpa_get_option('disp_summ_show_product_price', true)); ?>>
<label for="disp_summ_show_product_price">
<?php _e('Show Product Price', 'wcpa-text-domain') ?> </label>
</li>
<li>
<input type="checkbox" name="disp_summ_show_option_price" id="disp_summ_show_option_price" value="1" <?php checked(wcpa_get_option('disp_summ_show_option_price', true)); ?>>
<label for="disp_summ_show_option_price">
<?php _e('Show Options Price', 'wcpa-text-domain') ?>
</label>
</li>
</ul>
<h3> <?php _e('Custom options data', 'wcpa-text-domain') ?> </h3>
<ul>
<li>
<input type="checkbox" name="show_meta_in_cart" id="show_meta_in_cart" value="1" <?php checked(wcpa_get_option('show_meta_in_cart', true)); ?>>
<label for="show_meta_in_cart"> <?php _e('Show in Cart', 'wcpa-text-domain'); ?> </label>
</li>
<li>
<input type="checkbox" name="show_meta_in_checkout" id="show_meta_in_checkout" value="1" <?php checked(wcpa_get_option('show_meta_in_checkout', true)); ?>>
<label for="show_meta_in_checkout">
<?php _e('Show in Checkout', 'wcpa-text-domain'); ?> </label>
</li>
<li>
<input type="checkbox" name="show_meta_in_order" id="show_meta_in_order" value="1" <?php checked(wcpa_get_option('show_meta_in_order', true)); ?>>
<label for="show_meta_in_order">
<?php _e('Show in Order', 'wcpa-text-domain'); ?> </label>
</li>
</ul>
<h3> <?php _e('Show or Hide Price In', 'wcpa-text-domain') ?> </h3>
<ul>
<li>
<input type="checkbox" name="show_price_in_cart" id="show_price_in_cart" value="1" <?php checked(wcpa_get_option('show_price_in_cart', true)); ?>>
<label for="show_price_in_cart"> <?php _e('Show in cart', 'wcpa-text-domain'); ?> </label>
</li>
<li>
<input type="checkbox" name="show_price_in_checkout" id="show_price_in_checkout" value="1" <?php checked(wcpa_get_option('show_price_in_checkout', true)); ?>>
<label for="show_price_in_checkout">
<?php _e('Show in Checkout', 'wcpa-text-domain'); ?> </label>
</li>
<li>
<input type="checkbox" name="show_price_in_order" id="show_price_in_order" value="1" <?php checked(wcpa_get_option('show_price_in_order', true)); ?>>
<label for="show_price_in_order">
<?php _e('Show in Order', 'wcpa-text-domain'); ?> </label>
</li>
<li>
<input type="checkbox" name="show_price_in_order_meta" id="show_price_in_order_meta" value="1" <?php checked(wcpa_get_option('show_price_in_order_meta', true)); ?>>
<label for="show_price_in_order_meta">
<?php _e('Add in Order Meta( Price will be saved along with order meta, Third party plugins will be using this data)', 'wcpa-text-domain'); ?> </label>
</li>
</ul>
<?php submit_button(null, 'primary', 'wcpa_save_settings'); ?>
</div>
</div>
<div id="wcpa_content_settings" class="wcpa_tabcontent" style="display: none">
<div class="options_group">
<h3><?php _e('Price Summary Section Labels', 'wcpa-text-domain') ?></h3>
<ul>
<li>
<label for="options_total_label"> <?php
_e('Options Price Label:', 'wcpa-text-domain'); ?>
</label>
<input type="text" name="options_total_label" id="options_total_label" value="<?php echo wcpa_get_option('options_total_label', 'Options Price'); ?>">
</li>
<li>
<label for="options_product_label"> <?php
_e('Product Price Label:', 'wcpa-text-domain');
?></label>
<input type="text" name="options_product_label" id="options_product_label" value="<?php echo wcpa_get_option('options_product_label', 'Product Price'); ?>">
</li>
<li>
<label for="total_label"><?php
_e('Total Label:', 'wcpa-text-domain');
?> </label>
<input type="text" name="total_label" id="total_label" value="<?php echo wcpa_get_option('total_label', 'Total'); ?>">
</li>
<li>
<label for="fee_label"><?php
_e('Fee Label:', 'wcpa-text-domain');
?> </label>
<input type="text" name="fee_label" id="fee_label" value="<?php echo wcpa_get_option('fee_label', 'Fee'); ?>">
</li>
<li>
<label style="display: block" for="field_option_price_format"><?php
_e('Format for showing price in field options:', 'wcpa-text-domain');
?> </label>
<input style="display: inline-block" type="text" name="field_option_price_format" id="field_option_price_format" placeholder="(price)" value="<?php echo wcpa_get_option('field_option_price_format', '(price)'); ?>">
<span class="wcpa_var_hilight"><?php _e('Preview:', 'wcpa-text-domain');
echo str_replace('price', wcpa_price(10), wcpa_get_option('field_option_price_format', '(price)')); ?></span>
</li>
</ul>
</div>
<div class="options_group section">
<ul>
<li>
<label for="add_to_cart_text">
<p><?php _e('Add to Cart button text', 'wcpa-text-domain'); ?> </p>
<small><?php _e('Add to cart button text in archive/product listing page in case product has additional fields', 'wcpa-text-domain'); ?> </small>
</label>
<input type="text" name="add_to_cart_text" id="add_to_cart_text" value="<?php echo wcpa_get_option('add_to_cart_text', 'Select options'); ?>">
</li>
<li>
<label for="price_prefix_label">
<p><?php _e('Product Price prefix', 'wcpa-text-domain'); ?></p>
<small><?php _e('Set a prefix text before the price in archive and product page. Leave blank if no prefix needed. eg: \'Starting at\' ', 'wcpa-text-domain'); ?> </small>
</label>
<input type="text" name="price_prefix_label" id="price_prefix_label" value="<?php echo wcpa_get_option('price_prefix_label', ''); ?>">
</li>
</ul>
<?php submit_button(null, 'primary', 'wcpa_save_settings'); ?>
</div>
</div>
<div id="wcpa_other_settings" class="wcpa_tabcontent" style="display: none">
<div class="options_group">
<h3><?php _e('Other Settings', 'wcpa-text-domain') ?></h3>
<ul>
<li>
<input type="checkbox" name="form_loading_order_by_date" id="form_loading_order_by_date" value="1" <?php checked(wcpa_get_option('form_loading_order_by_date', false)); ?>>
<label for="form_loading_order_by_date" class="text">
<?php _e('Load form in recency order', 'wcpa-text-domain'); ?>
<br>
<small class="label"><?php _e('If a product has assigned multiple forms, it will be loaded based on form created order', 'wcpa-text-domain'); ?> </small>
</label>
</li>
</ul>
</div>
<div class="options_group">
<ul>
<li>
<input type="checkbox" name="hide_empty_data" id="hide_empty_data" value="1" <?php checked(wcpa_get_option('hide_empty_data', false)); ?>>
<label for="hide_empty_data" class="text">
<?php _e('Hide empty fields in cart', 'wcpa-text-domain'); ?>
<br>
<small class="label"><?php _e('Hide empty fields in cart, checkout and order', 'wcpa-text-domain'); ?> </small>
</label>
</li>
</ul>
</div>
<div class="options_group">
<ul>
<li>
<input type="checkbox" name="change_price_as_quantity" id="change_price_as_quantity" value="1" <?php checked(wcpa_get_option('change_price_as_quantity', false)); ?>>
<label for="change_price_as_quantity" class="text">
<?php _e('Update summary price as quantity change', 'wcpa-text-domain'); ?>
<br>
<small class="label"><?php _e('In price summary section, price will be updated as quantity change', 'wcpa-text-domain'); ?> </small>
</label>
</li>
</ul>
</div>
<div class="options_group">
<h3><?php _e('Custom fields for products', 'wcpa-text-domain'); ?> </h3>
<ul>
<li>
<label for="product_custom_fields">
<?php _e('This fields can be used in custom price formula with prefix \'wcpa_pcf_\'', 'wcpa-text-domain'); ?>
<br>
<?php _e('Example: ', 'wcpa-text-domain'); ?>
<span class="example_slug">{wcpa_pcf_packing_price}</span></label><br>
<div id="product_custom_fields">
<span class="custom_field_slug title">Custom Field Slug</span>
<span class="default_value title">Default Value</span>
<?php
$custom_fields = wcpa_get_option('product_custom_fields');
if (is_array($custom_fields)) {
foreach ($custom_fields as $key => $v) {
?>
<div class="fields">
<input type="text" name="product_custom_field_name[<?php echo $key ?>]" placeholder="<?php _e('Custom Field Slug', 'wcpa-text-domain') ?>" value="<?php echo $v['name']; ?>">
<input type="text" name="product_custom_field_value[<?php echo $key ?>]" placeholder="<?php _e('Default Value', 'wcpa-text-domain') ?>" value="<?php echo $v['value']; ?>" />
<input type="submit" class="wcpa_rmv_btn" value="Remove">
<span class="wcpa_var_hilight"> {wcpa_pcf_<?php echo $v['name']; ?>}</span>
</div>
<?php
}
}
?>
</div>
<div id="product_custom_field_add">
<input type="text" class="product_custom_field_name" placeholder="<?php _e('Custom Field Slug', 'wcpa-text-domain') ?>" name="product_custom_field_name[0]" value="">
<input type="text" class="product_custom_field_value" placeholder="<?php _e('Default Value', 'wcpa-text-domain') ?>" name="product_custom_field_value[0]" value="" />
<input type="submit" class="wcpa_add_btn" value="Add">
</div>
</li>
</ul>
</div>
<div class="options_group textbox_width">
<ul>
<li>
<label for="recaptcha_site_key" class="title"> <?php
_e('reCAPTCHA Site Key:', 'wcpa-text-domain');
?></label>
<input type="text" name="recaptcha_site_key" id="recaptcha_site_key" value="<?php echo wcpa_get_option('recaptcha_site_key', ''); ?>">
<div class="tooltip">
<img src="<?php echo $asset_url; ?>/img/help-circle.png">
<span class="tooltiptext">If you need to use reCAPTCHA in your forms you have to paste reCAPTCHA Site Key here. Tick to enable option shown at: Products-> Custom Product Addons-> Other Settings after pasting both the keys.
<a href="https://www.google.com/recaptcha/admin" target="_blank"><br>Get reCAPTCHA Site Key</a>
</span>
</div>
</li>
<li>
<label for="recaptcha_secret_key" class="title"> <?php
_e('reCAPTCHA Secret Key:', 'wcpa-text-domain');
?></label>
<input type="text" name="recaptcha_secret_key" id="recaptcha_secret_key" value="<?php echo wcpa_get_option('recaptcha_secret_key', ''); ?>">
<div class="tooltip">
<img src="<?php echo $asset_url; ?>/img/help-circle.png">
<span class="tooltiptext">If you need to use reCAPTCHA in your forms you have to paste reCAPTCHA Secret Key here. Tick enable option shown at: Products-> Custom Product Addons-> Other Settings after pasting both the keys.
<a href="https://www.google.com/recaptcha/admin" target="_blank"><br>Get reCAPTCHA Secret Key</a>
</span>
</div>
</li>
</ul>
</div>
<div class="options_group textbox_width">
<ul>
<li>
<label for="google_map_api_key" class="title"> <?php
_e('Google Map API Key:', 'wcpa-text-domain');
?></label>
<div>Don't forget to restrict the API key by site domains.</div>
<input type="text" name="google_map_api_key" id="options_total_label" value="<?php echo wcpa_get_option('google_map_api_key', ''); ?>">
<div class="tooltip">
<img src="<?php echo $asset_url; ?>/img/help-circle.png">
<span class="tooltiptext">If you need to use Google Maps in your forms, you have to paste Google Map API Key here.
<a href="https://developers.google.com/maps/documentation/embed/get-api-key" target="_blank"><br>Get Google Map API Key</a>
</span>
</div>
</li>
</ul>
<?php submit_button(null, 'primary', 'wcpa_save_settings'); ?>
</div>
</div>
<div id="wcpa_import_export" class="wcpa_tabcontent" style="display: none">
<div class="options_group">
<p>
<h3><?php _e('This can be used to import single product form', 'wcpa-text-domain'); ?></h3>
</p>
<ul>
<li>
<div>
<label class="import_descript1"><?php _e('Input the exported data here and press <strong>Import From</strong>', 'wcpa-text-domain'); ?></label>
<textarea rows="5" id="wcpa_import_form_data"></textarea>
<?php wp_nonce_field('wcpa_form_import_nonce', 'wcpa_form_import_nonce'); ?>
</div>
<button class="button-secondary" id="wcpa_import_form"><?php
_e('Import Form', 'wcpa-text-domain');
?></button>
</li>
</ul>
<p>
<h3><?php _e('Export All Forms', 'wcpa-text-domain'); ?></h3>
</p>
<ul>
<li>
<div>
<a href="<?php echo admin_url('export.php?download=true&content=' . WCPA_POST_TYPE . '&submit=Download+Export+File'); ?>" class="button-secondary"><?php
_e('Export Form', 'wcpa-text-domain');
?></a>
</div>
</li>
</ul>
<p>
<h3><?php _e('Import All Forms', 'wcpa-text-domain'); ?></h3>
</p>
<div class="import_descript2"><?php _e('You can import the xml file using Wordpress default post import option at <a href="' . admin_url('import.php') . '">Tools&#187;Import</a>', 'wcpa-text-domain'); ?></div>
<?php submit_button(null, 'primary', 'wcpa_save_settings'); ?>
</div>
</div>
<div id="wcpa_license_key" class="wcpa_tabcontent" style="display:none">
<div class="options_group">
<?php
$license = get_option('wcpa_activation_license_key');
$status = get_option('wcpa_activation_license_status');
?>
<form method="post" action="options.php">
<?php settings_fields('wcpa_license'); ?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" valign="top" class="lic_heading">
<?php _e('Plugin License'); ?>
</th>
<th class="lic_heading"><?php _e('Status: '); ?>
<?php if ($status !== false && $status == 'valid') { ?>
<span style="color:green;"><?php _e('Active'); ?></span>
<?php wp_nonce_field('wcpa_deactivate', 'wcpa_nounce'); ?>
<?php } else { ?>
<?php wp_nonce_field('wcpa_activate', 'wcpa_nounce'); ?>
<span style="color:red;"><?php _e('Inactive'); ?></span>
<?php } ?>
</th>
</tr>
<tr>
<td>
<?php _e('License Key'); ?>
<td>
</tr>
<tr>
<td>
<input id="edd_sample_license_key" name="wcpa_activation_license_key" type="text" class="regular-text" value="<?php esc_attr_e($license); ?>" placeholder="Enter your license key here" />
</td>
</tr>
<tr valign="top">
<td>
<?php if ($status !== false && $status == 'valid') { ?>
<?php wp_nonce_field('wcpa_deactivate', 'wcpa_nounce'); ?>
<input type="submit" class="button-secondary" name="wcpa_license_deactivate" value="<?php _e('Deactivate License'); ?>" />
<?php
} else {
?>
<?php wp_nonce_field('wcpa_activate', 'wcpa_nounce'); ?>
<input type="submit" class="button-secondary" name="wcpa_license_activate" value="<?php _e('Activate License'); ?>" />
<?php } ?>
</td>
</tr>
</tbody>
</table>
</form>
<?php submit_button(null, 'primary', 'wcpa_save_settings'); ?>
</div>
</div>
</div>
<!--wcpa_g_set_tabcontents-->
<div style="clear: both">
</div>
</form>
</div>
<!-- .inside -->
<div class="support">
<h3>24x7 Support </h3>
<p>Our support is what makes us No.1. We are available round the clock for any support.</p>
<p><a href="https://acowebs.com/support/">Guidelines</a></p>
<p><a href="https://support.acowebs.com/portal/newticket">Submit a new Ticket</a></p>
<div>
</div>
<!-- .postbox -->
</div>
<!-- .meta-box-sortables .ui-sortable -->
</div>
<!-- post-body-content -->
<!-- #postbox-container-1 .postbox-container -->
</div>
<!-- #post-body .metabox-holder .columns-2 -->
<br class="clear">
</div>
<!-- #poststuff -->
</div> <!-- .wrap -->
</div>
</div>

View File

@@ -0,0 +1,56 @@
<div class="wrap">
<div id="icon-options-general" class="icon32"></div>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<!-- main content -->
<div id="post-body-content">
<div class="meta-box-sortables ui-sortable">
<div class="postbox">
<h2><span><?php esc_attr_e('Custom Product Addons Migration', WCPA_TEXT_DOMAIN); ?></span></h2>
<div class="inside">
<?php
if (isset($response) && $response) {
foreach ($response as $res) {
if ($res['status']) {
echo '<div clas="notice notice-success">';
} else {
echo '<div clas="notice notice-error">';
}
echo $res['message'];
echo '</div>';
}
}
?>
<p>
<?php _e('Found some data from old version of this plugin, You can migrate the old data to compatible with new plugin by clicking the migrate now button below ', WCPA_TEXT_DOMAIN); ?>
</p>
<a href="<?php print wp_nonce_url(admin_url('options-general.php?page=wcpa_settings&view=migration&action=migrate'), 'wcpa_migration', 'wcpa_nonce');
?>" ><input class="button-primary" type="submit" name="Example" value="<?php esc_attr_e('Migrate Now'); ?>" /></a>
</div>
<!-- .inside -->
</div>
<!-- .postbox -->
</div>
<!-- .meta-box-sortables .ui-sortable -->
</div>
<!-- post-body-content -->
</div>
<!-- #post-body .metabox-holder .columns-2 -->
<br class="clear">
</div>
<!-- #poststuff -->
</div> <!-- .wrap -->