WordPress.org

Plugin Directory

Changeset 621694


Ignore:
Timestamp:
11/06/12 14:34:51 (18 months ago)
Author:
garyc40
Message:

Merge with latest 3.8.

Location:
wp-e-commerce/branches/branch-3.8
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • wp-e-commerce/branches/branch-3.8/wpsc-admin/admin.php

    r618862 r621694  
    985985 
    986986    wpsc_update_page_urls( true ); 
    987     return $return; 
    988987} 
    989988 
  • wp-e-commerce/branches/branch-3.8/wpsc-admin/init.php

    r618697 r621694  
    492492 
    493493    wpsc_update_permalink_slugs(); 
     494    wpsc_core_load_page_titles(); 
     495    wpsc_register_post_types(); 
    494496 
    495497    if( ! $auto ){ 
  • wp-e-commerce/branches/branch-3.8/wpsc-core/wpsc-functions.php

    r618697 r621694  
    356356        'register_meta_box_cb' => 'wpsc_meta_boxes', 
    357357        'rewrite'              => array( 
    358             'slug'       => $wpsc_page_titles['products'] . '/%wpsc_product_category%', 
     358            'slug'       => str_replace( basename( home_url() ), '', $wpsc_page_titles['products'] ) . '/%wpsc_product_category%', 
    359359            'with_front' => false 
    360360        ) 
     
    418418        'hierarchical' => true, 
    419419        'rewrite'      => array( 
    420             'slug'         => $wpsc_page_titles['products'], 
     420            'slug'         => str_replace( basename( home_url() ), '', $wpsc_page_titles['products'] ), 
    421421            'with_front'   => false, 
    422422            'hierarchical' => (bool) get_option( 'product_category_hierarchical_url', 0 ), 
     
    656656    global $wp_the_query; 
    657657 
    658     if ( $query !== $wp_the_query ) 
     658    if ( is_admin() || $query !== $wp_the_query ) 
    659659        return; 
    660660 
     
    12921292function wpsc_product_link( $permalink, $post, $leavename ) { 
    12931293    global $wp_query, $wpsc_page_titles, $wpsc_query, $wp_current_filter; 
    1294     $term_url = ''; 
    12951294    $rewritecode = array( 
    12961295        '%wpsc_product_category%', 
     
    13121311 
    13131312    $permalink_structure = get_option( 'permalink_structure' ); 
     1313 
    13141314    // This may become customiseable later 
    1315  
    1316     $our_permalink_structure = $wpsc_page_titles['products'] . "/%wpsc_product_category%/%postname%/"; 
     1315    $our_permalink_structure = str_replace( basename( home_url() ), '', $wpsc_page_titles['products'] ) . "/%wpsc_product_category%/%postname%/"; 
    13171316    // Mostly the same conditions used for posts, but restricted to items with a post type of "wpsc-product " 
    13181317 
     
    13401339            } 
    13411340            $category_slug = $product_category; 
    1342             $term_url = get_term_link( $category_slug, 'wpsc_product_category' ); 
    13431341        } else { 
    13441342            // If the product is associated with only one category, we only have one choice 
     
    13551353 
    13561354            $category_slug = $product_category->slug; 
    1357  
    1358             $term_url = get_term_link( $category_slug, 'wpsc_product_category' ); 
    13591355        } 
    13601356 
     
    13851381        $permalink = str_replace( $rewritecode, $rewritereplace, $our_permalink_structure ); 
    13861382        $permalink = user_trailingslashit( $permalink, 'single' ); 
     1383 
    13871384        $permalink = home_url( $permalink ); 
    13881385    } 
     
    14371434 */ 
    14381435function wpsc_get_page_post_names() { 
    1439  
    14401436    $wpsc_page['products']            = basename( get_option( 'product_list_url' ) ); 
    14411437    $wpsc_page['checkout']            = basename( get_option( 'checkout_url' ) ); 
     
    16571653 */ 
    16581654function wpsc_get_all_customer_meta( $id = false ) { 
     1655    global $wpdb; 
     1656 
    16591657    if ( ! $id ) 
    16601658        $id = wpsc_get_current_customer_id(); 
     
    17131711 */ 
    17141712function wpsc_update_all_customer_meta( $profile, $id = false ) { 
     1713    global $wpdb; 
     1714 
    17151715    if ( ! $id ) 
    17161716        $id = wpsc_get_current_customer_id( 'create' ); 
  • wp-e-commerce/branches/branch-3.8/wpsc-includes/category.functions.php

    r586511 r621694  
    124124 
    125125    //if we are in wpsc category page then get the current category 
    126     if(isset($wp_query->query_vars['wpsc_product_category']) || (isset($wp_query->query_vars['taxonomy']) && 'wpsc_product_category' == $wp_query->query_vars['taxonomy'])) 
    127         $curr_cat = get_term_by('slug',$wp_query->query_vars['term'], 'wpsc_product_category'); 
    128     else 
    129         $curr_cat = false; 
     126    $curr_cat = false; 
     127    $term = get_query_var( 'wpsc_product_category' ); 
     128    if ( ! $term && get_query_var( 'taxonomy' ) == 'wpsc_product_category' ) 
     129        $term = get_query_var( 'term' ); 
     130    if ( $term ) 
     131        $curr_cat = get_term_by( 'slug', $term, 'wpsc_product_category' ); 
    130132 
    131133    //check if we are in wpsc category page and that we have a term_id of the category to print 
     
    593595 
    594596/** 
    595  * Abstracts Suhosin check into a function.  Used primarily in relation to target markets.   
     597 * Abstracts Suhosin check into a function.  Used primarily in relation to target markets. 
    596598 * May be deprecated or never publicly launched if we change how the target market variables work. 
    597  *  
     599 * 
    598600 * @since 3.8.9 
    599601 * @return boolean 
    600602 */ 
    601603function wpsc_is_suhosin_enabled() { 
    602     return @ extension_loaded( 'suhosin' ) && @ ini_get( 'suhosin.post.max_vars' ) > 0 && @ ini_get( 'suhosin.post.max_vars' ) < 500;  
     604    return @ extension_loaded( 'suhosin' ) && @ ini_get( 'suhosin.post.max_vars' ) > 0 && @ ini_get( 'suhosin.post.max_vars' ) < 500; 
    603605} 
    604606 
  • wp-e-commerce/branches/branch-3.8/wpsc-includes/purchase-log-notification.class.php

    r618697 r621694  
    329329 
    330330    public function get_raw_message() { 
     331        global $wpdb; 
     332 
    331333        $form_data = new WPSC_Checkout_Form_Data( $this->purchase_log->get( 'id' ) ); 
    332334        $raw_data = $form_data->get_raw_data(); 
     
    387389            if ( empty( $section['fields'] ) ) 
    388390                continue; 
     391 
    389392            $message .= "<strong>{$section['title']}</strong>\r\n"; 
    390393            foreach ( $section['fields'] as $field ) { 
     394                if ( strpos( $field->unique_name, 'state' ) && is_numeric( $field->value ) ) { 
     395                    $sql = $wpdb->prepare( "SELECT name FROM " . WPSC_TABLE_REGION_TAX . " WHERE id = %d", $field->value ); 
     396                    $field->value = $wpdb->get_var( $sql ); 
     397                } 
    391398                $message .= $field->name . ' : ' . $field->value . "\r\n"; 
    392399            } 
  • wp-e-commerce/branches/branch-3.8/wpsc-shipping/library/shipwire_functions.php

    r586469 r621694  
    5858        self::$endpoint  = 'https://api.shipwire.com/exec/'; //For testing, change to api.beta.shipwire 
    5959 
     60        if ( ! self::is_active() ) 
     61            return; 
     62 
    6063        //Hooks into transaction results for Order Fulfillment API.  wpsc_confirm_checkout would be logical - but it is run for each cart item. 
    6164        //In fact, the only two current transaction page actions happen within the cart loop.  Not great. 
     
    316319     * @return type 
    317320     */ 
    318     public function shipwire_on_checkout( $object, $sessionid, $display ) { 
     321    public function shipwire_on_checkout( $purchase_log_object, $sessionid, $display ) { 
    319322        global $wpdb; 
    320  
    321         $log_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE sessionid = %s", $sessionid ) ); 
    322  
    323         self::process_order_request( $log_id ); 
     323        self::process_order_request( $purchase_log_object->get( 'id' ) ); 
    324324    } 
    325325 
     
    911911    return WPSC_Shipwire::send_tracking_request( $xml ); 
    912912} 
    913  
    914 ?> 
  • wp-e-commerce/branches/branch-3.8/wpsc-shipping/shipwire.php

    r618697 r621694  
    11<?php 
    22 
     3require_once( WPSC_FILE_PATH . '/wpsc-shipping/library/shipwire_functions.php' ); 
     4 
    35/** 
    4  * New Shipwire Shipping rates   
     6 * New Shipwire Shipping rates 
    57 * This is a very simple gateway - no settings, and essentially just a wrapper function for the Shipwire Shipping Rate API 
    68 */ 
     
    810class WPSC_Shipwire_Shipping { 
    911    public $internal_name; 
    10     public $name;    
    11      
     12    public $name; 
     13 
    1214    /** 
    1315     * Constructor 
     
    1921        $this->requires_weight = false; 
    2022        $this->needs_zipcode   = true; 
    21          
     23 
    2224        return true; 
    2325    } 
    24      
     26 
    2527    function getName() { 
    2628        return $this->name; 
    2729    } 
    28      
     30 
    2931    function getInternalName() { 
    3032        return $this->internal_name; 
    3133    } 
    32      
     34 
    3335 
    3436    function getForm() { 
     
    4143        return $output; 
    4244    } 
    43      
     45 
    4446    function submit_form() { 
    4547        return true; 
     
    5860    $wpsc_shipping_modules[$wpsc_shipwire->getInternalName()] = $wpsc_shipwire; 
    5961} 
    60  
    61 ?> 
  • wp-e-commerce/branches/branch-3.8/wpsc-theme/functions/wpsc-transaction_results_functions.php

    r618697 r621694  
    1111 */ 
    1212function transaction_results( $sessionid, $display_to_screen = true, $transaction_id = null ) { 
    13     global $message_html, $echo_to_screen, $wpsc_cart; 
     13    global $message_html, $echo_to_screen, $wpsc_cart, $purchase_log; 
    1414 
     15    // pre-3.8.9 variable 
    1516    $echo_to_screen = $display_to_screen; 
    1617 
    17     $purchase_log = new WPSC_Purchase_Log( $sessionid, 'sessionid' ); 
     18    $purchase_log_object = new WPSC_Purchase_Log( $sessionid, 'sessionid' ); 
    1819 
    19     $message_html = _wpsc_transaction_results_html( $purchase_log ); 
     20    // compatibility with pre-3.8.9 templates where they use a global 
     21    // $purchase_log object which is simply just a database row 
     22    $purchase_log = (object) $purchase_log_object->get_data(); 
     23 
     24    // pre-3.8.9 templates also use this global variable 
     25    $message_html = wpsc_get_transaction_html_output( $purchase_log_object ); 
    2026 
    2127    $wpsc_cart->empty_cart(); 
     28 
     29    do_action( 'wpsc_transaction_results_shutdown', $purchase_log_object, $sessionid, $display_to_screen ); 
     30 
    2231    return $message_html; 
    2332} 
    2433 
    25 function _wpsc_transaction_results_html( $purchase_log ) { 
    26     $output = wpsc_get_transaction_html_output( $purchase_log ); 
    27  
    28     if ( version_compare( WPSC_VERSION, '3.8.9', '>=' ) ) 
    29         echo $output; 
    30  
    31     return $output; 
     34function wpsc_transaction_html_output() { 
     35    global $message_html; 
     36    echo $message_html; 
    3237} 
    3338 
     
    5560        $sessionid = $_GET['result']; 
    5661    elseif ( isset( $_REQUEST['eway'] ) && '0' == $_REQUEST['eway'] ) 
    57         echo $_SESSION['eway_message']; 
     62        echo wpsc_get_customer_meta( 'eway_message' ); 
    5863    elseif ( isset( $_REQUEST['payflow'] ) && '1' == $_REQUEST['payflow'] ){ 
    59         echo $_SESSION['payflow_message']; 
    60         $_SESSION['payflow_message'] = ''; 
     64        echo wpsc_get_customer_meta( 'payflow_message' ); 
     65        wpsc_delete_customer_meta( 'payflow_message' ); 
    6166    } 
    6267 
Note: See TracChangeset for help on using the changeset viewer.