Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 7910d6b

Browse files
authored
Merge pull request #109 from xwp/develop
0.6.0 RC1
2 parents 7d1e373 + 0374987 commit 7910d6b

38 files changed

+7009
-3326
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ node_js:
1313

1414
env:
1515
- WP_VERSION=trunk WP_MULTISITE=0
16+
- WP_VERSION=latest WP_MULTISITE=0
17+
- WP_VERSION=4.6.1 WP_MULTISITE=0
1618
- WP_VERSION=latest WP_MULTISITE=1
1719

1820
install:

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "xwp/wp-customize-snapshots",
33
"description": "Allow Customizer states to be drafted, and previewed with a private URL.",
4-
"version": "0.5.2",
4+
"version": "0.6.0",
55
"type": "wordpress-plugin",
66
"homepage": "https://github.com/xwp/wp-customize-snapshots",
77
"license": "GPL-2.0+",

css/customize-snapshots-admin.css

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
details.snapshot-setting-removed summary {
2+
text-decoration: line-through;
3+
}
4+
details:not(.snapshot-setting-removed) .snapshot-toggle-setting-removal {
5+
color: #a00
6+
}
7+
details:not(.snapshot-setting-removed) .snapshot-toggle-setting-removal:hover {
8+
color: #f00
9+
}
10+
details .snapshot-toggle-setting-removal {
11+
float: right;
12+
}

css/customize-snapshots.css

+170-23
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#snapshot-preview-link,
2-
#snapshot-schedule-button {
2+
#snapshot-expand-button {
33
float: right;
44
margin-top: 13px;
55
margin-right: 4px;
66
color: #656a6f;
77
}
88

9-
#snapshot-schedule-button {
9+
#snapshot-expand-button {
1010
display: block;
1111
}
12-
#snapshot-schedule-button:hover,
13-
#snapshot-schedule-button:focus,
14-
#snapshot-schedule-button:active {
12+
13+
#snapshot-expand-button:hover,
14+
#snapshot-expand-button:focus,
15+
#snapshot-expand-button:active {
1516
color: #191e23;
1617
}
1718

@@ -64,36 +65,38 @@
6465
}
6566
}
6667

67-
#snapshot-schedule {
68+
#customize-snapshot {
6869
background: #fff !important;
6970
border-bottom: 1px solid #ddd;
7071
line-height: 1.5;
7172
left: 0;
7273
top: 46px;
7374
position: absolute;
7475
width: 100%;
75-
box-shadow: 0 5px 0 0 rgba(0,0,0,0.05);
76-
padding:10px;
76+
box-shadow: 0 5px 0 0 rgba(0, 0, 0, 0.05);
77+
padding: 10px;
7778
box-sizing: border-box;
7879
}
7980

80-
#snapshot-schedule .snapshot-schedule-title {
81+
#customize-snapshot .snapshot-schedule-title {
8182
color: #555;
8283
}
8384

84-
#snapshot-schedule .snapshot-schedule-title h3 {
85+
#customize-snapshot .snapshot-schedule-title h3 {
8586
margin: .2em 2em .75em 0;
8687
}
8788

88-
#snapshot-schedule .snapshot-schedule-description {
89+
#customize-snapshot .snapshot-schedule-description {
8990
margin-bottom: 0.5em;
91+
margin-top: 0;
9092
}
91-
#snapshot-schedule .timezone-info {
93+
94+
#customize-snapshot .timezone-info {
9295
margin-top: 0.5em;
9396
font-size: smaller;
9497
}
9598

96-
#snapshot-schedule a.snapshot-edit-link {
99+
#customize-snapshot a.snapshot-edit-link {
97100
position: absolute;
98101
top: 4px;
99102
right: 1px;
@@ -109,12 +112,12 @@
109112
padding: 10px;
110113
}
111114

112-
#snapshot-schedule a.snapshot-edit-link:focus,
113-
#snapshot-schedule a.snapshot-edit-link:hover {
115+
#customize-snapshot a.snapshot-edit-link:focus,
116+
#customize-snapshot a.snapshot-edit-link:hover {
114117
color: #0073aa;
115118
}
116119

