FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
wp2static/wp2static.php at develop · staticweb-io/wp2static · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
staticweb-io
/
wp2static
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
wp2static
/
wp2static.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
81 lines (68 loc) · 2.2 KB
Breadcrumbs
wp2static
/
wp2static.php
Copy path
File metadata and controls
executable file
·
81 lines (68 loc) · 2.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Plugin Name: WP2Static
* Plugin URI: https://wp2static.com
* Description: Static site generator functionality for WordPress.
* Version: 8.5.0
* Author: WP2Static
* Author URI: https://wp2static.com
* Text Domain: wp2static
*
* @package WP2Static
*/
if
( !
defined
(
'
ABSPATH
'
) ) {
die;
}
define
(
'
WP2STATIC_VERSION
'
,
'
8.5.0
'
);
define
(
'
WP2STATIC_PATH
'
,
plugin_dir_path
(
__FILE__
) );
if
(
file_exists
(
WP2STATIC_PATH
.
'
vendor/autoload.php
'
) ) {
require_once
WP2STATIC_PATH
.
'
vendor/autoload.php
'
;
}
if
( !
class_exists
(
'
WP2Static\Controller
'
) ) {
if
(
file_exists
(
WP2STATIC_PATH
.
'
src/WP2StaticException.php
'
) ) {
require_once
WP2STATIC_PATH
.
'
src/WP2StaticException.php
'
;
throw
new
WP2Static
\
WP2StaticException
(
'
Looks like you
\'
re trying to activate WP2Static from source code
'
.
'
, without compiling it first. Please see
'
.
'
https://wp2static.com/compiling-from-source for assistance.
'
);
}
}
WP2Static
\Controller::
init
(
__FILE__
);
/**
* Define Settings link for plugin
*
* @param string[] $links array of links
* @return string[] modified array of links
*/
function
plugin_action_links
(
$
links
) {
$
settings_link
=
'
<a href="admin.php?page=wp2static">
'
.
__
(
'
Settings
'
,
'
static-html-output-plugin
'
) .
'
</a>
'
;
array_unshift
(
$
links
,
$
settings_link
);
return
$
links
;
}
add_filter
(
'
plugin_action_links_
'
.
plugin_basename
(
__FILE__
),
'
plugin_action_links
'
);
/**
* Prevent WP scripts from loading which aren't useful
* on a statically exported site
*/
function
wp2static_deregister_scripts
():
void
{
wp_dequeue_script
(
'
wp-embed
'
);
wp_deregister_script
(
'
wp-embed
'
);
wp_dequeue_script
(
'
comment-reply
'
);
wp_deregister_script
(
'
comment-reply
'
);
}
add_action
(
'
wp_footer
'
,
'
wp2static_deregister_scripts
'
);
// TODO: move into own plugin for WP cleanup, don't belong in core
remove_action
(
'
wp_head
'
,
'
wlwmanifest_link
'
);
remove_action
(
'
wp_head
'
,
'
print_emoji_detection_script
'
,
7
);
remove_action
(
'
wp_print_styles
'
,
'
print_emoji_styles
'
);
if
(
defined
(
'
WP_CLI
'
) ) {
WP_CLI
::
add_command
(
'
wp2static
'
,
WP2Static
\
CLI
::class );
}
Back
|
FazBrowse Home
|
New Git URL