This repository has been archived by the owner on Aug 20, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsample-plugin.php
89 lines (69 loc) · 1.57 KB
/
sample-plugin.php
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
82
83
84
85
86
87
88
89
<?php
/**
* Register, minify and unify CSS and JavaScript resources.
*
* @author Josantonius <hello@josantonius.com>
* @package Josantonius\WP_Register
* @copyright 2017 - 2018 (c) Josantonius - WP_Register
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
* @link https://github.com/Josantonius/WP_Register
* @since 1.0.4
*/
create_files();
/**
* Create files for testing environment.
*/
function create_files() {
$css = WP_CORE_DIR . 'wp-content/themes/tests/css/';
$js = WP_CORE_DIR . 'wp-content/themes/tests/js/';
if ( ! is_dir( $css ) ) {
mkdir( $css, 0777, true );
}
if ( ! is_dir( $js ) ) {
mkdir( $js, 0777, true );
}
if ( ! file_exists( $css . 'editor-style.css' ) ) {
file_put_contents(
$css . 'editor-style.css', "
body, h1, h2, h3, h4, h5, h6 {
font-family: 'Open Sans', sans-serif;
}
body {
font-size: 1.6em;
line-height: 1.6;
}
"
);
}
if ( ! file_exists( $css . 'style.css' ) ) {
file_put_contents(
$css . 'style.css', "
body, h1, h2, h3, h4, h5, h6 {
font-family: 'Open Sans', sans-serif;
}
body {
font-size: 1.6em;
line-height: 1.6;
}
"
);
}
if ( ! file_exists( $js . 'html5.js' ) ) {
file_put_contents(
$js . 'html5.js', "
function myFunction() {
document.getElementById('myCheck').click();
}
"
);
}
if ( ! file_exists( $js . 'navigation.js' ) ) {
file_put_contents(
$js . 'navigation.js', "
$('p').click(function(){
alert('The paragraph was clicked.');
});
"
);
}
}