117-
#snapshot-schedule a.snapshot-edit-link:before {
120+
#customize-snapshot a.snapshot-edit-link:before {
118121
padding: 4px;
119122
position: absolute;
120123
top: 5px;
@@ -123,7 +126,7 @@
123126
border-radius: 100%;
124127
}
125128

126-
#snapshot-schedule a.snapshot-edit-link:focus:before {
129+
#customize-snapshot a.snapshot-edit-link:focus:before {
127130
-webkit-box-shadow:
128131
0 0 0 1px #5b9dd9,
129132
0 0 2px 1px rgba(30, 140, 190, .8);
@@ -132,11 +135,11 @@
132135
0 0 2px 1px rgba(30, 140, 190, .8);
133136
}
134137

135-
#snapshot-schedule .accordion-section-title {
138+
#customize-snapshot .accordion-section-title {
136139
padding: 10px;
137140
}
138141

139-
#snapshot-schedule .reset-time {
142+
#customize-snapshot .reset-time {
140143
font-weight: normal;
141144
font-size: 80%;
142145
display: none;
@@ -168,13 +171,13 @@
168171
min-width: 4em;
169172
}
170173

171-
.snapshot-schedule-control input[type="number"]{
172-
width:100%;
174+
.snapshot-schedule-control input[type="number"] {
175+
width: 100%;
173176
}
174177

175178
.snapshot-schedule-control .time-special-char {
176-
padding-left:2px;
177-
padding-right:2px;
179+
padding-left: 2px;
180+
padding-right: 2px;
178181
}
179182

180183
.snapshot-schedule-control select {
@@ -201,3 +204,147 @@
201204
.select2-container {
202205
z-index: 500100 !important;
203206
}
207+
208+
.snapshot-control input[type="text"] {
209+
width: 100%;
210+
line-height: 18px;
211+
margin: 0;
212+
}
213+
214+
#customize-snapshot .snapshot-schedule-title h3 {
215+
font-size: 16px;
216+
}
217+
218+
#customize-snapshot .snapshot-controls {
219+
list-style: none;
220+
margin: 0;
221+
}
222+
223+
.snapshot-future-date-notification.notice {
224+
margin-bottom: 5px;
225+
border-top: 1px solid #eee;
226+
padding: 5px;
227+
}
228+
229+
/*Status Button*/
230+
/** @todo Need to add snapshot specific class for all ui classes. **/
231+
232+
#snapshot-status-button-wrapper {
233+
float: right;
234+
position: relative;
235+
margin-top: 9px;
236+
height: 28px;
237+
}
238+
239+
#snapshot-status-button-wrapper .button-primary {
240+
margin-top: 0;
241+
-webkit-touch-callout: none; /* iOS Safari */
242+
-webkit-user-select: none; /* Chrome/Safari/Opera */
243+
-moz-user-select: none; /* Firefox */
244+
-ms-user-select: none; /* Internet Explorer/Edge */
245+
user-select: none;
246+
}
247+
248+
.snapshot-status-button-wrapper .button:active{
249+
-webkit-transform: none;
250+
-moz-transform: none;
251+
-ms-transform: none;
252+
-o-transform: none;
253+
transform: none; /* 4.7 added translateY(1px) */
254+
}
255+
256+
.ui-selectmenu-menu {
257+
padding: 0;
258+
margin: 0;
259+
position: absolute;
260+
top: 0;
261+
left: 0;
262+
display: none;
263+
}
264+
265+
.ui-selectmenu-menu .ui-menu {
266+
overflow: auto;
267+
margin: 0;
268+
margin-top: 2px;
269+
overflow-x: hidden;
270+
background: #FFFFFF;
271+
border-top: 0;
272+
border-radius: 0 0 5px 5px;
273+
box-shadow: 0 1px 4px 0 rgba(33, 38, 34, .12), 0 2px 11px 0 rgba(30, 36, 37, .14)
274+
}
275+
276+
.ui-selectmenu-menu .ui-menu li {
277+
padding: 5px 10px 5px 5px;
278+
margin: 0;
279+
}
280+
281+
.ui-selectmenu-menu .ui-menu .ui-state-focus {
282+
background: #0073aa;
283+
color: #FFFFFF;
284+
cursor: pointer;
285+
}
286+
287+
.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
288+
font-size: 1em;
289+
font-weight: bold;
290+
line-height: 1.5;
291+
padding: 2px 0.4em;
292+
margin: 0.5em 0 0 0;
293+
height: auto;
294+
border: 0;
295+
}
296+
297+
.ui-selectmenu-open {
298+
display: block;
299+
}
300+
301+
#snapshot-status-button-wrapper .ui-selectmenu-button span.dashicons {
302+
text-indent: 0;
303+
float: right;
304+
border-radius: 0 3px 3px 0;
305+
padding-left: 0;
306+
padding-right: 0;
307+
-webkit-box-shadow: none;
308+
-moz-box-shadow: none;
309+
box-shadow: none;
310+
font-size: 20px;
311+
width: 20px;
312+
}
313+
314+
#snapshot-status-button-wrapper .ui-selectmenu-button span.dashicons:before {
315+
display: inline-block;
316+
margin-left: -3px;
317+
}
318+
319+
@media screen and ( max-width: 640px ) {
320+
#snapshot-status-button-wrapper .ui-selectmenu-button span.dashicons {
321+
font-size: 17px;
322+
}
323+
}
324+
325+
.ui-selectmenu-button span.ui-selectmenu-text {
326+
border-radius: 3px 0 0 3px;
327+
opacity: 0;
328+
}
329+
330+
.ui-selectmenu-menu.ui-front {
331+
z-index: 999999;
332+
}
333+
334+
.snapshot-status-button-overlay.button {
335+
width: calc( 100% - 20px );
336+
height: 28px;
337+
position: absolute;
338+
top: 0;
339+
left: 0;
340+
z-index: 1;
341+
border-radius: 3px 0 0 3px;
342+
box-shadow: none;
343+
}
344+
345+
#customize-header-actions .ui-selectmenu-button {
346+
display: inline-block;
347+
outline-width: 2px;
348+
outline-offset: -2px;
349+
}
350+

