Skip to content
Snippets Groups Projects

updated version for 2019 ;)

Merged Krzysztof Dyszczyk requested to merge feature/update into devel
1 file
+ 41
0
Compare changes
  • Side-by-side
  • Inline
src/Plugin.php 0 → 100644
+ 41
0
<?php
namespace WPDesk\PluginTemplate;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use WPDesk\Logger\WPDeskLoggerFactory;
use WPDesk\PluginBuilder\Plugin\AbstractPlugin;
use WPDesk_Helper_Plugin;
class Plugin extends AbstractPlugin implements LoggerAwareInterface {
use LoggerAwareTrait;
public function __construct( \WPDesk_Plugin_Info $plugin_info ) {
parent::__construct( $plugin_info );
$this->setLogger( ( new WPDeskLoggerFactory() )->createWPDeskLogger() );
}
public function init() {
if ( $this->is_active() ) {
parent::init();
}
}
/**
* Check plugin activation.
*
* @return bool
*/
private function is_active() {
$plugin_data = array(
'plugin' => $this->plugin_info->get_plugin_file_name(),
'product_id' => $this->plugin_info->get_product_id(),
'version' => $this->plugin_info->get_version(),
'config_uri' => admin_url( 'admin.php?page=wc-settings&tab=integration' ),
);
return ( new WPDesk_Helper_Plugin( $plugin_data ) )->is_active();
}
}
\ No newline at end of file
Loading