Version Description
- Adds options to specify Media Sizes
- Adds options to modify the image ( Crop, Rotate, Flip & Scale )
- Creates only required image sizes ( Rather than all registered image sizes )
- Adds thickbox to BuddyPress Media Widget
- Fixes bug in js
- Adds framework for shotcode support ( Functionality will be added in the next release )
Download this release
Release Info
Developer | JoshuaAbenazer |
Plugin | rtMedia for WordPress, BuddyPress and bbPress |
Version | 2.9 |
Comparing to | |
See all releases |
Code changes from version 2.8.1 to 2.9
- app/assets/css/image-edit.css +701 -0
- app/assets/css/main.css +1 -2
- app/assets/js/bp-media-activity-uploader.js +0 -1
- app/assets/js/main.js +14 -2
- app/helper/BPMediaSettings.php +142 -54
- app/main/BPMediaLoader.php +142 -149
- app/main/BuddyPressMedia.php +78 -39
- app/main/includes/BPMediaActions.php +123 -29
- app/main/includes/BPMediaFilters.php +15 -0
- app/main/includes/BPMediaFunction.php +2 -1
- app/main/includes/BPMediaHostWordpress.php +46 -29
- app/main/includes/BPMediaImage.php +48 -0
- app/main/profile/BPMediaAlbum.php +6 -2
- app/main/profile/BPMediaScreen.php +1 -0
- index.php +1 -1
- readme.txt +13 -5
app/assets/css/image-edit.css
ADDED
@@ -0,0 +1,701 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*------------------------------------------------------------------------------
|
2 |
+
14.0 - Media Screen
|
3 |
+
------------------------------------------------------------------------------*/
|
4 |
+
|
5 |
+
.media-item .describe {
|
6 |
+
border-collapse: collapse;
|
7 |
+
width: 100%;
|
8 |
+
border-top-style: solid;
|
9 |
+
border-top-width: 1px;
|
10 |
+
clear: both;
|
11 |
+
cursor: default;
|
12 |
+
}
|
13 |
+
|
14 |
+
.media-item.media-blank .describe {
|
15 |
+
border: 0;
|
16 |
+
}
|
17 |
+
|
18 |
+
.media-item .describe th {
|
19 |
+
vertical-align: top;
|
20 |
+
text-align: left;
|
21 |
+
padding: 5px 10px 10px;
|
22 |
+
width: 140px;
|
23 |
+
}
|
24 |
+
|
25 |
+
.media-item .describe .align th {
|
26 |
+
padding-top: 0;
|
27 |
+
}
|
28 |
+
|
29 |
+
.media-item .media-item-info tr {
|
30 |
+
background-color: transparent;
|
31 |
+
}
|
32 |
+
|
33 |
+
.media-item .describe td {
|
34 |
+
padding: 0 8px 8px 0;
|
35 |
+
vertical-align: top;
|
36 |
+
}
|
37 |
+
|
38 |
+
.media-item thead.media-item-info td {
|
39 |
+
padding: 4px 10px 0;
|
40 |
+
}
|
41 |
+
|
42 |
+
.media-item .media-item-info .A1B1 {
|
43 |
+
padding: 0 0 0 10px;
|
44 |
+
}
|
45 |
+
|
46 |
+
.media-item td.savesend {
|
47 |
+
padding-bottom: 15px;
|
48 |
+
}
|
49 |
+
|
50 |
+
.media-item .thumbnail {
|
51 |
+
max-height: 128px;
|
52 |
+
max-width: 128px;
|
53 |
+
}
|
54 |
+
|
55 |
+
#wpbody-content #async-upload-wrap a {
|
56 |
+
display: none;
|
57 |
+
}
|
58 |
+
|
59 |
+
.media-upload-form {
|
60 |
+
margin-top: 20px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.media-upload-form td label {
|
64 |
+
margin-right: 6px;
|
65 |
+
margin-left: 2px;
|
66 |
+
}
|
67 |
+
|
68 |
+
.media-upload-form .align .field label {
|
69 |
+
display: inline;
|
70 |
+
padding: 0 0 0 23px;
|
71 |
+
margin: 0 1em 0 3px;
|
72 |
+
font-weight: bold;
|
73 |
+
}
|
74 |
+
|
75 |
+
.media-upload-form tr.image-size label {
|
76 |
+
margin: 0 0 0 5px;
|
77 |
+
font-weight: bold;
|
78 |
+
}
|
79 |
+
|
80 |
+
.media-upload-form th.label label {
|
81 |
+
font-weight: bold;
|
82 |
+
margin: 0.5em;
|
83 |
+
font-size: 13px;
|
84 |
+
}
|
85 |
+
|
86 |
+
.media-upload-form th.label label span {
|
87 |
+
padding: 0 5px;
|
88 |
+
}
|
89 |
+
|
90 |
+
abbr.required {
|
91 |
+
border: medium none;
|
92 |
+
text-decoration: none;
|
93 |
+
}
|
94 |
+
|
95 |
+
.media-item .describe input[type="text"],
|
96 |
+
.media-item .describe textarea {
|
97 |
+
width: 460px;
|
98 |
+
}
|
99 |
+
|
100 |
+
.media-item .describe p.help {
|
101 |
+
margin: 0;
|
102 |
+
padding: 0 0 0 5px;
|
103 |
+
}
|
104 |
+
|
105 |
+
.media-item .edit-attachment,
|
106 |
+
.describe-toggle-on,
|
107 |
+
.describe-toggle-off {
|
108 |
+
display: block;
|
109 |
+
line-height: 36px;
|
110 |
+
float: right;
|
111 |
+
margin-right: 15px;
|
112 |
+
}
|
113 |
+
|
114 |
+
.media-item .describe-toggle-off,
|
115 |
+
.media-item.open .describe-toggle-on {
|
116 |
+
display: none;
|
117 |
+
}
|
118 |
+
|
119 |
+
.media-item.open .describe-toggle-off {
|
120 |
+
display: block;
|
121 |
+
}
|
122 |
+
|
123 |
+
#media-items .media-item {
|
124 |
+
border-style: solid;
|
125 |
+
border-width: 1px;
|
126 |
+
min-height: 36px;
|
127 |
+
position: relative;
|
128 |
+
margin-top: -1px;
|
129 |
+
width: 100%;
|
130 |
+
}
|
131 |
+
|
132 |
+
#media-items {
|
133 |
+
width: 623px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.media-new-php #media-items {
|
137 |
+
margin: 1em 0;
|
138 |
+
}
|
139 |
+
|
140 |
+
#media-items:empty {
|
141 |
+
border: 0 none;
|
142 |
+
}
|
143 |
+
|
144 |
+
.media-item .filename {
|
145 |
+
line-height: 36px;
|
146 |
+
overflow: hidden;
|
147 |
+
padding: 0 10px;
|
148 |
+
}
|
149 |
+
|
150 |
+
.media-item .error-div {
|
151 |
+
padding-left: 10px;
|
152 |
+
}
|
153 |
+
|
154 |
+
.media-item .pinkynail {
|
155 |
+
float: left;
|
156 |
+
margin: 2px 2px 0;
|
157 |
+
max-width: 40px;
|
158 |
+
max-height: 32px;
|
159 |
+
}
|
160 |
+
|
161 |
+
.media-item .startopen,
|
162 |
+
.media-item .startclosed {
|
163 |
+
display: none;
|
164 |
+
}
|
165 |
+
|
166 |
+
.media-item .original {
|
167 |
+
position: relative;
|
168 |
+
height: 34px;
|
169 |
+
}
|
170 |
+
|
171 |
+
.media-item .progress {
|
172 |
+
float: right;
|
173 |
+
height: 22px;
|
174 |
+
margin: 6px 10px 0 0;
|
175 |
+
width: 200px;
|
176 |
+
line-height: 2em;
|
177 |
+
padding: 0;
|
178 |
+
overflow: hidden;
|
179 |
+
margin-bottom: 2px;
|
180 |
+
border: 1px solid #d1d1d1;
|
181 |
+
background: #f7f7f7;
|
182 |
+
background-image: -webkit-gradient(linear, left bottom, left top, from(#fff), to(#f7f7f7));
|
183 |
+
background-image: -webkit-linear-gradient(bottom, #fff, #f7f7f7);
|
184 |
+
background-image: -moz-linear-gradient(bottom, #fff, #f7f7f7);
|
185 |
+
background-image: -o-linear-gradient(bottom, #fff, #f7f7f7);
|
186 |
+
background-image: linear-gradient(to top, #fff, #f7f7f7);
|
187 |
+
-webkit-border-radius: 3px;
|
188 |
+
border-radius: 3px;
|
189 |
+
-webkit-box-shadow: inset 0 0 3px rgba(0,0,0,0.1);
|
190 |
+
box-shadow: inset 0 0 3px rgba(0,0,0,0.1);
|
191 |
+
}
|
192 |
+
|
193 |
+
.media-item .bar {
|
194 |
+
z-index: 9;
|
195 |
+
width: 0;
|
196 |
+
height: 100%;
|
197 |
+
margin-top: -24px;
|
198 |
+
background-color: #8cc1e9;
|
199 |
+
background-image: -webkit-gradient(linear, left bottom, left top, from(#72a7cf), to(#8cc1e9));
|
200 |
+
background-image: -webkit-linear-gradient(bottom, #72a7cf, #8cc1e9);
|
201 |
+
background-image: -moz-linear-gradient(bottom, #72a7cf, #8cc1e9);
|
202 |
+
background-image: -o-linear-gradient(bottom, #72a7cf, #8cc1e9);
|
203 |
+
background-image: linear-gradient(to top, #72a7cf, #8cc1e9);
|
204 |
+
-webkit-border-radius: 3px;
|
205 |
+
border-radius: 3px;
|
206 |
+
-webkit-box-shadow: 0 0 3px rgba(0,0,0,0.3);
|
207 |
+
box-shadow: 0 0 3px rgba(0,0,0,0.3);
|
208 |
+
}
|
209 |
+
|
210 |
+
.media-item .progress .percent {
|
211 |
+
z-index: 10;
|
212 |
+
position: relative;
|
213 |
+
width: 200px;
|
214 |
+
padding: 0 8px;
|
215 |
+
text-shadow: 0 1px 0 rgba(255,255,255,0.4);
|
216 |
+
color: rgba(0,0,0,0.6);
|
217 |
+
}
|
218 |
+
|
219 |
+
.upload-php .fixed .column-parent {
|
220 |
+
width: 15%;
|
221 |
+
}
|
222 |
+
|
223 |
+
.js .html-uploader #plupload-upload-ui {
|
224 |
+
display: none;
|
225 |
+
}
|
226 |
+
|
227 |
+
.js .html-uploader #html-upload-ui {
|
228 |
+
display: block;
|
229 |
+
}
|
230 |
+
|
231 |
+
.media-upload-form .media-item.error {
|
232 |
+
margin: 0;
|
233 |
+
padding: 0;
|
234 |
+
}
|
235 |
+
|
236 |
+
.media-upload-form .media-item.error p,
|
237 |
+
.media-item .error-div {
|
238 |
+
line-height: 16px;
|
239 |
+
margin: 5px 10px;
|
240 |
+
padding: 0;
|
241 |
+
}
|
242 |
+
|
243 |
+
.media-item .error-div a.dismiss {
|
244 |
+
display: block;
|
245 |
+
float: right;
|
246 |
+
margin: 5px 4px 0 15px;
|
247 |
+
}
|
248 |
+
|
249 |
+
/*------------------------------------------------------------------------------
|
250 |
+
14.1 - Media Library
|
251 |
+
------------------------------------------------------------------------------*/
|
252 |
+
|
253 |
+
.find-box {
|
254 |
+
width: 600px;
|
255 |
+
height: 300px;
|
256 |
+
overflow: hidden;
|
257 |
+
padding: 33px 0 51px;
|
258 |
+
position: absolute;
|
259 |
+
z-index: 1000;
|
260 |
+
}
|
261 |
+
|
262 |
+
.find-box-head {
|
263 |
+
cursor: move;
|
264 |
+
font-weight: bold;
|
265 |
+
height: 2em;
|
266 |
+
line-height: 2em;
|
267 |
+
padding: 1px 12px;
|
268 |
+
position: absolute;
|
269 |
+
top: 5px;
|
270 |
+
width: 100%;
|
271 |
+
}
|
272 |
+
|
273 |
+
.find-box-inside {
|
274 |
+
overflow: auto;
|
275 |
+
padding: 6px;
|
276 |
+
height: 100%;
|
277 |
+
}
|
278 |
+
|
279 |
+
.find-box-search {
|
280 |
+
overflow: hidden;
|
281 |
+
padding: 9px;
|
282 |
+
position: relative;
|
283 |
+
}
|
284 |
+
|
285 |
+
.find-box-search .spinner {
|
286 |
+
float: none;
|
287 |
+
left: 125px;
|
288 |
+
position: absolute;
|
289 |
+
top: 9px;
|
290 |
+
}
|
291 |
+
|
292 |
+
#find-posts-input {
|
293 |
+
float: left;
|
294 |
+
width: 140px;
|
295 |
+
height: 24px;
|
296 |
+
}
|
297 |
+
|
298 |
+
#find-posts-search {
|
299 |
+
float: left;
|
300 |
+
margin: 1px 4px 0 3px;
|
301 |
+
}
|
302 |
+
|
303 |
+
#find-posts-response {
|
304 |
+
margin: 8px 0;
|
305 |
+
padding: 0 1px 6px;
|
306 |
+
}
|
307 |
+
|
308 |
+
#find-posts-response table {
|
309 |
+
width: 100%;
|
310 |
+
}
|
311 |
+
|
312 |
+
#find-posts-response .found-radio {
|
313 |
+
padding: 3px 0 0 8px;
|
314 |
+
width: 15px;
|
315 |
+
}
|
316 |
+
|
317 |
+
.find-box-buttons {
|
318 |
+
padding: 8px;
|
319 |
+
overflow: hidden;
|
320 |
+
}
|
321 |
+
|
322 |
+
.find-box #resize-se {
|
323 |
+
position: absolute;
|
324 |
+
right: 1px;
|
325 |
+
bottom: 1px;
|
326 |
+
}
|
327 |
+
|
328 |
+
.ui-find-overlay {
|
329 |
+
position: absolute;
|
330 |
+
top: 0;
|
331 |
+
left: 0;
|
332 |
+
background-color: #000;
|
333 |
+
opacity: 0.6;
|
334 |
+
filter: alpha(opacity=60);
|
335 |
+
}
|
336 |
+
|
337 |
+
ul#dismissed-updates {
|
338 |
+
display: none;
|
339 |
+
}
|
340 |
+
|
341 |
+
form.upgrade {
|
342 |
+
margin-top: 8px;
|
343 |
+
}
|
344 |
+
|
345 |
+
form.upgrade .hint {
|
346 |
+
font-style: italic;
|
347 |
+
font-size: 85%;
|
348 |
+
margin: -0.5em 0 2em 0;
|
349 |
+
}
|
350 |
+
|
351 |
+
#poststuff .inside .the-tagcloud {
|
352 |
+
margin: 5px 0 10px;
|
353 |
+
padding: 8px;
|
354 |
+
border-width: 1px;
|
355 |
+
border-style: solid;
|
356 |
+
line-height: 1.8em;
|
357 |
+
word-spacing: 3px;
|
358 |
+
-webkit-border-radius: 6px;
|
359 |
+
border-radius: 6px;
|
360 |
+
}
|
361 |
+
|
362 |
+
.drag-drop #drag-drop-area {
|
363 |
+
border: 4px dashed #DDDDDD;
|
364 |
+
height: 200px;
|
365 |
+
}
|
366 |
+
|
367 |
+
.drag-drop .drag-drop-inside {
|
368 |
+
margin: 70px auto 0;
|
369 |
+
width: 250px;
|
370 |
+
}
|
371 |
+
|
372 |
+
.drag-drop-inside p {
|
373 |
+
color: #aaa;
|
374 |
+
font-size: 14px;
|
375 |
+
margin: 5px 0;
|
376 |
+
display: none;
|
377 |
+
}
|
378 |
+
|
379 |
+
.drag-drop .drag-drop-inside p {
|
380 |
+
text-align: center;
|
381 |
+
}
|
382 |
+
|
383 |
+
.drag-drop-inside p.drag-drop-info {
|
384 |
+
font-size: 20px;
|
385 |
+
}
|
386 |
+
|
387 |
+
.drag-drop .drag-drop-inside p,
|
388 |
+
.drag-drop-inside p.drag-drop-buttons {
|
389 |
+
display: block;
|
390 |
+
}
|
391 |
+
|
392 |
+
/*
|
393 |
+
#drag-drop-area:-moz-drag-over {
|
394 |
+
border-color: #83b4d8;
|
395 |
+
}
|
396 |
+
borger color while dragging a file over the uploader drop area */
|
397 |
+
.drag-drop.drag-over #drag-drop-area {
|
398 |
+
border-color: #83b4d8;
|
399 |
+
}
|
400 |
+
|
401 |
+
#plupload-upload-ui {
|
402 |
+
position: relative;
|
403 |
+
}
|
404 |
+
|
405 |
+
/*------------------------------------------------------------------------------
|
406 |
+
14.2 - Image Editor
|
407 |
+
------------------------------------------------------------------------------*/
|
408 |
+
|
409 |
+
.describe .image-editor {
|
410 |
+
vertical-align: top;
|
411 |
+
}
|
412 |
+
|
413 |
+
.imgedit-wrap {
|
414 |
+
position: relative;
|
415 |
+
}
|
416 |
+
|
417 |
+
.imgedit-settings p {
|
418 |
+
margin: 8px 0;
|
419 |
+
}
|
420 |
+
|
421 |
+
.post-php .imgedit-wrap table {
|
422 |
+
width: 100%;
|
423 |
+
}
|
424 |
+
|
425 |
+
.describe .imgedit-wrap table td,
|
426 |
+
.wp_attachment_holder .imgedit-wrap table td {
|
427 |
+
vertical-align: top;
|
428 |
+
padding-top: 0;
|
429 |
+
}
|
430 |
+
|
431 |
+
.describe .imgedit-wrap table td.imgedit-settings {
|
432 |
+
padding: 0 5px;
|
433 |
+
}
|
434 |
+
|
435 |
+
.wp_attachment_holder .imgedit-wrap table td.imgedit-settings {
|
436 |
+
width: 250px;
|
437 |
+
}
|
438 |
+
|
439 |
+
td.imgedit-settings input {
|
440 |
+
margin-top: 0;
|
441 |
+
vertical-align: middle;
|
442 |
+
}
|
443 |
+
|
444 |
+
.imgedit-wait {
|
445 |
+
position: absolute;
|
446 |
+
top: 0;
|
447 |
+
background: #fff url(../../../../../../wp-admin/images/wpspin_light.gif) no-repeat scroll 22px 10px;
|
448 |
+
background-size: 16px 16px;
|
449 |
+
opacity: 0.7;
|
450 |
+
filter: alpha(opacity=70);
|
451 |
+
width: 100%;
|
452 |
+
height: 500px;
|
453 |
+
display: none;
|
454 |
+
}
|
455 |
+
|
456 |
+
.spinner {
|
457 |
+
background: url(../../../../../../wp-admin/images/wpspin_light.gif) no-repeat;
|
458 |
+
background-size: 16px 16px;
|
459 |
+
display: none;
|
460 |
+
float: right;
|
461 |
+
opacity: 0.7;
|
462 |
+
filter: alpha(opacity=70);
|
463 |
+
width: 16px;
|
464 |
+
height: 16px;
|
465 |
+
margin: 5px 5px 0;
|
466 |
+
}
|
467 |
+
|
468 |
+
.no-float {
|
469 |
+
float: none;
|
470 |
+
}
|
471 |
+
|
472 |
+
.media-disabled,
|
473 |
+
.imgedit-settings .disabled {
|
474 |
+
color: grey;
|
475 |
+
}
|
476 |
+
|
477 |
+
.wp_attachment_image,
|
478 |
+
.A1B1 {
|
479 |
+
overflow: hidden;
|
480 |
+
}
|
481 |
+
|
482 |
+
.wp_attachment_image .button,
|
483 |
+
.A1B1 .button {
|
484 |
+
float: left;
|
485 |
+
}
|
486 |
+
|
487 |
+
.no-js .wp_attachment_image .button {
|
488 |
+
display: none;
|
489 |
+
}
|
490 |
+
|
491 |
+
.wp_attachment_image .spinner,
|
492 |
+
.A1B1 .spinner {
|
493 |
+
float: left;
|
494 |
+
padding: 0 4px 4px;
|
495 |
+
vertical-align: bottom;
|
496 |
+
}
|
497 |
+
|
498 |
+
.imgedit-menu {
|
499 |
+
margin: 0 0 12px;
|
500 |
+
min-width: 300px;
|
501 |
+
}
|
502 |
+
|
503 |
+
.imgedit-menu div {
|
504 |
+
float: left;
|
505 |
+
width: 32px;
|
506 |
+
height: 32px;
|
507 |
+
}
|
508 |
+
|
509 |
+
.imgedit-crop-wrap {
|
510 |
+
position: relative;
|
511 |
+
}
|
512 |
+
|
513 |
+
.imgedit-crop {
|
514 |
+
background: transparent url('../../../../../../wp-admin/images/imgedit-icons.png') no-repeat scroll -9px -31px;
|
515 |
+
margin: 0 8px 0 0;
|
516 |
+
}
|
517 |
+
|
518 |
+
.imgedit-crop.disabled:hover {
|
519 |
+
background-position: -9px -31px;
|
520 |
+
}
|
521 |
+
|
522 |
+
.imgedit-crop:hover {
|
523 |
+
background-position: -9px -1px;
|
524 |
+
}
|
525 |
+
|
526 |
+
.imgedit-rleft {
|
527 |
+
background: transparent url('../../../../../../wp-admin/images/imgedit-icons.png') no-repeat scroll -46px -31px;
|
528 |
+
margin: 0 3px;
|
529 |
+
}
|
530 |
+
|
531 |
+
.imgedit-rleft.disabled:hover {
|
532 |
+
background-position: -46px -31px;
|
533 |
+
}
|
534 |
+
|
535 |
+
.imgedit-rleft:hover {
|
536 |
+
background-position: -46px -1px;
|
537 |
+
}
|
538 |
+
|
539 |
+
.imgedit-rright {
|
540 |
+
background: transparent url('../../../../../../wp-admin/images/imgedit-icons.png') no-repeat scroll -77px -31px;
|
541 |
+
margin: 0 8px 0 3px;
|
542 |
+
}
|
543 |
+
|
544 |
+
.imgedit-rright.disabled:hover {
|
545 |
+
background-position: -77px -31px;
|
546 |
+
}
|
547 |
+
|
548 |
+
.imgedit-rright:hover {
|
549 |
+
background-position: -77px -1px;
|
550 |
+
}
|
551 |
+
|
552 |
+
.imgedit-flipv {
|
553 |
+
background: transparent url('../../../../../../wp-admin/images/imgedit-icons.png') no-repeat scroll -115px -31px;
|
554 |
+
margin: 0 3px;
|
555 |
+
}
|
556 |
+
|
557 |
+
.imgedit-flipv.disabled:hover {
|
558 |
+
background-position: -115px -31px;
|
559 |
+
}
|
560 |
+
|
561 |
+
.imgedit-flipv:hover {
|
562 |
+
background-position: -115px -1px;
|
563 |
+
}
|
564 |
+
|
565 |
+
.imgedit-fliph {
|
566 |
+
background: transparent url('../../../../../../wp-admin/images/imgedit-icons.png') no-repeat scroll -147px -31px;
|
567 |
+
margin: 0 8px 0 3px;
|
568 |
+
}
|
569 |
+
|
570 |
+
.imgedit-fliph.disabled:hover {
|
571 |
+
background-position: -147px -31px;
|
572 |
+
}
|
573 |
+
|
574 |
+
.imgedit-fliph:hover {
|
575 |
+
background-position: -147px -1px;
|
576 |
+
}
|
577 |
+
|
578 |
+
.imgedit-undo {
|
579 |
+
background: transparent url('../../../../../../wp-admin/images/imgedit-icons.png') no-repeat scroll -184px -31px;
|
580 |
+
margin: 0 3px;
|
581 |
+
}
|
582 |
+
|
583 |
+
.imgedit-undo.disabled:hover {
|
584 |
+
background-position: -184px -31px;
|
585 |
+
}
|
586 |
+
|
587 |
+
.imgedit-undo:hover {
|
588 |
+
background-position: -184px -1px;
|
589 |
+
}
|
590 |
+
|
591 |
+
.imgedit-redo {
|
592 |
+
background: transparent url('../../../../../../wp-admin/images/imgedit-icons.png') no-repeat scroll -215px -31px;
|
593 |
+
margin: 0 8px 0 3px;
|
594 |
+
}
|
595 |
+
|
596 |
+
.imgedit-redo.disabled:hover {
|
597 |
+
background-position: -215px -31px;
|
598 |
+
}
|
599 |
+
|
600 |
+
.imgedit-redo:hover {
|
601 |
+
background-position: -215px -1px;
|
602 |
+
}
|
603 |
+
|
604 |
+
.imgedit-applyto img {
|
605 |
+
margin: 0 8px 0 0;
|
606 |
+
}
|
607 |
+
|
608 |
+
.imgedit-group-top {
|
609 |
+
margin: 5px 0;
|
610 |
+
}
|
611 |
+
|
612 |
+
.imgedit-applyto .imgedit-label {
|
613 |
+
padding: 2px 0 0;
|
614 |
+
display: block;
|
615 |
+
}
|
616 |
+
|
617 |
+
.imgedit-help {
|
618 |
+
display: none;
|
619 |
+
font-style: italic;
|
620 |
+
margin-bottom: 8px;
|
621 |
+
}
|
622 |
+
|
623 |
+
a.imgedit-help-toggle {
|
624 |
+
text-decoration: none;
|
625 |
+
}
|
626 |
+
|
627 |
+
.form-table td.imgedit-response {
|
628 |
+
padding: 0;
|
629 |
+
}
|
630 |
+
|
631 |
+
.imgedit-submit {
|
632 |
+
margin: 8px 0;
|
633 |
+
}
|
634 |
+
|
635 |
+
.imgedit-submit-btn {
|
636 |
+
margin-left: 20px;
|
637 |
+
}
|
638 |
+
|
639 |
+
.imgedit-wrap .nowrap {
|
640 |
+
white-space: nowrap;
|
641 |
+
}
|
642 |
+
|
643 |
+
span.imgedit-scale-warn {
|
644 |
+
color: red;
|
645 |
+
font-size: 20px;
|
646 |
+
font-style: normal;
|
647 |
+
visibility: hidden;
|
648 |
+
vertical-align: middle;
|
649 |
+
}
|
650 |
+
|
651 |
+
.imgedit-group {
|
652 |
+
border-width: 1px;
|
653 |
+
border-style: solid;
|
654 |
+
-webkit-border-radius: 3px;
|
655 |
+
border-radius: 3px;
|
656 |
+
margin-bottom: 8px;
|
657 |
+
padding: 2px 10px;
|
658 |
+
}
|
659 |
+
|
660 |
+
.wp_attachment_details {
|
661 |
+
margin-bottom: 20px;
|
662 |
+
}
|
663 |
+
|
664 |
+
.imgedit-menu div {
|
665 |
+
border-color: #d5d5d5;
|
666 |
+
background-color: #f1f1f1;
|
667 |
+
}
|
668 |
+
|
669 |
+
.imgedit-menu div:hover {
|
670 |
+
border-color: #c1c1c1;
|
671 |
+
background-color: #eaeaea;
|
672 |
+
}
|
673 |
+
|
674 |
+
.imgedit-menu div.disabled {
|
675 |
+
border-color: #ccc;
|
676 |
+
background-color: #ddd;
|
677 |
+
filter: alpha(opacity=50);
|
678 |
+
opacity: 0.5;
|
679 |
+
}
|
680 |
+
|
681 |
+
/*------------------------------------------------------------------------------
|
682 |
+
Custom Styles
|
683 |
+
------------------------------------------------------------------------------*/
|
684 |
+
|
685 |
+
.bp-media-image-editor-cotnainer { margin-top : 35px; }
|
686 |
+
.wp_attachment_image .bp-media-image-edit { float: left; }
|
687 |
+
.wp_attachment_image .thumbnail { max-width: 300px; }
|
688 |
+
.wp_attachment_image .spinner { display: none; }
|
689 |
+
.bp-media-image-editor-cotnainer .hidden { display: none; }
|
690 |
+
.bp-media-image-editor-cotnainer div.updated {
|
691 |
+
margin: 5px 0 15px;
|
692 |
+
background-color: #ffffe0;
|
693 |
+
border-color: #e6db55;
|
694 |
+
padding: 0 .6em;
|
695 |
+
-webkit-border-radius: 3px;
|
696 |
+
border-radius: 3px;
|
697 |
+
border-width: 1px;
|
698 |
+
border-style: solid;
|
699 |
+
}
|
700 |
+
|
701 |
+
.bp-media-image-editor-cotnainer div.updated p { margin: .5em 0;padding: 2px; }
|
app/assets/css/main.css
CHANGED
@@ -247,7 +247,7 @@ position: relative;}
|
|
247 |
.media-tabs-container .ui-tabs-hide{display: none}
|
248 |
|
249 |
.media-tabs-container .ui-tabs-nav{clear: both;display: block;margin: 0 0 15px;overflow: hidden;}
|
250 |
-
.media-tabs-container .ui-state-default{border-left: 1px solid;float: left;line-height: 110%;padding: 0 5px;}
|
251 |
.media-tabs-container .ui-state-default:first-child{margin-left: 0px;border: 0; padding-left: 0}
|
252 |
|
253 |
.media-tabs-container .ui-state-default a{text-decoration: none}
|
@@ -434,7 +434,6 @@ float:left;
|
|
434 |
display:none;
|
435 |
}
|
436 |
|
437 |
-
|
438 |
@media (min-width: 981px) and (max-width: 1096px) {
|
439 |
li #bp-media-upload-ui #drag-drop-area{padding: 10px 0;}
|
440 |
/* li #bp-media-upload-ui .drag-drop-inside{margin: 0 auto;}*/
|
247 |
.media-tabs-container .ui-tabs-hide{display: none}
|
248 |
|
249 |
.media-tabs-container .ui-tabs-nav{clear: both;display: block;margin: 0 0 15px;overflow: hidden;}
|
250 |
+
.media-tabs-container .ui-state-default{border-left: 1px solid;float: left;line-height: 110%;padding: 0 5px; list-style: none;}
|
251 |
.media-tabs-container .ui-state-default:first-child{margin-left: 0px;border: 0; padding-left: 0}
|
252 |
|
253 |
.media-tabs-container .ui-state-default a{text-decoration: none}
|
434 |
display:none;
|
435 |
}
|
436 |
|
|
|
437 |
@media (min-width: 981px) and (max-width: 1096px) {
|
438 |
li #bp-media-upload-ui #drag-drop-area{padding: 10px 0;}
|
439 |
/* li #bp-media-upload-ui .drag-drop-inside{margin: 0 auto;}*/
|
app/assets/js/bp-media-activity-uploader.js
CHANGED
@@ -137,7 +137,6 @@ jQuery(document).ready(function(){
|
|
137 |
// bp_media_activity_album_selected = jQuery('#bp-media-activity-selected-album').val();
|
138 |
$bp_media_activity_album_selected = default_album;
|
139 |
$bp_media_activity_uploader.start();
|
140 |
-
do_bp_jazz();
|
141 |
up.refresh(); // Reposition Flash/Silverlight
|
142 |
});
|
143 |
$bp_media_activity_uploader.bind('UploadProgress', function(up, file) {
|
137 |
// bp_media_activity_album_selected = jQuery('#bp-media-activity-selected-album').val();
|
138 |
$bp_media_activity_album_selected = default_album;
|
139 |
$bp_media_activity_uploader.start();
|
|
|
140 |
up.refresh(); // Reposition Flash/Silverlight
|
141 |
});
|
142 |
$bp_media_activity_uploader.bind('UploadProgress', function(up, file) {
|
app/assets/js/main.js
CHANGED
@@ -104,6 +104,11 @@ jQuery(document).ready(function(){
|
|
104 |
$current = jQuery(this);
|
105 |
load_media($current);
|
106 |
});
|
|
|
|
|
|
|
|
|
|
|
107 |
jQuery('ul#activity-stream').on('click',
|
108 |
'li.media.album_updated ul li a, ul.bp-media-list-media li a, li.activity-item div.activity-content div.activity-inner div.bp_media_content a',function(e){
|
109 |
e.preventDefault();
|
@@ -174,7 +179,7 @@ jQuery(document).ready(function(){
|
|
174 |
'opacity': 90
|
175 |
});
|
176 |
do_fixes($medialoaded);
|
177 |
-
|
178 |
});
|
179 |
}
|
180 |
function transit_media($current){
|
@@ -187,7 +192,7 @@ jQuery(document).ready(function(){
|
|
187 |
$medialoaded.empty();
|
188 |
$medialoaded.append($mediacontent);
|
189 |
do_fixes($medialoaded);
|
190 |
-
|
191 |
});
|
192 |
}
|
193 |
|
@@ -250,6 +255,13 @@ jQuery(document).ready(function(){
|
|
250 |
/* Hide excess comments */
|
251 |
// if ( jQuery('.activity-comments').length )
|
252 |
// bp_legacy_theme_hide_comments();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
/* Activity list event delegation */
|
255 |
jQuery('body').on( 'click', '.bp-media-ajax-single div.activity',function(event) {
|
104 |
$current = jQuery(this);
|
105 |
load_media($current);
|
106 |
});
|
107 |
+
jQuery('.widget-item-listing').on('click','li a',function(e){
|
108 |
+
e.preventDefault();
|
109 |
+
$current = jQuery(this);
|
110 |
+
load_media($current);
|
111 |
+
});
|
112 |
jQuery('ul#activity-stream').on('click',
|
113 |
'li.media.album_updated ul li a, ul.bp-media-list-media li a, li.activity-item div.activity-content div.activity-inner div.bp_media_content a',function(e){
|
114 |
e.preventDefault();
|
179 |
'opacity': 90
|
180 |
});
|
181 |
do_fixes($medialoaded);
|
182 |
+
jQuery('.bp_media_content video,.bp_media_content audio').trigger('mediapreview');
|
183 |
});
|
184 |
}
|
185 |
function transit_media($current){
|
192 |
$medialoaded.empty();
|
193 |
$medialoaded.append($mediacontent);
|
194 |
do_fixes($medialoaded);
|
195 |
+
jQuery('.bp_media_content video,.bp_media_content audio').trigger('mediapreview');
|
196 |
});
|
197 |
}
|
198 |
|
255 |
/* Hide excess comments */
|
256 |
// if ( jQuery('.activity-comments').length )
|
257 |
// bp_legacy_theme_hide_comments();
|
258 |
+
|
259 |
+
jQuery('.bp-media-image-editor').bind('DOMNodeInserted DOMNodeRemoved', function(event) {
|
260 |
+
$id = jQuery('.bp-media-image-editor').attr('id').replace('image-editor-','');
|
261 |
+
if (!jQuery('#imgedit-save-target-'+$id).length){
|
262 |
+
jQuery('#imgedit-y-'+$id).after('<p id="imgedit-save-target-'+$id+'" style="display: none;"><input type="checkbox" style="display:none;" checked="checked" name="imgedit-target-'+$id+'" value="all"></p>');
|
263 |
+
}
|
264 |
+
});
|
265 |
|
266 |
/* Activity list event delegation */
|
267 |
jQuery('body').on( 'click', '.bp-media-ajax-single div.activity',function(event) {
|
app/helper/BPMediaSettings.php
CHANGED
@@ -46,6 +46,49 @@ if (!class_exists('BPMediaSettings')) {
|
|
46 |
'option' => 'audio_enabled',
|
47 |
'desc' => __('Enable Audio (mp3)', 'buddypress-media')
|
48 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
if (bp_is_active('activity')) {
|
50 |
add_settings_section('bpm-activity-upload', __('Activity Upload', 'buddypress-media'), '', 'bp-media-settings');
|
51 |
add_settings_field('bpm-activity', __('Activity Uploads', 'buddypress-media'), array($this, 'checkbox'), 'bp-media-settings', 'bpm-activity-upload', array(
|
@@ -55,15 +98,15 @@ if (!class_exists('BPMediaSettings')) {
|
|
55 |
)
|
56 |
);
|
57 |
}
|
58 |
-
|
59 |
add_settings_section('bpm-media-lightbox', __('Lightbox Integration', 'buddypress-media'), '', 'bp-media-settings');
|
60 |
add_settings_field('bpm-media-lightbox-option', __('Lightbox', 'buddypress-media'), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-lightbox', array(
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
if (bp_is_active('groups')) {
|
68 |
add_settings_section('bpm-media-type', __('Groups Integration', 'buddypress-media'), '', 'bp-media-settings');
|
69 |
// add_settings_field('bpm-admin-profile', __('User profiles', 'buddypress-media'), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
|
@@ -80,8 +123,6 @@ if (!class_exists('BPMediaSettings')) {
|
|
80 |
);
|
81 |
}
|
82 |
|
83 |
-
|
84 |
-
|
85 |
add_settings_section('bpm-media-fine', __('Display Settings', 'buddypress-media'), '', 'bp-media-settings');
|
86 |
add_settings_field('bpm-media-count', __('Number of media', 'buddypress-media'), array($this, 'textbox'), 'bp-media-settings', 'bpm-media-fine', array(
|
87 |
'setting' => 'bp_media_options',
|
@@ -134,24 +175,20 @@ if (!class_exists('BPMediaSettings')) {
|
|
134 |
add_settings_field('bpm-other-settings', __('Recount', 'buddypress-media'), array($this, 'button'), 'bp-media-settings', 'bpm-miscellaneous', array(
|
135 |
'option' => 'refresh-count',
|
136 |
'name' => __('Recount', 'buddypress-media'),
|
137 |
-
'desc' => '<br />'.__('Repair media counts', 'buddypress-media')
|
138 |
));
|
139 |
|
140 |
$bp_media_addon = new BPMediaAddon();
|
141 |
add_settings_section('bpm-addons', __('BuddyPress Media Addons for Audio/Video Conversion', 'buddypress-media'), array($bp_media_addon, 'get_addons'), 'bp-media-addons');
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
'premium_support' => __('Premium Support', 'buddypress-media'),
|
146 |
-
'new_feature' => __('Suggest a New Feature', 'buddypress-media'),
|
147 |
-
'bug_report' => __('Submit a Bug Report', 'buddypress-media'))
|
148 |
-
));
|
149 |
if (!BPMediaPrivacy::is_installed()) {
|
150 |
$bp_media_privacy = new BPMediaPrivacySettings();
|
151 |
add_filter('bp_media_add_sub_tabs', array($bp_media_privacy, 'ui'), 99, 2);
|
152 |
add_settings_section('bpm-privacy', __('Update Database', 'buddypress-media'), array($bp_media_privacy, 'init'), 'bp-media-privacy');
|
153 |
}
|
154 |
-
|
155 |
$bp_media_album_importer = new BPMediaAlbumimporter();
|
156 |
add_settings_section('bpm-bp-album-importer', __('BP-Album Importer', 'buddypress-media'), array($bp_media_album_importer, 'ui'), 'bp-media-importer');
|
157 |
|
@@ -189,37 +226,37 @@ if (!class_exists('BPMediaSettings')) {
|
|
189 |
}
|
190 |
|
191 |
public function network_notices() {
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
}
|
224 |
|
225 |
/**
|
@@ -261,9 +298,9 @@ if (!class_exists('BPMediaSettings')) {
|
|
261 |
add_settings_error(__('Media Type', 'buddypress-media'), 'bpm-media-type', __('Atleast one Media Type Must be selected', 'buddypress-media'));
|
262 |
$input['images_enabled'] = 1;
|
263 |
}
|
264 |
-
|
265 |
$input['default_count'] = intval($_POST['bp_media_options']['default_count']);
|
266 |
-
if (!is_int($input['default_count']) || ($input['default_count'] < 0 ) || empty($input['default_count'])
|
267 |
if (is_multisite())
|
268 |
update_site_option('bpm-media-default-count', __('"Number of media" count value should be numeric and greater than 0.', 'buddypress-media'));
|
269 |
else
|
@@ -276,6 +313,17 @@ if (!class_exists('BPMediaSettings')) {
|
|
276 |
return $input;
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
/**
|
280 |
* Output a checkbox
|
281 |
*
|
@@ -415,6 +463,41 @@ if (!class_exists('BPMediaSettings')) {
|
|
415 |
?></label><br /><?php
|
416 |
}
|
417 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
/**
|
419 |
* Outputs Dropdown
|
420 |
*
|
@@ -453,14 +536,14 @@ if (!class_exists('BPMediaSettings')) {
|
|
453 |
if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
|
454 |
$options[$option] = '';
|
455 |
}
|
456 |
-
|
457 |
<select name="<?php echo $name; ?>" id="<?php echo $option; ?>"><?php if ($none) { ?>
|
458 |
<option><?php _e('None', 'buddypress-media'); ?></option><?php
|
459 |
}
|
460 |
foreach ($values as $value => $text) {
|
461 |
-
?>
|
462 |
-
<option<?php selected($options[$option], $value); ?> value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
|
463 |
?>
|
|
|
|
|
464 |
</select><?php
|
465 |
}
|
466 |
|
@@ -495,7 +578,7 @@ if (!class_exists('BPMediaSettings')) {
|
|
495 |
$button = $option;
|
496 |
submit_button($name, '', $button, false);
|
497 |
if (!empty($desc)) {
|
498 |
-
|
499 |
<span class="description"><?php echo $desc; ?></a><?php
|
500 |
}
|
501 |
}
|
@@ -515,8 +598,13 @@ if (!class_exists('BPMediaSettings')) {
|
|
515 |
';
|
516 |
echo $notice;
|
517 |
}
|
|
|
|
|
|
|
|
|
|
|
518 |
|
519 |
}
|
520 |
|
521 |
}
|
522 |
-
|
46 |
'option' => 'audio_enabled',
|
47 |
'desc' => __('Enable Audio (mp3)', 'buddypress-media')
|
48 |
));
|
49 |
+
|
50 |
+
add_settings_section('bpm-image-settings', __('Image Settings', 'buddypress-media'), array($this, 'image_settings_intro'), 'bp-media-settings');
|
51 |
+
add_settings_field('bpm-image-thumbnail', __('Thumbnail Size', 'buddypress-media'), array($this, 'dimensions'), 'bp-media-settings', 'bpm-image-settings', array(
|
52 |
+
'type' => 'image',
|
53 |
+
'size' => 'thumbnail',
|
54 |
+
'crop' => true,
|
55 |
+
'desc' => __('Used in albums, sidebar media widget acitvity stream', 'buddypress-media')
|
56 |
+
));
|
57 |
+
add_settings_field('bpm-image-medium', __('Medium Size', 'buddypress-media'), array($this, 'dimensions'), 'bp-media-settings', 'bpm-image-settings', array(
|
58 |
+
'type' => 'image',
|
59 |
+
'size' => 'medium',
|
60 |
+
'crop' => true,
|
61 |
+
'desc' => __('Used in activity stream for single media uploads', 'buddypress-media')
|
62 |
+
));
|
63 |
+
add_settings_field('bpm-image-large', __('Large Size', 'buddypress-media'), array($this, 'dimensions'), 'bp-media-settings', 'bpm-image-settings', array(
|
64 |
+
'type' => 'image',
|
65 |
+
'size' => 'large',
|
66 |
+
'crop' => true,
|
67 |
+
'desc' => __('Used in single media and thickbox', 'buddypress-media')
|
68 |
+
));
|
69 |
+
|
70 |
+
add_settings_section('bpm-video-settings', __('Video Payer Settings', 'buddypress-media'), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
|
71 |
+
add_settings_field('bpm-video-medium', __('Activity Player Size', 'buddypress-media'), array($this, 'dimensions'), 'bp-media-settings', 'bpm-video-settings', array(
|
72 |
+
'type' => 'video',
|
73 |
+
'size' => 'medium'
|
74 |
+
));
|
75 |
+
add_settings_field('bpm-video-large', __('Single Player Size', 'buddypress-media'), array($this, 'dimensions'), 'bp-media-settings', 'bpm-video-settings', array(
|
76 |
+
'type' => 'video',
|
77 |
+
'size' => 'large'
|
78 |
+
));
|
79 |
+
|
80 |
+
add_settings_section('bpm-audio-settings', __('Audio Player Settings', 'buddypress-media'), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
|
81 |
+
add_settings_field('bpm-audio-medium', __('Activity Player Size', 'buddypress-media'), array($this, 'dimensions'), 'bp-media-settings', 'bpm-audio-settings', array(
|
82 |
+
'type' => 'audio',
|
83 |
+
'size' => 'medium',
|
84 |
+
'height' => false
|
85 |
+
));
|
86 |
+
add_settings_field('bpm-audio-large', __('Single Player Size', 'buddypress-media'), array($this, 'dimensions'), 'bp-media-settings', 'bpm-audio-settings', array(
|
87 |
+
'type' => 'audio',
|
88 |
+
'size' => 'large',
|
89 |
+
'height' => false
|
90 |
+
));
|
91 |
+
|
92 |
if (bp_is_active('activity')) {
|
93 |
add_settings_section('bpm-activity-upload', __('Activity Upload', 'buddypress-media'), '', 'bp-media-settings');
|
94 |
add_settings_field('bpm-activity', __('Activity Uploads', 'buddypress-media'), array($this, 'checkbox'), 'bp-media-settings', 'bpm-activity-upload', array(
|
98 |
)
|
99 |
);
|
100 |
}
|
101 |
+
|
102 |
add_settings_section('bpm-media-lightbox', __('Lightbox Integration', 'buddypress-media'), '', 'bp-media-settings');
|
103 |
add_settings_field('bpm-media-lightbox-option', __('Lightbox', 'buddypress-media'), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-lightbox', array(
|
104 |
+
'setting' => 'bp_media_options',
|
105 |
+
'option' => 'enable_lightbox',
|
106 |
+
'desc' => __('Enable Lighbox on Media', 'buddypress-media')
|
107 |
+
)
|
108 |
+
);
|
109 |
+
|
110 |
if (bp_is_active('groups')) {
|
111 |
add_settings_section('bpm-media-type', __('Groups Integration', 'buddypress-media'), '', 'bp-media-settings');
|
112 |
// add_settings_field('bpm-admin-profile', __('User profiles', 'buddypress-media'), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
|
123 |
);
|
124 |
}
|
125 |
|
|
|
|
|
126 |
add_settings_section('bpm-media-fine', __('Display Settings', 'buddypress-media'), '', 'bp-media-settings');
|
127 |
add_settings_field('bpm-media-count', __('Number of media', 'buddypress-media'), array($this, 'textbox'), 'bp-media-settings', 'bpm-media-fine', array(
|
128 |
'setting' => 'bp_media_options',
|
175 |
add_settings_field('bpm-other-settings', __('Recount', 'buddypress-media'), array($this, 'button'), 'bp-media-settings', 'bpm-miscellaneous', array(
|
176 |
'option' => 'refresh-count',
|
177 |
'name' => __('Recount', 'buddypress-media'),
|
178 |
+
'desc' => '<br />' . __('Repair media counts', 'buddypress-media')
|
179 |
));
|
180 |
|
181 |
$bp_media_addon = new BPMediaAddon();
|
182 |
add_settings_section('bpm-addons', __('BuddyPress Media Addons for Audio/Video Conversion', 'buddypress-media'), array($bp_media_addon, 'get_addons'), 'bp-media-addons');
|
183 |
+
|
184 |
+
add_settings_section('bpm-support', __('Support', 'buddypress-media'), array($this,'bp_media_support_intro'), 'bp-media-support');
|
185 |
+
|
|
|
|
|
|
|
|
|
186 |
if (!BPMediaPrivacy::is_installed()) {
|
187 |
$bp_media_privacy = new BPMediaPrivacySettings();
|
188 |
add_filter('bp_media_add_sub_tabs', array($bp_media_privacy, 'ui'), 99, 2);
|
189 |
add_settings_section('bpm-privacy', __('Update Database', 'buddypress-media'), array($bp_media_privacy, 'init'), 'bp-media-privacy');
|
190 |
}
|
191 |
+
|
192 |
$bp_media_album_importer = new BPMediaAlbumimporter();
|
193 |
add_settings_section('bpm-bp-album-importer', __('BP-Album Importer', 'buddypress-media'), array($bp_media_album_importer, 'ui'), 'bp-media-importer');
|
194 |
|
226 |
}
|
227 |
|
228 |
public function network_notices() {
|
229 |
+
$flag = 1;
|
230 |
+
if (get_site_option('bpm-media-enable', false)) {
|
231 |
+
echo '<div id="setting-error-bpm-media-enable" class="error"><p><strong>' . get_site_option('bpm-media-enable') . '</strong></p></div>';
|
232 |
+
delete_site_option('bpm-media-enable');
|
233 |
+
$flag = 0;
|
234 |
+
}
|
235 |
+
if (get_site_option('bpm-media-type', false)) {
|
236 |
+
echo '<div id="setting-error-bpm-media-type" class="error"><p><strong>' . get_site_option('bpm-media-type') . '</strong></p></div>';
|
237 |
+
delete_site_option('bpm-media-type');
|
238 |
+
$flag = 0;
|
239 |
+
}
|
240 |
+
if (get_site_option('bpm-media-default-count', false)) {
|
241 |
+
echo '<div id="setting-error-bpm-media-default-count" class="error"><p><strong>' . get_site_option('bpm-media-default-count') . '</strong></p></div>';
|
242 |
+
delete_site_option('bpm-media-default-count');
|
243 |
+
$flag = 0;
|
244 |
+
}
|
245 |
|
246 |
+
if (get_site_option('bpm-recount-success', false)) {
|
247 |
+
echo '<div id="setting-error-bpm-recount-success" class="updated"><p><strong>' . get_site_option('bpm-recount-success') . '</strong></p></div>';
|
248 |
+
delete_site_option('bpm-recount-success');
|
249 |
+
$flag = 0;
|
250 |
+
} elseif (get_site_option('bpm-recount-fail', false)) {
|
251 |
+
echo '<div id="setting-error-bpm-recount-fail" class="error"><p><strong>' . get_site_option('bpm-recount-fail') . '</strong></p></div>';
|
252 |
+
delete_site_option('bpm-recount-fail');
|
253 |
+
$flag = 0;
|
254 |
+
}
|
255 |
|
256 |
+
if (get_site_option('bpm-settings-saved') && $flag) {
|
257 |
+
echo '<div id="setting-error-bpm-settings-saved" class="updated"><p><strong>' . get_site_option('bpm-settings-saved') . '</strong></p></div>';
|
258 |
+
}
|
259 |
+
delete_site_option('bpm-settings-saved');
|
260 |
}
|
261 |
|
262 |
/**
|
298 |
add_settings_error(__('Media Type', 'buddypress-media'), 'bpm-media-type', __('Atleast one Media Type Must be selected', 'buddypress-media'));
|
299 |
$input['images_enabled'] = 1;
|
300 |
}
|
301 |
+
|
302 |
$input['default_count'] = intval($_POST['bp_media_options']['default_count']);
|
303 |
+
if (!is_int($input['default_count']) || ($input['default_count'] < 0 ) || empty($input['default_count'])) {
|
304 |
if (is_multisite())
|
305 |
update_site_option('bpm-media-default-count', __('"Number of media" count value should be numeric and greater than 0.', 'buddypress-media'));
|
306 |
else
|
313 |
return $input;
|
314 |
}
|
315 |
|
316 |
+
public function image_settings_intro() {
|
317 |
+
if (is_plugin_active('regenerate-thumbnails/regenerate-thumbnails.php')) {
|
318 |
+
$regenerate_link = admin_url('/tools.php?page=regenerate-thumbnails');
|
319 |
+
} elseif (array_key_exists('regenerate-thumbnails/regenerate-thumbnails.php', get_plugins())) {
|
320 |
+
$regenerate_link = admin_url('/plugins.php#regenerate-thumbnails');
|
321 |
+
} else {
|
322 |
+
$regenerate_link = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=regenerate-thumbnails'), 'install-plugin_regenerate-thumbnails');
|
323 |
+
}
|
324 |
+
echo '<span class="description">' . sprintf(__('If you make changes to width, height or crop settings, you must use "<a href="%s">Regenerate Thumbnail Plugin</a>" to regenerate old images."', 'buddypress-media'), $regenerate_link) . '</span>';
|
325 |
+
}
|
326 |
+
|
327 |
/**
|
328 |
* Output a checkbox
|
329 |
*
|
463 |
?></label><br /><?php
|
464 |
}
|
465 |
|
466 |
+
/**
|
467 |
+
*
|
468 |
+
* @global array $bp_media
|
469 |
+
* @param type $args
|
470 |
+
* @return type
|
471 |
+
*/
|
472 |
+
public function dimensions($args) {
|
473 |
+
global $bp_media;
|
474 |
+
$defaults = array(
|
475 |
+
'type' => 'image',
|
476 |
+
'size' => 'thumbnail',
|
477 |
+
'height' => true,
|
478 |
+
'crop' => false,
|
479 |
+
'desc' => ''
|
480 |
+
);
|
481 |
+
$args = wp_parse_args($args, $defaults);
|
482 |
+
extract($args);
|
483 |
+
|
484 |
+
$options = bp_get_option('bp_media_options');
|
485 |
+
|
486 |
+
$w = $options['sizes'][$type][$size]['width'];
|
487 |
+
if ($height) {
|
488 |
+
$h = $options['sizes'][$type][$size]['height'];
|
489 |
+
}
|
490 |
+
if ($crop) {
|
491 |
+
$c = $options['sizes'][$type][$size]['crop'];
|
492 |
+
}
|
493 |
+
?>
|
494 |
+
<label for="<?php echo sanitize_title("{$type}_{$size}_w"); ?>"><?php _e('Width', 'buddypress-media'); ?> <input value="<?php echo $w; ?>" name="<?php echo "bp_media_options[sizes][$type][$size][width]"; ?>" id="<?php echo sanitize_title("{$type}_{$size}_w"); ?>" type="number" class="small-text" /></label>
|
495 |
+
<?php if ($height) { ?><label for="<?php echo sanitize_title("{$type}_{$size}_h"); ?>"><?php _e('Height', 'buddypress-media'); ?> <input value="<?php echo $h; ?>" name="<?php echo "bp_media_options[sizes][$type][$size][height]"; ?>" id="<?php echo sanitize_title("{$type}_{$size}_h"); ?>" type="number" class="small-text" /></label> <?php } ?>
|
496 |
+
<?php if ($crop) { ?><label for="<?php echo sanitize_title("{$type}_{$size}_c"); ?>"> <input value="1"<?php checked($c ? $c : 0, 1); ?> name="<?php echo "bp_media_options[sizes][$type][$size][crop]"; ?>" id="<?php echo sanitize_title("{$type}_{$size}_c"); ?>" type="checkbox" /> <?php _e('Crop', 'buddypress-media'); ?></label><?php } ?>
|
497 |
+
<?php if ($desc) { ?><br /><span class="description"><?php echo $desc; ?></span><?php
|
498 |
+
}
|
499 |
+
}
|
500 |
+
|
501 |
/**
|
502 |
* Outputs Dropdown
|
503 |
*
|
536 |
if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
|
537 |
$options[$option] = '';
|
538 |
}
|
539 |
+
?>
|
540 |
<select name="<?php echo $name; ?>" id="<?php echo $option; ?>"><?php if ($none) { ?>
|
541 |
<option><?php _e('None', 'buddypress-media'); ?></option><?php
|
542 |
}
|
543 |
foreach ($values as $value => $text) {
|
|
|
|
|
544 |
?>
|
545 |
+
<option<?php selected($options[$option], $value); ?> value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
|
546 |
+
?>
|
547 |
</select><?php
|
548 |
}
|
549 |
|
578 |
$button = $option;
|
579 |
submit_button($name, '', $button, false);
|
580 |
if (!empty($desc)) {
|
581 |
+
?>
|
582 |
<span class="description"><?php echo $desc; ?></a><?php
|
583 |
}
|
584 |
}
|
598 |
';
|
599 |
echo $notice;
|
600 |
}
|
601 |
+
|
602 |
+
public function bp_media_support_intro(){
|
603 |
+
echo '<p>'.__('If your site has some issues due to BuddyPress Media and you want one on one support then you can create a support topic on the <a target="_blank" href="http://rtcamp.com/support/forum/buddypress-media/technical-support/">rtCamp Support Forum</a>.','buddypress-media').'</p>';
|
604 |
+
echo '<p>'.__('If you have any suggestions, enhancements or bug reports, then you can open a new issue on <a target="_blank" href="https://github.com/rtCamp/buddypress-media/issues/new">GitHub</a>.','buddypress-media').'</p>';
|
605 |
+
}
|
606 |
|
607 |
}
|
608 |
|
609 |
}
|
610 |
+
?>
|
app/main/BPMediaLoader.php
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Don't load this file directly!
|
4 |
*/
|
5 |
-
if (
|
6 |
-
|
7 |
|
8 |
/**
|
9 |
* BuddyPress Media Loader
|
@@ -19,160 +20,152 @@ if ( ! defined( 'ABSPATH' ) )
|
|
19 |
*/
|
20 |
class BPMediaLoader {
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
add_action( 'bp_loaded', array( $this, 'load_component' ) );
|
39 |
-
add_action( 'bp_setup_nav', array( $this, 'custom_nav' ), 999 );
|
40 |
-
//if ( array_key_exists( 'enable_on_profile', $options ) ) {
|
41 |
-
// if ( $options[ 'enable_on_profile' ] ) {
|
42 |
-
// This is where the add actions should move
|
43 |
-
// after some refactoring,
|
44 |
-
// so it is loaded on profiles, only when the admin specifies
|
45 |
-
// }
|
46 |
-
//}
|
47 |
-
|
48 |
-
add_action( 'after_setup_theme', array( $this, 'thumbnail' ) );
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Load the BPMedia Component as an component of BuddyPress
|
53 |
-
* Add it to the BuddyPress global object
|
54 |
-
*
|
55 |
-
* @global object $bp BuddyPress object
|
56 |
-
*/
|
57 |
-
|
58 |
-
/**
|
59 |
-
*
|
60 |
-
* @global object $bp
|
61 |
-
*/
|
62 |
-
public function load_component() {
|
63 |
-
global $bp;
|
64 |
-
$bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
-
|
|
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
*/
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
$bp->bp_options_nav[ BP_MEDIA_SLUG ][ ] = array(
|
86 |
-
'name' => $nav_item[ 'name' ],
|
87 |
-
'link' => (
|
88 |
-
isset( $bp->displayed_user->domain ) ?
|
89 |
-
$bp->displayed_user->domain
|
90 |
-
: (
|
91 |
-
isset( $bp->loggedin_user->domain ) ?
|
92 |
-
$bp->loggedin_user->domain
|
93 |
-
: ''
|
94 |
-
)
|
95 |
-
)
|
96 |
-
. $nav_item[ 'slug' ]
|
97 |
-
. '/',
|
98 |
-
'slug' => $nav_item[ 'slug' ],
|
99 |
-
'css_id' => $nav_item[ 'css_id' ],
|
100 |
-
'position' => $nav_item[ 'position' ],
|
101 |
-
'screen_function' => $nav_item[ 'screen_function' ],
|
102 |
-
'user_has_access' => true,
|
103 |
-
'parent_url' => trailingslashit(
|
104 |
-
bp_displayed_user_domain()
|
105 |
-
)
|
106 |
-
);
|
107 |
-
unset( $bp->bp_nav[ $key ] );
|
108 |
-
break;
|
109 |
-
case BP_MEDIA_UPLOAD_SLUG:
|
110 |
-
$bp->bp_options_nav[ BP_MEDIA_SLUG ][ ] = array(
|
111 |
-
'name' => $nav_item[ 'name' ],
|
112 |
-
'link' => (
|
113 |
-
isset( $bp->displayed_user->domain ) ?
|
114 |
-
$bp->displayed_user->domain
|
115 |
-
: (
|
116 |
-
isset( $bp->loggedin_user->domain ) ?
|
117 |
-
$bp->loggedin_user->domain
|
118 |
-
: ''
|
119 |
-
)
|
120 |
-
)
|
121 |
-
. $nav_item[ 'slug' ]
|
122 |
-
. '/',
|
123 |
-
'slug' => $nav_item[ 'slug' ],
|
124 |
-
'css_id' => $nav_item[ 'css_id' ],
|
125 |
-
'position' => $nav_item[ 'position' ],
|
126 |
-
'screen_function' => $nav_item[ 'screen_function' ],
|
127 |
-
'user_has_access' => bp_is_my_profile(),
|
128 |
-
'parent_url' => trailingslashit(
|
129 |
-
bp_displayed_user_domain()
|
130 |
-
)
|
131 |
-
);
|
132 |
-
unset( $bp->bp_nav[ $key ] );
|
133 |
-
}
|
134 |
-
switch ( $bp->current_component ) {
|
135 |
-
case BP_MEDIA_IMAGES_SLUG:
|
136 |
-
case BP_MEDIA_VIDEOS_SLUG:
|
137 |
-
case BP_MEDIA_AUDIO_SLUG:
|
138 |
-
case BP_MEDIA_ALBUMS_SLUG:
|
139 |
-
case BP_MEDIA_UPLOAD_SLUG:
|
140 |
-
$count = count( $bp->action_variables );
|
141 |
-
for ( $i = $count; $i > 0; $i -- ) {
|
142 |
-
$bp->action_variables[ $i ]
|
143 |
-
= $bp->action_variables[ $i - 1 ];
|
144 |
-
}
|
145 |
-
$bp->action_variables[ 0 ] = $bp->current_action;
|
146 |
-
$bp->current_action = $bp->current_component;
|
147 |
-
$bp->current_component = BP_MEDIA_SLUG;
|
148 |
-
}
|
149 |
-
}
|
150 |
-
}
|
151 |
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
}
|
176 |
|
177 |
}
|
178 |
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Don't load this file directly!
|
5 |
*/
|
6 |
+
if (!defined('ABSPATH'))
|
7 |
+
exit;
|
8 |
|
9 |
/**
|
10 |
* BuddyPress Media Loader
|
20 |
*/
|
21 |
class BPMediaLoader {
|
22 |
|
23 |
+
/**
|
24 |
+
* Initialises BuddyPress Media's functionality. Hooks into BuddyPress
|
25 |
+
*
|
26 |
+
* Hooks into bp_loaded to load itself
|
27 |
+
* Hooks into bp_setup_nav to add tabs to the profile and group navigation
|
28 |
+
* Hooks into after_setup_theme to add its thumbnail sizes
|
29 |
+
*
|
30 |
+
* @uses bp_loaded
|
31 |
+
* @uses bp_setup_nav
|
32 |
+
* @uses after_setup_theme
|
33 |
+
* @global object $bp_media
|
34 |
+
*/
|
35 |
+
public function __construct() {
|
36 |
+
global $bp_media;
|
37 |
+
//$options = $bp_media->options;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
add_action('bp_loaded', array($this, 'load_component'));
|
40 |
+
add_action('bp_setup_nav', array($this, 'custom_nav'), 999);
|
41 |
+
//if ( array_key_exists( 'enable_on_profile', $options ) ) {
|
42 |
+
// if ( $options[ 'enable_on_profile' ] ) {
|
43 |
+
// This is where the add actions should move
|
44 |
+
// after some refactoring,
|
45 |
+
// so it is loaded on profiles, only when the admin specifies
|
46 |
+
// }
|
47 |
+
//}
|
48 |
|
49 |
+
add_action('after_setup_theme', array($this, 'add_image_sizes'));
|
50 |
+
}
|
51 |
|
52 |
+
/**
|
53 |
+
* Load the BPMedia Component as an component of BuddyPress
|
54 |
+
* Add it to the BuddyPress global object
|
55 |
+
*
|
56 |
+
* @global object $bp BuddyPress object
|
57 |
+
*/
|
|
|
58 |
|
59 |
+
/**
|
60 |
+
*
|
61 |
+
* @global object $bp
|
62 |
+
*/
|
63 |
+
public function load_component() {
|
64 |
+
global $bp;
|
65 |
+
$bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
|
66 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
/**
|
69 |
+
* Navigation Loader
|
70 |
+
*
|
71 |
+
* Loads BuddyPress Media's navigation
|
72 |
+
*
|
73 |
+
* @global object $bp BuddyPress object
|
74 |
+
*/
|
75 |
+
public function custom_nav() {
|
76 |
+
global $bp;
|
77 |
+
foreach ($bp->bp_nav as $key => $nav_item) {
|
78 |
+
switch ($nav_item['slug']) {
|
79 |
+
case BP_MEDIA_IMAGES_SLUG:
|
80 |
+
case BP_MEDIA_VIDEOS_SLUG:
|
81 |
+
case BP_MEDIA_AUDIO_SLUG:
|
82 |
+
case BP_MEDIA_ALBUMS_SLUG:
|
83 |
+
$bp->bp_options_nav[BP_MEDIA_SLUG][] = array(
|
84 |
+
'name' => $nav_item['name'],
|
85 |
+
'link' => (
|
86 |
+
isset($bp->displayed_user->domain) ?
|
87 |
+
$bp->displayed_user->domain : (
|
88 |
+
isset($bp->loggedin_user->domain) ?
|
89 |
+
$bp->loggedin_user->domain : ''
|
90 |
+
)
|
91 |
+
)
|
92 |
+
. $nav_item['slug']
|
93 |
+
. '/',
|
94 |
+
'slug' => $nav_item['slug'],
|
95 |
+
'css_id' => $nav_item['css_id'],
|
96 |
+
'position' => $nav_item['position'],
|
97 |
+
'screen_function' => $nav_item['screen_function'],
|
98 |
+
'user_has_access' => true,
|
99 |
+
'parent_url' => trailingslashit(
|
100 |
+
bp_displayed_user_domain()
|
101 |
+
)
|
102 |
+
);
|
103 |
+
unset($bp->bp_nav[$key]);
|
104 |
+
break;
|
105 |
+
case BP_MEDIA_UPLOAD_SLUG:
|
106 |
+
$bp->bp_options_nav[BP_MEDIA_SLUG][] = array(
|
107 |
+
'name' => $nav_item['name'],
|
108 |
+
'link' => (
|
109 |
+
isset($bp->displayed_user->domain) ?
|
110 |
+
$bp->displayed_user->domain : (
|
111 |
+
isset($bp->loggedin_user->domain) ?
|
112 |
+
$bp->loggedin_user->domain : ''
|
113 |
+
)
|
114 |
+
)
|
115 |
+
. $nav_item['slug']
|
116 |
+
. '/',
|
117 |
+
'slug' => $nav_item['slug'],
|
118 |
+
'css_id' => $nav_item['css_id'],
|
119 |
+
'position' => $nav_item['position'],
|
120 |
+
'screen_function' => $nav_item['screen_function'],
|
121 |
+
'user_has_access' => bp_is_my_profile(),
|
122 |
+
'parent_url' => trailingslashit(
|
123 |
+
bp_displayed_user_domain()
|
124 |
+
)
|
125 |
+
);
|
126 |
+
unset($bp->bp_nav[$key]);
|
127 |
+
}
|
128 |
+
switch ($bp->current_component) {
|
129 |
+
case BP_MEDIA_IMAGES_SLUG:
|
130 |
+
case BP_MEDIA_VIDEOS_SLUG:
|
131 |
+
case BP_MEDIA_AUDIO_SLUG:
|
132 |
+
case BP_MEDIA_ALBUMS_SLUG:
|
133 |
+
case BP_MEDIA_UPLOAD_SLUG:
|
134 |
+
$count = count($bp->action_variables);
|
135 |
+
for ($i = $count; $i > 0; $i--) {
|
136 |
+
$bp->action_variables[$i]
|
137 |
+
= $bp->action_variables[$i - 1];
|
138 |
+
}
|
139 |
+
$bp->action_variables[0] = $bp->current_action;
|
140 |
+
$bp->current_action = $bp->current_component;
|
141 |
+
$bp->current_component = BP_MEDIA_SLUG;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
|
148 |
+
/**
|
149 |
+
* Add image sizes required by the plugin to existing WordPress sizes.
|
150 |
+
* This can be filtered
|
151 |
+
*
|
152 |
+
* @global object $bp_media
|
153 |
+
*/
|
154 |
+
public function add_image_sizes() {
|
155 |
+
global $bp_media;
|
156 |
|
157 |
+
$default_sizes = $bp_media->media_sizes();
|
158 |
+
$image_sizes = $default_sizes['image'];
|
159 |
+
add_image_size(
|
160 |
+
'bp_media_thumbnail', $image_sizes['thumbnail']['width'], $image_sizes['thumbnail']['height'], $image_sizes['thumbnail']['crop']
|
161 |
+
);
|
162 |
+
add_image_size(
|
163 |
+
'bp_media_activity_image', $image_sizes['medium']['width'], $image_sizes['medium']['height'], $image_sizes['medium']['crop']
|
164 |
+
);
|
165 |
+
add_image_size(
|
166 |
+
'bp_media_single_image', $image_sizes['large']['width'], $image_sizes['large']['height'], $image_sizes['large']['crop']
|
167 |
+
);
|
168 |
+
}
|
|
|
169 |
|
170 |
}
|
171 |
|
app/main/BuddyPressMedia.php
CHANGED
@@ -173,6 +173,21 @@ class BuddyPressMedia {
|
|
173 |
$options = array(
|
174 |
'enable_on_group' => 1,
|
175 |
'enable_lightbox' => 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
'videos_enabled' => 1,
|
177 |
'audio_enabled' => 1,
|
178 |
'images_enabled' => 1,
|
@@ -180,13 +195,24 @@ class BuddyPressMedia {
|
|
180 |
'show_admin_menu' => 1
|
181 |
);
|
182 |
bp_update_option('bp_media_options', $options);
|
183 |
-
}
|
184 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
bp_update_option('bp_media_options', $options);
|
188 |
-
bp_update_option('bp_media_lightbox', 1);
|
189 |
}
|
|
|
190 |
$this->options = $options;
|
191 |
}
|
192 |
|
@@ -353,12 +379,13 @@ class BuddyPressMedia {
|
|
353 |
// new BPMediaActivity();
|
354 |
$class_construct = array(
|
355 |
'activity' => false,
|
356 |
-
'filters'
|
357 |
-
'actions'
|
358 |
'function' => false,
|
359 |
-
'privacy'
|
360 |
'download' => false,
|
361 |
-
'albumimporter'
|
|
|
362 |
);
|
363 |
$class_construct = apply_filters('bpmedia_class_construct', $class_construct);
|
364 |
|
@@ -426,33 +453,10 @@ class BuddyPressMedia {
|
|
426 |
* @return array
|
427 |
*/
|
428 |
function media_sizes() {
|
|
|
429 |
$def_sizes = array(
|
430 |
-
|
431 |
-
|
432 |
-
'height' => 60
|
433 |
-
),
|
434 |
-
'tiny_video' => array(
|
435 |
-
'width' => 80,
|
436 |
-
'height' => 60
|
437 |
-
),
|
438 |
-
'tiny_audio' => array(
|
439 |
-
'width' => 80,
|
440 |
-
),
|
441 |
-
'activity_image' => array(
|
442 |
-
'width' => 320,
|
443 |
-
'height' => 240
|
444 |
-
),
|
445 |
-
'activity_video' => array(
|
446 |
-
'width' => 320,
|
447 |
-
'height' => 240
|
448 |
-
),
|
449 |
-
'activity_audio' => array(
|
450 |
-
'width' => 320,
|
451 |
-
),
|
452 |
-
'single_image' => array(
|
453 |
-
'width' => 800,
|
454 |
-
'height' => 0
|
455 |
-
),
|
456 |
'single_video' => array(
|
457 |
'width' => 640,
|
458 |
'height' => 480
|
@@ -460,10 +464,45 @@ class BuddyPressMedia {
|
|
460 |
'single_audio' => array(
|
461 |
'width' => 640,
|
462 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
);
|
464 |
|
465 |
-
|
466 |
-
return apply_filters('bpmedia_media_sizes', $def_sizes);
|
467 |
}
|
468 |
|
469 |
/**
|
@@ -689,8 +728,8 @@ class BuddyPressMedia {
|
|
689 |
return $plugin_version;
|
690 |
}
|
691 |
|
692 |
-
static function get_current_user_default_album(){
|
693 |
-
if (
|
694 |
$current_user_id = get_current_user_id();
|
695 |
$album_id = get_user_meta($current_user_id, 'bp-media-default-album', true);
|
696 |
return $album_id;
|
173 |
$options = array(
|
174 |
'enable_on_group' => 1,
|
175 |
'enable_lightbox' => 1,
|
176 |
+
'sizes' => array(
|
177 |
+
'image' => array(
|
178 |
+
'thumbnail' => array('width' => 150, 'height' => 150, 'crop' => 1),
|
179 |
+
'medium' => array('width' => 320, 'height' => 240, 'crop' => 1),
|
180 |
+
'large' => array('width' => 800, 'height' => 0, 'crop' => 1)
|
181 |
+
),
|
182 |
+
'video' => array(
|
183 |
+
'medium' => array('width' => 320, 'height' => 240),
|
184 |
+
'large' => array('width' => 640, 'height' => 480)
|
185 |
+
),
|
186 |
+
'audio' => array(
|
187 |
+
'medium' => array('width' => 320),
|
188 |
+
'large' => array('width' => 640)
|
189 |
+
)
|
190 |
+
),
|
191 |
'videos_enabled' => 1,
|
192 |
'audio_enabled' => 1,
|
193 |
'images_enabled' => 1,
|
195 |
'show_admin_menu' => 1
|
196 |
);
|
197 |
bp_update_option('bp_media_options', $options);
|
198 |
+
} elseif (!isset($options['sizes'])) {
|
199 |
+
$options['sizes'] = array(
|
200 |
+
'image' => array(
|
201 |
+
'thumbnail' => array('width' => 150, 'height' => 150, 'crop' => 1),
|
202 |
+
'medium' => array('width' => 320, 'height' => 240, 'crop' => 1),
|
203 |
+
'large' => array('width' => 800, 'height' => 0, 'crop' => 1)
|
204 |
+
),
|
205 |
+
'video' => array(
|
206 |
+
'medium' => array('width' => 320, 'height' => 240),
|
207 |
+
'large' => array('width' => 640, 'height' => 480)
|
208 |
+
),
|
209 |
+
'audio' => array(
|
210 |
+
'medium' => array('width' => 320),
|
211 |
+
'large' => array('width' => 640)
|
212 |
+
));
|
213 |
bp_update_option('bp_media_options', $options);
|
|
|
214 |
}
|
215 |
+
|
216 |
$this->options = $options;
|
217 |
}
|
218 |
|
379 |
// new BPMediaActivity();
|
380 |
$class_construct = array(
|
381 |
'activity' => false,
|
382 |
+
'filters' => false,
|
383 |
+
'actions' => false,
|
384 |
'function' => false,
|
385 |
+
'privacy' => false,
|
386 |
'download' => false,
|
387 |
+
'albumimporter' => false,
|
388 |
+
'image' => false
|
389 |
);
|
390 |
$class_construct = apply_filters('bpmedia_class_construct', $class_construct);
|
391 |
|
453 |
* @return array
|
454 |
*/
|
455 |
function media_sizes() {
|
456 |
+
$options = $this->options;
|
457 |
$def_sizes = array(
|
458 |
+
|
459 |
+
//legacy array
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
'single_video' => array(
|
461 |
'width' => 640,
|
462 |
'height' => 480
|
464 |
'single_audio' => array(
|
465 |
'width' => 640,
|
466 |
),
|
467 |
+
|
468 |
+
'image' => array(
|
469 |
+
'thumbnail' => array(
|
470 |
+
'width' => $options['sizes']['image']['thumbnail']['width'],
|
471 |
+
'height' => $options['sizes']['image']['thumbnail']['height'],
|
472 |
+
'crop' => $options['sizes']['image']['thumbnail']['crop']
|
473 |
+
),
|
474 |
+
'medium' => array(
|
475 |
+
'width' => $options['sizes']['image']['medium']['width'],
|
476 |
+
'height' => $options['sizes']['image']['medium']['height'],
|
477 |
+
'crop' => $options['sizes']['image']['medium']['crop'],
|
478 |
+
),
|
479 |
+
'large' => array(
|
480 |
+
'width' => $options['sizes']['image']['large']['width'],
|
481 |
+
'height' => $options['sizes']['image']['large']['height'],
|
482 |
+
'crop' => $options['sizes']['image']['large']['crop'],
|
483 |
+
)
|
484 |
+
),
|
485 |
+
'video' => array(
|
486 |
+
'medium' => array(
|
487 |
+
'width' => $options['sizes']['video']['medium']['width'],
|
488 |
+
'height' => $options['sizes']['video']['medium']['height'],
|
489 |
+
),
|
490 |
+
'large' => array(
|
491 |
+
'width' => $options['sizes']['video']['large']['width'],
|
492 |
+
'height' => $options['sizes']['video']['large']['height'],
|
493 |
+
)
|
494 |
+
),
|
495 |
+
'audio' => array(
|
496 |
+
'medium' => array(
|
497 |
+
'width' => $options['sizes']['audio']['medium']['width'],
|
498 |
+
),
|
499 |
+
'large' => array(
|
500 |
+
'width' => $options['sizes']['audio']['large']['width'],
|
501 |
+
)
|
502 |
+
)
|
503 |
);
|
504 |
|
505 |
+
return $def_sizes;
|
|
|
506 |
}
|
507 |
|
508 |
/**
|
728 |
return $plugin_version;
|
729 |
}
|
730 |
|
731 |
+
static function get_current_user_default_album() {
|
732 |
+
if (is_user_logged_in()) {
|
733 |
$current_user_id = get_current_user_id();
|
734 |
$album_id = get_user_meta($current_user_id, 'bp-media-default-album', true);
|
735 |
return $album_id;
|
app/main/includes/BPMediaActions.php
CHANGED
@@ -39,6 +39,9 @@ class BPMediaActions {
|
|
39 |
add_action('bp_media_after_update_media', array($this, 'update_count'), 999);
|
40 |
add_action('bp_media_after_delete_media', array($this, 'update_count'), 999);
|
41 |
add_action('bp_before_group_settings_creation_step', array($this, 'group_create_default_album'));
|
|
|
|
|
|
|
42 |
$linkback = bp_get_option('bp_media_add_linkback', false);
|
43 |
if ($linkback)
|
44 |
add_action('bp_footer', array($this, 'footer'));
|
@@ -326,8 +329,9 @@ class BPMediaActions {
|
|
326 |
if (bp_displayed_user_id() == bp_loggedin_user_id())
|
327 |
$action_buttons[] = '<a href="' . $bp_media_current_entry->get_edit_url()
|
328 |
. '" class="button item-button bp-secondary-action bp-media-edit" title="'
|
329 |
-
. __('Edit Media',
|
330 |
}
|
|
|
331 |
$action_buttons = apply_filters('bp_media_action_buttons', $action_buttons);
|
332 |
foreach ($action_buttons as $action_button) {
|
333 |
echo $action_button;
|
@@ -844,34 +848,6 @@ class BPMediaActions {
|
|
844 |
die;
|
845 |
}
|
846 |
|
847 |
-
public function get_thumbnail() {
|
848 |
-
$id = $_POST['media_id'];
|
849 |
-
$content = '';
|
850 |
-
$media = new BPMediaHostWordpress($id);
|
851 |
-
switch ($media->get_type()) {
|
852 |
-
case 'video' :
|
853 |
-
if ($media->get_thumbnail_id()) {
|
854 |
-
$image_array = image_downsize($media->get_thumbnail_id(), 'thumbnail');
|
855 |
-
$content.=apply_filters('bp_media_ajax_thumbnail_filter', '<video poster="' . $image_array[0] . '" src="' . wp_get_attachment_url($media->get_id()) . '" width="' . $default_sizes['single_video']['width'] . '" height="' . ($default_sizes['single_video']['height'] == 0 ? 'auto' : $default_sizes['single_video']['height']) . '" type="video/mp4" id="bp_media_video_' . $media->get_id() . '" controls="controls" preload="none"></video><script>bp_media_create_element("bp_media_video_' . $media->get_id() . '");</script>', $media);
|
856 |
-
} else {
|
857 |
-
$content.=apply_filters('bp_media_ajax_thumbnail_filter', '<video src="' . wp_get_attachment_url($media->get_id()) . '" width="' . $default_sizes['single_video']['width'] . '" height="' . ($default_sizes['single_video']['height'] == 0 ? 'auto' : $default_sizes['single_video']['height']) . '" type="video/mp4" id="bp_media_video_' . $media->get_id() . '" controls="controls" preload="none"></video><script>bp_media_create_element("bp_media_video_' . $media->get_id() . '");</script>', $media);
|
858 |
-
}
|
859 |
-
break;
|
860 |
-
case 'audio' :
|
861 |
-
$content.=apply_filters('bp_media_ajax_thumbnail_filter', '<audio src="' . wp_get_attachment_url($media->get_id()) . '" width="' . $default_sizes['single_audio']['width'] . '" type="audio/mp3" id="bp_media_audio_' . $media->get_id() . '" controls="controls" preload="none" ></audio><script>bp_media_create_element("bp_media_audio_' . $media->get_id() . '");</script>', $media);
|
862 |
-
break;
|
863 |
-
case 'image' :
|
864 |
-
$image_array = image_downsize($media->get_id(), 'thumbnail');
|
865 |
-
$content.=apply_filters('bp_media_ajax_thumbnail_filter', '<img src="' . $image_array[0] . '" id="bp_media_image_' . $media->get_id() . '" />', $media);
|
866 |
-
break;
|
867 |
-
default :
|
868 |
-
return false;
|
869 |
-
}
|
870 |
-
|
871 |
-
echo $content;
|
872 |
-
die();
|
873 |
-
}
|
874 |
-
|
875 |
public function default_user_album() {
|
876 |
$album_id = 0;
|
877 |
if (is_user_logged_in()) {
|
@@ -940,5 +916,123 @@ class BPMediaActions {
|
|
940 |
$bp_album->check_and_create_album(0, bp_get_new_group_id());
|
941 |
}
|
942 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
943 |
}
|
944 |
?>
|
39 |
add_action('bp_media_after_update_media', array($this, 'update_count'), 999);
|
40 |
add_action('bp_media_after_delete_media', array($this, 'update_count'), 999);
|
41 |
add_action('bp_before_group_settings_creation_step', array($this, 'group_create_default_album'));
|
42 |
+
add_filter('intermediate_image_sizes_advanced', array($this, 'filter_image_sizes_details'));
|
43 |
+
add_filter('intermediate_image_sizes', array($this, 'filter_image_sizes'));
|
44 |
+
// add_shortcode('bpmedia', array($this, 'bpmedia_shortcode'));
|
45 |
$linkback = bp_get_option('bp_media_add_linkback', false);
|
46 |
if ($linkback)
|
47 |
add_action('bp_footer', array($this, 'footer'));
|
329 |
if (bp_displayed_user_id() == bp_loggedin_user_id())
|
330 |
$action_buttons[] = '<a href="' . $bp_media_current_entry->get_edit_url()
|
331 |
. '" class="button item-button bp-secondary-action bp-media-edit" title="'
|
332 |
+
. __('Edit Media', BP_MEDIA_TXT_DOMAIN) . '">' . __('Edit', BP_MEDIA_TXT_DOMAIN) . '</a>';
|
333 |
}
|
334 |
+
|
335 |
$action_buttons = apply_filters('bp_media_action_buttons', $action_buttons);
|
336 |
foreach ($action_buttons as $action_button) {
|
337 |
echo $action_button;
|
848 |
die;
|
849 |
}
|
850 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
851 |
public function default_user_album() {
|
852 |
$album_id = 0;
|
853 |
if (is_user_logged_in()) {
|
916 |
$bp_album->check_and_create_album(0, bp_get_new_group_id());
|
917 |
}
|
918 |
|
919 |
+
function filter_image_sizes_details($sizes) {
|
920 |
+
if (isset($_REQUEST['post_id'])) {
|
921 |
+
$sizes = $this->unset_bp_media_image_sizes_details($sizes);
|
922 |
+
} elseif (isset($_REQUEST['id'])) { //For Regenerate Thumbnails Plugin
|
923 |
+
if ($parent_id = get_post_field('post_parent', $_REQUEST['id'])) {
|
924 |
+
$post_type = get_post_field('post_type', $parent_id);
|
925 |
+
if ($post_type == 'bp_media_album') {
|
926 |
+
global $bp_media;
|
927 |
+
$bp_media_sizes = $bp_media->media_sizes();
|
928 |
+
$sizes = array(
|
929 |
+
'bp_media_thumbnail' => $bp_media_sizes['image']['thumbnail'],
|
930 |
+
'bp_media_activity_image' => $bp_media_sizes['image']['medium'],
|
931 |
+
'bp_media_single_image' => $bp_media_sizes['image']['large']
|
932 |
+
);
|
933 |
+
} else {
|
934 |
+
$sizes = $this->unset_bp_media_image_sizes_details($sizes);
|
935 |
+
}
|
936 |
+
} else {
|
937 |
+
$sizes = $this->unset_bp_media_image_sizes_details($sizes);
|
938 |
+
}
|
939 |
+
}
|
940 |
+
|
941 |
+
return $sizes;
|
942 |
+
}
|
943 |
+
|
944 |
+
function filter_image_sizes($sizes) {
|
945 |
+
if (isset($_REQUEST['postid'])) { //For Regenerate Thumbnails Plugin
|
946 |
+
if ($parent_id = get_post_field('post_parent', $_REQUEST['postid'])) {
|
947 |
+
$post_type = get_post_field('post_type', $parent_id);
|
948 |
+
if ($post_type == 'bp_media_album') {
|
949 |
+
$sizes = array(
|
950 |
+
'bp_media_thumbnail', 'bp_media_activity_image', 'bp_media_single_image'
|
951 |
+
);
|
952 |
+
} else {
|
953 |
+
$sizes = $this->unset_bp_media_image_sizes($sizes);
|
954 |
+
}
|
955 |
+
} else {
|
956 |
+
$sizes = $this->unset_bp_media_image_sizes($sizes);
|
957 |
+
}
|
958 |
+
}
|
959 |
+
|
960 |
+
return $sizes;
|
961 |
+
}
|
962 |
+
|
963 |
+
function unset_bp_media_image_sizes_details($sizes) {
|
964 |
+
if (isset($sizes['bp_media_thumbnail']))
|
965 |
+
unset($sizes['bp_media_thumbnail']);
|
966 |
+
if (isset($sizes['bp_media_activity_image']))
|
967 |
+
unset($sizes['bp_media_activity_image']);
|
968 |
+
if (isset($sizes['bp_media_single_image']))
|
969 |
+
unset($sizes['bp_media_single_image']);
|
970 |
+
return $sizes;
|
971 |
+
}
|
972 |
+
|
973 |
+
function unset_bp_media_image_sizes($sizes) {
|
974 |
+
if (($key = array_search('bp_media_thumbnail', $sizes)) !== false)
|
975 |
+
unset($sizes[$key]);
|
976 |
+
if (($key = array_search('bp_media_activity_image', $sizes)) !== false)
|
977 |
+
unset($sizes[$key]);
|
978 |
+
if (($key = array_search('bp_media_single_image', $sizes)) !== false)
|
979 |
+
unset($sizes[$key]);
|
980 |
+
return $sizes;
|
981 |
+
}
|
982 |
+
|
983 |
+
function bpmedia_shortcode($atts) {
|
984 |
+
extract(shortcode_atts(array(
|
985 |
+
'media' => 'all',
|
986 |
+
'count' => '10',
|
987 |
+
), $atts));
|
988 |
+
|
989 |
+
$value = 0;
|
990 |
+
if (is_user_logged_in()) {
|
991 |
+
$value = 2;
|
992 |
+
}
|
993 |
+
$privacy_query = array(
|
994 |
+
array(
|
995 |
+
'key' => 'bp_media_privacy',
|
996 |
+
'value' => $value,
|
997 |
+
'compare' => '<='
|
998 |
+
)
|
999 |
+
);
|
1000 |
+
$args = array(
|
1001 |
+
'post_type' => 'attachment',
|
1002 |
+
'post_status' => 'any',
|
1003 |
+
'meta_query' => $privacy_query,
|
1004 |
+
'posts_per_page' => $count
|
1005 |
+
);
|
1006 |
+
if ($media != 'all')
|
1007 |
+
$args['post_mime_type'] = $media;
|
1008 |
+
$query = new WP_Query($args);
|
1009 |
+
if ($query->have_posts()) {
|
1010 |
+
?>
|
1011 |
+
<div id="item-body"><ul class="bp-media-gallery item-list"><?php
|
1012 |
+
while ($query->have_posts()) {
|
1013 |
+
$query->the_post();
|
1014 |
+
try {
|
1015 |
+
$entry = new BPMediaHostWordpress(get_the_ID());
|
1016 |
+
echo $entry->get_media_gallery_content();
|
1017 |
+
} catch (Exception $e) {
|
1018 |
+
echo '<li>';
|
1019 |
+
echo $e->getMessage();
|
1020 |
+
echo '<h3><a>Private</h3>';
|
1021 |
+
echo '</li>';
|
1022 |
+
}
|
1023 |
+
}
|
1024 |
+
?>
|
1025 |
+
</ul></div>
|
1026 |
+
<div class="bp-media-actions"><a href="#" class="button" id="bp-media-show-more">Show More</a></div><?php
|
1027 |
+
} else {
|
1028 |
+
$media_string = $type;
|
1029 |
+
if ($type === 'all') {
|
1030 |
+
$media_string = 'media';
|
1031 |
+
}
|
1032 |
+
_e('No ' . $wdType . ' ' . $media_string . ' found', 'buddypress-media');
|
1033 |
+
}
|
1034 |
+
wp_reset_query();
|
1035 |
+
}
|
1036 |
+
|
1037 |
}
|
1038 |
?>
|
app/main/includes/BPMediaFilters.php
CHANGED
@@ -17,6 +17,21 @@ class BPMediaFilters {
|
|
17 |
add_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
|
18 |
// and we hook our function via wp_before_admin_bar_render
|
19 |
add_action('admin_bar_menu', array($this, 'my_account_menu'), 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
// and we hook our function via wp_before_admin_bar_render
|
21 |
global $bp_media;
|
22 |
if (isset($bp_media->options['show_admin_menu']) && ($bp_media->options['show_admin_menu'] == true)) {
|
17 |
add_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
|
18 |
// and we hook our function via wp_before_admin_bar_render
|
19 |
add_action('admin_bar_menu', array($this, 'my_account_menu'), 1);
|
20 |
+
|
21 |
+
//WordPress Edit Image ( For applying edit image changes to custom sizes hack )
|
22 |
+
global $bp_media;
|
23 |
+
$media_sizes = $bp_media->media_sizes();
|
24 |
+
$image_size = $media_sizes['image'];
|
25 |
+
add_filter( 'pre_option_bp_media_thumbnail_size_w', create_function('','return '.$image_size['thumbnail']['width'].';') );
|
26 |
+
add_filter( 'pre_option_bp_media_thumbnail_size_h', create_function('','return '. $image_size['thumbnail']['height'].';') );
|
27 |
+
add_filter( 'pre_option_bp_media_thumbnail_crop', create_function('','return '. $image_size['thumbnail']['crop'].';') );
|
28 |
+
add_filter( 'pre_option_bp_media_activity_image_size_w', create_function('','return '.$image_size['medium']['width'].';') );
|
29 |
+
add_filter( 'pre_option_bp_media_activity_image_size_h', create_function('','return '. $image_size['medium']['height'].';') );
|
30 |
+
add_filter( 'pre_option_bp_media_activity_image_crop', create_function('','return '. $image_size['medium']['crop'].';') );
|
31 |
+
add_filter( 'pre_option_bp_media_single_image_size_w', create_function('','return '. $image_size['large']['width'].';') );
|
32 |
+
add_filter( 'pre_option_bp_media_single_image_size_h', create_function('','return '. $image_size['large']['height'].';') );
|
33 |
+
add_filter( 'pre_option_bp_media_single_image_crop', create_function('','return '. $image_size['large']['crop'].';') );
|
34 |
+
|
35 |
// and we hook our function via wp_before_admin_bar_render
|
36 |
global $bp_media;
|
37 |
if (isset($bp_media->options['show_admin_menu']) && ($bp_media->options['show_admin_menu'] == true)) {
|
app/main/includes/BPMediaFunction.php
CHANGED
@@ -48,6 +48,7 @@ class BPMediaFunction {
|
|
48 |
$activity_allowedtags['audio']['id'] = array();
|
49 |
$activity_allowedtags['audio']['class'] = array();
|
50 |
$activity_allowedtags['audio']['src'] = array();
|
|
|
51 |
$activity_allowedtags['audio']['controls'] = array();
|
52 |
$activity_allowedtags['audio']['preload'] = array();
|
53 |
$activity_allowedtags['audio']['alt'] = array();
|
@@ -205,7 +206,7 @@ class BPMediaFunction {
|
|
205 |
$content .= $bp_media->get_album_activity_content();
|
206 |
}
|
207 |
$content .= '</ul>';
|
208 |
-
$activity_id = get_post_meta($album->get_id(), 'bp_media_child_activity',true);
|
209 |
if ($activity_id) {
|
210 |
$args = array(
|
211 |
'in' => $activity_id,
|
48 |
$activity_allowedtags['audio']['id'] = array();
|
49 |
$activity_allowedtags['audio']['class'] = array();
|
50 |
$activity_allowedtags['audio']['src'] = array();
|
51 |
+
$activity_allowedtags['audio']['width'] = array();
|
52 |
$activity_allowedtags['audio']['controls'] = array();
|
53 |
$activity_allowedtags['audio']['preload'] = array();
|
54 |
$activity_allowedtags['audio']['alt'] = array();
|
206 |
$content .= $bp_media->get_album_activity_content();
|
207 |
}
|
208 |
$content .= '</ul>';
|
209 |
+
$activity_id = get_post_meta($album->get_id(), 'bp_media_child_activity', true);
|
210 |
if ($activity_id) {
|
211 |
$args = array(
|
212 |
'in' => $activity_id,
|
app/main/includes/BPMediaHostWordpress.php
CHANGED
@@ -113,17 +113,17 @@ class BPMediaHostWordpress {
|
|
113 |
function add_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false, $is_activity = false, $files = false, $author_id = false, $album_name = false) {
|
114 |
echo $this->insert_media($name, $description, $album_id, $group, $is_multiple, $is_activity, $files, $author_id, $album_name);
|
115 |
}
|
116 |
-
|
117 |
-
function insert_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false, $is_activity = false, $files = false, $author_id = false, $album_name = false){
|
118 |
do_action('bp_media_before_add_media');
|
119 |
|
120 |
global $bp, $wpdb, $bp_media;
|
121 |
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
122 |
include_once(ABSPATH . 'wp-admin/includes/image.php');
|
123 |
-
|
124 |
-
if (
|
125 |
-
$author_id = get_current_user_id
|
126 |
-
|
127 |
$post_id = $this->check_and_create_album($album_id, $group, $author_id, $album_name);
|
128 |
|
129 |
if (!$files) {
|
@@ -139,10 +139,9 @@ class BPMediaHostWordpress {
|
|
139 |
|
140 |
$type = $file['type'];
|
141 |
if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
}
|
147 |
|
148 |
$attachment = array();
|
@@ -227,8 +226,10 @@ class BPMediaHostWordpress {
|
|
227 |
$activity_content = false;
|
228 |
throw new Exception(__('Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4.', 'buddypress-media'));
|
229 |
}
|
|
|
230 |
$attachment_id = wp_insert_attachment($attachment, $file, $post_id);
|
231 |
if (!is_wp_error($attachment_id)) {
|
|
|
232 |
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
|
233 |
} else {
|
234 |
unlink($file);
|
@@ -251,11 +252,17 @@ class BPMediaHostWordpress {
|
|
251 |
return $attachment_id;
|
252 |
}
|
253 |
|
254 |
-
function
|
|
|
|
|
|
|
|
|
255 |
$thumb = '';
|
256 |
if (in_array($this->type, array('image', 'video', 'audio'))) {
|
257 |
if ($this->thumbnail_id) {
|
258 |
-
$
|
|
|
|
|
259 |
$thumb_url = $medium_array[0];
|
260 |
} else {
|
261 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/' . $this->type . '_thumb.png';
|
@@ -280,6 +287,7 @@ class BPMediaHostWordpress {
|
|
280 |
*/
|
281 |
function get_media_activity_content() {
|
282 |
global $bp_media_counter, $bp_media_default_excerpts, $bp_media;
|
|
|
283 |
$attachment_id = $this->id;
|
284 |
$activity_content = apply_filters('bp_media_single_activity_title', '<div class="bp_media_title"><a href="' . $this->url . '" title="' . __($this->name, 'buddypress-media') . '">' . __(wp_html_excerpt($this->name, $bp_media_default_excerpts['activity_entry_title']), 'buddypress-media') . '</a></div>');
|
285 |
$activity_content .='<div class="bp_media_content">';
|
@@ -287,19 +295,17 @@ class BPMediaHostWordpress {
|
|
287 |
case 'video' :
|
288 |
if ($this->thumbnail_id) {
|
289 |
$image_array = image_downsize($this->thumbnail_id, 'bp_media_activity_image');
|
290 |
-
$activity_content.=apply_filters('bp_media_single_activity_filter', '<video poster="' . $image_array[0] . '" src="' . wp_get_attachment_url($attachment_id) . '" width="
|
291 |
} else {
|
292 |
-
$activity_content.=apply_filters('bp_media_single_activity_filter', '<video src="' . wp_get_attachment_url($attachment_id) . '" width="
|
293 |
}
|
294 |
break;
|
295 |
case 'audio' :
|
296 |
-
$activity_content.=apply_filters('bp_media_single_activity_filter', '<audio src="' . wp_get_attachment_url($attachment_id) . '" width="
|
297 |
-
$type = 'audio';
|
298 |
break;
|
299 |
case 'image' :
|
300 |
$image_array = image_downsize($attachment_id, 'bp_media_activity_image');
|
301 |
$activity_content.=apply_filters('bp_media_single_activity_filter', '<a href="' . $this->url . '" title="' . __($this->name, 'buddypress-media') . '"><img src="' . $image_array[0] . '" id="bp_media_image_' . $this->id . '_' . $bp_media_counter++ . '" alt="' . __($this->name, 'buddypress-media') . '" /></a>', $this, true);
|
302 |
-
$type = 'image';
|
303 |
break;
|
304 |
default :
|
305 |
return false;
|
@@ -354,7 +360,7 @@ class BPMediaHostWordpress {
|
|
354 |
function get_media_single_content() {
|
355 |
global $bp_media_default_excerpts, $bp_media;
|
356 |
|
357 |
-
$
|
358 |
$content = '';
|
359 |
if ($this->group_id > 0) {
|
360 |
|
@@ -365,13 +371,13 @@ class BPMediaHostWordpress {
|
|
365 |
case 'video' :
|
366 |
if ($this->thumbnail_id) {
|
367 |
$image_array = image_downsize($this->thumbnail_id, 'bp_media_single_image');
|
368 |
-
$content.=apply_filters('bp_media_single_content_filter', '<video poster="' . $image_array[0] . '" src="' . wp_get_attachment_url($this->id) . '" width="' . $
|
369 |
} else {
|
370 |
-
$content.=apply_filters('bp_media_single_content_filter', '<video src="' . wp_get_attachment_url($this->id) . '" width="' . $
|
371 |
}
|
372 |
break;
|
373 |
case 'audio' :
|
374 |
-
$content.=apply_filters('bp_media_single_content_filter', '<audio src="' . wp_get_attachment_url($this->id) . '" width="' . $
|
375 |
break;
|
376 |
case 'image' :
|
377 |
$image_array = image_downsize($this->id, 'bp_media_single_image');
|
@@ -471,7 +477,9 @@ class BPMediaHostWordpress {
|
|
471 |
switch ($this->type) {
|
472 |
case 'video' :
|
473 |
if ($this->thumbnail_id) {
|
474 |
-
$
|
|
|
|
|
475 |
$thumb_url = $medium_array[0];
|
476 |
} else {
|
477 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/video_thumb.png';
|
@@ -487,7 +495,9 @@ class BPMediaHostWordpress {
|
|
487 |
break;
|
488 |
case 'audio' :
|
489 |
if ($this->thumbnail_id) {
|
490 |
-
$
|
|
|
|
|
491 |
$thumb_url = $medium_array[0];
|
492 |
} else {
|
493 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/audio_thumb.png';
|
@@ -503,7 +513,9 @@ class BPMediaHostWordpress {
|
|
503 |
<?php
|
504 |
break;
|
505 |
case 'image' :
|
506 |
-
$
|
|
|
|
|
507 |
$medium_path = $medium_array[0];
|
508 |
?>
|
509 |
<li id="bp-media-item-<?php echo $this->id ?>">
|
@@ -749,7 +761,9 @@ class BPMediaHostWordpress {
|
|
749 |
switch ($this->type) {
|
750 |
case 'video' :
|
751 |
if ($this->thumbnail_id) {
|
752 |
-
$
|
|
|
|
|
753 |
$thumb_url = $medium_array[0];
|
754 |
} else {
|
755 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/video_thumb.png';
|
@@ -757,14 +771,18 @@ class BPMediaHostWordpress {
|
|
757 |
break;
|
758 |
case 'audio' :
|
759 |
if ($this->thumbnail_id) {
|
760 |
-
$
|
|
|
|
|
761 |
$thumb_url = $medium_array[0];
|
762 |
} else {
|
763 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/audio_thumb.png';
|
764 |
}
|
765 |
break;
|
766 |
case 'image' :
|
767 |
-
$
|
|
|
|
|
768 |
$thumb_url = $medium_array[0];
|
769 |
break;
|
770 |
default :
|
@@ -952,7 +970,6 @@ class BPMediaHostWordpress {
|
|
952 |
$this->url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . $this->id);
|
953 |
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_EDIT_SLUG . '/' . $this->id);
|
954 |
$this->delete_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
|
955 |
-
$image_array = image_downsize($this->id, 'bp_media_single_image');
|
956 |
$this->thumbnail_id = $this->id;
|
957 |
break;
|
958 |
case 'album' :
|
@@ -985,7 +1002,7 @@ class BPMediaHostWordpress {
|
|
985 |
$create_new_album_flag = false;
|
986 |
if ($album_id != 0) {
|
987 |
$album = get_post($album_id);
|
988 |
-
if ($album->post_author != $author_id && $group == 0) {
|
989 |
$create_new_album_flag = true;
|
990 |
} else {
|
991 |
$post_id = $album->ID;
|
113 |
function add_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false, $is_activity = false, $files = false, $author_id = false, $album_name = false) {
|
114 |
echo $this->insert_media($name, $description, $album_id, $group, $is_multiple, $is_activity, $files, $author_id, $album_name);
|
115 |
}
|
116 |
+
|
117 |
+
function insert_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false, $is_activity = false, $files = false, $author_id = false, $album_name = false) {
|
118 |
do_action('bp_media_before_add_media');
|
119 |
|
120 |
global $bp, $wpdb, $bp_media;
|
121 |
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
122 |
include_once(ABSPATH . 'wp-admin/includes/image.php');
|
123 |
+
|
124 |
+
if (!$author_id)
|
125 |
+
$author_id = get_current_user_id();
|
126 |
+
|
127 |
$post_id = $this->check_and_create_album($album_id, $group, $author_id, $album_name);
|
128 |
|
129 |
if (!$files) {
|
139 |
|
140 |
$type = $file['type'];
|
141 |
if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
|
142 |
+
if (function_exists('read_exif_data')) {
|
143 |
+
$file = $this->exif($file);
|
144 |
+
}
|
|
|
145 |
}
|
146 |
|
147 |
$attachment = array();
|
226 |
$activity_content = false;
|
227 |
throw new Exception(__('Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4.', 'buddypress-media'));
|
228 |
}
|
229 |
+
|
230 |
$attachment_id = wp_insert_attachment($attachment, $file, $post_id);
|
231 |
if (!is_wp_error($attachment_id)) {
|
232 |
+
add_filter('intermediate_image_sizes', array($this, 'bp_media_image_sizes'), 99);
|
233 |
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
|
234 |
} else {
|
235 |
unlink($file);
|
252 |
return $attachment_id;
|
253 |
}
|
254 |
|
255 |
+
function bp_media_image_sizes($sizes) {
|
256 |
+
return array('bp_media_thumbnail', 'bp_media_activity_image', 'bp_media_single_image');
|
257 |
+
}
|
258 |
+
|
259 |
+
function get_media_thumbnail($size = 'bp_media_thumbnail') {
|
260 |
$thumb = '';
|
261 |
if (in_array($this->type, array('image', 'video', 'audio'))) {
|
262 |
if ($this->thumbnail_id) {
|
263 |
+
$metadata = wp_get_attachment_metadata($this->thumbnail_id);
|
264 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
265 |
+
$medium_array = image_downsize($this->thumbnail_id, $wpattachsize);
|
266 |
$thumb_url = $medium_array[0];
|
267 |
} else {
|
268 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/' . $this->type . '_thumb.png';
|
287 |
*/
|
288 |
function get_media_activity_content() {
|
289 |
global $bp_media_counter, $bp_media_default_excerpts, $bp_media;
|
290 |
+
$default_size = $bp_media->media_sizes();
|
291 |
$attachment_id = $this->id;
|
292 |
$activity_content = apply_filters('bp_media_single_activity_title', '<div class="bp_media_title"><a href="' . $this->url . '" title="' . __($this->name, 'buddypress-media') . '">' . __(wp_html_excerpt($this->name, $bp_media_default_excerpts['activity_entry_title']), 'buddypress-media') . '</a></div>');
|
293 |
$activity_content .='<div class="bp_media_content">';
|
295 |
case 'video' :
|
296 |
if ($this->thumbnail_id) {
|
297 |
$image_array = image_downsize($this->thumbnail_id, 'bp_media_activity_image');
|
298 |
+
$activity_content.=apply_filters('bp_media_single_activity_filter', '<video poster="' . $image_array[0] . '" src="' . wp_get_attachment_url($attachment_id) . '" width="'.$default_size['video']['medium']['width'].'" height="'.$default_size['video']['medium']['height'].'" type="video/mp4" id="bp_media_video_' . $this->id . '_' . $bp_media_counter . '" controls="controls" preload="none"></video></span>', $this, true);
|
299 |
} else {
|
300 |
+
$activity_content.=apply_filters('bp_media_single_activity_filter', '<video src="' . wp_get_attachment_url($attachment_id) . '" width="'.$default_size['video']['medium']['width'].'" height="'.$default_size['video']['medium']['height'].'" type="video/mp4" id="bp_media_video_' . $this->id . '_' . $bp_media_counter . '" controls="controls" preload="none"></video></span>', $this, true);
|
301 |
}
|
302 |
break;
|
303 |
case 'audio' :
|
304 |
+
$activity_content.=apply_filters('bp_media_single_activity_filter', '<audio src="' . wp_get_attachment_url($attachment_id) . '" width="'.$default_size['audio']['medium']['width'].'" type="audio/mp3" id="bp_media_audio_' . $this->id . '_' . $bp_media_counter . '" controls="controls" preload="none" ></audio></span>', $this, true);
|
|
|
305 |
break;
|
306 |
case 'image' :
|
307 |
$image_array = image_downsize($attachment_id, 'bp_media_activity_image');
|
308 |
$activity_content.=apply_filters('bp_media_single_activity_filter', '<a href="' . $this->url . '" title="' . __($this->name, 'buddypress-media') . '"><img src="' . $image_array[0] . '" id="bp_media_image_' . $this->id . '_' . $bp_media_counter++ . '" alt="' . __($this->name, 'buddypress-media') . '" /></a>', $this, true);
|
|
|
309 |
break;
|
310 |
default :
|
311 |
return false;
|
360 |
function get_media_single_content() {
|
361 |
global $bp_media_default_excerpts, $bp_media;
|
362 |
|
363 |
+
$default_size = $bp_media->media_sizes();
|
364 |
$content = '';
|
365 |
if ($this->group_id > 0) {
|
366 |
|
371 |
case 'video' :
|
372 |
if ($this->thumbnail_id) {
|
373 |
$image_array = image_downsize($this->thumbnail_id, 'bp_media_single_image');
|
374 |
+
$content.=apply_filters('bp_media_single_content_filter', '<video poster="' . $image_array[0] . '" src="' . wp_get_attachment_url($this->id) . '" width="' . $default_size['video']['large']['width'] . '" height="' . ($default_size['video']['large']['height'] == 0 ? 'auto' : $default_size['video']['large']['height']) . '" type="video/mp4" id="bp_media_video_' . $this->id . '" controls="controls" preload="none"></video>', $this);
|
375 |
} else {
|
376 |
+
$content.=apply_filters('bp_media_single_content_filter', '<video src="' . wp_get_attachment_url($this->id) . '" width="' . $default_size['video']['large']['width'] . '" height="' . ($default_size['video']['large']['height'] == 0 ? 'auto' : $default_size['video']['large']['height']) . '" type="video/mp4" id="bp_media_video_' . $this->id . '" controls="controls" preload="none"></video>', $this);
|
377 |
}
|
378 |
break;
|
379 |
case 'audio' :
|
380 |
+
$content.=apply_filters('bp_media_single_content_filter', '<audio src="' . wp_get_attachment_url($this->id) . '" width="' . $default_size['audio']['large']['width'] . '" type="audio/mp3" id="bp_media_audio_' . $this->id . '" controls="controls" preload="none" ></audio>', $this);
|
381 |
break;
|
382 |
case 'image' :
|
383 |
$image_array = image_downsize($this->id, 'bp_media_single_image');
|
477 |
switch ($this->type) {
|
478 |
case 'video' :
|
479 |
if ($this->thumbnail_id) {
|
480 |
+
$metadata = wp_get_attachment_metadata($this->thumbnail_id);
|
481 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
482 |
+
$medium_array = image_downsize($this->thumbnail_id, $wpattachsize);
|
483 |
$thumb_url = $medium_array[0];
|
484 |
} else {
|
485 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/video_thumb.png';
|
495 |
break;
|
496 |
case 'audio' :
|
497 |
if ($this->thumbnail_id) {
|
498 |
+
$metadata = wp_get_attachment_metadata($this->thumbnail_id);
|
499 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
500 |
+
$medium_array = image_downsize($this->thumbnail_id, $wpattachsize);
|
501 |
$thumb_url = $medium_array[0];
|
502 |
} else {
|
503 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/audio_thumb.png';
|
513 |
<?php
|
514 |
break;
|
515 |
case 'image' :
|
516 |
+
$metadata = wp_get_attachment_metadata($attachment);
|
517 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
518 |
+
$medium_array = image_downsize($attachment, $wpattachsize);
|
519 |
$medium_path = $medium_array[0];
|
520 |
?>
|
521 |
<li id="bp-media-item-<?php echo $this->id ?>">
|
761 |
switch ($this->type) {
|
762 |
case 'video' :
|
763 |
if ($this->thumbnail_id) {
|
764 |
+
$metadata = wp_get_attachment_metadata($this->thumbnail_id);
|
765 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
766 |
+
$medium_array = image_downsize($this->thumbnail_id, $wpattachsize);
|
767 |
$thumb_url = $medium_array[0];
|
768 |
} else {
|
769 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/video_thumb.png';
|
771 |
break;
|
772 |
case 'audio' :
|
773 |
if ($this->thumbnail_id) {
|
774 |
+
$metadata = wp_get_attachment_metadata($this->thumbnail_id);
|
775 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
776 |
+
$medium_array = image_downsize($this->thumbnail_id, $wpattachsize);
|
777 |
$thumb_url = $medium_array[0];
|
778 |
} else {
|
779 |
$thumb_url = BP_MEDIA_URL . 'app/assets/img/audio_thumb.png';
|
780 |
}
|
781 |
break;
|
782 |
case 'image' :
|
783 |
+
$metadata = wp_get_attachment_metadata($attachment);
|
784 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
785 |
+
$medium_array = image_downsize($attachment, $wpattachsize);
|
786 |
$thumb_url = $medium_array[0];
|
787 |
break;
|
788 |
default :
|
970 |
$this->url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . $this->id);
|
971 |
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_EDIT_SLUG . '/' . $this->id);
|
972 |
$this->delete_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
|
|
|
973 |
$this->thumbnail_id = $this->id;
|
974 |
break;
|
975 |
case 'album' :
|
1002 |
$create_new_album_flag = false;
|
1003 |
if ($album_id != 0) {
|
1004 |
$album = get_post($album_id);
|
1005 |
+
if ( $author_id && $album->post_author != $author_id && $group == 0) {
|
1006 |
$create_new_album_flag = true;
|
1007 |
} else {
|
1008 |
$post_id = $album->ID;
|
app/main/includes/BPMediaImage.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of BPMediaImage
|
5 |
+
*
|
6 |
+
* @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
|
7 |
+
*/
|
8 |
+
class BPMediaImage {
|
9 |
+
|
10 |
+
public function __construct() {
|
11 |
+
add_action('bp_media_add_media_fields', array($this, 'edit'), 99);
|
12 |
+
add_action('wp_enqueue_scripts', array($this, 'editor_ui'));
|
13 |
+
}
|
14 |
+
|
15 |
+
public function edit($media_type) {
|
16 |
+
if ($media_type == 'image') {
|
17 |
+
global $bp_media_current_entry;
|
18 |
+
$id = $bp_media_current_entry->get_id();
|
19 |
+
$editor = wp_get_image_editor(get_attached_file($id));
|
20 |
+
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
|
21 |
+
echo '<div class="bp-media-image-editor-cotnainer">';
|
22 |
+
echo '<div class="bp-media-image-editor" id="image-editor-' . $id . '"></div>';
|
23 |
+
$thumb_url = wp_get_attachment_image_src($id, 'bp_media_thumbnail', true);
|
24 |
+
$nonce = wp_create_nonce("image_editor-$id");
|
25 |
+
echo '<div id="imgedit-response-' . $id . '"></div>';
|
26 |
+
echo '<div class="wp_attachment_image" id="media-head-' . $id . '">
|
27 |
+
<p id="thumbnail-head-' . $id . '"><img class="thumbnail" src="' . set_url_scheme($thumb_url[0]) . '" alt="" /></p>
|
28 |
+
<p><input type="button" class="bp-media-image-edit" id="imgedit-open-btn-' . $id . '" onclick="imageEdit.open( \'' . $id . '\', \'' . $nonce . '\' )" class="button" value="Modifiy Image"> <span class="spinner"></span></p>
|
29 |
+
</div>';
|
30 |
+
echo '</div>';
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
public function editor_ui() {
|
35 |
+
if (( 'edit' == bp_action_variable(0)) && is_numeric(bp_action_variable(1))) {
|
36 |
+
if ('attachment' == get_post_type(bp_action_variable(1)) && substr_compare(get_post_field('post_mime_type', bp_action_variable(1)), 'image', 0, 6)) {
|
37 |
+
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
|
38 |
+
wp_enqueue_script('wp-ajax-response');
|
39 |
+
wp_enqueue_script('bp-media-image-edit', admin_url("js/image-edit$suffix.js"), array('jquery', 'json2', 'imgareaselect'), false, 1);
|
40 |
+
wp_enqueue_style('bp-media-image-edit', BP_MEDIA_URL . 'app/assets/css/image-edit.css');
|
41 |
+
wp_enqueue_style('imgareaselect');
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
?>
|
app/main/profile/BPMediaAlbum.php
CHANGED
@@ -119,10 +119,14 @@ class BPMediaAlbum {
|
|
119 |
));
|
120 |
$thumbnail_id = get_post_thumbnail_id($this->id);
|
121 |
if ($thumbnail_id) {
|
122 |
-
|
|
|
|
|
123 |
} elseif ($attachments) {
|
124 |
foreach ($attachments as $attachment) {
|
125 |
-
$
|
|
|
|
|
126 |
}
|
127 |
} else {
|
128 |
$this->thumbnail = '<img src ="' . BP_MEDIA_URL . 'app/assets/img/image_thumb.png">';
|
119 |
));
|
120 |
$thumbnail_id = get_post_thumbnail_id($this->id);
|
121 |
if ($thumbnail_id) {
|
122 |
+
$metadata = wp_get_attachment_metadata($thumbnail_id);
|
123 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
124 |
+
$this->thumbnail = wp_get_attachment_image($thumbnail_id, $wpattachsize);
|
125 |
} elseif ($attachments) {
|
126 |
foreach ($attachments as $attachment) {
|
127 |
+
$metadata = wp_get_attachment_metadata($attachment->ID);
|
128 |
+
$wpattachsize = isset($metadata['sizes']['bp_media_thumbnail'])?'bp_media_thumbnail':'thumbnail';
|
129 |
+
$this->thumbnail = wp_get_attachment_image($attachment->ID, $wpattachsize);
|
130 |
}
|
131 |
} else {
|
132 |
$this->thumbnail = '<img src ="' . BP_MEDIA_URL . 'app/assets/img/image_thumb.png">';
|
app/main/profile/BPMediaScreen.php
CHANGED
@@ -335,6 +335,7 @@ class BPMediaScreen {
|
|
335 |
maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_description'], $bp_media_default_excerpts['activity_entry_description'])) ?>"
|
336 |
><?php echo $bp_media_current_entry->get_content(); ?></textarea>
|
337 |
<?php do_action('bp_media_add_media_fields', $this->media_type); ?>
|
|
|
338 |
<div class="submit">
|
339 |
<input type="submit" class="auto" value="<?php _e('Update', 'buddypress-media'); ?>" />
|
340 |
<a href="<?php echo $bp_media_current_entry->get_url(); ?>" class="button" title="<?php _e('Back to Media File', 'buddypress-media'); ?>">
|
335 |
maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_description'], $bp_media_default_excerpts['activity_entry_description'])) ?>"
|
336 |
><?php echo $bp_media_current_entry->get_content(); ?></textarea>
|
337 |
<?php do_action('bp_media_add_media_fields', $this->media_type); ?>
|
338 |
+
|
339 |
<div class="submit">
|
340 |
<input type="submit" class="auto" value="<?php _e('Update', 'buddypress-media'); ?>" />
|
341 |
<a href="<?php echo $bp_media_current_entry->get_url(); ?>" class="button" title="<?php _e('Back to Media File', 'buddypress-media'); ?>">
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: BuddyPress Media
|
4 |
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
5 |
Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
|
6 |
-
Version: 2.
|
7 |
Author: rtCamp
|
8 |
Text Domain: buddypress-media
|
9 |
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
3 |
Plugin Name: BuddyPress Media
|
4 |
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
5 |
Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
|
6 |
+
Version: 2.9
|
7 |
Author: rtCamp
|
8 |
Text Domain: buddypress-media
|
9 |
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ License: GPLv2 or later
|
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: WordPress 3.5 + BuddyPress 1.6
|
8 |
Tested up to: WordPress 3.5 + BuddyPress 1.6
|
9 |
-
Stable tag: 2.
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
@@ -122,9 +122,17 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
|
|
122 |
|
123 |
Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page") to get some details about future releases.
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
= 2.8.1 =
|
126 |
-
*
|
127 |
-
*
|
128 |
|
129 |
= 2.8 =
|
130 |
* Adds importer for BP Album
|
@@ -357,5 +365,5 @@ Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-medi
|
|
357 |
* HTML5 Video Tag Support (with fallback)
|
358 |
|
359 |
== Upgrade Notice ==
|
360 |
-
= 2.
|
361 |
-
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: WordPress 3.5 + BuddyPress 1.6
|
8 |
Tested up to: WordPress 3.5 + BuddyPress 1.6
|
9 |
+
Stable tag: 2.9
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
122 |
|
123 |
Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page") to get some details about future releases.
|
124 |
|
125 |
+
= 2.9 =
|
126 |
+
* Adds options to specify Media Sizes
|
127 |
+
* Adds options to modify the image ( Crop, Rotate, Flip & Scale )
|
128 |
+
* Creates only required image sizes ( Rather than all registered image sizes )
|
129 |
+
* Adds thickbox to BuddyPress Media Widget
|
130 |
+
* Fixes bug in js
|
131 |
+
* Adds framework for shotcode support ( Functionality will be added in the next release )
|
132 |
+
|
133 |
= 2.8.1 =
|
134 |
+
* Improved i18n support, thanks to [David Decker](http://profiles.wordpress.org/daveshine/)
|
135 |
+
* Updated translations
|
136 |
|
137 |
= 2.8 =
|
138 |
* Adds importer for BP Album
|
365 |
* HTML5 Video Tag Support (with fallback)
|
366 |
|
367 |
== Upgrade Notice ==
|
368 |
+
= 2.9 =
|
369 |
+
Adds Image Editor
|