Skip to content

Commit

Permalink
Fix for CC icon not showing in some installations (#289)
Browse files Browse the repository at this point in the history
* Fix for CC icon not showing in some installations

* Use WC_ABSPATH constant to avoid hardcoding CC path

* Version bump

* Remove new but unused code
  • Loading branch information
timbocode authored Oct 17, 2020
1 parent c2ef5ca commit 2d50eef
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
== Changelog ==

= 1.0.1 - 2020-10-17
Fixed: CC icon not showing in some installations #289

= 1.0.0 - 2020-10-01
New: Complete new set of sample products created specifically for CC #284
Updated: All documentation links now point to classiccommerce.cc #274, #278, #281
Expand All @@ -10,7 +13,6 @@ Improved: Stock levels are now hidden on the dashboard widget if inventory is di
Improved: Additional checks made during build process #269
Tweaks: Some well-hidden instances of WC purple changes to CC aqua #270, #271


= 1.0.0-rc.2 - 2020-08-29
Fixed: Corrected color of two images to CC aqua, missed in rc1. #255

Expand Down
2 changes: 1 addition & 1 deletion classic-commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Classic Commerce
* Plugin URI: https://github.com/ClassicPress-plugins/classic-commerce
* Description: A simple, powerful and independent e-commerce platform. Sell anything with ease.
* Version: 1.0.0
* Version: 1.0.1
* Author: ClassicPress Research Team
* Author URI: https://github.com/ClassicPress-plugins/classic-commerce
* Text Domain: classic-commerce
Expand Down
13 changes: 9 additions & 4 deletions includes/admin/class-wc-admin-menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,19 @@ public function __construct() {
public function admin_menu() {
global $menu;

$icon_svg = file_get_contents( WC()->plugin_url() . '/assets/images/classic-commerce-dashicon-white-on-transparent.svg' );
$cc_icon = base64_encode( $icon_svg );
$cc_icon = '';
$icon_file = WC_ABSPATH . 'assets/images/classic-commerce-dashicon-white-on-transparent.svg';

if ( file_exists( $icon_file ) ) {
$icon_svg = file_get_contents( $icon_file );
$cc_icon = 'data:image/svg+xml;base64,' . base64_encode( $icon_svg );
}

if ( current_user_can( 'manage_woocommerce' ) ) {
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' ); // WPCS: override ok.
}

add_menu_page( __( 'Classic Commerce', 'classic-commerce' ), __( 'WooCommerce', 'classic-commerce' ), 'manage_woocommerce', 'woocommerce', null, 'data:image/svg+xml;base64,' . $cc_icon, '55.5' );
add_menu_page( __( 'Classic Commerce', 'classic-commerce' ), __( 'WooCommerce', 'classic-commerce' ), 'manage_woocommerce', 'woocommerce', null, $cc_icon, '55.5' ); // A default icon will be used if $cc_icon is empty

add_submenu_page( 'edit.php?post_type=product', __( 'Attributes', 'classic-commerce' ), __( 'Attributes', 'classic-commerce' ), 'manage_product_terms', 'product_attributes', array( $this, 'attributes_page' ) );
}
Expand Down Expand Up @@ -366,7 +371,7 @@ public function nav_menu_links() {
* Add the "Visit Store" link in admin bar main menu.
*
* @since WC-2.4.0
*
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance.
*/
public function admin_bar_menus( $wp_admin_bar ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/class-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class WooCommerce {
* @var string
*/
public $version = '3.5.3';
public $cc_version = '1.0.0';
public $cc_version = '1.0.1';

/**
* The single instance of the class.
Expand Down

0 comments on commit 2d50eef

Please sign in to comment.