Skip to content
Snippets Groups Projects
Commit 9b9ef235 authored by dyszczo's avatar dyszczo
Browse files

well.. and the plugin ;)

parent 5795ff86
No related branches found
No related tags found
2 merge requests!36Devel,!33updated version for 2019 ;)
<?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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment