Skip to content

Commit

Permalink
ssl check
Browse files Browse the repository at this point in the history
  • Loading branch information
piffpaffpuff authored and piffpaffpuff committed May 3, 2015
1 parent b67cdd9 commit 225cb33
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
20 changes: 16 additions & 4 deletions includes/class-wcdn-print.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class WooCommerce_Delivery_Notes_Print {

public static $templates;

public $template_paths;

public $template;
public $template_directory_name;
public $template_path_theme;
Expand Down Expand Up @@ -111,7 +113,15 @@ public function __construct() {
*/
public function load_hooks() {
// Define default variables
$this->template_directory_name = apply_filters( 'wcdn_template_directory_name', 'print-order' );
$this->template_directory_name = 'print-order';
/*
$this->template_paths = array(
WC_TEMPLATE_PATH . $this->template_directory_name . '/',
WooCommerce_Delivery_Notes::$plugin_path . 'templates/' . $this->template_directory_name . '/'
);
*/

$this->template_path_theme = WC_TEMPLATE_PATH . $this->template_directory_name . '/';
$this->template_path_plugin = WooCommerce_Delivery_Notes::$plugin_path . 'templates/' . $this->template_directory_name . '/';
$this->template_url_plugin = WooCommerce_Delivery_Notes::$plugin_url . 'templates/' . $this->template_directory_name . '/';
Expand Down Expand Up @@ -270,18 +280,20 @@ public function get_print_page_url( $order_ids, $template_type = 'order', $order
$url = add_query_arg( $endpoint, $order_ids_slug, $base_url );
} else {
// For the theme
$base_url = get_permalink( wc_get_page_id( 'myaccount' ) );
$base_url = wc_get_page_permalink( 'myaccount' );
$endpoint = $this->api_endpoints['print-order'];

/*
// The permalink function can return a faulty protocol when
// the front-end uses ssl but the back-end doesn't. This
// depends on which plugin is used for ssl. To fix this, the
// home_url is checked for the correct protocol.
$home_url_scheme = parse_url(home_url(), PHP_URL_SCHEME);
$base_url_scheme = parse_url($base_url, PHP_URL_SCHEME);
if( $base_url_scheme != $home_url_scheme ) {
if( !empty($home_url_scheme) && $base_url_scheme != $home_url_scheme ) {
$base_url = str_replace( $base_url_scheme . '://', $home_url_scheme . '://', $base_url );
}
*/

// Add the order ids and create the url
if( get_option( 'permalink_structure' ) ) {
Expand All @@ -307,7 +319,7 @@ public function get_template_url( $name ) {
$theme_path = get_template_directory() . '/' . $this->template_path_theme;
$theme_uri = get_template_directory_uri() . '/' . $this->template_path_theme;

// buld the url depenind on where the file is
// build the url depending on where the file is
if( file_exists( $child_theme_path . $name ) ) {
$uri = $child_theme_uri . $name;
} elseif( file_exists( $theme_path . $name ) ) {
Expand Down
3 changes: 1 addition & 2 deletions includes/class-wcdn-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public function create_thumbnail( $attachment_id ) {
*/
public function reset_invoice_counter_ajax() {
if( !wp_verify_nonce( $_POST['nonce'], WooCommerce_Delivery_Notes::$plugin_prefix . 'settings_nonce' ) || !isset( $_POST['reset'] ) ) {
print_r('no reset');
exit;
}

Expand Down Expand Up @@ -253,7 +252,7 @@ public function create_settings_page() {
// show template preview links when an order is available
$args = array(
'post_type' => 'shop_order',
'post_status' => array_keys( wc_get_order_statuses() ),
'post_status' => array( 'wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-cancelled', 'wc-refunded', 'wc-failed' ),
'posts_per_page' => 1
);
$query = new WP_Query( $args );
Expand Down
18 changes: 10 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: piffpaffpuff
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=K2JKYEASQBBSQ&lc=US&item_name=WooCommerce%20Print%20Invoice%20%26%20Delivery%20Note&item_number=WCDN&amount=20%2e00&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest
Tags: delivery note, packing slip, invoice, delivery, shipping, print, order, woocommerce, woothemes, shop
Requires at least: 4.0
Tested up to: 4.2
Tested up to: 4.2.1
Stable tag: trunk
License: GPLv3 or later
License URI: http://www.opensource.org/licenses/gpl-license.php
Expand Down Expand Up @@ -286,13 +286,17 @@ Please [contribute your translation](https://github.com/piffpaffpuff/woocommerce

== Changelog ==

= Minimum Requirements: WooCommerce 2.2 and WordPress 4.0 =
= Minimum Requirements: WooCommerce 2.2 =

= 4.1.6 =

* Fix - More flexible protocol checks of email permalinks

= 4.1.5 =

* Fix - Check protocol of email permalinks
* Fix - Show preview links on the settings page
* Fix - Consistent privileges for users with admin access

= 4.1.4 =

Expand Down Expand Up @@ -422,12 +426,10 @@ Please [contribute your translation](https://github.com/piffpaffpuff/woocommerce

== Upgrade Notice ==

= 3.0.6 =
= 4.2.0 =

Thanks everybody to help fixing the SSL issue. Please report to the support forums if you still have SSL problems after the update.
4.2.0 requires at least WooCommerce 2.2.

= 3.0.3 =
= 4.1.5 =

* This update works only with WooCommerce 2.1 (or later) and Wordpress 3.8 (or later). Install it only if your system meets the requirements.
* Prior print templates aren't compatible. Read the [FAQ](http://wordpress.org/plugins/woocommerce-delivery-notes/faq/) to customize the new template.
* Translations aren't updated, except German.
4.1.5 requires at least WooCommerce 2.2.
7 changes: 3 additions & 4 deletions woocommerce-delivery-notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Plugin Name: WooCommerce Print Invoice & Delivery Note
* Plugin URI: https://github.com/piffpaffpuff/woocommerce-delivery-notes
* Description: Print Invoices & Delivery Notes for WooCommerce Orders.
* Version: 4.1.5
* Version: 4.1.6
* Author: Triggvy Gunderson
* Author URI: https://github.com/piffpaffpuff/woocommerce-delivery-notes
* License: GPLv3 or later
Expand Down Expand Up @@ -55,7 +55,7 @@ final class WooCommerce_Delivery_Notes {
/**
* Default properties
*/
public static $plugin_version;
public static $plugin_version = '4.1.6';
public static $plugin_prefix;
public static $plugin_url;
public static $plugin_path;
Expand Down Expand Up @@ -118,7 +118,6 @@ public function init_hooks() {
* Define WC Constants
*/
private function define_constants() {
self::$plugin_version = '4.1.5';
self::$plugin_prefix = 'wcdn_';
self::$plugin_basefile_path = __FILE__;
self::$plugin_basefile = plugin_basename( self::$plugin_basefile_path );
Expand Down Expand Up @@ -249,7 +248,7 @@ public function is_woocommerce_activated() {
}

/**
* Returns the main instance of teh plugin to prevent the need to use globals
* Returns the main instance of the plugin to prevent the need to use globals
*/
function WCDN() {
return WooCommerce_Delivery_Notes::instance();
Expand Down

0 comments on commit 225cb33

Please sign in to comment.