Skip to content

Commit

Permalink
v2.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Jun 14, 2021
1 parent b2b53c8 commit 12614bd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 31 deletions.
47 changes: 20 additions & 27 deletions cost-of-goods-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Cost of Goods for WooCommerce
Plugin URI: https://wpfactory.com/item/cost-of-goods-for-woocommerce/
Description: Save product purchase costs (cost of goods) in WooCommerce. Beautifully.
Version: 2.4.3
Version: 2.4.4
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: cost-of-goods-for-woocommerce
Expand All @@ -16,7 +16,23 @@

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
// Handle is_plugin_active function
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}

// Check for active plugins
if (
! is_plugin_active( 'woocommerce/woocommerce.php' ) ||
( 'cost-of-goods-for-woocommerce.php' === basename( __FILE__ ) && is_plugin_active( 'cost-of-goods-for-woocommerce-pro/cost-of-goods-for-woocommerce-pro.php' ) )
) {
return;
}

// Composer autoload
if ( ! class_exists( 'Alg_WC_Cost_of_Goods' ) ) {
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
}

if ( ! class_exists( 'Alg_WC_Cost_of_Goods' ) ) :

Expand All @@ -35,7 +51,7 @@ final class Alg_WC_Cost_of_Goods {
* @var string
* @since 1.0.0
*/
public $version = '2.4.3';
public $version = '2.4.4';

/**
* @var Alg_WC_Cost_of_Goods The single instance of the class
Expand Down Expand Up @@ -63,20 +79,12 @@ public static function instance() {
/**
* Alg_WC_Cost_of_Goods Constructor.
*
* @version 2.4.3
* @version 2.4.4
* @since 1.0.0
* @access public
*/
function __construct() {

// Check for active plugins
if (
! $this->is_plugin_active( 'woocommerce/woocommerce.php' ) ||
( 'cost-of-goods-for-woocommerce.php' === basename( __FILE__ ) && $this->is_plugin_active( 'cost-of-goods-for-woocommerce-pro/cost-of-goods-for-woocommerce-pro.php' ) )
) {
return;
}

// Localization
add_action( 'init', array( $this, 'localize' ) );

Expand Down Expand Up @@ -125,21 +133,6 @@ function localize() {
load_plugin_textdomain( 'cost-of-goods-for-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
}

/**
* is_plugin_active.
*
* @version 1.4.0
* @since 1.4.0
*/
function is_plugin_active( $plugin ) {
return ( function_exists( 'is_plugin_active' ) ? is_plugin_active( $plugin ) :
(
in_array( $plugin, apply_filters( 'active_plugins', ( array ) get_option( 'active_plugins', array() ) ) ) ||
( is_multisite() && array_key_exists( $plugin, ( array ) get_site_option( 'active_sitewide_plugins', array() ) ) )
)
);
}

/**
* Include required core files used in admin and on the frontend.
*
Expand Down
6 changes: 3 additions & 3 deletions langs/cost-of-goods-for-woocommerce.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GNU General Public License v3.0.
msgid ""
msgstr ""
"Project-Id-Version: Cost of Goods for WooCommerce 2.4.3\n"
"Project-Id-Version: Cost of Goods for WooCommerce 2.4.4\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cost-of-goods-for-woocommerce\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2021-06-11T20:21:48+02:00\n"
"POT-Creation-Date: 2021-06-14T19:15:17+02:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.4.0\n"
"X-Domain: cost-of-goods-for-woocommerce\n"
Expand All @@ -35,7 +35,7 @@ msgstr ""
msgid "https://wpfactory.com"
msgstr ""

#: cost-of-goods-for-woocommerce.php:186
#: cost-of-goods-for-woocommerce.php:179
msgid "Go Pro"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: wpcodefactory, kerbhavik
Tags: woocommerce, cost, cost of goods, cog, cost of goods sold, cogs, woo commerce
Requires at least: 4.4
Tested up to: 5.7
Stable tag: 2.4.3
Stable tag: 2.4.4
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -83,6 +83,9 @@ And then you can follow these steps:

== Changelog ==

= 2.4.4 - 14/06/2021 =
* Fix - Free and pro plugins can't be active at the same time.

= 2.4.3 - 11/06/2021 =
* Fix - Some products are empty on Cost of goods stock reports csv.
* Dev - Orders - Refunds - Create option to calculate quantity by excluding refunded items.
Expand Down

0 comments on commit 12614bd

Please sign in to comment.