Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wpct Http Bridge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
codeccoop
WordPress
plugins
Wpct Http Bridge
Merge requests
!2
Git submodules
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Git submodules
feat/submodules
into
main
Overview
0
Commits
24
Pipelines
0
Changes
14
Merged
Lucas García
requested to merge
feat/submodules
into
main
8 months ago
Overview
0
Commits
24
Pipelines
0
Changes
14
Expand
Changes to be compatible with submodules integration
JWT auth implementation
0
0
Merge request reports
Compare
main
version 6
8db3739f
8 months ago
version 5
26d159f0
8 months ago
version 4
6426fe2c
8 months ago
version 3
a94c92d2
8 months ago
version 2
98b6d9e3
8 months ago
version 1
f625b3c8
8 months ago
main (base)
and
latest version
latest version
db9c7595
24 commits,
8 months ago
version 6
8db3739f
23 commits,
8 months ago
version 5
26d159f0
22 commits,
8 months ago
version 4
6426fe2c
21 commits,
8 months ago
version 3
a94c92d2
20 commits,
8 months ago
version 2
98b6d9e3
19 commits,
8 months ago
version 1
f625b3c8
18 commits,
8 months ago
14 files
+
619
−
531
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
14
Search (e.g. *.vue) (Ctrl+P)
abstract/class-plugin.php deleted
100644 → 0
+
0
−
100
Options
<?php
namespace
WPCT_HTTP\Abstract
;
use
WPCT_HTTP
\Menu
as
Menu
;
use
WPCT_HTTP
\Settings
as
Settings
;
abstract
class
Plugin
extends
Singleton
{
protected
$name
;
protected
$index
;
protected
$textdomain
;
private
$menu
;
protected
$dependencies
=
[];
abstract
public
function
init
();
abstract
public
static
function
activate
();
abstract
public
static
function
deactivate
();
public
function
__construct
()
{
if
(
empty
(
$this
->
name
)
||
empty
(
$this
->
textdomain
))
{
throw
new
\Exception
(
'Bad plugin initialization'
);
}
$this
->
index
=
dirname
(
__FILE__
,
2
)
.
'/'
.
$this
->
index
;
$this
->
check_dependencies
();
$settings
=
Settings
::
get_instance
(
$this
->
textdomain
);
$this
->
menu
=
Menu
::
get_instance
(
$this
->
name
,
$settings
);
add_action
(
'init'
,
[
$this
,
'init'
],
10
);
add_action
(
'init'
,
function
()
{
$this
->
load_textdomain
();
},
5
);
add_filter
(
'load_textdomain_mofile'
,
function
(
$mofile
,
$domain
)
{
return
$this
->
load_mofile
(
$mofile
,
$domain
);
},
10
,
2
);
}
public
function
get_menu
()
{
return
$this
->
menu
;
}
public
function
get_name
()
{
return
$this
->
name
;
}
public
function
get_textdomain
()
{
return
$this
->
textdomain
;
}
public
function
get_data
()
{
return
apply_filters
(
'wpct_dc_plugin_data'
,
null
,
$this
->
index
);
}
private
function
check_dependencies
()
{
add_filter
(
'wpct_dc_dependencies'
,
function
(
$dependencies
)
{
foreach
(
$this
->
dependencies
as
$label
=>
$url
)
{
$dependencies
[
$label
]
=
$url
;
}
return
$dependencies
;
});
}
private
function
load_textdomain
()
{
$data
=
$this
->
get_data
();
$domain_path
=
isset
(
$data
[
'DomainPath'
])
&&
!
empty
(
$data
[
'DomainPath'
])
?
$data
[
'DomainPath'
]
:
'/languages'
;
load_plugin_textdomain
(
$this
->
textdomain
,
false
,
dirname
(
$this
->
index
)
.
$domain_path
,
);
}
private
function
load_mofile
(
$mofile
,
$domain
)
{
$data
=
$this
->
get_data
();
$domain_path
=
isset
(
$data
[
'DomainPath'
])
&&
!
empty
(
$data
[
'DomainPath'
])
?
$data
[
'DomainPath'
]
:
'/languages'
;
if
(
$domain
===
$this
->
textdomain
&&
strpos
(
$mofile
,
WP_LANG_DIR
.
'/plugins/'
)
===
false
)
{
$locale
=
apply_filters
(
'plugin_locale'
,
determine_locale
(),
$domain
);
$mofile
=
dirname
(
$this
->
index
)
.
$domain_path
.
'/'
.
$domain
.
'-'
.
$locale
.
'.mo'
;
}
return
$mofile
;
}
}
Loading