Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin-template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
Library
plugin-template
Merge requests
!36
You need to sign in or sign up before continuing.
Devel
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Closed
Devel
devel
into
master
Overview
0
Commits
44
Changes
1
Closed
Krzysztof Dyszczyk
requested to merge
devel
into
master
5 years ago
Overview
0
Commits
44
Changes
1
0
0
Merge request reports
Viewing commit
9b9ef235
Prev
Next
Show latest version
1 file
+
41
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
9b9ef235
well.. and the plugin ;)
· 9b9ef235
dyszczo
authored
6 years ago
src/Plugin.php
0 → 100644
+
41
−
0
View file @ 9b9ef235
<?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