Version Description
- [Fixed] Compatible with WordPress 4.8
- [Fixed] Padding generator will automatically add 'px' to numbers
- [Added] Added filter to hide banner
add_filter( 'cpsh_show_banner', '__return_false' );
- [Improved] UI improvements for better readability
Download this release
Release Info
Developer | tschutter |
Plugin | Column Shortcodes |
Version | 1.0 |
Comparing to | |
See all releases |
Code changes from version 0.6.9 to 1.0
- assets/css/admin.css +434 -30
- assets/images/ac_vignet_grey.svg +13 -0
- assets/js/admin.js +68 -38
- assets/js/plugins.js +17 -0
- column-shortcodes.php +320 -145
- readme.txt +9 -3
assets/css/admin.css
CHANGED
@@ -1,9 +1,23 @@
|
|
1 |
/* =Popup
|
2 |
-------------------------------------------------------------- */
|
3 |
#cpsh {
|
4 |
-
margin-top: 13px;
|
5 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
}
|
|
|
7 |
#cpsh .cpsh-title {
|
8 |
display: block;
|
9 |
height: 20px;
|
@@ -15,18 +29,326 @@
|
|
15 |
color: #666;
|
16 |
font-size: 13px;
|
17 |
}
|
|
|
18 |
#cpsh #cpsh-generator-header {
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
overflow: hidden;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
/* =Shortcodes
|
25 |
-------------------------------------------------------------- */
|
26 |
#cpsh .cpsh-shortcodes {
|
27 |
float: left;
|
28 |
width: 50%;
|
29 |
}
|
|
|
30 |
#cpsh .columns {
|
31 |
display: block;
|
32 |
height: 20px;
|
@@ -37,29 +359,98 @@
|
|
37 |
text-decoration: none;
|
38 |
background: transparent url(../images/columns.png) no-repeat left 6px;
|
39 |
}
|
40 |
-
|
41 |
-
#cpsh .cp-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
#cpsh .cp-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
#cpsh .cp-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
#cpsh .cp-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
#cpsh .cp-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
#cpsh .cp-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
/* =Settings
|
65 |
-------------------------------------------------------------- */
|
@@ -67,9 +458,11 @@
|
|
67 |
float: right;
|
68 |
width: 50%;
|
69 |
}
|
|
|
70 |
#preview-padding {
|
71 |
margin: 10px 0;
|
72 |
}
|
|
|
73 |
#preview-padding .column-container {
|
74 |
width: 200px;
|
75 |
max-height: 370px;
|
@@ -77,46 +470,57 @@
|
|
77 |
background: #f3fcff;
|
78 |
position: relative;
|
79 |
}
|
|
|
80 |
#preview-padding .column-inner {
|
81 |
border: 1px solid #fff;
|
82 |
background: #fff;
|
83 |
height: 130px;
|
84 |
}
|
|
|
85 |
#preview-padding .padding-fields input {
|
86 |
position: absolute;
|
87 |
-
width:
|
88 |
border: 1px solid #DFDFDF;
|
89 |
border-radius: 3px 3px 3px 3px;
|
90 |
margin: 0;
|
|
|
91 |
text-align: center;
|
|
|
|
|
92 |
}
|
|
|
93 |
#preview-padding .padding-fields input#padding-top {
|
94 |
top: 10px;
|
95 |
left: 50%;
|
96 |
-
margin-left: -
|
97 |
}
|
|
|
98 |
#preview-padding .padding-fields input#padding-right {
|
99 |
top: 50%;
|
100 |
margin-top: -10px;
|
101 |
right: 10px;
|
102 |
}
|
|
|
103 |
#preview-padding .padding-fields input#padding-bottom {
|
104 |
bottom: 10px;
|
105 |
left: 50%;
|
106 |
-
margin-left: -
|
107 |
}
|
|
|
108 |
#preview-padding .padding-fields input#padding-left {
|
109 |
top: 50%;
|
110 |
margin-top: -10px;
|
111 |
left: 10px;
|
112 |
}
|
113 |
-
|
|
|
114 |
color: #097BB4;
|
115 |
text-decoration: none;
|
116 |
display: inline-block;
|
117 |
padding-left: 3px;
|
118 |
padding-top: 3px;
|
119 |
}
|
|
|
120 |
/*
|
121 |
#TB_window #preview-padding .column-container .padding-reset {
|
122 |
margin-top: -6px;
|
1 |
/* =Popup
|
2 |
-------------------------------------------------------------- */
|
3 |
#cpsh {
|
|
|
4 |
width: 100%;
|
5 |
+
height: calc(100% - 30px);
|
6 |
+
position: absolute;
|
7 |
+
top: 30px;
|
8 |
+
left: 0;
|
9 |
+
box-sizing: border-box;
|
10 |
+
}
|
11 |
+
|
12 |
+
#cpsh #cpsh-generator-shell {
|
13 |
+
padding: 20px;
|
14 |
+
background: #f1f1f1;
|
15 |
+
box-sizing: border-box;
|
16 |
+
width: 100%;
|
17 |
+
height: 100%;
|
18 |
+
overflow: scroll;
|
19 |
}
|
20 |
+
|
21 |
#cpsh .cpsh-title {
|
22 |
display: block;
|
23 |
height: 20px;
|
29 |
color: #666;
|
30 |
font-size: 13px;
|
31 |
}
|
32 |
+
|
33 |
#cpsh #cpsh-generator-header {
|
34 |
+
float: left;
|
35 |
+
width: 66%;
|
36 |
+
padding: 20px;
|
37 |
+
overflow: hidden;
|
38 |
+
box-sizing: border-box;
|
39 |
+
background: none repeat scroll 0 0 #FFFFFF;
|
40 |
+
border: 1px solid #dedede;
|
41 |
+
border-radius: 0 0 0 0;
|
42 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
43 |
+
}
|
44 |
+
|
45 |
+
#cpsh #cpsh-generator-sidebar {
|
46 |
+
width: 34%;
|
47 |
+
float: right;
|
48 |
+
padding-left: 20px;
|
49 |
+
box-sizing: border-box;
|
50 |
+
}
|
51 |
+
|
52 |
+
@media only screen and (max-width: 792px) {
|
53 |
+
#cpsh #cpsh-generator-header {
|
54 |
+
width: 100%;
|
55 |
+
}
|
56 |
+
|
57 |
+
#cpsh-generator-sidebar {
|
58 |
+
display: none;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
/* =Sidebar
|
63 |
+
-------------------------------------------------------------- */
|
64 |
+
#cpsh-generator-sidebar .sidebox {
|
65 |
+
background: none repeat scroll 0 0 #FFFFFF;
|
66 |
+
border: 1px solid #dedede;
|
67 |
+
border-radius: 0 0 0 0;
|
68 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
69 |
+
position: relative;
|
70 |
+
margin-bottom: 14px;
|
71 |
+
}
|
72 |
+
|
73 |
+
#cpsh-generator-sidebar .sidebox h3 {
|
74 |
+
padding: 10px;
|
75 |
+
margin: 0;
|
76 |
+
position: relative;
|
77 |
+
}
|
78 |
+
|
79 |
+
#cpsh-generator-sidebar .sidebox h3.title {
|
80 |
+
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
81 |
+
font-size: 15px;
|
82 |
+
font-weight: normal;
|
83 |
+
line-height: 1;
|
84 |
+
margin: 0;
|
85 |
+
padding: 7px 10px;
|
86 |
+
background: #f1f1f1;
|
87 |
+
background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9));
|
88 |
+
background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9);
|
89 |
+
background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9);
|
90 |
+
background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9);
|
91 |
+
background-image: linear-gradient(to top, #ececec, #f9f9f9);
|
92 |
+
border-bottom-color: #dfdfdf;
|
93 |
+
text-shadow: #fff 0 1px 0;
|
94 |
+
-webkit-box-shadow: 0 1px 0 #fff;
|
95 |
+
box-shadow: 0 1px 0 #fff;
|
96 |
+
border-bottom-style: solid;
|
97 |
+
border-bottom-width: 1px;
|
98 |
+
}
|
99 |
+
|
100 |
+
#cpsh-generator-sidebar .sidebox h3 span.left {
|
101 |
+
position: relative;
|
102 |
+
background: #fff;
|
103 |
+
z-index: 2;
|
104 |
+
padding-right: 8px;
|
105 |
+
}
|
106 |
+
|
107 |
+
#cpsh-generator-sidebar .sidebox h3 span.contenttype {
|
108 |
+
display: block;
|
109 |
+
line-height: 20px;
|
110 |
+
font-size: 12px;
|
111 |
+
text-transform: uppercase;
|
112 |
+
color: #808080;
|
113 |
+
margin-top: 4px;
|
114 |
+
}
|
115 |
+
|
116 |
+
#cpsh-generator-sidebar .sidebox h3 span.contenttype.right {
|
117 |
+
position: absolute;
|
118 |
+
display: inline-block;
|
119 |
+
z-index: 1;
|
120 |
+
right: 10px;
|
121 |
+
text-align: right;
|
122 |
+
margin-top: 0;
|
123 |
+
}
|
124 |
+
|
125 |
+
#cpsh-generator-sidebar .sidebox .inside {
|
126 |
+
padding: 10px;
|
127 |
+
}
|
128 |
+
|
129 |
+
#cpsh-generator-sidebar .sidebox .inside p {
|
130 |
+
padding: 0;
|
131 |
+
margin-top: 0;
|
132 |
+
}
|
133 |
+
|
134 |
+
#cpsh-generator-sidebar .sidebox.form-actions .form-reset {
|
135 |
+
display: none;
|
136 |
+
border-bottom: 1px solid #F5F5F5;
|
137 |
+
padding: 8px;
|
138 |
+
}
|
139 |
+
|
140 |
+
#cpsh-generator-sidebar .sidebox.form-actions .reset-column-type {
|
141 |
+
text-decoration: none;
|
142 |
+
color: #BC0B0B;
|
143 |
+
line-height: 25px;
|
144 |
+
display: inline-block;
|
145 |
+
background: none;
|
146 |
+
border: none;
|
147 |
+
padding: 0;
|
148 |
+
font-size: 13px;
|
149 |
+
cursor: pointer;
|
150 |
+
margin: 0;
|
151 |
+
}
|
152 |
+
|
153 |
+
#cpsh-generator-sidebar .sidebox.form-actions .reset-column-type:hover {
|
154 |
+
color: #f00;
|
155 |
+
}
|
156 |
+
|
157 |
+
#cpsh-generator-sidebar .sidebox.form-actions .form-update {
|
158 |
+
padding: 8px;
|
159 |
overflow: hidden;
|
160 |
}
|
161 |
|
162 |
+
#cpsh-generator-sidebar .sidebox.form-actions .submit {
|
163 |
+
display: none;
|
164 |
+
width: 100%;
|
165 |
+
height: 28px;
|
166 |
+
line-height: 28px;
|
167 |
+
text-align: center;
|
168 |
+
}
|
169 |
+
|
170 |
+
#cpsh-generator-sidebar .sidebox.form-actions .submit.save {
|
171 |
+
display: block;
|
172 |
+
}
|
173 |
+
|
174 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback #feedback-support,
|
175 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback #feedback-rate {
|
176 |
+
display: none;
|
177 |
+
}
|
178 |
+
|
179 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside > a {
|
180 |
+
border-radius: 4px;
|
181 |
+
border: 1px solid #CCC;
|
182 |
+
width: 48%;
|
183 |
+
height: 64px;
|
184 |
+
text-align: center;
|
185 |
+
line-height: 64px;
|
186 |
+
font-weight: bold;
|
187 |
+
color: #222;
|
188 |
+
display: inline-block;
|
189 |
+
text-decoration: none;
|
190 |
+
}
|
191 |
+
|
192 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside > a:hover {
|
193 |
+
background: #FAFAFA;
|
194 |
+
}
|
195 |
+
|
196 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside form textarea {
|
197 |
+
width: 100%;
|
198 |
+
height: 120px;
|
199 |
+
}
|
200 |
+
|
201 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside form input[type="submit"] {
|
202 |
+
display: inline-block;
|
203 |
+
float: right;
|
204 |
+
border-radius: 4px;
|
205 |
+
border: 1px solid #CCC;
|
206 |
+
height: 32px;
|
207 |
+
text-align: center;
|
208 |
+
line-height: 32px;
|
209 |
+
font-weight: bold;
|
210 |
+
font-size: 12px;
|
211 |
+
padding: 0 32px;
|
212 |
+
color: #CCC;
|
213 |
+
background: none;
|
214 |
+
text-decoration: none;
|
215 |
+
cursor: pointer;
|
216 |
+
}
|
217 |
+
|
218 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside form input[type="submit"]:hover {
|
219 |
+
background: #FAFAFA;
|
220 |
+
}
|
221 |
+
|
222 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside form p.description {
|
223 |
+
float: left;
|
224 |
+
font-size: 10px;
|
225 |
+
}
|
226 |
+
|
227 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside ul {
|
228 |
+
margin: 0;
|
229 |
+
}
|
230 |
+
|
231 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside ul.share li {
|
232 |
+
margin: 0;
|
233 |
+
display: block;
|
234 |
+
float: left;
|
235 |
+
margin-left: 9px;
|
236 |
+
width: 47%;
|
237 |
+
box-sizing: border-box;
|
238 |
+
}
|
239 |
+
|
240 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside ul.share li a {
|
241 |
+
text-decoration: none;
|
242 |
+
vertical-align: middle;
|
243 |
+
line-height: 20px;
|
244 |
+
padding: 16px 0;
|
245 |
+
width: 100%;
|
246 |
+
text-align: center;
|
247 |
+
border: 1px solid #CCC;
|
248 |
+
border-radius: 4px;
|
249 |
+
display: block;
|
250 |
+
}
|
251 |
+
|
252 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside ul.share li a:hover {
|
253 |
+
background: #FAFAFA;
|
254 |
+
}
|
255 |
+
|
256 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback .inside ul.share li:first-child {
|
257 |
+
margin-left: 0;
|
258 |
+
}
|
259 |
+
|
260 |
+
#cpsh-generator-sidebar .sidebox#cpsh-sidebox-feedback #feedback-support .inside ul.share li {
|
261 |
+
width: 100%;
|
262 |
+
}
|
263 |
+
|
264 |
+
.cs-acsidebox {
|
265 |
+
background: none;
|
266 |
+
}
|
267 |
+
|
268 |
+
.cs-acsidebox__wrapper {
|
269 |
+
padding: 15px 12px;
|
270 |
+
background: #3d4350;
|
271 |
+
color: #fff;
|
272 |
+
}
|
273 |
+
|
274 |
+
.cs-acsidebox__button {
|
275 |
+
display: inline-block;
|
276 |
+
border-radius: 4px;
|
277 |
+
height: 38px;
|
278 |
+
line-height: 38px;
|
279 |
+
background-color: #ffee85;
|
280 |
+
color: #3d4350;
|
281 |
+
text-decoration: none;
|
282 |
+
font-weight: 400;
|
283 |
+
padding-left: 10px;
|
284 |
+
padding-right: 15px;
|
285 |
+
margin-bottom: 18px;
|
286 |
+
}
|
287 |
+
|
288 |
+
.cs-acsidebox__button:hover {
|
289 |
+
background-color: #fff4af;
|
290 |
+
color: #3d4350;
|
291 |
+
}
|
292 |
+
|
293 |
+
.cs-acsidebox__button__logo {
|
294 |
+
height: auto;
|
295 |
+
width: 30px;
|
296 |
+
display: inline-block;
|
297 |
+
margin-top: -3px;
|
298 |
+
vertical-align: middle;
|
299 |
+
margin-right: 5px;
|
300 |
+
}
|
301 |
+
|
302 |
+
.cs-acsidebox .cs-acsidebox__intro {
|
303 |
+
margin-top: 0;
|
304 |
+
margin-bottom: 18px;
|
305 |
+
padding-top: 0 !important;
|
306 |
+
}
|
307 |
+
|
308 |
+
.cs-acsidebox__footer {
|
309 |
+
padding-top: 0 !important;
|
310 |
+
margin-bottom: 0;
|
311 |
+
margin-top: 0;
|
312 |
+
color: #acb3c3;
|
313 |
+
}
|
314 |
+
|
315 |
+
.cs-acsidebox__footer em {
|
316 |
+
color: #fff;
|
317 |
+
font-style: normal;
|
318 |
+
}
|
319 |
+
|
320 |
+
.cs-acsidebox__stars {
|
321 |
+
white-space: nowrap;
|
322 |
+
margin-bottom: 5px;
|
323 |
+
}
|
324 |
+
|
325 |
+
.cs-acsidebox__stars .dashicons {
|
326 |
+
color: #ffee85;
|
327 |
+
display: inline-block;
|
328 |
+
vertical-align: middle;
|
329 |
+
margin-right: -2px;
|
330 |
+
margin-top: -4px;
|
331 |
+
}
|
332 |
+
|
333 |
+
.cs-acsidebox__stars_count {
|
334 |
+
margin-left: 5px;
|
335 |
+
}
|
336 |
+
|
337 |
+
.cs-acsidebox__link {
|
338 |
+
color: #fff;
|
339 |
+
}
|
340 |
+
|
341 |
+
.cs-acsidebox__link:focus {
|
342 |
+
color: #0073aa;
|
343 |
+
}
|
344 |
+
|
345 |
/* =Shortcodes
|
346 |
-------------------------------------------------------------- */
|
347 |
#cpsh .cpsh-shortcodes {
|
348 |
float: left;
|
349 |
width: 50%;
|
350 |
}
|
351 |
+
|
352 |
#cpsh .columns {
|
353 |
display: block;
|
354 |
height: 20px;
|
359 |
text-decoration: none;
|
360 |
background: transparent url(../images/columns.png) no-repeat left 6px;
|
361 |
}
|
362 |
+
|
363 |
+
#cpsh .cp-one_half {
|
364 |
+
background-position: left 6px;
|
365 |
+
}
|
366 |
+
|
367 |
+
#cpsh .cp-one_half_last {
|
368 |
+
background-position: left -14px;
|
369 |
+
}
|
370 |
+
|
371 |
+
#cpsh .cp-one_third {
|
372 |
+
background-position: left -34px;
|
373 |
+
}
|
374 |
+
|
375 |
+
#cpsh .cp-one_third_last {
|
376 |
+
background-position: left -54px;
|
377 |
+
}
|
378 |
+
|
379 |
+
#cpsh .cp-two_third {
|
380 |
+
background-position: left -74px;
|
381 |
+
}
|
382 |
+
|
383 |
+
#cpsh .cp-two_third_last {
|
384 |
+
background-position: left -94px;
|
385 |
+
}
|
386 |
+
|
387 |
+
#cpsh .cp-one_fourth {
|
388 |
+
background-position: left -114px;
|
389 |
+
}
|
390 |
+
|
391 |
+
#cpsh .cp-one_fourth_last {
|
392 |
+
background-position: left -134px;
|
393 |
+
}
|
394 |
+
|
395 |
+
#cpsh .cp-three_fourth {
|
396 |
+
background-position: left -154px;
|
397 |
+
}
|
398 |
+
|
399 |
+
#cpsh .cp-three_fourth_last {
|
400 |
+
background-position: left -174px;
|
401 |
+
}
|
402 |
+
|
403 |
+
#cpsh .cp-one_fifth {
|
404 |
+
background-position: left -194px;
|
405 |
+
}
|
406 |
+
|
407 |
+
#cpsh .cp-one_fifth_last {
|
408 |
+
background-position: left -214px;
|
409 |
+
}
|
410 |
+
|
411 |
+
#cpsh .cp-two_fifth {
|
412 |
+
background-position: left -234px;
|
413 |
+
}
|
414 |
+
|
415 |
+
#cpsh .cp-two_fifth_last {
|
416 |
+
background-position: left -254px;
|
417 |
+
}
|
418 |
+
|
419 |
+
#cpsh .cp-three_fifth {
|
420 |
+
background-position: left -274px;
|
421 |
+
}
|
422 |
+
|
423 |
+
#cpsh .cp-three_fifth_last {
|
424 |
+
background-position: left -294px;
|
425 |
+
}
|
426 |
+
|
427 |
+
#cpsh .cp-four_fifth {
|
428 |
+
background-position: left -314px;
|
429 |
+
}
|
430 |
+
|
431 |
+
#cpsh .cp-four_fifth_last {
|
432 |
+
background-position: left -334px;
|
433 |
+
}
|
434 |
+
|
435 |
+
#cpsh .cp-one_sixth {
|
436 |
+
background-position: left -354px;
|
437 |
+
}
|
438 |
+
|
439 |
+
#cpsh .cp-one_sixth_last {
|
440 |
+
background-position: left -374px;
|
441 |
+
}
|
442 |
+
|
443 |
+
#cpsh .cp-five_sixth {
|
444 |
+
background-position: left -394px;
|
445 |
+
}
|
446 |
+
|
447 |
+
#cpsh .cp-five_sixth_last {
|
448 |
+
background-position: left -414px;
|
449 |
+
}
|
450 |
+
|
451 |
+
#cpsh .cp-full_width {
|
452 |
+
background-position: left -434px;
|
453 |
+
}
|
454 |
|
455 |
/* =Settings
|
456 |
-------------------------------------------------------------- */
|
458 |
float: right;
|
459 |
width: 50%;
|
460 |
}
|
461 |
+
|
462 |
#preview-padding {
|
463 |
margin: 10px 0;
|
464 |
}
|
465 |
+
|
466 |
#preview-padding .column-container {
|
467 |
width: 200px;
|
468 |
max-height: 370px;
|
470 |
background: #f3fcff;
|
471 |
position: relative;
|
472 |
}
|
473 |
+
|
474 |
#preview-padding .column-inner {
|
475 |
border: 1px solid #fff;
|
476 |
background: #fff;
|
477 |
height: 130px;
|
478 |
}
|
479 |
+
|
480 |
#preview-padding .padding-fields input {
|
481 |
position: absolute;
|
482 |
+
width: 44px;
|
483 |
border: 1px solid #DFDFDF;
|
484 |
border-radius: 3px 3px 3px 3px;
|
485 |
margin: 0;
|
486 |
+
font-size: 13px;
|
487 |
text-align: center;
|
488 |
+
padding-left: 2px;
|
489 |
+
padding-right: 2px;
|
490 |
}
|
491 |
+
|
492 |
#preview-padding .padding-fields input#padding-top {
|
493 |
top: 10px;
|
494 |
left: 50%;
|
495 |
+
margin-left: -22px;
|
496 |
}
|
497 |
+
|
498 |
#preview-padding .padding-fields input#padding-right {
|
499 |
top: 50%;
|
500 |
margin-top: -10px;
|
501 |
right: 10px;
|
502 |
}
|
503 |
+
|
504 |
#preview-padding .padding-fields input#padding-bottom {
|
505 |
bottom: 10px;
|
506 |
left: 50%;
|
507 |
+
margin-left: -22px;
|
508 |
}
|
509 |
+
|
510 |
#preview-padding .padding-fields input#padding-left {
|
511 |
top: 50%;
|
512 |
margin-top: -10px;
|
513 |
left: 10px;
|
514 |
}
|
515 |
+
|
516 |
+
#TB_window #preview-padding .padding-reset {
|
517 |
color: #097BB4;
|
518 |
text-decoration: none;
|
519 |
display: inline-block;
|
520 |
padding-left: 3px;
|
521 |
padding-top: 3px;
|
522 |
}
|
523 |
+
|
524 |
/*
|
525 |
#TB_window #preview-padding .column-container .padding-reset {
|
526 |
margin-top: -6px;
|
assets/images/ac_vignet_grey.svg
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
+
<svg width="186px" height="107px" viewBox="0 0 186 107" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3 |
+
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
|
4 |
+
<title>ac_vignet_grey</title>
|
5 |
+
<desc>Created with Sketch.</desc>
|
6 |
+
<defs></defs>
|
7 |
+
<g id="Vignet" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8 |
+
<g id="ac_vignet_grey" fill="#3D4350">
|
9 |
+
<path d="M114.6,32.1 C117.3,29.4 120.5,27.2 124.2,25.6 C127.9,24 131.8,23.2 135.9,23.2 C140.7,23.2 145.1,24 149.3,25.7 C153.4,27.4 156.9,30.2 159.8,34 L185.2,34 C182.7,28.1 179.7,23 176.1,18.8 C172.5,14.6 168.5,11.1 164.2,8.4 C159.9,5.7 155.3,3.7 150.4,2.5 C145.6,1.3 140.7,0.7 135.9,0.7 C128.5,0.7 121.6,2.1 115.2,4.9 C108.8,7.7 103.2,11.4 98.5,16.2 C97,17.7 95.6,19.2 94.4,20.9 C91.6,24.5 89.2,28.5 87.3,32.9 C84.7,39 83.3,45.6 83.2,52.5 L83.2,53.5 L83.2,54.6 C83.1,58.6 82.3,62.3 80.9,65.7 C79.3,69.4 77.2,72.6 74.4,75.3 C71.6,78 68.4,80.1 64.7,81.6 C61,83.1 57.1,83.8 52.9,83.8 C48.7,83.8 44.8,83 41.1,81.4 C37.4,79.8 34.2,77.6 31.5,74.9 C28.8,72.2 26.6,69 25,65.3 C23.4,61.6 22.6,57.7 22.6,53.6 L22.6,53.6 C22.6,49.5 23.4,45.5 25,41.9 C26.6,38.2 28.8,35 31.5,32.3 C34.2,29.6 37.4,27.4 41.1,25.8 C41.6,25.6 42.1,25.4 42.6,25.2 C45.9,24 49.3,23.4 52.9,23.4 C57.1,23.4 61,24.2 64.7,25.8 C68.4,27.4 71.6,29.6 74.3,32.3 C75.5,33.5 76.6,34.8 77.5,36.2 C78.1,34 78.9,31.9 79.8,29.8 C81.9,24.8 84.7,20.1 88,16 C88.3,15.7 88.5,15.3 88.8,15 C84.4,10.9 79.3,7.7 73.6,5.2 C67.2,2 60.3,0.6 53,0.6 C49.4,0.6 45.9,0.9 42.6,1.6 C39.1,2.3 35.6,3.4 32.4,4.8 C26,7.6 20.4,11.3 15.6,16.1 C10.7,20.8 7,26.4 4.2,32.7 C1.4,39.1 0,46 0,53.4 L0,53.4 C0,60.8 1.3,67.7 3.8,74.1 C6.3,80.5 9.9,86.1 14.5,90.9 C19.1,95.7 24.7,99.4 31.2,102.1 C37.7,104.8 45,106.2 53,106.2 C64.3,106.2 74.3,103 83.3,96.7 L83.3,102.1 L105.8,102.1 L105.8,96.7 L105.8,55.1 L105.8,53.4 L105.8,52.4 C105.9,48.6 106.7,45 108.2,41.7 C109.7,38 111.9,34.8 114.6,32.1 L114.6,32.1 Z" id="Shape"></path>
|
10 |
+
<path d="M149.7,80.9 C145.6,82.8 141,83.7 135.9,83.7 C131.8,83.7 127.9,82.9 124.2,81.3 C120.5,79.7 117.3,77.5 114.6,74.8 C114.4,74.6 114.1,74.3 113.9,74 L113.9,101.4 C114.4,101.6 114.8,101.8 115.3,102 C121.7,104.8 128.6,106.2 136,106.2 C141,106.2 146,105.5 150.7,104.3 C155.5,103 160,101 164.3,98.3 C168.6,95.6 172.5,92.1 176,87.8 C179.6,83.5 182.6,78.5 185,72.7 L159.8,72.7 C157.2,76.2 153.9,79 149.7,80.9 L149.7,80.9 Z" id="Shape"></path>
|
11 |
+
</g>
|
12 |
+
</g>
|
13 |
+
</svg>
|
assets/js/admin.js
CHANGED
@@ -1,24 +1,45 @@
|
|
1 |
-
(function($) {
|
2 |
|
3 |
-
$(document).ready(function()
|
4 |
-
{
|
5 |
codepressShortcodes();
|
6 |
codepressPaddingGenerator();
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
/**
|
10 |
* Send shortcode to editor
|
11 |
*
|
12 |
*/
|
13 |
function codepressShortcodes() {
|
14 |
-
$('#cpsh .insert-shortcode').live('click', function(e) {
|
15 |
|
16 |
-
var shortcode = $(this).attr('rel');
|
17 |
window.send_to_editor( shortcode );
|
18 |
|
19 |
e.preventDefault();
|
20 |
return false;
|
21 |
-
});
|
22 |
}
|
23 |
|
24 |
/**
|
@@ -27,56 +48,65 @@
|
|
27 |
*/
|
28 |
function codepressPaddingGenerator() {
|
29 |
|
30 |
-
if ( $('#preview-padding').length === 0 )
|
31 |
return;
|
32 |
|
33 |
-
var fields = $("#preview-padding .padding-fields input");
|
34 |
|
35 |
// init: restore previous settings
|
36 |
-
var positions = ['top', 'right', 'bottom', 'left'];
|
37 |
|
38 |
for ( var p in positions ) {
|
39 |
-
var pos = positions[p];
|
40 |
-
if ( $.cookie('cpsh-' + pos) ) {
|
41 |
-
updatePreviewAndShortcode( pos, $.cookie('cpsh-' + pos) );
|
42 |
}
|
43 |
}
|
44 |
|
45 |
// event: user input
|
46 |
-
fields.bind("keyup change", function(
|
47 |
|
48 |
-
var value
|
49 |
-
var pos
|
50 |
|
51 |
updatePreviewAndShortcode( pos, value );
|
52 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
// event: reset all values
|
55 |
-
$('.padding-reset').click( function(e) {
|
56 |
|
57 |
-
fields.val('').trigger('change');
|
58 |
e.preventDefault();
|
59 |
-
});
|
60 |
|
61 |
/**
|
62 |
* Update preview and shortcode
|
63 |
*
|
64 |
*/
|
65 |
function updatePreviewAndShortcode( pos, value ) {
|
66 |
-
|
67 |
value = suffixPaddingValue( value );
|
68 |
|
69 |
// inputs
|
70 |
-
if (
|
71 |
-
$
|
72 |
|
73 |
-
var preview = $('#preview-padding .column-container .column-inner');
|
74 |
|
75 |
// preview: margins
|
76 |
preview.css( 'margin-' + pos, value );
|
77 |
|
78 |
// preview: hide border when margin is zero
|
79 |
-
if ( '0px'
|
80 |
preview.css( 'border-' + pos, '0px solid #fff' );
|
81 |
}
|
82 |
else {
|
@@ -84,31 +114,31 @@
|
|
84 |
}
|
85 |
|
86 |
// shortcode attributes
|
87 |
-
var attr_padding
|
88 |
-
var has_padding
|
89 |
for ( var p in positions ) {
|
90 |
|
91 |
-
var _input_val
|
92 |
-
var attr_val
|
93 |
|
94 |
// has padding?
|
95 |
-
if( _input_val !== "" ) {
|
96 |
attr_val = suffixPaddingValue( _input_val );
|
97 |
has_padding = true;
|
98 |
}
|
99 |
|
100 |
-
attr_padding += ' ' +
|
101 |
}
|
102 |
|
103 |
// update: shortcode rel
|
104 |
-
$('.cpsh-shortcodes .columns').each( function() {
|
105 |
-
if ( !
|
106 |
-
$(this).attr( 'rel', $(this).attr('data-tag') );
|
107 |
}
|
108 |
else {
|
109 |
-
$(this).attr( 'rel', $(this).attr('data-tag').replace( '][/', ' padding="' + attr_padding.trim() + '"][/' ) );
|
110 |
}
|
111 |
-
});
|
112 |
|
113 |
// store settings in cookie
|
114 |
$.cookie( 'cpsh-' + pos, value );
|
@@ -119,7 +149,7 @@
|
|
119 |
*/
|
120 |
function suffixPaddingValue( value ) {
|
121 |
|
122 |
-
if ( Math.floor( value )
|
123 |
value = value + 'px';
|
124 |
}
|
125 |
|
@@ -128,4 +158,4 @@
|
|
128 |
|
129 |
}
|
130 |
|
131 |
-
})(jQuery);
|
1 |
+
(function( $ ) {
|
2 |
|
3 |
+
$( document ).ready( function() {
|
|
|
4 |
codepressShortcodes();
|
5 |
codepressPaddingGenerator();
|
6 |
+
codepressSidebarFeedback();
|
7 |
+
} );
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @since @NEWVERSION
|
11 |
+
*/
|
12 |
+
function codepressSidebarFeedback() {
|
13 |
+
var sidebox = $( '.sidebox#cpsh-sidebox-feedback' );
|
14 |
+
|
15 |
+
sidebox.find( '#feedback-choice a.no' ).click( function( e ) {
|
16 |
+
e.preventDefault();
|
17 |
+
|
18 |
+
sidebox.find( '#feedback-choice' ).slideUp();
|
19 |
+
sidebox.find( '#feedback-support' ).slideDown();
|
20 |
+
} );
|
21 |
+
|
22 |
+
sidebox.find( '#feedback-choice a.yes' ).click( function( e ) {
|
23 |
+
e.preventDefault();
|
24 |
+
|
25 |
+
sidebox.find( '#feedback-choice' ).slideUp();
|
26 |
+
sidebox.find( '#feedback-rate' ).slideDown();
|
27 |
+
} );
|
28 |
+
}
|
29 |
|
30 |
/**
|
31 |
* Send shortcode to editor
|
32 |
*
|
33 |
*/
|
34 |
function codepressShortcodes() {
|
35 |
+
$( '#cpsh .insert-shortcode' ).live( 'click', function( e ) {
|
36 |
|
37 |
+
var shortcode = $( this ).attr( 'rel' );
|
38 |
window.send_to_editor( shortcode );
|
39 |
|
40 |
e.preventDefault();
|
41 |
return false;
|
42 |
+
} );
|
43 |
}
|
44 |
|
45 |
/**
|
48 |
*/
|
49 |
function codepressPaddingGenerator() {
|
50 |
|
51 |
+
if ( $( '#preview-padding' ).length === 0 )
|
52 |
return;
|
53 |
|
54 |
+
var fields = $( "#preview-padding .padding-fields input" );
|
55 |
|
56 |
// init: restore previous settings
|
57 |
+
var positions = [ 'top', 'right', 'bottom', 'left' ];
|
58 |
|
59 |
for ( var p in positions ) {
|
60 |
+
var pos = positions[ p ];
|
61 |
+
if ( $.cookie( 'cpsh-' + pos ) ) {
|
62 |
+
updatePreviewAndShortcode( pos, $.cookie( 'cpsh-' + pos ) );
|
63 |
}
|
64 |
}
|
65 |
|
66 |
// event: user input
|
67 |
+
fields.bind( "keyup change", function() {
|
68 |
|
69 |
+
var value = $( this ).val();
|
70 |
+
var pos = $( this ).attr( 'id' ).replace( 'padding-', '' );
|
71 |
|
72 |
updatePreviewAndShortcode( pos, value );
|
73 |
+
} );
|
74 |
+
|
75 |
+
fields.on( 'blur', function() {
|
76 |
+
var value = $( this ).val();
|
77 |
+
var isnum = /^\d+$/.test( value );
|
78 |
+
|
79 |
+
if ( isnum ) {
|
80 |
+
$( this ).val( value + 'px' ).trigger( 'change' );
|
81 |
+
}
|
82 |
+
} );
|
83 |
|
84 |
// event: reset all values
|
85 |
+
$( '.padding-reset' ).click( function( e ) {
|
86 |
|
87 |
+
fields.val( '' ).trigger( 'change' );
|
88 |
e.preventDefault();
|
89 |
+
} );
|
90 |
|
91 |
/**
|
92 |
* Update preview and shortcode
|
93 |
*
|
94 |
*/
|
95 |
function updatePreviewAndShortcode( pos, value ) {
|
96 |
+
var $field = $( '#padding-' + pos );
|
97 |
value = suffixPaddingValue( value );
|
98 |
|
99 |
// inputs
|
100 |
+
if ( !$field.val() )
|
101 |
+
$field.val( value );
|
102 |
|
103 |
+
var preview = $( '#preview-padding .column-container .column-inner' );
|
104 |
|
105 |
// preview: margins
|
106 |
preview.css( 'margin-' + pos, value );
|
107 |
|
108 |
// preview: hide border when margin is zero
|
109 |
+
if ( '0px' === preview.css( 'margin-' + pos ) ) {
|
110 |
preview.css( 'border-' + pos, '0px solid #fff' );
|
111 |
}
|
112 |
else {
|
114 |
}
|
115 |
|
116 |
// shortcode attributes
|
117 |
+
var attr_padding = '';
|
118 |
+
var has_padding = false;
|
119 |
for ( var p in positions ) {
|
120 |
|
121 |
+
var _input_val = $( '#padding-' + positions[ p ] ).val();
|
122 |
+
var attr_val = '0';
|
123 |
|
124 |
// has padding?
|
125 |
+
if ( _input_val !== "" ) {
|
126 |
attr_val = suffixPaddingValue( _input_val );
|
127 |
has_padding = true;
|
128 |
}
|
129 |
|
130 |
+
attr_padding += ' ' + attr_val;
|
131 |
}
|
132 |
|
133 |
// update: shortcode rel
|
134 |
+
$( '.cpsh-shortcodes .columns' ).each( function() {
|
135 |
+
if ( !has_padding ) {
|
136 |
+
$( this ).attr( 'rel', $( this ).attr( 'data-tag' ) );
|
137 |
}
|
138 |
else {
|
139 |
+
$( this ).attr( 'rel', $( this ).attr( 'data-tag' ).replace( '][/', ' padding="' + attr_padding.trim() + '"][/' ) );
|
140 |
}
|
141 |
+
} );
|
142 |
|
143 |
// store settings in cookie
|
144 |
$.cookie( 'cpsh-' + pos, value );
|
149 |
*/
|
150 |
function suffixPaddingValue( value ) {
|
151 |
|
152 |
+
if ( ( Math.floor( value ) === value ) && $.isNumeric( value ) ) {
|
153 |
value = value + 'px';
|
154 |
}
|
155 |
|
158 |
|
159 |
}
|
160 |
|
161 |
+
})( jQuery );
|
assets/js/plugins.js
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
|
3 |
+
$( document ).ready( function() {
|
4 |
+
|
5 |
+
if ( window.location.hash ) {
|
6 |
+
|
7 |
+
if ( 'install_admin_columns' === window.location.hash.substring( 1 ) ) {
|
8 |
+
setTimeout( function() {
|
9 |
+
jQuery( '.plugin-card-codepress-admin-columns .thickbox' ).trigger( 'click' );
|
10 |
+
}, 1000 );
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
+
} );
|
16 |
+
|
17 |
+
})( jQuery );
|
column-shortcodes.php
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
|
3 |
/*
|
4 |
Plugin Name: Column Shortcodes
|
5 |
-
Version: 0
|
6 |
Description: Adds shortcodes to easily create columns in your posts or pages
|
7 |
Author: Codepress
|
8 |
-
Author URI:
|
9 |
-
Plugin URI:
|
10 |
Text Domain: column-shortcodes
|
11 |
Domain Path: /languages
|
12 |
License: GPLv2
|
13 |
|
14 |
-
Copyright 2011-
|
15 |
|
16 |
This program is free software; you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License version 2 as published by
|
@@ -27,10 +27,6 @@ along with this program; if not, write to the Free Software
|
|
27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
30 |
-
define( 'CPSH_VERSION', '0.6.9' );
|
31 |
-
define( 'CPSH_URL', plugins_url( '', __FILE__ ) );
|
32 |
-
define( 'CPSH_TEXTDOMAIN', 'column-shortcodes' );
|
33 |
-
|
34 |
// Long posts should require a higher limit, see http://core.trac.wordpress.org/ticket/8553
|
35 |
@ini_set( 'pcre.backtrack_limit', 500000 );
|
36 |
|
@@ -42,45 +38,75 @@ define( 'CPSH_TEXTDOMAIN', 'column-shortcodes' );
|
|
42 |
class Codepress_Column_Shortcodes {
|
43 |
|
44 |
/**
|
45 |
-
*
|
46 |
-
*
|
47 |
-
* @since 0.6.3
|
48 |
*/
|
49 |
-
private $
|
50 |
|
51 |
/**
|
52 |
* Constructor
|
53 |
*
|
54 |
* @since 0.1
|
55 |
*/
|
56 |
-
function __construct() {
|
57 |
-
|
58 |
-
add_action( 'wp_loaded', array( $this, 'init' ) );
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Initialize plugin.
|
63 |
-
*
|
64 |
-
* @since 0.1
|
65 |
-
*/
|
66 |
-
public function init() {
|
67 |
-
|
68 |
-
$this->prefix = trim( apply_filters( 'cpsh_prefix', '' ) );
|
69 |
-
|
70 |
add_action( 'admin_init', array( $this, 'add_editor_buttons' ) );
|
71 |
add_action( 'admin_footer', array( $this, 'popup' ) );
|
|
|
|
|
72 |
|
73 |
// styling
|
74 |
add_action( 'admin_print_styles', array( $this, 'admin_styles' ) );
|
|
|
75 |
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ) );
|
76 |
|
77 |
// scripts, only load when editor is available
|
78 |
add_filter( 'tiny_mce_plugins', array( $this, 'admin_scripts' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
-
|
81 |
-
|
82 |
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
/**
|
@@ -90,29 +116,41 @@ class Codepress_Column_Shortcodes {
|
|
90 |
*/
|
91 |
public function admin_styles() {
|
92 |
if ( $this->has_permissions() && $this->is_edit_screen() ) {
|
93 |
-
|
94 |
-
wp_enqueue_style( 'cpsh-admin', CPSH_URL . '/assets/css/admin.css', array(), CPSH_VERSION, 'all' );
|
95 |
|
96 |
if ( is_rtl() ) {
|
97 |
-
wp_enqueue_style( 'cpsh-admin-rtl',
|
98 |
}
|
99 |
}
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
-
* Register admin scripts
|
|
|
|
|
104 |
*
|
105 |
* @since 0.1
|
106 |
*/
|
107 |
public function admin_scripts( $plugins ) {
|
108 |
if ( $this->has_permissions() && $this->is_edit_screen() ) {
|
109 |
-
wp_enqueue_script( 'cpsh-admin',
|
110 |
-
wp_enqueue_script( 'jquery-cookie',
|
111 |
}
|
112 |
|
113 |
return $plugins;
|
114 |
}
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
/**
|
117 |
* Register frontend styles
|
118 |
*
|
@@ -120,11 +158,10 @@ class Codepress_Column_Shortcodes {
|
|
120 |
*/
|
121 |
public function frontend_styles() {
|
122 |
if ( apply_filters( 'cpsh_load_styles', true ) ) {
|
123 |
-
if (
|
124 |
-
wp_enqueue_style( 'cpsh-shortcodes',
|
125 |
-
}
|
126 |
-
|
127 |
-
wp_enqueue_style( 'cpsh-shortcodes-rtl', CPSH_URL . '/assets/css/shortcodes-rtl.css', array(), CPSH_VERSION, 'all' );
|
128 |
}
|
129 |
}
|
130 |
}
|
@@ -134,7 +171,7 @@ class Codepress_Column_Shortcodes {
|
|
134 |
*
|
135 |
* @since 0.1
|
136 |
*/
|
137 |
-
|
138 |
foreach ( $this->get_shortcodes() as $shortcode ) {
|
139 |
add_shortcode( $shortcode['name'], array( $this, 'columns' ) );
|
140 |
}
|
@@ -145,13 +182,13 @@ class Codepress_Column_Shortcodes {
|
|
145 |
*
|
146 |
* @since 0.1
|
147 |
*
|
148 |
-
* @param array
|
149 |
* @param string $content
|
150 |
* @param string $name
|
151 |
*
|
152 |
-
* @return string
|
153 |
*/
|
154 |
-
function columns( $atts, $content = null, $name = '' ) {
|
155 |
|
156 |
$atts = shortcode_atts( array(
|
157 |
"id" => '',
|
@@ -178,8 +215,7 @@ class Codepress_Column_Shortcodes {
|
|
178 |
$padding .= ! empty( $parts[1] ) ? "padding-right:{$parts[1]};" : '';
|
179 |
$padding .= ! empty( $parts[2] ) ? "padding-bottom:{$parts[2]};" : '';
|
180 |
$padding .= ! empty( $parts[3] ) ? "padding-left:{$parts[3]};" : '';
|
181 |
-
}
|
182 |
-
else {
|
183 |
$padding = "padding:{$padding};";
|
184 |
}
|
185 |
|
@@ -187,7 +223,6 @@ class Codepress_Column_Shortcodes {
|
|
187 |
$content = '<div style="' . esc_attr( $padding ) . '">' . $content . '</div>';
|
188 |
}
|
189 |
|
190 |
-
|
191 |
// last class
|
192 |
$pos = strpos( $name, '_last' );
|
193 |
|
@@ -195,10 +230,9 @@ class Codepress_Column_Shortcodes {
|
|
195 |
$name = str_replace( '_last', ' last_column', $name );
|
196 |
}
|
197 |
|
198 |
-
// remove prefix from
|
199 |
-
|
200 |
-
|
201 |
-
$name = str_replace( $this->prefix, '', $name );
|
202 |
}
|
203 |
|
204 |
$output = "<div{$id} class='content-column {$name}{$class}'>{$content}</div>";
|
@@ -210,6 +244,17 @@ class Codepress_Column_Shortcodes {
|
|
210 |
return $output;
|
211 |
}
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
/**
|
214 |
* Is edit screen
|
215 |
*
|
@@ -220,11 +265,7 @@ class Codepress_Column_Shortcodes {
|
|
220 |
|
221 |
$allowed_screens = apply_filters( 'cpsh_allowed_screens', array( 'post-new.php', 'page-new.php', 'post.php', 'page.php', 'profile.php', 'user-edit.php', 'user-new.php' ) );
|
222 |
|
223 |
-
|
224 |
-
return true;
|
225 |
-
}
|
226 |
-
|
227 |
-
return false;
|
228 |
}
|
229 |
|
230 |
/**
|
@@ -233,35 +274,27 @@ class Codepress_Column_Shortcodes {
|
|
233 |
* @since 0.4
|
234 |
*/
|
235 |
private function has_permissions() {
|
236 |
-
|
237 |
-
return true;
|
238 |
-
}
|
239 |
-
|
240 |
-
return false;
|
241 |
}
|
242 |
|
243 |
/**
|
244 |
-
* Add buttons to
|
245 |
*
|
246 |
* @since 0.1
|
247 |
*/
|
248 |
-
function add_editor_buttons() {
|
|
|
249 |
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
|
254 |
-
|
255 |
-
if ( apply_filters( 'add_shortcode_html_buttons', false ) ) {
|
256 |
-
add_action( 'admin_head', array( $this, 'add_html_buttons' ) );
|
257 |
}
|
258 |
-
|
259 |
-
// add shortcode button
|
260 |
-
add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 100 );
|
261 |
}
|
262 |
|
263 |
/**
|
264 |
-
* Add shortcode button to
|
265 |
*
|
266 |
* @since 0.1
|
267 |
*
|
@@ -270,35 +303,35 @@ class Codepress_Column_Shortcodes {
|
|
270 |
*/
|
271 |
public function add_shortcode_button( $page = null, $target = null ) {
|
272 |
?>
|
273 |
-
<a href="#TB_inline?width=
|
274 |
-
<img src="<?php echo
|
275 |
</a>
|
276 |
<?php
|
277 |
}
|
278 |
|
279 |
/**
|
280 |
-
*
|
281 |
-
*
|
282 |
-
* @since 0.1
|
283 |
*/
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
// buttons
|
288 |
-
$select = '';
|
289 |
-
foreach ( $buttons as $button ) {
|
290 |
-
|
291 |
$open_tag = str_replace( '\n', '', $button['options']['open_tag'] );
|
292 |
$close_tag = str_replace( '\n', '', $button['options']['close_tag'] );
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
|
|
298 |
}
|
|
|
299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
?>
|
301 |
-
|
302 |
<div id="cpsh-wrap" style="display:none">
|
303 |
<div id="cpsh">
|
304 |
<div id="cpsh-generator-shell">
|
@@ -306,17 +339,17 @@ class Codepress_Column_Shortcodes {
|
|
306 |
<div id="cpsh-generator-header">
|
307 |
|
308 |
<div class="cpsh-shortcodes">
|
309 |
-
<h2 class="cpsh-title"><?php _e( "Column shortcodes",
|
310 |
-
<?php
|
311 |
-
</div
|
312 |
|
313 |
<?php if ( ! apply_filters( 'cpsh_hide_padding_settings', false ) ) : ?>
|
314 |
|
315 |
<div class="cpsh-settings">
|
316 |
-
<h2 class="cpsh-title"><?php _e( "Column padding ( optional )",
|
317 |
<p class="description">
|
318 |
-
<?php _e( "Use the input fields below to customize the padding of your column shortcode.",
|
319 |
-
<?php _e( "Enter padding first, then select your column shortcode.",
|
320 |
</p>
|
321 |
|
322 |
<div id="preview-padding">
|
@@ -331,7 +364,7 @@ class Codepress_Column_Shortcodes {
|
|
331 |
</div>
|
332 |
</div>
|
333 |
|
334 |
-
<a class="padding-reset" href="javascript:;"><?php _e( "reset",
|
335 |
</div>
|
336 |
</div><!--.cpsh-settings-->
|
337 |
|
@@ -339,51 +372,199 @@ class Codepress_Column_Shortcodes {
|
|
339 |
|
340 |
</div><!--cpsh-generator-header-->
|
341 |
|
342 |
-
|
|
|
|
|
|
|
343 |
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
</div>
|
346 |
</div>
|
347 |
|
348 |
<?php
|
349 |
}
|
350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
/**
|
352 |
* get shortcodes
|
353 |
*
|
354 |
* @since 0.1
|
355 |
*/
|
356 |
-
function get_shortcodes() {
|
357 |
-
|
358 |
-
|
359 |
-
if ( ! empty( $shortcodes ) ) {
|
360 |
-
return $shortcodes;
|
361 |
-
}
|
362 |
|
363 |
-
// define column shortcodes
|
364 |
$column_shortcodes = apply_filters( 'cpsh_column_shortcodes', array(
|
365 |
-
'full_width' => array( 'display_name' => __( 'full width',
|
366 |
-
'one_half' => array( 'display_name' => __( 'one half',
|
367 |
-
'one_third' => array( 'display_name' => __( 'one third',
|
368 |
-
'one_fourth' => array( 'display_name' => __( 'one fourth',
|
369 |
-
'two_third' => array( 'display_name' => __( 'two third',
|
370 |
-
'three_fourth' => array( 'display_name' => __( 'three fourth',
|
371 |
-
'one_fifth' => array( 'display_name' => __( 'one fifth',
|
372 |
-
'two_fifth' => array( 'display_name' => __( 'two fifth',
|
373 |
-
'three_fifth' => array( 'display_name' => __( 'three fifth',
|
374 |
-
'four_fifth' => array( 'display_name' => __( 'four fifth',
|
375 |
-
'one_sixth' => array( 'display_name' => __( 'one sixth',
|
376 |
-
'five_sixth' => array( 'display_name' => __( 'five sixth',
|
377 |
) );
|
378 |
|
379 |
-
if ( ! $column_shortcodes ) {
|
380 |
-
return array();
|
381 |
-
}
|
382 |
-
|
383 |
foreach ( $column_shortcodes as $short => $options ) {
|
384 |
|
385 |
// add prefix
|
386 |
-
$shortcode = $this->
|
387 |
|
388 |
$shortcodes[] = array(
|
389 |
'name' => $shortcode,
|
@@ -396,7 +577,7 @@ class Codepress_Column_Shortcodes {
|
|
396 |
),
|
397 |
);
|
398 |
|
399 |
-
if ( 'full_width'
|
400 |
continue;
|
401 |
}
|
402 |
|
@@ -404,7 +585,7 @@ class Codepress_Column_Shortcodes {
|
|
404 |
'name' => "{$shortcode}_last",
|
405 |
'class' => "{$short}_last",
|
406 |
'options' => array(
|
407 |
-
'display_name' => $options['display_name'] . ' (' . __( 'last',
|
408 |
'open_tag' => '\n' . "[{$shortcode}_last]",
|
409 |
'close_tag' => "[/{$shortcode}_last]" . '\n',
|
410 |
'key' => '',
|
@@ -416,21 +597,19 @@ class Codepress_Column_Shortcodes {
|
|
416 |
}
|
417 |
|
418 |
/**
|
419 |
-
* Add buttons to
|
420 |
*
|
421 |
* @since 0.1
|
422 |
*/
|
423 |
-
function add_html_buttons() {
|
424 |
wp_print_scripts( 'quicktags' );
|
425 |
|
426 |
-
$shortcodes = $this->get_shortcodes();
|
427 |
-
|
428 |
// output script
|
429 |
-
$
|
430 |
-
foreach ( $
|
431 |
$options = $shortcode['options'];
|
432 |
|
433 |
-
$
|
434 |
,'{$shortcode['name']}'
|
435 |
,'{$options['open_tag']}'
|
436 |
,'{$options['close_tag']}'
|
@@ -438,15 +617,11 @@ class Codepress_Column_Shortcodes {
|
|
438 |
); \n";
|
439 |
}
|
440 |
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
</script>
|
447 |
-
";
|
448 |
-
|
449 |
-
echo $script;
|
450 |
}
|
451 |
|
452 |
/**
|
@@ -455,12 +630,12 @@ class Codepress_Column_Shortcodes {
|
|
455 |
* @since 0.1
|
456 |
*
|
457 |
* @param string $content
|
458 |
-
* @param bool
|
459 |
-
* @param bool
|
460 |
*
|
461 |
* @return string Shortcode
|
462 |
*/
|
463 |
-
function content_helper( $content, $paragraph_tag = false, $br_tag = false ) {
|
464 |
$content = preg_replace( '#^<\/p>|^<br \/>|<p>$#', '', $content );
|
465 |
|
466 |
if ( $br_tag ) {
|
@@ -475,4 +650,4 @@ class Codepress_Column_Shortcodes {
|
|
475 |
}
|
476 |
}
|
477 |
|
478 |
-
new Codepress_Column_Shortcodes();
|
2 |
|
3 |
/*
|
4 |
Plugin Name: Column Shortcodes
|
5 |
+
Version: 1.0
|
6 |
Description: Adds shortcodes to easily create columns in your posts or pages
|
7 |
Author: Codepress
|
8 |
+
Author URI: https://www.admincolumns.com/
|
9 |
+
Plugin URI: https://wordpress.org/plugins/column-shortcodes
|
10 |
Text Domain: column-shortcodes
|
11 |
Domain Path: /languages
|
12 |
License: GPLv2
|
13 |
|
14 |
+
Copyright 2011-2017 Codepress info@codepress.nl
|
15 |
|
16 |
This program is free software; you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License version 2 as published by
|
27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
|
|
|
|
|
|
|
|
30 |
// Long posts should require a higher limit, see http://core.trac.wordpress.org/ticket/8553
|
31 |
@ini_set( 'pcre.backtrack_limit', 500000 );
|
32 |
|
38 |
class Codepress_Column_Shortcodes {
|
39 |
|
40 |
/**
|
41 |
+
* @var string
|
|
|
|
|
42 |
*/
|
43 |
+
private $version;
|
44 |
|
45 |
/**
|
46 |
* Constructor
|
47 |
*
|
48 |
* @since 0.1
|
49 |
*/
|
50 |
+
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
add_action( 'admin_init', array( $this, 'add_editor_buttons' ) );
|
52 |
add_action( 'admin_footer', array( $this, 'popup' ) );
|
53 |
+
add_action( 'plugins_loaded', array( $this, 'translations' ) );
|
54 |
+
add_action( 'wp_loaded', array( $this, 'add_shortcodes' ) );
|
55 |
|
56 |
// styling
|
57 |
add_action( 'admin_print_styles', array( $this, 'admin_styles' ) );
|
58 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_plugins_scripts' ) );
|
59 |
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ) );
|
60 |
|
61 |
// scripts, only load when editor is available
|
62 |
add_filter( 'tiny_mce_plugins', array( $this, 'admin_scripts' ) );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @since 1.0
|
67 |
+
*/
|
68 |
+
public function translations() {
|
69 |
+
load_plugin_textdomain( 'column-shortcodes', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
private function get_url() {
|
76 |
+
return plugin_dir_url( __FILE__ );
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @return string
|
81 |
+
*/
|
82 |
+
public function get_version() {
|
83 |
+
if ( null === $this->version ) {
|
84 |
+
$this->version = $this->get_plugin_version( __FILE__ );
|
85 |
+
}
|
86 |
+
|
87 |
+
return $this->version;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @param string $file
|
92 |
+
*
|
93 |
+
* @since 3.0
|
94 |
+
*/
|
95 |
+
private function get_plugin_version( $file ) {
|
96 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
97 |
+
|
98 |
+
$plugin = get_plugin_data( $file, false, false );
|
99 |
|
100 |
+
return isset( $plugin['Version'] ) ? $plugin['Version'] : false;
|
101 |
+
}
|
102 |
|
103 |
+
/**
|
104 |
+
* Prefix
|
105 |
+
*
|
106 |
+
* @since 0.6.3
|
107 |
+
*/
|
108 |
+
private function get_prefix() {
|
109 |
+
return apply_filters( 'cpsh_prefix', '' );
|
110 |
}
|
111 |
|
112 |
/**
|
116 |
*/
|
117 |
public function admin_styles() {
|
118 |
if ( $this->has_permissions() && $this->is_edit_screen() ) {
|
119 |
+
wp_enqueue_style( 'cpsh-admin', $this->get_url() . '/assets/css/admin.css', array(), $this->get_version(), 'all' );
|
|
|
120 |
|
121 |
if ( is_rtl() ) {
|
122 |
+
wp_enqueue_style( 'cpsh-admin-rtl', $this->get_url() . '/assets/css/admin-rtl.css', array(), $this->get_version(), 'all' );
|
123 |
}
|
124 |
}
|
125 |
}
|
126 |
|
127 |
/**
|
128 |
+
* Register admin scripts for the editor
|
129 |
+
*
|
130 |
+
* @param array $plugins
|
131 |
*
|
132 |
* @since 0.1
|
133 |
*/
|
134 |
public function admin_scripts( $plugins ) {
|
135 |
if ( $this->has_permissions() && $this->is_edit_screen() ) {
|
136 |
+
wp_enqueue_script( 'cpsh-admin', $this->get_url() . '/assets/js/admin.js', array( 'jquery' ), $this->get_version() );
|
137 |
+
wp_enqueue_script( 'jquery-cookie', $this->get_url() . '/assets/js/jquery.ck.js', array( 'jquery' ), $this->get_version() );
|
138 |
}
|
139 |
|
140 |
return $plugins;
|
141 |
}
|
142 |
|
143 |
+
/**
|
144 |
+
* Register admin scripts for the plugins page
|
145 |
+
*
|
146 |
+
* @since 1.0
|
147 |
+
*/
|
148 |
+
public function admin_plugins_scripts() {
|
149 |
+
if ( $this->is_plugins_screen() ) {
|
150 |
+
wp_enqueue_script( 'cpsh-admin-plugins', $this->get_url() . '/assets/js/plugins.js', array( 'jquery' ), $this->get_version() );
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
/**
|
155 |
* Register frontend styles
|
156 |
*
|
158 |
*/
|
159 |
public function frontend_styles() {
|
160 |
if ( apply_filters( 'cpsh_load_styles', true ) ) {
|
161 |
+
if ( is_rtl() ) {
|
162 |
+
wp_enqueue_style( 'cpsh-shortcodes-rtl', $this->get_url() . '/assets/css/shortcodes-rtl.css', array(), $this->get_version(), 'all' );
|
163 |
+
} else {
|
164 |
+
wp_enqueue_style( 'cpsh-shortcodes', $this->get_url() . '/assets/css/shortcodes.css', array(), $this->get_version(), 'all' );
|
|
|
165 |
}
|
166 |
}
|
167 |
}
|
171 |
*
|
172 |
* @since 0.1
|
173 |
*/
|
174 |
+
public function add_shortcodes() {
|
175 |
foreach ( $this->get_shortcodes() as $shortcode ) {
|
176 |
add_shortcode( $shortcode['name'], array( $this, 'columns' ) );
|
177 |
}
|
182 |
*
|
183 |
* @since 0.1
|
184 |
*
|
185 |
+
* @param array $atts
|
186 |
* @param string $content
|
187 |
* @param string $name
|
188 |
*
|
189 |
+
* @return string Column HTML output
|
190 |
*/
|
191 |
+
public function columns( $atts, $content = null, $name = '' ) {
|
192 |
|
193 |
$atts = shortcode_atts( array(
|
194 |
"id" => '',
|
215 |
$padding .= ! empty( $parts[1] ) ? "padding-right:{$parts[1]};" : '';
|
216 |
$padding .= ! empty( $parts[2] ) ? "padding-bottom:{$parts[2]};" : '';
|
217 |
$padding .= ! empty( $parts[3] ) ? "padding-left:{$parts[3]};" : '';
|
218 |
+
} else {
|
|
|
219 |
$padding = "padding:{$padding};";
|
220 |
}
|
221 |
|
223 |
$content = '<div style="' . esc_attr( $padding ) . '">' . $content . '</div>';
|
224 |
}
|
225 |
|
|
|
226 |
// last class
|
227 |
$pos = strpos( $name, '_last' );
|
228 |
|
230 |
$name = str_replace( '_last', ' last_column', $name );
|
231 |
}
|
232 |
|
233 |
+
// remove prefix from class name
|
234 |
+
if ( $this->get_prefix() ) {
|
235 |
+
$name = str_replace( $this->get_prefix(), '', $name );
|
|
|
236 |
}
|
237 |
|
238 |
$output = "<div{$id} class='content-column {$name}{$class}'>{$content}</div>";
|
244 |
return $output;
|
245 |
}
|
246 |
|
247 |
+
/**
|
248 |
+
* Is edit screen
|
249 |
+
*
|
250 |
+
* @since 0.4
|
251 |
+
*/
|
252 |
+
private function is_plugins_screen() {
|
253 |
+
global $pagenow;
|
254 |
+
|
255 |
+
return 'plugin-install.php' === $pagenow;
|
256 |
+
}
|
257 |
+
|
258 |
/**
|
259 |
* Is edit screen
|
260 |
*
|
265 |
|
266 |
$allowed_screens = apply_filters( 'cpsh_allowed_screens', array( 'post-new.php', 'page-new.php', 'post.php', 'page.php', 'profile.php', 'user-edit.php', 'user-new.php' ) );
|
267 |
|
268 |
+
return in_array( $pagenow, $allowed_screens );
|
|
|
|
|
|
|
|
|
269 |
}
|
270 |
|
271 |
/**
|
274 |
* @since 0.4
|
275 |
*/
|
276 |
private function has_permissions() {
|
277 |
+
return current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
|
|
|
|
|
|
|
|
|
278 |
}
|
279 |
|
280 |
/**
|
281 |
+
* Add buttons to TinyMCE
|
282 |
*
|
283 |
* @since 0.1
|
284 |
*/
|
285 |
+
public function add_editor_buttons() {
|
286 |
+
if ( $this->has_permissions() && $this->is_edit_screen() ) {
|
287 |
|
288 |
+
if ( apply_filters( 'add_shortcode_html_buttons', false ) ) {
|
289 |
+
add_action( 'admin_head', array( $this, 'add_html_buttons' ) );
|
290 |
+
}
|
291 |
|
292 |
+
add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 100 );
|
|
|
|
|
293 |
}
|
|
|
|
|
|
|
294 |
}
|
295 |
|
296 |
/**
|
297 |
+
* Add shortcode button to TinyMCE
|
298 |
*
|
299 |
* @since 0.1
|
300 |
*
|
303 |
*/
|
304 |
public function add_shortcode_button( $page = null, $target = null ) {
|
305 |
?>
|
306 |
+
<a href="#TB_inline?width=753&height=573&inlineId=cpsh-wrap" class="thickbox button" title="<?php _e( 'Select shortcode', 'column-shortcodes' ); ?>" data-page="<?php echo $page; ?>" data-target="<?php echo $target; ?>">
|
307 |
+
<img src="<?php echo $this->get_url() . "/assets/images/shortcode.png"; ?>" alt=""/>
|
308 |
</a>
|
309 |
<?php
|
310 |
}
|
311 |
|
312 |
/**
|
313 |
+
* @since 1.0
|
|
|
|
|
314 |
*/
|
315 |
+
private function display_shortcode_buttons() {
|
316 |
+
foreach ( $this->get_shortcodes() as $button ) {
|
|
|
|
|
|
|
|
|
|
|
317 |
$open_tag = str_replace( '\n', '', $button['options']['open_tag'] );
|
318 |
$close_tag = str_replace( '\n', '', $button['options']['close_tag'] );
|
319 |
|
320 |
+
?>
|
321 |
+
<a href='javascript:;' rel='<?php echo esc_attr( $open_tag . $close_tag ); ?>' data-tag='<?php echo esc_attr( $open_tag . $close_tag ); ?>' class='cp-<?php echo esc_attr( $button['class'] ); ?> columns insert-shortcode'>
|
322 |
+
<?php echo esc_html( $button['options']['display_name'] ); ?>
|
323 |
+
</a>
|
324 |
+
<?php
|
325 |
}
|
326 |
+
}
|
327 |
|
328 |
+
/**
|
329 |
+
* TB window Popup
|
330 |
+
*
|
331 |
+
* @since 0.1
|
332 |
+
*/
|
333 |
+
public function popup() {
|
334 |
?>
|
|
|
335 |
<div id="cpsh-wrap" style="display:none">
|
336 |
<div id="cpsh">
|
337 |
<div id="cpsh-generator-shell">
|
339 |
<div id="cpsh-generator-header">
|
340 |
|
341 |
<div class="cpsh-shortcodes">
|
342 |
+
<h2 class="cpsh-title"><?php _e( "Column shortcodes", 'column-shortcodes' ); ?></h2>
|
343 |
+
<?php $this->display_shortcode_buttons(); ?>
|
344 |
+
</div>
|
345 |
|
346 |
<?php if ( ! apply_filters( 'cpsh_hide_padding_settings', false ) ) : ?>
|
347 |
|
348 |
<div class="cpsh-settings">
|
349 |
+
<h2 class="cpsh-title"><?php _e( "Column padding ( optional )", 'column-shortcodes' ); ?></h2>
|
350 |
<p class="description">
|
351 |
+
<?php _e( "Use the input fields below to customize the padding of your column shortcode.", 'column-shortcodes' ); ?>
|
352 |
+
<?php _e( "Enter padding first, then select your column shortcode.", 'column-shortcodes' ); ?>
|
353 |
</p>
|
354 |
|
355 |
<div id="preview-padding">
|
364 |
</div>
|
365 |
</div>
|
366 |
|
367 |
+
<a class="padding-reset" href="javascript:;"><?php _e( "reset", 'column-shortcodes' ); ?></a>
|
368 |
</div>
|
369 |
</div><!--.cpsh-settings-->
|
370 |
|
372 |
|
373 |
</div><!--cpsh-generator-header-->
|
374 |
|
375 |
+
<div id="cpsh-generator-sidebar">
|
376 |
+
<div class="sidebox" id="cpsh-sidebox-feedback">
|
377 |
+
<div id="feedback-choice">
|
378 |
+
<h3><?php _e( 'Are you happy with Columns Shortcodes?', 'column-shortcodes' ); ?></h3>
|
379 |
|
380 |
+
<div class="inside">
|
381 |
+
<a href="#" class="yes"><?php _e( 'Yes' ); ?></a>
|
382 |
+
<a href="#" class="no"><?php _e( 'No' ); ?></a>
|
383 |
+
</div>
|
384 |
+
</div>
|
385 |
+
<div id="feedback-support">
|
386 |
+
<div class="inside">
|
387 |
+
<p>
|
388 |
+
<?php _e( "What's wrong? Need help? Let us know: please open a support topic on WordPress.org!", 'column-shortcodes' ); ?>
|
389 |
+
</p>
|
390 |
+
<ul class="share">
|
391 |
+
<li>
|
392 |
+
<a href="https://wordpress.org/support/plugin/column-shortcodes#new-post" target="_blank">
|
393 |
+
<div class="dashicons dashicons-wordpress"></div> <?php _e( 'Support Forums', 'column-shortcodes' ); ?>
|
394 |
+
</a>
|
395 |
+
</li>
|
396 |
+
</ul>
|
397 |
+
<div class="clear"></div>
|
398 |
+
</div>
|
399 |
+
</div>
|
400 |
+
<div id="feedback-rate">
|
401 |
+
<div class="inside">
|
402 |
+
<p>
|
403 |
+
<?php _e( "Woohoo! We're glad to hear that!", 'column-shortcodes' ); ?>
|
404 |
+
</p>
|
405 |
+
<p>
|
406 |
+
<?php _e( 'We would really love it if you could show your appreciation by giving us a rating on WordPress.org or tweet about Column Shortcodes!', 'column-shortcodes' ); ?>
|
407 |
+
</p>
|
408 |
+
<ul class="share">
|
409 |
+
<li>
|
410 |
+
<a href="http://wordpress.org/support/view/plugin-reviews/column-shortcodes#new-post" target="_blank">
|
411 |
+
<div class="dashicons dashicons-star-empty"></div> <?php _e( 'Rate', 'column-shortcodes' ); ?>
|
412 |
+
</a>
|
413 |
+
</li>
|
414 |
+
|
415 |
+
<li>
|
416 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'hashtags' => 'columnshortcodes', 'text' => urlencode( __( "I'm using Column Shortcodes for WordPress!", 'column-shortcodes' ) ), 'url' => urlencode( 'https://wordpress.org/plugins/column-shortcodes' ) ), 'https://twitter.com/intent/tweet' ) ); ?>" target="_blank">
|
417 |
+
<div class="dashicons dashicons-twitter"></div> <?php _e( 'Tweet', 'column-shortcodes' ); ?>
|
418 |
+
</a>
|
419 |
+
</li>
|
420 |
+
</ul>
|
421 |
+
<div class="clear"></div>
|
422 |
+
</div>
|
423 |
+
</div>
|
424 |
+
</div><!--cpsh-sidebox-feedback-->
|
425 |
+
|
426 |
+
<?php if ( $this->show_banner() ) : ?>
|
427 |
+
|
428 |
+
<div class="cs-acsidebox">
|
429 |
+
<div class="cs-acsidebox__wrapper">
|
430 |
+
<p class="cs-acsidebox__intro">
|
431 |
+
<?php printf( __( 'Be sure to check out other plugins by Codepress, such as %s. It adds custom columns to your posts, users, comments and media overview in your admin. Get more insight in your content now!', 'column-shortcodes' ), '<a target="_blank" href="https://wordpress.org/plugins/codepress-admin-columns/" class="cs-acsidebox__link">Admin Columns</a>' ); ?>
|
432 |
+
</p>
|
433 |
+
<a href="<?php echo esc_url( add_query_arg( array( 's' => 'Admin Columns', 'tab' => 'search', 'type' => 'term' ), admin_url( 'plugin-install.php' ) ) ); ?>#install_admin_columns" target="_blank" class="cs-acsidebox__button">
|
434 |
+
<img src="<?php echo $this->get_url() . "/assets/images/ac_vignet_grey.svg"; ?>" alt="" class="cs-acsidebox__button__logo"/>
|
435 |
+
<?php _e( 'Download for Free', 'column-shortcodes' ); ?>
|
436 |
+
</a>
|
437 |
+
<div class="cs-acsidebox__stars">
|
438 |
+
<?php for ( $i = 1; $i <= 5; $i++ ) : ?>
|
439 |
+
<span class="dashicons dashicons-star-filled"></span>
|
440 |
+
<?php endfor; ?>
|
441 |
+
<span class="cs-acsidebox__stars__count">(<?php echo $this->get_num_ratings(); ?>)</span>
|
442 |
+
</div>
|
443 |
+
<p class="cs-acsidebox__footer">
|
444 |
+
<?php printf( __( "%s Active Installs", 'column-shortcodes' ), '<em>' . $this->get_active_installs() . '+</em>' ); ?>
|
445 |
+
</p>
|
446 |
+
</div>
|
447 |
+
</div><!--cpsh-sidebox-admin-columns-->
|
448 |
+
<?php endif; ?>
|
449 |
+
</div><!--cpsh-generator-sidebar-->
|
450 |
+
|
451 |
+
</div><!--cpsh-generator-shell-->
|
452 |
</div>
|
453 |
</div>
|
454 |
|
455 |
<?php
|
456 |
}
|
457 |
|
458 |
+
/**
|
459 |
+
* @return bool True when banner is shown
|
460 |
+
*/
|
461 |
+
private function show_banner() {
|
462 |
+
$show_banner = true;
|
463 |
+
|
464 |
+
// Plugin is already installed
|
465 |
+
if ( class_exists( 'CPAC' ) || class_exists( 'ACP_Full' ) ) {
|
466 |
+
$show_banner = false;
|
467 |
+
}
|
468 |
+
|
469 |
+
return apply_filters( 'cpsh_show_banner', $show_banner );
|
470 |
+
}
|
471 |
+
|
472 |
+
/**
|
473 |
+
* @return false|stdClass Plugin info object
|
474 |
+
*/
|
475 |
+
private function get_plugin_info() {
|
476 |
+
$data = get_transient( 'cpsh_plugin_admin_columns_info' );
|
477 |
+
|
478 |
+
if ( false === $data && ! get_transient( 'cpsh_plugin_timeout' ) ) {
|
479 |
+
|
480 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
|
481 |
+
|
482 |
+
$info = plugins_api( 'plugin_information', array(
|
483 |
+
'slug' => 'codepress-admin-columns',
|
484 |
+
'fields' => array(
|
485 |
+
'rating' => true,
|
486 |
+
'ratings' => true,
|
487 |
+
'active_installs' => true,
|
488 |
+
'short_description' => false,
|
489 |
+
'sections' => false,
|
490 |
+
'requires' => false,
|
491 |
+
'downloaded' => false,
|
492 |
+
'last_updated' => false,
|
493 |
+
'added' => false,
|
494 |
+
'tags' => false,
|
495 |
+
'compatibility' => false,
|
496 |
+
'homepage' => false,
|
497 |
+
'donate_link' => false,
|
498 |
+
'versions' => false,
|
499 |
+
),
|
500 |
+
) );
|
501 |
+
|
502 |
+
if ( $info && ! is_wp_error( $info ) && isset( $info->name ) ) {
|
503 |
+
set_transient( 'cpsh_plugin_admin_columns_info', $info, DAY_IN_SECONDS * 7 ); // 7 day cache
|
504 |
+
|
505 |
+
$data = $info;
|
506 |
+
}
|
507 |
+
|
508 |
+
// Limit request in case API is not responding
|
509 |
+
set_transient( 'cpsh_plugin_timeout', true, HOUR_IN_SECONDS * 4 ); // 4 hours
|
510 |
+
}
|
511 |
+
|
512 |
+
return $data;
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
* @return string Active install count
|
517 |
+
*/
|
518 |
+
private function get_active_installs() {
|
519 |
+
$active_installs = 90000; // fallback
|
520 |
+
|
521 |
+
if ( $data = $this->get_plugin_info() ) {
|
522 |
+
$active_installs = $data->active_installs;
|
523 |
+
}
|
524 |
+
|
525 |
+
return number_format( $active_installs );
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* @return string Number of ratings
|
530 |
+
*/
|
531 |
+
private function get_num_ratings() {
|
532 |
+
$active_installs = 730; // fallback
|
533 |
+
|
534 |
+
if ( $data = $this->get_plugin_info() ) {
|
535 |
+
$active_installs = $data->num_ratings;
|
536 |
+
}
|
537 |
+
|
538 |
+
return number_format( $active_installs );
|
539 |
+
}
|
540 |
+
|
541 |
/**
|
542 |
* get shortcodes
|
543 |
*
|
544 |
* @since 0.1
|
545 |
*/
|
546 |
+
private function get_shortcodes() {
|
547 |
+
$shortcodes = array();
|
|
|
|
|
|
|
|
|
548 |
|
|
|
549 |
$column_shortcodes = apply_filters( 'cpsh_column_shortcodes', array(
|
550 |
+
'full_width' => array( 'display_name' => __( 'full width', 'column-shortcodes' ) ),
|
551 |
+
'one_half' => array( 'display_name' => __( 'one half', 'column-shortcodes' ) ),
|
552 |
+
'one_third' => array( 'display_name' => __( 'one third', 'column-shortcodes' ) ),
|
553 |
+
'one_fourth' => array( 'display_name' => __( 'one fourth', 'column-shortcodes' ) ),
|
554 |
+
'two_third' => array( 'display_name' => __( 'two third', 'column-shortcodes' ) ),
|
555 |
+
'three_fourth' => array( 'display_name' => __( 'three fourth', 'column-shortcodes' ) ),
|
556 |
+
'one_fifth' => array( 'display_name' => __( 'one fifth', 'column-shortcodes' ) ),
|
557 |
+
'two_fifth' => array( 'display_name' => __( 'two fifth', 'column-shortcodes' ) ),
|
558 |
+
'three_fifth' => array( 'display_name' => __( 'three fifth', 'column-shortcodes' ) ),
|
559 |
+
'four_fifth' => array( 'display_name' => __( 'four fifth', 'column-shortcodes' ) ),
|
560 |
+
'one_sixth' => array( 'display_name' => __( 'one sixth', 'column-shortcodes' ) ),
|
561 |
+
'five_sixth' => array( 'display_name' => __( 'five sixth', 'column-shortcodes' ) ),
|
562 |
) );
|
563 |
|
|
|
|
|
|
|
|
|
564 |
foreach ( $column_shortcodes as $short => $options ) {
|
565 |
|
566 |
// add prefix
|
567 |
+
$shortcode = $this->get_prefix() . $short;
|
568 |
|
569 |
$shortcodes[] = array(
|
570 |
'name' => $shortcode,
|
577 |
),
|
578 |
);
|
579 |
|
580 |
+
if ( 'full_width' === $short ) {
|
581 |
continue;
|
582 |
}
|
583 |
|
585 |
'name' => "{$shortcode}_last",
|
586 |
'class' => "{$short}_last",
|
587 |
'options' => array(
|
588 |
+
'display_name' => $options['display_name'] . ' (' . __( 'last', 'column-shortcodes' ) . ')',
|
589 |
'open_tag' => '\n' . "[{$shortcode}_last]",
|
590 |
'close_tag' => "[/{$shortcode}_last]" . '\n',
|
591 |
'key' => '',
|
597 |
}
|
598 |
|
599 |
/**
|
600 |
+
* Add buttons to TinyMCE HTML tab
|
601 |
*
|
602 |
* @since 0.1
|
603 |
*/
|
604 |
+
public function add_html_buttons() {
|
605 |
wp_print_scripts( 'quicktags' );
|
606 |
|
|
|
|
|
607 |
// output script
|
608 |
+
$script_buttons = array();
|
609 |
+
foreach ( $this->get_shortcodes() as $shortcode ) {
|
610 |
$options = $shortcode['options'];
|
611 |
|
612 |
+
$script_buttons[] = "edButtons[edButtons.length] = new edButton('ed_{$shortcode['name']}'
|
613 |
,'{$shortcode['name']}'
|
614 |
,'{$options['open_tag']}'
|
615 |
,'{$options['close_tag']}'
|
617 |
); \n";
|
618 |
}
|
619 |
|
620 |
+
?>
|
621 |
+
<script type='text/javascript'>
|
622 |
+
<?php echo implode( $script_buttons ); ?>
|
623 |
+
</script>
|
624 |
+
<?php
|
|
|
|
|
|
|
|
|
625 |
}
|
626 |
|
627 |
/**
|
630 |
* @since 0.1
|
631 |
*
|
632 |
* @param string $content
|
633 |
+
* @param bool $paragraph_tag Filter p-tags
|
634 |
+
* @param bool $br_tag Filter br-tags
|
635 |
*
|
636 |
* @return string Shortcode
|
637 |
*/
|
638 |
+
private function content_helper( $content, $paragraph_tag = false, $br_tag = false ) {
|
639 |
$content = preg_replace( '#^<\/p>|^<br \/>|<p>$#', '', $content );
|
640 |
|
641 |
if ( $br_tag ) {
|
650 |
}
|
651 |
}
|
652 |
|
653 |
+
new Codepress_Column_Shortcodes();
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: codepress, tschutter, davidmosterd, dungengronovius
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J
|
4 |
Tags: columns, column, shortcodes, shortcode, divider, layout, posts, editor, wp-admin, admin, codepress, wordpress
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 0
|
8 |
|
9 |
Adds shortcodes to easily create columns in your posts or pages.
|
10 |
|
@@ -259,6 +259,12 @@ You will find a .po file in the languages folder which you can use. You can send
|
|
259 |
|
260 |
== Changelog ==
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
= 0.6.9 =
|
263 |
* [Fixed] Rollback of the auto paragraphs. Too much conflicts with other shortcodes
|
264 |
|
@@ -272,7 +278,7 @@ You will find a .po file in the languages folder which you can use. You can send
|
|
272 |
* [Fixed] Swapped images for 5/6 columns
|
273 |
|
274 |
= 0.6.5 =
|
275 |
-
* added filter to prevent loading of frontend styles: add_filter( 'cpsh_load_styles', '__return_false' )
|
276 |
* added 5/6 column;
|
277 |
|
278 |
= 0.6.4 =
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J
|
4 |
Tags: columns, column, shortcodes, shortcode, divider, layout, posts, editor, wp-admin, admin, codepress, wordpress
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 4.9.4
|
7 |
+
Stable tag: 1.0
|
8 |
|
9 |
Adds shortcodes to easily create columns in your posts or pages.
|
10 |
|
259 |
|
260 |
== Changelog ==
|
261 |
|
262 |
+
= 1.0 =
|
263 |
+
* [Fixed] Compatible with WordPress 4.8
|
264 |
+
* [Fixed] Padding generator will automatically add 'px' to numbers
|
265 |
+
* [Added] Added filter to hide banner `add_filter( 'cpsh_show_banner', '__return_false' );`
|
266 |
+
* [Improved] UI improvements for better readability
|
267 |
+
|
268 |
= 0.6.9 =
|
269 |
* [Fixed] Rollback of the auto paragraphs. Too much conflicts with other shortcodes
|
270 |
|
278 |
* [Fixed] Swapped images for 5/6 columns
|
279 |
|
280 |
= 0.6.5 =
|
281 |
+
* added filter to prevent loading of frontend styles: `add_filter( 'cpsh_load_styles', '__return_false' );`
|
282 |
* added 5/6 column;
|
283 |
|
284 |
= 0.6.4 =
|