当前位置: 首页>>代码示例>>PHP>>正文


PHP wpshop_tools::wpshop_safe_redirect方法代码示例

本文整理汇总了PHP中wpshop_tools::wpshop_safe_redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP wpshop_tools::wpshop_safe_redirect方法的具体用法?PHP wpshop_tools::wpshop_safe_redirect怎么用?PHP wpshop_tools::wpshop_safe_redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wpshop_tools的用法示例。


在下文中一共展示了wpshop_tools::wpshop_safe_redirect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: direct_payment_link

 public static function direct_payment_link($token, $order_id, $login)
 {
     global $wpdb;
     if (!empty($token) && !empty($order_id) && !empty($login)) {
         /** Verify informations **/
         $query = $wpdb->prepare('SELECT * FROM ' . $wpdb->users . ' WHERE user_login = %s AND user_activation_key = %s', $login, $token);
         $user_infos = $wpdb->get_row($query);
         if (!empty($user_infos)) {
             /** Connect the user **/
             $secure_cookie = is_ssl() ? true : false;
             wp_set_auth_cookie($user_infos->ID, true, $secure_cookie);
             /** Add order to SESSION **/
             $order_meta = get_post_meta($order_id, '_order_postmeta', true);
             $_SESSION['cart'] = array();
             $_SESSION['cart']['order_items'] = array();
             if (!empty($order_meta) && !empty($order_meta['order_items'])) {
                 $wpshop_cart_type = 'cart';
                 foreach ($order_meta['order_items'] as $item) {
                     $_SESSION['cart']['order_items'][$item['item_id']] = $item;
                 }
                 $wps_cart_ctr = new wps_cart();
                 $order = $wps_cart_ctr->calcul_cart_information(array());
                 $wps_cart_ctr->store_cart_in_session($order);
             }
             $_SESSION['order_id'] = $order_id;
             $wpdb->update($wpdb->users, array('user_activation_key' => ''), array('user_login' => $login));
             wpshop_tools::wpshop_safe_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'))));
         } else {
             wpshop_tools::wpshop_safe_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))));
         }
     }
 }
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:32,代码来源:checkout.class.php

