Skip to content

Commit

Permalink
Merge pull request #12 from hxii/development
Browse files Browse the repository at this point in the history
Upstream from Development
  • Loading branch information
hxii authored Jan 26, 2020
2 parents acd3863 + cc50286 commit 8802d22
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
7 changes: 5 additions & 2 deletions class-yrfw-reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: Yotpo Reviews for WooCommerce
Description: Yotpo Social Reviews helps Woocommerce store owners generate a ton of reviews for their products. Yotpo is the only solution which makes it easy to share your reviews automatically to your social networks to gain a boost in traffic and an increase in sales.
Author: Paul Glushak (hxii)
Version: 2.0.3
Version: 2.0.4
Author URI: https://github.com/hxii/
Plugin URI: https://github.com/hxii/YRFW
WC requires at least: 3.1.0
Expand All @@ -24,7 +24,7 @@
/**
* Const definitions
*/
define( 'YRFW_PLUGIN_VERSION', '2.0.3' );
define( 'YRFW_PLUGIN_VERSION', '2.0.4' );
define( 'YRFW_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'YRFW_PLUGIN_URL', plugins_url( '', __FILE__ ) );
define( 'YRFW_BASENAME', plugin_basename( __FILE__ ) );
Expand Down Expand Up @@ -57,6 +57,9 @@
global $yrfw_logger, $settings_instance;
$settings_instance = ( YRFW_Settings_File::get_instance() )->get_settings();
$yrfw_logger = new Hxii_Logger( YRFW_PLUGIN_PATH . 'yotpo_debug.log', ( isset( $settings_instance['debug_level'] ) ) ? $settings_instance['debug_level'] : 'info' );
if ( $yrfw_logger->err && $settings_instance['debug_mode'] ) {
new YRFW_Messages( '<strong>Yotpo Reviews for WooCommerce</strong> - Unable to open log file. Please check permissions/ownership on the <code>yotpo_debug.log</code> file. Debugging has been disabled', 'error', false, true );
}

/**
* Main class
Expand Down
12 changes: 9 additions & 3 deletions inc/Base/class-yrfw-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
* hxiilog
* very simple, constantly evolving logger class for stuff and things
* by Paul Glushak aka hxii
* v. 0.2
* v. 0.2.2
* http://github.com/hxii/
*/

defined( 'ABSPATH' ) || die();

define( 'HXII_LOGGER_VER', '0.2.1' );
define( 'HXII_LOGGER_VER', '0.2.2' );

class Hxii_Logger {
public $err;
public $filename;
public $filepath;
public $loglevel;
Expand All @@ -32,7 +33,12 @@ public function __construct( string $file = 'debug.log', string $level = 'info',
$this->loglevel = $level;
$this->logsize = ( $size * 1048576 );
$this->date_format = ( ! empty( $date_format ) ) ? $date_format : 'Y-m-d H:i:s';
$this->filehandler = fopen( $this->filepath, 'a' ) or exit( "Can't open $this->filepath!" );
if ( is_writable( $this->filepath ) ) {
$this->filehandler = fopen( $this->filepath, 'a' );
} else {
$this->loglevel = 'off';
$this->err = true;
}
}

public function __destruct(){
Expand Down
3 changes: 2 additions & 1 deletion inc/Base/class-yrfw-messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public function __construct( $message, $type, $dismissible = true, $notice = fal
$this->_dismissible = $dismissible;
if ( $notice ) {
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
} else {
add_action( 'throw_message', array( $this, 'throw_message' ) );
}
add_action( 'throw_message', array( $this, 'throw_message' ) );
}

/**
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ You can find some extensions made by me on GitHub [here](https://github.com/hxii
Just place them in the `/extensions` folder.

== Changelog ==
= 2.0.4 =
- Non-writeable log file no longer prevents WP from loading and showing notice instead.
= 2.0.3 =
- Fixed conversion tracking total sum to be string instead of float.
= 2.0.2 =
Expand Down

0 comments on commit 8802d22

Please sign in to comment.