customize-snapshots.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Customize Snapshots
44
* Plugin URI: https://github.com/xwp/wp-customize-snapshots
55
* Description: Allow Customizer states to be drafted, and previewed with a private URL.
6-
* Version: 0.5.2
6+
* Version: 0.6.0-rc1
77
* Author: XWP
88
* Author URI: https://xwp.co/
99
* License: GPLv2+

instance.php

+22-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ function get_plugin_instance() {
3333
* @return bool Whether previewing settings.
3434
*/
3535
function is_previewing_settings() {
36-
return get_plugin_instance()->customize_snapshot_manager->is_previewing_settings();
36+
$manager = get_plugin_instance()->customize_snapshot_manager;
37+
if ( get_plugin_instance()->compat ) {
38+
return $manager->is_previewing_settings();
39+
} else {
40+
return ( isset( $manager->customize_manager ) && $manager->customize_manager->is_preview() ) || did_action( 'customize_preview_init' );
41+
}
3742
}
3843

3944
/**
@@ -51,3 +56,19 @@ function current_snapshot_uuid() {
5156
return $customize_snapshot_uuid;
5257
}
5358
}
59+
60+
/**
61+
* Returns whether it is back compat or not.
62+
*
63+
* @return bool is compat.
64+
*/
65+
function is_back_compat() {
66+
$wp_version = get_bloginfo( 'version' );
67+
68+
// Fix in case version contains extra string for example 4.7-src in that case php version_compare fails.
69+
$pos = strpos( $wp_version, '-' );
70+
if ( false !== $pos ) {
71+
$wp_version = substr( $wp_version, 0, $pos );
72+
}
73+
return version_compare( $wp_version, '4.7', '<' );
74+
}
File renamed without changes.

js/customize-snapshots-preview.js js/compat/customize-snapshots-preview.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ var CustomizeSnapshotsPreview = (function( api, $ ) {
194194

195195
// Now preventDefault as is done on the normal submit.preview handler in customize-preview.js.
196196
event.preventDefault();
197-
});
197+
} );
198198
};
199199

200200
return component;

0 commit comments

Comments
 (0)