/** * function Form, displays the form * @param $atts Array - an associative array of attributes (preferences) * @param $content String - the enclosed content * @param $code String - the shortcode name * @code * @static */ static function form($atts, $content = null, $code = "") { global $dvin_wcql_settings, $dvin_qlist_products; if (!isset($_POST['qlist_process'])) { if (!isset($dvin_qlist_products) || isset($dvin_qlist_products) && count($dvin_qlist_products) == 0) { return; } } if (isset($dvin_wcql_settings['use_gravity_forms']) && $dvin_wcql_settings['use_gravity_forms'] == 'on') { return do_shortcode('[gravityform id="' . $dvin_wcql_settings['gravity_form_select'] . '" title=false description=false ajax="true"]'); } else { if (isset($dvin_wcql_settings['use_formidable_forms']) && $dvin_wcql_settings['use_formidable_forms'] == 'on') { return do_shortcode('[formidable id="' . $dvin_wcql_settings['formidable_form_select'] . '"]'); } else { if (isset($dvin_wcql_settings['use_contactform7']) && $dvin_wcql_settings['use_contactform7'] == 'on') { return do_shortcode('[contact-form-7 id="' . $dvin_wcql_settings['contactform7_form_select'] . '"]'); } else { ob_start(); if (file_exists(TEMPLATEPATH . '/' . Dvin_Wcql::template_path() . 'templates/form.php')) { include TEMPLATEPATH . '/' . Dvin_Wcql::template_path() . 'templates/form.php'; } elseif (file_exists(STYLESHEETPATH . '/' . Dvin_Wcql::template_path() . 'templates/form.php')) { include STYLESHEETPATH . '/' . Dvin_Wcql::template_path() . 'templates/form.php'; } else { echo '<div class="woocommerce">'; include 'templates/form.php'; echo '</div>'; } return ob_get_clean(); } } } }
function dvin_wcql_getlist_frm_session() { global $dvin_qlist_products; //get list from session $dvin_qlist_products = Dvin_Wcql::get_qlist_from_session(); }
public static function add_localisation() { //define constants if not if (!defined('TEMPLATEPATH_QLIST')) { define('TEMPLATEPATH_QLIST', get_template_directory()); } if (!defined('STYLESHEETPATH_QLIST')) { define('STYLESHEETPATH_QLIST', get_stylesheet_directory()); } //include the language file if (file_exists(TEMPLATEPATH_QLIST . '/' . Dvin_Wcql::template_path() . 'languages/')) { $langdir_path = TEMPLATEPATH_QLIST . '/' . Dvin_Wcql::template_path() . 'languages/'; } elseif (file_exists(STYLESHEETPATH_QLIST . '/' . Dvin_Wcql::template_path() . 'languages/')) { $langdir_path = STYLESHEETPATH_QLIST . '/' . Dvin_Wcql::template_path() . 'languages/'; } else { $langdir_path = dirname(plugin_basename(__FILE__)) . '/languages/'; } load_plugin_textdomain('dvinwcql', false, $langdir_path); }
public static function dvin_qlist_validate_form() { global $dvin_qlist_products; $errors = array(); //validate the form if (isset($_POST['req_name']) && trim($_POST['req_name']) == '') { $errors[] = __("Please enter ", 'dvinwcql') . __('Name', 'dvinwcql'); } if (isset($_POST['req_email']) && trim($_POST['req_email']) == '') { $errors[] = __("Please enter ", 'dvinwcql') . __('Email', 'dvinwcql'); } else { if (isset($_POST['req_email'])) { $regex = '/^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{2,63})$/'; // Run the preg_match() function on regex against the email address if (!preg_match($regex, $_POST['req_email'])) { $errors[] = "Please enter valid " . __('Email', 'dvinwcql'); } } } //apply filters for to do validations for the custom fileds $errors = apply_filters('dvin_wcql_custom_fields_validation', $errors); //include the validation file if exists if (file_exists(TEMPLATEPATH . '/' . Dvin_Wcql::template_path() . 'form-validation.php')) { include TEMPLATEPATH . '/' . Dvin_Wcql::template_path() . 'form-validation.php'; } elseif (file_exists(STYLESHEETPATH . '/' . Dvin_Wcql::template_path() . 'form-validation.php')) { include STYLESHEETPATH . '/' . Dvin_Wcql::template_path() . 'form-validation.php'; } return $errors; }
<?php echo $addons_str; //addon info if (isset($dvin_wcql_settings['no_price']) && $dvin_wcql_settings['no_price'] != 'on') { echo apply_filters('woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf('%s × %s', $values['quantity'], $price_in_html) . '</span>'); ?> <?php } } } ?> </li> <p class="buttons"> <a href="<?php echo Dvin_Wcql::get_url(); ?> " class="button wc-forward minicart-button"><?php echo apply_filters('dvin_wcql_viewquotelist', __('View Quote List', 'dvinwcql')); ?> </a> </p> <?php } else { ?> <li class="empty"><?php _e('No products in the list', 'dvinwcql'); ?> </li> <?php }