0 ) { $term_engine = get_term( $engine, 'product_ymm' ); if( $term_engine && $term_engine->parent != $model ) { $_error = true; } } } if( ! $_error ) { if( $model > 0 ) { $term_model = get_term( $model, 'product_ymm' ); if( $term_model && $term_model->parent != $make ) { $_error = true; } } } if( ! $_error ) { if( $make > 0 ) { $term_make = get_term( $make, 'product_ymm' ); if( $term_make && $term_make->parent != $year ) { $_error = true; } } } $term_id = ''; if( $_error ) { $term_id = -1; } else { if( $engine > 0 ) { $term_id = $engine; } else if( $model > 0 ) { $term_id = $model; } else if( $make > 0 ) { $term_id = $make; } else if( $year > 0 ) { $term_id = $year; } } vpf_ymm_set_cookie ( 'mark_search', array ( 'year_id' => $year, 'make' => $make, 'model' => $model, 'engine' => $engine, 'term_id' => $term_id, 'category_id' => $category_id ) ); }else{ echo "Go away"; exit(); } /** * Set Cookie [copied from woo-vpf-ymm-cookies.php for use in this file] */ function vpf_ymm_set_cookie ( $identifier = '', $item = '', $type = ''/*, $sub_identifier = ''*/ ) { // $type is for array $item only if ( empty ( $identifier ) ) { return; } $expiry = 0; //setcookie ( 'vpf_ymm', '', time() - 3600, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN ); exit; $vpf_ymm = array (); if ( isset ( $_COOKIE['vpf_ymm'] ) ) { $vpf_ymm = vpf_ymm_get_cookie (); if ( empty ( $vpf_ymm ) ) { $vpf_ymm = array (); } } if ( $type != '' ) { // append or delete if ( ! isset ( $vpf_ymm[ $identifier ] ) || empty ( $vpf_ymm[ $identifier ] ) ) { $vpf_ymm[ $identifier ] = array (); } // Delete Item for Reset Latest Item on Top if ( ! empty ( $vpf_ymm[ $identifier ] ) && in_array ( $item, $vpf_ymm[ $identifier ] ) ) { $item_key = array_search ( $item, $vpf_ymm[ $identifier ] ); if ( $item_key !== false ) { unset ( $vpf_ymm[ $identifier ][ $item_key ] ); } } if ( $type == 'append' && ! empty ( $item ) ) { $vpf_ymm[ $identifier ][] = $item; } // Reset Array Keys from Zero if ( ! empty ( $vpf_ymm[ $identifier ] ) ) { $vpf_ymm[ $identifier ] = array_values ( $vpf_ymm[ $identifier ] ); } } else { if ( empty ( $item ) ) { $expiry = time() - 3600; } $vpf_ymm[ $identifier ] = $item; } $vpf_ymm = maybe_serialize ( $vpf_ymm ); setcookie ( 'vpf_ymm', $vpf_ymm, $expiry, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN ); $_COOKIE['vpf_ymm'] = $vpf_ymm; }