Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
0378f23f
Verified
Commit
0378f23f
authored
Nov 04, 2016
by
Erick Hitter
Browse files
Update remaining classes to use abstract
Also fixes the abstract class to support multiple classes.
🤦
parent
521d6325
Changes
4
Hide whitespace changes
Inline
Side-by-side
includes/abstract-class-singleton.php
View file @
0378f23f
...
...
@@ -6,18 +6,18 @@ abstract class Singleton {
/**
* Class instance
*/
private
static
$__instance
=
null
;
private
static
$__instance
s
=
array
()
;
public
static
function
instance
()
{
$caller
=
get_called_class
();
if
(
!
is
_a
(
self
::
$__instance
,
$caller
)
)
{
self
::
$__instance
=
new
$caller
();
if
(
!
is
set
(
self
::
$__instance
s
[
$caller
]
)
)
{
self
::
$__instance
s
[
$caller
]
=
new
$caller
();
self
::
$__instance
->
class_init
();
self
::
$__instance
s
[
$caller
]
->
class_init
();
}
return
self
::
$__instance
;
return
self
::
$__instance
s
[
$caller
]
;
}
protected
function
__construct
()
{}
...
...
includes/class-cron-options-cpt.php
View file @
0378f23f
...
...
@@ -2,20 +2,7 @@
namespace
WP_Cron_Control_Revisited
;
class
Cron_Options_CPT
{
/**
* Class instance
*/
private
static
$__instance
=
null
;
public
static
function
instance
()
{
if
(
!
is_a
(
self
::
$__instance
,
__CLASS__
)
)
{
self
::
$__instance
=
new
self
;
}
return
self
::
$__instance
;
}
class
Cron_Options_CPT
extends
Singleton
{
/**
* PLUGIN SETUP
*/
...
...
@@ -29,7 +16,7 @@ class Cron_Options_CPT {
/**
* Register hooks
*/
pr
ivate
function
__construc
t
()
{
pr
otected
function
class_ini
t
()
{
// Data storage
add_action
(
'init'
,
array
(
$this
,
'register_post_type'
)
);
...
...
includes/class-internal-events.php
View file @
0378f23f
...
...
@@ -2,20 +2,7 @@
namespace
WP_Cron_Control_Revisited
;
class
Internal_Events
{
/**
* Class instance
*/
private
static
$__instance
=
null
;
public
static
function
instance
()
{
if
(
!
is_a
(
self
::
$__instance
,
__CLASS__
)
)
{
self
::
$__instance
=
new
self
;
}
return
self
::
$__instance
;
}
class
Internal_Events
extends
Singleton
{
/**
* PLUGIN SETUP
*/
...
...
@@ -29,7 +16,7 @@ class Internal_Events {
/**
* Register hooks
*/
pr
ivate
function
__construc
t
()
{
pr
otected
function
class_ini
t
()
{
$this
->
prepare
();
add_action
(
'wp_loaded'
,
array
(
$this
,
'schedule_internal_events'
)
);
...
...
wp-cron-control-revisited.php
View file @
0378f23f
...
...
@@ -12,20 +12,7 @@ namespace WP_Cron_Control_Revisited;
require
__DIR__
.
'/includes/abstract-class-singleton.php'
;
class
Main
{
/**
* Class instance
*/
private
static
$__instance
=
null
;
public
static
function
instance
()
{
if
(
!
is_a
(
self
::
$__instance
,
__CLASS__
)
)
{
self
::
$__instance
=
new
self
;
}
return
self
::
$__instance
;
}
class
Main
extends
Singleton
{
/**
* PLUGIN SETUP
*/
...
...
@@ -48,7 +35,7 @@ class Main {
/**
* Register hooks
*/
pr
ivate
function
__construc
t
()
{
pr
otected
function
class_ini
t
()
{
// For now, leave WP-CLI alone
if
(
defined
(
'WP_CLI'
)
&&
WP_CLI
)
{
return
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment