本文整理汇总了PHP中wpshop_tools::varSanitizer方法的典型用法代码示例。如果您正苦于以下问题:PHP wpshop_tools::varSanitizer方法的具体用法?PHP wpshop_tools::varSanitizer怎么用?PHP wpshop_tools::varSanitizer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpshop_tools
的用法示例。
在下文中一共展示了wpshop_tools::varSanitizer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wps_ajax_close_wps_help_window
/**
* AJAX - Save into current user meta the different help that have to be closed next time the user will be logged in
*/
function wps_ajax_close_wps_help_window()
{
$status = false;
$result = '';
$pointer_id = !empty($_POST['pointer_id']) ? wpshop_tools::varSanitizer($_POST['pointer_id']) : '';
if (!empty($pointer_id)) {
$seen_help_windows = get_user_meta(get_current_user_id(), '_wps_closed_help', true);
$seen_help_windows[$pointer_id] = true;
update_user_meta(get_current_user_id(), '_wps_closed_help', $seen_help_windows);
$status = true;
}
$response = array('status' => $status, 'response' => $result);
wp_die(json_encode($response));
}
示例2: delete_address_in_order_panel
/**
* Delete address in order
*/
function delete_address_in_order_panel()
{
$status = false;
$address_datas = !empty($_POST['address_id']) ? wpshop_tools::varSanitizer($_POST['address_id']) : null;
if (!empty($address_datas)) {
$address_datas = explode('-', $address_datas);
if (!empty($address_datas) && !empty($address_datas[0])) {
wp_delete_post($address_datas[0], true);
delete_post_meta($address_datas[0], '_wpshop_address_attribute_set_id');
delete_post_meta($address_datas[0], '_wpshop_address_metadata');
$status = true;
}
}
echo json_encode(array('status' => $status));
wp_die();
}
示例3: pageTitle
/**
* Define the title of the page
*
* @return string $title The title of the page looking at the environnement
*/
function pageTitle()
{
$action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : '';
$objectInEdition = isset($_REQUEST['id']) ? wpshop_tools::varSanitizer($_REQUEST['id']) : '';
$title = __(self::pageTitle, 'wpshop');
if ($action != '') {
if ($action == 'edit' || $action == 'delete') {
$editedItem = self::getElement($objectInEdition);
$title = sprintf(__(self::pageEditingTitle, 'wpshop'), str_replace("\\", "", $editedItem->frontend_label) . ' (' . $editedItem->code . ')');
} elseif ($action == 'add') {
$title = __(self::pageAddingTitle, 'wpshop');
}
} elseif (self::getEditionSlug() != self::getListingSlug() && $_GET['page'] == self::getEditionSlug()) {
$title = __(self::pageAddingTitle, 'wpshop');
}
return $title;
}
示例4: wpshop_ajax_delete_cart_rule
/** Save the cart rule **/
function wpshop_ajax_delete_cart_rule()
{
$cart_rule_id = !empty($_POST['cart_rule_id']) ? wpshop_tools::varSanitizer($_POST['cart_rule_id']) : null;
$status = false;
$response = array();
$cart_rules = !empty($_POST['cart_rules']) ? $_POST['cart_rules'] : null;
$cart_rule_id = str_replace('_', '.', $cart_rule_id);
if (!empty($cart_rule_id)) {
$cart_rules = unserialize(stripslashes($cart_rules));
unset($cart_rules[$cart_rule_id]);
$cart_rules = serialize($cart_rules);
$status = true;
}
$display_rules = wpshop_cart_rules::display_cart_rules($cart_rules);
$display_rules = wpshop_cart_rules::display_cart_rules($cart_rules);
$reponse = array('status' => $status, 'response' => $cart_rules, 'display_rules' => $display_rules);
echo json_encode($reponse);
die;
}
示例5: ajax_load_element_from_letter
/**
* AJAX - Load element list from choosen letter into alphabet list
*/
function ajax_load_element_from_letter()
{
$response = array('status' => false, 'output' => __('An error occured', 'wps-pos-i18n'));
$alphabet = unserialize(WPSPOS_ALPHABET_LETTERS);
$letter = !empty($_POST['term']) && in_array($_POST['term'], $alphabet) ? $_POST['term'] : null;
$element_type = !empty($_POST['element_type']) ? wpshop_tools::varSanitizer($_POST['element_type']) : 'customer';
$response['element_type'] = $element_type;
if (!empty($letter)) {
$error_message = '';
switch ($element_type) {
case 'customer':
$result = $this->wps_pos_customer->display_customer_list($letter);
break;
case 'product':
$wps_pos_product = new wps_pos_addon_product();
$result = $this->wps_pos_product->get_product_table_by_alphabet($letter);
break;
}
if (empty($result)) {
$response['output'] = sprintf(__('Nothing found in %s for letter %s', 'wps-pos-i18n'), __($element_type, 'wps-pos-i18n'), $letter);
} else {
$response['status'] = true;
$response['output'] = $result;
}
} else {
$response['output'] = sprintf(__('THe requested term (%s) to search is invalid. Please check your request and try again', 'wps-pos-i18n'), $_POST['term']);
}
wp_die(json_encode($response));
}
示例6: display_page
/**
* Return The complete output page code
*
* @return string The complete html page output
*/
public static function display_page()
{
$pageAddButton = false;
$pageMessage = $addButtonLink = $pageFormButton = $pageIcon = $pageIconTitle = $pageIconAlt = $objectType = '';
$outputType = 'listing';
$objectToEdit = isset($_REQUEST['id']) ? wpshop_tools::varSanitizer($_REQUEST['id']) : '';
$pageSlug = isset($_REQUEST['page']) ? wpshop_tools::varSanitizer($_REQUEST['page']) : '';
$action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : '';
/* Select the content to add to the page looking for the parameter */
switch ($pageSlug) {
case WPSHOP_URL_SLUG_ATTRIBUTE_LISTING:
$objectType = new wpshop_attributes();
$current_user_can_edit = current_user_can('wpshop_edit_attributes');
$current_user_can_add = current_user_can('wpshop_add_attributes');
$current_user_can_delete = current_user_can('wpshop_delete_attributes');
if (current_user_can('wpshop_add_attributes')) {
$pageAddButton = true;
}
break;
case WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING:
$objectType = new wpshop_attributes_set();
$current_user_can_edit = current_user_can('wpshop_edit_attribute_set');
$current_user_can_add = current_user_can('wpshop_add_attribute_set');
$current_user_can_delete = current_user_can('wpshop_delete_attribute_set');
if (current_user_can('wpshop_add_attribute_set')) {
$pageAddButton = true;
}
break;
case WPSHOP_URL_SLUG_SHORTCODES:
$pageAddButton = false;
$current_user_can_edit = false;
$objectType = new wps_shortcodes_ctr();
break;
case WPSHOP_URL_SLUG_MESSAGES:
$pageAddButton = false;
$objectType = new wpshop_messages();
$current_user_can_edit = true;
if (!empty($_GET['mid'])) {
$action = 'edit';
}
break;
default:
$pageTitle = sprintf(__('You have to add this page into %s at line %s', 'wpshop'), __FILE__, __LINE__ - 4);
$pageAddButton = false;
break;
}
if ($objectType != '') {
if ($action != '' && ($action == 'edit' && $current_user_can_edit || $action == 'add' && $current_user_can_add || $action == 'delete' && $current_user_can_delete)) {
$outputType = 'adding';
}
$objectType->elementAction();
$pageIcon = self::getPageIconInformation('path', $objectType);
$pageIconTitle = self::getPageIconInformation('title', $objectType);
$pageIconAlt = self::getPageIconInformation('alt', $objectType);
if ($outputType == 'listing') {
$pageContent = $objectType->elementList();
} elseif ($outputType == 'adding') {
$pageAddButton = false;
$pageFormButton = $objectType->getPageFormButton($objectToEdit);
$pageContent = $objectType->elementEdition($objectToEdit);
}
$pageTitle = $objectType->pageTitle();
$pageMessage = $objectType->pageMessage;
if (in_array($objectType->getEditionSlug(), array(WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING))) {
$addButtonLink = admin_url('admin.php?page=' . $objectType->getEditionSlug() . '&action=add');
} else {
$addButtonLink = admin_url('edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES . '&page=' . $objectType->getEditionSlug() . '&action=add');
}
}
/* Page content header */
wpshop_display::displayPageHeader($pageTitle, $pageIcon, $pageIconTitle, $pageIconAlt, $pageAddButton, $addButtonLink, $pageMessage, $pageSlug);
/* Page content */
echo $pageContent;
/* Page content footer */
wpshop_display::displayPageFooter($pageFormButton);
}
示例7: wps_orders_load_details
/**
* AJAX - Load order details in customer account
*/
function wps_orders_load_details()
{
$order_id = !empty($_POST['order_id']) ? wpshop_tools::varSanitizer($_POST['order_id']) : '';
$user_id = get_current_user_id();
$status = false;
$result = '';
if (!empty($order_id)) {
$order = get_post($order_id);
$order_infos = get_post_meta($order_id, '_order_postmeta', true);
$order_key = !empty($order_infos['order_key']) ? $order_infos['order_key'] : '-';
if (!empty($order) && !empty($user_id) && $order->post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER && $order->post_author == $user_id) {
$result = do_shortcode('[wps_cart cart_type="summary" oid="' . $order_id . '"]');
$status = true;
}
}
echo json_encode(array('status' => $status, 'title' => sprintf(__('Order n° %s details', 'wpshop'), $order_key), 'content' => $result));
wp_die();
}
示例8: save_entities_custom_informations
/**
* Save informations for current entity
*/
public static function save_entities_custom_informations($post)
{
global $wpdb;
global $wpshop_account;
$post_id = !empty($_REQUEST['post_ID']) ? intval(wpshop_tools::varSanitizer($_REQUEST['post_ID'])) : null;
if (!empty($post_id) && empty($_POST['edit_other_thing']) || !empty($_REQUEST['post_ID']) && !(bool) $_POST['edit_other_thing'] && get_post_type($_REQUEST['post_ID']) != WPSHOP_NEWTYPE_IDENTIFIER_ORDER) {
$current_post_type = get_post_type($post_id);
/* Vérification de l'existence de l'envoi de l'identifiant du set d'attribut */
if (!empty($_REQUEST[$current_post_type . '_attribute_set_id'])) {
$attribute_set_id = intval(wpshop_tools::varSanitizer($_REQUEST[$current_post_type . '_attribute_set_id']));
$attribet_set_infos = wpshop_attributes_set::getElement($attribute_set_id, "'valid'", 'id');
if ($attribet_set_infos->entity == $_REQUEST['post_type']) {
/* Enregistrement de l'identifiant du set d'attribut associé à l'entité */
update_post_meta($post_id, sprintf(WPSHOP_ATTRIBUTE_SET_ID_META_KEY, $current_post_type), $attribute_set_id);
/* Enregistrement de tous les attributs */
if (!empty($_REQUEST[$current_post_type . '_attribute'])) {
/* Traduction des virgule en point pour la base de donnees */
if (!empty($_REQUEST[$current_post_type . '_attribute']['decimal'])) {
foreach ($_REQUEST[$current_post_type . '_attribute']['decimal'] as $attributeName => $attributeValue) {
if (!is_array($attributeValue)) {
$_REQUEST[$current_post_type . '_attribute']['decimal'][$attributeName] = str_replace(',', '.', $_REQUEST[$current_post_type . '_attribute']['decimal'][$attributeName]);
}
}
}
/* Enregistrement des valeurs des différents attributs */
wpshop_attributes::saveAttributeForEntity($_REQUEST[$current_post_type . '_attribute'], wpshop_entities::get_entity_identifier_from_code($current_post_type), $post_id, WPSHOP_CURRENT_LOCALE);
/* Enregistrement des valeurs des attributs dans les metas de l'entité => Permet de profiter de la recherche native de wordpress */
$productMetaDatas = array();
foreach ($_REQUEST[$current_post_type . '_attribute'] as $attributeType => $attributeValues) {
foreach ($attributeValues as $attributeCode => $attributeValue) {
$productMetaDatas[$attributeCode] = $attributeValue;
}
}
update_post_meta($_REQUEST['post_ID'], WPSHOP_PRODUCT_ATTRIBUTE_META_KEY, $productMetaDatas);
}
}
}
if (!empty($_REQUEST['attribute'])) {
$current_id = array();
foreach ($_REQUEST['attribute'] as $key => $values) {
$ad_id = '';
$addresses_id = get_post_meta($_REQUEST['post_ID'], '_wpshop_attached_address', true);
if (!empty($addresses_id)) {
foreach ($addresses_id as $address_id) {
$address_type = get_post_meta($address_id, '_wpshop_address_attribute_set_id', true);
if ($address_type == $key) {
$ad_id = $address_id;
}
}
}
$_REQUEST['item_id'] = $ad_id;
$result = wps_address::save_address_infos($key);
$current_id[] = $result['current_id'];
}
update_post_meta($_REQUEST['post_ID'], '_wpshop_attached_address', $current_id);
} else {
$current_id = array();
if (!empty($_REQUEST['address_type'])) {
foreach ($_REQUEST['address_type'] as $key => $value) {
$current_id[] = $value;
}
}
update_post_meta($_REQUEST['post_ID'], '_wpshop_entity_attached_address', $current_id);
}
}
/** Save price infos **/
if (!empty($_REQUEST) && !empty($_REQUEST['post_ID']) && !empty($_REQUEST['post_type']) && $_REQUEST['post_type'] == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) {
}
flush_rewrite_rules();
}
示例9: category_edit_fields
/**
* Add additionnal fields to the category edition form
*/
public static function category_edit_fields()
{
$category_id = wpshop_tools::varSanitizer($_REQUEST["tag_ID"]);
$category_meta_information = get_option(WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES . '_' . $category_id);
$tpl_component = array();
$category_thumbnail_preview = '<img src="' . WPSHOP_DEFAULT_CATEGORY_PICTURE . '" alt="No picture" class="category_thumbnail_preview" />';
/* Check if there is already a picture for the selected category */
if (!empty($category_meta_information['wpshop_category_picture'])) {
$image_post = wp_get_attachment_image($category_meta_information['wpshop_category_picture'], 'thumbnail', false, array('class' => 'category_thumbnail_preview'));
$category_thumbnail_preview = !empty($image_post) ? $image_post : '<img src="' . WPSHOP_DEFAULT_CATEGORY_PICTURE . '" alt="No picture" class="category_thumbnail_preview" />';
}
$tpl_component['CATEGORY_DELETE_PICTURE_BUTTON'] = '';
if (!empty($category_meta_information) && !empty($category_meta_information['wpshop_category_picture'])) {
$tpl_component['CATEGORY_DELETE_PICTURE_BUTTON'] = '<a href="#" role="button" id="wps-delete-category-picture" class="wps-bton-second-mini-rounded">' . __('Delete the category picture', 'wpshop') . '</a> ';
}
$tpl_component['CATEGORY_PICTURE_ID'] = !empty($category_meta_information['wpshop_category_picture']) ? $category_meta_information['wpshop_category_picture'] : '';
$tpl_component['CATEGORY_THUMBNAIL_PREVIEW'] = $category_thumbnail_preview;
if (isset($_GET['tag_ID'])) {
$tpl_component['CATEGORY_TAG_ID'] = $_GET['tag_ID'];
$tpl_component['CATEGORY_FILTERABLE_ATTRIBUTES'] = '';
$wpshop_category_products = wpshop_categories::get_product_of_category($_GET['tag_ID']);
$filterable_attributes_list = array();
foreach ($wpshop_category_products as $wpshop_category_product) {
$elementId = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT);
if (!empty($elementId)) {
$product_attributes = wpshop_attributes::get_attribute_list_for_item($elementId, $wpshop_category_product);
if (!empty($product_attributes)) {
foreach ($product_attributes as $key => $product_attribute) {
if (!empty($product_attribute) && !empty($product_attribute->is_filterable) && strtolower(__($product_attribute->is_filterable, 'wpshop')) == strtolower(__('Yes', 'wpshop'))) {
if (!array_key_exists($product_attribute->attribute_id, $filterable_attributes_list)) {
$filterable_attributes_list[$product_attribute->attribute_id] = $product_attribute;
$sub_tpl_component['CATEGORY_FILTERABLE_ATTRIBUTE_ID'] = $product_attribute->attribute_id;
$sub_tpl_component['CATEGORY_FILTERABLE_ATTRIBUTE_NAME'] = __($product_attribute->frontend_label, 'wpshop');
if (!empty($category_meta_information) && !empty($category_meta_information['wpshop_category_filterable_attributes']) && array_key_exists($product_attribute->attribute_id, $category_meta_information['wpshop_category_filterable_attributes'])) {
$sub_tpl_component['CATEGORY_FILTERABLE_ATTRIBUTE_CHECKED'] = 'checked="checked"';
} else {
$sub_tpl_component['CATEGORY_FILTERABLE_ATTRIBUTE_CHECKED'] = '';
}
$tpl_component['CATEGORY_FILTERABLE_ATTRIBUTES'] .= wpshop_display::display_template_element('wpshop_category_filterable_attribute_element', $sub_tpl_component, array(), 'admin');
unset($sub_tpl_component);
}
}
}
}
}
}
} else {
$tpl_component['CATEGORY_TAG_ID'] = 1;
}
$output = wpshop_display::display_template_element('wpshop_category_edit_interface_admin', $tpl_component, array(), 'admin');
echo $output;
}
示例10: unit_group_edition
/**
* Return the page content to add a new item
*
* @return string The html code that output the interface for adding a nem item
*/
function unit_group_edition($itemToEdit = '')
{
global $attribute_displayed_field;
$dbFieldList = wpshop_database::fields_to_input(WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP);
$editedItem = '';
$_REQUEST['action'] = 'save_new_attribute_unit_group';
if ($itemToEdit != '') {
$editedItem = self::get_unit_group($itemToEdit);
$_REQUEST['action'] = 'update_attribute_unit_group';
}
$the_form_content_hidden = $the_form_general_content = $the_form_option_content = '';
foreach ($dbFieldList as $input_key => $input_def) {
$pageAction = isset($_REQUEST[WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP . '_action']) ? wpshop_tools::varSanitizer($_REQUEST[WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP . '_action']) : '';
$requestFormValue = isset($_REQUEST[self::currentPageCode][$input_def['name']]) ? wpshop_tools::varSanitizer($_REQUEST[self::currentPageCode][$input_def['name']]) : '';
$currentFieldValue = $input_def['value'];
if (is_object($editedItem)) {
$currentFieldValue = $editedItem->{$input_def}['name'];
} elseif ($pageAction != '' && $requestFormValue != '') {
$currentFieldValue = $requestFormValue;
}
$input_def['value'] = $currentFieldValue;
$input_def['value'] = __(str_replace("\\", "", $input_def['value']), 'wpshop');
$the_input = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP);
if ($input_def['type'] != 'hidden') {
$label = 'for="' . $input_def['name'] . '"';
if ($input_def['type'] == 'radio' || $input_def['type'] == 'checkbox') {
$label = '';
}
$input = '
<div class="wpshop_cls" >
<div class="wpshop_form_label wpshop_' . self::currentPageCode . '_' . $input_def['name'] . '_label alignleft" >
<label ' . $label . ' >' . __($input_def['name'], 'wpshop') . '</label>
</div>
<div class="wpshop_form_input wpshop_' . self::currentPageCode . '_' . $input_def['name'] . '_input alignleft" >
' . $the_input . '
</div>
</div>';
if (substr($input_def['name'], 0, 3) == 'is_') {
$the_form_option_content .= $input;
} else {
$the_form_general_content .= $input;
}
} else {
$the_form_content_hidden .= '
' . $the_input;
}
}
$the_form = '
<form name="' . WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP . '_form" id="' . WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP . '_form" method="post" action="' . WPSHOP_AJAX_FILE_URL . '" >
' . wpshop_form::form_input('action', 'action', $_REQUEST['action'], 'hidden') . '
' . wpshop_form::form_input('post', 'post', 'true', 'hidden') . '
' . wpshop_form::form_input('elementCode', 'elementCode', 'attribute_unit_management', 'hidden') . '
' . wpshop_form::form_input(self::currentPageCode . '_form_has_modification', self::currentPageCode . '_form_has_modification', 'no', 'hidden') . '
' . $the_form_content_hidden . '' . $the_form_general_content . '
<input type="button" value="' . __('Retour', 'wpshop') . '" class="button-primary alignright" name="cancel_unit_group_edition" id="cancel_unit_group_edition" />
<input type="submit" value="' . __('Save', 'wpshop') . '" class="button-primary alignright" name="save_new_unit_group" id="save_new_unit_group" />
</form>
<script type="text/javascript" >
wpshop(document).ready(function(){
wpshopMainInterface("' . WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP . '", "' . __('Are you sure you want to quit this page? You will loose all current modification', 'wpshop') . '", "' . __('Are you sure you want to delete this unit group?', 'wpshop') . '");
jQuery("#wpshop_unit_list_tab").hide();
jQuery("#cancel_unit_group_edition").click(function(){
jQuery("#wpshop_unit_group_list").load(WPSHOP_AJAX_FILE_URL, {
"post": "true",
"elementCode": "attribute_unit_management",
"action": "load_attribute_unit_groups"
});
});
jQuery("#' . WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP . '_form").ajaxForm({
target: "#wpshop_unit_group_list"
});
});
</script>';
return $the_form;
}
示例11: wps_checkout_valid_step_five
/**
* AJAX - Valid Checkout step four
*/
function wps_checkout_valid_step_five()
{
$status = false;
$response = '';
$payment_method = !empty($_POST['wps-payment-method']) ? wpshop_tools::varSanitizer($_POST['wps-payment-method']) : null;
$order_id = !empty($_SESSION['cart']['order_id']) ? wpshop_tools::varSanitizer($_SESSION['cart']['order_id']) : 0;
$customer_comment = !empty($_POST['wps-customer-comment']) ? wpshop_tools::varSanitizer($_POST['wps-customer-comment']) : null;
$terms_of_sale_checking = isset($_POST['terms_of_sale_indicator']) && !empty($_POST['terms_of_sale']) || !empty($_POST['terms_of_sale']) || !isset($_POST['terms_of_sale_indicator']) && empty($_POST['terms_of_sale']) ? true : false;
if ($terms_of_sale_checking) {
if (!empty($payment_method)) {
/** Check if the payment method exist for the shop **/
$payment_option = get_option('wps_payment_mode');
if (!empty($payment_option) && !empty($payment_option['mode']) && array_key_exists($payment_method, $payment_option['mode']) && !empty($payment_option['mode'][$payment_method]['active'])) {
$order_id = wpshop_checkout::process_checkout($payment_method, $order_id, get_current_user_id(), $_SESSION['billing_address'], $_SESSION['shipping_address']);
if (!empty($order_id) && !empty($customer_comment)) {
wp_update_post(array('ID' => $order_id, 'post_excerpt' => $customer_comment));
}
$permalink_option = get_option('permalink_structure');
$checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
$response = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=6';
$_SESSION['payment_method'] = $payment_method;
$status = true;
//Add an action to extra actions on order save
$args = array('order_id' => $order_id, 'posted_data' => $_REQUEST);
wpshop_tools::create_custom_hook('wps_order_extra_save_action', $args);
} else {
$response = '<div class="wps-alert-error">' . __('This payment method is unavailable', 'wpshop') . '</div>';
}
} else {
$response = '<div class="wps-alert-error">' . __('You must choose a payment method', 'wpshop') . '</div>';
}
} else {
$response = '<div class="wps-alert-error">' . __('You must accept the terms of sale to order', 'wpshop') . '</div>';
}
echo json_encode(array('status' => $status, 'response' => $response));
die;
}
示例12: ajax_pos_check_product_type
/**
* AJAX - Vérifie si le produit sur le point d'être ajouté à la commande est un produit simple ou un produit composé / Check if the selected produt is a simple one or a combined one
*/
function ajax_pos_check_product_type()
{
$product_type = 'simple';
$product_id = !empty($_POST['product_id']) ? wpshop_tools::varSanitizer($_POST['product_id']) : null;
if (!empty($product_id)) {
$product_post_meta = get_post_meta($product_id, '_wpshop_variation_defining', true);
if (!empty($product_post_meta)) {
$product_type = 'variations';
}
}
wp_die(json_encode(array('product_type' => $product_type)));
}
示例13: wps_calculate_shipping_cost
/**
* AJAX - Calculate Shipping cost
*/
function wps_calculate_shipping_cost()
{
$status = false;
$result = '';
$chosen_method = !empty($_POST['chosen_method']) ? wpshop_tools::varSanitizer($_POST['chosen_method']) : null;
if (!empty($chosen_method)) {
$_SESSION['shipping_method'] = $chosen_method;
$wps_cart = new wps_cart();
$order = $wps_cart->calcul_cart_information(array());
$wps_cart->store_cart_in_session($order);
$status = true;
}
$response = array('status' => $status);
echo json_encode($response);
die;
}
示例14: header
<?php
/* Wordpress - Main bootstrap file that load wordpress basic files */
require_once '../../../../../wp-load.php';
header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
$content = $content_explanation = '';
$type = isset($_GET['type']) ? wpshop_tools::varSanitizer($_GET['type']) : null;
$post_type = isset($_GET['post_type']) ? wpshop_tools::varSanitizer($_GET['post_type']) : null;
$display_option_display_type = true;
$display_option_grouped = true;
$display_search_form = true;
if (!empty($type)) {
switch ($type) {
case 'attribute_value':
$display_option_grouped = false;
$display_search_form = false;
$display_option_grouped = false;
$wpshop_wysiwyg_shortcode_inserter_shortcode_main_identifier = 'wpshop_att_val attid';
$content = wpshop_attributes::get_attribute_list(null, $type, $post_type);
break;
case 'categories':
$content = wpshop_categories::product_list_cats(true);
$wpshop_wysiwyg_shortcode_inserter_shortcode_main_identifier = 'wpshop_category cid';
ob_start();
?>
<p><?php
_e('Shortcode options', 'wpshop');
?>
</p>
<div id="wpshop_wysiwyg_shortcode_categorie_options_container" >
<input type="checkbox" name="wpshop_wysiwyg_shortcode_options[]" id="wpshop_wysiwyg_shortcode_options_categorie_display_product" class="wpshop_wysiwyg_shortcode_options wpshop_wysiwyg_shortcode_options_categories_display_product" value="only_cat" checked ><label for="wpshop_wysiwyg_shortcode_options_categorie_display_product" > <?php
示例15: DEFINE
<?php
/* Wordpress - Ajax functionnality activation */
DEFINE('DOING_AJAX', true);
/* Wordpress - Main bootstrap file that load wordpress basic files */
require_once '../../../../wp-load.php';
/* Wordpress - Admin page that define some needed vars and include file */
require_once ABSPATH . 'wp-admin/includes/admin.php';
$order_id = !empty($_GET['order_id']) ? wpshop_tools::varSanitizer($_GET['order_id']) : null;
$invoice_ref = !empty($_GET['invoice_ref']) ? wpshop_tools::varSanitizer($_GET['invoice_ref']) : null;
$mode = !empty($_GET['mode']) ? wpshop_tools::varSanitizer($_GET['mode']) : 'html';
$is_credit_slip = !empty($_GET['credit_slip']) ? wpshop_tools::varSanitizer($_GET['credit_slip']) : null;
$user_id = get_current_user_id();
if (!empty($order_id) && $user_id != 0) {
/** Order reading */
$order_postmeta = get_post_meta($order_id, '_order_postmeta', true);
/** Start invoice display */
if (!empty($is_credit_slip)) {
$html_content = wpshop_modules_billing::generate_html_invoice($order_id, $invoice_ref, 'credit_slip');
} else {
$html_content = wpshop_modules_billing::generate_html_invoice($order_id, $invoice_ref);
}
if ($mode == 'pdf') {
require_once WPSHOP_LIBRAIRIES_DIR . 'HTML2PDF/html2pdf.class.php';
try {
//$html_content = wpshop_display::display_template_element('invoice_print_page_content_css', array(), array(), 'common') . '<page>' . $html_content . '</page>';
$html_content = wpshop_display::display_template_element('invoice_page_content_css', array(), array(), 'common') . '<page>' . $html_content . '</page>';
$html2pdf = new HTML2PDF('P', 'A4', 'fr');
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($html_content);
$html2pdf->Output('order_' . $order_id . '.pdf', 'D');