示例2: elementAction

 /**
  *	Define the different message and action after an action is send through the element interface
  */
 function elementAction()
 {
     global $wpdb, $initialEavData;
     $pageMessage = $actionResult = '';
     $attribute_undeletable = unserialize(WPSHOP_ATTRIBUTE_UNDELETABLE);
     /*	Start definition of output message when action is doing on another page	*/
     /************		CHANGE THE FIELD NAME TO TAKE TO DISPLAY				*************/
     /****************************************************************************/
     $action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : 'add';
     $saveditem = isset($_REQUEST['saveditem']) ? wpshop_tools::varSanitizer($_REQUEST['saveditem']) : '';
     $set_section = !empty($_REQUEST[self::getDbTable()]['set_section']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable()]['set_section']) : '';
     if (!empty($_REQUEST[self::getDbTable()]['set_section'])) {
         unset($_REQUEST[self::getDbTable()]['set_section']);
     }
     if (!empty($action) && $action == 'activate' && !empty($_REQUEST['id'])) {
         $query = $wpdb->update(self::getDbTable(), array('status' => 'moderated'), array('id' => $_REQUEST['id']));
         wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $_REQUEST['id']));
     }
     if ($action != '' && $action == 'saveok' && $saveditem > 0) {
         $editedElement = self::getElement($saveditem);
         $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully saved', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>');
     } elseif ($action != '' && $action == 'deleteok' && $saveditem > 0) {
         $editedElement = self::getElement($saveditem, "'deleted'");
         $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully deleted', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>');
     }
     $wpshop_attribute_combo_values_list_order_def = !empty($_REQUEST[self::getDbTable()]['wpshop_attribute_combo_values_list_order_def']) ? $_REQUEST[self::getDbTable()]['wpshop_attribute_combo_values_list_order_def'] : array();
     unset($_REQUEST[self::getDbTable()]['wpshop_attribute_combo_values_list_order_def']);
     if (!isset($_REQUEST[self::getDbTable()]['status'])) {
         $_REQUEST[self::getDbTable()]['status'] = 'moderated';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_historisable'])) {
         $_REQUEST[self::getDbTable()]['is_historisable'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_required'])) {
         $_REQUEST[self::getDbTable()]['is_required'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_used_in_admin_listing_column'])) {
         $_REQUEST[self::getDbTable()]['is_used_in_admin_listing_column'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_used_in_quick_add_form'])) {
         $_REQUEST[self::getDbTable()]['is_used_in_quick_add_form'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_intrinsic'])) {
         $_REQUEST[self::getDbTable()]['is_intrinsic'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_requiring_unit'])) {
         $_REQUEST[self::getDbTable()]['is_requiring_unit'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_visible_in_front'])) {
         $_REQUEST[self::getDbTable()]['is_visible_in_front'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_visible_in_front_listing'])) {
         $_REQUEST[self::getDbTable()]['is_visible_in_front_listing'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_used_for_sort_by'])) {
         $_REQUEST[self::getDbTable()]['is_used_for_sort_by'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_visible_in_advanced_search'])) {
         $_REQUEST[self::getDbTable()]['is_visible_in_advanced_search'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_searchable'])) {
         $_REQUEST[self::getDbTable()]['is_searchable'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_used_for_variation'])) {
         $_REQUEST[self::getDbTable()]['is_used_for_variation'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_used_in_variation'])) {
         $_REQUEST[self::getDbTable()]['is_used_in_variation'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['is_user_defined'])) {
         $_REQUEST[self::getDbTable()]['is_user_defined'] = 'no';
     }
     if (!isset($_REQUEST[self::getDbTable()]['_display_informations_about_value'])) {
         $_REQUEST[self::getDbTable()]['_display_informations_about_value'] = 'no';
     }
     /*	Check frontend input and data type	*/
     if (!empty($_REQUEST[self::getDbTable()]['frontend_input'])) {
         switch ($_REQUEST[self::getDbTable()]['frontend_input']) {
             case 'short_text':
                 $_REQUEST[self::getDbTable()]['frontend_input'] = 'text';
                 if (empty($_REQUEST[self::getDbTable()]['backend_input'])) {
                     $_REQUEST[self::getDbTable()]['backend_input'] = 'text';
                 }
                 $_REQUEST[self::getDbTable()]['data_type'] = 'varchar';
                 break;
             case 'date_field':
                 $_REQUEST[self::getDbTable()]['frontend_input'] = 'text';
                 if (empty($_REQUEST[self::getDbTable()]['backend_input'])) {
                     $_REQUEST[self::getDbTable()]['backend_input'] = 'text';
                 }
                 $_REQUEST[self::getDbTable()]['data_type'] = 'datetime';
                 break;
             case 'float_field':
                 $_REQUEST[self::getDbTable()]['frontend_input'] = 'text';
                 if (empty($_REQUEST[self::getDbTable()]['backend_input'])) {
                     $_REQUEST[self::getDbTable()]['backend_input'] = 'text';
                 }
//.........这里部分代码省略.........
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:101,代码来源:attributes.class.php

示例3: display_page

    /**
     * Affiche la page des groupes
     */
    public static function display_page()
    {
        self::manage_post();
        ob_start();
        wpshop_display::displayPageHeader(__('Groups', 'wpshop'), '', __('Groups', 'wpshop'), __('Groups', 'wpshop'), true, 'admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP . '&action=add', '');
        $content = ob_get_contents();
        ob_end_clean();
        $wps_customer_mdl = new wps_customer_mdl();
        // Si on re�oit une action
        if (!empty($_GET['action'])) {
            $readonly_name_field = '';
            switch ($_GET['action']) {
                case 'delete':
                    if (!empty($_GET['code'])) {
                        $roles = get_option('wp_user_roles', array());
                        if (isset($roles[$_GET['code']]) && $_GET['code'] != 'customer' && $_GET['code'] != 'wpshop_customer') {
                            unset($roles[$_GET['code']]);
                            $this->unaffectUsersToGroup($_GET['code']);
                            update_option('wp_user_roles', $roles);
                        }
                    }
                    wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP));
                    break;
                case 'edit':
                    $readonly_name_field = 'readonly';
                    if (!empty($_GET['code'])) {
                        $role = $this->getRole($_GET['code']);
                        if (!empty($role)) {
                            $group_name = $role['name'];
                            $group_description = $role['description'];
                            $group_parent = $role['parent'];
                            $submit_button_value = __('Edit the group', 'wpshop');
                            $submit_button_name = 'editrole';
                            // ROLES
                            $roles = get_option('wp_user_roles', array());
                            $select_parent = '<option value="">--</option>';
                            foreach ($roles as $code => $role) {
                                if ($code != $_GET['code']) {
                                    $selected = $group_parent == $code ? 'selected' : '';
                                    $select_parent .= '<option value="' . $code . '" ' . $selected . '>' . $role['name'] . '</option>';
                                }
                            }
                            // USERS
                            $users = $wps_customer_mdl->getUserList();
                            if (!empty($users)) {
                                $select_users = '';
                                foreach ($users as $user) {
                                    if ($user->ID != 1) {
                                        $u = new WP_User($user->ID);
                                        $selected = isset($u->roles[0]) && $u->roles[0] == $_GET['code'] ? 'selected' : '';
                                        $select_users .= '<option value="' . $user->ID . '" ' . $selected . '>' . $user->user_login . '</option>';
                                    }
                                }
                            }
                        } else {
                            wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP));
                            exit;
                        }
                    } else {
                        wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP));
                        exit;
                    }
                    break;
                case 'add':
                    $group_name = $group_description = '';
                    $submit_button_value = __('Create the group', 'wpshop');
                    $submit_button_name = 'addrole';
                    // ROLES
                    $roles = get_option('wp_user_roles', array());
                    $select_parent = '<option value="">--</option>';
                    foreach ($roles as $code => $role) {
                        $select_parent .= '<option value="' . $code . '">' . $role['name'] . '</option>';
                    }
                    // USERS
                    $users = $wps_customer_mdl->getUserList();
                    $select_users = '';
                    if (!empty($users)) {
                        foreach ($users as $user) {
                            if ($user->ID != 1) {
                                $select_users .= '<option value="' . $user->ID . '">' . $user->user_login . '</option>';
                            }
                        }
                    }
                    break;
            }
            $content .= '
				<form method="post">
					<label>' . __('Name', 'wpshop') . '</label><br /><input type="text" name="group-name" style="width:500px;" value="' . $group_name . '" ' . $readonly_name_field . ' /><br /><br />

					<label>' . __('Parent', 'wpshop') . '</label><br />
					<select name="group-parent" class="chosen_select" style="width:500px;">
						' . $select_parent . '
					</select><br /><br />

					<label>' . __('Users', 'wpshop') . '</label><br />
					<select name="group-users[]" class="chosen_select" multiple style="width:500px;">
						' . $select_users . '
//.........这里部分代码省略.........
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:101,代码来源:wps_customer_group.php

示例4: forceDownload

 /** Force le t�l�chargement d'un fichier */
 function forceDownload($nom, $path, $poids)
 {
     /*header('Content-Type: application/pdf');
     		header('Content-Length: '. $poids);
     		header('Content-disposition: attachment; filename='. $nom);
     		header('Pragma: no-cache');
     		header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
     		header('Expires: 0');
     		ob_clean();
     		flush();*/
     wpshop_tools::wpshop_safe_redirect(str_replace(WP_CONTENT_DIR, WP_CONTENT_URL, $path));
     //readfile($path);
     exit;
 }
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:15,代码来源:fpdf_extends.class.php

示例5: elementAction

 /**
  *	Define the different message and action after an action is send through the element interface
  */
 function elementAction()
 {
     global $wpdb, $initialEavData;
     $pageMessage = $actionResult = '';
     /*	Start definition of output message when action is doing on another page	*/
     /************		CHANGE THE FIELD NAME TO TAKE TO DISPLAY				*************/
     /****************************************************************************/
     $action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : 'add';
     $saveditem = isset($_REQUEST['saveditem']) ? wpshop_tools::varSanitizer($_REQUEST['saveditem']) : '';
     if ($action != '' && $action == 'saveok' && $saveditem > 0) {
         $editedElement = self::getElement($saveditem);
         $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully saved', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>');
     } elseif ($action != '' && $action == 'deleteok' && $saveditem > 0) {
         $editedElement = self::getElement($saveditem, "'deleted'");
         $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully deleted', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>');
     }
     /*	Define the database operation type from action launched by the user	 */
     $_REQUEST[self::getDbTable()]['default_value'] = str_replace('"', "'", $_REQUEST[self::getDbTable()]['default_value']);
     /*************************		GENERIC				**************************/
     /*************************************************************************/
     $pageAction = isset($_REQUEST[self::getDbTable() . '_action']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable() . '_action']) : '';
     $id = isset($_REQUEST[self::getDbTable()]['id']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable()]['id']) : '';
     if ($pageAction != '' && ($pageAction == 'edit' || $pageAction == 'editandcontinue')) {
         if (current_user_can('wpshop_edit_attributes')) {
             $_REQUEST[self::getDbTable()]['last_update_date'] = date('Y-m-d H:i:s');
             if ($pageAction == 'delete') {
                 if (current_user_can('wpshop_delete_attributes')) {
                     $_REQUEST[self::getDbTable()]['status'] = 'deleted';
                 } else {
                     $actionResult = 'userNotAllowedForActionDelete';
                 }
             }
             $actionResult = wpshop_database::update($_REQUEST[self::getDbTable()], $id, self::getDbTable());
         } else {
             $actionResult = 'userNotAllowedForActionEdit';
         }
     } elseif ($pageAction != '' && $pageAction == 'delete') {
         if (current_user_can('wpshop_delete_attributes')) {
             $_REQUEST[self::getDbTable()]['last_update_date'] = date('Y-m-d H:i:s');
             $_REQUEST[self::getDbTable()]['status'] = 'deleted';
             $actionResult = wpshop_database::update($_REQUEST[self::getDbTable()], $id, self::getDbTable());
         } else {
             $actionResult = 'userNotAllowedForActionDelete';
         }
     } elseif ($pageAction != '' && ($pageAction == 'save' || $pageAction == 'saveandcontinue' || $pageAction == 'add')) {
         if (current_user_can('wpshop_add_attributes')) {
             $_REQUEST[self::getDbTable()]['creation_date'] = date('Y-m-d H:i:s');
             if (trim($_REQUEST[self::getDbTable()]['code']) == '') {
                 $_REQUEST[self::getDbTable()]['code'] = $_REQUEST[self::getDbTable()]['frontend_label'];
             }
             $_REQUEST[self::getDbTable()]['code'] = wpshop_tools::slugify(str_replace("\\'", "_", str_replace('\\"', "_", $_REQUEST[self::getDbTable()]['code'])), array('noAccent', 'noSpaces', 'lowerCase', 'noPunctuation'));
             $code_exists = self::getElement($_REQUEST[self::getDbTable()]['code'], "'valid', 'moderated', 'deleted'", 'code');
             if ((is_object($code_exists) || is_array($code_exists)) && count($code_exists) > 0) {
                 $_REQUEST[self::getDbTable()]['code'] = $_REQUEST[self::getDbTable()]['code'] . '_' . (count($code_exists) + 1);
             }
             $actionResult = wpshop_database::save($_REQUEST[self::getDbTable()], self::getDbTable());
             $id = $wpdb->insert_id;
         } else {
             $actionResult = 'userNotAllowedForActionAdd';
         }
     }
     /*	When an action is launched and there is a result message	*/
     /************		CHANGE THE FIELD NAME TO TAKE TO DISPLAY				*************/
     /************		CHANGE ERROR MESSAGE FOR SPECIFIC CASE					*************/
     /****************************************************************************/
     if ($actionResult != '') {
         $elementIdentifierForMessage = '<span class="bold" >' . $_REQUEST[self::getDbTable()]['frontend_label'] . '</span>';
         if ($actionResult == 'error') {
             $pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . sprintf(__('An error occured while saving %s', 'wpshop'), $elementIdentifierForMessage);
             if (WPSHOP_DEBUG_MODE) {
                 $pageMessage .= '<br/>' . $wpdb->last_error;
             }
         } elseif ($actionResult == 'done' || $actionResult == 'nothingToUpdate') {
             /*	CHANGE HERE FOR SPECIFIC CASE	*/
             /*****************************************************************************************************************/
             /*************************			CHANGE FOR SPECIFIC ACTION FOR CURRENT ELEMENT				******************/
             /*****************************************************************************************************************/
             /***********************************************************************************/
             /*************************			GENERIC				****************************/
             /***********************************************************************************/
             $pageMessage .= '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully saved', 'wpshop'), $elementIdentifierForMessage);
             if ($pageAction == 'edit' || $pageAction == 'save') {
                 wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=saveok&saveditem=" . $id));
             } elseif ($pageAction == 'add') {
                 wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id));
             } elseif ($pageAction == 'delete') {
                 wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=deleteok&saveditem=" . $id));
             }
         } elseif ($actionResult == 'userNotAllowedForActionEdit' || $actionResult == 'userNotAllowedForActionAdd' || $actionResult == 'userNotAllowedForActionDelete') {
             $pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('You are not allowed to do this action', 'wpshop');
         }
     }
     self::setMessage($pageMessage);
 }
开发者ID:pronoSoupe,项目名称:pronobo_soupe,代码行数:97,代码来源:attributes_unit.class.php

示例6: show_classic_checkout

 /**
  * Display Classic Checkout
  */
 function show_classic_checkout()
 {
     if (!empty($_GET['action']) && $_GET['action'] == 'direct_payment_link') {
         wpshop_checkout::direct_payment_link($_GET['token'], $_GET['order_id'], $_GET['login']);
     }
     $checkout_step_indicator = do_shortcode('[wps_checkout_step_indicator]');
     $checkout_content = '';
     if (!empty($_GET['order_step'])) {
         switch ($_GET['order_step']) {
             case 1:
                 ob_start();
                 require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-one");
                 $checkout_content .= ob_get_contents();
                 ob_end_clean();
                 break;
             case 2:
                 if (get_current_user_id() != 0) {
                     $permalink_option = get_option('permalink_structure');
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=3';
                     wpshop_tools::wpshop_safe_redirect($url);
                 } else {
                     ob_start();
                     require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-two");
                     $checkout_content .= ob_get_contents();
                     ob_end_clean();
                 }
                 break;
             case 3:
                 if (get_current_user_id() == 0) {
                     $permalink_option = get_option('permalink_structure');
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=2';
                     wpshop_tools::wpshop_safe_redirect($url);
                 } else {
                     if (!empty($_SESSION) && !empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items'])) {
                         ob_start();
                         require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-three");
                         $checkout_content .= ob_get_contents();
                         ob_end_clean();
                         $url = apply_filters('wps_extra_signup_actions', isset($url) ? $url : '');
                         if (!empty($url)) {
                             wpshop_tools::wpshop_safe_redirect($url);
                         }
                     } else {
                         $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                         $url = get_permalink($checkout_page_id);
                         wpshop_tools::wpshop_safe_redirect($url);
                     }
                 }
                 break;
             case 4:
                 if (get_current_user_id() == 0) {
                     $permalink_option = get_option('permalink_structure');
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=2';
                     wpshop_tools::wpshop_safe_redirect($url);
                 } else {
                     if (!empty($_SESSION) && !empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items'])) {
                         ob_start();
                         require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-four");
                         $checkout_content .= ob_get_contents();
                         ob_end_clean();
                     } else {
                         $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                         $url = get_permalink($checkout_page_id);
                         wpshop_tools::wpshop_safe_redirect($url);
                     }
                 }
                 break;
             case 5:
                 if (get_current_user_id() == 0) {
                     $permalink_option = get_option('permalink_structure');
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=2';
                     wpshop_tools::wpshop_safe_redirect($url);
                 } else {
                     $wps_cart = new wps_cart();
                     $order = $wps_cart->calcul_cart_information(array());
                     $wps_cart->store_cart_in_session($order);
                     $shipping_option = get_option('wpshop_shipping_address_choice');
                     if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items']) && (!empty($shipping_option) && !empty($shipping_option['activate']) && !empty($_SESSION['shipping_method']) || !empty($shipping_option) && empty($shipping_option['activate']))) {
                         $order_id = !empty($_SESSION['cart']['order_id']) ? wpshop_tools::varSanitizer($_SESSION['cart']['order_id']) : 0;
                         ob_start();
                         require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-five");
                         $checkout_content .= ob_get_contents();
                         ob_end_clean();
                     } else {
                         $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                         $url = get_permalink($checkout_page_id);
                         wpshop_tools::wpshop_safe_redirect($url);
                     }
                 }
                 break;
             case 6:
                 if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items'])) {
                     $wps_marketing_tools_ctr = new wps_marketing_tools_ctr();
//.........这里部分代码省略.........
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:101,代码来源:wps_classic_checkout.php

示例7: elementAction

 /**
  *	Define the different message and action after an action is send through the element interface
  */
 function elementAction()
 {
     global $wpdb, $initialEavData;
     $pageMessage = $actionResult = '';
     /*	Start definition of output message when action is doing on another page	*/
     /************		CHANGE THE FIELD NAME TO TAKE TO DISPLAY				*************/
     /****************************************************************************/
     $saveditem = isset($_REQUEST['saveditem']) ? wpshop_tools::varSanitizer($_REQUEST['saveditem']) : '';
     $action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : 'add';
     if (!empty($action) && $action == 'activate' && !empty($_REQUEST['id'])) {
         $query = $wpdb->update(self::getDbTable(), array('status' => 'moderated'), array('id' => $_REQUEST['id']));
         wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $_REQUEST['id']));
     }
     if ($action != '' && $action == 'saveok' && $saveditem > 0) {
         $editedElement = self::getElement($saveditem);
         $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully saved', 'wpshop'), '<span class="bold" >' . $editedElement->name . '</span>');
     } elseif ($action != '' && $action == 'deleteok' && $saveditem > 0) {
         $editedElement = self::getElement($saveditem, "'deleted'");
         $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully deleted', 'wpshop'), '<span class="bold" >' . $editedElement->name . '</span>');
     }
     /*	Define the database operation type from action launched by the user	 */
     /*************************			GENERIC				****************************/
     /*************************************************************************/
     $pageAction = isset($_REQUEST[self::getDbTable() . '_action']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable() . '_action']) : (!empty($_GET['action']) && $_GET['action'] == 'delete' ? $_GET['action'] : '');
     $id = isset($_REQUEST[self::getDbTable()]['id']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable()]['id']) : (!empty($_GET['id']) ? $_GET['id'] : '');
     $set_section = !empty($_REQUEST[self::getDbTable()]['set_section']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable()]['set_section']) : '';
     unset($_REQUEST[self::getDbTable()]['set_section']);
     /*	Specific case for the attribute groups	*/
     if (!isset($_REQUEST[self::getDbTable()]['status'])) {
         $_REQUEST[self::getDbTable()]['status'] = 'moderated';
     }
     if (!isset($_REQUEST[self::getDbTable()]['default_set'])) {
         $_REQUEST[self::getDbTable()]['default_set'] = 'no';
     }
     if ($pageAction != '' && ($pageAction == 'edit' || $pageAction == 'editandcontinue' || $pageAction == 'delete')) {
         if (current_user_can('wpshop_edit_attribute_set')) {
             $_REQUEST[self::getDbTable()]['last_update_date'] = date('Y-m-d H:i:s');
             if ($pageAction == 'delete') {
                 if (current_user_can('wpshop_delete_attribute_set')) {
                     $_REQUEST[self::getDbTable()]['status'] = 'deleted';
                 } else {
                     $actionResult = 'userNotAllowedForActionDelete';
                 }
             }
             $actionResult = wpshop_database::update($_REQUEST[self::getDbTable()], $id, self::getDbTable());
         } else {
             $actionResult = 'userNotAllowedForActionEdit';
         }
         /** Address display managment **/
         if (!empty($_REQUEST['id'])) {
             $is_billing = $is_shipping = false;
             /** Get billing option **/
             $billing_option = get_option('wpshop_billing_address');
             $shipping_option = get_option('wpshop_shipping_address_choice');
             if (!empty($billing_option) && !empty($billing_option['choice']) && $billing_option['choice'] == $_REQUEST['id']) {
                 $is_billing = true;
             }
             if (!empty($shipping_option) && !empty($shipping_option['choice']) && $shipping_option['choice'] == $_REQUEST['id']) {
                 $is_shipping = true;
             }
             $attribute_display = array();
             if (!empty($_REQUEST['attribute_group_order'])) {
                 foreach ($_REQUEST['attribute_group_order'] as $group_id => $group_def) {
                     $end_line_element_id = 0;
                     if ($group_id != 'newOrderNotAffectedAttribute') {
                         $attribute_display[str_replace('newOrder', '', $group_id)] = explode(',', $group_def);
                         foreach ($attribute_display[str_replace('newOrder', '', $group_id)] as $att_id => $att) {
                             if ($att == 'wps-attribute-end-line') {
                                 $attribute_display[str_replace('newOrder', '', $group_id)][$att_id] = 'wps-attribute-end-line-' . $end_line_element_id;
                                 $end_line_element_id++;
                             }
                         }
                     }
                 }
             }
             if ($is_billing && !$is_shipping) {
                 $billing_option['display_model'] = $attribute_display;
                 update_option('wpshop_billing_address', $billing_option);
             }
             if (!$is_billing && $is_shipping) {
                 $shipping_option['display_model'] = $attribute_display;
                 update_option('wpshop_shipping_address_choice', $shipping_option);
             }
         }
     } elseif ($pageAction != '' && $pageAction == 'delete') {
         if (current_user_can('wpshop_delete_attribute_set')) {
             $_REQUEST[self::getDbTable()]['last_update_date'] = date('Y-m-d H:i:s');
             $_REQUEST[self::getDbTable()]['status'] = 'deleted';
             $actionResult = wpshop_database::update($_REQUEST[self::getDbTable()], $id, self::getDbTable());
         } else {
             $actionResult = 'userNotAllowedForActionDelete';
         }
     } elseif ($pageAction != '' && ($pageAction == 'save' || $pageAction == 'saveandcontinue' || $pageAction == 'add')) {
         if (current_user_can('wpshop_add_attribute_set')) {
             $_REQUEST[self::getDbTable()]['creation_date'] = date('Y-m-d H:i:s');
             $actionResult = wpshop_database::save($_REQUEST[self::getDbTable()], self::getDbTable());
             $id = $wpdb->insert_id;
//.........这里部分代码省略.........
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:101,代码来源:attributes_set.class.php


注:本文中的wpshop_tools::wpshop_safe_redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。