Version Description
Download this release
Release Info
Developer | pasyuk |
Plugin | Gmedia Photo Gallery |
Version | 1.21.6 |
Comparing to | |
See all releases |
Code changes from version 1.20.0 to 1.21.6
- admin/admin.php +446 -433
- admin/ajax.php +636 -578
- admin/app.php +53 -49
- admin/assets/css/gmedia.admin.css +210 -115
- admin/assets/js/gmedia.admin.js +1963 -1749
- admin/assets/js/gmedia.global.js +5 -3
- admin/assets/js/gmedia.metabox.js +156 -232
- admin/class.processor.php +35 -30
- admin/functions.php +9 -9
- admin/logs.php +109 -103
- admin/pages/addmedia/addmedia.php +5 -8
- admin/pages/addmedia/tpl/assign-terms.php +23 -24
- admin/pages/addmedia/tpl/import.php +59 -59
- admin/pages/addmedia/tpl/panel-heading.php +21 -20
- admin/pages/addmedia/tpl/upload.php +113 -108
- admin/pages/galleries/edit-gallery.php +27 -27
- admin/pages/galleries/functions.php +12 -12
- admin/pages/galleries/galleries.php +10 -13
- admin/pages/galleries/tpl/choose-module.php +35 -37
- admin/pages/galleries/tpl/galleries-panel-heading.php +53 -44
- admin/pages/galleries/tpl/gallery-edit-item.php +123 -88
- admin/pages/galleries/tpl/gallery-list-item.php +23 -24
- admin/pages/galleries/tpl/gallery-panel-heading.php +26 -26
- admin/pages/galleries/tpl/modal-build-query.php +360 -340
- admin/pages/galleries/tpl/module-settings.php +20 -17
- admin/pages/library/functions.php +82 -47
- admin/pages/library/library.php +27 -29
- admin/pages/library/tpl/edit-item.php +176 -123
- admin/pages/library/tpl/grid-item.php +51 -38
- admin/pages/library/tpl/list-item.php +75 -60
- admin/pages/library/tpl/no-items.php +13 -12
- admin/pages/library/tpl/panel-footer.php +9 -8
- admin/pages/library/tpl/panel-heading.php +152 -115
- admin/pages/modules/edit-preset.php +18 -19
- admin/pages/modules/functions.php +22 -17
- admin/pages/modules/modules.php +28 -28
- admin/pages/modules/tpl/modal-modulezip.php +9 -10
- admin/pages/modules/tpl/module-item.php +26 -27
- admin/pages/modules/tpl/module-preset-edit-item.php +44 -34
- admin/pages/modules/tpl/module-preset-panel-heading.php +11 -14
- admin/pages/settings/settings.php +22 -26
- admin/pages/settings/tpl/common.php +92 -87
- admin/pages/settings/tpl/license.php +33 -28
- admin/pages/settings/tpl/permalinks.php +34 -36
- admin/pages/settings/tpl/roles.php +34 -37
- admin/pages/settings/tpl/system.php +9 -11
- admin/pages/terms/edit-term.php +7 -10
- admin/pages/terms/functions.php +46 -33
- admin/pages/terms/terms.php +8 -11
- admin/pages/terms/tpl/album-create-item.php +67 -63
- admin/pages/terms/tpl/album-edit-item.php +143 -98
- admin/pages/terms/tpl/album-list-item.php +21 -20
- admin/pages/terms/tpl/category-create-item.php +58 -51
- admin/pages/terms/tpl/category-edit-item.php +90 -70
- admin/pages/terms/tpl/category-list-item.php +12 -12
- admin/pages/terms/tpl/no-items.php +4 -7
- admin/pages/terms/tpl/tag-create-item.php +11 -11
- admin/pages/terms/tpl/tag-list-item.php +11 -12
- admin/pages/terms/tpl/term-panel-heading.php +38 -29
- admin/pages/terms/tpl/terms-create-alert.php +4 -6
- admin/pages/terms/tpl/terms-panel-heading.php +51 -43
- admin/processor/class.processor.addmedia.php +5 -4
- admin/processor/class.processor.galleries.php +75 -60
- admin/processor/class.processor.library.php +185 -152
- admin/processor/class.processor.modules.php +54 -41
- admin/processor/class.processor.settings.php +38 -35
- admin/processor/class.processor.terms.php +49 -42
- admin/processor/class.processor.wpmedia.php +6 -4
- admin/support.php +119 -73
- admin/tpl/comments.php +34 -16
- admin/tpl/modal-customfield.php +9 -9
- admin/tpl/modal-share.php +21 -23
- admin/tpl/module-preview.php +6 -7
- admin/tpl/search-form.php +3 -6
admin/admin.php
CHANGED
@@ -4,48 +4,50 @@
|
|
4 |
* GmediaAdmin - Admin Section for GRAND Media
|
5 |
*/
|
6 |
class GmediaAdmin {
|
7 |
-
|
8 |
-
|
9 |
|
10 |
/**
|
11 |
* constructor
|
12 |
*/
|
13 |
-
function __construct() {
|
14 |
-
global $pagenow;
|
15 |
|
16 |
-
add_action( 'admin_head',
|
17 |
|
18 |
-
// Add the admin menu
|
19 |
-
add_action( 'admin_menu',
|
20 |
|
21 |
-
// Add the script and style files
|
22 |
-
add_action( 'admin_enqueue_scripts',
|
23 |
-
add_action( 'admin_print_scripts-widgets.php',
|
24 |
|
25 |
-
add_action( 'enqueue_block_editor_assets',
|
26 |
|
27 |
-
add_filter( 'screen_settings',
|
28 |
-
add_filter( 'set-screen-option',
|
29 |
-
add_filter( 'set_screen_option_gm_screen_options',
|
30 |
|
31 |
-
|
|
|
32 |
$this->body_classes[] = 'grand-media-admin-page';
|
33 |
|
34 |
-
if ( ! isset( $_GET['gmediablank'] ) || 'library' === $
|
35 |
-
$this->body_classes[] = $
|
36 |
-
|
37 |
-
|
|
|
38 |
}
|
39 |
if ( isset( $_GET['edit_term'] ) || isset( $_GET['gallery_module'] ) || isset( $_GET['preset'] ) ) {
|
40 |
-
$this->body_classes[] = $
|
41 |
}
|
42 |
}
|
43 |
|
44 |
if ( ( 'admin.php' === $pagenow ) && isset( $_GET['gmediablank'] ) ) {
|
45 |
-
add_action( 'admin_init',
|
46 |
}
|
47 |
|
48 |
-
add_action( 'admin_footer',
|
49 |
}
|
50 |
|
51 |
}
|
@@ -53,12 +55,17 @@ class GmediaAdmin {
|
|
53 |
/**
|
54 |
* admin_head
|
55 |
*/
|
56 |
-
function admin_head() {
|
57 |
-
|
58 |
|
59 |
-
|
|
|
|
|
|
|
60 |
?>
|
61 |
-
<style
|
|
|
|
|
62 |
<?php
|
63 |
}
|
64 |
}
|
@@ -66,16 +73,18 @@ class GmediaAdmin {
|
|
66 |
/**
|
67 |
* admin_body_class
|
68 |
*
|
69 |
-
* @param $classes_string
|
70 |
*
|
71 |
* @return string
|
72 |
*/
|
73 |
-
function admin_body_class( $classes_string ) {
|
|
|
|
|
74 |
$classes = $this->body_classes;
|
75 |
|
76 |
$classes[] = $classes_string;
|
77 |
-
if ( isset( $_GET[
|
78 |
-
$classes[] =
|
79 |
}
|
80 |
$classes = array_filter( $classes );
|
81 |
|
@@ -85,10 +94,10 @@ class GmediaAdmin {
|
|
85 |
/**
|
86 |
* Load gmedia pages in wpless interface
|
87 |
*/
|
88 |
-
function gmedia_blank_page() {
|
89 |
set_current_screen( 'GrandMedia_Settings' );
|
90 |
|
91 |
-
global $gmCore, $gmProcessor;
|
92 |
$gmediablank = $gmCore->_get( 'gmediablank', '' );
|
93 |
define( 'IFRAME_REQUEST', true );
|
94 |
|
@@ -110,7 +119,7 @@ class GmediaAdmin {
|
|
110 |
break;
|
111 |
case 'library':
|
112 |
echo '<div id="gmedia_iframe_content">';
|
113 |
-
echo '<div id="gm-message">' . $gmCore->alert( 'success', $gmProcessor->msg ) . $gmCore->alert( 'danger', $gmProcessor->error ) . '</div>';
|
114 |
include GMEDIA_ABSPATH . 'admin/pages/library/library.php';
|
115 |
echo '</div>';
|
116 |
break;
|
@@ -127,42 +136,50 @@ class GmediaAdmin {
|
|
127 |
exit;
|
128 |
}
|
129 |
|
130 |
-
|
131 |
-
function add_menu() {
|
132 |
|
133 |
$count = '';
|
134 |
if ( current_user_can( 'gmedia_module_manage' ) ) {
|
135 |
global $gmGallery;
|
136 |
if ( $gmGallery->options['modules_update'] ) {
|
137 |
-
$count .=
|
138 |
}
|
139 |
if ( $gmGallery->options['modules_new'] && ! empty( $gmGallery->options['notify_new_modules'] ) ) {
|
140 |
-
$count .=
|
141 |
}
|
142 |
}
|
143 |
|
144 |
-
$this->pages =
|
145 |
-
$this->pages[] = add_menu_page(
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
if ( current_user_can( 'gmedia_library' ) ) {
|
151 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Add Media Files', 'grand-media' ), __( 'Add/Import Files', 'grand-media' ), 'gmedia_upload', 'GrandMedia_AddMedia',
|
152 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Tags', 'grand-media' ), __( 'Tags', 'grand-media' ), 'gmedia_tag_manage', 'GrandMedia_Tags',
|
153 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Categories', 'grand-media' ), __( 'Categories', 'grand-media' ), 'gmedia_category_manage', 'GrandMedia_Categories',
|
154 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Albums', 'grand-media' ), __( 'Albums', 'grand-media' ), 'gmedia_album_manage', 'GrandMedia_Albums',
|
155 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Galleries', 'grand-media' ), __( 'Galleries', 'grand-media' ), 'gmedia_gallery_manage', 'GrandMedia_Galleries',
|
156 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Modules', 'grand-media' ), __( 'Modules', 'grand-media' ), 'gmedia_gallery_manage', 'GrandMedia_Modules',
|
157 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Settings', 'grand-media' ), __( 'Settings', 'grand-media' ), 'manage_options', 'GrandMedia_Settings',
|
158 |
//$this->pages[] = add_submenu_page( 'GrandMedia', __( 'iOS Application', 'grand-media' ), __( 'iOS Application', 'grand-media' ), 'gmedia_settings', 'GrandMedia_App', array( &$this, 'shell' ) );
|
159 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'WordPress Media Library', 'grand-media' ), __( 'WP Media Library', 'grand-media' ), 'gmedia_import', 'GrandMedia_WordpressLibrary',
|
160 |
-
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Logs', 'grand-media' ), __( 'Gmedia Logs', 'grand-media' ), 'manage_options', 'GrandMedia_Logs',
|
161 |
//$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Support', 'grand-media' ), __( 'Support', 'grand-media' ), 'manage_options', 'GrandMedia_Support', array( &$this, 'shell' ) );
|
162 |
}
|
163 |
|
164 |
foreach ( $this->pages as $page ) {
|
165 |
-
add_action( "load-$page",
|
166 |
}
|
167 |
}
|
168 |
|
@@ -170,14 +187,14 @@ class GmediaAdmin {
|
|
170 |
* Load the script for the defined page and load only this code
|
171 |
* Display shell of plugin
|
172 |
*/
|
173 |
-
function shell() {
|
174 |
-
global $gmCore, $gmProcessor, $gmGallery;
|
175 |
|
176 |
$sideLinks = $this->sideLinks();
|
177 |
|
178 |
-
// check for upgrade
|
179 |
if ( get_option( 'gmediaDbVersion' ) !== GMEDIA_DBVERSION ) {
|
180 |
-
if ( get_transient( 'gmediaUpgrade' ) || (
|
181 |
$sideLinks['grandTitle'] = __( 'Updating GmediaGallery Plugin', 'grand-media' );
|
182 |
$sideLinks['sideLinks'] = '';
|
183 |
$gmProcessor->page = 'GrandMedia_Update';
|
@@ -186,18 +203,18 @@ class GmediaAdmin {
|
|
186 |
}
|
187 |
}
|
188 |
|
189 |
-
//
|
190 |
-
|
191 |
-
//
|
192 |
-
//
|
193 |
-
//
|
194 |
-
//
|
195 |
-
//
|
196 |
|
197 |
?>
|
198 |
<div id="gmedia-container" class="gmedia-admin">
|
199 |
<?php
|
200 |
-
if ( $gmProcessor->page
|
201 |
$this->collect_data_permission();
|
202 |
}
|
203 |
?>
|
@@ -209,54 +226,57 @@ class GmediaAdmin {
|
|
209 |
<?php
|
210 |
if ( ! is_plugin_active( 'woowgallery/woowgallery.php' ) && empty( $gmGallery->options['disable_ads'] ) ) {
|
211 |
?>
|
212 |
-
<div class="promote-woowbox"><a href="https://bit.ly/gm-woowgallery" target="_blank"><img src="<?php echo esc_url( plugins_url( '
|
213 |
<?php
|
214 |
}
|
215 |
?>
|
216 |
</div>
|
217 |
<div class="container-fluid">
|
218 |
<div class="row row-fx180-fl">
|
219 |
-
<div class="col-sm-2 hidden-xs" id="sidebar" role="navigation">
|
220 |
-
<?php echo $sideLinks['sideLinks']; ?>
|
221 |
|
222 |
<?php
|
223 |
if ( (int) $gmGallery->options['feedback'] ) {
|
224 |
$installDate = get_option( 'gmediaInstallDate' );
|
225 |
-
if ( $installDate && ( strtotime( $installDate ) < strtotime( '2 weeks ago' ) ) ) {
|
226 |
-
|
227 |
-
|
228 |
-
|
|
|
229 |
</div>
|
230 |
-
<div class="collapse<?php
|
231 |
-
|
232 |
-
|
233 |
-
<div class="panel-body">
|
234 |
-
<p><?php _e( 'You can help me spread the word about GmediaGallery among the users striving to get awesome galleries on their WordPress sites.', 'grand-media' ); ?></p>
|
235 |
|
236 |
<p>
|
237 |
-
<a class="btn btn-primary" href="https://wordpress.org/support/view/plugin-reviews/grand-media?filter=5" target="_blank"><?php
|
238 |
</p>
|
239 |
|
240 |
-
<p><?php
|
241 |
</div>
|
242 |
</div>
|
243 |
</div>
|
244 |
-
|
|
|
245 |
}
|
246 |
if ( (int) $gmGallery->options['twitter'] ) {
|
247 |
?>
|
248 |
-
<div class="
|
249 |
<a class="twitter-timeline" data-height="600" href="https://twitter.com/CodEasily/timelines/648240437141086212?ref_src=twsrc%5Etfw">#GmediaGallery - Curated tweets by CodEasily</a>
|
250 |
-
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"
|
251 |
</div>
|
252 |
<?php
|
253 |
-
}
|
|
|
254 |
</div>
|
255 |
<div class="col-sm-10 col-xs-12">
|
256 |
-
<div id="gm-message"
|
257 |
-
|
258 |
-
echo $gmCore->alert( '
|
259 |
-
|
|
|
|
|
260 |
|
261 |
<?php $this->controller(); ?>
|
262 |
|
@@ -267,16 +287,17 @@ class GmediaAdmin {
|
|
267 |
<?php
|
268 |
}
|
269 |
|
270 |
-
function sideLinks() {
|
271 |
global $submenu, $gmProcessor, $gmGallery;
|
272 |
$content['sideLinks'] = '
|
273 |
<div id="gmedia-navbar">
|
274 |
<div class="row">
|
275 |
-
<ul
|
276 |
if ( empty( $gmGallery->options['license_key'] ) ) {
|
277 |
-
$content['sideLinks'] .= "\n" . '<a class="list-group-item list-group-item-premium" target="_blank" href="https://codeasily.com/product/one-site-license/">' .
|
278 |
}
|
279 |
-
|
|
|
280 |
if ( $menuItem[2] === $gmProcessor->page ) {
|
281 |
$iscur = ' active';
|
282 |
$content['grandTitle'] = $menuItem[3];
|
@@ -284,16 +305,16 @@ class GmediaAdmin {
|
|
284 |
$iscur = '';
|
285 |
}
|
286 |
$menuData = '';
|
287 |
-
if ( $menuItem[2]
|
288 |
if ( ! empty( $gmGallery->options['notify_new_modules'] ) ) {
|
289 |
-
$menuData .= '<span class="badge badge-success
|
290 |
}
|
291 |
-
$menuData .= '<span class="badge badge-error
|
292 |
}
|
293 |
|
294 |
-
$content['sideLinks'] .= "\n" . '<a class="list-group-item' . $iscur . '" href="' . admin_url( 'admin.php?page=' . $menuItem[2] ) . '">' . $menuItem[0] . $menuData . '</a>';
|
295 |
}
|
296 |
-
$content['sideLinks'] .= "\n" . '<a class="list-group-item" target="_blank" href="https://wordpress.org/support/plugin/grand-media/">' .
|
297 |
$content['sideLinks'] .= '
|
298 |
</li></ul>
|
299 |
</div>
|
@@ -302,41 +323,43 @@ class GmediaAdmin {
|
|
302 |
return $content;
|
303 |
}
|
304 |
|
305 |
-
function collect_data_permission() {
|
306 |
$current_user = wp_get_current_user();
|
307 |
$nonce = wp_create_nonce( 'GmediaService' );
|
308 |
?>
|
309 |
<div class="notice updated gm-message gmedia-service__message">
|
310 |
<div class="gm-message-content">
|
311 |
<div class="gm-plugin-icon">
|
312 |
-
<img src="<?php echo esc_url( plugins_url( '
|
313 |
</div>
|
314 |
-
<?php
|
315 |
-
|
|
|
|
|
316 |
</div>
|
317 |
<div class="gm-message-actions">
|
318 |
-
<button class="button button-secondary gm_service_action" data-action="skip" data-nonce="<?php echo esc_attr( $nonce ); ?>"><?php
|
319 |
-
<button class="button button-primary gm_service_action" data-action="allow" data-nonce="<?php echo esc_attr( $nonce ); ?>"><?php
|
320 |
</div>
|
321 |
<div class="gm-message-plus gm-closed">
|
322 |
-
<a class="gm-mp-trigger" href="#" onclick="jQuery('.gm-message-plus').toggleClass('gm-closed gm-opened'); return false;"><?php
|
323 |
<ul>
|
324 |
<li>
|
325 |
<i class="dashicons dashicons-admin-users"></i>
|
326 |
|
327 |
<div>
|
328 |
-
<span><?php
|
329 |
|
330 |
-
<p><?php
|
331 |
</div>
|
332 |
</li>
|
333 |
<li>
|
334 |
<i class="dashicons dashicons-admin-settings"></i>
|
335 |
|
336 |
<div>
|
337 |
-
<span><?php
|
338 |
|
339 |
-
<p><?php
|
340 |
</div>
|
341 |
</li>
|
342 |
</ul>
|
@@ -345,7 +368,7 @@ class GmediaAdmin {
|
|
345 |
<?php
|
346 |
}
|
347 |
|
348 |
-
function controller() {
|
349 |
|
350 |
global $gmProcessor;
|
351 |
switch ( $gmProcessor->page ) {
|
@@ -353,12 +376,6 @@ class GmediaAdmin {
|
|
353 |
include_once dirname( __FILE__ ) . '/pages/addmedia/addmedia.php';
|
354 |
break;
|
355 |
case 'GrandMedia_Albums':
|
356 |
-
if ( isset( $_GET['edit_term'] ) ) {
|
357 |
-
include_once dirname( __FILE__ ) . '/pages/terms/edit-term.php';
|
358 |
-
} else {
|
359 |
-
include_once dirname( __FILE__ ) . '/pages/terms/terms.php';
|
360 |
-
}
|
361 |
-
break;
|
362 |
case 'GrandMedia_Categories':
|
363 |
if ( isset( $_GET['edit_term'] ) ) {
|
364 |
include_once dirname( __FILE__ ) . '/pages/terms/edit-term.php';
|
@@ -409,12 +426,12 @@ class GmediaAdmin {
|
|
409 |
include_once dirname( __FILE__ ) . '/pages/library/library.php';
|
410 |
break;
|
411 |
default:
|
412 |
-
do_action( '
|
413 |
break;
|
414 |
}
|
415 |
}
|
416 |
|
417 |
-
function admin_footer() {
|
418 |
$ajax_operations = get_option( 'gmedia_ajax_long_operations' );
|
419 |
if ( empty( $ajax_operations ) || ! is_array( $ajax_operations ) ) {
|
420 |
return;
|
@@ -429,35 +446,35 @@ class GmediaAdmin {
|
|
429 |
$nonce = wp_create_nonce( 'gmedia_ajax_long_operations' );
|
430 |
?>
|
431 |
<script type="text/javascript">
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
|
|
|
|
|
|
446 |
gmAjaxLongOperation();
|
447 |
});
|
448 |
-
};
|
449 |
-
gmAjaxLongOperation();
|
450 |
-
});
|
451 |
</script>
|
452 |
<?php
|
453 |
}
|
454 |
|
455 |
/**
|
456 |
-
* @param $hook
|
457 |
*/
|
458 |
-
function load_scripts( $hook ) {
|
459 |
global $gmCore, $gmProcessor, $gmGallery;
|
460 |
-
// no need to go on if it's not a plugin page
|
461 |
if ( 'admin.php' !== $hook && strpos( $gmCore->_get( 'page' ), 'GrandMedia' ) === false ) {
|
462 |
return;
|
463 |
}
|
@@ -485,109 +502,101 @@ class GmediaAdmin {
|
|
485 |
wp_enqueue_style( 'gmedia-bootstrap' );
|
486 |
wp_enqueue_script( 'gmedia-bootstrap' );
|
487 |
|
488 |
-
|
489 |
-
|
490 |
|
491 |
-
wp_register_style( 'spectrum', $gmCore->gmedia_url . '/assets/spectrum/spectrum.min.css',
|
492 |
-
wp_register_script( 'spectrum', $gmCore->gmedia_url . '/assets/spectrum/spectrum.min.js',
|
493 |
|
494 |
-
|
495 |
-
|
496 |
-
|
|
|
497 |
if ( $gmCore->caps['gmedia_edit_media'] ) {
|
498 |
if ( $gmCore->_get( 'gmediablank' ) === 'image_editor' ) {
|
499 |
-
wp_enqueue_script( 'camanjs', $gmCore->gmedia_url . '/assets/image-editor/camanjs/caman.full.min.js',
|
500 |
|
501 |
-
wp_enqueue_style( 'nouislider', $gmCore->gmedia_url . '/assets/image-editor/js/jquery.nouislider.css',
|
502 |
-
wp_enqueue_script( 'nouislider', $gmCore->gmedia_url . '/assets/image-editor/js/jquery.nouislider.min.js',
|
503 |
|
504 |
-
wp_enqueue_style( 'gmedia-image-editor', $gmCore->gmedia_url . '/assets/image-editor/style.css',
|
505 |
-
wp_enqueue_script( 'gmedia-image-editor', $gmCore->gmedia_url . '/assets/image-editor/image-editor.js',
|
506 |
break;
|
507 |
}
|
508 |
-
if ( $gmProcessor->mode
|
509 |
-
wp_enqueue_script( 'alphanum', $gmCore->gmedia_url . '/assets/jq-plugins/jquery.alphanum.js',
|
510 |
|
511 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
512 |
|
513 |
-
wp_enqueue_script( '
|
514 |
-
wp_enqueue_style( '
|
515 |
-
wp_enqueue_script( '
|
516 |
-
|
517 |
-
'moment',
|
518 |
-
'gmedia-bootstrap',
|
519 |
-
], '4.17.47' );
|
520 |
}
|
521 |
}
|
522 |
-
wp_enqueue_script( 'wavesurfer', $gmCore->gmedia_url . '/assets/wavesurfer/wavesurfer.min.js',
|
523 |
break;
|
524 |
-
case
|
525 |
break;
|
526 |
-
case
|
527 |
if ( isset( $_GET['edit_term'] ) ) {
|
528 |
if ( $gmCore->caps['gmedia_album_manage'] ) {
|
529 |
-
|
530 |
-
wp_enqueue_script( 'jquery-ui-full', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js', [], '1.10.2' );
|
531 |
}
|
532 |
|
533 |
-
wp_enqueue_script( '
|
534 |
-
wp_enqueue_style( '
|
535 |
-
wp_enqueue_script( '
|
536 |
-
|
537 |
-
|
538 |
-
'gmedia-bootstrap',
|
539 |
-
], '2.1.32' );
|
540 |
}
|
541 |
break;
|
542 |
-
case
|
543 |
break;
|
544 |
-
case
|
545 |
if ( $gmCore->caps['gmedia_upload'] ) {
|
546 |
$tab = $gmCore->_get( 'tab', 'upload' );
|
547 |
-
if (
|
548 |
-
wp_enqueue_style( 'jquery
|
549 |
-
wp_enqueue_script( 'jquery
|
550 |
-
|
551 |
-
wp_enqueue_script( 'gmedia-plupload', $gmCore->gmedia_url . '/assets/plupload/plupload.full.min.js', [ 'jquery', 'jquery-ui-full' ], '2.3.7' );
|
552 |
-
|
553 |
-
wp_enqueue_style( 'jquery.ui.plupload', $gmCore->gmedia_url . '/assets/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css', [ 'jquery-ui-smoothness' ], '2.3.7', 'screen' );
|
554 |
-
wp_enqueue_script( 'jquery.ui.plupload', $gmCore->gmedia_url . '/assets/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js', [
|
555 |
-
'gmedia-plupload',
|
556 |
-
'jquery-ui-full',
|
557 |
-
], '2.1.2' );
|
558 |
-
|
559 |
}
|
560 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
break;
|
562 |
-
case
|
563 |
-
case
|
564 |
-
// under construction
|
565 |
break;
|
566 |
-
case
|
567 |
if ( $gmCore->caps['gmedia_gallery_manage'] && ( isset( $_GET['gallery_module'] ) || isset( $_GET['edit_term'] ) ) ) {
|
568 |
|
569 |
-
wp_enqueue_style( 'jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css', [], '1.10.2', 'screen' );
|
570 |
-
wp_enqueue_script( 'jquery-ui-resizable' );
|
571 |
-
|
572 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
573 |
|
574 |
-
wp_enqueue_style( 'jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.css',
|
575 |
-
wp_enqueue_script( 'jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.js',
|
576 |
|
577 |
wp_enqueue_style( 'spectrum' );
|
578 |
wp_enqueue_script( 'spectrum' );
|
579 |
}
|
580 |
break;
|
581 |
-
case
|
582 |
if ( isset( $_GET['preset_module'] ) || isset( $_GET['preset'] ) ) {
|
583 |
|
584 |
-
wp_enqueue_style( 'jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css', [], '1.10.2', 'screen' );
|
585 |
-
wp_enqueue_script( 'jquery-ui-resizable' );
|
586 |
-
|
587 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
588 |
|
589 |
-
wp_enqueue_style( 'jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.css',
|
590 |
-
wp_enqueue_script( 'jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.js',
|
591 |
|
592 |
wp_enqueue_style( 'spectrum' );
|
593 |
wp_enqueue_script( 'spectrum' );
|
@@ -603,22 +612,21 @@ class GmediaAdmin {
|
|
603 |
|
604 |
}
|
605 |
|
606 |
-
function gmedia_widget_scripts() {
|
607 |
-
|
608 |
-
}
|
609 |
|
610 |
/**
|
611 |
* Enqueue the block's assets for the gutenberg editor.
|
612 |
*/
|
613 |
-
function gutenberg_assets() {
|
614 |
global $gmGallery, $gmDB, $gmCore;
|
615 |
|
616 |
-
wp_enqueue_style( 'gmedia-block-editor', $gmCore->gmedia_url . '/admin/assets/css/gmedia-block.css',
|
617 |
wp_register_script(
|
618 |
'gmedia-block-editor',
|
619 |
$gmCore->gmedia_url . '/admin/assets/js/gmedia-block.js',
|
620 |
-
|
621 |
-
$gmGallery->version
|
|
|
622 |
);
|
623 |
|
624 |
$default_module = $gmGallery->options['default_gmedia_module'];
|
@@ -626,14 +634,14 @@ class GmediaAdmin {
|
|
626 |
$default_module = $default_preset['module'];
|
627 |
|
628 |
$modules_data = get_gmedia_modules( false );
|
629 |
-
$modules =
|
630 |
-
$modules_options =
|
631 |
if ( ! empty( $modules_data['in'] ) ) {
|
632 |
foreach ( $modules_data['in'] as $module_name => $module_data ) {
|
633 |
|
634 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
635 |
-
$option =
|
636 |
-
$option[ $module_name ] = $module_data['title'] . ' - ' . __( 'Default Settings' );
|
637 |
foreach ( $presets as $preset ) {
|
638 |
if ( ! (int) $preset->global && '[' . $module_name . ']' === $preset->name ) {
|
639 |
continue;
|
@@ -644,78 +652,71 @@ class GmediaAdmin {
|
|
644 |
$by_author = $display_name ? ' [' . $display_name . ']' : '';
|
645 |
}
|
646 |
if ( '[' . $module_name . ']' === $preset->name ) {
|
647 |
-
$option[ $preset->term_id ] = $module_data['title'] . $by_author . ' - ' . __( 'Default Settings' );
|
648 |
} else {
|
649 |
$preset_name = str_replace( '[' . $module_name . '] ', '', $preset->name );
|
650 |
-
$option[ $preset->term_id ] = $module_data['title'] . $by_author . ' - ' . $preset_name;
|
651 |
}
|
652 |
}
|
653 |
-
$modules_options[ $module_name ] =
|
654 |
|
655 |
-
$modules[ $module_name ] =
|
656 |
-
'name' => $module_data['title'],
|
657 |
-
'screenshot' => $module_data['module_url'] . '/screenshot.png',
|
658 |
-
|
659 |
}
|
660 |
}
|
661 |
|
662 |
-
$gm_galleries =
|
663 |
-
$gm_albums =
|
664 |
-
$gm_categories =
|
665 |
-
$gm_tags =
|
666 |
|
667 |
$gm_terms = $gmDB->get_terms( 'gmedia_gallery' );
|
668 |
if ( count( $gm_terms ) ) {
|
669 |
foreach ( $gm_terms as $_term ) {
|
670 |
unset( $_term->description );
|
671 |
unset( $_term->taxonomy );
|
672 |
-
$_term->module_name = $gmDB->get_metadata( 'gmedia_term', $_term->term_id, '_module', true );
|
673 |
if ( $_term->global ) {
|
674 |
-
$display_name =
|
675 |
-
|
|
|
676 |
}
|
677 |
if ( $_term->status && 'publish' !== $_term->status ) {
|
678 |
-
$_term->name .= " [{$_term->status}]";
|
679 |
}
|
680 |
$gm_galleries[ $_term->term_id ] = $_term;
|
681 |
}
|
682 |
}
|
683 |
-
$gm_galleries =
|
684 |
-
0 => [
|
685 |
-
'term_id' => 0,
|
686 |
-
'name' => __( ' - select gallery - ', 'grand-media' ),
|
687 |
-
],
|
688 |
-
] + $gm_galleries;
|
689 |
|
690 |
$gm_terms = $gmDB->get_terms( 'gmedia_album' );
|
691 |
if ( count( $gm_terms ) ) {
|
692 |
foreach ( $gm_terms as $_term ) {
|
693 |
unset( $_term->description );
|
694 |
unset( $_term->taxonomy );
|
695 |
-
$module_preset = $gmDB->get_metadata( 'gmedia_term', $_term->term_id, '_module_preset', true );
|
696 |
if ( $module_preset ) {
|
697 |
$preset = $gmCore->getModulePreset( $module_preset );
|
698 |
-
$_term->module_name = $preset['module'];
|
699 |
} else {
|
700 |
$_term->module_name = '';
|
701 |
}
|
702 |
if ( $_term->global ) {
|
703 |
-
$display_name =
|
704 |
-
|
|
|
705 |
}
|
706 |
if ( $_term->status && 'publish' !== $_term->status ) {
|
707 |
-
$_term->name .= " [{$_term->status}]";
|
708 |
}
|
709 |
-
$_term->name
|
|
|
710 |
$gm_albums[ $_term->term_id ] = $_term;
|
711 |
}
|
712 |
}
|
713 |
-
$gm_albums =
|
714 |
-
0 => [
|
715 |
-
'term_id' => 0,
|
716 |
-
'name' => __( ' - select album - ', 'grand-media' ),
|
717 |
-
],
|
718 |
-
] + $gm_albums;
|
719 |
|
720 |
$gm_terms = $gmDB->get_terms( 'gmedia_category' );
|
721 |
if ( count( $gm_terms ) ) {
|
@@ -724,16 +725,12 @@ class GmediaAdmin {
|
|
724 |
unset( $_term->taxonomy );
|
725 |
unset( $_term->global );
|
726 |
unset( $_term->status );
|
727 |
-
$_term->name
|
|
|
728 |
$gm_categories[ $_term->term_id ] = $_term;
|
729 |
}
|
730 |
}
|
731 |
-
$gm_categories =
|
732 |
-
0 => [
|
733 |
-
'term_id' => 0,
|
734 |
-
'name' => __( ' - select category - ', 'grand-media' ),
|
735 |
-
],
|
736 |
-
] + $gm_categories;
|
737 |
|
738 |
$gm_terms = $gmDB->get_terms( 'gmedia_tag' );
|
739 |
if ( count( $gm_terms ) ) {
|
@@ -742,18 +739,14 @@ class GmediaAdmin {
|
|
742 |
unset( $_term->taxonomy );
|
743 |
unset( $_term->global );
|
744 |
unset( $_term->status );
|
745 |
-
$_term->name
|
|
|
746 |
$gm_tags[ $_term->term_id ] = $_term;
|
747 |
}
|
748 |
}
|
749 |
-
$gm_tags =
|
750 |
-
|
751 |
-
|
752 |
-
'name' => __( ' - select tag - ', 'grand-media' ),
|
753 |
-
],
|
754 |
-
] + $gm_tags;
|
755 |
-
|
756 |
-
$data = [
|
757 |
'modules' => $modules,
|
758 |
'default_module' => $default_module,
|
759 |
'modules_options' => $modules_options,
|
@@ -762,134 +755,156 @@ class GmediaAdmin {
|
|
762 |
'albums' => $gm_albums,
|
763 |
'categories' => $gm_categories,
|
764 |
'tags' => $gm_tags,
|
765 |
-
|
766 |
|
767 |
wp_localize_script( 'gmedia-block-editor', 'gmedia_data', $data );
|
768 |
wp_enqueue_script( 'gmedia-block-editor' );
|
769 |
}
|
770 |
|
771 |
-
function screen_help() {
|
772 |
$screen = get_current_screen();
|
773 |
$screen_id = explode( 'page_', $screen->id, 2 );
|
774 |
$screen_id = $screen_id[1];
|
775 |
|
776 |
-
$screen->add_help_tab(
|
777 |
-
|
778 |
-
|
779 |
-
|
|
|
|
|
|
|
780 |
<p>If you have any problems with displaying Gmedia Gallery in admin or on website. Before posting to the Forum try next:</p>
|
781 |
<ul>
|
782 |
-
<li>Exclude plugin conflicts: Disable other plugins one by one and check if it
|
783 |
<li>Exclude theme conflict: Temporary switch to one of default themes and check if gallery works</li>
|
784 |
</ul>
|
785 |
-
<h4>Links</h4>',
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
| <a href="https://codeasily.com/
|
|
|
|
|
790 |
</p>',
|
791 |
-
|
|
|
792 |
|
793 |
switch ( $screen_id ) {
|
794 |
-
case 'GrandMedia'
|
795 |
break;
|
796 |
-
case 'GrandMedia_Settings'
|
797 |
if ( current_user_can( 'manage_options' ) ) {
|
798 |
-
$screen->add_help_tab(
|
799 |
-
|
800 |
-
|
801 |
-
|
|
|
|
|
|
|
|
|
802 |
<p>No, plugin is absolutely free and all modules for it are free to install.</p>
|
803 |
<p>Even premium modules are fully functional and free to test, but have backlink labels. To remove baclink labels from premium modules you need license key.</p>
|
804 |
<p>Note: License Key will remove backlinks from all current and future premium modules, so you can use all available modules on one website.</p>
|
805 |
-
<p>Do not purchase license key before testing module you like. Only if everything works fine and you satisfied with functionality you are good to purchase license. Otherwise use <a href="%1$s" target="_blank">Gmedia Support Forum</a>.</p>
|
806 |
-
<h4>I have license key but I can\'t activate it</h4>
|
807 |
-
<p>Contact developer <a href="mailto:%2$s">%2$s</a> with your problem and wait for additional instructions and code for manual activation</p>',
|
808 |
-
|
809 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
810 |
}
|
811 |
break;
|
812 |
-
case 'GrandMedia_App'
|
813 |
$gm_options = get_option( 'gmediaOptions' );
|
814 |
$nonce = wp_create_nonce( 'GmediaService' );
|
815 |
if ( current_user_can( 'manage_options' ) && (int) $gm_options['mobile_app'] ) {
|
816 |
-
$screen->add_help_tab(
|
817 |
-
|
818 |
-
|
819 |
-
|
|
|
|
|
|
|
820 |
<p>Usage tracking is done in the name of making <strong>Gmedia Gallery</strong> better. Making a better user experience, prioritizing new features, and more good things.</p>
|
821 |
-
<p>By clicking "Opt Out", we will no longer be sending any data from <strong>Gmedia Gallery</strong> to <a href="https://codeasily.com" target="_blank">codeasily.com</a>.</p>',
|
822 |
-
|
823 |
-
|
824 |
-
<button
|
825 |
-
|
826 |
-
<button type="button" data-action="
|
827 |
-
<button type="button" data-action="
|
|
|
|
|
828 |
</div>
|
829 |
',
|
830 |
-
|
|
|
831 |
}
|
832 |
break;
|
833 |
}
|
834 |
}
|
835 |
|
836 |
/**
|
837 |
-
* @param $current
|
838 |
-
* @param $screen
|
839 |
*
|
840 |
* @return string
|
841 |
*/
|
842 |
-
function screen_settings( $current, $screen ) {
|
843 |
global $gmProcessor, $gmCore;
|
844 |
if ( in_array( $screen->id, $this->pages, true ) ) {
|
845 |
|
846 |
$gm_screen_options = $gmProcessor->user_options;
|
847 |
|
848 |
-
$title = '<h5><strong>' .
|
849 |
-
$wp_screen_options = '<input type="hidden" name="wp_screen_options[option]" value="gm_screen_options" /><input type="hidden" name="wp_screen_options[value]" value="' . $screen->id . '" />';
|
850 |
-
$button = get_submit_button(
|
851 |
|
852 |
$settings = false;
|
853 |
|
854 |
$screen_id = explode( 'page_', $screen->id, 2 );
|
855 |
|
856 |
switch ( $screen_id[1] ) {
|
857 |
-
case 'GrandMedia'
|
858 |
$settings = '
|
859 |
-
<div class="form-inline
|
860 |
<div class="form-group">
|
861 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia]" class="form-control input-
|
862 |
</div>
|
863 |
<div class="form-group">
|
864 |
-
<select name="gm_screen_options[orderby_gmedia]" class="form-control input-
|
865 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'ID', false ) . ' value="ID">' .
|
866 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'title', false ) . ' value="title">' .
|
867 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'gmuid', false ) . ' value="gmuid">' .
|
868 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'mime_type', false ) . ' value="mime_type">' .
|
869 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'author', false ) . ' value="author">' .
|
870 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'date', false ) . ' value="date">' .
|
871 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'modified', false ) . ' value="modified">' .
|
872 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], '_created_timestamp', false ) . ' value="_created_timestamp">' .
|
873 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'comment_count', false ) . ' value="comment_count">' .
|
874 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'views', false ) . ' value="views">' .
|
875 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], 'likes', false ) . ' value="likes">' .
|
876 |
-
<option' . selected( $gm_screen_options['orderby_gmedia'], '_size', false ) . ' value="_size">' .
|
877 |
-
</select> <span>' .
|
878 |
</div>
|
879 |
<div class="form-group">
|
880 |
-
<select name="gm_screen_options[sortorder_gmedia]" class="form-control input-
|
881 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia'], 'DESC', false ) . ' value="DESC">' .
|
882 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia'], 'ASC', false ) . ' value="ASC">' .
|
883 |
-
</select> <span>' .
|
884 |
</div>
|
885 |
';
|
886 |
if ( 'edit' === $gmCore->_get( 'mode' ) ) {
|
887 |
$settings .= '
|
888 |
<div class="form-group">
|
889 |
-
<select name="gm_screen_options[library_edit_quicktags]" class="form-control input-
|
890 |
-
<option' . selected( $gm_screen_options['library_edit_quicktags'], 'false', false ) . ' value="false">' .
|
891 |
-
<option' . selected( $gm_screen_options['library_edit_quicktags'], 'true', false ) . ' value="true">' .
|
892 |
-
</select> <span>' .
|
893 |
</div>
|
894 |
';
|
895 |
}
|
@@ -897,191 +912,190 @@ class GmediaAdmin {
|
|
897 |
</div>
|
898 |
';
|
899 |
break;
|
900 |
-
case 'GrandMedia_AddMedia'
|
901 |
$tab = $gmCore->_get( 'tab', 'upload' );
|
902 |
if ( 'upload' === $tab ) {
|
903 |
$html4_hide = ( 'html4' === $gm_screen_options['uploader_runtime'] ) ? ' hide' : '';
|
904 |
$settings = '
|
905 |
-
<div class="form-inline
|
906 |
-
<div id="uploader_runtime" class="form-group"><span>' .
|
907 |
-
<select name="gm_screen_options[uploader_runtime]" class="form-control input-
|
908 |
-
<option' . selected( $gm_screen_options['uploader_runtime'], 'auto', false ) . ' value="auto">' .
|
909 |
-
<option' . selected( $gm_screen_options['uploader_runtime'], 'html5', false ) . ' value="html5">' .
|
910 |
-
<option' . selected( $gm_screen_options['uploader_runtime'], '
|
911 |
-
<option' . selected( $gm_screen_options['uploader_runtime'], 'html4', false ) . ' value="html4">' . __( 'HTML4 Uploader', 'grand-media' ) . '</option>
|
912 |
</select>
|
913 |
</div>
|
914 |
-
<div id="uploader_chunking" class="form-group' . $html4_hide . '"><span>' .
|
915 |
-
<select name="gm_screen_options[uploader_chunking]" class="form-control input-
|
916 |
-
<option' . selected( $gm_screen_options['uploader_chunking'], 'true', false ) . ' value="true">' .
|
917 |
-
<option' . selected( $gm_screen_options['uploader_chunking'], 'false', false ) . ' value="false">' .
|
918 |
</select>
|
919 |
</div>
|
920 |
-
<div id="uploader_urlstream_upload" class="form-group' . $html4_hide . '"><span>' .
|
921 |
-
<select name="gm_screen_options[uploader_urlstream_upload]" class="form-control input-
|
922 |
-
<option' . selected( $gm_screen_options['uploader_urlstream_upload'], 'true', false ) . ' value="true">' .
|
923 |
-
<option' . selected( $gm_screen_options['uploader_urlstream_upload'], 'false', false ) . ' value="false">' .
|
924 |
</select>
|
925 |
</div>
|
926 |
</div>
|
927 |
';
|
928 |
}
|
929 |
break;
|
930 |
-
case 'GrandMedia_Albums'
|
931 |
if ( isset( $_GET['edit_term'] ) ) {
|
932 |
$settings = '
|
933 |
-
<div class="form-inline
|
934 |
<div class="form-group">
|
935 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_album_edit]" class="form-control input-
|
936 |
</div>
|
937 |
</div>
|
938 |
';
|
939 |
} else {
|
940 |
$settings = '
|
941 |
-
<div class="form-inline
|
942 |
<div class="form-group">
|
943 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_album]" class="form-control input-
|
944 |
</div>
|
945 |
<div class="form-group">
|
946 |
-
<select name="gm_screen_options[orderby_gmedia_album]" class="form-control input-
|
947 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_album'], 'id', false ) . ' value="id">' .
|
948 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_album'], 'name', false ) . ' value="name">' .
|
949 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_album'], 'count', false ) . ' value="count">' .
|
950 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_album'], 'global', false ) . ' value="global">' .
|
951 |
-
</select> <span>' .
|
952 |
</div>
|
953 |
<div class="form-group">
|
954 |
-
<select name="gm_screen_options[sortorder_gmedia_album]" class="form-control input-
|
955 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_album'], 'DESC', false ) . ' value="DESC">' .
|
956 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_album'], 'ASC', false ) . ' value="ASC">' .
|
957 |
-
</select> <span>' .
|
958 |
</div>
|
959 |
</div>
|
960 |
';
|
961 |
}
|
962 |
break;
|
963 |
-
case 'GrandMedia_Categories'
|
964 |
if ( isset( $_GET['edit_term'] ) ) {
|
965 |
$settings = '
|
966 |
-
<div class="form-inline
|
967 |
<div class="form-group">
|
968 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_category_edit]" class="form-control input-
|
969 |
</div>
|
970 |
</div>
|
971 |
';
|
972 |
} else {
|
973 |
$settings = '
|
974 |
-
<div class="form-inline
|
975 |
<div class="form-group">
|
976 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_category]" class="form-control input-
|
977 |
</div>
|
978 |
<div class="form-group">
|
979 |
-
<select name="gm_screen_options[orderby_gmedia_category]" class="form-control input-
|
980 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_category'], 'id', false ) . ' value="id">' .
|
981 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_category'], 'name', false ) . ' value="name">' .
|
982 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_category'], 'count', false ) . ' value="count">' .
|
983 |
-
</select> <span>' .
|
984 |
</div>
|
985 |
<div class="form-group">
|
986 |
-
<select name="gm_screen_options[sortorder_gmedia_category]" class="form-control input-
|
987 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_category'], 'DESC', false ) . ' value="DESC">' .
|
988 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_category'], 'ASC', false ) . ' value="ASC">' .
|
989 |
-
</select> <span>' .
|
990 |
</div>
|
991 |
</div>
|
992 |
';
|
993 |
}
|
994 |
break;
|
995 |
-
case 'GrandMedia_Tags'
|
996 |
$settings = '
|
997 |
-
<div class="form-inline
|
998 |
<div class="form-group">
|
999 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_tag]" class="form-control input-
|
1000 |
</div>
|
1001 |
<div class="form-group">
|
1002 |
-
<select name="gm_screen_options[orderby_gmedia_tag]" class="form-control input-
|
1003 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_tag'], 'id', false ) . ' value="id">' .
|
1004 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_tag'], 'name', false ) . ' value="name">' .
|
1005 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_tag'], 'count', false ) . ' value="count">' .
|
1006 |
-
</select> <span>' .
|
1007 |
</div>
|
1008 |
<div class="form-group">
|
1009 |
-
<select name="gm_screen_options[sortorder_gmedia_tag]" class="form-control input-
|
1010 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_tag'], 'DESC', false ) . ' value="DESC">' .
|
1011 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_tag'], 'ASC', false ) . ' value="ASC">' .
|
1012 |
-
</select> <span>' .
|
1013 |
</div>
|
1014 |
</div>
|
1015 |
';
|
1016 |
break;
|
1017 |
-
case 'GrandMedia_Galleries'
|
1018 |
if ( ! $gmCore->_get( 'edit_term' ) && ! $gmCore->_get( 'gallery_module' ) ) {
|
1019 |
$settings = '
|
1020 |
-
<div class="form-inline
|
1021 |
<div class="form-group">
|
1022 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_gallery]" class="form-control input-
|
1023 |
</div>
|
1024 |
<div class="form-group">
|
1025 |
-
<select name="gm_screen_options[orderby_gmedia_gallery]" class="form-control input-
|
1026 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_gallery'], 'id', false ) . ' value="id">' .
|
1027 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_gallery'], 'name', false ) . ' value="name">' .
|
1028 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_gallery'], 'global', false ) . ' value="global">' .
|
1029 |
-
</select> <span>' .
|
1030 |
</div>
|
1031 |
<div class="form-group">
|
1032 |
-
<select name="gm_screen_options[sortorder_gmedia_gallery]" class="form-control input-
|
1033 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_gallery'], 'DESC', false ) . ' value="DESC">' .
|
1034 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_gallery'], 'ASC', false ) . ' value="ASC">' .
|
1035 |
-
</select> <span>' .
|
1036 |
</div>
|
1037 |
</div>
|
1038 |
';
|
1039 |
}
|
1040 |
break;
|
1041 |
-
case 'GrandMedia_WordpressLibrary'
|
1042 |
-
$settings = '<p>' .
|
1043 |
-
<div class="form-inline
|
1044 |
<div class="form-group">
|
1045 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_wpmedia]" class="form-control input-
|
1046 |
</div>
|
1047 |
<div class="form-group">
|
1048 |
-
<select name="gm_screen_options[orderby_wpmedia]" class="form-control input-
|
1049 |
-
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'ID', false ) . ' value="ID">' .
|
1050 |
-
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'title', false ) . ' value="title">' .
|
1051 |
-
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'filename', false ) . ' value="filename">' .
|
1052 |
-
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'date', false ) . ' value="date">' .
|
1053 |
-
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'modified', false ) . ' value="modified">' .
|
1054 |
-
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'mime_type', false ) . ' value="mime_type">' .
|
1055 |
-
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'author', false ) . ' value="author">' .
|
1056 |
-
</select> <span>' .
|
1057 |
</div>
|
1058 |
<div class="form-group">
|
1059 |
-
<select name="gm_screen_options[sortorder_wpmedia]" class="form-control input-
|
1060 |
-
<option' . selected( $gm_screen_options['sortorder_wpmedia'], 'DESC', false ) . ' value="DESC">' .
|
1061 |
-
<option' . selected( $gm_screen_options['sortorder_wpmedia'], 'ASC', false ) . ' value="ASC">' .
|
1062 |
-
</select> <span>' .
|
1063 |
</div>
|
1064 |
</div>
|
1065 |
';
|
1066 |
break;
|
1067 |
-
case 'GrandMedia_Logs'
|
1068 |
$settings = '
|
1069 |
-
<div class="form-inline
|
1070 |
<div class="form-group">
|
1071 |
-
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_log]" class="form-control input-
|
1072 |
</div>
|
1073 |
<div class="form-group">
|
1074 |
-
<select name="gm_screen_options[orderby_gmedia_log]" class="form-control input-
|
1075 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_log'], 'log_date', false ) . ' value="log_date">' .
|
1076 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_log'], 'ID', false ) . ' value="ID">' .
|
1077 |
-
<option' . selected( $gm_screen_options['orderby_gmedia_log'], 'author', false ) . ' value="author">' .
|
1078 |
-
</select> <span>' .
|
1079 |
</div>
|
1080 |
<div class="form-group">
|
1081 |
-
<select name="gm_screen_options[sortorder_gmedia_log]" class="form-control input-
|
1082 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_log'], 'DESC', false ) . ' value="DESC">' .
|
1083 |
-
<option' . selected( $gm_screen_options['sortorder_gmedia_log'], 'ASC', false ) . ' value="ASC">' .
|
1084 |
-
</select> <span>' .
|
1085 |
</div>
|
1086 |
</div>
|
1087 |
';
|
@@ -1091,21 +1105,20 @@ class GmediaAdmin {
|
|
1091 |
if ( $settings ) {
|
1092 |
$current = $title . $settings . $wp_screen_options . $button;
|
1093 |
}
|
1094 |
-
|
1095 |
}
|
1096 |
|
1097 |
return $current;
|
1098 |
}
|
1099 |
|
1100 |
/**
|
1101 |
-
* @param $status
|
1102 |
-
* @param $option
|
1103 |
-
* @param $value
|
1104 |
*
|
1105 |
* @return array
|
1106 |
*/
|
1107 |
-
function screen_settings_save( $status, $option, $value ) {
|
1108 |
-
global $user_ID;
|
1109 |
if ( 'gm_screen_options' === $option ) {
|
1110 |
/*
|
1111 |
global $gmGallery;
|
@@ -1116,9 +1129,9 @@ class GmediaAdmin {
|
|
1116 |
*/
|
1117 |
$gm_screen_options = get_user_meta( $user_ID, 'gm_screen_options', true );
|
1118 |
if ( ! is_array( $gm_screen_options ) ) {
|
1119 |
-
$gm_screen_options =
|
1120 |
}
|
1121 |
-
$value = array_merge( $gm_screen_options, $
|
1122 |
|
1123 |
return $value;
|
1124 |
}
|
4 |
* GmediaAdmin - Admin Section for GRAND Media
|
5 |
*/
|
6 |
class GmediaAdmin {
|
7 |
+
public $pages = array();
|
8 |
+
public $body_classes = array();
|
9 |
|
10 |
/**
|
11 |
* constructor
|
12 |
*/
|
13 |
+
public function __construct() {
|
14 |
+
global $pagenow, $gmCore;
|
15 |
|
16 |
+
add_action( 'admin_head', array( &$this, 'admin_head' ) );
|
17 |
|
18 |
+
// Add the admin menu.
|
19 |
+
add_action( 'admin_menu', array( &$this, 'add_menu' ) );
|
20 |
|
21 |
+
// Add the script and style files.
|
22 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'load_scripts' ), 20 );
|
23 |
+
add_action( 'admin_print_scripts-widgets.php', array( &$this, 'gmedia_widget_scripts' ) );
|
24 |
|
25 |
+
add_action( 'enqueue_block_editor_assets', array( &$this, 'gutenberg_assets' ) );
|
26 |
|
27 |
+
add_filter( 'screen_settings', array( &$this, 'screen_settings' ), 10, 2 );
|
28 |
+
add_filter( 'set-screen-option', array( &$this, 'screen_settings_save' ), 11, 3 );
|
29 |
+
add_filter( 'set_screen_option_gm_screen_options', array( &$this, 'screen_settings_save' ), 11, 3 );
|
30 |
|
31 |
+
$page = $gmCore->_get( 'page' );
|
32 |
+
if ( $page && ( false !== strpos( $page, 'GrandMedia' ) ) ) {
|
33 |
$this->body_classes[] = 'grand-media-admin-page';
|
34 |
|
35 |
+
if ( ! isset( $_GET['gmediablank'] ) || 'library' === $gmCore->_get( 'gmediablank' ) ) {
|
36 |
+
$this->body_classes[] = $page;
|
37 |
+
$mode = $gmCore->_get( 'mode' );
|
38 |
+
if ( $mode ) {
|
39 |
+
$this->body_classes[] = $page . '_' . $mode;
|
40 |
}
|
41 |
if ( isset( $_GET['edit_term'] ) || isset( $_GET['gallery_module'] ) || isset( $_GET['preset'] ) ) {
|
42 |
+
$this->body_classes[] = $page . '_edit';
|
43 |
}
|
44 |
}
|
45 |
|
46 |
if ( ( 'admin.php' === $pagenow ) && isset( $_GET['gmediablank'] ) ) {
|
47 |
+
add_action( 'admin_init', array( &$this, 'gmedia_blank_page' ) );
|
48 |
}
|
49 |
|
50 |
+
add_action( 'admin_footer', array( &$this, 'admin_footer' ) );
|
51 |
}
|
52 |
|
53 |
}
|
55 |
/**
|
56 |
* admin_head
|
57 |
*/
|
58 |
+
public function admin_head() {
|
59 |
+
global $gmCore;
|
60 |
|
61 |
+
add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) );
|
62 |
+
|
63 |
+
$page = $gmCore->_get( 'page' );
|
64 |
+
if ( $page && ( false !== strpos( $page, 'GrandMedia' ) ) ) {
|
65 |
?>
|
66 |
+
<style id="gmedia_admin_css">html, body {
|
67 |
+
background: <?php echo isset( $_GET['gmediablank'] ) ? 'transparent' : '#708090'; ?>;
|
68 |
+
}</style>
|
69 |
<?php
|
70 |
}
|
71 |
}
|
73 |
/**
|
74 |
* admin_body_class
|
75 |
*
|
76 |
+
* @param string $classes_string
|
77 |
*
|
78 |
* @return string
|
79 |
*/
|
80 |
+
public function admin_body_class( $classes_string ) {
|
81 |
+
global $gmCore;
|
82 |
+
|
83 |
$classes = $this->body_classes;
|
84 |
|
85 |
$classes[] = $classes_string;
|
86 |
+
if ( isset( $_GET['gmediablank'] ) ) {
|
87 |
+
$classes[] = 'gmedia-blank gmedia_' . $gmCore->_get( 'gmediablank', '' );
|
88 |
}
|
89 |
$classes = array_filter( $classes );
|
90 |
|
94 |
/**
|
95 |
* Load gmedia pages in wpless interface
|
96 |
*/
|
97 |
+
public function gmedia_blank_page() {
|
98 |
set_current_screen( 'GrandMedia_Settings' );
|
99 |
|
100 |
+
global $gmCore, $gmProcessor, $gm_allowed_tags;
|
101 |
$gmediablank = $gmCore->_get( 'gmediablank', '' );
|
102 |
define( 'IFRAME_REQUEST', true );
|
103 |
|
119 |
break;
|
120 |
case 'library':
|
121 |
echo '<div id="gmedia_iframe_content">';
|
122 |
+
echo '<div id="gm-message">' . wp_kses( $gmCore->alert( 'success', $gmProcessor->msg ) . $gmCore->alert( 'danger', $gmProcessor->error ), $gm_allowed_tags ) . '</div>';
|
123 |
include GMEDIA_ABSPATH . 'admin/pages/library/library.php';
|
124 |
echo '</div>';
|
125 |
break;
|
136 |
exit;
|
137 |
}
|
138 |
|
139 |
+
/** Integrate the menu. */
|
140 |
+
public function add_menu() {
|
141 |
|
142 |
$count = '';
|
143 |
if ( current_user_can( 'gmedia_module_manage' ) ) {
|
144 |
global $gmGallery;
|
145 |
if ( $gmGallery->options['modules_update'] ) {
|
146 |
+
$count .= ' <span class="update-plugins count-' . intval( $gmGallery->options['modules_update'] ) . '" style="background-color: #bb391b;"><span class="plugin-count gm-module-count gm-modules-update-count" title="' . esc_html__( 'Modules Updates', 'grand-media' ) . '">' . intval( $gmGallery->options['modules_update'] ) . '</span></span>';
|
147 |
}
|
148 |
if ( $gmGallery->options['modules_new'] && ! empty( $gmGallery->options['notify_new_modules'] ) ) {
|
149 |
+
$count .= ' <span class="update-plugins count-' . intval( $gmGallery->options['modules_new'] ) . '" style="background-color: #367236;"><span class="plugin-count gm-module-count gm-modules-new-count" title="' . esc_html__( 'New Modules', 'grand-media' ) . '">' . intval( $gmGallery->options['modules_new'] ) . '</span></span>';
|
150 |
}
|
151 |
}
|
152 |
|
153 |
+
$this->pages = array();
|
154 |
+
$this->pages[] = add_menu_page(
|
155 |
+
__( 'Gmedia Library', 'grand-media' ),
|
156 |
+
"Gmedia{$count}",
|
157 |
+
'gmedia_library',
|
158 |
+
'GrandMedia',
|
159 |
+
array(
|
160 |
+
&$this,
|
161 |
+
'shell',
|
162 |
+
),
|
163 |
+
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMjAgMjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPiAgPGltYWdlIGlkPSJpbWFnZTAiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgeD0iMCIgeT0iMCIKICAgIHhsaW5rOmhyZWY9ImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBQlFBQUFBVUNBTUFBQUM2ViswL0FBQUFCR2RCVFVFQUFMR1BDL3hoQlFBQUFDQmpTRkpOCkFBQjZKZ0FBZ0lRQUFQb0FBQUNBNkFBQWRUQUFBT3BnQUFBNm1BQUFGM0NjdWxFOEFBQUJrbEJNVkVVeFpua3haM2d4WjNoQ2RJTnUKbEtBK2NZQnBrSjJRcmJhb3Y4YTV5OUdadEx5UnJyZG1qcHMzYTN4WmhKS0txYktPckxXcndjaW52c1dWc2JxM3l0Q1hzcnRWZ1k5UwpmNDZndWNGN25hZzdibjVFZFlWeGxxS01xclN3eGN1aHVzS2Z1TUMrejlSMm1xWTZibjZ1dzhyNy9QekYxTm0weU03dDh2UHo5dmVGCnBhL2Y1K3BiaHBSSWVJZCtvS3FOcTdTZHQ3OWhpcGN5YUhuSDF0clMzdUZIZDRiSzJOMzUrL3YzK2ZxOXp0UmFoWk5QZll5Qm9xeUMKbzYwOGIzOUdkb1poaTVoT2ZJdnE3L0dwdjhiLy8vLzIrUG45L2YzQjBkWkFjb0tZczd3emFIbSt6OVZxa1oxWGc1SFQzK0xZNHVaNgpuYWh3bGFGRGRJVFAzT0JLZVloTWU0bnc5UFhoNmV2eDlmYkwyZDFUZ0k1em1LTXphWHJUM3VLWXM3dlAyOS9WNE9PY3RyN2c2T3VVCnNMbE5mSXU0eTlEbzd2QkZkb1YzbTZibTdlODViWDNJMXR1RHBLN1EzT0JZaEpHUHJMWEMwdGVsdmNSSmVZamI1ZWpOMnQ1eWw2S1cKc3JyYjVPZUFvYXhqakpuZTUrbDJtcVhFMDlpSHByQnRrNTl5bDZOOG5xazRiSDNXNGVUVTMrUFIzZUdxd01jY1RNSnpBQUFBQW5SUwpUbE51MlhMaTRXRUFBQUFCWWt0SFJFVDV0SmpCQUFBQUNYQklXWE1BQUFzVEFBQUxFd0VBbXB3WUFBQUFCM1JKVFVVSDRBc0NDRGNJCmw0WXhCZ0FBQVIxSlJFRlVHTk5qWUdCa1FnT01ESmhpSUZFNGs1bUZGY2FFQzdLeGMzQnljZlB3SWd2eWNmRUxDQW9KYzRxSThvdEIKQmNVRkpDU2xtS1JsWklYbDVCVVVsVUNDeWlxcWF1b2FtbHJhT3N4TXVucjZCb1pBUVNOakUxTW1Kak56QzBzQkt5WW1hMTBiUHFDZwpyWWFkdllLRG81T3ppNnVidTRlOHA1QVhVTkJiMGNmWHo5OHVJRkNDS1VneE9NUk9DR2hScUdaWU9MTmRSR1JVZ0FFVGsxU0VYMVEwCkUwTk1ySGRjZklKVVlwSzdiRExRMHBUVXRIUW1ob3pNTEgzVGhPd2MzY3pjUExEelRMU1lHUElMbUR3S2k0cExtRXFUSWQ3Z0tHUmkKWUF1elk3SXJpeXV2cUlTSVNWVlZBeTJxQ2ErdERtU3BxMk1KckZkcXlNbjN5MjRFQ25weEp6UWxOUHZGeHBxMDVBWUh4N2Z5SW9VUwpNc0FleU5paUF3Q3FwalN3RnBqcGxnQUFBQ1YwUlZoMFpHRjBaVHBqY21WaGRHVUFNakF4TmkweE1TMHdNbFF3T0RvMU5Ub3dPQzB3Ck56b3dNSWl4dXBvQUFBQWxkRVZZZEdSaGRHVTZiVzlrYVdaNUFESXdNVFl0TVRFdE1ESlVNRGc2TlRVNk1EZ3RNRGM2TURENTdBSW0KQUFBQUFFbEZUa1N1UW1DQyIgLz4KPC9zdmc+Cg==',
|
164 |
+
11
|
165 |
+
);
|
166 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Library', 'grand-media' ), __( 'Gmedia Library', 'grand-media' ), 'gmedia_library', 'GrandMedia', array( &$this, 'shell' ) );
|
167 |
if ( current_user_can( 'gmedia_library' ) ) {
|
168 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Add Media Files', 'grand-media' ), __( 'Add/Import Files', 'grand-media' ), 'gmedia_upload', 'GrandMedia_AddMedia', array( &$this, 'shell' ) );
|
169 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Tags', 'grand-media' ), __( 'Tags', 'grand-media' ), 'gmedia_tag_manage', 'GrandMedia_Tags', array( &$this, 'shell' ) );
|
170 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Categories', 'grand-media' ), __( 'Categories', 'grand-media' ), 'gmedia_category_manage', 'GrandMedia_Categories', array( &$this, 'shell' ) );
|
171 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Albums', 'grand-media' ), __( 'Albums', 'grand-media' ), 'gmedia_album_manage', 'GrandMedia_Albums', array( &$this, 'shell' ) );
|
172 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Galleries', 'grand-media' ), __( 'Galleries', 'grand-media' ), 'gmedia_gallery_manage', 'GrandMedia_Galleries', array( &$this, 'shell' ) );
|
173 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Modules', 'grand-media' ), __( 'Modules', 'grand-media' ), 'gmedia_gallery_manage', 'GrandMedia_Modules', array( &$this, 'shell' ) );
|
174 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Settings', 'grand-media' ), __( 'Settings', 'grand-media' ), 'manage_options', 'GrandMedia_Settings', array( &$this, 'shell' ) );
|
175 |
//$this->pages[] = add_submenu_page( 'GrandMedia', __( 'iOS Application', 'grand-media' ), __( 'iOS Application', 'grand-media' ), 'gmedia_settings', 'GrandMedia_App', array( &$this, 'shell' ) );
|
176 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'WordPress Media Library', 'grand-media' ), __( 'WP Media Library', 'grand-media' ), 'gmedia_import', 'GrandMedia_WordpressLibrary', array( &$this, 'shell' ) );
|
177 |
+
$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Logs', 'grand-media' ), __( 'Gmedia Logs', 'grand-media' ), 'manage_options', 'GrandMedia_Logs', array( &$this, 'shell' ) );
|
178 |
//$this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Support', 'grand-media' ), __( 'Support', 'grand-media' ), 'manage_options', 'GrandMedia_Support', array( &$this, 'shell' ) );
|
179 |
}
|
180 |
|
181 |
foreach ( $this->pages as $page ) {
|
182 |
+
add_action( "load-$page", array( &$this, 'screen_help' ) );
|
183 |
}
|
184 |
}
|
185 |
|
187 |
* Load the script for the defined page and load only this code
|
188 |
* Display shell of plugin
|
189 |
*/
|
190 |
+
public function shell() {
|
191 |
+
global $gmCore, $gmProcessor, $gmGallery, $gm_allowed_tags;
|
192 |
|
193 |
$sideLinks = $this->sideLinks();
|
194 |
|
195 |
+
// check for upgrade.
|
196 |
if ( get_option( 'gmediaDbVersion' ) !== GMEDIA_DBVERSION ) {
|
197 |
+
if ( get_transient( 'gmediaUpgrade' ) || ( 'gmedia' === $gmCore->_get( 'do_update' ) ) ) {
|
198 |
$sideLinks['grandTitle'] = __( 'Updating GmediaGallery Plugin', 'grand-media' );
|
199 |
$sideLinks['sideLinks'] = '';
|
200 |
$gmProcessor->page = 'GrandMedia_Update';
|
203 |
}
|
204 |
}
|
205 |
|
206 |
+
//global $wpdb;
|
207 |
+
//$query = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}gmedia_term");
|
208 |
+
//foreach($query as $item){
|
209 |
+
// $name = $gmCore->mb_convert_encoding_utf8($item->name);
|
210 |
+
// $wpdb->update($wpdb->prefix . 'gmedia_term', array('name' => $name), array('term_id' => $item->term_id));
|
211 |
+
//}
|
212 |
+
//echo '<pre>' . print_r($query, true) . '</pre>';
|
213 |
|
214 |
?>
|
215 |
<div id="gmedia-container" class="gmedia-admin">
|
216 |
<?php
|
217 |
+
if ( 'GrandMedia_App' !== $gmProcessor->page && ! isset( $gmGallery->options['gmedia_service'] ) && current_user_can( 'manage_options' ) ) {
|
218 |
$this->collect_data_permission();
|
219 |
}
|
220 |
?>
|
226 |
<?php
|
227 |
if ( ! is_plugin_active( 'woowgallery/woowgallery.php' ) && empty( $gmGallery->options['disable_ads'] ) ) {
|
228 |
?>
|
229 |
+
<div class="promote-woowbox"><a href="https://bit.ly/gm-woowgallery" target="_blank"><img src="<?php echo esc_url( plugins_url( 'assets/img/woowbox-promote.png', __FILE__ ) ); ?>" alt="Try WoowGallery plugin"/></a></div>
|
230 |
<?php
|
231 |
}
|
232 |
?>
|
233 |
</div>
|
234 |
<div class="container-fluid">
|
235 |
<div class="row row-fx180-fl">
|
236 |
+
<div class="col-sm-2 p-0 hidden-xs" id="sidebar" role="navigation">
|
237 |
+
<?php echo wp_kses( $sideLinks['sideLinks'], $gm_allowed_tags ); ?>
|
238 |
|
239 |
<?php
|
240 |
if ( (int) $gmGallery->options['feedback'] ) {
|
241 |
$installDate = get_option( 'gmediaInstallDate' );
|
242 |
+
if ( $installDate && ( strtotime( $installDate ) < strtotime( '2 weeks ago' ) ) ) {
|
243 |
+
?>
|
244 |
+
<div class="card p-0 d-none d-xl-block d-sm-none">
|
245 |
+
<div class="card-header" data-bs-toggle="collapse" data-bs-target="#support_div_collapse" aria-expanded="true" aria-controls="support_div_collapse" style="cursor:pointer;">
|
246 |
+
<b><?php esc_html_e( 'Any feedback?', 'grand-media' ); ?></b>
|
247 |
</div>
|
248 |
+
<div class="collapse<?php echo empty( $gmGallery->options['license_key'] ) ? ' in' : ''; ?>" id="support_div_collapse">
|
249 |
+
<div class="card-body">
|
250 |
+
<p><?php esc_html_e( 'You can help me spread the word about GmediaGallery among the users striving to get awesome galleries on their WordPress sites.', 'grand-media' ); ?></p>
|
|
|
|
|
251 |
|
252 |
<p>
|
253 |
+
<a class="btn btn-primary" href="https://wordpress.org/support/view/plugin-reviews/grand-media?filter=5" target="_blank"><?php esc_html_e( 'Rate Gmedia Gallery', 'grand-media' ); ?></a>
|
254 |
</p>
|
255 |
|
256 |
+
<p><?php esc_html_e( 'Your reviews and ideas helps me to create new awesome modules and to improve plugin.', 'grand-media' ); ?></p>
|
257 |
</div>
|
258 |
</div>
|
259 |
</div>
|
260 |
+
<?php
|
261 |
+
}
|
262 |
}
|
263 |
if ( (int) $gmGallery->options['twitter'] ) {
|
264 |
?>
|
265 |
+
<div class="card p-0 d-none d-xl-block d-sm-none">
|
266 |
<a class="twitter-timeline" data-height="600" href="https://twitter.com/CodEasily/timelines/648240437141086212?ref_src=twsrc%5Etfw">#GmediaGallery - Curated tweets by CodEasily</a>
|
267 |
+
<script <?php echo 'async src="https://platform.twitter.com/widgets.js" charset="utf-8"'; ?>></script>
|
268 |
</div>
|
269 |
<?php
|
270 |
+
}
|
271 |
+
?>
|
272 |
</div>
|
273 |
<div class="col-sm-10 col-xs-12">
|
274 |
+
<div id="gm-message">
|
275 |
+
<?php
|
276 |
+
echo wp_kses( $gmCore->alert( 'success', $gmProcessor->msg ), $gm_allowed_tags );
|
277 |
+
echo wp_kses( $gmCore->alert( 'danger', $gmProcessor->error ), $gm_allowed_tags );
|
278 |
+
?>
|
279 |
+
</div>
|
280 |
|
281 |
<?php $this->controller(); ?>
|
282 |
|
287 |
<?php
|
288 |
}
|
289 |
|
290 |
+
public function sideLinks() {
|
291 |
global $submenu, $gmProcessor, $gmGallery;
|
292 |
$content['sideLinks'] = '
|
293 |
<div id="gmedia-navbar">
|
294 |
<div class="row">
|
295 |
+
<ul>';
|
296 |
if ( empty( $gmGallery->options['license_key'] ) ) {
|
297 |
+
$content['sideLinks'] .= "\n" . '<li class="list-group mb-3"><a class="list-group-item list-group-item-premium" target="_blank" href="https://codeasily.com/product/one-site-license/">' . esc_html__( 'Get Gmedia Premium', 'grand-media' ) . '</a></li>';
|
298 |
}
|
299 |
+
$content['sideLinks'] .= "\n" . '<li class="list-group">';
|
300 |
+
foreach ( $submenu['GrandMedia'] as $menuItem ) {
|
301 |
if ( $menuItem[2] === $gmProcessor->page ) {
|
302 |
$iscur = ' active';
|
303 |
$content['grandTitle'] = $menuItem[3];
|
305 |
$iscur = '';
|
306 |
}
|
307 |
$menuData = '';
|
308 |
+
if ( 'GrandMedia_Modules' === $menuItem[2] && gm_user_can( 'module_manage' ) ) {
|
309 |
if ( ! empty( $gmGallery->options['notify_new_modules'] ) ) {
|
310 |
+
$menuData .= '<span class="badge badge-success float-end gm-module-count-' . intval( $gmGallery->options['modules_new'] ) . '" title="' . esc_attr__( 'New Modules', 'grand-media' ) . '">' . intval( $gmGallery->options['modules_new'] ) . '</span>';
|
311 |
}
|
312 |
+
$menuData .= '<span class="badge badge-error float-end gm-module-count-' . intval( $gmGallery->options['modules_update'] ) . '" title="' . esc_attr__( 'Modules Updates', 'grand-media' ) . '">' . intval( $gmGallery->options['modules_update'] ) . '</span>';
|
313 |
}
|
314 |
|
315 |
+
$content['sideLinks'] .= "\n" . '<a class="list-group-item list-group-item-action' . esc_attr( $iscur ) . '" href="' . esc_url( admin_url( 'admin.php?page=' . $menuItem[2] ) ) . '">' . wp_kses_post( $menuItem[0] . $menuData ) . '</a>';
|
316 |
}
|
317 |
+
$content['sideLinks'] .= "\n" . '<a class="list-group-item list-group-item-action" target="_blank" href="https://wordpress.org/support/plugin/grand-media/">' . esc_html__( 'Support', 'grand-media' ) . '</a>';
|
318 |
$content['sideLinks'] .= '
|
319 |
</li></ul>
|
320 |
</div>
|
323 |
return $content;
|
324 |
}
|
325 |
|
326 |
+
public function collect_data_permission() {
|
327 |
$current_user = wp_get_current_user();
|
328 |
$nonce = wp_create_nonce( 'GmediaService' );
|
329 |
?>
|
330 |
<div class="notice updated gm-message gmedia-service__message">
|
331 |
<div class="gm-message-content">
|
332 |
<div class="gm-plugin-icon">
|
333 |
+
<img src="<?php echo esc_url( plugins_url( 'assets/img/icon-128x128.png', __FILE__ ) ); ?>" width="90" height="90" alt="">
|
334 |
</div>
|
335 |
+
<?php
|
336 |
+
// translators: user name.
|
337 |
+
echo wp_kses_post( sprintf( __( '<p>Hey %s,<br>Please help us improve <b>Gmedia Gallery</b>! If you opt-in, some data about your usage of <b>Gmedia Gallery</b> will be sent to <a href="https://codeasily.com/" target="_blank" tabindex="1">codeasily.com</a>. If you skip this, that\'s okay! <b>Gmedia Gallery</b> will still work just fine.</p>', 'grand-media' ), esc_html( $current_user->display_name ) ) );
|
338 |
+
?>
|
339 |
</div>
|
340 |
<div class="gm-message-actions">
|
341 |
+
<button class="button button-secondary gm_service_action" data-action="skip" data-nonce="<?php echo esc_attr( $nonce ); ?>"><?php esc_html_e( 'Skip', 'grand-media' ); ?></button>
|
342 |
+
<button class="button button-primary gm_service_action" data-action="allow" data-nonce="<?php echo esc_attr( $nonce ); ?>"><?php esc_html_e( 'Allow & Continue', 'grand-media' ); ?></button>
|
343 |
</div>
|
344 |
<div class="gm-message-plus gm-closed">
|
345 |
+
<a class="gm-mp-trigger" href="#" onclick="jQuery('.gm-message-plus').toggleClass('gm-closed gm-opened'); return false;"><?php esc_html_e( 'What permissions are being granted?', 'grand-media' ); ?></a>
|
346 |
<ul>
|
347 |
<li>
|
348 |
<i class="dashicons dashicons-admin-users"></i>
|
349 |
|
350 |
<div>
|
351 |
+
<span><?php esc_html_e( 'Your Profile Overview', 'grand-media' ); ?></span>
|
352 |
|
353 |
+
<p><?php esc_html_e( 'Name and email address', 'grand-media' ); ?></p>
|
354 |
</div>
|
355 |
</li>
|
356 |
<li>
|
357 |
<i class="dashicons dashicons-admin-settings"></i>
|
358 |
|
359 |
<div>
|
360 |
+
<span><?php esc_html_e( 'Your Site Overview', 'grand-media' ); ?></span>
|
361 |
|
362 |
+
<p><?php esc_html_e( 'Site URL, WP version, PHP version, active theme & plugins', 'grand-media' ); ?></p>
|
363 |
</div>
|
364 |
</li>
|
365 |
</ul>
|
368 |
<?php
|
369 |
}
|
370 |
|
371 |
+
public function controller() {
|
372 |
|
373 |
global $gmProcessor;
|
374 |
switch ( $gmProcessor->page ) {
|
376 |
include_once dirname( __FILE__ ) . '/pages/addmedia/addmedia.php';
|
377 |
break;
|
378 |
case 'GrandMedia_Albums':
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
case 'GrandMedia_Categories':
|
380 |
if ( isset( $_GET['edit_term'] ) ) {
|
381 |
include_once dirname( __FILE__ ) . '/pages/terms/edit-term.php';
|
426 |
include_once dirname( __FILE__ ) . '/pages/library/library.php';
|
427 |
break;
|
428 |
default:
|
429 |
+
do_action( 'gmedia_admin_page__' . $gmProcessor->page );
|
430 |
break;
|
431 |
}
|
432 |
}
|
433 |
|
434 |
+
public function admin_footer() {
|
435 |
$ajax_operations = get_option( 'gmedia_ajax_long_operations' );
|
436 |
if ( empty( $ajax_operations ) || ! is_array( $ajax_operations ) ) {
|
437 |
return;
|
446 |
$nonce = wp_create_nonce( 'gmedia_ajax_long_operations' );
|
447 |
?>
|
448 |
<script type="text/javascript">
|
449 |
+
jQuery(document).ready(function($) {
|
450 |
+
var header = $('#gmedia-header');
|
451 |
+
header.append('<div id="ajax-long-operation"><div class="progress"><div class="progress-bar progress-bar-info" style="width: 0%;"></div><div class="progress-bar-indicator">0%</div></div></div>');
|
452 |
+
var gmAjaxLongOperation = function() {
|
453 |
+
jQuery.post(ajaxurl, {action: '<?php echo esc_url( $ajax ); ?>', _wpnonce_ajax_long_operations: '<?php echo esc_attr( $nonce ); ?>'}, function(r) {
|
454 |
+
if (r.data) {
|
455 |
+
jQuery('.progress-bar-info', header).width(r.data.progress);
|
456 |
+
var indicator = r.data.info ? r.data.info + ' ' + r.data.progress : r.data.progress;
|
457 |
+
jQuery('.progress-bar-indicator', header).html(indicator);
|
458 |
+
|
459 |
+
if (r.data.done) {
|
460 |
+
return;
|
461 |
+
}
|
462 |
+
}
|
463 |
+
gmAjaxLongOperation();
|
464 |
+
});
|
465 |
+
};
|
466 |
gmAjaxLongOperation();
|
467 |
});
|
|
|
|
|
|
|
468 |
</script>
|
469 |
<?php
|
470 |
}
|
471 |
|
472 |
/**
|
473 |
+
* @param string $hook
|
474 |
*/
|
475 |
+
public function load_scripts( $hook ) {
|
476 |
global $gmCore, $gmProcessor, $gmGallery;
|
477 |
+
// no need to go on if it's not a plugin page.
|
478 |
if ( 'admin.php' !== $hook && strpos( $gmCore->_get( 'page' ), 'GrandMedia' ) === false ) {
|
479 |
return;
|
480 |
}
|
502 |
wp_enqueue_style( 'gmedia-bootstrap' );
|
503 |
wp_enqueue_script( 'gmedia-bootstrap' );
|
504 |
|
505 |
+
wp_register_style( 'selectize', $gmCore->gmedia_url . '/assets/selectize/selectize.bootstrap5.css', array( 'gmedia-bootstrap' ), '0.13.5', 'screen' );
|
506 |
+
wp_register_script( 'selectize', $gmCore->gmedia_url . '/assets/selectize/selectize.min.js', array( 'jquery' ), '0.13.5', true );
|
507 |
|
508 |
+
wp_register_style( 'spectrum', $gmCore->gmedia_url . '/assets/spectrum/spectrum.min.css', array(), '1.8.0' );
|
509 |
+
wp_register_script( 'spectrum', $gmCore->gmedia_url . '/assets/spectrum/spectrum.min.js', array( 'jquery' ), '1.8.0', true );
|
510 |
|
511 |
+
$page = $gmCore->_get( 'page' );
|
512 |
+
if ( $page ) {
|
513 |
+
switch ( $page ) {
|
514 |
+
case 'GrandMedia':
|
515 |
if ( $gmCore->caps['gmedia_edit_media'] ) {
|
516 |
if ( $gmCore->_get( 'gmediablank' ) === 'image_editor' ) {
|
517 |
+
wp_enqueue_script( 'camanjs', $gmCore->gmedia_url . '/assets/image-editor/camanjs/caman.full.min.js', array(), '4.1.2', true );
|
518 |
|
519 |
+
wp_enqueue_style( 'nouislider', $gmCore->gmedia_url . '/assets/image-editor/js/jquery.nouislider.css', array( 'gmedia-bootstrap' ), '6.1.0' );
|
520 |
+
wp_enqueue_script( 'nouislider', $gmCore->gmedia_url . '/assets/image-editor/js/jquery.nouislider.min.js', array( 'jquery' ), '6.1.0', true );
|
521 |
|
522 |
+
wp_enqueue_style( 'gmedia-image-editor', $gmCore->gmedia_url . '/assets/image-editor/style.css', array( 'gmedia-bootstrap' ), '0.9.16', 'screen' );
|
523 |
+
wp_enqueue_script( 'gmedia-image-editor', $gmCore->gmedia_url . '/assets/image-editor/image-editor.js', array( 'jquery', 'camanjs' ), '0.9.16', true );
|
524 |
break;
|
525 |
}
|
526 |
+
if ( 'edit' === $gmProcessor->mode ) {
|
527 |
+
wp_enqueue_script( 'alphanum', $gmCore->gmedia_url . '/assets/jq-plugins/jquery.alphanum.js', array( 'jquery' ), '1.0.16', true );
|
528 |
|
529 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
530 |
|
531 |
+
wp_enqueue_script( 'popper', $gmCore->gmedia_url . '/assets/popper/popper.min.js', array(), '2.11.2', true );
|
532 |
+
wp_enqueue_style( 'tempus-dominus', $gmCore->gmedia_url . '/assets/tempus-dominus/css/tempus-dominus.min.css', array( 'gmedia-bootstrap' ), '6.0.0' );
|
533 |
+
wp_enqueue_script( 'tempus-dominus', $gmCore->gmedia_url . '/assets/tempus-dominus/js/tempus-dominus.js', array( 'popper', 'gmedia-bootstrap' ), '6.0.0', true );
|
534 |
+
wp_enqueue_script( 'moment' );
|
|
|
|
|
|
|
535 |
}
|
536 |
}
|
537 |
+
wp_enqueue_script( 'wavesurfer', $gmCore->gmedia_url . '/assets/wavesurfer/wavesurfer.min.js', array( 'jquery' ), '1.1.5', true );
|
538 |
break;
|
539 |
+
case 'GrandMedia_WordpressLibrary':
|
540 |
break;
|
541 |
+
case 'GrandMedia_Albums':
|
542 |
if ( isset( $_GET['edit_term'] ) ) {
|
543 |
if ( $gmCore->caps['gmedia_album_manage'] ) {
|
544 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
|
|
545 |
}
|
546 |
|
547 |
+
wp_enqueue_script( 'popper', $gmCore->gmedia_url . '/assets/popper/popper.min.js', array(), '2.11.2', true );
|
548 |
+
wp_enqueue_style( 'tempus-dominus', $gmCore->gmedia_url . '/assets/tempus-dominus/css/tempus-dominus.min.css', array( 'gmedia-bootstrap' ), '6.0.0' );
|
549 |
+
wp_enqueue_script( 'tempus-dominus', $gmCore->gmedia_url . '/assets/tempus-dominus/js/tempus-dominus.min.js', array( 'popper', 'gmedia-bootstrap' ), '6.0.0', true );
|
550 |
+
wp_enqueue_script( 'tempus-dominus-jq', $gmCore->gmedia_url . '/assets/tempus-dominus/js/jQuery-provider.min.js', array( 'tempus-dominus', 'jquery' ), '6.0.0', true );
|
551 |
+
wp_enqueue_script( 'moment' );
|
|
|
|
|
552 |
}
|
553 |
break;
|
554 |
+
case 'GrandMedia_Categories':
|
555 |
break;
|
556 |
+
case 'GrandMedia_AddMedia':
|
557 |
if ( $gmCore->caps['gmedia_upload'] ) {
|
558 |
$tab = $gmCore->_get( 'tab', 'upload' );
|
559 |
+
if ( 'upload' === $tab ) {
|
560 |
+
wp_enqueue_style( 'jquery.plupload.queue', $gmCore->gmedia_url . '/assets/jquery.plupload.queue/css/jquery.plupload.queue.css', array(), '2.3.9', 'screen' );
|
561 |
+
wp_enqueue_script( 'jquery.plupload.queue', $gmCore->gmedia_url . '/assets/jquery.plupload.queue/jquery.plupload.queue.js', array( 'plupload' ), '2.3.9', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
}
|
563 |
}
|
564 |
+
if ( ! empty( $_GET['import'] ) ) {
|
565 |
+
wp_enqueue_style( 'jqueryFileTree', $gmCore->gmedia_url . '/assets/jqueryFileTree/jqueryFileTree.css', array(), '1.0.1', 'screen' );
|
566 |
+
wp_enqueue_script(
|
567 |
+
'jqueryFileTree',
|
568 |
+
$gmCore->gmedia_url . '/assets/jqueryFileTree/jqueryFileTree.js',
|
569 |
+
array(
|
570 |
+
'jquery',
|
571 |
+
),
|
572 |
+
'1.0.1',
|
573 |
+
true
|
574 |
+
);
|
575 |
+
}
|
576 |
break;
|
577 |
+
case 'GrandMedia_Settings':
|
578 |
+
case 'GrandMedia_App':
|
579 |
+
// under construction.
|
580 |
break;
|
581 |
+
case 'GrandMedia_Galleries':
|
582 |
if ( $gmCore->caps['gmedia_gallery_manage'] && ( isset( $_GET['gallery_module'] ) || isset( $_GET['edit_term'] ) ) ) {
|
583 |
|
|
|
|
|
|
|
584 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
585 |
|
586 |
+
wp_enqueue_style( 'jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.css', array( 'gmedia-bootstrap' ), '0.9.13' );
|
587 |
+
wp_enqueue_script( 'jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.js', array( 'jquery' ), '0.9.13', true );
|
588 |
|
589 |
wp_enqueue_style( 'spectrum' );
|
590 |
wp_enqueue_script( 'spectrum' );
|
591 |
}
|
592 |
break;
|
593 |
+
case 'GrandMedia_Modules':
|
594 |
if ( isset( $_GET['preset_module'] ) || isset( $_GET['preset'] ) ) {
|
595 |
|
|
|
|
|
|
|
596 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
597 |
|
598 |
+
wp_enqueue_style( 'jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.css', array( 'gmedia-bootstrap' ), '0.9.13' );
|
599 |
+
wp_enqueue_script( 'jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.js', array( 'jquery' ), '0.9.13', true );
|
600 |
|
601 |
wp_enqueue_style( 'spectrum' );
|
602 |
wp_enqueue_script( 'spectrum' );
|
612 |
|
613 |
}
|
614 |
|
615 |
+
public function gmedia_widget_scripts() {}
|
|
|
|
|
616 |
|
617 |
/**
|
618 |
* Enqueue the block's assets for the gutenberg editor.
|
619 |
*/
|
620 |
+
public function gutenberg_assets() {
|
621 |
global $gmGallery, $gmDB, $gmCore;
|
622 |
|
623 |
+
wp_enqueue_style( 'gmedia-block-editor', $gmCore->gmedia_url . '/admin/assets/css/gmedia-block.css', array(), $gmGallery->version );
|
624 |
wp_register_script(
|
625 |
'gmedia-block-editor',
|
626 |
$gmCore->gmedia_url . '/admin/assets/js/gmedia-block.js',
|
627 |
+
array( 'wp-blocks', 'wp-element' ),
|
628 |
+
$gmGallery->version,
|
629 |
+
true
|
630 |
);
|
631 |
|
632 |
$default_module = $gmGallery->options['default_gmedia_module'];
|
634 |
$default_module = $default_preset['module'];
|
635 |
|
636 |
$modules_data = get_gmedia_modules( false );
|
637 |
+
$modules = array();
|
638 |
+
$modules_options = array();
|
639 |
if ( ! empty( $modules_data['in'] ) ) {
|
640 |
foreach ( $modules_data['in'] as $module_name => $module_data ) {
|
641 |
|
642 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $module_name ) );
|
643 |
+
$option = array();
|
644 |
+
$option[ $module_name ] = esc_html( $module_data['title'] . ' - ' . __( 'Default Settings' ) );
|
645 |
foreach ( $presets as $preset ) {
|
646 |
if ( ! (int) $preset->global && '[' . $module_name . ']' === $preset->name ) {
|
647 |
continue;
|
652 |
$by_author = $display_name ? ' [' . $display_name . ']' : '';
|
653 |
}
|
654 |
if ( '[' . $module_name . ']' === $preset->name ) {
|
655 |
+
$option[ $preset->term_id ] = esc_html( $module_data['title'] . $by_author . ' - ' . __( 'Default Settings' ) );
|
656 |
} else {
|
657 |
$preset_name = str_replace( '[' . $module_name . '] ', '', $preset->name );
|
658 |
+
$option[ $preset->term_id ] = esc_html( $module_data['title'] . $by_author . ' - ' . $preset_name );
|
659 |
}
|
660 |
}
|
661 |
+
$modules_options[ $module_name ] = array( 'title' => esc_html( $module_data['title'] ), 'options' => $option );
|
662 |
|
663 |
+
$modules[ $module_name ] = array(
|
664 |
+
'name' => esc_html( $module_data['title'] ),
|
665 |
+
'screenshot' => esc_url( $module_data['module_url'] . '/screenshot.png' ),
|
666 |
+
);
|
667 |
}
|
668 |
}
|
669 |
|
670 |
+
$gm_galleries = array();
|
671 |
+
$gm_albums = array();
|
672 |
+
$gm_categories = array();
|
673 |
+
$gm_tags = array();
|
674 |
|
675 |
$gm_terms = $gmDB->get_terms( 'gmedia_gallery' );
|
676 |
if ( count( $gm_terms ) ) {
|
677 |
foreach ( $gm_terms as $_term ) {
|
678 |
unset( $_term->description );
|
679 |
unset( $_term->taxonomy );
|
680 |
+
$_term->module_name = esc_html( $gmDB->get_metadata( 'gmedia_term', $_term->term_id, '_module', true ) );
|
681 |
if ( $_term->global ) {
|
682 |
+
$display_name = get_the_author_meta( 'display_name', $_term->global );
|
683 |
+
// translators: author name.
|
684 |
+
$_term->name .= empty( $display_name ) ? '' : ' ' . sprintf( esc_html__( 'by %s', 'grand-media' ), esc_html( $display_name ) );
|
685 |
}
|
686 |
if ( $_term->status && 'publish' !== $_term->status ) {
|
687 |
+
$_term->name .= esc_html( " [{$_term->status}]" );
|
688 |
}
|
689 |
$gm_galleries[ $_term->term_id ] = $_term;
|
690 |
}
|
691 |
}
|
692 |
+
$gm_galleries = array( 0 => array( 'term_id' => 0, 'name' => esc_html__( ' - select gallery - ', 'grand-media' ) ) ) + $gm_galleries;
|
|
|
|
|
|
|
|
|
|
|
693 |
|
694 |
$gm_terms = $gmDB->get_terms( 'gmedia_album' );
|
695 |
if ( count( $gm_terms ) ) {
|
696 |
foreach ( $gm_terms as $_term ) {
|
697 |
unset( $_term->description );
|
698 |
unset( $_term->taxonomy );
|
699 |
+
$module_preset = esc_html( $gmDB->get_metadata( 'gmedia_term', $_term->term_id, '_module_preset', true ) );
|
700 |
if ( $module_preset ) {
|
701 |
$preset = $gmCore->getModulePreset( $module_preset );
|
702 |
+
$_term->module_name = esc_html( $preset['module'] );
|
703 |
} else {
|
704 |
$_term->module_name = '';
|
705 |
}
|
706 |
if ( $_term->global ) {
|
707 |
+
$display_name = get_the_author_meta( 'display_name', $_term->global );
|
708 |
+
// translators: author name.
|
709 |
+
$_term->name .= empty( $display_name ) ? '' : ' ' . sprintf( esc_html__( 'by %s', 'grand-media' ), esc_html( $display_name ) );
|
710 |
}
|
711 |
if ( $_term->status && 'publish' !== $_term->status ) {
|
712 |
+
$_term->name .= esc_html( " [{$_term->status}]" );
|
713 |
}
|
714 |
+
$_term->name .= esc_html( " ({$_term->count})" );
|
715 |
+
|
716 |
$gm_albums[ $_term->term_id ] = $_term;
|
717 |
}
|
718 |
}
|
719 |
+
$gm_albums = array( 0 => array( 'term_id' => 0, 'name' => esc_html__( ' - select album - ', 'grand-media' ) ) ) + $gm_albums;
|
|
|
|
|
|
|
|
|
|
|
720 |
|
721 |
$gm_terms = $gmDB->get_terms( 'gmedia_category' );
|
722 |
if ( count( $gm_terms ) ) {
|
725 |
unset( $_term->taxonomy );
|
726 |
unset( $_term->global );
|
727 |
unset( $_term->status );
|
728 |
+
$_term->name .= esc_html( " ({$_term->count})" );
|
729 |
+
|
730 |
$gm_categories[ $_term->term_id ] = $_term;
|
731 |
}
|
732 |
}
|
733 |
+
$gm_categories = array( 0 => array( 'term_id' => 0, 'name' => esc_html__( ' - select category - ', 'grand-media' ) ) ) + $gm_categories;
|
|
|
|
|
|
|
|
|
|
|
734 |
|
735 |
$gm_terms = $gmDB->get_terms( 'gmedia_tag' );
|
736 |
if ( count( $gm_terms ) ) {
|
739 |
unset( $_term->taxonomy );
|
740 |
unset( $_term->global );
|
741 |
unset( $_term->status );
|
742 |
+
$_term->name .= esc_html( " ({$_term->count})" );
|
743 |
+
|
744 |
$gm_tags[ $_term->term_id ] = $_term;
|
745 |
}
|
746 |
}
|
747 |
+
$gm_tags = array( 0 => array( 'term_id' => 0, 'name' => esc_html__( ' - select tag - ', 'grand-media' ) ) ) + $gm_tags;
|
748 |
+
|
749 |
+
$data = array(
|
|
|
|
|
|
|
|
|
|
|
750 |
'modules' => $modules,
|
751 |
'default_module' => $default_module,
|
752 |
'modules_options' => $modules_options,
|
755 |
'albums' => $gm_albums,
|
756 |
'categories' => $gm_categories,
|
757 |
'tags' => $gm_tags,
|
758 |
+
);
|
759 |
|
760 |
wp_localize_script( 'gmedia-block-editor', 'gmedia_data', $data );
|
761 |
wp_enqueue_script( 'gmedia-block-editor' );
|
762 |
}
|
763 |
|
764 |
+
public function screen_help() {
|
765 |
$screen = get_current_screen();
|
766 |
$screen_id = explode( 'page_', $screen->id, 2 );
|
767 |
$screen_id = $screen_id[1];
|
768 |
|
769 |
+
$screen->add_help_tab(
|
770 |
+
array(
|
771 |
+
'id' => 'help_' . $screen_id . '_support',
|
772 |
+
'title' => __( 'Support' ),
|
773 |
+
'content' =>
|
774 |
+
__(
|
775 |
+
'<h4>First steps</h4>
|
776 |
<p>If you have any problems with displaying Gmedia Gallery in admin or on website. Before posting to the Forum try next:</p>
|
777 |
<ul>
|
778 |
+
<li>Exclude plugin conflicts: Disable other plugins one by one and check if it resolves problem</li>
|
779 |
<li>Exclude theme conflict: Temporary switch to one of default themes and check if gallery works</li>
|
780 |
</ul>
|
781 |
+
<h4>Links</h4>',
|
782 |
+
'grand-media'
|
783 |
+
)
|
784 |
+
. '<p><a href="https://codeasily.com/community/forum/gmedia-gallery-wordpress-plugin/" target="_blank">' . esc_html__( 'Support Forum', 'grand-media' ) . '</a>
|
785 |
+
| <a href="https://codeasily.com/contact/" target="_blank">' . esc_html__( 'Contact', 'grand-media' ) . '</a>
|
786 |
+
| <a href="https://codeasily.com/portfolio/gmedia-gallery-modules/" target="_blank">' . esc_html__( 'Demo', 'grand-media' ) . '</a>
|
787 |
+
| <a href="https://codeasily.com/product/one-site-license/" target="_blank">' . esc_html__( 'Premium', 'grand-media' ) . '</a>
|
788 |
</p>',
|
789 |
+
)
|
790 |
+
);
|
791 |
|
792 |
switch ( $screen_id ) {
|
793 |
+
case 'GrandMedia':
|
794 |
break;
|
795 |
+
case 'GrandMedia_Settings':
|
796 |
if ( current_user_can( 'manage_options' ) ) {
|
797 |
+
$screen->add_help_tab(
|
798 |
+
array(
|
799 |
+
'id' => 'help_' . $screen_id . '_license',
|
800 |
+
'title' => __( 'License Key' ),
|
801 |
+
'content' =>
|
802 |
+
sprintf(
|
803 |
+
__(
|
804 |
+
'<h4>Should I buy it, to use plugin?</h4>
|
805 |
<p>No, plugin is absolutely free and all modules for it are free to install.</p>
|
806 |
<p>Even premium modules are fully functional and free to test, but have backlink labels. To remove baclink labels from premium modules you need license key.</p>
|
807 |
<p>Note: License Key will remove backlinks from all current and future premium modules, so you can use all available modules on one website.</p>
|
808 |
+
<p>Do not purchase license key before testing module you like. Only if everything works fine, and you satisfied with functionality you are good to purchase license. Otherwise use <a href="%1$s" target="_blank">Gmedia Support Forum</a>.</p>
|
809 |
+
<h4>I have license key, but I can\'t activate it</h4>
|
810 |
+
<p>Contact developer <a href="mailto:%2$s">%2$s</a> with your problem and wait for additional instructions and code for manual activation</p>',
|
811 |
+
'grand-media'
|
812 |
+
),
|
813 |
+
'https://wordpress.org/support/plugin/grand-media/',
|
814 |
+
'gmediafolder@gmail.com'
|
815 |
+
)
|
816 |
+
. '<div><a class="btn btn-secondary" href="' . admin_url( 'admin.php?page=' . $screen_id . '&license_activate=manual' ) . '">' . __( 'Manual Activation', 'grand-media' ) . '</a></div>',
|
817 |
+
)
|
818 |
+
);
|
819 |
}
|
820 |
break;
|
821 |
+
case 'GrandMedia_App':
|
822 |
$gm_options = get_option( 'gmediaOptions' );
|
823 |
$nonce = wp_create_nonce( 'GmediaService' );
|
824 |
if ( current_user_can( 'manage_options' ) && (int) $gm_options['mobile_app'] ) {
|
825 |
+
$screen->add_help_tab(
|
826 |
+
array(
|
827 |
+
'id' => 'help_' . $screen_id . '_optout',
|
828 |
+
'title' => __( 'Opt Out', 'grand-media' ),
|
829 |
+
'content' =>
|
830 |
+
__(
|
831 |
+
'<h4>We appreciate your help in making the plugin better by letting us track some usage data.</h4>
|
832 |
<p>Usage tracking is done in the name of making <strong>Gmedia Gallery</strong> better. Making a better user experience, prioritizing new features, and more good things.</p>
|
833 |
+
<p>By clicking "Opt Out", we will no longer be sending any data from <strong>Gmedia Gallery</strong> to <a href="https://codeasily.com" target="_blank">codeasily.com</a>.</p>',
|
834 |
+
'grand-media'
|
835 |
+
)
|
836 |
+
. '<p><button class="button button-default gm_service_action" data-action="app_deactivate" data-nonce="' . esc_attr( $nonce ) . '">' . esc_html__( 'Opt Out', 'grand-media' ) . '</button><span class="spinner" style="float: none;"></span></p>'
|
837 |
+
. '<div style="display:none;">Test:
|
838 |
+
<button type="button" data-action="app_updateinfo" data-nonce="' . esc_attr( $nonce ) . '" class="btn btn-sm btn-primary gm_service_action">Update</button>
|
839 |
+
<button type="button" data-action="app_updatecron" data-nonce="' . esc_attr( $nonce ) . '" class="btn btn-sm btn-primary gm_service_action">CronJob</button>
|
840 |
+
<button type="button" data-action="app_deactivateplugin" data-nonce="' . esc_attr( $nonce ) . '" class="btn btn-sm btn-primary gm_service_action">Deactivate Plugin</button>
|
841 |
+
<button type="button" data-action="app_uninstallplugin" data-nonce="' . esc_attr( $nonce ) . '" class="btn btn-sm btn-primary gm_service_action">Uninstall Plugin</button>
|
842 |
</div>
|
843 |
',
|
844 |
+
)
|
845 |
+
);
|
846 |
}
|
847 |
break;
|
848 |
}
|
849 |
}
|
850 |
|
851 |
/**
|
852 |
+
* @param string $current
|
853 |
+
* @param object $screen
|
854 |
*
|
855 |
* @return string
|
856 |
*/
|
857 |
+
public function screen_settings( $current, $screen ) {
|
858 |
global $gmProcessor, $gmCore;
|
859 |
if ( in_array( $screen->id, $this->pages, true ) ) {
|
860 |
|
861 |
$gm_screen_options = $gmProcessor->user_options;
|
862 |
|
863 |
+
$title = '<h5><strong>' . esc_html__( 'Settings', 'grand-media' ) . '</strong></h5>';
|
864 |
+
$wp_screen_options = '<input type="hidden" name="wp_screen_options[option]" value="gm_screen_options" /><input type="hidden" name="wp_screen_options[value]" value="' . esc_attr( $screen->id ) . '" />';
|
865 |
+
$button = get_submit_button( esc_html__( 'Apply', 'grand-media' ), 'button', 'screen-options-apply', false );
|
866 |
|
867 |
$settings = false;
|
868 |
|
869 |
$screen_id = explode( 'page_', $screen->id, 2 );
|
870 |
|
871 |
switch ( $screen_id[1] ) {
|
872 |
+
case 'GrandMedia':
|
873 |
$settings = '
|
874 |
+
<div class="form-inline float-start row row-cols-auto">
|
875 |
<div class="form-group">
|
876 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_gmedia'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
877 |
</div>
|
878 |
<div class="form-group">
|
879 |
+
<select name="gm_screen_options[orderby_gmedia]" class="form-control input-xs d-inline w-auto pe-4">
|
880 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'ID', false ) . ' value="ID">' . esc_html__( 'ID', 'grand-media' ) . '</option>
|
881 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'title', false ) . ' value="title">' . esc_html__( 'Title', 'grand-media' ) . '</option>
|
882 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'gmuid', false ) . ' value="gmuid">' . esc_html__( 'Filename', 'grand-media' ) . '</option>
|
883 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'mime_type', false ) . ' value="mime_type">' . esc_html__( 'MIME Type', 'grand-media' ) . '</option>
|
884 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'author', false ) . ' value="author">' . esc_html__( 'Author', 'grand-media' ) . '</option>
|
885 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'date', false ) . ' value="date">' . esc_html__( 'Date', 'grand-media' ) . '</option>
|
886 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'modified', false ) . ' value="modified">' . esc_html__( 'Last Modified', 'grand-media' ) . '</option>
|
887 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], '_created_timestamp', false ) . ' value="_created_timestamp">' . esc_html__( 'Created Timestamp', 'grand-media' ) . '</option>
|
888 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'comment_count', false ) . ' value="comment_count">' . esc_html__( 'Comment Count', 'grand-media' ) . '</option>
|
889 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'views', false ) . ' value="views">' . esc_html__( 'Views Count', 'grand-media' ) . '</option>
|
890 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], 'likes', false ) . ' value="likes">' . esc_html__( 'Likes Count', 'grand-media' ) . '</option>
|
891 |
+
<option' . selected( $gm_screen_options['orderby_gmedia'], '_size', false ) . ' value="_size">' . esc_html__( 'File Size', 'grand-media' ) . '</option>
|
892 |
+
</select> <span>' . esc_html__( 'order items', 'grand-media' ) . '</span>
|
893 |
</div>
|
894 |
<div class="form-group">
|
895 |
+
<select name="gm_screen_options[sortorder_gmedia]" class="form-control input-xs d-inline w-auto pe-4">
|
896 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia'], 'DESC', false ) . ' value="DESC">' . esc_html__( 'DESC', 'grand-media' ) . '</option>
|
897 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia'], 'ASC', false ) . ' value="ASC">' . esc_html__( 'ASC', 'grand-media' ) . '</option>
|
898 |
+
</select> <span>' . esc_html__( 'sort order', 'grand-media' ) . '</span>
|
899 |
</div>
|
900 |
';
|
901 |
if ( 'edit' === $gmCore->_get( 'mode' ) ) {
|
902 |
$settings .= '
|
903 |
<div class="form-group">
|
904 |
+
<select name="gm_screen_options[library_edit_quicktags]" class="form-control input-xs d-inline w-auto pe-4">
|
905 |
+
<option' . selected( $gm_screen_options['library_edit_quicktags'], 'false', false ) . ' value="false">' . esc_html__( 'FALSE', 'grand-media' ) . '</option>
|
906 |
+
<option' . selected( $gm_screen_options['library_edit_quicktags'], 'true', false ) . ' value="true">' . esc_html__( 'TRUE', 'grand-media' ) . '</option>
|
907 |
+
</select> <span>' . esc_html__( 'Quick Tags panel for Description field', 'grand-media' ) . '</span>
|
908 |
</div>
|
909 |
';
|
910 |
}
|
912 |
</div>
|
913 |
';
|
914 |
break;
|
915 |
+
case 'GrandMedia_AddMedia':
|
916 |
$tab = $gmCore->_get( 'tab', 'upload' );
|
917 |
if ( 'upload' === $tab ) {
|
918 |
$html4_hide = ( 'html4' === $gm_screen_options['uploader_runtime'] ) ? ' hide' : '';
|
919 |
$settings = '
|
920 |
+
<div class="form-inline float-start row row-cols-auto">
|
921 |
+
<div id="uploader_runtime" class="form-group"><span>' . esc_html__( 'Uploader runtime:', 'grand-media' ) . ' </span>
|
922 |
+
<select name="gm_screen_options[uploader_runtime]" class="form-control input-xs d-inline w-auto pe-4">
|
923 |
+
<option' . selected( $gm_screen_options['uploader_runtime'], 'auto', false ) . ' value="auto">' . esc_html__( 'Auto', 'grand-media' ) . '</option>
|
924 |
+
<option' . selected( $gm_screen_options['uploader_runtime'], 'html5', false ) . ' value="html5">' . esc_html__( 'HTML5 Uploader', 'grand-media' ) . '</option>
|
925 |
+
<option' . selected( $gm_screen_options['uploader_runtime'], 'html4', false ) . ' value="html4">' . esc_html__( 'HTML4 Uploader', 'grand-media' ) . '</option>
|
|
|
926 |
</select>
|
927 |
</div>
|
928 |
+
<div id="uploader_chunking" class="form-group' . esc_attr( $html4_hide ) . '"><span>' . esc_html__( 'Chunking:', 'grand-media' ) . ' </span>
|
929 |
+
<select name="gm_screen_options[uploader_chunking]" class="form-control input-xs d-inline w-auto pe-4">
|
930 |
+
<option' . selected( $gm_screen_options['uploader_chunking'], 'true', false ) . ' value="true">' . esc_html__( 'TRUE', 'grand-media' ) . '</option>
|
931 |
+
<option' . selected( $gm_screen_options['uploader_chunking'], 'false', false ) . ' value="false">' . esc_html__( 'FALSE', 'grand-media' ) . '</option>
|
932 |
</select>
|
933 |
</div>
|
934 |
+
<div id="uploader_urlstream_upload" class="form-group' . esc_attr( $html4_hide ) . '"><span>' . esc_html__( 'URL streem upload:', 'grand-media' ) . ' </span>
|
935 |
+
<select name="gm_screen_options[uploader_urlstream_upload]" class="form-control input-xs d-inline w-auto pe-4">
|
936 |
+
<option' . selected( $gm_screen_options['uploader_urlstream_upload'], 'true', false ) . ' value="true">' . esc_html__( 'TRUE', 'grand-media' ) . '</option>
|
937 |
+
<option' . selected( $gm_screen_options['uploader_urlstream_upload'], 'false', false ) . ' value="false">' . esc_html__( 'FALSE', 'grand-media' ) . '</option>
|
938 |
</select>
|
939 |
</div>
|
940 |
</div>
|
941 |
';
|
942 |
}
|
943 |
break;
|
944 |
+
case 'GrandMedia_Albums':
|
945 |
if ( isset( $_GET['edit_term'] ) ) {
|
946 |
$settings = '
|
947 |
+
<div class="form-inline float-start row row-cols-auto">
|
948 |
<div class="form-group">
|
949 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_album_edit]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_gmedia_album_edit'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
950 |
</div>
|
951 |
</div>
|
952 |
';
|
953 |
} else {
|
954 |
$settings = '
|
955 |
+
<div class="form-inline float-start row row-cols-auto">
|
956 |
<div class="form-group">
|
957 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_album]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_gmedia_album'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
958 |
</div>
|
959 |
<div class="form-group">
|
960 |
+
<select name="gm_screen_options[orderby_gmedia_album]" class="form-control input-xs d-inline w-auto pe-4">
|
961 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_album'], 'id', false ) . ' value="id">' . esc_html__( 'ID', 'grand-media' ) . '</option>
|
962 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_album'], 'name', false ) . ' value="name">' . esc_html__( 'Name', 'grand-media' ) . '</option>
|
963 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_album'], 'count', false ) . ' value="count">' . esc_html__( 'Gmedia Count', 'grand-media' ) . '</option>
|
964 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_album'], 'global', false ) . ' value="global">' . esc_html__( 'Author ID', 'grand-media' ) . '</option>
|
965 |
+
</select> <span>' . esc_html__( 'order items', 'grand-media' ) . '</span>
|
966 |
</div>
|
967 |
<div class="form-group">
|
968 |
+
<select name="gm_screen_options[sortorder_gmedia_album]" class="form-control input-xs d-inline w-auto pe-4">
|
969 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_album'], 'DESC', false ) . ' value="DESC">' . esc_html__( 'DESC', 'grand-media' ) . '</option>
|
970 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_album'], 'ASC', false ) . ' value="ASC">' . esc_html__( 'ASC', 'grand-media' ) . '</option>
|
971 |
+
</select> <span>' . esc_html__( 'sort order', 'grand-media' ) . '</span>
|
972 |
</div>
|
973 |
</div>
|
974 |
';
|
975 |
}
|
976 |
break;
|
977 |
+
case 'GrandMedia_Categories':
|
978 |
if ( isset( $_GET['edit_term'] ) ) {
|
979 |
$settings = '
|
980 |
+
<div class="form-inline float-start row row-cols-auto">
|
981 |
<div class="form-group">
|
982 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_category_edit]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_gmedia_category_edit'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
983 |
</div>
|
984 |
</div>
|
985 |
';
|
986 |
} else {
|
987 |
$settings = '
|
988 |
+
<div class="form-inline float-start row row-cols-auto">
|
989 |
<div class="form-group">
|
990 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_category]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_gmedia_category'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
991 |
</div>
|
992 |
<div class="form-group">
|
993 |
+
<select name="gm_screen_options[orderby_gmedia_category]" class="form-control input-xs d-inline w-auto pe-4">
|
994 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_category'], 'id', false ) . ' value="id">' . esc_html__( 'ID', 'grand-media' ) . '</option>
|
995 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_category'], 'name', false ) . ' value="name">' . esc_html__( 'Name', 'grand-media' ) . '</option>
|
996 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_category'], 'count', false ) . ' value="count">' . esc_html__( 'Gmedia Count', 'grand-media' ) . '</option>
|
997 |
+
</select> <span>' . esc_html__( 'order items', 'grand-media' ) . '</span>
|
998 |
</div>
|
999 |
<div class="form-group">
|
1000 |
+
<select name="gm_screen_options[sortorder_gmedia_category]" class="form-control input-xs d-inline w-auto pe-4">
|
1001 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_category'], 'DESC', false ) . ' value="DESC">' . esc_html__( 'DESC', 'grand-media' ) . '</option>
|
1002 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_category'], 'ASC', false ) . ' value="ASC">' . esc_html__( 'ASC', 'grand-media' ) . '</option>
|
1003 |
+
</select> <span>' . esc_html__( 'sort order', 'grand-media' ) . '</span>
|
1004 |
</div>
|
1005 |
</div>
|
1006 |
';
|
1007 |
}
|
1008 |
break;
|
1009 |
+
case 'GrandMedia_Tags':
|
1010 |
$settings = '
|
1011 |
+
<div class="form-inline float-start row row-cols-auto">
|
1012 |
<div class="form-group">
|
1013 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_tag]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_gmedia_tag'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
1014 |
</div>
|
1015 |
<div class="form-group">
|
1016 |
+
<select name="gm_screen_options[orderby_gmedia_tag]" class="form-control input-xs d-inline w-auto pe-4">
|
1017 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_tag'], 'id', false ) . ' value="id">' . esc_html__( 'ID', 'grand-media' ) . '</option>
|
1018 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_tag'], 'name', false ) . ' value="name">' . esc_html__( 'Name', 'grand-media' ) . '</option>
|
1019 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_tag'], 'count', false ) . ' value="count">' . esc_html__( 'Gmedia Count', 'grand-media' ) . '</option>
|
1020 |
+
</select> <span>' . esc_html__( 'order items', 'grand-media' ) . '</span>
|
1021 |
</div>
|
1022 |
<div class="form-group">
|
1023 |
+
<select name="gm_screen_options[sortorder_gmedia_tag]" class="form-control input-xs d-inline w-auto pe-4">
|
1024 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_tag'], 'DESC', false ) . ' value="DESC">' . esc_html__( 'DESC', 'grand-media' ) . '</option>
|
1025 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_tag'], 'ASC', false ) . ' value="ASC">' . esc_html__( 'ASC', 'grand-media' ) . '</option>
|
1026 |
+
</select> <span>' . esc_html__( 'sort order', 'grand-media' ) . '</span>
|
1027 |
</div>
|
1028 |
</div>
|
1029 |
';
|
1030 |
break;
|
1031 |
+
case 'GrandMedia_Galleries':
|
1032 |
if ( ! $gmCore->_get( 'edit_term' ) && ! $gmCore->_get( 'gallery_module' ) ) {
|
1033 |
$settings = '
|
1034 |
+
<div class="form-inline float-start row row-cols-auto">
|
1035 |
<div class="form-group">
|
1036 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_gallery]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_gmedia_gallery'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
1037 |
</div>
|
1038 |
<div class="form-group">
|
1039 |
+
<select name="gm_screen_options[orderby_gmedia_gallery]" class="form-control input-xs d-inline w-auto pe-4">
|
1040 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_gallery'], 'id', false ) . ' value="id">' . esc_html__( 'ID', 'grand-media' ) . '</option>
|
1041 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_gallery'], 'name', false ) . ' value="name">' . esc_html__( 'Name', 'grand-media' ) . '</option>
|
1042 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_gallery'], 'global', false ) . ' value="global">' . esc_html__( 'Author ID', 'grand-media' ) . '</option>
|
1043 |
+
</select> <span>' . esc_html__( 'order items', 'grand-media' ) . '</span>
|
1044 |
</div>
|
1045 |
<div class="form-group">
|
1046 |
+
<select name="gm_screen_options[sortorder_gmedia_gallery]" class="form-control input-xs d-inline w-auto pe-4">
|
1047 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_gallery'], 'DESC', false ) . ' value="DESC">' . esc_html__( 'DESC', 'grand-media' ) . '</option>
|
1048 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_gallery'], 'ASC', false ) . ' value="ASC">' . esc_html__( 'ASC', 'grand-media' ) . '</option>
|
1049 |
+
</select> <span>' . esc_html__( 'sort order', 'grand-media' ) . '</span>
|
1050 |
</div>
|
1051 |
</div>
|
1052 |
';
|
1053 |
}
|
1054 |
break;
|
1055 |
+
case 'GrandMedia_WordpressLibrary':
|
1056 |
+
$settings = '<p>' . esc_html__( 'Set query options for this page to be loaded by default.', 'grand-media' ) . '</p>
|
1057 |
+
<div class="form-inline float-start row row-cols-auto">
|
1058 |
<div class="form-group">
|
1059 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_wpmedia]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_wpmedia'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
1060 |
</div>
|
1061 |
<div class="form-group">
|
1062 |
+
<select name="gm_screen_options[orderby_wpmedia]" class="form-control input-xs d-inline w-auto pe-4">
|
1063 |
+
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'ID', false ) . ' value="ID">' . esc_html__( 'ID', 'grand-media' ) . '</option>
|
1064 |
+
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'title', false ) . ' value="title">' . esc_html__( 'Title', 'grand-media' ) . '</option>
|
1065 |
+
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'filename', false ) . ' value="filename">' . esc_html__( 'Filename', 'grand-media' ) . '</option>
|
1066 |
+
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'date', false ) . ' value="date">' . esc_html__( 'Date', 'grand-media' ) . '</option>
|
1067 |
+
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'modified', false ) . ' value="modified">' . esc_html__( 'Last Modified', 'grand-media' ) . '</option>
|
1068 |
+
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'mime_type', false ) . ' value="mime_type">' . esc_html__( 'MIME Type', 'grand-media' ) . '</option>
|
1069 |
+
<option' . selected( $gm_screen_options['orderby_wpmedia'], 'author', false ) . ' value="author">' . esc_html__( 'Author', 'grand-media' ) . '</option>
|
1070 |
+
</select> <span>' . esc_html__( 'order items', 'grand-media' ) . '</span>
|
1071 |
</div>
|
1072 |
<div class="form-group">
|
1073 |
+
<select name="gm_screen_options[sortorder_wpmedia]" class="form-control input-xs d-inline w-auto pe-4">
|
1074 |
+
<option' . selected( $gm_screen_options['sortorder_wpmedia'], 'DESC', false ) . ' value="DESC">' . esc_html__( 'DESC', 'grand-media' ) . '</option>
|
1075 |
+
<option' . selected( $gm_screen_options['sortorder_wpmedia'], 'ASC', false ) . ' value="ASC">' . esc_html__( 'ASC', 'grand-media' ) . '</option>
|
1076 |
+
</select> <span>' . esc_html__( 'sort order', 'grand-media' ) . '</span>
|
1077 |
</div>
|
1078 |
</div>
|
1079 |
';
|
1080 |
break;
|
1081 |
+
case 'GrandMedia_Logs':
|
1082 |
$settings = '
|
1083 |
+
<div class="form-inline float-start row row-cols-auto">
|
1084 |
<div class="form-group">
|
1085 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_log]" class="form-control input-xs d-inline" style="width: 5em;" value="' . esc_attr( $gm_screen_options['per_page_gmedia_log'] ) . '" /> <span>' . esc_html__( 'items per page', 'grand-media' ) . '</span>
|
1086 |
</div>
|
1087 |
<div class="form-group">
|
1088 |
+
<select name="gm_screen_options[orderby_gmedia_log]" class="form-control input-xs d-inline w-auto pe-4">
|
1089 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_log'], 'log_date', false ) . ' value="log_date">' . esc_html__( 'Date', 'grand-media' ) . '</option>
|
1090 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_log'], 'ID', false ) . ' value="ID">' . esc_html__( 'Gmedia ID', 'grand-media' ) . '</option>
|
1091 |
+
<option' . selected( $gm_screen_options['orderby_gmedia_log'], 'author', false ) . ' value="author">' . esc_html__( 'Author ID', 'grand-media' ) . '</option>
|
1092 |
+
</select> <span>' . esc_html__( 'order items', 'grand-media' ) . '</span>
|
1093 |
</div>
|
1094 |
<div class="form-group">
|
1095 |
+
<select name="gm_screen_options[sortorder_gmedia_log]" class="form-control input-xs d-inline w-auto pe-4">
|
1096 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_log'], 'DESC', false ) . ' value="DESC">' . esc_html__( 'DESC', 'grand-media' ) . '</option>
|
1097 |
+
<option' . selected( $gm_screen_options['sortorder_gmedia_log'], 'ASC', false ) . ' value="ASC">' . esc_html__( 'ASC', 'grand-media' ) . '</option>
|
1098 |
+
</select> <span>' . esc_html__( 'sort order', 'grand-media' ) . '</span>
|
1099 |
</div>
|
1100 |
</div>
|
1101 |
';
|
1105 |
if ( $settings ) {
|
1106 |
$current = $title . $settings . $wp_screen_options . $button;
|
1107 |
}
|
|
|
1108 |
}
|
1109 |
|
1110 |
return $current;
|
1111 |
}
|
1112 |
|
1113 |
/**
|
1114 |
+
* @param string|array $status
|
1115 |
+
* @param string $option
|
1116 |
+
* @param array $value
|
1117 |
*
|
1118 |
* @return array
|
1119 |
*/
|
1120 |
+
public function screen_settings_save( $status, $option, $value ) {
|
1121 |
+
global $user_ID, $gmCore;
|
1122 |
if ( 'gm_screen_options' === $option ) {
|
1123 |
/*
|
1124 |
global $gmGallery;
|
1129 |
*/
|
1130 |
$gm_screen_options = get_user_meta( $user_ID, 'gm_screen_options', true );
|
1131 |
if ( ! is_array( $gm_screen_options ) ) {
|
1132 |
+
$gm_screen_options = array();
|
1133 |
}
|
1134 |
+
$value = array_merge( $gm_screen_options, $gmCore->_post( 'gm_screen_options', array() ) );
|
1135 |
|
1136 |
return $value;
|
1137 |
}
|
admin/ajax.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
add_action( 'wp_ajax_gmedia_update_data', 'gmedia_update_data' );
|
3 |
function gmedia_update_data() {
|
4 |
global $gmDB, $gmCore;
|
5 |
-
check_ajax_referer(
|
6 |
if ( ! current_user_can( 'gmedia_edit_media' ) ) {
|
7 |
die( '-1' );
|
8 |
}
|
@@ -13,7 +13,7 @@ function gmedia_update_data() {
|
|
13 |
|
14 |
if ( ! empty( $gmedia['ID'] ) ) {
|
15 |
$item = $gmDB->get_gmedia( $gmedia['ID'] );
|
16 |
-
if ( (int) $item->author
|
17 |
if ( ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
18 |
die( '-2' );
|
19 |
}
|
@@ -29,7 +29,7 @@ function gmedia_update_data() {
|
|
29 |
$gmuid = pathinfo( $item->gmuid );
|
30 |
|
31 |
$gmedia['filename'] = preg_replace( '/[^a-z0-9_\.-]+/i', '_', $gmedia['filename'] );
|
32 |
-
if ( ( $gmedia['filename'] !== $gmuid['filename'] ) && ( current_user_can( 'gmedia_delete_others_media' ) || ( (int) $item->author
|
33 |
$fileinfo = $gmCore->fileinfo( $gmedia['filename'] . '.' . $gmuid['extension'] );
|
34 |
if ( false !== $fileinfo ) {
|
35 |
if ( 'image' === $fileinfo['dirname'] && file_is_displayable_image( $fileinfo['dirpath'] . '/' . $item->gmuid ) ) {
|
@@ -51,40 +51,42 @@ function gmedia_update_data() {
|
|
51 |
if ( ! is_wp_error( $id ) ) {
|
52 |
// Meta Stuff.
|
53 |
if ( isset( $gmedia['meta'] ) && is_array( $gmedia['meta'] ) ) {
|
54 |
-
$meta_error =
|
55 |
foreach ( $gmedia['meta'] as $key => $value ) {
|
56 |
if ( $gmCore->is_digit( $key ) ) {
|
57 |
$mid = (int) $key;
|
58 |
//$value = wp_unslash( $value );
|
59 |
-
|
60 |
-
|
|
|
61 |
'error' => 'no_meta',
|
62 |
'message' => __( 'No record in DataBase.', 'grand-media' ),
|
63 |
'meta_id' => $mid,
|
64 |
'meta_key' => $meta->meta_key,
|
65 |
-
|
66 |
continue;
|
67 |
}
|
68 |
if ( '' === trim( $value ) ) {
|
69 |
-
$meta_error[] =
|
70 |
'error' => 'empty_value',
|
71 |
'message' => __( 'Please provide a custom field value.', 'grand-media' ),
|
72 |
'meta_id' => $mid,
|
73 |
'meta_key' => $meta->meta_key,
|
74 |
'meta_value' => $meta->meta_value,
|
75 |
-
|
76 |
continue;
|
77 |
}
|
78 |
|
79 |
if ( $meta->meta_value !== $value ) {
|
80 |
-
|
81 |
-
|
|
|
82 |
'error' => 'meta_update',
|
83 |
'message' => __( 'Something goes wrong.', 'grand-media' ),
|
84 |
'meta_id' => $mid,
|
85 |
'meta_key' => $meta->meta_key,
|
86 |
'meta_value' => $meta->meta_value,
|
87 |
-
|
88 |
}
|
89 |
}
|
90 |
} elseif ( '_' === $key[0] ) {
|
@@ -93,7 +95,7 @@ function gmedia_update_data() {
|
|
93 |
} elseif ( '_gps' === $key ) {
|
94 |
if ( $value ) {
|
95 |
$latlng = explode( ',', $value );
|
96 |
-
$value =
|
97 |
}
|
98 |
}
|
99 |
$value = apply_filters( 'gmedia_protected_meta_value', $value, $key, $id );
|
@@ -101,10 +103,8 @@ function gmedia_update_data() {
|
|
101 |
}
|
102 |
}
|
103 |
}
|
104 |
-
$result = $gmDB->get_gmedia( $id );
|
105 |
-
} else {
|
106 |
-
$result = $gmDB->get_gmedia( $id );
|
107 |
}
|
|
|
108 |
|
109 |
gmedia_item_more_data( $result );
|
110 |
if ( 'image' !== $result->type ) {
|
@@ -119,7 +119,7 @@ function gmedia_update_data() {
|
|
119 |
if ( $album ) {
|
120 |
$album = reset( $album );
|
121 |
if ( (int) $gmedia['gmedia_album_order'] !== (int) $album->gmedia_order ) {
|
122 |
-
$gmDB->update_term_sortorder( $album->term_id,
|
123 |
$result->gmedia_album_order = (int) $gmedia['gmedia_album_order'];
|
124 |
}
|
125 |
}
|
@@ -136,7 +136,7 @@ function gmedia_update_data() {
|
|
136 |
}
|
137 |
gmedia_delete_transients( 'gm_cache' );
|
138 |
|
139 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
140 |
echo wp_json_encode( $result );
|
141 |
}
|
142 |
|
@@ -151,7 +151,7 @@ function gmedit_save() {
|
|
151 |
die( '-1' );
|
152 |
}
|
153 |
|
154 |
-
$gmedia =
|
155 |
$fail = '';
|
156 |
$success = '';
|
157 |
$gmid = $gmCore->_post( 'id' );
|
@@ -160,7 +160,7 @@ function gmedit_save() {
|
|
160 |
|
161 |
$item = $gmDB->get_gmedia( $gmid );
|
162 |
if ( ! empty( $item ) ) {
|
163 |
-
if ( (int) $item->author
|
164 |
if ( ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
165 |
die( '-2' );
|
166 |
}
|
@@ -181,7 +181,7 @@ function gmedit_save() {
|
|
181 |
$size = @getimagesize( $fileinfo['filepath'] );
|
182 |
|
183 |
do {
|
184 |
-
$extensions =
|
185 |
if ( function_exists( 'memory_get_usage' ) ) {
|
186 |
switch ( $extensions[ $size[2] ] ) {
|
187 |
case 'GIF':
|
@@ -198,9 +198,9 @@ function gmedit_save() {
|
|
198 |
$CHANNEL = 6;
|
199 |
break;
|
200 |
}
|
201 |
-
$MB = 1048576; // number of bytes in 1M
|
202 |
-
$K64 = 65536; // number of bytes in 64K
|
203 |
-
$TWEAKFACTOR = 1.8; // Or whatever works for you
|
204 |
$memoryNeeded = round( ( $size[0] * $size[1] * $size['bits'] * $CHANNEL / 8 + $K64 ) * $TWEAKFACTOR );
|
205 |
$memoryNeeded = memory_get_usage() + $memoryNeeded;
|
206 |
$current_limit = @ini_get( 'memory_limit' );
|
@@ -212,7 +212,7 @@ function gmedit_save() {
|
|
212 |
$current_limit_int *= 1024;
|
213 |
}
|
214 |
|
215 |
-
if ( - 1 !== $current_limit && $memoryNeeded > $current_limit_int ) {
|
216 |
$newLimit = $current_limit_int / $MB + ceil( ( $memoryNeeded - $current_limit_int ) / $MB );
|
217 |
if ( $newLimit < 256 ) {
|
218 |
$newLimit = 256;
|
@@ -231,13 +231,21 @@ function gmedit_save() {
|
|
231 |
@copy( $editfile, $fileinfo['filepath_original'] );
|
232 |
}
|
233 |
}
|
234 |
-
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
break;
|
237 |
}
|
238 |
|
239 |
$modified = isset( $meta['_modified'][0] ) ? ( intval( $meta['_modified'][0] ) + 1 ) : 1;
|
240 |
-
$gmDB->update_metadata(
|
241 |
|
242 |
// Web-image.
|
243 |
if ( 'thumb' !== $applyto ) {
|
@@ -251,11 +259,11 @@ function gmedit_save() {
|
|
251 |
// Thumbnail.
|
252 |
if ( 'web_thumb' === $applyto ) {
|
253 |
$size_ratio = $size[0] / $size[1];
|
254 |
-
$thumbimg['resize'] = ( ( ( 1 >= $size_ratio ) && ( $thumbimg['width'] > $size[0] ) ) || ( ( 1 <= $size_ratio ) && ( $thumbimg['height'] > $size[1] ) ) )
|
255 |
if ( $thumbimg['resize'] ) {
|
256 |
$editor = wp_get_image_editor( $editfile );
|
257 |
if ( is_wp_error( $editor ) ) {
|
258 |
-
$fail = $fileinfo['basename'] .
|
259 |
break;
|
260 |
}
|
261 |
|
@@ -268,7 +276,7 @@ function gmedit_save() {
|
|
268 |
$resized = $editor->resize( 0, $thumbimg['height'], $thumbimg['crop'] );
|
269 |
}
|
270 |
if ( is_wp_error( $resized ) ) {
|
271 |
-
$fail = $fileinfo['basename'] .
|
272 |
break;
|
273 |
}
|
274 |
|
@@ -282,16 +290,14 @@ function gmedit_save() {
|
|
282 |
if ( $thumbis ) {
|
283 |
rename( $fileinfo['filepath_thumb'] . '.tmp', $fileinfo['filepath_thumb'] );
|
284 |
}
|
285 |
-
$fail = $fileinfo['basename'] .
|
286 |
break;
|
287 |
}
|
288 |
-
|
289 |
} else {
|
290 |
@copy( $fileinfo['filepath'], $fileinfo['filepath_thumb'] );
|
291 |
}
|
292 |
}
|
293 |
|
294 |
-
|
295 |
$id = $gmDB->insert_gmedia( $gmedia );
|
296 |
|
297 |
$new_metadata = $gmDB->generate_gmedia_metadata( $id, $fileinfo );
|
@@ -299,15 +305,16 @@ function gmedit_save() {
|
|
299 |
$metadata['original'] = $new_metadata['original'];
|
300 |
$metadata['thumb'] = $new_metadata['thumb'];
|
301 |
|
302 |
-
$gmDB->update_metadata(
|
303 |
|
|
|
304 |
$success = sprintf( __( 'Image "%d" updated', 'grand-media' ), $id );
|
305 |
} while ( 0 );
|
306 |
|
307 |
if ( empty( $fail ) ) {
|
308 |
-
$out =
|
309 |
} else {
|
310 |
-
$out =
|
311 |
}
|
312 |
|
313 |
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
|
@@ -337,10 +344,10 @@ function gmedit_restore() {
|
|
337 |
add_action( 'wp_ajax_gmedia_get_modal', 'gmedia_get_modal' );
|
338 |
function gmedia_get_modal() {
|
339 |
global $gmDB, $gmCore, $gmGallery;
|
340 |
-
check_ajax_referer(
|
341 |
$user_ID = get_current_user_id();
|
342 |
$button_class = 'btn-primary';
|
343 |
-
$gm_terms =
|
344 |
$modal = $gmCore->_post( 'modal' );
|
345 |
$ckey = $gmCore->_post( 'ckey' );
|
346 |
switch ( $modal ) {
|
@@ -409,7 +416,7 @@ function gmedia_get_modal() {
|
|
409 |
die( '-1' );
|
410 |
}
|
411 |
$button_class = 'btn-danger';
|
412 |
-
$modal_title = __( 'Delete Tags from Selected Items', 'grand-media' );
|
413 |
$modal_button = __( 'Delete Tags', 'grand-media' );
|
414 |
break;
|
415 |
case 'custom_filter':
|
@@ -445,14 +452,15 @@ function gmedia_get_modal() {
|
|
445 |
break;
|
446 |
}
|
447 |
|
448 |
-
$
|
|
|
449 |
|
450 |
// @formatter:off
|
451 |
?>
|
452 |
<form class="modal-content" id="ajax-modal-form" autocomplete="off" method="post" action="<?php echo esc_url( $form_action ); ?>">
|
453 |
<div class="modal-header">
|
454 |
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
455 |
<h4 class="modal-title"><?php echo esc_html( $modal_title ); ?></h4>
|
|
|
456 |
</div>
|
457 |
<div class="modal-body">
|
458 |
<?php
|
@@ -460,27 +468,28 @@ function gmedia_get_modal() {
|
|
460 |
case 'quick_gallery':
|
461 |
case 'quick_gallery_stack':
|
462 |
if ( ! empty( $ckey ) ) {
|
463 |
-
$selected_in_library = isset( $_COOKIE[ $ckey ] ) ? str_replace( '.', ',', $_COOKIE[ $ckey ] ) : '';
|
464 |
}
|
465 |
if ( empty( $selected_in_library ) ) {
|
466 |
-
|
467 |
break;
|
468 |
}
|
469 |
$gmedia_modules = get_gmedia_modules( false );
|
470 |
?>
|
471 |
<div class="form-group">
|
472 |
-
<label><?php
|
473 |
-
<input type="text" class="form-control input-sm" name="gallery[name]" placeholder="<?php esc_attr_e(
|
474 |
</div>
|
475 |
<div class="form-group">
|
476 |
-
<label><?php
|
477 |
<select class="form-control input-sm" name="gallery[module]">
|
478 |
-
<?php
|
|
|
479 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
480 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
481 |
$selected = selected( $gmGallery->options['default_gmedia_module'], esc_attr( $mfold ), false );
|
482 |
-
$option =
|
483 |
-
$option[] = '<option ' . $selected . ' value="' . esc_attr( $mfold ) . '">' . $module['title'] . ' - ' . __( 'Default Settings' ) . '</option>';
|
484 |
foreach ( $presets as $preset ) {
|
485 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
486 |
continue;
|
@@ -491,19 +500,20 @@ function gmedia_get_modal() {
|
|
491 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
492 |
}
|
493 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
494 |
-
$option[] = '<option ' . $selected . ' value="' . $preset->term_id . '">' . $module['title'] . $by_author . ' - ' . __( 'Default Settings' ) . '</option>';
|
495 |
} else {
|
496 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
497 |
-
$option[] = '<option ' . $selected . ' value="' . $preset->term_id . '">' . $module['title'] . $by_author . ' - ' . $preset_name . '</option>';
|
498 |
}
|
499 |
}
|
500 |
-
echo implode( '', $option );
|
501 |
echo '</optgroup>';
|
502 |
-
}
|
|
|
503 |
</select>
|
504 |
</div>
|
505 |
<div class="form-group">
|
506 |
-
<label><?php
|
507 |
<input type="text" name="gallery[query][gmedia__in]" class="form-control input-sm" value="<?php echo esc_attr( $selected_in_library ); ?>" required="required"/>
|
508 |
</div>
|
509 |
<?php
|
@@ -511,53 +521,54 @@ function gmedia_get_modal() {
|
|
511 |
case 'exclude_albums':
|
512 |
case 'filter_albums':
|
513 |
if ( $gmCore->caps['gmedia_show_others_media'] ) {
|
514 |
-
$args =
|
515 |
} else {
|
516 |
-
$args =
|
517 |
-
'global' =>
|
518 |
'orderby' => 'global_desc_name',
|
519 |
-
|
520 |
}
|
521 |
$gm_terms = $gmDB->get_terms( 'gmedia_album', $args );
|
522 |
?>
|
523 |
-
<div class="checkbox"><label><input type="checkbox" name="alb[]" value="0"> <?php
|
524 |
<hr/>
|
525 |
<?php
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
|
|
|
|
|
|
|
|
532 |
}
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
$author_name = " <small>{$author_name}</small>";
|
541 |
-
}
|
542 |
-
?>
|
543 |
<div class="checkbox">
|
544 |
-
<label><input type="checkbox" name="alb[]" value="<?php echo absint( $term->term_id ); ?>"> <?php echo
|
545 |
-
<span class="badge
|
546 |
</div>
|
547 |
-
|
|
|
|
|
|
|
548 |
}
|
549 |
-
} else {
|
550 |
-
$modal_button = false;
|
551 |
-
}
|
552 |
break;
|
553 |
case 'assign_album':
|
554 |
if ( $gmCore->caps['gmedia_edit_others_media'] ) {
|
555 |
-
$args =
|
556 |
} else {
|
557 |
-
$args =
|
558 |
-
'global' =>
|
559 |
'orderby' => 'global_desc_name',
|
560 |
-
|
561 |
}
|
562 |
$gm_terms = $gmDB->get_terms( 'gmedia_album', $args );
|
563 |
|
@@ -567,7 +578,8 @@ function gmedia_get_modal() {
|
|
567 |
$author_name = '';
|
568 |
if ( $term->global ) {
|
569 |
if ( $gmCore->caps['gmedia_edit_others_media'] ) {
|
570 |
-
|
|
|
571 |
}
|
572 |
} else {
|
573 |
$author_name .= ' (' . __( 'shared', 'grand-media' ) . ')';
|
@@ -575,22 +587,22 @@ function gmedia_get_modal() {
|
|
575 |
if ( 'publish' !== $term->status ) {
|
576 |
$author_name .= ' [' . $term->status . ']';
|
577 |
}
|
578 |
-
$terms_album .= '<option value="' . $term->term_id . '" data-count="' . $term->count . '" data-name="' .
|
579 |
}
|
580 |
}
|
581 |
?>
|
582 |
<div class="form-group">
|
583 |
-
<label><?php
|
584 |
-
<select id="combobox_gmedia_album" name="alb" class="form-control" placeholder="<?php
|
585 |
<option></option>
|
586 |
-
<option value="0"><?php
|
587 |
-
<?php echo $terms_album; ?>
|
588 |
</select>
|
589 |
-
<small class="help-block" style="margin-top:0;"><?php
|
590 |
</div>
|
591 |
<div class="form-group">
|
592 |
<div class="checkbox">
|
593 |
-
<label><input type="checkbox" name="status_global" value="1" checked> <?php
|
594 |
</label></div>
|
595 |
</div>
|
596 |
<script type="text/javascript">
|
@@ -599,7 +611,7 @@ function gmedia_get_modal() {
|
|
599 |
var albums_data = $('option', albums);
|
600 |
//noinspection JSDuplicatedDeclaration
|
601 |
albums.selectize({
|
602 |
-
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
603 |
create: function(input) {
|
604 |
return {
|
605 |
value: input,
|
@@ -607,7 +619,7 @@ function gmedia_get_modal() {
|
|
607 |
};
|
608 |
},
|
609 |
createOnBlur: true,
|
610 |
-
<?php } else{ ?>
|
611 |
create: false,
|
612 |
<?php } ?>
|
613 |
persist: false,
|
@@ -623,11 +635,11 @@ function gmedia_get_modal() {
|
|
623 |
},
|
624 |
option: function(item, escape) {
|
625 |
if (0 === (parseInt(item.value) || 0)) {
|
626 |
-
return '<div>' + escape(item.text) + '</div>';
|
627 |
}
|
628 |
if (item.$order) {
|
629 |
var data = $(albums_data[item.$order]).data();
|
630 |
-
return '<div>' + escape(data.name) + ' <small>' + escape(data.meta) + '</small>' + ' <span class="badge
|
631 |
}
|
632 |
}
|
633 |
}
|
@@ -640,7 +652,7 @@ function gmedia_get_modal() {
|
|
640 |
case 'filter_categories':
|
641 |
$gm_terms = $gmDB->get_terms( 'gmedia_category' );
|
642 |
?>
|
643 |
-
<div class="checkbox"><label><input type="checkbox" name="cat[]" value="0"> <?php
|
644 |
<?php
|
645 |
if ( count( $gm_terms ) ) {
|
646 |
foreach ( $gm_terms as $term ) {
|
@@ -648,7 +660,7 @@ function gmedia_get_modal() {
|
|
648 |
?>
|
649 |
<div class="checkbox">
|
650 |
<label><input type="checkbox" name="cat[]" value="<?php echo absint( $term->term_id ); ?>"> <?php echo esc_html( $term->name ); ?></label>
|
651 |
-
<span class="badge
|
652 |
</div>
|
653 |
<?php
|
654 |
}
|
@@ -656,11 +668,11 @@ function gmedia_get_modal() {
|
|
656 |
}
|
657 |
break;
|
658 |
case 'assign_category':
|
659 |
-
$gm_terms = $gmDB->get_terms( 'gmedia_category',
|
660 |
$gm_terms = array_values( $gm_terms );
|
661 |
?>
|
662 |
<div class="form-group">
|
663 |
-
<input id="combobox_gmedia_category" name="cat_names" class="form-control input-sm" value="" placeholder="<?php
|
664 |
</div>
|
665 |
<script type="text/javascript">
|
666 |
jQuery(function($) {
|
@@ -681,14 +693,14 @@ function gmedia_get_modal() {
|
|
681 |
searchField: ['name'],
|
682 |
valueField: 'name',
|
683 |
persist: false,
|
684 |
-
<?php if($gmCore->caps['gmedia_category_manage']){ ?>
|
685 |
createOnBlur: true,
|
686 |
create: function(input) {
|
687 |
return {
|
688 |
name: input
|
689 |
};
|
690 |
},
|
691 |
-
<?php } else{ ?>
|
692 |
create: false,
|
693 |
<?php } ?>
|
694 |
render: {
|
@@ -696,7 +708,7 @@ function gmedia_get_modal() {
|
|
696 |
return '<div>' + escape(item.name) + '</div>';
|
697 |
},
|
698 |
option: function(item, escape) {
|
699 |
-
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
700 |
}
|
701 |
}
|
702 |
});
|
@@ -706,37 +718,38 @@ function gmedia_get_modal() {
|
|
706 |
break;
|
707 |
case 'unassign_category':
|
708 |
// get selected items in Gmedia Library.
|
709 |
-
$selected_items = ! empty( $ckey ) ? array_filter( explode( '.', $_COOKIE[ $ckey ] ), 'is_numeric' ) : false;
|
710 |
if ( ! empty( $selected_items ) ) {
|
711 |
$gm_terms = $gmDB->get_gmedia_terms( $selected_items, 'gmedia_category' );
|
712 |
}
|
713 |
-
if ( count( $gm_terms ) ){
|
714 |
-
foreach ( $gm_terms as $term ){
|
715 |
-
|
716 |
<div class="checkbox">
|
717 |
<label><input type="checkbox" name="category_id[]" value="<?php echo absint( $term->term_id ); ?>"> <?php echo esc_html( $term->name ); ?></label>
|
718 |
-
<span class="badge
|
719 |
</div>
|
720 |
<?php
|
721 |
}
|
722 |
} else {
|
723 |
-
$modal_button = false;
|
724 |
-
|
|
|
725 |
<?php
|
726 |
}
|
727 |
break;
|
728 |
case 'exclude_tags':
|
729 |
case 'filter_tags':
|
730 |
-
$gm_terms = $gmDB->get_terms( 'gmedia_tag',
|
731 |
$gm_terms = array_values( $gm_terms );
|
732 |
-
if ( count( $gm_terms ) ){
|
733 |
-
|
734 |
<div class="form-group">
|
735 |
-
<input id="combobox_gmedia_tag" name="tag_ids" class="form-control input-sm" value="" placeholder="<?php
|
736 |
</div>
|
737 |
<script type="text/javascript">
|
738 |
jQuery(function($) {
|
739 |
-
var gm_terms = <?php echo
|
740 |
//noinspection JSUnusedAssignment
|
741 |
var items = gm_terms.map(function(x) {
|
742 |
//noinspection JSUnresolvedVariable
|
@@ -757,7 +770,7 @@ function gmedia_get_modal() {
|
|
757 |
return '<div>' + escape(item.name) + '</div>';
|
758 |
},
|
759 |
option: function(item, escape) {
|
760 |
-
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
761 |
}
|
762 |
}
|
763 |
});
|
@@ -767,23 +780,23 @@ function gmedia_get_modal() {
|
|
767 |
} else {
|
768 |
$modal_button = false;
|
769 |
?>
|
770 |
-
<p class="noterms"><?php
|
771 |
<?php
|
772 |
}
|
773 |
break;
|
774 |
case 'add_tags':
|
775 |
-
$gm_terms = $gmDB->get_terms( 'gmedia_tag',
|
776 |
$gm_terms = array_values( $gm_terms );
|
777 |
?>
|
778 |
<div class="form-group">
|
779 |
-
<input id="combobox_gmedia_tag" name="tag_names" class="form-control input-sm" value="" placeholder="<?php
|
780 |
</div>
|
781 |
<div class="checkbox">
|
782 |
-
<label><input type="checkbox" name="iptc_tags" value="1"> <?php
|
783 |
</div>
|
784 |
<script type="text/javascript">
|
785 |
jQuery(function($) {
|
786 |
-
var gm_terms = <?php echo
|
787 |
//noinspection JSUnusedAssignment
|
788 |
var items = gm_terms.map(function(x) {
|
789 |
//noinspection JSUnresolvedVariable
|
@@ -800,14 +813,14 @@ function gmedia_get_modal() {
|
|
800 |
searchField: ['name'],
|
801 |
valueField: 'name',
|
802 |
persist: false,
|
803 |
-
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
804 |
createOnBlur: true,
|
805 |
create: function(input) {
|
806 |
return {
|
807 |
name: input
|
808 |
};
|
809 |
},
|
810 |
-
<?php } else{ ?>
|
811 |
create: false,
|
812 |
<?php } ?>
|
813 |
render: {
|
@@ -815,7 +828,7 @@ function gmedia_get_modal() {
|
|
815 |
return '<div>' + escape(item.name) + '</div>';
|
816 |
},
|
817 |
option: function(item, escape) {
|
818 |
-
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
819 |
}
|
820 |
}
|
821 |
});
|
@@ -825,48 +838,50 @@ function gmedia_get_modal() {
|
|
825 |
break;
|
826 |
case 'delete_tags':
|
827 |
// get selected items in Gmedia Library.
|
828 |
-
$selected_items = ! empty( $ckey ) ? array_filter( explode( '.', $_COOKIE[ $ckey ] ), 'is_numeric' ) : false;
|
829 |
if ( ! empty( $selected_items ) ) {
|
830 |
$gm_terms = $gmDB->get_gmedia_terms( $selected_items, 'gmedia_tag' );
|
831 |
}
|
832 |
-
if ( count( $gm_terms ) ){
|
833 |
-
foreach ( $gm_terms as $term ){
|
834 |
-
|
835 |
<div class="checkbox">
|
836 |
<label><input type="checkbox" name="tag_id[]" value="<?php echo absint( $term->term_id ); ?>"> <?php echo esc_html( $term->name ); ?></label>
|
837 |
-
<span class="badge
|
838 |
</div>
|
839 |
<?php
|
840 |
}
|
841 |
} else {
|
842 |
$modal_button = false;
|
843 |
?>
|
844 |
-
<p class="noterms"><?php
|
845 |
<?php
|
846 |
}
|
847 |
break;
|
848 |
case 'filter_author':
|
849 |
case 'select_author':
|
850 |
-
if ( $gmCore->caps['gmedia_show_others_media'] ){
|
851 |
-
|
852 |
<div class="form-group">
|
853 |
-
<label><?php
|
854 |
<?php
|
855 |
$user_ids = $gmCore->get_editable_user_ids();
|
856 |
if ( $user_ids ) {
|
857 |
if ( ! in_array( $user_ID, $user_ids, true ) ) {
|
858 |
-
|
859 |
}
|
860 |
-
wp_dropdown_users(
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
|
|
|
|
868 |
} else {
|
869 |
-
echo '<div>' . get_the_author_meta( 'display_name', $user_ID ) . '</div>';
|
870 |
}
|
871 |
?>
|
872 |
</div>
|
@@ -882,97 +897,101 @@ function gmedia_get_modal() {
|
|
882 |
</script>
|
883 |
<?php
|
884 |
} else {
|
885 |
-
echo '<p>' .
|
886 |
-
echo '<p><strong>' . get_the_author_meta( 'display_name', $user_ID ) . '</strong></p>';
|
887 |
}
|
888 |
break;
|
889 |
case 'batch_edit':
|
890 |
?>
|
891 |
-
<p><?php
|
892 |
<div class="form-group">
|
893 |
-
<label><?php
|
894 |
<select class="form-control input-sm batch_set" name="batch_filename">
|
895 |
-
<option value=""><?php
|
896 |
-
<option value="custom"><?php
|
897 |
</select>
|
898 |
|
899 |
<div class="batch_set_custom" style="margin-top:5px;display:none;">
|
900 |
<input class="form-control input-sm" name="batch_filename_custom" value="" placeholder="<?php echo esc_attr( 'newname_{id}' ); ?>"/>
|
901 |
|
902 |
-
<div><?php
|
903 |
</div>
|
904 |
</div>
|
905 |
<div class="form-group">
|
906 |
-
<label><?php
|
907 |
<select class="form-control input-sm batch_set" name="batch_title">
|
908 |
-
<option value=""><?php
|
909 |
-
<option value="empty"><?php
|
910 |
-
<option value="filename"><?php
|
911 |
-
<option value="custom"><?php
|
912 |
</select>
|
913 |
-
<input class="form-control input-sm batch_set_custom" style="margin-top:5px;display:none;" name="batch_title_custom" value="" placeholder="<?php
|
914 |
</div>
|
915 |
<div class="form-group">
|
916 |
-
<label><?php
|
917 |
<select class="form-control input-sm batch_set" name="batch_description">
|
918 |
-
<option value=""><?php
|
919 |
-
<option value="metadata"><?php
|
920 |
-
<option value="empty"><?php
|
921 |
-
<option value="custom"><?php
|
922 |
</select>
|
923 |
|
924 |
<div class="batch_set_custom" style="margin-top:5px;display:none;">
|
925 |
<select class="form-control input-sm" name="what_description_custom" style="margin-bottom:5px;">
|
926 |
-
<option value="replace"><?php
|
927 |
-
<option value="append"><?php
|
928 |
-
<option value="prepend"><?php
|
929 |
</select>
|
930 |
-
<textarea class="form-control input-sm" cols="30" rows="3" name="batch_description_custom" placeholder="<?php
|
931 |
</div>
|
932 |
</div>
|
933 |
<div class="form-group">
|
934 |
-
<label><?php
|
935 |
<select class="form-control input-sm batch_set" name="batch_link">
|
936 |
-
<option value=""><?php
|
937 |
-
<option value="empty"><?php
|
938 |
-
<option value="self"><?php
|
939 |
-
<option value="custom"><?php
|
940 |
</select>
|
941 |
-
<input class="form-control input-sm batch_set_custom" style="margin-top:5px;display:none;" name="batch_link_custom" value="" placeholder="<?php
|
942 |
</div>
|
943 |
<div class="form-group">
|
944 |
-
<label><?php
|
945 |
<select class="form-control input-sm batch_set" name="batch_status">
|
946 |
-
<option value=""><?php
|
947 |
-
<option value="publish"><?php
|
948 |
-
<option value="private"><?php
|
949 |
-
<option value="draft"><?php
|
950 |
</select>
|
951 |
</div>
|
952 |
<div class="form-group">
|
953 |
-
<label><?php
|
954 |
<select class="form-control input-sm batch_set" name="batch_comment_status">
|
955 |
-
<option value=""><?php
|
956 |
-
<option value="open"><?php
|
957 |
-
<option value="closed"><?php
|
958 |
</select>
|
959 |
</div>
|
960 |
-
<?php
|
|
|
961 |
if ( $user_ids ) {
|
962 |
if ( ! in_array( $user_ID, $user_ids, true ) ) {
|
963 |
-
|
964 |
}
|
965 |
?>
|
966 |
<div class="form-group">
|
967 |
-
<label><?php
|
968 |
-
<?php
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
|
|
|
|
|
|
976 |
?>
|
977 |
</div>
|
978 |
<?php
|
@@ -993,13 +1012,13 @@ function gmedia_get_modal() {
|
|
993 |
<?php
|
994 |
break;
|
995 |
default:
|
996 |
-
|
997 |
break;
|
998 |
}
|
999 |
?>
|
1000 |
</div>
|
1001 |
<div class="modal-footer">
|
1002 |
-
<button type="button" class="btn btn-
|
1003 |
<?php if ( $modal_button ) { ?>
|
1004 |
<input type="hidden" name="<?php echo esc_attr( $modal ); ?>"/>
|
1005 |
<button type="button" onclick="jQuery('#ajax-modal-form').submit()" class="btn <?php echo esc_attr( $button_class ); ?>"><?php echo esc_html( $modal_button ); ?></button>
|
@@ -1020,35 +1039,36 @@ function gmedia_tag_edit() {
|
|
1020 |
|
1021 |
check_ajax_referer( 'gmedia_terms', '_wpnonce_terms' );
|
1022 |
if ( ! current_user_can( 'gmedia_tag_manage' ) && ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
1023 |
-
$out['error'] = $gmCore->alert( 'danger', __(
|
1024 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
1025 |
echo wp_json_encode( $out );
|
1026 |
die();
|
1027 |
}
|
1028 |
|
1029 |
-
$term =
|
1030 |
$term['name'] = trim( $gmCore->_post( 'tag_name', '' ) );
|
1031 |
$term['term_id'] = intval( $gmCore->_post( 'tag_id', 0 ) );
|
1032 |
if ( $term['name'] && ! $gmCore->is_digit( $term['name'] ) ) {
|
1033 |
-
if (
|
1034 |
if ( ! $gmDB->term_exists( $term['name'], $term['taxonomy'] ) ) {
|
1035 |
$term_id = $gmDB->update_term( $term['term_id'], $term );
|
1036 |
if ( is_wp_error( $term_id ) ) {
|
1037 |
$out['error'] = $gmCore->alert( 'danger', $term_id->get_error_message() );
|
1038 |
} else {
|
1039 |
-
|
|
|
1040 |
}
|
1041 |
} else {
|
1042 |
-
$out['error'] = $gmCore->alert( 'danger',
|
1043 |
}
|
1044 |
} else {
|
1045 |
-
$out['error'] = $gmCore->alert( 'danger',
|
1046 |
}
|
1047 |
} else {
|
1048 |
-
$out['error'] = $gmCore->alert( 'danger',
|
1049 |
}
|
1050 |
|
1051 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
1052 |
echo wp_json_encode( $out );
|
1053 |
|
1054 |
die();
|
@@ -1058,19 +1078,19 @@ function gmedia_tag_edit() {
|
|
1058 |
add_action( 'wp_ajax_gmedia_module_preset_delete', 'gmedia_module_preset_delete' );
|
1059 |
function gmedia_module_preset_delete() {
|
1060 |
global $gmCore, $gmDB, $user_ID;
|
1061 |
-
$out =
|
1062 |
|
1063 |
check_ajax_referer( 'GmediaGallery' );
|
1064 |
if ( ! current_user_can( 'gmedia_gallery_manage' ) ) {
|
1065 |
-
$out['error'] = $gmCore->alert( 'danger',
|
1066 |
} else {
|
1067 |
$term_id = intval( $gmCore->_post( 'preset_id', 0 ) );
|
1068 |
$term = $gmDB->get_term( $term_id );
|
1069 |
if ( $term && ! is_wp_error( $term ) ) {
|
1070 |
-
if ( ( $term->global !== $user_ID && ! gm_user_can( 'delete_others_media' ) ) || ( (int) $term->global
|
1071 |
-
$out['error'] = $gmCore->alert( 'danger',
|
1072 |
|
1073 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
1074 |
echo wp_json_encode( $out );
|
1075 |
|
1076 |
die();
|
@@ -1083,7 +1103,7 @@ function gmedia_module_preset_delete() {
|
|
1083 |
}
|
1084 |
}
|
1085 |
|
1086 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
1087 |
echo wp_json_encode( $out );
|
1088 |
|
1089 |
die();
|
@@ -1095,37 +1115,41 @@ function gmedia_module_install() {
|
|
1095 |
|
1096 |
check_ajax_referer( 'GmediaGallery' );
|
1097 |
if ( ! current_user_can( 'gmedia_module_manage' ) ) {
|
1098 |
-
echo $gmCore->alert( 'danger',
|
1099 |
die();
|
1100 |
}
|
1101 |
|
1102 |
-
|
|
|
1103 |
$module = $gmCore->_post( 'module' );
|
1104 |
$mzip = download_url( $download );
|
1105 |
if ( is_wp_error( $mzip ) ) {
|
1106 |
-
echo $gmCore->alert( 'danger', $mzip->get_error_message() );
|
1107 |
die();
|
1108 |
}
|
1109 |
|
1110 |
-
$mzip = str_replace(
|
1111 |
$to_folder = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/';
|
1112 |
if ( ! wp_mkdir_p( $to_folder ) ) {
|
1113 |
-
|
|
|
1114 |
die();
|
1115 |
}
|
1116 |
if ( ! is_writable( $to_folder ) ) {
|
1117 |
@chmod( $to_folder, 0755 );
|
1118 |
if ( ! is_writable( $to_folder ) ) {
|
1119 |
-
|
|
|
1120 |
die();
|
1121 |
}
|
1122 |
}
|
1123 |
|
1124 |
global $wp_filesystem;
|
1125 |
// Is a filesystem accessor setup?
|
1126 |
-
if ( !
|
1127 |
require_once ABSPATH . 'wp-admin/includes/file.php';
|
1128 |
-
|
|
|
1129 |
}
|
1130 |
if ( ! is_object( $wp_filesystem ) ) {
|
1131 |
$result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.', 'grand-media' ) );
|
@@ -1133,7 +1157,8 @@ function gmedia_module_install() {
|
|
1133 |
$result = new WP_Error( 'fs_error', __( 'Filesystem error', 'grand-media' ), $wp_filesystem->errors );
|
1134 |
} else {
|
1135 |
if ( $module && is_dir( $to_folder . $module ) ) {
|
1136 |
-
|
|
|
1137 |
}
|
1138 |
$result = unzip_file( $mzip, $to_folder );
|
1139 |
}
|
@@ -1142,15 +1167,16 @@ function gmedia_module_install() {
|
|
1142 |
unlink( $mzip );
|
1143 |
|
1144 |
if ( is_wp_error( $result ) ) {
|
1145 |
-
echo $gmCore->alert( 'danger', $result->get_error_message() );
|
1146 |
die();
|
1147 |
} else {
|
1148 |
-
|
|
|
1149 |
// Try to clear cache after module update.
|
1150 |
@$gmCore->clear_cache();
|
1151 |
}
|
1152 |
} else {
|
1153 |
-
echo $gmCore->alert( 'danger',
|
1154 |
}
|
1155 |
|
1156 |
die();
|
@@ -1168,150 +1194,154 @@ function gmedia_import_wpmedia_modal() {
|
|
1168 |
?>
|
1169 |
<div class="modal-content">
|
1170 |
<div class="modal-header">
|
1171 |
-
<
|
1172 |
-
<
|
1173 |
</div>
|
1174 |
<div class="modal-body" style="position:relative; min-height:270px;">
|
1175 |
<form id="import_form" name="import_form" target="import_window" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="POST" accept-charset="utf-8">
|
1176 |
<?php wp_nonce_field( 'gmedia_import', '_wpnonce_import' ); ?>
|
1177 |
<input type="hidden" name="action" value="gmedia_import_handler"/>
|
1178 |
<input type="hidden" id="import-action" name="import" value="import-wpmedia"/>
|
1179 |
-
|
|
|
|
|
1180 |
if ( isset( $_COOKIE[ $ckey ] ) ) {
|
1181 |
-
|
1182 |
-
}
|
|
|
|
|
1183 |
<?php if ( $gmCore->caps['gmedia_terms'] ) { ?>
|
1184 |
<div class="form-group">
|
1185 |
<?php
|
1186 |
$term_type = 'gmedia_album';
|
1187 |
-
$gm_terms = $gmDB->get_terms( $term_type,
|
1188 |
|
1189 |
$terms_album = '';
|
1190 |
if ( count( $gm_terms ) ) {
|
1191 |
foreach ( $gm_terms as $term ) {
|
1192 |
-
$terms_album .= '<option value="' . esc_attr( $term->term_id ) . '">' . esc_html( $term->name
|
1193 |
}
|
1194 |
}
|
1195 |
?>
|
1196 |
-
<label><?php
|
1197 |
-
<select id="combobox_gmedia_album" name="terms[gmedia_album]" class="form-control input-sm" placeholder="<?php
|
1198 |
<option value=""></option>
|
1199 |
-
<?php echo $terms_album; ?>
|
1200 |
</select>
|
1201 |
</div>
|
1202 |
|
1203 |
<div class="form-group">
|
1204 |
<?php
|
1205 |
$term_type = 'gmedia_category';
|
1206 |
-
$gm_cat_terms = $gmDB->get_terms( $term_type,
|
1207 |
?>
|
1208 |
-
<label><?php
|
1209 |
-
<input id="combobox_gmedia_category" name="terms[gmedia_category]" class="form-control input-sm" value="" placeholder="<?php
|
1210 |
</div>
|
1211 |
|
1212 |
<div class="form-group">
|
1213 |
<?php
|
1214 |
$term_type = 'gmedia_tag';
|
1215 |
-
$gm_tag_terms = $gmDB->get_terms( $term_type,
|
1216 |
?>
|
1217 |
-
<label><?php
|
1218 |
-
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" class="form-control input-sm" value="" placeholder="<?php
|
1219 |
</div>
|
1220 |
<script type="text/javascript">
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
</script>
|
1290 |
<?php } else { ?>
|
1291 |
-
<p><?php
|
1292 |
<?php } ?>
|
1293 |
<div class="checkbox">
|
1294 |
-
<label><input type="checkbox" name="skip_exists" value="skip"> <?php
|
1295 |
-
<div class="help-block"><?php
|
1296 |
</div>
|
1297 |
<script type="text/javascript">
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
</script>
|
1309 |
</form>
|
1310 |
<iframe name="import_window" id="import_window" src="about:blank" style="display:none; position:absolute; left:0; top:0; width:100%; height:100%; z-index:1000; background-color:#ffffff; padding:20px 20px 0 20px;" onload="gmedia_import_done()"></iframe>
|
1311 |
</div>
|
1312 |
<div class="modal-footer">
|
1313 |
-
<button type="button" class="btn btn-
|
1314 |
-
<button type="button" id="import-done" class="btn btn-primary" data-complete-text="<?php
|
1315 |
</div>
|
1316 |
</div><!-- /.modal-content -->
|
1317 |
<?php
|
@@ -1330,7 +1360,7 @@ function gmedia_relimage() {
|
|
1330 |
/** @var $wpdb wpdb */
|
1331 |
global $wpdb, $gmCore, $gmDB;
|
1332 |
|
1333 |
-
check_ajax_referer(
|
1334 |
|
1335 |
// check for correct capability.
|
1336 |
if ( ! current_user_can( 'gmedia_library' ) ) {
|
@@ -1342,18 +1372,18 @@ function gmedia_relimage() {
|
|
1342 |
$per_page = 20;
|
1343 |
$s = trim( stripslashes( urldecode( $gmCore->_get( 'search' ) ) ) );
|
1344 |
if ( $s && strlen( $s ) > 2 ) {
|
1345 |
-
$post_tags =
|
1346 |
} else {
|
1347 |
$s = '';
|
1348 |
}
|
1349 |
|
1350 |
-
$gmediaLib =
|
1351 |
$relative = (int) $gmCore->_get( 'rel', 1 );
|
1352 |
$continue = true;
|
1353 |
$content = '';
|
1354 |
|
1355 |
-
if (
|
1356 |
-
$arg =
|
1357 |
'mime_type' => 'image/*',
|
1358 |
'orderby' => 'ID',
|
1359 |
'order' => 'DESC',
|
@@ -1362,57 +1392,57 @@ function gmedia_relimage() {
|
|
1362 |
's' => $s,
|
1363 |
'tag_name__in' => $post_tags,
|
1364 |
'null_tags' => true,
|
1365 |
-
|
1366 |
$gmediaLib = $gmDB->get_gmedias( $arg );
|
1367 |
}
|
1368 |
|
1369 |
if ( empty( $gmediaLib ) && count( $post_tags ) ) {
|
1370 |
|
1371 |
-
if (
|
1372 |
$relative = 0;
|
1373 |
$paged = 1;
|
1374 |
-
$content .= '<li class="emptydb">' .
|
1375 |
}
|
1376 |
|
1377 |
-
$
|
1378 |
-
$
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
" );
|
1384 |
|
1385 |
-
$arg =
|
1386 |
'mime_type' => 'image/*',
|
1387 |
'orderby' => 'ID',
|
1388 |
'order' => 'DESC',
|
1389 |
'per_page' => $per_page,
|
1390 |
'page' => $paged,
|
1391 |
'tag__not_in' => $tag__not_in,
|
1392 |
-
|
1393 |
$gmediaLib = $gmDB->get_gmedias( $arg );
|
1394 |
}
|
1395 |
|
1396 |
-
|
|
|
1397 |
foreach ( $gmediaLib as $item ) {
|
1398 |
-
$content .=
|
1399 |
-
$content .=
|
1400 |
-
$content .=
|
1401 |
-
$content .=
|
1402 |
}
|
1403 |
-
if ( ( $count < $per_page ) && (
|
1404 |
$continue = false;
|
1405 |
}
|
1406 |
} else {
|
1407 |
if ( $s ) {
|
1408 |
-
$content .= '<li class="emptydb">' .
|
1409 |
} else {
|
1410 |
-
$content .= '<li class="emptydb">' .
|
1411 |
}
|
1412 |
$continue = false;
|
1413 |
}
|
1414 |
-
$result =
|
1415 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
1416 |
echo wp_json_encode( $result );
|
1417 |
|
1418 |
die();
|
@@ -1424,20 +1454,22 @@ add_action( 'wp_ajax_gmedia_ftp_browser', 'gmedia_ftp_browser' );
|
|
1424 |
*
|
1425 |
* @author Cory S.N. LaViska - A Beautiful Site (http://abeautifulsite.net/)
|
1426 |
* @version 1.0.1
|
1427 |
-
* @return
|
1428 |
*/
|
1429 |
function gmedia_ftp_browser() {
|
1430 |
if ( ! current_user_can( 'gmedia_import' ) ) {
|
1431 |
die( 'No access' );
|
1432 |
}
|
1433 |
|
|
|
|
|
1434 |
// if nonce is not correct it returns -1.
|
1435 |
check_ajax_referer( 'GmediaGallery' );
|
1436 |
|
1437 |
// start from the default path.
|
1438 |
$root = trailingslashit( ABSPATH );
|
1439 |
// get the current directory.
|
1440 |
-
$dir = trailingslashit( urldecode( $
|
1441 |
|
1442 |
if ( ( false === strpos( $dir, '..' ) ) && file_exists( $root . $dir ) ) {
|
1443 |
$files = scandir( $root . $dir );
|
@@ -1445,25 +1477,25 @@ function gmedia_ftp_browser() {
|
|
1445 |
|
1446 |
// The 2 counts for . and ..
|
1447 |
if ( count( $files ) > 2 ) {
|
1448 |
-
echo
|
1449 |
-
// return only directories
|
1450 |
foreach ( $files as $file ) {
|
1451 |
-
if ( in_array( $file,
|
1452 |
continue;
|
1453 |
}
|
1454 |
|
1455 |
-
if ( file_exists( $root . $dir . $file ) &&
|
1456 |
-
echo
|
1457 |
}
|
1458 |
}
|
1459 |
// All files.
|
1460 |
foreach ( $files as $file ) {
|
1461 |
-
if ( file_exists( $root . $dir . $file ) &&
|
1462 |
$ext = preg_replace( '/^.*\./', '', $file );
|
1463 |
-
if (
|
1464 |
continue;
|
1465 |
}
|
1466 |
-
echo
|
1467 |
}
|
1468 |
}
|
1469 |
echo '</ul>';
|
@@ -1501,22 +1533,22 @@ function gmedia_set_post_thumbnail() {
|
|
1501 |
$image = $gmDB->get_gmedia( $img_id );
|
1502 |
if ( $image ) {
|
1503 |
|
1504 |
-
$args =
|
1505 |
'post_type' => 'attachment',
|
1506 |
'meta_key' => '_gmedia_image_id',
|
1507 |
'meta_compare' => '==',
|
1508 |
'meta_value' => $img_id,
|
1509 |
-
|
1510 |
$posts = get_posts( $args );
|
1511 |
$attachment_id = null;
|
1512 |
|
1513 |
-
if (
|
1514 |
$attachment_id = $posts[0]->ID;
|
1515 |
//$target_path = get_attached_file( $attachment_id );
|
1516 |
} else {
|
1517 |
$upload_dir = wp_upload_dir();
|
1518 |
$basedir = $upload_dir['basedir'];
|
1519 |
-
$thumbs_dir = implode( DIRECTORY_SEPARATOR,
|
1520 |
|
1521 |
$type = explode( '/', $image->mime_type );
|
1522 |
|
@@ -1531,14 +1563,14 @@ function gmedia_set_post_thumbnail() {
|
|
1531 |
$title = sanitize_title( $image->title );
|
1532 |
$caption = $gmCore->sanitize( $image->description );
|
1533 |
|
1534 |
-
$attachment =
|
1535 |
'post_title' => $title,
|
1536 |
'post_content' => $caption,
|
1537 |
'post_status' => 'attachment',
|
1538 |
'post_parent' => 0,
|
1539 |
'post_mime_type' => $image->mime_type,
|
1540 |
'guid' => $url,
|
1541 |
-
|
1542 |
|
1543 |
//require for wp_generate_attachment_metadata which generates image related meta-data also creates thumbs.
|
1544 |
require_once ABSPATH . 'wp-admin/includes/image.php';
|
@@ -1553,7 +1585,7 @@ function gmedia_set_post_thumbnail() {
|
|
1553 |
delete_post_meta( $post_ID, '_thumbnail_id' );
|
1554 |
add_post_meta( $post_ID, '_thumbnail_id', $attachment_id, true );
|
1555 |
|
1556 |
-
echo _wp_post_thumbnail_html( $attachment_id, $post_ID );
|
1557 |
die();
|
1558 |
}
|
1559 |
}
|
@@ -1566,8 +1598,6 @@ add_action( 'wp_ajax_gmedia_upload_handler', 'gmedia_upload_handler' );
|
|
1566 |
function gmedia_upload_handler() {
|
1567 |
global $gmCore;
|
1568 |
|
1569 |
-
ini_set( 'max_execution_time', 300 );
|
1570 |
-
|
1571 |
// HTTP headers for no cache etc.
|
1572 |
send_nosniff_header();
|
1573 |
//send_origin_headers();
|
@@ -1576,11 +1606,11 @@ function gmedia_upload_handler() {
|
|
1576 |
// if nonce is not correct it returns -1.
|
1577 |
check_ajax_referer( 'gmedia_upload', '_wpnonce_upload' );
|
1578 |
if ( ! current_user_can( 'gmedia_upload' ) ) {
|
1579 |
-
wp_die(
|
1580 |
}
|
1581 |
|
1582 |
// 5 minutes execution time.
|
1583 |
-
|
1584 |
|
1585 |
// fake upload time.
|
1586 |
usleep( 10 );
|
@@ -1589,58 +1619,57 @@ function gmedia_upload_handler() {
|
|
1589 |
|
1590 |
// Get parameters.
|
1591 |
if ( ! $filename ) {
|
1592 |
-
$return =
|
1593 |
-
die( $return );
|
1594 |
}
|
1595 |
|
1596 |
$fileinfo = $gmCore->fileinfo( $filename );
|
1597 |
if ( false === $fileinfo ) {
|
1598 |
-
$return =
|
1599 |
-
die( $return );
|
1600 |
}
|
1601 |
|
1602 |
// Look for the content type header.
|
1603 |
$contentType = '';
|
1604 |
-
if ( isset( $_SERVER[
|
1605 |
-
$contentType = $_SERVER[
|
1606 |
}
|
1607 |
|
1608 |
-
if ( isset( $_SERVER[
|
1609 |
-
$contentType = $_SERVER[
|
1610 |
}
|
1611 |
|
1612 |
-
// Handle non
|
1613 |
$file_tmp = '';
|
1614 |
-
if ( strpos( $contentType,
|
|
|
1615 |
if ( isset( $_FILES['file']['tmp_name'] ) && is_uploaded_file( $_FILES['file']['tmp_name'] ) ) {
|
1616 |
-
$file_tmp = $_FILES['file']['tmp_name'];
|
1617 |
}
|
1618 |
} else {
|
1619 |
-
$file_tmp =
|
1620 |
}
|
1621 |
|
1622 |
if ( empty( $file_tmp ) ) {
|
1623 |
-
$return =
|
1624 |
-
die( $return );
|
1625 |
}
|
1626 |
|
1627 |
-
$post_data =
|
1628 |
-
|
|
|
1629 |
parse_str( $params, $post_data );
|
1630 |
}
|
1631 |
|
1632 |
$return = $gmCore->gmedia_upload_handler( $file_tmp, $fileinfo, $contentType, $post_data );
|
1633 |
-
$return = wp_json_encode( $return );
|
1634 |
|
1635 |
-
die( $return );
|
1636 |
}
|
1637 |
|
1638 |
add_action( 'wp_ajax_gmedia_import_handler', 'gmedia_import_handler' );
|
1639 |
function gmedia_import_handler() {
|
1640 |
global $wpdb, $gmCore, $gmDB;
|
1641 |
|
1642 |
-
ini_set( 'max_execution_time', 600 );
|
1643 |
-
|
1644 |
// HTTP headers for no cache etc.
|
1645 |
send_nosniff_header();
|
1646 |
//send_origin_headers();
|
@@ -1648,43 +1677,58 @@ function gmedia_import_handler() {
|
|
1648 |
|
1649 |
check_admin_referer( 'gmedia_import', '_wpnonce_import' );
|
1650 |
if ( ! current_user_can( 'gmedia_import' ) ) {
|
1651 |
-
wp_die(
|
1652 |
}
|
1653 |
|
1654 |
// 10 minutes execution time.
|
1655 |
-
|
1656 |
|
1657 |
// fake upload time.
|
1658 |
usleep( 10 );
|
1659 |
|
1660 |
$import = $gmCore->_post( 'import' );
|
1661 |
-
$terms = $gmCore->_post( 'terms',
|
1662 |
|
1663 |
if ( ob_get_level() === 0 ) {
|
1664 |
ob_start();
|
1665 |
}
|
|
|
1666 |
echo str_pad( ' ', 4096 ) . PHP_EOL;
|
1667 |
wp_ob_end_flush_all();
|
1668 |
flush();
|
1669 |
?>
|
1670 |
<html>
|
1671 |
-
<
|
1672 |
-
|
|
|
|
|
|
|
|
|
1673 |
|
1674 |
-
|
|
|
|
|
1675 |
|
1676 |
-
|
|
|
|
|
|
|
1677 |
|
1678 |
-
|
|
|
|
|
1679 |
|
1680 |
-
|
1681 |
-
|
|
|
|
|
|
|
1682 |
<body>
|
1683 |
<?php
|
1684 |
if ( ( 'import-folder' === $import ) || isset( $_POST['import-folder'] ) ) {
|
1685 |
|
1686 |
$path = $gmCore->_post( 'path' );
|
1687 |
-
echo '<h4 style="margin: 0 0 10px">' . __( 'Import Server Folder' ) . " `$path
|
1688 |
|
1689 |
if ( $path ) {
|
1690 |
$path = trim( urldecode( $path ), '/' );
|
@@ -1722,19 +1766,20 @@ function gmedia_import_handler() {
|
|
1722 |
}
|
1723 |
$gmCore->gmedia_import_files( $files, $terms, $move, $exists );
|
1724 |
} else {
|
1725 |
-
|
|
|
1726 |
}
|
1727 |
} else {
|
1728 |
-
echo
|
1729 |
}
|
1730 |
}
|
1731 |
} elseif ( ( 'import-flagallery' === $import ) || isset( $_POST['import-flagallery'] ) ) {
|
1732 |
|
1733 |
-
echo '<h4 style="margin: 0 0 10px">' .
|
1734 |
|
1735 |
$gallery = $gmCore->_post( 'gallery' );
|
1736 |
if ( ! empty( $gallery ) ) {
|
1737 |
-
$album =
|
1738 |
foreach ( $gallery as $gid ) {
|
1739 |
$flag_gallery = $wpdb->get_row( $wpdb->prepare( "SELECT gid, path, title, galdesc FROM {$wpdb->prefix}flag_gallery WHERE gid = %d", $gid ), ARRAY_A );
|
1740 |
if ( empty( $flag_gallery ) ) {
|
@@ -1747,17 +1792,18 @@ function gmedia_import_handler() {
|
|
1747 |
$terms['gmedia_album'] = 'a' . $terms['gmedia_album'];
|
1748 |
}
|
1749 |
if ( ! $gmDB->term_exists( $terms['gmedia_album'], 'gmedia_album' ) ) {
|
1750 |
-
$
|
1751 |
}
|
1752 |
}
|
1753 |
|
1754 |
$path = ABSPATH . trailingslashit( $flag_gallery['path'] );
|
1755 |
|
1756 |
-
|
|
|
1757 |
|
1758 |
-
$flag_pictures = $wpdb->get_results( $wpdb->prepare( "SELECT CONCAT(
|
1759 |
if ( empty( $flag_pictures ) ) {
|
1760 |
-
echo '<pre>' .
|
1761 |
continue;
|
1762 |
}
|
1763 |
$exists = $gmCore->_post( 'skip_exists', 0 );
|
@@ -1766,15 +1812,15 @@ function gmedia_import_handler() {
|
|
1766 |
$gmCore->gmedia_import_files( $flag_pictures, $terms, false, $exists );
|
1767 |
}
|
1768 |
} else {
|
1769 |
-
echo
|
1770 |
}
|
1771 |
} elseif ( ( 'import-nextgen' === $import ) || isset( $_POST['import-nextgen'] ) ) {
|
1772 |
|
1773 |
-
echo '<h4 style="margin: 0 0 10px">' .
|
1774 |
|
1775 |
$gallery = $gmCore->_post( 'gallery' );
|
1776 |
if ( ! empty( $gallery ) ) {
|
1777 |
-
$album =
|
1778 |
foreach ( $gallery as $gid ) {
|
1779 |
$ngg_gallery = $wpdb->get_row( $wpdb->prepare( "SELECT gid, path, title, galdesc FROM {$wpdb->prefix}ngg_gallery WHERE gid = %d", $gid ), ARRAY_A );
|
1780 |
if ( empty( $ngg_gallery ) ) {
|
@@ -1787,21 +1833,22 @@ function gmedia_import_handler() {
|
|
1787 |
$terms['gmedia_album'] = 'a' . $ngg_gallery['title'];
|
1788 |
}
|
1789 |
if ( ! $gmDB->term_exists( $terms['gmedia_album'], 'gmedia_album' ) ) {
|
1790 |
-
$
|
1791 |
}
|
1792 |
}
|
1793 |
|
1794 |
$path = ABSPATH . trailingslashit( $ngg_gallery['path'] );
|
1795 |
|
1796 |
-
|
|
|
1797 |
|
1798 |
-
$ngg_pictures = $wpdb->get_results( $wpdb->prepare( "SELECT CONCAT(
|
1799 |
if ( empty( $ngg_pictures ) ) {
|
1800 |
-
echo '<pre>' .
|
1801 |
continue;
|
1802 |
} else {
|
1803 |
foreach ( $ngg_pictures as &$ngg_image ) {
|
1804 |
-
$ngg_terms = wp_get_object_terms( (int) $ngg_image['pid'], 'ngg_tag',
|
1805 |
if ( ! empty( $ngg_terms ) ) {
|
1806 |
$ngg_image['terms']['gmedia_tag'] = $ngg_terms;
|
1807 |
}
|
@@ -1812,31 +1859,31 @@ function gmedia_import_handler() {
|
|
1812 |
$gmCore->gmedia_import_files( $ngg_pictures, $terms, false, $exists );
|
1813 |
}
|
1814 |
} else {
|
1815 |
-
echo
|
1816 |
}
|
1817 |
} elseif ( ( 'import-wpmedia' === $import ) || isset( $_POST['import-wpmedia'] ) ) {
|
1818 |
|
1819 |
-
echo '<h4 style="margin: 0 0 10px">' .
|
1820 |
|
1821 |
-
$wpMediaLib = $gmDB->get_wp_media_lib(
|
1822 |
|
1823 |
if ( ! empty( $wpMediaLib ) ) {
|
1824 |
|
1825 |
-
$wp_media =
|
1826 |
foreach ( $wpMediaLib as $item ) {
|
1827 |
-
$wp_media[] =
|
1828 |
'file' => get_attached_file( $item->ID ),
|
1829 |
'author' => $item->post_author,
|
1830 |
'title' => $item->post_title,
|
1831 |
'description' => $item->post_content,
|
1832 |
-
|
1833 |
}
|
1834 |
$exists = $gmCore->_post( 'skip_exists', 0 );
|
1835 |
//echo '<pre>' . print_r($wp_media, true) . '</pre>';
|
1836 |
$gmCore->gmedia_import_files( $wp_media, $terms, false, $exists );
|
1837 |
|
1838 |
} else {
|
1839 |
-
echo
|
1840 |
}
|
1841 |
}
|
1842 |
?>
|
@@ -1886,7 +1933,7 @@ function gmedia_application() {
|
|
1886 |
|
1887 |
$result = $gmCore->app_service( $service );
|
1888 |
|
1889 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
1890 |
echo wp_json_encode( $result );
|
1891 |
|
1892 |
die();
|
@@ -1902,60 +1949,78 @@ function gmedia_share_page() {
|
|
1902 |
$email = $gmCore->_post( 'email', '' );
|
1903 |
$sharemessage = $gmCore->_post( 'message', '' );
|
1904 |
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
|
1905 |
-
echo $gmCore->alert( 'danger', __( 'Invalid email', 'grand-media' ) . ': ' .
|
1906 |
die();
|
1907 |
}
|
1908 |
|
1909 |
-
$display_name
|
1910 |
-
|
1911 |
-
$
|
|
|
|
|
1912 |
$sharelinktext = __( 'Click here to view page', 'grand-media' );
|
1913 |
if ( $sharemessage ) {
|
1914 |
$sharemessage = '<blockquote>"' . nl2br( esc_html( $sharemessage ) ) . '"</blockquote>';
|
1915 |
}
|
1916 |
-
$footer
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
<
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
<
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
<
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1957 |
if ( wp_mail( $email, $subject, $message, $headers ) ) {
|
1958 |
-
|
|
|
1959 |
}
|
1960 |
|
1961 |
die();
|
@@ -1968,22 +2033,23 @@ function gmedia_add_custom_field() {
|
|
1968 |
|
1969 |
$meta_type = 'gmedia';
|
1970 |
|
1971 |
-
$pid = (int) $
|
1972 |
$post = $gmDB->get_gmedia( $pid );
|
1973 |
|
1974 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
1975 |
|
1976 |
if ( ! current_user_can( 'gmedia_edit_media' ) || ( $user_ID !== $post->author && ! current_user_can( 'gmedia_edit_others_media' ) ) ) {
|
1977 |
-
echo wp_json_encode(
|
1978 |
die();
|
1979 |
}
|
1980 |
if ( isset( $_POST['metakeyselect'] ) && empty( $_POST['metakeyselect'] ) && empty( $_POST['metakeyinput'] ) ) {
|
1981 |
-
echo wp_json_encode(
|
1982 |
die();
|
1983 |
}
|
1984 |
|
1985 |
-
|
1986 |
-
|
|
|
1987 |
die();
|
1988 |
}
|
1989 |
|
@@ -1991,13 +2057,13 @@ function gmedia_add_custom_field() {
|
|
1991 |
$meta = $gmDB->get_metadata_by_mid( $meta_type, $mid );
|
1992 |
$pid = (int) $meta->{$column};
|
1993 |
$meta = get_object_vars( $meta );
|
1994 |
-
$result =
|
1995 |
-
'success' =>
|
1996 |
'meta_id' => $mid,
|
1997 |
'data' => $gmCore->_list_meta_item( $meta, $meta_type ),
|
1998 |
-
|
1999 |
'id' => $pid,
|
2000 |
-
|
2001 |
|
2002 |
if ( ! empty( $_POST['metakeyinput'] ) ) {
|
2003 |
$result['newmeta_form'] = $gmCore->meta_form( $meta_type );
|
@@ -2015,21 +2081,22 @@ function gmedia_delete_custom_field() {
|
|
2015 |
|
2016 |
$meta_type = 'gmedia';
|
2017 |
|
2018 |
-
$pid = (int) $
|
2019 |
$post = $gmDB->get_gmedia( $pid );
|
2020 |
|
2021 |
if ( ! current_user_can( 'gmedia_edit_media' ) || ( $user_ID !== $post->author && ! current_user_can( 'gmedia_edit_others_media' ) ) ) {
|
2022 |
-
echo wp_json_encode(
|
2023 |
die();
|
2024 |
}
|
2025 |
|
2026 |
-
$result =
|
2027 |
|
2028 |
-
$deletemeta = $
|
2029 |
$column = sanitize_key( $meta_type . '_id' );
|
2030 |
if ( isset( $deletemeta ) && is_array( $deletemeta ) ) {
|
2031 |
foreach ( $deletemeta as $key => $value ) {
|
2032 |
-
|
|
|
2033 |
continue;
|
2034 |
}
|
2035 |
if ( $meta->{$column} !== $pid ) {
|
@@ -2038,13 +2105,13 @@ function gmedia_delete_custom_field() {
|
|
2038 |
if ( $gmCore->is_protected_meta( $meta->meta_key, $meta_type ) ) {
|
2039 |
continue;
|
2040 |
}
|
2041 |
-
if (
|
2042 |
$result['deleted'][] = $key;
|
2043 |
}
|
2044 |
}
|
2045 |
}
|
2046 |
|
2047 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2048 |
echo wp_json_encode( $result );
|
2049 |
die();
|
2050 |
|
@@ -2057,24 +2124,25 @@ function gmedia_term_add_custom_field() {
|
|
2057 |
|
2058 |
$meta_type = 'gmedia_term';
|
2059 |
|
2060 |
-
$pid = (int) $
|
2061 |
$post = $gmDB->get_term( $pid );
|
2062 |
|
2063 |
$taxonomy = $post->taxonomy;
|
2064 |
|
2065 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2066 |
|
2067 |
if ( ! current_user_can( $taxonomy . '_manage' ) || ( $user_ID !== $post->global && ! current_user_can( 'gmedia_edit_others_media' ) ) ) {
|
2068 |
-
echo wp_json_encode(
|
2069 |
die();
|
2070 |
}
|
2071 |
if ( isset( $_POST['metakeyselect'] ) && empty( $_POST['metakeyselect'] ) && empty( $_POST['metakeyinput'] ) ) {
|
2072 |
-
echo wp_json_encode(
|
2073 |
die();
|
2074 |
}
|
2075 |
|
2076 |
-
|
2077 |
-
|
|
|
2078 |
die();
|
2079 |
}
|
2080 |
|
@@ -2082,13 +2150,13 @@ function gmedia_term_add_custom_field() {
|
|
2082 |
$meta = $gmDB->get_metadata_by_mid( $meta_type, $mid );
|
2083 |
$pid = (int) $meta->{$column};
|
2084 |
$meta = get_object_vars( $meta );
|
2085 |
-
$result =
|
2086 |
-
'success' =>
|
2087 |
'meta_id' => $mid,
|
2088 |
'data' => $gmCore->_list_meta_item( $meta, $meta_type ),
|
2089 |
-
|
2090 |
'id' => $pid,
|
2091 |
-
|
2092 |
|
2093 |
if ( ! empty( $_POST['metakeyinput'] ) ) {
|
2094 |
$result['newmeta_form'] = $gmCore->meta_form( $meta_type );
|
@@ -2105,34 +2173,35 @@ function gmedia_term_delete_custom_field() {
|
|
2105 |
|
2106 |
$meta_type = 'gmedia_term';
|
2107 |
|
2108 |
-
$pid = (int) $
|
2109 |
$post = $gmDB->get_term( $pid );
|
2110 |
|
2111 |
$taxonomy = $post->taxonomy;
|
2112 |
|
2113 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2114 |
|
2115 |
if ( ! current_user_can( $taxonomy . '_manage' ) || ( $user_ID !== $post->global && ! current_user_can( 'gmedia_edit_others_media' ) ) ) {
|
2116 |
-
echo wp_json_encode(
|
2117 |
die();
|
2118 |
}
|
2119 |
|
2120 |
-
$result =
|
2121 |
|
2122 |
-
$deletemeta = $
|
2123 |
$column = sanitize_key( $meta_type . '_id' );
|
2124 |
-
if (
|
2125 |
foreach ( $deletemeta as $key => $value ) {
|
2126 |
-
|
|
|
2127 |
continue;
|
2128 |
}
|
2129 |
-
if ( $meta->{$column} !== $pid ) {
|
2130 |
continue;
|
2131 |
}
|
2132 |
if ( $gmCore->is_protected_meta( $meta->meta_key, $meta_type ) ) {
|
2133 |
continue;
|
2134 |
}
|
2135 |
-
if (
|
2136 |
$result['deleted'][] = $key;
|
2137 |
}
|
2138 |
}
|
@@ -2156,18 +2225,18 @@ function gmedia_term_sortorder() {
|
|
2156 |
}
|
2157 |
|
2158 |
if ( ! current_user_can( 'gmedia_album_manage' ) ) {
|
2159 |
-
wp_send_json(
|
2160 |
}
|
2161 |
|
2162 |
if ( ! $term_id || ! ( $term_id = $gmDB->term_exists( $term_id ) ) ) {
|
2163 |
-
wp_send_json(
|
2164 |
}
|
2165 |
$term = $gmDB->get_term( $term_id );
|
2166 |
if ( ( (int) $term->global !== (int) $user_ID ) && ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
2167 |
-
wp_send_json(
|
2168 |
}
|
2169 |
|
2170 |
-
$gm_ids_order =
|
2171 |
foreach ( $ids as $id ) {
|
2172 |
$gm_ids_order[ $id ] = $idx0;
|
2173 |
$idx0 ++;
|
@@ -2175,7 +2244,7 @@ function gmedia_term_sortorder() {
|
|
2175 |
|
2176 |
$term_id = $gmDB->update_term_sortorder( $term_id, $gm_ids_order );
|
2177 |
if ( is_wp_error( $term_id ) ) {
|
2178 |
-
wp_send_json(
|
2179 |
}
|
2180 |
|
2181 |
wp_send_json_success( $term_id );
|
@@ -2186,7 +2255,7 @@ function gmedia_upgrade_process() {
|
|
2186 |
|
2187 |
$db_version = get_option( 'gmediaDbVersion' );
|
2188 |
$info = get_transient( 'gmediaHeavyJob' );
|
2189 |
-
$result =
|
2190 |
|
2191 |
$upgrading = get_transient( 'gmediaUpgrade' );
|
2192 |
if ( $upgrading ) {
|
@@ -2202,11 +2271,11 @@ function gmedia_upgrade_process() {
|
|
2202 |
|
2203 |
if ( ! empty( $info ) ) {
|
2204 |
$result['content'] = '<div>' . implode( "</div>\n<div>", $info ) . '</div>';
|
2205 |
-
} elseif (
|
2206 |
$result['status'] = 'done';
|
2207 |
}
|
2208 |
|
2209 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2210 |
echo wp_json_encode( $result );
|
2211 |
die();
|
2212 |
}
|
@@ -2222,14 +2291,15 @@ function gmedia_hash_files() {
|
|
2222 |
$all_count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}gmedia" );
|
2223 |
wp_cache_set( 'gmedia_count_all', $all_count );
|
2224 |
}
|
2225 |
-
$sql
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
|
|
2230 |
$unhashed = $wpdb->get_results( $sql );
|
2231 |
if ( ! $unhashed ) {
|
2232 |
-
$ajax_operations = get_option( 'gmedia_ajax_long_operations',
|
2233 |
unset( $ajax_operations['gmedia_hash_files'] );
|
2234 |
if ( empty( $ajax_operations ) ) {
|
2235 |
delete_option( 'gmedia_ajax_long_operations' );
|
@@ -2238,7 +2308,7 @@ function gmedia_hash_files() {
|
|
2238 |
}
|
2239 |
wp_cache_delete( 'gmedia_count_all' );
|
2240 |
|
2241 |
-
wp_send_json_success(
|
2242 |
}
|
2243 |
|
2244 |
$unhashed_count = $wpdb->get_var( 'SELECT FOUND_ROWS()' );
|
@@ -2247,14 +2317,14 @@ function gmedia_hash_files() {
|
|
2247 |
$fileinfo = $gmCore->fileinfo( $item->gmuid, false );
|
2248 |
$filepath = is_file( $fileinfo['filepath_original'] ) ? $fileinfo['filepath_original'] : $fileinfo['filepath'];
|
2249 |
$hash_file = hash_file( 'md5', $filepath );
|
2250 |
-
$gmDB->update_metadata(
|
2251 |
$file_size = filesize( $filepath );
|
2252 |
-
$gmDB->update_metadata(
|
2253 |
}
|
2254 |
|
2255 |
$progress = round( ( $all_count - $unhashed_count ) * 100 / $all_count );
|
2256 |
|
2257 |
-
wp_send_json_success(
|
2258 |
}
|
2259 |
|
2260 |
add_action( 'wp_ajax_gmedia_recreate_images', 'gmedia_recreate_images' );
|
@@ -2264,7 +2334,7 @@ function gmedia_recreate_images() {
|
|
2264 |
check_ajax_referer( 'gmedia_ajax_long_operations', '_wpnonce_ajax_long_operations' );
|
2265 |
|
2266 |
$gmid = 0;
|
2267 |
-
$ajax_operations = get_option( 'gmedia_ajax_long_operations',
|
2268 |
if ( ! empty( $ajax_operations['gmedia_recreate_images'] ) ) {
|
2269 |
$all_count = count( $ajax_operations['gmedia_recreate_images'] );
|
2270 |
$recreate_ids = array_filter( $ajax_operations['gmedia_recreate_images'] );
|
@@ -2283,15 +2353,15 @@ function gmedia_recreate_images() {
|
|
2283 |
if ( empty( $ajax_operations ) ) {
|
2284 |
delete_option( 'gmedia_ajax_long_operations' );
|
2285 |
|
2286 |
-
wp_send_json_success(
|
2287 |
} else {
|
2288 |
$progress = round( ( $all_count - $do_count ) * 100 / $all_count );
|
2289 |
|
2290 |
-
wp_send_json_success(
|
2291 |
}
|
2292 |
}
|
2293 |
|
2294 |
-
wp_send_json_success(
|
2295 |
}
|
2296 |
|
2297 |
add_action( 'wp_ajax_gmedia_feedback', 'gmedia_feedback' );
|
@@ -2304,15 +2374,15 @@ function gmedia_feedback() {
|
|
2304 |
|
2305 |
if ( ! empty( $data ) ) {
|
2306 |
$current_user = wp_get_current_user();
|
2307 |
-
$title =
|
2308 |
$content = 'Website: ' . home_url() . "\r\n\r\n";
|
2309 |
foreach ( $data as $key => $val ) {
|
2310 |
$content .= ucwords( str_replace( '_', ' ', $key ) ) . ': ' . urldecode( $val ) . "\r\n\r\n";
|
2311 |
}
|
2312 |
-
$headers =
|
2313 |
-
|
2314 |
"Reply-To: {$current_user->display_name} <{$current_user->user_email}>",
|
2315 |
-
|
2316 |
wp_mail( 'codeasily@gmail.com', $title, $content, $headers );
|
2317 |
}
|
2318 |
|
@@ -2332,12 +2402,12 @@ function gmedia_save_waveform() {
|
|
2332 |
$peaks_arr = json_decode( $peaks );
|
2333 |
$peaks_arr = array_filter( $peaks_arr, 'is_numeric' );
|
2334 |
if ( 3600 !== count( $peaks_arr ) ) {
|
2335 |
-
wp_send_json_error(
|
2336 |
}
|
2337 |
|
2338 |
$gmDB->update_metadata( 'gmedia', $id, '_peaks', $peaks );
|
2339 |
do_action( 'clean_gmedia_cache', $id );
|
2340 |
-
wp_send_json_success(
|
2341 |
} else {
|
2342 |
wp_send_json_error();
|
2343 |
}
|
@@ -2348,24 +2418,26 @@ add_action( 'wp_ajax_nopriv_gmedia_module_interaction', 'gmedia_module_interacti
|
|
2348 |
function gmedia_module_interaction() {
|
2349 |
global $gmDB, $gmCore;
|
2350 |
|
2351 |
-
|
2352 |
-
|
|
|
|
|
|
|
|
|
2353 |
die();
|
2354 |
}
|
2355 |
|
2356 |
-
$
|
2357 |
-
|
2358 |
-
if ( ( false === strpos( $ref, get_home_url() ) ) && ( false === strpos( $ref, get_site_url() ) ) ) {
|
2359 |
-
header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request' );
|
2360 |
die();
|
2361 |
}
|
2362 |
-
if ( ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) || ! isset( $_SERVER['HTTP_HOST'] ) || ! strpos( get_home_url(), $
|
2363 |
-
header( $
|
2364 |
die();
|
2365 |
}
|
2366 |
|
2367 |
-
|
2368 |
-
if (
|
2369 |
if ( null === $gmDB->get_gmedia( $gmID ) ) {
|
2370 |
die( '0' );
|
2371 |
}
|
@@ -2375,26 +2447,27 @@ function gmedia_module_interaction() {
|
|
2375 |
$meta = array_map( 'intval', $meta );
|
2376 |
$meta = $gmCore->gm_hitcounter( $gmID, $meta );
|
2377 |
|
2378 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2379 |
echo wp_json_encode( $meta );
|
2380 |
die();
|
2381 |
}
|
2382 |
|
2383 |
-
|
|
|
2384 |
/**
|
2385 |
* @var $uip
|
2386 |
* @var $gmid
|
2387 |
* @var $rate
|
2388 |
*/
|
2389 |
-
extract( $
|
2390 |
if ( ! intval( $gmid ) || ( null === $gmDB->get_gmedia( $gmid ) ) ) {
|
2391 |
die( '0' );
|
2392 |
}
|
2393 |
$rating = $gmDB->get_metadata( 'gmedia', $gmid, '_rating', true );
|
2394 |
-
$rating = wp_parse_args( (array) $rating,
|
2395 |
$old_rate = 0;
|
2396 |
|
2397 |
-
$transient_key = 'gm_rate_day' .
|
2398 |
$transient_value = get_transient( $transient_key );
|
2399 |
if ( false !== $transient_value ) {
|
2400 |
if ( isset( $transient_value[ $uip ][ $gmid ] ) ) {
|
@@ -2402,7 +2475,7 @@ function gmedia_module_interaction() {
|
|
2402 |
}
|
2403 |
$transient_value[ $uip ][ $gmid ] = $rate;
|
2404 |
} else {
|
2405 |
-
$transient_value =
|
2406 |
}
|
2407 |
set_transient( $transient_key, $transient_value, 18 * HOUR_IN_SECONDS );
|
2408 |
|
@@ -2413,8 +2486,8 @@ function gmedia_module_interaction() {
|
|
2413 |
|
2414 |
$gmDB->update_metadata( 'gmedia', $gmid, '_rating', $rating );
|
2415 |
|
2416 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2417 |
-
echo wp_json_encode(
|
2418 |
die();
|
2419 |
}
|
2420 |
|
@@ -2426,25 +2499,9 @@ add_action( 'wp_ajax_nopriv_load_comments', 'gmedia_module_load_comments' );
|
|
2426 |
function gmedia_module_load_comments() {
|
2427 |
global $gmCore;
|
2428 |
|
2429 |
-
/* if(empty($_SERVER['HTTP_REFERER'])) {
|
2430 |
-
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
|
2431 |
-
die();
|
2432 |
-
}
|
2433 |
-
|
2434 |
-
$ref = $_SERVER['HTTP_REFERER'];
|
2435 |
-
//$uip = str_replace('.', '', $_SERVER['REMOTE_ADDR'])
|
2436 |
-
if((false === strpos($ref, get_home_url())) && (false === strpos($ref, get_site_url()))) {
|
2437 |
-
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
|
2438 |
-
die();
|
2439 |
-
}
|
2440 |
-
if(('POST' !== $_SERVER['REQUEST_METHOD']) || !isset($_SERVER['HTTP_HOST']) || !strpos(get_home_url(), $_SERVER['HTTP_HOST'])) {
|
2441 |
-
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
|
2442 |
-
die();
|
2443 |
-
}*/
|
2444 |
-
|
2445 |
check_ajax_referer( 'GmediaGallery' );
|
2446 |
|
2447 |
-
$data = $gmCore->_post( 'data'
|
2448 |
|
2449 |
$post_id = (int) $data['post_id'];
|
2450 |
if ( $post_id ) {
|
@@ -2456,11 +2513,11 @@ function gmedia_module_load_comments() {
|
|
2456 |
$comments_count = 0;
|
2457 |
}
|
2458 |
|
2459 |
-
$result =
|
2460 |
$result['comments_count'] = $comments_count;
|
2461 |
-
$result['content'] =
|
2462 |
|
2463 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2464 |
echo wp_json_encode( $result );
|
2465 |
|
2466 |
die();
|
@@ -2469,7 +2526,7 @@ function gmedia_module_load_comments() {
|
|
2469 |
add_action( 'wp_ajax_gmedia_get_data', 'gmedia_get_data' );
|
2470 |
add_action( 'wp_ajax_nopriv_gmedia_get_data', 'gmedia_get_data' );
|
2471 |
function gmedia_get_data() {
|
2472 |
-
global $gmDB, $gmProcessor, $gmGallery;
|
2473 |
|
2474 |
/** @var $gmProcessorLibrary */
|
2475 |
include_once GMEDIA_ABSPATH . 'admin/processor/class.processor.library.php';
|
@@ -2484,8 +2541,8 @@ function gmedia_get_data() {
|
|
2484 |
}
|
2485 |
|
2486 |
if ( ! empty( $cache_value ) ) {
|
2487 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2488 |
-
echo $cache_value;
|
2489 |
} else {
|
2490 |
$gmedia_query = $gmDB->get_gmedias( $query_args );
|
2491 |
foreach ( $gmedia_query as &$item ) {
|
@@ -2496,8 +2553,9 @@ function gmedia_get_data() {
|
|
2496 |
set_transient( $cache_key, $json_string, $cache_expiration );
|
2497 |
}
|
2498 |
|
2499 |
-
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' )
|
2500 |
-
|
|
|
2501 |
}
|
2502 |
|
2503 |
die();
|
2 |
add_action( 'wp_ajax_gmedia_update_data', 'gmedia_update_data' );
|
3 |
function gmedia_update_data() {
|
4 |
global $gmDB, $gmCore;
|
5 |
+
check_ajax_referer( 'GmediaGallery' );
|
6 |
if ( ! current_user_can( 'gmedia_edit_media' ) ) {
|
7 |
die( '-1' );
|
8 |
}
|
13 |
|
14 |
if ( ! empty( $gmedia['ID'] ) ) {
|
15 |
$item = $gmDB->get_gmedia( $gmedia['ID'] );
|
16 |
+
if ( get_current_user_id() !== (int) $item->author ) {
|
17 |
if ( ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
18 |
die( '-2' );
|
19 |
}
|
29 |
$gmuid = pathinfo( $item->gmuid );
|
30 |
|
31 |
$gmedia['filename'] = preg_replace( '/[^a-z0-9_\.-]+/i', '_', $gmedia['filename'] );
|
32 |
+
if ( ( $gmedia['filename'] !== $gmuid['filename'] ) && ( current_user_can( 'gmedia_delete_others_media' ) || ( get_current_user_id() === (int) $item->author ) ) ) {
|
33 |
$fileinfo = $gmCore->fileinfo( $gmedia['filename'] . '.' . $gmuid['extension'] );
|
34 |
if ( false !== $fileinfo ) {
|
35 |
if ( 'image' === $fileinfo['dirname'] && file_is_displayable_image( $fileinfo['dirpath'] . '/' . $item->gmuid ) ) {
|
51 |
if ( ! is_wp_error( $id ) ) {
|
52 |
// Meta Stuff.
|
53 |
if ( isset( $gmedia['meta'] ) && is_array( $gmedia['meta'] ) ) {
|
54 |
+
$meta_error = array();
|
55 |
foreach ( $gmedia['meta'] as $key => $value ) {
|
56 |
if ( $gmCore->is_digit( $key ) ) {
|
57 |
$mid = (int) $key;
|
58 |
//$value = wp_unslash( $value );
|
59 |
+
$meta = $gmDB->get_metadata_by_mid( 'gmedia', $mid );
|
60 |
+
if ( ! $meta ) {
|
61 |
+
$meta_error[] = array(
|
62 |
'error' => 'no_meta',
|
63 |
'message' => __( 'No record in DataBase.', 'grand-media' ),
|
64 |
'meta_id' => $mid,
|
65 |
'meta_key' => $meta->meta_key,
|
66 |
+
);
|
67 |
continue;
|
68 |
}
|
69 |
if ( '' === trim( $value ) ) {
|
70 |
+
$meta_error[] = array(
|
71 |
'error' => 'empty_value',
|
72 |
'message' => __( 'Please provide a custom field value.', 'grand-media' ),
|
73 |
'meta_id' => $mid,
|
74 |
'meta_key' => $meta->meta_key,
|
75 |
'meta_value' => $meta->meta_value,
|
76 |
+
);
|
77 |
continue;
|
78 |
}
|
79 |
|
80 |
if ( $meta->meta_value !== $value ) {
|
81 |
+
$u = $gmDB->update_metadata_by_mid( 'gmedia', $mid, $value );
|
82 |
+
if ( ! $u ) {
|
83 |
+
$meta_error[] = array(
|
84 |
'error' => 'meta_update',
|
85 |
'message' => __( 'Something goes wrong.', 'grand-media' ),
|
86 |
'meta_id' => $mid,
|
87 |
'meta_key' => $meta->meta_key,
|
88 |
'meta_value' => $meta->meta_value,
|
89 |
+
);
|
90 |
}
|
91 |
}
|
92 |
} elseif ( '_' === $key[0] ) {
|
95 |
} elseif ( '_gps' === $key ) {
|
96 |
if ( $value ) {
|
97 |
$latlng = explode( ',', $value );
|
98 |
+
$value = array( 'lat' => trim( $latlng[0] ), 'lng' => trim( $latlng[1] ) );
|
99 |
}
|
100 |
}
|
101 |
$value = apply_filters( 'gmedia_protected_meta_value', $value, $key, $id );
|
103 |
}
|
104 |
}
|
105 |
}
|
|
|
|
|
|
|
106 |
}
|
107 |
+
$result = $gmDB->get_gmedia( $id );
|
108 |
|
109 |
gmedia_item_more_data( $result );
|
110 |
if ( 'image' !== $result->type ) {
|
119 |
if ( $album ) {
|
120 |
$album = reset( $album );
|
121 |
if ( (int) $gmedia['gmedia_album_order'] !== (int) $album->gmedia_order ) {
|
122 |
+
$gmDB->update_term_sortorder( $album->term_id, array( $id => (int) $gmedia['gmedia_album_order'] ) );
|
123 |
$result->gmedia_album_order = (int) $gmedia['gmedia_album_order'];
|
124 |
}
|
125 |
}
|
136 |
}
|
137 |
gmedia_delete_transients( 'gm_cache' );
|
138 |
|
139 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
140 |
echo wp_json_encode( $result );
|
141 |
}
|
142 |
|
151 |
die( '-1' );
|
152 |
}
|
153 |
|
154 |
+
$gmedia = array();
|
155 |
$fail = '';
|
156 |
$success = '';
|
157 |
$gmid = $gmCore->_post( 'id' );
|
160 |
|
161 |
$item = $gmDB->get_gmedia( $gmid );
|
162 |
if ( ! empty( $item ) ) {
|
163 |
+
if ( get_current_user_id() !== (int) $item->author ) {
|
164 |
if ( ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
165 |
die( '-2' );
|
166 |
}
|
181 |
$size = @getimagesize( $fileinfo['filepath'] );
|
182 |
|
183 |
do {
|
184 |
+
$extensions = array( '1' => 'GIF', '2' => 'JPG', '3' => 'PNG', '6' => 'BMP' );
|
185 |
if ( function_exists( 'memory_get_usage' ) ) {
|
186 |
switch ( $extensions[ $size[2] ] ) {
|
187 |
case 'GIF':
|
198 |
$CHANNEL = 6;
|
199 |
break;
|
200 |
}
|
201 |
+
$MB = 1048576; // number of bytes in 1M.
|
202 |
+
$K64 = 65536; // number of bytes in 64K.
|
203 |
+
$TWEAKFACTOR = 1.8; // Or whatever works for you.
|
204 |
$memoryNeeded = round( ( $size[0] * $size[1] * $size['bits'] * $CHANNEL / 8 + $K64 ) * $TWEAKFACTOR );
|
205 |
$memoryNeeded = memory_get_usage() + $memoryNeeded;
|
206 |
$current_limit = @ini_get( 'memory_limit' );
|
212 |
$current_limit_int *= 1024;
|
213 |
}
|
214 |
|
215 |
+
if ( - 1 !== (int) $current_limit && $memoryNeeded > $current_limit_int ) {
|
216 |
$newLimit = $current_limit_int / $MB + ceil( ( $memoryNeeded - $current_limit_int ) / $MB );
|
217 |
if ( $newLimit < 256 ) {
|
218 |
$newLimit = 256;
|
231 |
@copy( $editfile, $fileinfo['filepath_original'] );
|
232 |
}
|
233 |
}
|
234 |
+
|
235 |
+
global $wp_filesystem;
|
236 |
+
if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) {
|
237 |
+
require_once ABSPATH . 'wp-admin/includes/file.php';
|
238 |
+
$creds = request_filesystem_credentials( site_url() );
|
239 |
+
wp_filesystem( $creds );
|
240 |
+
}
|
241 |
+
|
242 |
+
if ( ! $wp_filesystem->put_contents( $editfile, $image['data'] ) ) {
|
243 |
+
$fail = $fileinfo['basename'] . ': ' . __( 'Can\'t write to file. Permission denied', 'grand-media' );
|
244 |
break;
|
245 |
}
|
246 |
|
247 |
$modified = isset( $meta['_modified'][0] ) ? ( intval( $meta['_modified'][0] ) + 1 ) : 1;
|
248 |
+
$gmDB->update_metadata( 'gmedia', $item->ID, '_modified', $modified );
|
249 |
|
250 |
// Web-image.
|
251 |
if ( 'thumb' !== $applyto ) {
|
259 |
// Thumbnail.
|
260 |
if ( 'web_thumb' === $applyto ) {
|
261 |
$size_ratio = $size[0] / $size[1];
|
262 |
+
$thumbimg['resize'] = ( ( ( 1 >= $size_ratio ) && ( $thumbimg['width'] > $size[0] ) ) || ( ( 1 <= $size_ratio ) && ( $thumbimg['height'] > $size[1] ) ) );
|
263 |
if ( $thumbimg['resize'] ) {
|
264 |
$editor = wp_get_image_editor( $editfile );
|
265 |
if ( is_wp_error( $editor ) ) {
|
266 |
+
$fail = $fileinfo['basename'] . ' (wp_get_image_editor): ' . $editor->get_error_message();
|
267 |
break;
|
268 |
}
|
269 |
|
276 |
$resized = $editor->resize( 0, $thumbimg['height'], $thumbimg['crop'] );
|
277 |
}
|
278 |
if ( is_wp_error( $resized ) ) {
|
279 |
+
$fail = $fileinfo['basename'] . ' (' . $resized->get_error_code() . " | editor->resize->thumb({$thumbimg['width']}, {$thumbimg['height']}, {$thumbimg['crop']})) applyto-{$applyto}: " . $resized->get_error_message();
|
280 |
break;
|
281 |
}
|
282 |
|
290 |
if ( $thumbis ) {
|
291 |
rename( $fileinfo['filepath_thumb'] . '.tmp', $fileinfo['filepath_thumb'] );
|
292 |
}
|
293 |
+
$fail = $fileinfo['basename'] . ' (' . $saved->get_error_code() . ' | editor->save->thumb): ' . $saved->get_error_message();
|
294 |
break;
|
295 |
}
|
|
|
296 |
} else {
|
297 |
@copy( $fileinfo['filepath'], $fileinfo['filepath_thumb'] );
|
298 |
}
|
299 |
}
|
300 |
|
|
|
301 |
$id = $gmDB->insert_gmedia( $gmedia );
|
302 |
|
303 |
$new_metadata = $gmDB->generate_gmedia_metadata( $id, $fileinfo );
|
305 |
$metadata['original'] = $new_metadata['original'];
|
306 |
$metadata['thumb'] = $new_metadata['thumb'];
|
307 |
|
308 |
+
$gmDB->update_metadata( 'gmedia', $id, '_metadata', $metadata );
|
309 |
|
310 |
+
// translators: ID.
|
311 |
$success = sprintf( __( 'Image "%d" updated', 'grand-media' ), $id );
|
312 |
} while ( 0 );
|
313 |
|
314 |
if ( empty( $fail ) ) {
|
315 |
+
$out = array( 'msg' => $gmCore->alert( 'info', $success ), 'modified' => $gmedia['modified'] );
|
316 |
} else {
|
317 |
+
$out = array( 'error' => $gmCore->alert( 'danger', $fail ) );
|
318 |
}
|
319 |
|
320 |
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
|
344 |
add_action( 'wp_ajax_gmedia_get_modal', 'gmedia_get_modal' );
|
345 |
function gmedia_get_modal() {
|
346 |
global $gmDB, $gmCore, $gmGallery;
|
347 |
+
check_ajax_referer( 'GmediaGallery' );
|
348 |
$user_ID = get_current_user_id();
|
349 |
$button_class = 'btn-primary';
|
350 |
+
$gm_terms = array();
|
351 |
$modal = $gmCore->_post( 'modal' );
|
352 |
$ckey = $gmCore->_post( 'ckey' );
|
353 |
switch ( $modal ) {
|
416 |
die( '-1' );
|
417 |
}
|
418 |
$button_class = 'btn-danger';
|
419 |
+
$modal_title = __( /** @lang text */ 'Delete Tags from Selected Items', 'grand-media' );
|
420 |
$modal_button = __( 'Delete Tags', 'grand-media' );
|
421 |
break;
|
422 |
case 'custom_filter':
|
452 |
break;
|
453 |
}
|
454 |
|
455 |
+
$ref = ! isset( $_SERVER['HTTP_REFERER'] ) ? esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : '';
|
456 |
+
$form_action = ! empty( $ref ) ? $gmCore->get_admin_url( array(), array(), $ref ) : '';
|
457 |
|
458 |
// @formatter:off
|
459 |
?>
|
460 |
<form class="modal-content" id="ajax-modal-form" autocomplete="off" method="post" action="<?php echo esc_url( $form_action ); ?>">
|
461 |
<div class="modal-header">
|
|
|
462 |
<h4 class="modal-title"><?php echo esc_html( $modal_title ); ?></h4>
|
463 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
464 |
</div>
|
465 |
<div class="modal-body">
|
466 |
<?php
|
468 |
case 'quick_gallery':
|
469 |
case 'quick_gallery_stack':
|
470 |
if ( ! empty( $ckey ) ) {
|
471 |
+
$selected_in_library = isset( $_COOKIE[ $ckey ] ) ? str_replace( '.', ',', sanitize_text_field( wp_unslash( $_COOKIE[ $ckey ] ) ) ) : '';
|
472 |
}
|
473 |
if ( empty( $selected_in_library ) ) {
|
474 |
+
esc_html_e( 'No selected Gmedia. Select at least one item in library.', 'grand-media' );
|
475 |
break;
|
476 |
}
|
477 |
$gmedia_modules = get_gmedia_modules( false );
|
478 |
?>
|
479 |
<div class="form-group">
|
480 |
+
<label><?php esc_html_e( 'Gallery Name', 'grand-media' ); ?></label>
|
481 |
+
<input type="text" class="form-control input-sm" name="gallery[name]" placeholder="<?php esc_attr_e( 'Gallery Name', 'grand-media' ); ?>" value="" required="required"/>
|
482 |
</div>
|
483 |
<div class="form-group">
|
484 |
+
<label><?php esc_html_e( 'Modue', 'grand-media' ); ?></label>
|
485 |
<select class="form-control input-sm" name="gallery[module]">
|
486 |
+
<?php
|
487 |
+
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
488 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
489 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $mfold ) );
|
490 |
$selected = selected( $gmGallery->options['default_gmedia_module'], esc_attr( $mfold ), false );
|
491 |
+
$option = array();
|
492 |
+
$option[] = '<option ' . $selected . ' value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title'] . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
493 |
foreach ( $presets as $preset ) {
|
494 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
495 |
continue;
|
500 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
501 |
}
|
502 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
503 |
+
$option[] = '<option ' . $selected . ' value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
504 |
} else {
|
505 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
506 |
+
$option[] = '<option ' . $selected . ' value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
507 |
}
|
508 |
}
|
509 |
+
echo wp_kses_post( implode( '', $option ) );
|
510 |
echo '</optgroup>';
|
511 |
+
}
|
512 |
+
?>
|
513 |
</select>
|
514 |
</div>
|
515 |
<div class="form-group">
|
516 |
+
<label><?php esc_html_e( 'Selected IDs', 'grand-media' ); ?></label>
|
517 |
<input type="text" name="gallery[query][gmedia__in]" class="form-control input-sm" value="<?php echo esc_attr( $selected_in_library ); ?>" required="required"/>
|
518 |
</div>
|
519 |
<?php
|
521 |
case 'exclude_albums':
|
522 |
case 'filter_albums':
|
523 |
if ( $gmCore->caps['gmedia_show_others_media'] ) {
|
524 |
+
$args = array();
|
525 |
} else {
|
526 |
+
$args = array(
|
527 |
+
'global' => array( 0, $user_ID ),
|
528 |
'orderby' => 'global_desc_name',
|
529 |
+
);
|
530 |
}
|
531 |
$gm_terms = $gmDB->get_terms( 'gmedia_album', $args );
|
532 |
?>
|
533 |
+
<div class="checkbox"><label><input type="checkbox" name="alb[]" value="0"> <?php esc_html_e( 'No Album', 'grand-media' ); ?></label></div>
|
534 |
<hr/>
|
535 |
<?php
|
536 |
+
if ( count( $gm_terms ) ) {
|
537 |
+
foreach ( $gm_terms as $term ) {
|
538 |
+
$author_name = '';
|
539 |
+
if ( $term->global ) {
|
540 |
+
if ( $gmCore->caps['gmedia_show_others_media'] ) {
|
541 |
+
// translators: author name.
|
542 |
+
$author_name .= sprintf( esc_html__( 'by %s', 'grand-media' ), esc_html( get_the_author_meta( 'display_name', $term->global ) ) );
|
543 |
+
}
|
544 |
+
} else {
|
545 |
+
$author_name .= '(' . esc_html__( 'shared', 'grand-media' ) . ')';
|
546 |
}
|
547 |
+
if ( 'publish' !== $term->status ) {
|
548 |
+
$author_name .= ' [' . $term->status . ']';
|
549 |
+
}
|
550 |
+
if ( $author_name ) {
|
551 |
+
$author_name = " <small>{$author_name}</small>";
|
552 |
+
}
|
553 |
+
?>
|
|
|
|
|
|
|
554 |
<div class="checkbox">
|
555 |
+
<label><input type="checkbox" name="alb[]" value="<?php echo absint( $term->term_id ); ?>"> <?php echo wp_kses_post( $term->name . $author_name ); ?></label>
|
556 |
+
<span class="badge badge-info float-end"><?php echo absint( $term->count ); ?></span>
|
557 |
</div>
|
558 |
+
<?php
|
559 |
+
}
|
560 |
+
} else {
|
561 |
+
$modal_button = false;
|
562 |
}
|
|
|
|
|
|
|
563 |
break;
|
564 |
case 'assign_album':
|
565 |
if ( $gmCore->caps['gmedia_edit_others_media'] ) {
|
566 |
+
$args = array();
|
567 |
} else {
|
568 |
+
$args = array(
|
569 |
+
'global' => array( 0, $user_ID ),
|
570 |
'orderby' => 'global_desc_name',
|
571 |
+
);
|
572 |
}
|
573 |
$gm_terms = $gmDB->get_terms( 'gmedia_album', $args );
|
574 |
|
578 |
$author_name = '';
|
579 |
if ( $term->global ) {
|
580 |
if ( $gmCore->caps['gmedia_edit_others_media'] ) {
|
581 |
+
// translators: author name.
|
582 |
+
$author_name .= ' ' . sprintf( __( 'by %s', 'grand-media' ), get_the_author_meta( 'display_name', $term->global ) );
|
583 |
}
|
584 |
} else {
|
585 |
$author_name .= ' (' . __( 'shared', 'grand-media' ) . ')';
|
587 |
if ( 'publish' !== $term->status ) {
|
588 |
$author_name .= ' [' . $term->status . ']';
|
589 |
}
|
590 |
+
$terms_album .= '<option value="' . intval( $term->term_id ) . '" data-count="' . intval( $term->count ) . '" data-name="' . esc_attr( $term->name ) . '" data-meta="' . esc_attr( $author_name ) . '">' . wp_kses_post( $term->name . $author_name ) . '</option>' . "\n";
|
591 |
}
|
592 |
}
|
593 |
?>
|
594 |
<div class="form-group">
|
595 |
+
<label><?php esc_html_e( 'Move to Album', 'grand-media' ); ?> </label>
|
596 |
+
<select id="combobox_gmedia_album" name="alb" class="form-control" placeholder="<?php esc_attr_e( 'Album Name...', 'grand-media' ); ?>">
|
597 |
<option></option>
|
598 |
+
<option value="0"><?php esc_html_e( 'No Album', 'grand-media' ); ?></option>
|
599 |
+
<?php echo wp_kses_post( $terms_album ); ?>
|
600 |
</select>
|
601 |
+
<small class="help-block" style="margin-top:0;"><?php esc_html_e( 'Choose "No Album" to delete albums from selected items', 'grand-media' ); ?></small>
|
602 |
</div>
|
603 |
<div class="form-group">
|
604 |
<div class="checkbox">
|
605 |
+
<label><input type="checkbox" name="status_global" value="1" checked> <?php esc_html_e( 'Make status of selected items be the same as Album status', 'grand-media' ); ?>
|
606 |
</label></div>
|
607 |
</div>
|
608 |
<script type="text/javascript">
|
611 |
var albums_data = $('option', albums);
|
612 |
//noinspection JSDuplicatedDeclaration
|
613 |
albums.selectize({
|
614 |
+
<?php if ( $gmCore->caps['gmedia_album_manage'] ) { ?>
|
615 |
create: function(input) {
|
616 |
return {
|
617 |
value: input,
|
619 |
};
|
620 |
},
|
621 |
createOnBlur: true,
|
622 |
+
<?php } else { ?>
|
623 |
create: false,
|
624 |
<?php } ?>
|
625 |
persist: false,
|
635 |
},
|
636 |
option: function(item, escape) {
|
637 |
if (0 === (parseInt(item.value) || 0)) {
|
638 |
+
return '<div class="option">' + escape(item.text) + '</div>';
|
639 |
}
|
640 |
if (item.$order) {
|
641 |
var data = $(albums_data[item.$order]).data();
|
642 |
+
return '<div class="option">' + escape(data.name) + ' <small>' + escape(data.meta) + '</small>' + ' <span class="badge badge-info float-end">' + escape(data.count) + '</span></div>';
|
643 |
}
|
644 |
}
|
645 |
}
|
652 |
case 'filter_categories':
|
653 |
$gm_terms = $gmDB->get_terms( 'gmedia_category' );
|
654 |
?>
|
655 |
+
<div class="checkbox"><label><input type="checkbox" name="cat[]" value="0"> <?php esc_html_e( 'Uncategorized', 'grand-media' ); ?></label></div>
|
656 |
<?php
|
657 |
if ( count( $gm_terms ) ) {
|
658 |
foreach ( $gm_terms as $term ) {
|
660 |
?>
|
661 |
<div class="checkbox">
|
662 |
<label><input type="checkbox" name="cat[]" value="<?php echo absint( $term->term_id ); ?>"> <?php echo esc_html( $term->name ); ?></label>
|
663 |
+
<span class="badge badge-info float-end"><?php echo absint( $term->count ); ?></span>
|
664 |
</div>
|
665 |
<?php
|
666 |
}
|
668 |
}
|
669 |
break;
|
670 |
case 'assign_category':
|
671 |
+
$gm_terms = $gmDB->get_terms( 'gmedia_category', array( 'fields' => 'names_count' ) );
|
672 |
$gm_terms = array_values( $gm_terms );
|
673 |
?>
|
674 |
<div class="form-group">
|
675 |
+
<input id="combobox_gmedia_category" name="cat_names" class="form-control input-sm" value="" placeholder="<?php esc_attr_e( 'Add to Categories...', 'grand-media' ); ?>"/>
|
676 |
</div>
|
677 |
<script type="text/javascript">
|
678 |
jQuery(function($) {
|
693 |
searchField: ['name'],
|
694 |
valueField: 'name',
|
695 |
persist: false,
|
696 |
+
<?php if ( $gmCore->caps['gmedia_category_manage'] ) { ?>
|
697 |
createOnBlur: true,
|
698 |
create: function(input) {
|
699 |
return {
|
700 |
name: input
|
701 |
};
|
702 |
},
|
703 |
+
<?php } else { ?>
|
704 |
create: false,
|
705 |
<?php } ?>
|
706 |
render: {
|
708 |
return '<div>' + escape(item.name) + '</div>';
|
709 |
},
|
710 |
option: function(item, escape) {
|
711 |
+
return '<div class="option">' + escape(item.name) + ' <span class="badge badge-info float-end">' + escape(item.count) + '</span></div>';
|
712 |
}
|
713 |
}
|
714 |
});
|
718 |
break;
|
719 |
case 'unassign_category':
|
720 |
// get selected items in Gmedia Library.
|
721 |
+
$selected_items = ! empty( $ckey ) ? array_filter( explode( '.', sanitize_text_field( wp_unslash( $_COOKIE[ $ckey ] ) ) ), 'is_numeric' ) : false;
|
722 |
if ( ! empty( $selected_items ) ) {
|
723 |
$gm_terms = $gmDB->get_gmedia_terms( $selected_items, 'gmedia_category' );
|
724 |
}
|
725 |
+
if ( count( $gm_terms ) ) {
|
726 |
+
foreach ( $gm_terms as $term ) {
|
727 |
+
?>
|
728 |
<div class="checkbox">
|
729 |
<label><input type="checkbox" name="category_id[]" value="<?php echo absint( $term->term_id ); ?>"> <?php echo esc_html( $term->name ); ?></label>
|
730 |
+
<span class="badge badge-info float-end"><?php echo absint( $term->count ); ?></span>
|
731 |
</div>
|
732 |
<?php
|
733 |
}
|
734 |
} else {
|
735 |
+
$modal_button = false;
|
736 |
+
?>
|
737 |
+
<p class="noterms"><?php esc_html_e( 'No categories', 'grand-media' ); ?></p>
|
738 |
<?php
|
739 |
}
|
740 |
break;
|
741 |
case 'exclude_tags':
|
742 |
case 'filter_tags':
|
743 |
+
$gm_terms = $gmDB->get_terms( 'gmedia_tag', array( 'fields' => 'names_count' ) );
|
744 |
$gm_terms = array_values( $gm_terms );
|
745 |
+
if ( count( $gm_terms ) ) {
|
746 |
+
?>
|
747 |
<div class="form-group">
|
748 |
+
<input id="combobox_gmedia_tag" name="tag_ids" class="form-control input-sm" value="" placeholder="<?php esc_attr_e( 'Filter Tags...', 'grand-media' ); ?>"/>
|
749 |
</div>
|
750 |
<script type="text/javascript">
|
751 |
jQuery(function($) {
|
752 |
+
var gm_terms = <?php echo wp_json_encode( $gm_terms ); ?>;
|
753 |
//noinspection JSUnusedAssignment
|
754 |
var items = gm_terms.map(function(x) {
|
755 |
//noinspection JSUnresolvedVariable
|
770 |
return '<div>' + escape(item.name) + '</div>';
|
771 |
},
|
772 |
option: function(item, escape) {
|
773 |
+
return '<div class="option">' + escape(item.name) + ' <span class="badge badge-info float-end">' + escape(item.count) + '</span></div>';
|
774 |
}
|
775 |
}
|
776 |
});
|
780 |
} else {
|
781 |
$modal_button = false;
|
782 |
?>
|
783 |
+
<p class="noterms"><?php esc_html_e( 'No tags', 'grand-media' ); ?></p>
|
784 |
<?php
|
785 |
}
|
786 |
break;
|
787 |
case 'add_tags':
|
788 |
+
$gm_terms = $gmDB->get_terms( 'gmedia_tag', array( 'fields' => 'names_count' ) );
|
789 |
$gm_terms = array_values( $gm_terms );
|
790 |
?>
|
791 |
<div class="form-group">
|
792 |
+
<input id="combobox_gmedia_tag" name="tag_names" class="form-control input-sm" value="" placeholder="<?php esc_attr_e( 'Add Tags...', 'grand-media' ); ?>"/>
|
793 |
</div>
|
794 |
<div class="checkbox">
|
795 |
+
<label><input type="checkbox" name="iptc_tags" value="1"> <?php esc_html_e( 'Import IPTC Keywords from selected images to Tags' ); ?></label>
|
796 |
</div>
|
797 |
<script type="text/javascript">
|
798 |
jQuery(function($) {
|
799 |
+
var gm_terms = <?php echo wp_json_encode( $gm_terms ); ?>;
|
800 |
//noinspection JSUnusedAssignment
|
801 |
var items = gm_terms.map(function(x) {
|
802 |
//noinspection JSUnresolvedVariable
|
813 |
searchField: ['name'],
|
814 |
valueField: 'name',
|
815 |
persist: false,
|
816 |
+
<?php if ( $gmCore->caps['gmedia_tag_manage'] ) { ?>
|
817 |
createOnBlur: true,
|
818 |
create: function(input) {
|
819 |
return {
|
820 |
name: input
|
821 |
};
|
822 |
},
|
823 |
+
<?php } else { ?>
|
824 |
create: false,
|
825 |
<?php } ?>
|
826 |
render: {
|
828 |
return '<div>' + escape(item.name) + '</div>';
|
829 |
},
|
830 |
option: function(item, escape) {
|
831 |
+
return '<div class="option">' + escape(item.name) + ' <span class="badge badge-info float-end">' + escape(item.count) + '</span></div>';
|
832 |
}
|
833 |
}
|
834 |
});
|
838 |
break;
|
839 |
case 'delete_tags':
|
840 |
// get selected items in Gmedia Library.
|
841 |
+
$selected_items = ! empty( $ckey ) ? array_filter( explode( '.', sanitize_text_field( wp_unslash( $_COOKIE[ $ckey ] ) ) ), 'is_numeric' ) : false;
|
842 |
if ( ! empty( $selected_items ) ) {
|
843 |
$gm_terms = $gmDB->get_gmedia_terms( $selected_items, 'gmedia_tag' );
|
844 |
}
|
845 |
+
if ( count( $gm_terms ) ) {
|
846 |
+
foreach ( $gm_terms as $term ) {
|
847 |
+
?>
|
848 |
<div class="checkbox">
|
849 |
<label><input type="checkbox" name="tag_id[]" value="<?php echo absint( $term->term_id ); ?>"> <?php echo esc_html( $term->name ); ?></label>
|
850 |
+
<span class="badge badge-info float-end"><?php echo absint( $term->count ); ?></span>
|
851 |
</div>
|
852 |
<?php
|
853 |
}
|
854 |
} else {
|
855 |
$modal_button = false;
|
856 |
?>
|
857 |
+
<p class="noterms"><?php esc_html_e( 'No tags', 'grand-media' ); ?></p>
|
858 |
<?php
|
859 |
}
|
860 |
break;
|
861 |
case 'filter_author':
|
862 |
case 'select_author':
|
863 |
+
if ( $gmCore->caps['gmedia_show_others_media'] ) {
|
864 |
+
?>
|
865 |
<div class="form-group">
|
866 |
+
<label><?php esc_html_e( 'Choose Author', 'grand-media' ); ?></label>
|
867 |
<?php
|
868 |
$user_ids = $gmCore->get_editable_user_ids();
|
869 |
if ( $user_ids ) {
|
870 |
if ( ! in_array( $user_ID, $user_ids, true ) ) {
|
871 |
+
$user_ids[] = $user_ID;
|
872 |
}
|
873 |
+
wp_dropdown_users(
|
874 |
+
array(
|
875 |
+
'show_option_all' => ' — ',
|
876 |
+
'include' => $user_ids,
|
877 |
+
'include_selected' => true,
|
878 |
+
'name' => 'author_ids',
|
879 |
+
'selected' => $user_ID,
|
880 |
+
'class' => 'form-control combobox_authors',
|
881 |
+
)
|
882 |
+
);
|
883 |
} else {
|
884 |
+
echo '<div>' . esc_html( get_the_author_meta( 'display_name', $user_ID ) ) . '</div>';
|
885 |
}
|
886 |
?>
|
887 |
</div>
|
897 |
</script>
|
898 |
<?php
|
899 |
} else {
|
900 |
+
echo '<p>' . esc_html__( 'You are not allowed to see others media' ) . '</p>';
|
901 |
+
echo '<p><strong>' . esc_html( get_the_author_meta( 'display_name', $user_ID ) ) . '</strong></p>';
|
902 |
}
|
903 |
break;
|
904 |
case 'batch_edit':
|
905 |
?>
|
906 |
+
<p><?php esc_html_e( 'Note, data will be saved to all selected items in Gmedia Library.' ); ?></p>
|
907 |
<div class="form-group">
|
908 |
+
<label><?php esc_html_e( 'Filename', 'grand-media' ); ?></label>
|
909 |
<select class="form-control input-sm batch_set" name="batch_filename">
|
910 |
+
<option value=""><?php esc_html_e( 'Skip. Do not change', 'grand-media' ); ?></option>
|
911 |
+
<option value="custom"><?php esc_html_e( 'Custom', 'grand-media' ); ?></option>
|
912 |
</select>
|
913 |
|
914 |
<div class="batch_set_custom" style="margin-top:5px;display:none;">
|
915 |
<input class="form-control input-sm" name="batch_filename_custom" value="" placeholder="<?php echo esc_attr( 'newname_{id}' ); ?>"/>
|
916 |
|
917 |
+
<div><?php echo wp_kses_post( 'Variables: <b>{filename}</b> - original file name; <b>{id}</b> - Gmedia #ID in database; <b>{index:001}</b> - index of selected file in order you select (set start number after colon).' ); ?></div>
|
918 |
</div>
|
919 |
</div>
|
920 |
<div class="form-group">
|
921 |
+
<label><?php esc_html_e( 'Title', 'grand-media' ); ?></label>
|
922 |
<select class="form-control input-sm batch_set" name="batch_title">
|
923 |
+
<option value=""><?php esc_html_e( 'Skip. Do not change', 'grand-media' ); ?></option>
|
924 |
+
<option value="empty"><?php esc_html_e( 'Empty Title', 'grand-media' ); ?></option>
|
925 |
+
<option value="filename"><?php esc_html_e( 'From Filename', 'grand-media' ); ?></option>
|
926 |
+
<option value="custom"><?php esc_html_e( 'Custom', 'grand-media' ); ?></option>
|
927 |
</select>
|
928 |
+
<input class="form-control input-sm batch_set_custom" style="margin-top:5px;display:none;" name="batch_title_custom" value="" placeholder="<?php esc_attr_e( 'Enter custom title here', 'grand-media' ); ?>"/>
|
929 |
</div>
|
930 |
<div class="form-group">
|
931 |
+
<label><?php esc_html_e( 'Description', 'grand-media' ); ?></label>
|
932 |
<select class="form-control input-sm batch_set" name="batch_description">
|
933 |
+
<option value=""><?php esc_html_e( 'Skip. Do not change', 'grand-media' ); ?></option>
|
934 |
+
<option value="metadata"><?php esc_html_e( 'Add MetaInfo to Description', 'grand-media' ); ?></option>
|
935 |
+
<option value="empty"><?php esc_html_e( 'Empty Description', 'grand-media' ); ?></option>
|
936 |
+
<option value="custom"><?php esc_html_e( 'Custom', 'grand-media' ); ?></option>
|
937 |
</select>
|
938 |
|
939 |
<div class="batch_set_custom" style="margin-top:5px;display:none;">
|
940 |
<select class="form-control input-sm" name="what_description_custom" style="margin-bottom:5px;">
|
941 |
+
<option value="replace"><?php esc_html_e( 'Replace', 'grand-media' ); ?></option>
|
942 |
+
<option value="append"><?php esc_html_e( 'Append', 'grand-media' ); ?></option>
|
943 |
+
<option value="prepend"><?php esc_html_e( 'Prepend', 'grand-media' ); ?></option>
|
944 |
</select>
|
945 |
+
<textarea class="form-control input-sm" cols="30" rows="3" name="batch_description_custom" placeholder="<?php esc_attr_e( 'Enter description here', 'grand-media' ); ?>"></textarea>
|
946 |
</div>
|
947 |
</div>
|
948 |
<div class="form-group">
|
949 |
+
<label><?php esc_html_e( 'Link', 'grand-media' ); ?></label>
|
950 |
<select class="form-control input-sm batch_set" name="batch_link">
|
951 |
+
<option value=""><?php esc_html_e( 'Skip. Do not change', 'grand-media' ); ?></option>
|
952 |
+
<option value="empty"><?php esc_html_e( 'Empty Link', 'grand-media' ); ?></option>
|
953 |
+
<option value="self"><?php esc_html_e( 'Link to original file', 'grand-media' ); ?></option>
|
954 |
+
<option value="custom"><?php esc_html_e( 'Custom', 'grand-media' ); ?></option>
|
955 |
</select>
|
956 |
+
<input class="form-control input-sm batch_set_custom" style="margin-top:5px;display:none;" name="batch_link_custom" value="" placeholder="<?php esc_attr_e( 'Enter url here' ); ?>"/>
|
957 |
</div>
|
958 |
<div class="form-group">
|
959 |
+
<label><?php esc_html_e( 'Status', 'grand-media' ); ?></label>
|
960 |
<select class="form-control input-sm batch_set" name="batch_status">
|
961 |
+
<option value=""><?php esc_html_e( 'Skip. Do not change', 'grand-media' ); ?></option>
|
962 |
+
<option value="publish"><?php esc_html_e( 'Public', 'grand-media' ); ?></option>
|
963 |
+
<option value="private"><?php esc_html_e( 'Private', 'grand-media' ); ?></option>
|
964 |
+
<option value="draft"><?php esc_html_e( 'Draft', 'grand-media' ); ?></option>
|
965 |
</select>
|
966 |
</div>
|
967 |
<div class="form-group">
|
968 |
+
<label><?php esc_html_e( 'Comment Status', 'grand-media' ); ?></label>
|
969 |
<select class="form-control input-sm batch_set" name="batch_comment_status">
|
970 |
+
<option value=""><?php esc_html_e( 'Skip. Do not change', 'grand-media' ); ?></option>
|
971 |
+
<option value="open"><?php esc_html_e( 'Open', 'grand-media' ); ?></option>
|
972 |
+
<option value="closed"><?php esc_html_e( 'Closed', 'grand-media' ); ?></option>
|
973 |
</select>
|
974 |
</div>
|
975 |
+
<?php
|
976 |
+
$user_ids = current_user_can( 'gmedia_delete_others_media' ) ? $gmCore->get_editable_user_ids() : false;
|
977 |
if ( $user_ids ) {
|
978 |
if ( ! in_array( $user_ID, $user_ids, true ) ) {
|
979 |
+
$user_ids[] = $user_ID;
|
980 |
}
|
981 |
?>
|
982 |
<div class="form-group">
|
983 |
+
<label><?php esc_html_e( 'Author', 'grand-media' ); ?></label>
|
984 |
+
<?php
|
985 |
+
wp_dropdown_users(
|
986 |
+
array(
|
987 |
+
'show_option_none' => __( 'Skip. Do not change', 'grand-media' ),
|
988 |
+
'include' => $user_ids,
|
989 |
+
'include_selected' => true,
|
990 |
+
'name' => 'batch_author',
|
991 |
+
'selected' => - 1,
|
992 |
+
'class' => 'input-sm form-control',
|
993 |
+
)
|
994 |
+
);
|
995 |
?>
|
996 |
</div>
|
997 |
<?php
|
1012 |
<?php
|
1013 |
break;
|
1014 |
default:
|
1015 |
+
esc_html_e( 'Ops! Something wrong.', 'grand-media' );
|
1016 |
break;
|
1017 |
}
|
1018 |
?>
|
1019 |
</div>
|
1020 |
<div class="modal-footer">
|
1021 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Cancel', 'grand-media' ); ?></button>
|
1022 |
<?php if ( $modal_button ) { ?>
|
1023 |
<input type="hidden" name="<?php echo esc_attr( $modal ); ?>"/>
|
1024 |
<button type="button" onclick="jQuery('#ajax-modal-form').submit()" class="btn <?php echo esc_attr( $button_class ); ?>"><?php echo esc_html( $modal_button ); ?></button>
|
1039 |
|
1040 |
check_ajax_referer( 'gmedia_terms', '_wpnonce_terms' );
|
1041 |
if ( ! current_user_can( 'gmedia_tag_manage' ) && ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
1042 |
+
$out['error'] = $gmCore->alert( 'danger', __( 'You are not allowed to edit others media', 'grand-media' ) );
|
1043 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
1044 |
echo wp_json_encode( $out );
|
1045 |
die();
|
1046 |
}
|
1047 |
|
1048 |
+
$term = array( 'taxonomy' => 'gmedia_tag' );
|
1049 |
$term['name'] = trim( $gmCore->_post( 'tag_name', '' ) );
|
1050 |
$term['term_id'] = intval( $gmCore->_post( 'tag_id', 0 ) );
|
1051 |
if ( $term['name'] && ! $gmCore->is_digit( $term['name'] ) ) {
|
1052 |
+
if ( $gmDB->term_exists( $term['term_id'] ) ) {
|
1053 |
if ( ! $gmDB->term_exists( $term['name'], $term['taxonomy'] ) ) {
|
1054 |
$term_id = $gmDB->update_term( $term['term_id'], $term );
|
1055 |
if ( is_wp_error( $term_id ) ) {
|
1056 |
$out['error'] = $gmCore->alert( 'danger', $term_id->get_error_message() );
|
1057 |
} else {
|
1058 |
+
// translators: ID.
|
1059 |
+
$out['msg'] = $gmCore->alert( 'info', sprintf( esc_html__( 'Tag #%d successfully updated', 'grand-media' ), $term_id ) );
|
1060 |
}
|
1061 |
} else {
|
1062 |
+
$out['error'] = $gmCore->alert( 'danger', esc_html__( 'A term with the name provided already exists', 'grand-media' ) );
|
1063 |
}
|
1064 |
} else {
|
1065 |
+
$out['error'] = $gmCore->alert( 'danger', esc_html__( 'A term with the id provided does not exists', 'grand-media' ) );
|
1066 |
}
|
1067 |
} else {
|
1068 |
+
$out['error'] = $gmCore->alert( 'danger', esc_html__( "Term name can't be only digits or empty", 'grand-media' ) );
|
1069 |
}
|
1070 |
|
1071 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
1072 |
echo wp_json_encode( $out );
|
1073 |
|
1074 |
die();
|
1078 |
add_action( 'wp_ajax_gmedia_module_preset_delete', 'gmedia_module_preset_delete' );
|
1079 |
function gmedia_module_preset_delete() {
|
1080 |
global $gmCore, $gmDB, $user_ID;
|
1081 |
+
$out = array( 'error' => '' );
|
1082 |
|
1083 |
check_ajax_referer( 'GmediaGallery' );
|
1084 |
if ( ! current_user_can( 'gmedia_gallery_manage' ) ) {
|
1085 |
+
$out['error'] = $gmCore->alert( 'danger', esc_html__( 'You are not allowed to manage galleries', 'grand-media' ) );
|
1086 |
} else {
|
1087 |
$term_id = intval( $gmCore->_post( 'preset_id', 0 ) );
|
1088 |
$term = $gmDB->get_term( $term_id );
|
1089 |
if ( $term && ! is_wp_error( $term ) ) {
|
1090 |
+
if ( ( $term->global !== $user_ID && ! gm_user_can( 'delete_others_media' ) ) || ( 0 === (int) $term->global && ! current_user_can( 'manage_options' ) ) ) {
|
1091 |
+
$out['error'] = $gmCore->alert( 'danger', esc_html__( 'You are not allowed to manage galleries', 'grand-media' ) );
|
1092 |
|
1093 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
1094 |
echo wp_json_encode( $out );
|
1095 |
|
1096 |
die();
|
1103 |
}
|
1104 |
}
|
1105 |
|
1106 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
1107 |
echo wp_json_encode( $out );
|
1108 |
|
1109 |
die();
|
1115 |
|
1116 |
check_ajax_referer( 'GmediaGallery' );
|
1117 |
if ( ! current_user_can( 'gmedia_module_manage' ) ) {
|
1118 |
+
echo wp_kses_post( $gmCore->alert( 'danger', esc_html__( 'You are not allowed to install modules' ) ) );
|
1119 |
die();
|
1120 |
}
|
1121 |
|
1122 |
+
$download = $gmCore->_post( 'download' );
|
1123 |
+
if ( $download ) {
|
1124 |
$module = $gmCore->_post( 'module' );
|
1125 |
$mzip = download_url( $download );
|
1126 |
if ( is_wp_error( $mzip ) ) {
|
1127 |
+
echo wp_kses_post( $gmCore->alert( 'danger', $mzip->get_error_message() ) );
|
1128 |
die();
|
1129 |
}
|
1130 |
|
1131 |
+
$mzip = str_replace( '\\', '/', $mzip );
|
1132 |
$to_folder = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/';
|
1133 |
if ( ! wp_mkdir_p( $to_folder ) ) {
|
1134 |
+
// translators: dirname.
|
1135 |
+
echo wp_kses_post( $gmCore->alert( 'danger', sprintf( esc_html__( 'Unable to create directory %s. Is its parent directory writable by the server?', 'grand-media' ), $to_folder ) ) );
|
1136 |
die();
|
1137 |
}
|
1138 |
if ( ! is_writable( $to_folder ) ) {
|
1139 |
@chmod( $to_folder, 0755 );
|
1140 |
if ( ! is_writable( $to_folder ) ) {
|
1141 |
+
// translators: dirname.
|
1142 |
+
echo wp_kses_post( $gmCore->alert( 'danger', sprintf( esc_html__( 'Directory %s is not writable by the server.', 'grand-media' ), $to_folder ) ) );
|
1143 |
die();
|
1144 |
}
|
1145 |
}
|
1146 |
|
1147 |
global $wp_filesystem;
|
1148 |
// Is a filesystem accessor setup?
|
1149 |
+
if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) {
|
1150 |
require_once ABSPATH . 'wp-admin/includes/file.php';
|
1151 |
+
$creds = request_filesystem_credentials( site_url() );
|
1152 |
+
wp_filesystem( $creds );
|
1153 |
}
|
1154 |
if ( ! is_object( $wp_filesystem ) ) {
|
1155 |
$result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.', 'grand-media' ) );
|
1157 |
$result = new WP_Error( 'fs_error', __( 'Filesystem error', 'grand-media' ), $wp_filesystem->errors );
|
1158 |
} else {
|
1159 |
if ( $module && is_dir( $to_folder . $module ) ) {
|
1160 |
+
//$gmCore->delete_folder( $to_folder . $module );
|
1161 |
+
$wp_filesystem->delete( $to_folder . $module, true );
|
1162 |
}
|
1163 |
$result = unzip_file( $mzip, $to_folder );
|
1164 |
}
|
1167 |
unlink( $mzip );
|
1168 |
|
1169 |
if ( is_wp_error( $result ) ) {
|
1170 |
+
echo wp_kses_post( $gmCore->alert( 'danger', $result->get_error_message() ) );
|
1171 |
die();
|
1172 |
} else {
|
1173 |
+
// translators: module name.
|
1174 |
+
echo wp_kses_post( $gmCore->alert( 'success', sprintf( esc_html__( 'The `%s` module successfully installed', 'grand-media' ), $module ) ) );
|
1175 |
// Try to clear cache after module update.
|
1176 |
@$gmCore->clear_cache();
|
1177 |
}
|
1178 |
} else {
|
1179 |
+
echo wp_kses_post( $gmCore->alert( 'danger', esc_html__( 'No file specified', 'grand-media' ) ) );
|
1180 |
}
|
1181 |
|
1182 |
die();
|
1194 |
?>
|
1195 |
<div class="modal-content">
|
1196 |
<div class="modal-header">
|
1197 |
+
<h4 class="modal-title"><?php esc_html_e( 'Import from WP Media Library' ); ?></h4>
|
1198 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
1199 |
</div>
|
1200 |
<div class="modal-body" style="position:relative; min-height:270px;">
|
1201 |
<form id="import_form" name="import_form" target="import_window" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="POST" accept-charset="utf-8">
|
1202 |
<?php wp_nonce_field( 'gmedia_import', '_wpnonce_import' ); ?>
|
1203 |
<input type="hidden" name="action" value="gmedia_import_handler"/>
|
1204 |
<input type="hidden" id="import-action" name="import" value="import-wpmedia"/>
|
1205 |
+
<?php
|
1206 |
+
$ckey = 'gmedia_library:wpmedia';
|
1207 |
+
$selected_value = '';
|
1208 |
if ( isset( $_COOKIE[ $ckey ] ) ) {
|
1209 |
+
$selected_value = str_replace( '.', ',', sanitize_text_field( wp_unslash( $_COOKIE[ $ckey ] ) ) );
|
1210 |
+
}
|
1211 |
+
?>
|
1212 |
+
<input type="hidden" name="selected" value="<?php esc_attr( $selected_value ); ?>"/>
|
1213 |
<?php if ( $gmCore->caps['gmedia_terms'] ) { ?>
|
1214 |
<div class="form-group">
|
1215 |
<?php
|
1216 |
$term_type = 'gmedia_album';
|
1217 |
+
$gm_terms = $gmDB->get_terms( $term_type, array( 'global' => array( 0, $user_ID ), 'orderby' => 'global_desc_name' ) );
|
1218 |
|
1219 |
$terms_album = '';
|
1220 |
if ( count( $gm_terms ) ) {
|
1221 |
foreach ( $gm_terms as $term ) {
|
1222 |
+
$terms_album .= '<option value="' . esc_attr( $term->term_id ) . '">' . esc_html( $term->name . ( $term->global ? '' : __( ' (shared)', 'grand-media' ) ) . ( 'publish' === $term->status ? '' : " [{$term->status}]" ) ) . '</option>' . "\n";
|
1223 |
}
|
1224 |
}
|
1225 |
?>
|
1226 |
+
<label><?php esc_html_e( 'Add to Album', 'grand-media' ); ?> </label>
|
1227 |
+
<select id="combobox_gmedia_album" name="terms[gmedia_album]" class="form-control input-sm" placeholder="<?php esc_attr_e( 'Album Name...', 'grand-media' ); ?>">
|
1228 |
<option value=""></option>
|
1229 |
+
<?php echo wp_kses_post( $terms_album ); ?>
|
1230 |
</select>
|
1231 |
</div>
|
1232 |
|
1233 |
<div class="form-group">
|
1234 |
<?php
|
1235 |
$term_type = 'gmedia_category';
|
1236 |
+
$gm_cat_terms = $gmDB->get_terms( $term_type, array( 'fields' => 'names' ) );
|
1237 |
?>
|
1238 |
+
<label><?php esc_html_e( 'Assign Categories', 'grand-media' ); ?></label>
|
1239 |
+
<input id="combobox_gmedia_category" name="terms[gmedia_category]" class="form-control input-sm" value="" placeholder="<?php esc_attr_e( 'Uncategorized', 'grand-media' ); ?>"/>
|
1240 |
</div>
|
1241 |
|
1242 |
<div class="form-group">
|
1243 |
<?php
|
1244 |
$term_type = 'gmedia_tag';
|
1245 |
+
$gm_tag_terms = $gmDB->get_terms( $term_type, array( 'fields' => 'names' ) );
|
1246 |
?>
|
1247 |
+
<label><?php esc_html_e( 'Add Tags', 'grand-media' ); ?> </label>
|
1248 |
+
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" class="form-control input-sm" value="" placeholder="<?php esc_attr_e( 'Add Tags...', 'grand-media' ); ?>"/>
|
1249 |
</div>
|
1250 |
<script type="text/javascript">
|
1251 |
+
jQuery( function( $ ) {
|
1252 |
+
//noinspection JSDuplicatedDeclaration
|
1253 |
+
$( '#combobox_gmedia_album' ).selectize( {
|
1254 |
+
<?php if ( $gmCore->caps['gmedia_album_manage'] ) { ?>
|
1255 |
+
create: true,
|
1256 |
+
createOnBlur: true,
|
1257 |
+
<?php } else { ?>
|
1258 |
+
create: false,
|
1259 |
+
<?php } ?>
|
1260 |
+
persist: false,
|
1261 |
+
} );
|
1262 |
+
|
1263 |
+
var gm_cat_terms = <?php echo wp_json_encode( $gm_cat_terms ); ?>;
|
1264 |
+
//noinspection JSUnusedAssignment
|
1265 |
+
var cat_items = gm_cat_terms.map( function( x ) {
|
1266 |
+
return {item: x};
|
1267 |
+
} );
|
1268 |
+
//noinspection JSDuplicatedDeclaration
|
1269 |
+
$( '#combobox_gmedia_category' ).selectize( {
|
1270 |
+
<?php if ( $gmCore->caps['gmedia_category_manage'] ) { ?>
|
1271 |
+
create: function( input ) {
|
1272 |
+
return {
|
1273 |
+
item: input,
|
1274 |
+
};
|
1275 |
+
},
|
1276 |
+
createOnBlur: true,
|
1277 |
+
<?php } else { ?>
|
1278 |
+
create: false,
|
1279 |
+
<?php } ?>
|
1280 |
+
delimiter: ',',
|
1281 |
+
maxItems: null,
|
1282 |
+
openOnFocus: true,
|
1283 |
+
persist: false,
|
1284 |
+
options: cat_items,
|
1285 |
+
labelField: 'item',
|
1286 |
+
valueField: 'item',
|
1287 |
+
searchField: ['item'],
|
1288 |
+
hideSelected: true,
|
1289 |
+
} );
|
1290 |
+
|
1291 |
+
var gm_tag_terms = <?php echo wp_json_encode( $gm_tag_terms ); ?>;
|
1292 |
+
//noinspection JSUnusedAssignment
|
1293 |
+
var tag_items = gm_tag_terms.map( function( x ) {
|
1294 |
+
return {item: x};
|
1295 |
+
} );
|
1296 |
+
//noinspection JSDuplicatedDeclaration
|
1297 |
+
$( '#combobox_gmedia_tag' ).selectize( {
|
1298 |
+
<?php if ( $gmCore->caps['gmedia_tag_manage'] ) { ?>
|
1299 |
+
create: function( input ) {
|
1300 |
+
return {
|
1301 |
+
item: input,
|
1302 |
+
};
|
1303 |
+
},
|
1304 |
+
createOnBlur: true,
|
1305 |
+
<?php } else { ?>
|
1306 |
+
create: false,
|
1307 |
+
<?php } ?>
|
1308 |
+
delimiter: ',',
|
1309 |
+
maxItems: null,
|
1310 |
+
openOnFocus: true,
|
1311 |
+
persist: false,
|
1312 |
+
options: tag_items,
|
1313 |
+
labelField: 'item',
|
1314 |
+
valueField: 'item',
|
1315 |
+
searchField: ['item'],
|
1316 |
+
hideSelected: true,
|
1317 |
+
} );
|
1318 |
+
} );
|
1319 |
</script>
|
1320 |
<?php } else { ?>
|
1321 |
+
<p><?php esc_html_e( 'You are not allowed to assign terms', 'grand-media' ); ?></p>
|
1322 |
<?php } ?>
|
1323 |
<div class="checkbox">
|
1324 |
+
<label><input type="checkbox" name="skip_exists" value="skip"> <?php esc_html_e( 'Skip if file with the same name already exists in Gmedia Library', 'grand-media' ); ?></label>
|
1325 |
+
<div class="help-block"><?php esc_html_e( 'Note: duplicates will be skipped in any way (checked by file hash)' ); ?></div>
|
1326 |
</div>
|
1327 |
<script type="text/javascript">
|
1328 |
+
jQuery( function( $ ) {
|
1329 |
+
$( '#import-done' ).one( 'click', function() {
|
1330 |
+
$( '#import_form' ).submit();
|
1331 |
+
$( this ).text( $( this ).data( 'loading-text' ) ).prop( 'disabled', true );
|
1332 |
+
$( '#import_window' ).show();
|
1333 |
+
$( this ).one( 'click', function() {
|
1334 |
+
$( '#importModal' ).modal( 'hide' );
|
1335 |
+
} );
|
1336 |
+
} );
|
1337 |
+
} );
|
1338 |
</script>
|
1339 |
</form>
|
1340 |
<iframe name="import_window" id="import_window" src="about:blank" style="display:none; position:absolute; left:0; top:0; width:100%; height:100%; z-index:1000; background-color:#ffffff; padding:20px 20px 0 20px;" onload="gmedia_import_done()"></iframe>
|
1341 |
</div>
|
1342 |
<div class="modal-footer">
|
1343 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Cancel', 'grand-media' ); ?></button>
|
1344 |
+
<button type="button" id="import-done" class="btn btn-primary" data-complete-text="<?php esc_attr_e( 'Close', 'grand-media' ); ?>" data-loading-text="<?php esc_attr_e( 'Working...', 'grand-media' ); ?>" data-reset-text="<?php esc_attr_e( 'Import', 'grand-media' ); ?>"><?php esc_html_e( 'Import', 'grand-media' ); ?></button>
|
1345 |
</div>
|
1346 |
</div><!-- /.modal-content -->
|
1347 |
<?php
|
1360 |
/** @var $wpdb wpdb */
|
1361 |
global $wpdb, $gmCore, $gmDB;
|
1362 |
|
1363 |
+
check_ajax_referer( 'GmediaGallery' );
|
1364 |
|
1365 |
// check for correct capability.
|
1366 |
if ( ! current_user_can( 'gmedia_library' ) ) {
|
1372 |
$per_page = 20;
|
1373 |
$s = trim( stripslashes( urldecode( $gmCore->_get( 'search' ) ) ) );
|
1374 |
if ( $s && strlen( $s ) > 2 ) {
|
1375 |
+
$post_tags = array();
|
1376 |
} else {
|
1377 |
$s = '';
|
1378 |
}
|
1379 |
|
1380 |
+
$gmediaLib = array();
|
1381 |
$relative = (int) $gmCore->_get( 'rel', 1 );
|
1382 |
$continue = true;
|
1383 |
$content = '';
|
1384 |
|
1385 |
+
if ( 1 === $relative ) {
|
1386 |
+
$arg = array(
|
1387 |
'mime_type' => 'image/*',
|
1388 |
'orderby' => 'ID',
|
1389 |
'order' => 'DESC',
|
1392 |
's' => $s,
|
1393 |
'tag_name__in' => $post_tags,
|
1394 |
'null_tags' => true,
|
1395 |
+
);
|
1396 |
$gmediaLib = $gmDB->get_gmedias( $arg );
|
1397 |
}
|
1398 |
|
1399 |
if ( empty( $gmediaLib ) && count( $post_tags ) ) {
|
1400 |
|
1401 |
+
if ( 1 === $relative ) {
|
1402 |
$relative = 0;
|
1403 |
$paged = 1;
|
1404 |
+
$content .= '<li class="emptydb">' . esc_html__( 'No items related by tags.', 'grand-media' ) . '</li>' . "\n";
|
1405 |
}
|
1406 |
|
1407 |
+
$post_tags = array_unique( (array) $post_tags );
|
1408 |
+
$post_tags_count = count( $post_tags );
|
1409 |
+
$string_placeholders = array_fill( 0, $post_tags_count, '%s' );
|
1410 |
+
$placeholders_post_tags = implode( ', ', $string_placeholders );
|
1411 |
+
$tag__not_in_query = "SELECT term_id FROM {$wpdb->prefix}gmedia_term WHERE taxonomy = 'gmedia_tag' AND name IN ({$placeholders_post_tags})";
|
1412 |
+
$tag__not_in = $wpdb->get_col( $wpdb->prepare( $tag__not_in_query, $post_tags ) );
|
|
|
1413 |
|
1414 |
+
$arg = array(
|
1415 |
'mime_type' => 'image/*',
|
1416 |
'orderby' => 'ID',
|
1417 |
'order' => 'DESC',
|
1418 |
'per_page' => $per_page,
|
1419 |
'page' => $paged,
|
1420 |
'tag__not_in' => $tag__not_in,
|
1421 |
+
);
|
1422 |
$gmediaLib = $gmDB->get_gmedias( $arg );
|
1423 |
}
|
1424 |
|
1425 |
+
$count = count( $gmediaLib );
|
1426 |
+
if ( $count ) {
|
1427 |
foreach ( $gmediaLib as $item ) {
|
1428 |
+
$content .= '<li class="gmedia-image-li" id="gm-img-' . intval( $item->ID ) . '">' . "\n";
|
1429 |
+
$content .= ' <a target="_blank" class="gm-img" data-gmid="' . intval( $item->ID ) . '" href="' . esc_url( $gmCore->gm_get_media_image( $item ) ) . '"><img src="' . esc_url( $gmCore->gm_get_media_image( $item, 'thumb' ) ) . '" height="50" style="width:auto;" alt="" title="' . esc_attr( $item->title ) . '" /></a>' . "\n";
|
1430 |
+
$content .= ' <div style="display: none;" class="gm-img-description">' . esc_html( $item->description ) . '</div>' . "\n";
|
1431 |
+
$content .= '</li>' . "\n";
|
1432 |
}
|
1433 |
+
if ( ( $count < $per_page ) && ( 0 === $relative || ! empty( $s ) ) ) {
|
1434 |
$continue = false;
|
1435 |
}
|
1436 |
} else {
|
1437 |
if ( $s ) {
|
1438 |
+
$content .= '<li class="emptydb">' . esc_html__( 'No items matching the search query.', 'grand-media' ) . '</li>' . "\n";
|
1439 |
} else {
|
1440 |
+
$content .= '<li class="emptydb">' . esc_html__( 'No items to show', 'grand-media' ) . '</li>' . "\n";
|
1441 |
}
|
1442 |
$continue = false;
|
1443 |
}
|
1444 |
+
$result = array( 'paged' => $paged, 'rel' => $relative, 'continue' => $continue, 'content' => $content, 'data' => $post_tags );
|
1445 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
1446 |
echo wp_json_encode( $result );
|
1447 |
|
1448 |
die();
|
1454 |
*
|
1455 |
* @author Cory S.N. LaViska - A Beautiful Site (http://abeautifulsite.net/)
|
1456 |
* @version 1.0.1
|
1457 |
+
* @return void folder content.
|
1458 |
*/
|
1459 |
function gmedia_ftp_browser() {
|
1460 |
if ( ! current_user_can( 'gmedia_import' ) ) {
|
1461 |
die( 'No access' );
|
1462 |
}
|
1463 |
|
1464 |
+
global $gmCore;
|
1465 |
+
|
1466 |
// if nonce is not correct it returns -1.
|
1467 |
check_ajax_referer( 'GmediaGallery' );
|
1468 |
|
1469 |
// start from the default path.
|
1470 |
$root = trailingslashit( ABSPATH );
|
1471 |
// get the current directory.
|
1472 |
+
$dir = trailingslashit( urldecode( $gmCore->_post( 'dir' ) ) );
|
1473 |
|
1474 |
if ( ( false === strpos( $dir, '..' ) ) && file_exists( $root . $dir ) ) {
|
1475 |
$files = scandir( $root . $dir );
|
1477 |
|
1478 |
// The 2 counts for . and ..
|
1479 |
if ( count( $files ) > 2 ) {
|
1480 |
+
echo '<ul class="jqueryFileTree" style="display: none;">';
|
1481 |
+
// return only directories.
|
1482 |
foreach ( $files as $file ) {
|
1483 |
+
if ( in_array( $file, array( 'wp-admin', 'wp-includes', 'plugins', 'themes', 'thumb', 'thumbs' ), true ) ) {
|
1484 |
continue;
|
1485 |
}
|
1486 |
|
1487 |
+
if ( file_exists( $root . $dir . $file ) && '.' !== $file && '..' !== $file && is_dir( $root . $dir . $file ) ) {
|
1488 |
+
echo '<li class="directory collapsed"><a href="#" rel="' . esc_attr( $dir . $file ) . '/">' . esc_html( $file ) . '</a></li>';
|
1489 |
}
|
1490 |
}
|
1491 |
// All files.
|
1492 |
foreach ( $files as $file ) {
|
1493 |
+
if ( file_exists( $root . $dir . $file ) && '.' !== $file && '..' !== $file && ! is_dir( $root . $dir . $file ) ) {
|
1494 |
$ext = preg_replace( '/^.*\./', '', $file );
|
1495 |
+
if ( '.' . $ext === $file ) {
|
1496 |
continue;
|
1497 |
}
|
1498 |
+
echo '<li class="file ext_' . esc_attr( $ext ) . '"><a href="#" rel="' . esc_attr( $dir ) . '">' . esc_html( $file ) . '</a></li>';
|
1499 |
}
|
1500 |
}
|
1501 |
echo '</ul>';
|
1533 |
$image = $gmDB->get_gmedia( $img_id );
|
1534 |
if ( $image ) {
|
1535 |
|
1536 |
+
$args = array(
|
1537 |
'post_type' => 'attachment',
|
1538 |
'meta_key' => '_gmedia_image_id',
|
1539 |
'meta_compare' => '==',
|
1540 |
'meta_value' => $img_id,
|
1541 |
+
);
|
1542 |
$posts = get_posts( $args );
|
1543 |
$attachment_id = null;
|
1544 |
|
1545 |
+
if ( null !== $posts ) {
|
1546 |
$attachment_id = $posts[0]->ID;
|
1547 |
//$target_path = get_attached_file( $attachment_id );
|
1548 |
} else {
|
1549 |
$upload_dir = wp_upload_dir();
|
1550 |
$basedir = $upload_dir['basedir'];
|
1551 |
+
$thumbs_dir = implode( DIRECTORY_SEPARATOR, array( $basedir, 'gmedia_featured' ) );
|
1552 |
|
1553 |
$type = explode( '/', $image->mime_type );
|
1554 |
|
1563 |
$title = sanitize_title( $image->title );
|
1564 |
$caption = $gmCore->sanitize( $image->description );
|
1565 |
|
1566 |
+
$attachment = array(
|
1567 |
'post_title' => $title,
|
1568 |
'post_content' => $caption,
|
1569 |
'post_status' => 'attachment',
|
1570 |
'post_parent' => 0,
|
1571 |
'post_mime_type' => $image->mime_type,
|
1572 |
'guid' => $url,
|
1573 |
+
);
|
1574 |
|
1575 |
//require for wp_generate_attachment_metadata which generates image related meta-data also creates thumbs.
|
1576 |
require_once ABSPATH . 'wp-admin/includes/image.php';
|
1585 |
delete_post_meta( $post_ID, '_thumbnail_id' );
|
1586 |
add_post_meta( $post_ID, '_thumbnail_id', $attachment_id, true );
|
1587 |
|
1588 |
+
echo wp_kses_post( _wp_post_thumbnail_html( $attachment_id, $post_ID ) );
|
1589 |
die();
|
1590 |
}
|
1591 |
}
|
1598 |
function gmedia_upload_handler() {
|
1599 |
global $gmCore;
|
1600 |
|
|
|
|
|
1601 |
// HTTP headers for no cache etc.
|
1602 |
send_nosniff_header();
|
1603 |
//send_origin_headers();
|
1606 |
// if nonce is not correct it returns -1.
|
1607 |
check_ajax_referer( 'gmedia_upload', '_wpnonce_upload' );
|
1608 |
if ( ! current_user_can( 'gmedia_upload' ) ) {
|
1609 |
+
wp_die( esc_html__( 'You do not have permission to upload files in Gmedia Library.' ) );
|
1610 |
}
|
1611 |
|
1612 |
// 5 minutes execution time.
|
1613 |
+
set_time_limit( 300 );
|
1614 |
|
1615 |
// fake upload time.
|
1616 |
usleep( 10 );
|
1619 |
|
1620 |
// Get parameters.
|
1621 |
if ( ! $filename ) {
|
1622 |
+
$return = array( 'error' => array( 'code' => 100, 'message' => esc_html__( 'No file name.', 'grand-media' ) ) );
|
1623 |
+
die( wp_json_encode( $return ) );
|
1624 |
}
|
1625 |
|
1626 |
$fileinfo = $gmCore->fileinfo( $filename );
|
1627 |
if ( false === $fileinfo ) {
|
1628 |
+
$return = array( 'error' => array( 'code' => 100, 'message' => __( 'File type not allowed.', 'grand-media' ) ), 'id' => $filename );
|
1629 |
+
die( wp_json_encode( $return ) );
|
1630 |
}
|
1631 |
|
1632 |
// Look for the content type header.
|
1633 |
$contentType = '';
|
1634 |
+
if ( isset( $_SERVER['HTTP_CONTENT_TYPE'] ) ) {
|
1635 |
+
$contentType = sanitize_text_field( wp_unslash( $_SERVER['HTTP_CONTENT_TYPE'] ) );
|
1636 |
}
|
1637 |
|
1638 |
+
if ( isset( $_SERVER['CONTENT_TYPE'] ) ) {
|
1639 |
+
$contentType = sanitize_text_field( wp_unslash( $_SERVER['CONTENT_TYPE'] ) );
|
1640 |
}
|
1641 |
|
1642 |
+
// Handle non-multipart uploads older WebKit versions didn't support multipart in HTML5.
|
1643 |
$file_tmp = '';
|
1644 |
+
if ( strpos( $contentType, 'multipart' ) !== false ) {
|
1645 |
+
// phpcs:ignore
|
1646 |
if ( isset( $_FILES['file']['tmp_name'] ) && is_uploaded_file( $_FILES['file']['tmp_name'] ) ) {
|
1647 |
+
$file_tmp = sanitize_text_field( wp_unslash( $_FILES['file']['tmp_name'] ) );
|
1648 |
}
|
1649 |
} else {
|
1650 |
+
$file_tmp = 'php://input';
|
1651 |
}
|
1652 |
|
1653 |
if ( empty( $file_tmp ) ) {
|
1654 |
+
$return = array( 'error' => array( 'code' => 103, 'message' => __( 'Failed to move uploaded file.', 'grand-media' ) ), 'id' => $filename );
|
1655 |
+
die( wp_json_encode( $return ) );
|
1656 |
}
|
1657 |
|
1658 |
+
$post_data = array();
|
1659 |
+
$params = $gmCore->_req( 'params', '' );
|
1660 |
+
if ( $params ) {
|
1661 |
parse_str( $params, $post_data );
|
1662 |
}
|
1663 |
|
1664 |
$return = $gmCore->gmedia_upload_handler( $file_tmp, $fileinfo, $contentType, $post_data );
|
|
|
1665 |
|
1666 |
+
die( wp_json_encode( $return ) );
|
1667 |
}
|
1668 |
|
1669 |
add_action( 'wp_ajax_gmedia_import_handler', 'gmedia_import_handler' );
|
1670 |
function gmedia_import_handler() {
|
1671 |
global $wpdb, $gmCore, $gmDB;
|
1672 |
|
|
|
|
|
1673 |
// HTTP headers for no cache etc.
|
1674 |
send_nosniff_header();
|
1675 |
//send_origin_headers();
|
1677 |
|
1678 |
check_admin_referer( 'gmedia_import', '_wpnonce_import' );
|
1679 |
if ( ! current_user_can( 'gmedia_import' ) ) {
|
1680 |
+
wp_die( esc_html__( 'You do not have permission to upload files.' ) );
|
1681 |
}
|
1682 |
|
1683 |
// 10 minutes execution time.
|
1684 |
+
set_time_limit( 600 );
|
1685 |
|
1686 |
// fake upload time.
|
1687 |
usleep( 10 );
|
1688 |
|
1689 |
$import = $gmCore->_post( 'import' );
|
1690 |
+
$terms = $gmCore->_post( 'terms', array() );
|
1691 |
|
1692 |
if ( ob_get_level() === 0 ) {
|
1693 |
ob_start();
|
1694 |
}
|
1695 |
+
// phpcs:ignore
|
1696 |
echo str_pad( ' ', 4096 ) . PHP_EOL;
|
1697 |
wp_ob_end_flush_all();
|
1698 |
flush();
|
1699 |
?>
|
1700 |
<html>
|
1701 |
+
<head>
|
1702 |
+
<style>
|
1703 |
+
* {
|
1704 |
+
margin: 0;
|
1705 |
+
padding: 0;
|
1706 |
+
}
|
1707 |
|
1708 |
+
pre {
|
1709 |
+
display: block;
|
1710 |
+
}
|
1711 |
|
1712 |
+
p {
|
1713 |
+
padding: 10px 0;
|
1714 |
+
font-size: 14px;
|
1715 |
+
}
|
1716 |
|
1717 |
+
.ok {
|
1718 |
+
color: darkgreen;
|
1719 |
+
}
|
1720 |
|
1721 |
+
.ko {
|
1722 |
+
color: darkred;
|
1723 |
+
}
|
1724 |
+
</style>
|
1725 |
+
</head>
|
1726 |
<body>
|
1727 |
<?php
|
1728 |
if ( ( 'import-folder' === $import ) || isset( $_POST['import-folder'] ) ) {
|
1729 |
|
1730 |
$path = $gmCore->_post( 'path' );
|
1731 |
+
echo '<h4 style="margin: 0 0 10px">' . esc_html( __( 'Import Server Folder' ) . " `$path`:" ) . '</h4>' . PHP_EOL;
|
1732 |
|
1733 |
if ( $path ) {
|
1734 |
$path = trim( urldecode( $path ), '/' );
|
1766 |
}
|
1767 |
$gmCore->gmedia_import_files( $files, $terms, $move, $exists );
|
1768 |
} else {
|
1769 |
+
// translators: folder path.
|
1770 |
+
echo sprintf( esc_html__( 'Folder `%s` is empty', 'grand-media' ), esc_html( $path ) ) . PHP_EOL;
|
1771 |
}
|
1772 |
} else {
|
1773 |
+
echo esc_html__( 'No folder chosen', 'grand-media' ) . PHP_EOL;
|
1774 |
}
|
1775 |
}
|
1776 |
} elseif ( ( 'import-flagallery' === $import ) || isset( $_POST['import-flagallery'] ) ) {
|
1777 |
|
1778 |
+
echo '<h4 style="margin: 0 0 10px">' . esc_html__( 'Import from Flagallery plugin' ) . ':</h4>' . PHP_EOL;
|
1779 |
|
1780 |
$gallery = $gmCore->_post( 'gallery' );
|
1781 |
if ( ! empty( $gallery ) ) {
|
1782 |
+
$album = empty( $terms['gmedia_album'] );
|
1783 |
foreach ( $gallery as $gid ) {
|
1784 |
$flag_gallery = $wpdb->get_row( $wpdb->prepare( "SELECT gid, path, title, galdesc FROM {$wpdb->prefix}flag_gallery WHERE gid = %d", $gid ), ARRAY_A );
|
1785 |
if ( empty( $flag_gallery ) ) {
|
1792 |
$terms['gmedia_album'] = 'a' . $terms['gmedia_album'];
|
1793 |
}
|
1794 |
if ( ! $gmDB->term_exists( $terms['gmedia_album'], 'gmedia_album' ) ) {
|
1795 |
+
$gmDB->insert_term( $terms['gmedia_album'], 'gmedia_album', array( 'description' => htmlspecialchars_decode( stripslashes( $flag_gallery['galdesc'] ) ) ) );
|
1796 |
}
|
1797 |
}
|
1798 |
|
1799 |
$path = ABSPATH . trailingslashit( $flag_gallery['path'] );
|
1800 |
|
1801 |
+
// translators: gallery title.
|
1802 |
+
echo '<h5 style="margin: 10px 0 5px">' . sprintf( esc_html__( 'Import `%s` gallery', 'grand-media' ), esc_html( $flag_gallery['title'] ) ) . ':</h5>' . PHP_EOL;
|
1803 |
|
1804 |
+
$flag_pictures = $wpdb->get_results( $wpdb->prepare( "SELECT CONCAT(%s, filename) AS file, description, alttext AS title, link FROM {$wpdb->prefix}flag_pictures WHERE galleryid = %d", $path, intval( $flag_gallery['gid'] ) ), ARRAY_A );
|
1805 |
if ( empty( $flag_pictures ) ) {
|
1806 |
+
echo '<pre>' . esc_html__( 'gallery contains 0 images', 'grand-media' ) . '</pre>';
|
1807 |
continue;
|
1808 |
}
|
1809 |
$exists = $gmCore->_post( 'skip_exists', 0 );
|
1812 |
$gmCore->gmedia_import_files( $flag_pictures, $terms, false, $exists );
|
1813 |
}
|
1814 |
} else {
|
1815 |
+
echo esc_html__( 'No gallery chosen', 'grand-media' ) . PHP_EOL;
|
1816 |
}
|
1817 |
} elseif ( ( 'import-nextgen' === $import ) || isset( $_POST['import-nextgen'] ) ) {
|
1818 |
|
1819 |
+
echo '<h4 style="margin: 0 0 10px">' . esc_html__( 'Import from NextGen plugin' ) . ':</h4>' . PHP_EOL;
|
1820 |
|
1821 |
$gallery = $gmCore->_post( 'gallery' );
|
1822 |
if ( ! empty( $gallery ) ) {
|
1823 |
+
$album = empty( $terms['gmedia_album'] );
|
1824 |
foreach ( $gallery as $gid ) {
|
1825 |
$ngg_gallery = $wpdb->get_row( $wpdb->prepare( "SELECT gid, path, title, galdesc FROM {$wpdb->prefix}ngg_gallery WHERE gid = %d", $gid ), ARRAY_A );
|
1826 |
if ( empty( $ngg_gallery ) ) {
|
1833 |
$terms['gmedia_album'] = 'a' . $ngg_gallery['title'];
|
1834 |
}
|
1835 |
if ( ! $gmDB->term_exists( $terms['gmedia_album'], 'gmedia_album' ) ) {
|
1836 |
+
$gmDB->insert_term( $terms['gmedia_album'], 'gmedia_album', array( 'description' => htmlspecialchars_decode( stripslashes( $ngg_gallery['galdesc'] ) ) ) );
|
1837 |
}
|
1838 |
}
|
1839 |
|
1840 |
$path = ABSPATH . trailingslashit( $ngg_gallery['path'] );
|
1841 |
|
1842 |
+
// translators: gallery title.
|
1843 |
+
echo '<h5 style="margin: 10px 0 5px">' . sprintf( esc_html__( 'Import `%s` gallery', 'grand-media' ), esc_html( $ngg_gallery['title'] ) ) . ':</h5>' . PHP_EOL;
|
1844 |
|
1845 |
+
$ngg_pictures = $wpdb->get_results( $wpdb->prepare( "SELECT CONCAT(%s, filename) AS file, description, alttext AS title, pid FROM {$wpdb->prefix}ngg_pictures WHERE galleryid = %d", $path, intval( $ngg_gallery['gid'] ) ), ARRAY_A );
|
1846 |
if ( empty( $ngg_pictures ) ) {
|
1847 |
+
echo '<pre>' . esc_html__( 'gallery contains 0 images', 'grand-media' ) . '</pre>';
|
1848 |
continue;
|
1849 |
} else {
|
1850 |
foreach ( $ngg_pictures as &$ngg_image ) {
|
1851 |
+
$ngg_terms = wp_get_object_terms( (int) $ngg_image['pid'], 'ngg_tag', array( 'fields' => 'names' ) );
|
1852 |
if ( ! empty( $ngg_terms ) ) {
|
1853 |
$ngg_image['terms']['gmedia_tag'] = $ngg_terms;
|
1854 |
}
|
1859 |
$gmCore->gmedia_import_files( $ngg_pictures, $terms, false, $exists );
|
1860 |
}
|
1861 |
} else {
|
1862 |
+
echo esc_html__( 'No gallery chosen', 'grand-media' ) . PHP_EOL;
|
1863 |
}
|
1864 |
} elseif ( ( 'import-wpmedia' === $import ) || isset( $_POST['import-wpmedia'] ) ) {
|
1865 |
|
1866 |
+
echo '<h4 style="margin: 0 0 10px">' . esc_html__( 'Import from WP Media Library' ) . ':</h4>' . PHP_EOL;
|
1867 |
|
1868 |
+
$wpMediaLib = $gmDB->get_wp_media_lib( array( 'filter' => 'selected', 'selected' => $gmCore->_post( 'selected' ) ) );
|
1869 |
|
1870 |
if ( ! empty( $wpMediaLib ) ) {
|
1871 |
|
1872 |
+
$wp_media = array();
|
1873 |
foreach ( $wpMediaLib as $item ) {
|
1874 |
+
$wp_media[] = array(
|
1875 |
'file' => get_attached_file( $item->ID ),
|
1876 |
'author' => $item->post_author,
|
1877 |
'title' => $item->post_title,
|
1878 |
'description' => $item->post_content,
|
1879 |
+
);
|
1880 |
}
|
1881 |
$exists = $gmCore->_post( 'skip_exists', 0 );
|
1882 |
//echo '<pre>' . print_r($wp_media, true) . '</pre>';
|
1883 |
$gmCore->gmedia_import_files( $wp_media, $terms, false, $exists );
|
1884 |
|
1885 |
} else {
|
1886 |
+
echo esc_html__( 'No items chosen', 'grand-media' ) . PHP_EOL;
|
1887 |
}
|
1888 |
}
|
1889 |
?>
|
1933 |
|
1934 |
$result = $gmCore->app_service( $service );
|
1935 |
|
1936 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
1937 |
echo wp_json_encode( $result );
|
1938 |
|
1939 |
die();
|
1949 |
$email = $gmCore->_post( 'email', '' );
|
1950 |
$sharemessage = $gmCore->_post( 'message', '' );
|
1951 |
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
|
1952 |
+
echo wp_kses_post( $gmCore->alert( 'danger', esc_html( __( 'Invalid email', 'grand-media' ) . ': ' . $email ) ) );
|
1953 |
die();
|
1954 |
}
|
1955 |
|
1956 |
+
$display_name = get_the_author_meta( 'display_name', $user_ID );
|
1957 |
+
// translators: author name.
|
1958 |
+
$subject = sprintf( esc_html__( '%s shared GmediaCloud Page with you', 'grand-media' ), esc_html( $display_name ) );
|
1959 |
+
// translators: author name.
|
1960 |
+
$sharetitle = sprintf( esc_html__( '%s used Gmedia to share something interesting with you!', 'grand-media' ), esc_html( $display_name ) );
|
1961 |
$sharelinktext = __( 'Click here to view page', 'grand-media' );
|
1962 |
if ( $sharemessage ) {
|
1963 |
$sharemessage = '<blockquote>"' . nl2br( esc_html( $sharemessage ) ) . '"</blockquote>';
|
1964 |
}
|
1965 |
+
$footer = '© ' . gmdate( 'Y' ) . ' GmediaGallery';
|
1966 |
+
|
1967 |
+
ob_start();
|
1968 |
+
?>
|
1969 |
+
<center>
|
1970 |
+
<table cellpadding="0" cellspacing="0" style="border-radius:4px;border:1px #dceaf5 solid;" border="0" align="center">
|
1971 |
+
<tr>
|
1972 |
+
<td colspan="3" height="20"></td>
|
1973 |
+
</tr>
|
1974 |
+
<tr style="line-height:0;">
|
1975 |
+
<td width="100%" style="font-size:0;" align="center" height="1">
|
1976 |
+
<img width="72" style="max-height:72px;width:72px;" alt="GmediaGallery" src="https://mypgc.co/images/email/logo-128.png"/>
|
1977 |
+
</td>
|
1978 |
+
</tr>
|
1979 |
+
<tr>
|
1980 |
+
<td>
|
1981 |
+
<table cellpadding="0" cellspacing="0" style="line-height:25px;" border="0" align="center">
|
1982 |
+
<tr>
|
1983 |
+
<td colspan="3" height="20"></td>
|
1984 |
+
</tr>
|
1985 |
+
<tr>
|
1986 |
+
<td width="36"></td>
|
1987 |
+
<td width="454" align="left" style="color:#444444;border-collapse:collapse;font-size:11pt;font-family:Arial,Helvetica,sans-serif;max-width:454px;" valign="top"><?php echo esc_html( $sharetitle ); ?>
|
1988 |
+
<br/>
|
1989 |
+
<?php echo wp_kses_post( $sharemessage ); ?>
|
1990 |
+
<br/><a style="color:#0D8FB3" href="<?php echo esc_url( $sharelink ); ?>"><?php echo esc_html( $sharelinktext ); ?></a>.
|
1991 |
+
</td>
|
1992 |
+
<td width="36"></td>
|
1993 |
+
</tr>
|
1994 |
+
<tr>
|
1995 |
+
<td colspan="3" height="36"></td>
|
1996 |
+
</tr>
|
1997 |
+
</table>
|
1998 |
+
</td>
|
1999 |
+
</tr>
|
2000 |
+
</table>
|
2001 |
+
<table cellpadding="0" cellspacing="0" align="center" border="0">
|
2002 |
+
<tr>
|
2003 |
+
<td height="10"></td>
|
2004 |
+
</tr>
|
2005 |
+
<tr>
|
2006 |
+
<td style="padding:0;border-collapse:collapse;">
|
2007 |
+
<table cellpadding="0" cellspacing="0" align="center" border="0">
|
2008 |
+
<tr style="color:#a8b9c6;font-size:11px;font-family:Arial,Helvetica,sans-serif;">
|
2009 |
+
<td width="128" align="left"></td>
|
2010 |
+
<td width="400" align="right"><?php echo esc_html( $footer ); ?></td>
|
2011 |
+
</tr>
|
2012 |
+
</table>
|
2013 |
+
</td>
|
2014 |
+
</tr>
|
2015 |
+
</table>
|
2016 |
+
</center>
|
2017 |
+
<?php
|
2018 |
+
$message = ob_get_clean();
|
2019 |
+
|
2020 |
+
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
|
2021 |
if ( wp_mail( $email, $subject, $message, $headers ) ) {
|
2022 |
+
// translators: email.
|
2023 |
+
echo wp_kses_post( $gmCore->alert( 'success', sprintf( esc_html__( 'Message sent to %s', 'grand-media' ), esc_html( $email ) ) ) );
|
2024 |
}
|
2025 |
|
2026 |
die();
|
2033 |
|
2034 |
$meta_type = 'gmedia';
|
2035 |
|
2036 |
+
$pid = (int) $gmCore->_post( 'ID', 0 );
|
2037 |
$post = $gmDB->get_gmedia( $pid );
|
2038 |
|
2039 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2040 |
|
2041 |
if ( ! current_user_can( 'gmedia_edit_media' ) || ( $user_ID !== $post->author && ! current_user_can( 'gmedia_edit_others_media' ) ) ) {
|
2042 |
+
echo wp_json_encode( array( 'error' => array( 'code' => 100, 'message' => esc_html__( 'You are not allowed to edit others media', 'grand-media' ) ), 'id' => $pid ) );
|
2043 |
die();
|
2044 |
}
|
2045 |
if ( isset( $_POST['metakeyselect'] ) && empty( $_POST['metakeyselect'] ) && empty( $_POST['metakeyinput'] ) ) {
|
2046 |
+
echo wp_json_encode( array( 'error' => array( 'code' => 101, 'message' => esc_html__( 'Choose or provide a custom field name', 'grand-media' ) ), 'id' => $pid ) );
|
2047 |
die();
|
2048 |
}
|
2049 |
|
2050 |
+
$mid = $gmCore->add_meta( $pid, $meta_type );
|
2051 |
+
if ( ! $mid ) {
|
2052 |
+
echo wp_json_encode( array( 'error' => array( 'code' => 102, 'message' => esc_html__( 'Please provide a custom field value', 'grand-media' ) ), 'id' => $pid ) );
|
2053 |
die();
|
2054 |
}
|
2055 |
|
2057 |
$meta = $gmDB->get_metadata_by_mid( $meta_type, $mid );
|
2058 |
$pid = (int) $meta->{$column};
|
2059 |
$meta = get_object_vars( $meta );
|
2060 |
+
$result = array(
|
2061 |
+
'success' => array(
|
2062 |
'meta_id' => $mid,
|
2063 |
'data' => $gmCore->_list_meta_item( $meta, $meta_type ),
|
2064 |
+
),
|
2065 |
'id' => $pid,
|
2066 |
+
);
|
2067 |
|
2068 |
if ( ! empty( $_POST['metakeyinput'] ) ) {
|
2069 |
$result['newmeta_form'] = $gmCore->meta_form( $meta_type );
|
2081 |
|
2082 |
$meta_type = 'gmedia';
|
2083 |
|
2084 |
+
$pid = (int) $gmCore->_post( 'ID', 0 );
|
2085 |
$post = $gmDB->get_gmedia( $pid );
|
2086 |
|
2087 |
if ( ! current_user_can( 'gmedia_edit_media' ) || ( $user_ID !== $post->author && ! current_user_can( 'gmedia_edit_others_media' ) ) ) {
|
2088 |
+
echo wp_json_encode( array( 'error' => array( 'code' => 100, 'message' => esc_html__( 'You are not allowed to edit others media', 'grand-media' ) ), 'id' => $pid ) );
|
2089 |
die();
|
2090 |
}
|
2091 |
|
2092 |
+
$result = array( 'id' => $pid );
|
2093 |
|
2094 |
+
$deletemeta = $gmCore->_post( 'meta' );
|
2095 |
$column = sanitize_key( $meta_type . '_id' );
|
2096 |
if ( isset( $deletemeta ) && is_array( $deletemeta ) ) {
|
2097 |
foreach ( $deletemeta as $key => $value ) {
|
2098 |
+
$meta = $gmDB->get_metadata_by_mid( $meta_type, $key );
|
2099 |
+
if ( ! $meta ) {
|
2100 |
continue;
|
2101 |
}
|
2102 |
if ( $meta->{$column} !== $pid ) {
|
2105 |
if ( $gmCore->is_protected_meta( $meta->meta_key, $meta_type ) ) {
|
2106 |
continue;
|
2107 |
}
|
2108 |
+
if ( $gmDB->delete_metadata_by_mid( $meta_type, $key ) ) {
|
2109 |
$result['deleted'][] = $key;
|
2110 |
}
|
2111 |
}
|
2112 |
}
|
2113 |
|
2114 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2115 |
echo wp_json_encode( $result );
|
2116 |
die();
|
2117 |
|
2124 |
|
2125 |
$meta_type = 'gmedia_term';
|
2126 |
|
2127 |
+
$pid = (int) $gmCore->_post( 'ID', 0 );
|
2128 |
$post = $gmDB->get_term( $pid );
|
2129 |
|
2130 |
$taxonomy = $post->taxonomy;
|
2131 |
|
2132 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2133 |
|
2134 |
if ( ! current_user_can( $taxonomy . '_manage' ) || ( $user_ID !== $post->global && ! current_user_can( 'gmedia_edit_others_media' ) ) ) {
|
2135 |
+
echo wp_json_encode( array( 'error' => array( 'code' => 100, 'message' => esc_html__( 'You are not allowed to edit others media', 'grand-media' ) ), 'id' => $pid ) );
|
2136 |
die();
|
2137 |
}
|
2138 |
if ( isset( $_POST['metakeyselect'] ) && empty( $_POST['metakeyselect'] ) && empty( $_POST['metakeyinput'] ) ) {
|
2139 |
+
echo wp_json_encode( array( 'error' => array( 'code' => 101, 'message' => esc_html__( 'Choose or provide a custom field name', 'grand-media' ) ), 'id' => $pid ) );
|
2140 |
die();
|
2141 |
}
|
2142 |
|
2143 |
+
$mid = $gmCore->add_meta( $pid, $meta_type );
|
2144 |
+
if ( ! $mid ) {
|
2145 |
+
echo wp_json_encode( array( 'error' => array( 'code' => 102, 'message' => esc_html__( 'Please provide a custom field value', 'grand-media' ) ), 'id' => $pid ) );
|
2146 |
die();
|
2147 |
}
|
2148 |
|
2150 |
$meta = $gmDB->get_metadata_by_mid( $meta_type, $mid );
|
2151 |
$pid = (int) $meta->{$column};
|
2152 |
$meta = get_object_vars( $meta );
|
2153 |
+
$result = array(
|
2154 |
+
'success' => array(
|
2155 |
'meta_id' => $mid,
|
2156 |
'data' => $gmCore->_list_meta_item( $meta, $meta_type ),
|
2157 |
+
),
|
2158 |
'id' => $pid,
|
2159 |
+
);
|
2160 |
|
2161 |
if ( ! empty( $_POST['metakeyinput'] ) ) {
|
2162 |
$result['newmeta_form'] = $gmCore->meta_form( $meta_type );
|
2173 |
|
2174 |
$meta_type = 'gmedia_term';
|
2175 |
|
2176 |
+
$pid = (int) $gmCore->_post( 'ID', 0 );
|
2177 |
$post = $gmDB->get_term( $pid );
|
2178 |
|
2179 |
$taxonomy = $post->taxonomy;
|
2180 |
|
2181 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2182 |
|
2183 |
if ( ! current_user_can( $taxonomy . '_manage' ) || ( $user_ID !== $post->global && ! current_user_can( 'gmedia_edit_others_media' ) ) ) {
|
2184 |
+
echo wp_json_encode( array( 'error' => array( 'code' => 100, 'message' => esc_html__( 'You are not allowed to edit others media', 'grand-media' ) ), 'id' => $pid ) );
|
2185 |
die();
|
2186 |
}
|
2187 |
|
2188 |
+
$result = array( 'id' => $pid );
|
2189 |
|
2190 |
+
$deletemeta = $gmCore->_post( 'meta' );
|
2191 |
$column = sanitize_key( $meta_type . '_id' );
|
2192 |
+
if ( $deletemeta && is_array( $deletemeta ) ) {
|
2193 |
foreach ( $deletemeta as $key => $value ) {
|
2194 |
+
$meta = $gmDB->get_metadata_by_mid( $meta_type, $key );
|
2195 |
+
if ( ! $meta ) {
|
2196 |
continue;
|
2197 |
}
|
2198 |
+
if ( (int) $meta->{$column} !== $pid ) {
|
2199 |
continue;
|
2200 |
}
|
2201 |
if ( $gmCore->is_protected_meta( $meta->meta_key, $meta_type ) ) {
|
2202 |
continue;
|
2203 |
}
|
2204 |
+
if ( $gmDB->delete_metadata_by_mid( $meta_type, $key ) ) {
|
2205 |
$result['deleted'][] = $key;
|
2206 |
}
|
2207 |
}
|
2225 |
}
|
2226 |
|
2227 |
if ( ! current_user_can( 'gmedia_album_manage' ) ) {
|
2228 |
+
wp_send_json( array( 'error' => array( 'code' => 100, 'message' => esc_html__( 'You are not allowed to manage this taxonomy', 'grand-media' ) ), 'id' => $term_id ) );
|
2229 |
}
|
2230 |
|
2231 |
if ( ! $term_id || ! ( $term_id = $gmDB->term_exists( $term_id ) ) ) {
|
2232 |
+
wp_send_json( array( 'error' => array( 'code' => 101, 'message' => esc_html__( 'A term with the id provided does not exists', 'grand-media' ) ), 'id' => $term_id ) );
|
2233 |
}
|
2234 |
$term = $gmDB->get_term( $term_id );
|
2235 |
if ( ( (int) $term->global !== (int) $user_ID ) && ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
2236 |
+
wp_send_json( array( 'error' => array( 'code' => 102, 'message' => esc_html__( 'You are not allowed to edit others media', 'grand-media' ) ), 'id' => $term_id ) );
|
2237 |
}
|
2238 |
|
2239 |
+
$gm_ids_order = array();
|
2240 |
foreach ( $ids as $id ) {
|
2241 |
$gm_ids_order[ $id ] = $idx0;
|
2242 |
$idx0 ++;
|
2244 |
|
2245 |
$term_id = $gmDB->update_term_sortorder( $term_id, $gm_ids_order );
|
2246 |
if ( is_wp_error( $term_id ) ) {
|
2247 |
+
wp_send_json( array( 'error' => array( 'code' => 103, 'message' => $term_id->get_error_message() ), 'id' => $term_id ) );
|
2248 |
}
|
2249 |
|
2250 |
wp_send_json_success( $term_id );
|
2255 |
|
2256 |
$db_version = get_option( 'gmediaDbVersion' );
|
2257 |
$info = get_transient( 'gmediaHeavyJob' );
|
2258 |
+
$result = array( 'content' => '' );
|
2259 |
|
2260 |
$upgrading = get_transient( 'gmediaUpgrade' );
|
2261 |
if ( $upgrading ) {
|
2271 |
|
2272 |
if ( ! empty( $info ) ) {
|
2273 |
$result['content'] = '<div>' . implode( "</div>\n<div>", $info ) . '</div>';
|
2274 |
+
} elseif ( GMEDIA_DBVERSION === $db_version ) {
|
2275 |
$result['status'] = 'done';
|
2276 |
}
|
2277 |
|
2278 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2279 |
echo wp_json_encode( $result );
|
2280 |
die();
|
2281 |
}
|
2291 |
$all_count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}gmedia" );
|
2292 |
wp_cache_set( 'gmedia_count_all', $all_count );
|
2293 |
}
|
2294 |
+
$sql = "SELECT SQL_CALC_FOUND_ROWS ID, gmuid FROM {$wpdb->prefix}gmedia AS g WHERE 1 = 1
|
2295 |
+
AND ( NOT EXISTS ( SELECT * FROM {$wpdb->prefix}gmedia_meta AS gm WHERE gm.meta_key = '_hash' AND gm.gmedia_id = g.ID )
|
2296 |
+
OR NOT EXISTS ( SELECT * FROM {$wpdb->prefix}gmedia_meta AS gm2 WHERE gm2.meta_key = '_size' AND gm2.gmedia_id = g.ID)
|
2297 |
+
)
|
2298 |
+
LIMIT 20";
|
2299 |
+
// phpcs:ignore
|
2300 |
$unhashed = $wpdb->get_results( $sql );
|
2301 |
if ( ! $unhashed ) {
|
2302 |
+
$ajax_operations = get_option( 'gmedia_ajax_long_operations', array() );
|
2303 |
unset( $ajax_operations['gmedia_hash_files'] );
|
2304 |
if ( empty( $ajax_operations ) ) {
|
2305 |
delete_option( 'gmedia_ajax_long_operations' );
|
2308 |
}
|
2309 |
wp_cache_delete( 'gmedia_count_all' );
|
2310 |
|
2311 |
+
wp_send_json_success( array( 'progress' => '100%', 'info' => __( 'Indexing:', 'grand-media' ), 'done' => true ) );
|
2312 |
}
|
2313 |
|
2314 |
$unhashed_count = $wpdb->get_var( 'SELECT FOUND_ROWS()' );
|
2317 |
$fileinfo = $gmCore->fileinfo( $item->gmuid, false );
|
2318 |
$filepath = is_file( $fileinfo['filepath_original'] ) ? $fileinfo['filepath_original'] : $fileinfo['filepath'];
|
2319 |
$hash_file = hash_file( 'md5', $filepath );
|
2320 |
+
$gmDB->update_metadata( 'gmedia', $item->ID, '_hash', $hash_file );
|
2321 |
$file_size = filesize( $filepath );
|
2322 |
+
$gmDB->update_metadata( 'gmedia', $item->ID, '_size', $file_size );
|
2323 |
}
|
2324 |
|
2325 |
$progress = round( ( $all_count - $unhashed_count ) * 100 / $all_count );
|
2326 |
|
2327 |
+
wp_send_json_success( array( 'progress' => "{$progress}%", 'info' => __( 'Indexing:', 'grand-media' ) ) );
|
2328 |
}
|
2329 |
|
2330 |
add_action( 'wp_ajax_gmedia_recreate_images', 'gmedia_recreate_images' );
|
2334 |
check_ajax_referer( 'gmedia_ajax_long_operations', '_wpnonce_ajax_long_operations' );
|
2335 |
|
2336 |
$gmid = 0;
|
2337 |
+
$ajax_operations = get_option( 'gmedia_ajax_long_operations', array() );
|
2338 |
if ( ! empty( $ajax_operations['gmedia_recreate_images'] ) ) {
|
2339 |
$all_count = count( $ajax_operations['gmedia_recreate_images'] );
|
2340 |
$recreate_ids = array_filter( $ajax_operations['gmedia_recreate_images'] );
|
2353 |
if ( empty( $ajax_operations ) ) {
|
2354 |
delete_option( 'gmedia_ajax_long_operations' );
|
2355 |
|
2356 |
+
wp_send_json_success( array( 'progress' => '100%', 'info' => __( 'Done:', 'grand-media' ), 'done' => true, 'id' => $gmid ) );
|
2357 |
} else {
|
2358 |
$progress = round( ( $all_count - $do_count ) * 100 / $all_count );
|
2359 |
|
2360 |
+
wp_send_json_success( array( 'progress' => "{$progress}%", 'info' => __( 'Working:', 'grand-media' ), 'id' => $gmid ) );
|
2361 |
}
|
2362 |
}
|
2363 |
|
2364 |
+
wp_send_json_success( array( 'progress' => '100%', 'info' => __( 'Done:', 'grand-media' ), 'done' => true, 'id' => $gmid ) );
|
2365 |
}
|
2366 |
|
2367 |
add_action( 'wp_ajax_gmedia_feedback', 'gmedia_feedback' );
|
2374 |
|
2375 |
if ( ! empty( $data ) ) {
|
2376 |
$current_user = wp_get_current_user();
|
2377 |
+
$title = 'Deactivate Reason: ' . urldecode( $data['reason'] );
|
2378 |
$content = 'Website: ' . home_url() . "\r\n\r\n";
|
2379 |
foreach ( $data as $key => $val ) {
|
2380 |
$content .= ucwords( str_replace( '_', ' ', $key ) ) . ': ' . urldecode( $val ) . "\r\n\r\n";
|
2381 |
}
|
2382 |
+
$headers = array(
|
2383 |
+
'From: Gmedia Feedback <feedback@gmedia.gallery>',
|
2384 |
"Reply-To: {$current_user->display_name} <{$current_user->user_email}>",
|
2385 |
+
);
|
2386 |
wp_mail( 'codeasily@gmail.com', $title, $content, $headers );
|
2387 |
}
|
2388 |
|
2402 |
$peaks_arr = json_decode( $peaks );
|
2403 |
$peaks_arr = array_filter( $peaks_arr, 'is_numeric' );
|
2404 |
if ( 3600 !== count( $peaks_arr ) ) {
|
2405 |
+
wp_send_json_error( array( 'peaks_cnt' => count( $peaks_arr ) ) );
|
2406 |
}
|
2407 |
|
2408 |
$gmDB->update_metadata( 'gmedia', $id, '_peaks', $peaks );
|
2409 |
do_action( 'clean_gmedia_cache', $id );
|
2410 |
+
wp_send_json_success( array( 'peaks' => $peaks ) );
|
2411 |
} else {
|
2412 |
wp_send_json_error();
|
2413 |
}
|
2418 |
function gmedia_module_interaction() {
|
2419 |
global $gmDB, $gmCore;
|
2420 |
|
2421 |
+
$referer = isset( $_SERVER['HTTP_REFERER'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : '';
|
2422 |
+
$protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_PROTOCOL'] ) ) : '';
|
2423 |
+
$http_post = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
|
2424 |
+
|
2425 |
+
if ( empty( $referer ) ) {
|
2426 |
+
header( $protocol . ' 400 Bad Request' );
|
2427 |
die();
|
2428 |
}
|
2429 |
|
2430 |
+
if ( ( false === strpos( $referer, get_home_url() ) ) && ( false === strpos( $referer, get_site_url() ) ) ) {
|
2431 |
+
header( $protocol . ' 400 Bad Request' );
|
|
|
|
|
2432 |
die();
|
2433 |
}
|
2434 |
+
if ( ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' !== $_SERVER['REQUEST_METHOD'] ) || ! isset( $_SERVER['HTTP_HOST'] ) || ! strpos( get_home_url(), $http_post ) ) {
|
2435 |
+
header( $protocol . ' 400 Bad Request' );
|
2436 |
die();
|
2437 |
}
|
2438 |
|
2439 |
+
$gmID = intval( $gmCore->_post( 'hit' ) );
|
2440 |
+
if ( $gmID ) {
|
2441 |
if ( null === $gmDB->get_gmedia( $gmID ) ) {
|
2442 |
die( '0' );
|
2443 |
}
|
2447 |
$meta = array_map( 'intval', $meta );
|
2448 |
$meta = $gmCore->gm_hitcounter( $gmID, $meta );
|
2449 |
|
2450 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2451 |
echo wp_json_encode( $meta );
|
2452 |
die();
|
2453 |
}
|
2454 |
|
2455 |
+
$gmRate = $gmCore->_post( 'rate' );
|
2456 |
+
if ( $gmRate ) {
|
2457 |
/**
|
2458 |
* @var $uip
|
2459 |
* @var $gmid
|
2460 |
* @var $rate
|
2461 |
*/
|
2462 |
+
extract( $gmRate, EXTR_OVERWRITE );
|
2463 |
if ( ! intval( $gmid ) || ( null === $gmDB->get_gmedia( $gmid ) ) ) {
|
2464 |
die( '0' );
|
2465 |
}
|
2466 |
$rating = $gmDB->get_metadata( 'gmedia', $gmid, '_rating', true );
|
2467 |
+
$rating = wp_parse_args( (array) $rating, array( 'votes' => 0, 'value' => 0 ) );
|
2468 |
$old_rate = 0;
|
2469 |
|
2470 |
+
$transient_key = 'gm_rate_day' . gmdate( 'w' );
|
2471 |
$transient_value = get_transient( $transient_key );
|
2472 |
if ( false !== $transient_value ) {
|
2473 |
if ( isset( $transient_value[ $uip ][ $gmid ] ) ) {
|
2475 |
}
|
2476 |
$transient_value[ $uip ][ $gmid ] = $rate;
|
2477 |
} else {
|
2478 |
+
$transient_value = array( $uip => array( $gmid => $rate ) );
|
2479 |
}
|
2480 |
set_transient( $transient_key, $transient_value, 18 * HOUR_IN_SECONDS );
|
2481 |
|
2486 |
|
2487 |
$gmDB->update_metadata( 'gmedia', $gmid, '_rating', $rating );
|
2488 |
|
2489 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2490 |
+
echo wp_json_encode( array( $rating ) );
|
2491 |
die();
|
2492 |
}
|
2493 |
|
2499 |
function gmedia_module_load_comments() {
|
2500 |
global $gmCore;
|
2501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2502 |
check_ajax_referer( 'GmediaGallery' );
|
2503 |
|
2504 |
+
$data = $gmCore->_post( 'data' );
|
2505 |
|
2506 |
$post_id = (int) $data['post_id'];
|
2507 |
if ( $post_id ) {
|
2513 |
$comments_count = 0;
|
2514 |
}
|
2515 |
|
2516 |
+
$result = array();
|
2517 |
$result['comments_count'] = $comments_count;
|
2518 |
+
$result['content'] = '<iframe class="gmedia-comments" src="' . esc_url( $comments_link ) . '" allowtransparency="true">';
|
2519 |
|
2520 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2521 |
echo wp_json_encode( $result );
|
2522 |
|
2523 |
die();
|
2526 |
add_action( 'wp_ajax_gmedia_get_data', 'gmedia_get_data' );
|
2527 |
add_action( 'wp_ajax_nopriv_gmedia_get_data', 'gmedia_get_data' );
|
2528 |
function gmedia_get_data() {
|
2529 |
+
global $gmDB, $gmProcessor, $gmGallery, $gm_allowed_tags;
|
2530 |
|
2531 |
/** @var $gmProcessorLibrary */
|
2532 |
include_once GMEDIA_ABSPATH . 'admin/processor/class.processor.library.php';
|
2541 |
}
|
2542 |
|
2543 |
if ( ! empty( $cache_value ) ) {
|
2544 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2545 |
+
echo wp_kses( $cache_value, $gm_allowed_tags );
|
2546 |
} else {
|
2547 |
$gmedia_query = $gmDB->get_gmedias( $query_args );
|
2548 |
foreach ( $gmedia_query as &$item ) {
|
2553 |
set_transient( $cache_key, $json_string, $cache_expiration );
|
2554 |
}
|
2555 |
|
2556 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2557 |
+
|
2558 |
+
echo wp_kses( $json_string, $gm_allowed_tags );
|
2559 |
}
|
2560 |
|
2561 |
die();
|
admin/app.php
CHANGED
@@ -1,17 +1,14 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'You are not allowed to call this page directly.' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* gmediaApp()
|
8 |
-
*
|
9 |
-
* @return mixed content
|
10 |
*/
|
11 |
function gmediaApp() {
|
12 |
global $gmCore, $gmGallery;
|
13 |
|
14 |
-
|
|
|
15 |
$gm_options = get_option( 'gmediaOptions' );
|
16 |
$gm_options['mobile_app'] = (int) $force_app_status;
|
17 |
$gmGallery->options['mobile_app'] = $gm_options['mobile_app'];
|
@@ -22,7 +19,7 @@ function gmediaApp() {
|
|
22 |
update_option( 'gmediaOptions', $gm_options );
|
23 |
}
|
24 |
|
25 |
-
$alert = $gmCore->alert( 'danger',
|
26 |
|
27 |
$site_ID = (int) $gmGallery->options['site_ID'];
|
28 |
$mobile_app = (int) $gmGallery->options['mobile_app'];
|
@@ -30,46 +27,49 @@ function gmediaApp() {
|
|
30 |
$current_user = wp_get_current_user();
|
31 |
|
32 |
?>
|
33 |
-
<div class="
|
34 |
<?php wp_nonce_field( 'GmediaService' ); ?>
|
35 |
-
<div class="
|
|
|
36 |
if ( empty( $_SERVER['HTTP_X_REAL_IP'] ) && ( '127.0.0.1' === $_SERVER['REMOTE_ADDR'] || '::1' === $_SERVER['REMOTE_ADDR'] ) ) {
|
37 |
-
echo $alert;
|
38 |
} else {
|
39 |
if ( ! $mobile_app || ! $site_ID ) {
|
40 |
-
echo $alert;
|
41 |
?>
|
42 |
<div class="notice updated gm-message">
|
43 |
<div class="gm-message-content">
|
44 |
<div class="gm-plugin-icon">
|
45 |
-
<img src="<?php echo esc_url( plugins_url( '
|
46 |
</div>
|
47 |
-
<?php
|
48 |
-
|
|
|
|
|
49 |
</div>
|
50 |
<div class="gm-message-actions">
|
51 |
<span class="spinner" style="float: none;"></span>
|
52 |
-
<button class="button button-primary gm_service_action" data-action="allow" data-nonce="<?php echo esc_attr( wp_create_nonce( 'GmediaService' ) ); ?>"><?php
|
53 |
</div>
|
54 |
<div class="gm-message-plus gm-closed">
|
55 |
-
<a class="gm-mp-trigger" href="#" onclick="jQuery('.gm-message-plus').toggleClass('gm-closed gm-opened'); return false;"><?php
|
56 |
<ul>
|
57 |
<li>
|
58 |
<i class="dashicons dashicons-admin-users"></i>
|
59 |
|
60 |
<div>
|
61 |
-
<span><?php
|
62 |
|
63 |
-
<p><?php
|
64 |
</div>
|
65 |
</li>
|
66 |
<li>
|
67 |
<i class="dashicons dashicons-admin-settings"></i>
|
68 |
|
69 |
<div>
|
70 |
-
<span><?php
|
71 |
|
72 |
-
<p><?php
|
73 |
</div>
|
74 |
</li>
|
75 |
</ul>
|
@@ -79,46 +79,50 @@ function gmediaApp() {
|
|
79 |
}
|
80 |
}
|
81 |
|
82 |
-
|
83 |
-
|
|
|
84 |
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
85 |
<div class="container-fluid">
|
86 |
<div class="row">
|
87 |
<div class="col-xs-6">
|
88 |
-
<p
|
89 |
-
|
90 |
-
echo '
|
91 |
-
|
|
|
|
|
|
|
92 |
<div class="gmapp-description">
|
93 |
<div style="text-align:center; margin-bottom:30px;">
|
94 |
<a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:0 30px; max-height:88px;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/icon-128x128.png" alt=""/></a>
|
95 |
-
<a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:0 30px;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/appstore_button.png"/></a>
|
96 |
</div>
|
97 |
|
98 |
-
<p><?php
|
99 |
-
<p><?php
|
100 |
|
101 |
<p class="text-center"><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide1.jpg" alt=""/></p>
|
102 |
|
103 |
<div class="text-left" style="padding-top:40%;">
|
104 |
<div style="margin-right:20%">
|
105 |
-
<h3><?php
|
106 |
-
<p><?php
|
107 |
</div>
|
108 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide3.jpg" alt=""/></p>
|
109 |
</div>
|
110 |
<div class="text-left" style="padding-top:40%;">
|
111 |
<div style="margin-right:20%">
|
112 |
-
<h3><?php
|
113 |
-
<p><?php
|
114 |
</div>
|
115 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide5.jpg" alt=""/></p>
|
116 |
</div>
|
117 |
|
118 |
<div class="well well-lg text-center" style="margin-top:40%; padding-top:50px;">
|
119 |
-
<p><?php
|
120 |
<div>
|
121 |
-
<a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:30px;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/appstore_button.png"/></a>
|
122 |
<a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:30px; max-height:88px;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/icon-128x128.png" alt=""/></a>
|
123 |
</div>
|
124 |
</div>
|
@@ -126,46 +130,46 @@ function gmediaApp() {
|
|
126 |
</div>
|
127 |
<div class="col-xs-6">
|
128 |
<div class="well-lg well">
|
129 |
-
<p><?php
|
130 |
<div class="form-group">
|
131 |
-
<label><?php
|
132 |
<input type="text" name="site_email" class="form-control input-sm" value="<?php echo esc_attr( get_option( 'admin_email' ) ); ?>" readonly/>
|
133 |
</div>
|
134 |
<div class="form-group">
|
135 |
-
<label><?php
|
136 |
<input type="text" name="site_url" class="form-control input-sm" value="<?php echo esc_url( home_url() ); ?>" readonly/>
|
137 |
</div>
|
138 |
<div class="form-group">
|
139 |
-
<label><?php
|
140 |
<input type="text" name="site_title" class="form-control input-sm" value="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" readonly/>
|
141 |
</div>
|
142 |
<div class="form-group">
|
143 |
-
<label><?php
|
144 |
<textarea rows="2" cols="10" name="site_description" class="form-control input-sm" readonly><?php echo esc_attr( get_bloginfo( 'description' ) ); ?></textarea>
|
145 |
</div>
|
146 |
</div>
|
147 |
|
148 |
<div class="gmapp-description">
|
149 |
-
<div class="text-
|
150 |
<div style="margin-left:20%">
|
151 |
-
<h3><?php
|
152 |
-
<p><?php
|
153 |
</div>
|
154 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide2.jpg" alt=""/></p>
|
155 |
</div>
|
156 |
|
157 |
-
<div class="text-
|
158 |
<div style="margin-left:20%">
|
159 |
-
<h3><?php
|
160 |
-
<p><?php
|
161 |
</div>
|
162 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide4.jpg" alt=""/></p>
|
163 |
</div>
|
164 |
|
165 |
-
<div class="text-
|
166 |
<div style="margin-left:20%">
|
167 |
-
<h3><?php
|
168 |
-
<p><?php
|
169 |
</div>
|
170 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide6.jpg" alt=""/></p>
|
171 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* gmediaApp()
|
|
|
|
|
6 |
*/
|
7 |
function gmediaApp() {
|
8 |
global $gmCore, $gmGallery;
|
9 |
|
10 |
+
$force_app_status = $gmCore->_get( 'force_app_status' );
|
11 |
+
if ( false !== $force_app_status ) {
|
12 |
$gm_options = get_option( 'gmediaOptions' );
|
13 |
$gm_options['mobile_app'] = (int) $force_app_status;
|
14 |
$gmGallery->options['mobile_app'] = $gm_options['mobile_app'];
|
19 |
update_option( 'gmediaOptions', $gm_options );
|
20 |
}
|
21 |
|
22 |
+
$alert = $gmCore->alert( 'danger', esc_html__( 'Your server is not accessable by iOS application', 'grand-media' ) );
|
23 |
|
24 |
$site_ID = (int) $gmGallery->options['site_ID'];
|
25 |
$mobile_app = (int) $gmGallery->options['mobile_app'];
|
27 |
$current_user = wp_get_current_user();
|
28 |
|
29 |
?>
|
30 |
+
<div class="card m-0 mw-100 p-0" id="gm_application">
|
31 |
<?php wp_nonce_field( 'GmediaService' ); ?>
|
32 |
+
<div class="card-body" id="gmedia-service-msg-panel">
|
33 |
+
<?php
|
34 |
if ( empty( $_SERVER['HTTP_X_REAL_IP'] ) && ( '127.0.0.1' === $_SERVER['REMOTE_ADDR'] || '::1' === $_SERVER['REMOTE_ADDR'] ) ) {
|
35 |
+
echo wp_kses_post( $alert );
|
36 |
} else {
|
37 |
if ( ! $mobile_app || ! $site_ID ) {
|
38 |
+
echo wp_kses_post( $alert );
|
39 |
?>
|
40 |
<div class="notice updated gm-message">
|
41 |
<div class="gm-message-content">
|
42 |
<div class="gm-plugin-icon">
|
43 |
+
<img src="<?php echo esc_url( plugins_url( 'assets/img/icon-128x128.png', __FILE__ ) ); ?>" width="80" height="80" alt="">
|
44 |
</div>
|
45 |
+
<?php
|
46 |
+
// translators: username.
|
47 |
+
echo wp_kses_post( sprintf( __( '<p>Hey %s,<br>You should allow some data about your <b>Gmedia Gallery</b> to be sent to <a href="https://codeasily.com/" target="_blank" tabindex="1">codeasily.com</a> in order to use iOS application. <br />These data required if you want to use Gmedia iOS application on your iPhone.</p>', 'grand-media' ), $current_user->display_name ) );
|
48 |
+
?>
|
49 |
</div>
|
50 |
<div class="gm-message-actions">
|
51 |
<span class="spinner" style="float: none;"></span>
|
52 |
+
<button class="button button-primary gm_service_action" data-action="allow" data-nonce="<?php echo esc_attr( wp_create_nonce( 'GmediaService' ) ); ?>"><?php esc_html_e( 'Allow & Continue', 'grand-media' ); ?></button>
|
53 |
</div>
|
54 |
<div class="gm-message-plus gm-closed">
|
55 |
+
<a class="gm-mp-trigger" href="#" onclick="jQuery('.gm-message-plus').toggleClass('gm-closed gm-opened'); return false;"><?php esc_html_e( 'What permissions are being granted?', 'grand-media' ); ?></a>
|
56 |
<ul>
|
57 |
<li>
|
58 |
<i class="dashicons dashicons-admin-users"></i>
|
59 |
|
60 |
<div>
|
61 |
+
<span><?php esc_html_e( 'Your Profile Overview', 'grand-media' ); ?></span>
|
62 |
|
63 |
+
<p><?php esc_html_e( 'Name and email address', 'grand-media' ); ?></p>
|
64 |
</div>
|
65 |
</li>
|
66 |
<li>
|
67 |
<i class="dashicons dashicons-admin-settings"></i>
|
68 |
|
69 |
<div>
|
70 |
+
<span><?php esc_html_e( 'Your Site Overview', 'grand-media' ); ?></span>
|
71 |
|
72 |
+
<p><?php esc_html_e( 'Site URL, WP version, PHP version, active theme & plugins', 'grand-media' ); ?></p>
|
73 |
</div>
|
74 |
</li>
|
75 |
</ul>
|
79 |
}
|
80 |
}
|
81 |
|
82 |
+
?>
|
83 |
+
</div>
|
84 |
+
<div class="card-body" id="gm_application_data">
|
85 |
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
86 |
<div class="container-fluid">
|
87 |
<div class="row">
|
88 |
<div class="col-xs-6">
|
89 |
+
<p>
|
90 |
+
<?php
|
91 |
+
echo 'Server address: ' . esc_html( $_SERVER['SERVER_ADDR'] );
|
92 |
+
echo '<br>Remote address: ' . esc_html( $_SERVER['REMOTE_ADDR'] );
|
93 |
+
echo '<br>HTTP X Real IP: ' . ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ? esc_html( $_SERVER['HTTP_X_REAL_IP'] ) : '' );
|
94 |
+
?>
|
95 |
+
</p>
|
96 |
<div class="gmapp-description">
|
97 |
<div style="text-align:center; margin-bottom:30px;">
|
98 |
<a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:0 30px; max-height:88px;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/icon-128x128.png" alt=""/></a>
|
99 |
+
<a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:0 30px;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/appstore_button.png" alt=""/></a>
|
100 |
</div>
|
101 |
|
102 |
+
<p><?php echo wp_kses_post( __( 'You are using one of the best plugins to create media library as well as your personal cloud storage on your WordPress website. You have chosen <strong><a href="https://wordpress.org/plugins/grand-media/" target="_blank">Gmedia Gallery Plugin</a></strong> and this choice gives you great opportunities to manage and organise your media library.', 'grand-media' ) ); ?></p>
|
103 |
+
<p><?php esc_html_e( 'We are happy to offer you a simple way to access your photos and audios by means of your iOS devices: at a few taps and you will be able to create great photo gallery and share it with your friends, readers and subscribers.', 'grand-media' ); ?></p>
|
104 |
|
105 |
<p class="text-center"><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide1.jpg" alt=""/></p>
|
106 |
|
107 |
<div class="text-left" style="padding-top:40%;">
|
108 |
<div style="margin-right:20%">
|
109 |
+
<h3><?php esc_html_e( 'DISCOVER and SHARE', 'grand-media' ); ?></h3>
|
110 |
+
<p><?php esc_html_e( 'Search, learn, open new horizons, share! It is just as easy as a piece of cake! Your photos will be seen by your friends, relatives and others.', 'grand-media' ); ?></p>
|
111 |
</div>
|
112 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide3.jpg" alt=""/></p>
|
113 |
</div>
|
114 |
<div class="text-left" style="padding-top:40%;">
|
115 |
<div style="margin-right:20%">
|
116 |
+
<h3><?php esc_html_e( 'PRIVATE CONTENT', 'grand-media' ); ?></h3>
|
117 |
+
<p><?php esc_html_e( 'If you are one of subscribers, contributors, authors, editors or administrators, use your login and password to get an access to the private content.', 'grand-media' ); ?></p>
|
118 |
</div>
|
119 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide5.jpg" alt=""/></p>
|
120 |
</div>
|
121 |
|
122 |
<div class="well well-lg text-center" style="margin-top:40%; padding-top:50px;">
|
123 |
+
<p><?php esc_html_e( 'Download Gmedia iOS application from the App Store to manage your Gmedia Library from iPhone.', 'grand-media' ); ?></p>
|
124 |
<div>
|
125 |
+
<a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:30px;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/appstore_button.png" alt=""/></a>
|
126 |
<a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:30px; max-height:88px;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/icon-128x128.png" alt=""/></a>
|
127 |
</div>
|
128 |
</div>
|
130 |
</div>
|
131 |
<div class="col-xs-6">
|
132 |
<div class="well-lg well">
|
133 |
+
<p><?php esc_html_e( 'Below you can see information about your website that will be used by GmediaService and iOS application, so you\'ll be able to manage your Gmedia Library with your smartphone and other people can find and view your public collections.', 'grand-media' ); ?></p>
|
134 |
<div class="form-group">
|
135 |
+
<label><?php esc_html_e( 'Email', 'grand-media' ); ?>:</label>
|
136 |
<input type="text" name="site_email" class="form-control input-sm" value="<?php echo esc_attr( get_option( 'admin_email' ) ); ?>" readonly/>
|
137 |
</div>
|
138 |
<div class="form-group">
|
139 |
+
<label><?php esc_html_e( 'Site URL', 'grand-media' ); ?>:</label>
|
140 |
<input type="text" name="site_url" class="form-control input-sm" value="<?php echo esc_url( home_url() ); ?>" readonly/>
|
141 |
</div>
|
142 |
<div class="form-group">
|
143 |
+
<label><?php esc_html_e( 'Site Title', 'grand-media' ); ?>:</label>
|
144 |
<input type="text" name="site_title" class="form-control input-sm" value="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" readonly/>
|
145 |
</div>
|
146 |
<div class="form-group">
|
147 |
+
<label><?php esc_html_e( 'Site Description', 'grand-media' ); ?>:</label>
|
148 |
<textarea rows="2" cols="10" name="site_description" class="form-control input-sm" readonly><?php echo esc_attr( get_bloginfo( 'description' ) ); ?></textarea>
|
149 |
</div>
|
150 |
</div>
|
151 |
|
152 |
<div class="gmapp-description">
|
153 |
+
<div class="text-end" style="padding-top:35%;">
|
154 |
<div style="margin-left:20%">
|
155 |
+
<h3><?php esc_html_e( 'FIND and ADD SITE it’s SIMPLY', 'grand-media' ); ?></h3>
|
156 |
+
<p><?php esc_html_e( 'Just a few touches and our smart search bar will let you find and add your website, your friend’s website or a famous blogger’s site to your favourites list.', 'grand-media' ); ?></p>
|
157 |
</div>
|
158 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide2.jpg" alt=""/></p>
|
159 |
</div>
|
160 |
|
161 |
+
<div class="text-end" style="padding-top:35%;">
|
162 |
<div style="margin-left:20%">
|
163 |
+
<h3><?php esc_html_e( 'MP3', 'grand-media' ); ?></h3>
|
164 |
+
<p><?php esc_html_e( 'Take your favourite music track with you on a trip or create a playlist to travel with it! It is so simple with Gmedia. Share your energy and positive mood with your friends!', 'grand-media' ); ?></p>
|
165 |
</div>
|
166 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide4.jpg" alt=""/></p>
|
167 |
</div>
|
168 |
|
169 |
+
<div class="text-end" style="padding-top:35%;">
|
170 |
<div style="margin-left:20%">
|
171 |
+
<h3><?php esc_html_e( 'GMEDIA LIBRARY', 'grand-media' ); ?></h3>
|
172 |
+
<p><?php esc_html_e( 'If you are one of subscribers, contributors,authors, editors or administrators, use your login and password to get an access to private content. If your type of users has an access to Gmedia Library, you will be able to create photo collections and download pictures just from iPhone, using wide functional opportunities of our app and plugin.', 'grand-media' ); ?></p>
|
173 |
</div>
|
174 |
<p><img style="max-width:90%;" src="<?php echo esc_url( $gmCore->gmedia_url ); ?>/admin/assets/img/slide6.jpg" alt=""/></p>
|
175 |
</div>
|
admin/assets/css/gmedia.admin.css
CHANGED
@@ -23,6 +23,11 @@
|
|
23 |
|
24 |
a {
|
25 |
color: #0074a2;
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
input[type="checkbox"] {
|
@@ -112,6 +117,10 @@ body.gmedia-blank pre {
|
|
112 |
border: none;
|
113 |
}
|
114 |
|
|
|
|
|
|
|
|
|
115 |
.gmedia-body div#gm-message {
|
116 |
position: absolute;
|
117 |
right: 5px;
|
@@ -147,6 +156,7 @@ div.gmedia-modal .row {
|
|
147 |
|
148 |
div#gmedia-container form.row {
|
149 |
padding: 15px 0;
|
|
|
150 |
}
|
151 |
|
152 |
body.gmedia-blank div#gmedia-container {
|
@@ -172,6 +182,7 @@ div#gmedia-logo {
|
|
172 |
position: relative;
|
173 |
margin: 0 30px 0 15px;
|
174 |
font-size: 48px;
|
|
|
175 |
text-shadow: 1px 1px 4px #000000;
|
176 |
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
177 |
color: #ffffff;
|
@@ -269,7 +280,6 @@ form.gmedia-search-form .form-group {
|
|
269 |
form#gmedia-pager {
|
270 |
float: left;
|
271 |
width: auto;
|
272 |
-
display: block;
|
273 |
}
|
274 |
|
275 |
form#gmedia-pager span,
|
@@ -280,6 +290,11 @@ form#gmedia-pager input {
|
|
280 |
float: none;
|
281 |
}
|
282 |
|
|
|
|
|
|
|
|
|
|
|
283 |
form#gmedia-pager input.pager_current_page {
|
284 |
padding-left: 0;
|
285 |
padding-right: 0;
|
@@ -304,14 +319,6 @@ a.text-danger {
|
|
304 |
|
305 |
.va-middle { vertical-align: middle }
|
306 |
|
307 |
-
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
|
308 |
-
background-color: #e8e8e8;
|
309 |
-
}
|
310 |
-
|
311 |
-
.gm-checkgroup {
|
312 |
-
margin-right: 20px;
|
313 |
-
}
|
314 |
-
|
315 |
.gm-backfade {
|
316 |
background-color: rgba(0, 0, 0, 0.1);
|
317 |
}
|
@@ -324,21 +331,21 @@ a.text-danger {
|
|
324 |
pointer-events: none;
|
325 |
}
|
326 |
|
327 |
-
.
|
328 |
|
329 |
-
.panel-floatingHeader .
|
330 |
-
.panel-absoluteHeader .
|
331 |
|
332 |
.panel-fixed-header { position: relative; }
|
333 |
|
334 |
-
.panel-fixed-header .
|
335 |
/*transition:top 0.2s ease-out; -webkit-transition:top 0.2s ease-out;*/
|
336 |
}
|
337 |
|
338 |
-
.
|
339 |
|
340 |
-
body.gmedia-blank .panel-floatingHeader .
|
341 |
-
.panel-floatingHeader .
|
342 |
position: fixed;
|
343 |
top: 32px;
|
344 |
z-index: 20;
|
@@ -348,12 +355,12 @@ body.gmedia-blank .panel-floatingHeader .panel-heading,
|
|
348 |
box-shadow: 0 5px 10px #888888;
|
349 |
}
|
350 |
|
351 |
-
body.gmedia-blank .panel-floatingHeader .
|
352 |
top: 0;
|
353 |
}
|
354 |
|
355 |
-
body.gmedia-blank .panel-absoluteHeader .
|
356 |
-
.panel-absoluteHeader .
|
357 |
position: absolute;
|
358 |
z-index: 10;
|
359 |
top: auto;
|
@@ -366,6 +373,14 @@ body.gmedia-blank .panel-absoluteHeader .panel-heading,
|
|
366 |
.dropdown-menu:not(.bootstrap-datetimepicker-widget) {
|
367 |
max-height: calc(100vh - 50px);
|
368 |
overflow-y: auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
}
|
370 |
|
371 |
div#gm-list-table {
|
@@ -383,7 +398,10 @@ div#gm-list-table::before {
|
|
383 |
overflow: hidden;
|
384 |
}
|
385 |
|
386 |
-
.list-group-item {
|
|
|
|
|
|
|
387 |
|
388 |
.list-group-item.row {
|
389 |
position: relative;
|
@@ -397,6 +415,7 @@ div.list-group-item.d-row {
|
|
397 |
position: relative;
|
398 |
color: inherit;
|
399 |
z-index: 1;
|
|
|
400 |
}
|
401 |
|
402 |
.no-touch div.list-group-item.d-row:hover {
|
@@ -485,20 +504,26 @@ label.cb_media-object-gallery {
|
|
485 |
padding-top: 4px;
|
486 |
}
|
487 |
|
488 |
-
.d-row .thumbnail {
|
489 |
margin-bottom: 0;
|
490 |
}
|
491 |
|
492 |
-
.gm-selected .thumbnail {
|
493 |
border-color: #428bca;
|
494 |
}
|
495 |
|
496 |
-
.thumbnail {
|
497 |
position: relative;
|
498 |
display: inline-block;
|
499 |
max-width: 100%;
|
500 |
}
|
501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
.display-as-grid .gm-item-cell {
|
503 |
padding: 12px 12px 10px;
|
504 |
border: 4px solid #ffffff;
|
@@ -551,7 +576,7 @@ label.cb_media-object-gallery {
|
|
551 |
overflow: hidden;
|
552 |
}
|
553 |
|
554 |
-
p.thumbnail.gmedia-related-image,
|
555 |
.related-media-previews p.gmedia-related-image {
|
556 |
width: 30%;
|
557 |
float: left;
|
@@ -561,14 +586,14 @@ p.thumbnail.gmedia-related-image,
|
|
561 |
margin-top: 7px;
|
562 |
}
|
563 |
|
564 |
-
.edit-gmedia p.thumbnail.gmedia-related-image,
|
565 |
.edit-gmedia .related-media-previews p.gmedia-related-image {
|
566 |
width: 44%;
|
567 |
float: none;
|
568 |
vertical-align: top;
|
569 |
}
|
570 |
|
571 |
-
p.thumbnail.gmedia-related-image .gm-remove {
|
572 |
padding: 1px;
|
573 |
font-size: 15px;
|
574 |
font-weight: bold;
|
@@ -588,11 +613,11 @@ p.thumbnail.gmedia-related-image .gm-remove {
|
|
588 |
cursor: pointer;
|
589 |
}
|
590 |
|
591 |
-
p.thumbnail.gmedia-related-image:hover .gm-remove {
|
592 |
transform: scale(1);
|
593 |
}
|
594 |
|
595 |
-
p.thumbnail.gmedia-related-image .image-wrapper {
|
596 |
display: block;
|
597 |
position: relative;
|
598 |
width: 100%;
|
@@ -601,7 +626,7 @@ p.thumbnail.gmedia-related-image .image-wrapper {
|
|
601 |
cursor: move;
|
602 |
}
|
603 |
|
604 |
-
p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
605 |
position: absolute;
|
606 |
left: 0;
|
607 |
top: 0;
|
@@ -643,7 +668,7 @@ p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
|
643 |
|
644 |
.gm-item-cell:hover .gmedia-actions { transform: translateY(0) translateZ(0); opacity: 1;}
|
645 |
|
646 |
-
.display-as-grid div.thumbnail {
|
647 |
cursor: pointer;
|
648 |
position: relative;
|
649 |
display: block;
|
@@ -654,21 +679,21 @@ p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
|
654 |
backface-visibility: hidden;
|
655 |
}
|
656 |
|
657 |
-
.display-as-grid div.thumbnail:before {
|
658 |
content: "";
|
659 |
display: block;
|
660 |
padding-top: 100%;
|
661 |
}
|
662 |
|
663 |
-
.display-as-grid .gm-selected div.thumbnail {
|
664 |
-webkit-box-shadow: 0 0 0 7px #1e8cbe;
|
665 |
-moz-box-shadow: 0 0 0 7px #1e8cbe;
|
666 |
box-shadow: 0 0 0 7px #1e8cbe;
|
667 |
border-radius: 1px;
|
668 |
}
|
669 |
|
670 |
-
.display-as-grid div.thumbnail .cb_media-object,
|
671 |
-
.display-as-grid div.thumbnail .gm-item-cell-media-object {
|
672 |
bottom: 0;
|
673 |
left: 0;
|
674 |
overflow: hidden;
|
@@ -679,7 +704,7 @@ p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
|
679 |
margin: 0;
|
680 |
}
|
681 |
|
682 |
-
.display-as-grid div.thumbnail .gm-cell-more {
|
683 |
position: absolute;
|
684 |
left: 0; top: 0; right: 0;
|
685 |
background: rgba(256, 256, 256, 0.6);
|
@@ -687,7 +712,7 @@ p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
|
687 |
cursor: auto;
|
688 |
}
|
689 |
|
690 |
-
.display-as-grid div.thumbnail .gm-cell-more-btn {
|
691 |
position: absolute;
|
692 |
top: 0; right: 0;
|
693 |
padding: 5px;
|
@@ -696,7 +721,7 @@ p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
|
696 |
/*text-shadow: 1px 1px 1px #83acbf;*/
|
697 |
}
|
698 |
|
699 |
-
.display-as-grid div.thumbnail .gm-cell-more-content {
|
700 |
padding: 5px 5px 0;
|
701 |
display: none;
|
702 |
overflow: hidden;
|
@@ -704,45 +729,45 @@ p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
|
704 |
font-size: 11px;
|
705 |
}
|
706 |
|
707 |
-
.display-as-grid div.thumbnail .gm-cell-more-content .gmedia-actions {
|
708 |
display: none;
|
709 |
}
|
710 |
|
711 |
-
.display-as-grid div.thumbnail .gm-cell-more:hover,
|
712 |
-
.display-as-grid div.thumbnail .gm-cell-more.gm-cell-more-active {
|
713 |
z-index: 10;
|
714 |
-webkit-box-shadow: 0 0 0 1px #dddddd, 0 4px 3px -1px rgba(0, 0, 0, 0.3);
|
715 |
-moz-box-shadow: 0 0 0 1px #dddddd, 0 4px 3px -1px rgba(0, 0, 0, 0.3);
|
716 |
box-shadow: 0 0 0 1px #dddddd, 0 4px 3px -1px rgba(0, 0, 0, 0.3);
|
717 |
}
|
718 |
|
719 |
-
.display-as-grid div.thumbnail .gm-cell-more:hover {
|
720 |
z-index: 11;
|
721 |
}
|
722 |
|
723 |
-
.display-as-grid div.thumbnail .gm-cell-more:hover > div {
|
724 |
background: rgba(256, 256, 256, 0.7);
|
725 |
}
|
726 |
|
727 |
-
.display-as-grid div.thumbnail .gm-cell-more-active .gm-cell-more-content .gmedia-actions {
|
728 |
display: block;
|
729 |
}
|
730 |
|
731 |
-
.display-as-grid div.thumbnail .gm-cell-more.gm-cell-more-active > div {
|
732 |
background: rgba(256, 256, 256, 0.9);
|
733 |
}
|
734 |
|
735 |
-
.display-as-grid div.thumbnail .gm-cell-more:hover .gm-cell-more-content,
|
736 |
-
.display-as-grid div.thumbnail .gm-cell-more.gm-cell-more-active .gm-cell-more-content {
|
737 |
display: block;
|
738 |
}
|
739 |
|
740 |
-
.display-as-grid div.thumbnail .gm-cell-more-content p {
|
741 |
font-size: 11px;
|
742 |
}
|
743 |
|
744 |
-
.display-as-grid div.thumbnail .cb_media-object .centered,
|
745 |
-
.display-as-grid div.thumbnail .gm-item-cell-media-object .centered {
|
746 |
height: 100%;
|
747 |
left: 0;
|
748 |
position: absolute;
|
@@ -751,52 +776,56 @@ p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
|
751 |
width: 100%;
|
752 |
}
|
753 |
|
754 |
-
.display-as-grid div.thumbnail.landscape .cb_media-object .centered,
|
755 |
-
.display-as-grid div.thumbnail.landscape .gm-item-cell-media-object .centered {
|
756 |
transform: translate(50%, 50.5%) translateZ(0);
|
757 |
}
|
758 |
|
759 |
-
.display-as-grid div.thumbnail .cb_media-object img,
|
760 |
-
.display-as-grid div.thumbnail .gm-item-cell-media-object img {
|
761 |
left: 0;
|
762 |
position: absolute;
|
763 |
top: 0;
|
764 |
transform: translate(-50%, -50%) translateZ(0);
|
765 |
}
|
766 |
|
767 |
-
.display-as-grid div.thumbnail.landscape img {
|
768 |
height: 101%;
|
769 |
width: auto;
|
|
|
770 |
}
|
771 |
|
772 |
-
.display-as-grid div.thumbnail.portrait img {
|
773 |
height: auto;
|
774 |
width: 100%;
|
775 |
}
|
776 |
|
777 |
-
.display-as-grid.invert-ratio div.thumbnail.landscape img {
|
778 |
height: auto;
|
779 |
width: 101%;
|
|
|
780 |
}
|
781 |
|
782 |
-
.display-as-grid.invert-ratio div.thumbnail.portrait img {
|
783 |
height: 101%;
|
784 |
width: auto;
|
|
|
785 |
}
|
786 |
|
787 |
-
.thumbnail img.gmedia-typethumb,
|
788 |
-
.display-as-grid div.thumbnail .cb_media-object img.gmedia-typethumb,
|
789 |
-
.display-as-grid div.thumbnail .gm-item-cell-media-object img.gmedia-typethumb {
|
790 |
position: absolute;
|
791 |
right: 7px;
|
792 |
bottom: 7px;
|
793 |
height: 75px;
|
794 |
max-height: 60%;
|
795 |
width: auto;
|
|
|
796 |
}
|
797 |
|
798 |
-
.display-as-grid div.thumbnail .cb_media-object img.gmedia-typethumb,
|
799 |
-
.display-as-grid div.thumbnail .gm-item-cell-media-object img.gmedia-typethumb {
|
800 |
left: auto;
|
801 |
top: auto;
|
802 |
right: 50%;
|
@@ -828,7 +857,7 @@ p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
|
828 |
|
829 |
.thumbwrap .cb_media-object { width: 100%; margin: 0; display: flex; }
|
830 |
|
831 |
-
.cb_media-object .thumbnail {
|
832 |
width: 100%;
|
833 |
}
|
834 |
|
@@ -961,12 +990,16 @@ div#pluploadUploader_buttons { margin-bottom: 5px; }
|
|
961 |
|
962 |
div.plupload_started { float: left; }
|
963 |
|
964 |
-
div.
|
965 |
-webkit-transition: all .2s ease-in-out;
|
966 |
transition: all .2s ease-in-out;
|
967 |
}
|
968 |
|
969 |
-
|
|
|
|
|
|
|
|
|
970 |
padding: 0;
|
971 |
}
|
972 |
|
@@ -1002,6 +1035,10 @@ div#gmedia-msg-panel .alert,
|
|
1002 |
padding: 20px 10px 0;
|
1003 |
}
|
1004 |
|
|
|
|
|
|
|
|
|
1005 |
.selectize-control.input-sm .selectize-input {
|
1006 |
min-height: 30px;
|
1007 |
padding: 2px 10px;
|
@@ -1116,10 +1153,10 @@ a.trash-icon:hover { color: #843534; }
|
|
1116 |
.object-actions .term-shortcode input,
|
1117 |
.object-actions .term-shortcode .input-buffer { font-family: Courier, sans-serif; font-size: 14px; line-height: 100%; letter-spacing: 0.05em; border: none; box-shadow: none; background-color: #fff; margin: 0; padding: 0;}
|
1118 |
|
1119 |
-
.
|
1120 |
|
1121 |
-
.
|
1122 |
-
.
|
1123 |
|
1124 |
.term-shortcode .input-buffer {position: absolute; top: -1000px; left: -1000px; visibility: hidden; white-space: nowrap;}
|
1125 |
|
@@ -1152,6 +1189,14 @@ a.edit_tag_save.btn {
|
|
1152 |
padding-bottom: 0;
|
1153 |
}
|
1154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1155 |
.no-touch a.edit_tag_save.btn-link:hover {
|
1156 |
text-decoration: none;
|
1157 |
}
|
@@ -1198,7 +1243,7 @@ a.edit_tag_save.btn {
|
|
1198 |
background-color: #d0e9c6;
|
1199 |
}
|
1200 |
|
1201 |
-
.choose-module .thumbnail {
|
1202 |
margin-bottom: 0;
|
1203 |
}
|
1204 |
|
@@ -1206,7 +1251,7 @@ a.edit_tag_save.btn {
|
|
1206 |
overflow: hidden;
|
1207 |
}
|
1208 |
|
1209 |
-
.media > .thumbnail.
|
1210 |
padding: 4px;
|
1211 |
margin-right: 10px
|
1212 |
}
|
@@ -1272,7 +1317,7 @@ a.edit_tag_save.btn {
|
|
1272 |
right: 0;
|
1273 |
top: 0;
|
1274 |
bottom: 0;
|
1275 |
-
padding: 0.
|
1276 |
line-height: 100%;
|
1277 |
}
|
1278 |
|
@@ -1300,12 +1345,12 @@ body#media-upload .panel {
|
|
1300 |
border-top: none;
|
1301 |
}
|
1302 |
|
1303 |
-
body#media-upload .
|
1304 |
position: relative;
|
1305 |
z-index: 100;
|
1306 |
}
|
1307 |
|
1308 |
-
body#media-upload .
|
1309 |
position: absolute;
|
1310 |
top: 55px;
|
1311 |
bottom: 0;
|
@@ -1316,24 +1361,24 @@ body#media-upload .panel-body {
|
|
1316 |
padding-bottom: 0;
|
1317 |
}
|
1318 |
|
1319 |
-
body#media-upload .
|
1320 |
height: 100%;
|
1321 |
}
|
1322 |
|
1323 |
-
body#media-upload .
|
1324 |
height: 100%;
|
1325 |
overflow: auto;
|
1326 |
padding-top: 15px;
|
1327 |
padding-bottom: 15px;
|
1328 |
}
|
1329 |
|
1330 |
-
body#media-upload .
|
1331 |
border-width: 0;
|
1332 |
border-top-width: 1px;
|
1333 |
margin: 0;
|
1334 |
}
|
1335 |
|
1336 |
-
body#media-upload .
|
1337 |
border-width: 0;
|
1338 |
}
|
1339 |
|
@@ -1391,22 +1436,22 @@ body#media-upload .media-upload-sidebar .media-upload-form-container {
|
|
1391 |
padding: 15px;
|
1392 |
}
|
1393 |
|
1394 |
-
body#media-upload .media-upload-sidebar .
|
1395 |
min-height: 57px;
|
1396 |
}
|
1397 |
|
1398 |
-
body#media-upload .thumbnail {
|
1399 |
margin: 0 5px 5px 0;
|
1400 |
position: relative;
|
1401 |
display: inline-block;
|
1402 |
}
|
1403 |
|
1404 |
-
body#media-upload .thumbnail.active {
|
1405 |
background-color: lightblue;
|
1406 |
border-color: cadetblue;
|
1407 |
}
|
1408 |
|
1409 |
-
body#media-upload .thumbnail
|
1410 |
display: none;
|
1411 |
position: absolute;
|
1412 |
right: -3px;
|
@@ -1414,7 +1459,7 @@ body#media-upload .thumbnail .glyphicon {
|
|
1414 |
font-size: 30px;
|
1415 |
}
|
1416 |
|
1417 |
-
body#media-upload .thumbnail.active
|
1418 |
display: inline-block;
|
1419 |
}
|
1420 |
|
@@ -1458,12 +1503,12 @@ body.gmedia-blank.gmedia_map_editor .panel {
|
|
1458 |
margin: 0;
|
1459 |
}
|
1460 |
|
1461 |
-
body.gmedia-blank .
|
1462 |
position: relative;
|
1463 |
z-index: 100;
|
1464 |
}
|
1465 |
|
1466 |
-
body.gmedia-blank.gmedia_image_editor .
|
1467 |
position: absolute;
|
1468 |
top: 55px;
|
1469 |
bottom: 0;
|
@@ -1474,11 +1519,11 @@ body.gmedia-blank.gmedia_image_editor .panel-body {
|
|
1474 |
padding-bottom: 0;
|
1475 |
}
|
1476 |
|
1477 |
-
body.gmedia-blank.gmedia_image_editor .
|
1478 |
height: 100%;
|
1479 |
}
|
1480 |
|
1481 |
-
body.gmedia-blank.gmedia_image_editor .
|
1482 |
height: 100%;
|
1483 |
overflow: auto;
|
1484 |
padding-top: 15px;
|
@@ -1498,7 +1543,7 @@ body.gmedia-blank #media-edit-form-container {
|
|
1498 |
padding: 15px;
|
1499 |
}
|
1500 |
|
1501 |
-
body.gmedia-blank .media-edit-sidebar .
|
1502 |
position: absolute;
|
1503 |
left: 0;
|
1504 |
bottom: 0;
|
@@ -1548,6 +1593,8 @@ body.gmedia_library .panel {
|
|
1548 |
background-color: #eee;
|
1549 |
width: 100%;
|
1550 |
height: 600px;
|
|
|
|
|
1551 |
}
|
1552 |
|
1553 |
#gallery_preview {
|
@@ -1601,10 +1648,16 @@ body.gmedia_library .panel {
|
|
1601 |
input.sharelink[readonly] { cursor: text; }
|
1602 |
|
1603 |
fieldset.gmediacustomstuff { margin: 0 0 10px; padding: .35em .625em .4em; position: relative; border: 1px solid silver }
|
|
|
|
|
|
|
|
|
|
|
|
|
1604 |
|
1605 |
.delete-custom-field { margin: 4px 2px 0; cursor: pointer; }
|
1606 |
|
1607 |
-
.newcustomfield-modal { position: absolute; bottom: -0.6em; right: 8px; font-size:
|
1608 |
|
1609 |
.gmapp-description, .gmapp-description p {font-size: 15px;}
|
1610 |
|
@@ -1638,19 +1691,19 @@ div#wp-link-wrap label {
|
|
1638 |
}
|
1639 |
|
1640 |
@media (max-width: 600px) {
|
1641 |
-
.panel-floatingHeader .
|
1642 |
-
.panel-absoluteHeader .
|
1643 |
position: static;
|
1644 |
box-shadow: none;
|
1645 |
}
|
1646 |
|
1647 |
-
.panel-floatingHeader .
|
1648 |
display: none;
|
1649 |
}
|
1650 |
}
|
1651 |
|
1652 |
@media (max-width: 782px) {
|
1653 |
-
.panel-floatingHeader .
|
1654 |
top: 46px;
|
1655 |
}
|
1656 |
|
@@ -1673,11 +1726,11 @@ div#wp-link-wrap label {
|
|
1673 |
}
|
1674 |
|
1675 |
@media (max-width: 991px) {
|
1676 |
-
body#media-upload .
|
1677 |
overflow-y: auto;
|
1678 |
}
|
1679 |
|
1680 |
-
body#media-upload .
|
1681 |
height: auto;
|
1682 |
}
|
1683 |
|
@@ -1743,9 +1796,9 @@ div#wp-link-wrap label {
|
|
1743 |
border-color: #eeeeee #dddddd #eeeeee #eeeeee;
|
1744 |
}
|
1745 |
|
1746 |
-
.tabs-left > .nav-tabs .active
|
1747 |
-
.no-touch .tabs-left > .nav-tabs .active
|
1748 |
-
.tabs-left > .nav-tabs .active
|
1749 |
border-color: #dddddd transparent #dddddd #dddddd;
|
1750 |
*border-right-color: #ffffff;
|
1751 |
}
|
@@ -1768,9 +1821,9 @@ div#wp-link-wrap label {
|
|
1768 |
border-color: #eeeeee #eeeeee #eeeeee #dddddd;
|
1769 |
}
|
1770 |
|
1771 |
-
.tabs-right > .nav-tabs .active
|
1772 |
-
.no-touch .tabs-right > .nav-tabs .active
|
1773 |
-
.tabs-right > .nav-tabs .active
|
1774 |
border-color: #dddddd #dddddd #dddddd transparent;
|
1775 |
*border-left-color: #ffffff;
|
1776 |
}
|
@@ -1797,6 +1850,20 @@ div#wp-link-wrap label {
|
|
1797 |
.badge-inverse:hover {background-color: #1a1a1a;}
|
1798 |
|
1799 |
/* custom *-xs size for form elements */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1800 |
input[type="date"].input-xs,
|
1801 |
input[type="time"].input-xs,
|
1802 |
input[type="datetime-local"].input-xs,
|
@@ -1815,15 +1882,18 @@ input[type="month"].input-xs,
|
|
1815 |
|
1816 |
.input-xs {
|
1817 |
height: 22px;
|
1818 |
-
padding:
|
1819 |
-
|
1820 |
-
|
|
|
1821 |
border-radius: 3px;
|
1822 |
}
|
1823 |
|
1824 |
select.input-xs {
|
1825 |
height: 22px;
|
1826 |
-
|
|
|
|
|
1827 |
}
|
1828 |
|
1829 |
textarea.input-xs,
|
@@ -1831,9 +1901,20 @@ select[multiple].input-xs {
|
|
1831 |
height: auto;
|
1832 |
}
|
1833 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1834 |
.form-group-xs .form-control {
|
1835 |
height: 22px;
|
1836 |
-
padding: 1px
|
1837 |
font-size: 12px;
|
1838 |
line-height: 1.5;
|
1839 |
border-radius: 3px;
|
@@ -1870,9 +1951,8 @@ select[multiple].form-group-xs .form-control {
|
|
1870 |
}
|
1871 |
|
1872 |
.input-group-xs > .form-control,
|
1873 |
-
.input-group-xs > .input-group-
|
1874 |
.input-group-xs > .input-group-btn > .btn {
|
1875 |
-
height: 22px;
|
1876 |
padding: 1px 5px;
|
1877 |
font-size: 12px;
|
1878 |
line-height: 1.5;
|
@@ -1880,29 +1960,28 @@ select[multiple].form-group-xs .form-control {
|
|
1880 |
}
|
1881 |
|
1882 |
select.input-group-xs > .form-control,
|
1883 |
-
select.input-group-xs > .input-group-
|
1884 |
select.input-group-xs > .input-group-btn > .btn {
|
1885 |
-
height: 22px;
|
1886 |
line-height: 22px;
|
1887 |
}
|
1888 |
|
1889 |
textarea.input-group-xs > .form-control,
|
1890 |
-
textarea.input-group-xs > .input-group-
|
1891 |
textarea.input-group-xs > .input-group-btn > .btn,
|
1892 |
select[multiple].input-group-xs > .form-control,
|
1893 |
-
select[multiple].input-group-xs > .input-group-
|
1894 |
select[multiple].input-group-xs > .input-group-btn > .btn {
|
1895 |
height: auto;
|
1896 |
}
|
1897 |
|
1898 |
-
.input-group-
|
1899 |
padding: 1px 5px;
|
1900 |
font-size: 12px;
|
1901 |
border-radius: 3px;
|
1902 |
}
|
1903 |
|
1904 |
.input-group .form-control:first-child,
|
1905 |
-
.input-group-
|
1906 |
.input-group-btn:first-child > .btn,
|
1907 |
.input-group-btn:first-child > .btn-group > .btn,
|
1908 |
.input-group-btn:first-child > .dropdown-toggle,
|
@@ -1913,7 +1992,7 @@ select[multiple].input-group-xs > .input-group-btn > .btn {
|
|
1913 |
}
|
1914 |
|
1915 |
.input-group .form-control:last-child,
|
1916 |
-
.input-group-
|
1917 |
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn,
|
1918 |
.input-group-btn:first-child > .btn:not(:first-child),
|
1919 |
.input-group-btn:last-child > .btn,
|
@@ -1923,13 +2002,25 @@ select[multiple].input-group-xs > .input-group-btn > .btn {
|
|
1923 |
border-top-left-radius: 0;
|
1924 |
}
|
1925 |
|
1926 |
-
.input-group-
|
1927 |
color: #fff;
|
1928 |
background-color: #337ab7;
|
1929 |
border-color: #2e6da4;
|
1930 |
cursor: pointer;
|
1931 |
}
|
1932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1933 |
.notice.updated.gm-message {
|
1934 |
margin-left: 0;
|
1935 |
margin-bottom: 30px;
|
@@ -2001,6 +2092,10 @@ select[multiple].input-group-xs > .input-group-btn > .btn {
|
|
2001 |
display: none;
|
2002 |
}
|
2003 |
|
|
|
|
|
|
|
|
|
2004 |
/* Spectrum */
|
2005 |
.form-group .sp-replacer {
|
2006 |
width: 100%;
|
23 |
|
24 |
a {
|
25 |
color: #0074a2;
|
26 |
+
text-decoration: none;
|
27 |
+
}
|
28 |
+
|
29 |
+
a:hover {
|
30 |
+
text-decoration: underline;
|
31 |
}
|
32 |
|
33 |
input[type="checkbox"] {
|
117 |
border: none;
|
118 |
}
|
119 |
|
120 |
+
body.gmedia-blank > .hidden {
|
121 |
+
display: contents;
|
122 |
+
}
|
123 |
+
|
124 |
.gmedia-body div#gm-message {
|
125 |
position: absolute;
|
126 |
right: 5px;
|
156 |
|
157 |
div#gmedia-container form.row {
|
158 |
padding: 15px 0;
|
159 |
+
display: flex;
|
160 |
}
|
161 |
|
162 |
body.gmedia-blank div#gmedia-container {
|
182 |
position: relative;
|
183 |
margin: 0 30px 0 15px;
|
184 |
font-size: 48px;
|
185 |
+
line-height: 20px;
|
186 |
text-shadow: 1px 1px 4px #000000;
|
187 |
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
188 |
color: #ffffff;
|
280 |
form#gmedia-pager {
|
281 |
float: left;
|
282 |
width: auto;
|
|
|
283 |
}
|
284 |
|
285 |
form#gmedia-pager span,
|
290 |
float: none;
|
291 |
}
|
292 |
|
293 |
+
form#gmedia-pager span {
|
294 |
+
display: flex;
|
295 |
+
align-items: center;
|
296 |
+
}
|
297 |
+
|
298 |
form#gmedia-pager input.pager_current_page {
|
299 |
padding-left: 0;
|
300 |
padding-right: 0;
|
319 |
|
320 |
.va-middle { vertical-align: middle }
|
321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
.gm-backfade {
|
323 |
background-color: rgba(0, 0, 0, 0.1);
|
324 |
}
|
331 |
pointer-events: none;
|
332 |
}
|
333 |
|
334 |
+
.card-header-fake { display: none; }
|
335 |
|
336 |
+
.panel-floatingHeader .card-header-fake,
|
337 |
+
.panel-absoluteHeader .card-header-fake { display: block; }
|
338 |
|
339 |
.panel-fixed-header { position: relative; }
|
340 |
|
341 |
+
.panel-fixed-header .card-header { position: relative; top: 0; max-width: 100%;
|
342 |
/*transition:top 0.2s ease-out; -webkit-transition:top 0.2s ease-out;*/
|
343 |
}
|
344 |
|
345 |
+
.card-header .spinner { margin-top: 0; }
|
346 |
|
347 |
+
body.gmedia-blank .panel-floatingHeader .card-header,
|
348 |
+
.panel-floatingHeader .card-header {
|
349 |
position: fixed;
|
350 |
top: 32px;
|
351 |
z-index: 20;
|
355 |
box-shadow: 0 5px 10px #888888;
|
356 |
}
|
357 |
|
358 |
+
body.gmedia-blank .panel-floatingHeader .card-header {
|
359 |
top: 0;
|
360 |
}
|
361 |
|
362 |
+
body.gmedia-blank .panel-absoluteHeader .card-header,
|
363 |
+
.panel-absoluteHeader .card-header {
|
364 |
position: absolute;
|
365 |
z-index: 10;
|
366 |
top: auto;
|
373 |
.dropdown-menu:not(.bootstrap-datetimepicker-widget) {
|
374 |
max-height: calc(100vh - 50px);
|
375 |
overflow-y: auto;
|
376 |
+
transform: translateX(0) !important;
|
377 |
+
top: calc(100% + 2px) !important;
|
378 |
+
bottom: auto !important;
|
379 |
+
}
|
380 |
+
|
381 |
+
a.btn,
|
382 |
+
a.dropdown-item {
|
383 |
+
text-decoration: none;
|
384 |
}
|
385 |
|
386 |
div#gm-list-table {
|
398 |
overflow: hidden;
|
399 |
}
|
400 |
|
401 |
+
.list-group-item {
|
402 |
+
margin: 0;
|
403 |
+
width: 100%;
|
404 |
+
}
|
405 |
|
406 |
.list-group-item.row {
|
407 |
position: relative;
|
415 |
position: relative;
|
416 |
color: inherit;
|
417 |
z-index: 1;
|
418 |
+
display: flex;
|
419 |
}
|
420 |
|
421 |
.no-touch div.list-group-item.d-row:hover {
|
504 |
padding-top: 4px;
|
505 |
}
|
506 |
|
507 |
+
.d-row .img-thumbnail {
|
508 |
margin-bottom: 0;
|
509 |
}
|
510 |
|
511 |
+
.gm-selected .img-thumbnail {
|
512 |
border-color: #428bca;
|
513 |
}
|
514 |
|
515 |
+
.img-thumbnail {
|
516 |
position: relative;
|
517 |
display: inline-block;
|
518 |
max-width: 100%;
|
519 |
}
|
520 |
|
521 |
+
.img-thumbnail img {
|
522 |
+
display: block;
|
523 |
+
max-width: 100%;
|
524 |
+
height: auto;
|
525 |
+
}
|
526 |
+
|
527 |
.display-as-grid .gm-item-cell {
|
528 |
padding: 12px 12px 10px;
|
529 |
border: 4px solid #ffffff;
|
576 |
overflow: hidden;
|
577 |
}
|
578 |
|
579 |
+
p.img-thumbnail.gmedia-related-image,
|
580 |
.related-media-previews p.gmedia-related-image {
|
581 |
width: 30%;
|
582 |
float: left;
|
586 |
margin-top: 7px;
|
587 |
}
|
588 |
|
589 |
+
.edit-gmedia p.img-thumbnail.gmedia-related-image,
|
590 |
.edit-gmedia .related-media-previews p.gmedia-related-image {
|
591 |
width: 44%;
|
592 |
float: none;
|
593 |
vertical-align: top;
|
594 |
}
|
595 |
|
596 |
+
p.img-thumbnail.gmedia-related-image .gm-remove {
|
597 |
padding: 1px;
|
598 |
font-size: 15px;
|
599 |
font-weight: bold;
|
613 |
cursor: pointer;
|
614 |
}
|
615 |
|
616 |
+
p.img-thumbnail.gmedia-related-image:hover .gm-remove {
|
617 |
transform: scale(1);
|
618 |
}
|
619 |
|
620 |
+
p.img-thumbnail.gmedia-related-image .image-wrapper {
|
621 |
display: block;
|
622 |
position: relative;
|
623 |
width: 100%;
|
626 |
cursor: move;
|
627 |
}
|
628 |
|
629 |
+
p.img-thumbnail.gmedia-related-image img.gmedia-thumb {
|
630 |
position: absolute;
|
631 |
left: 0;
|
632 |
top: 0;
|
668 |
|
669 |
.gm-item-cell:hover .gmedia-actions { transform: translateY(0) translateZ(0); opacity: 1;}
|
670 |
|
671 |
+
.display-as-grid div.img-thumbnail {
|
672 |
cursor: pointer;
|
673 |
position: relative;
|
674 |
display: block;
|
679 |
backface-visibility: hidden;
|
680 |
}
|
681 |
|
682 |
+
.display-as-grid div.img-thumbnail:before {
|
683 |
content: "";
|
684 |
display: block;
|
685 |
padding-top: 100%;
|
686 |
}
|
687 |
|
688 |
+
.display-as-grid .gm-selected div.img-thumbnail {
|
689 |
-webkit-box-shadow: 0 0 0 7px #1e8cbe;
|
690 |
-moz-box-shadow: 0 0 0 7px #1e8cbe;
|
691 |
box-shadow: 0 0 0 7px #1e8cbe;
|
692 |
border-radius: 1px;
|
693 |
}
|
694 |
|
695 |
+
.display-as-grid div.img-thumbnail .cb_media-object,
|
696 |
+
.display-as-grid div.img-thumbnail .gm-item-cell-media-object {
|
697 |
bottom: 0;
|
698 |
left: 0;
|
699 |
overflow: hidden;
|
704 |
margin: 0;
|
705 |
}
|
706 |
|
707 |
+
.display-as-grid div.img-thumbnail .gm-cell-more {
|
708 |
position: absolute;
|
709 |
left: 0; top: 0; right: 0;
|
710 |
background: rgba(256, 256, 256, 0.6);
|
712 |
cursor: auto;
|
713 |
}
|
714 |
|
715 |
+
.display-as-grid div.img-thumbnail .gm-cell-more-btn {
|
716 |
position: absolute;
|
717 |
top: 0; right: 0;
|
718 |
padding: 5px;
|
721 |
/*text-shadow: 1px 1px 1px #83acbf;*/
|
722 |
}
|
723 |
|
724 |
+
.display-as-grid div.img-thumbnail .gm-cell-more-content {
|
725 |
padding: 5px 5px 0;
|
726 |
display: none;
|
727 |
overflow: hidden;
|
729 |
font-size: 11px;
|
730 |
}
|
731 |
|
732 |
+
.display-as-grid div.img-thumbnail .gm-cell-more-content .gmedia-actions {
|
733 |
display: none;
|
734 |
}
|
735 |
|
736 |
+
.display-as-grid div.img-thumbnail .gm-cell-more:hover,
|
737 |
+
.display-as-grid div.img-thumbnail .gm-cell-more.gm-cell-more-active {
|
738 |
z-index: 10;
|
739 |
-webkit-box-shadow: 0 0 0 1px #dddddd, 0 4px 3px -1px rgba(0, 0, 0, 0.3);
|
740 |
-moz-box-shadow: 0 0 0 1px #dddddd, 0 4px 3px -1px rgba(0, 0, 0, 0.3);
|
741 |
box-shadow: 0 0 0 1px #dddddd, 0 4px 3px -1px rgba(0, 0, 0, 0.3);
|
742 |
}
|
743 |
|
744 |
+
.display-as-grid div.img-thumbnail .gm-cell-more:hover {
|
745 |
z-index: 11;
|
746 |
}
|
747 |
|
748 |
+
.display-as-grid div.img-thumbnail .gm-cell-more:hover > div {
|
749 |
background: rgba(256, 256, 256, 0.7);
|
750 |
}
|
751 |
|
752 |
+
.display-as-grid div.img-thumbnail .gm-cell-more-active .gm-cell-more-content .gmedia-actions {
|
753 |
display: block;
|
754 |
}
|
755 |
|
756 |
+
.display-as-grid div.img-thumbnail .gm-cell-more.gm-cell-more-active > div {
|
757 |
background: rgba(256, 256, 256, 0.9);
|
758 |
}
|
759 |
|
760 |
+
.display-as-grid div.img-thumbnail .gm-cell-more:hover .gm-cell-more-content,
|
761 |
+
.display-as-grid div.img-thumbnail .gm-cell-more.gm-cell-more-active .gm-cell-more-content {
|
762 |
display: block;
|
763 |
}
|
764 |
|
765 |
+
.display-as-grid div.img-thumbnail .gm-cell-more-content p {
|
766 |
font-size: 11px;
|
767 |
}
|
768 |
|
769 |
+
.display-as-grid div.img-thumbnail .cb_media-object .centered,
|
770 |
+
.display-as-grid div.img-thumbnail .gm-item-cell-media-object .centered {
|
771 |
height: 100%;
|
772 |
left: 0;
|
773 |
position: absolute;
|
776 |
width: 100%;
|
777 |
}
|
778 |
|
779 |
+
.display-as-grid div.img-thumbnail.landscape .cb_media-object .centered,
|
780 |
+
.display-as-grid div.img-thumbnail.landscape .gm-item-cell-media-object .centered {
|
781 |
transform: translate(50%, 50.5%) translateZ(0);
|
782 |
}
|
783 |
|
784 |
+
.display-as-grid div.img-thumbnail .cb_media-object img,
|
785 |
+
.display-as-grid div.img-thumbnail .gm-item-cell-media-object img {
|
786 |
left: 0;
|
787 |
position: absolute;
|
788 |
top: 0;
|
789 |
transform: translate(-50%, -50%) translateZ(0);
|
790 |
}
|
791 |
|
792 |
+
.display-as-grid div.img-thumbnail.landscape img {
|
793 |
height: 101%;
|
794 |
width: auto;
|
795 |
+
max-width: initial;
|
796 |
}
|
797 |
|
798 |
+
.display-as-grid div.img-thumbnail.portrait img {
|
799 |
height: auto;
|
800 |
width: 100%;
|
801 |
}
|
802 |
|
803 |
+
.display-as-grid.invert-ratio div.img-thumbnail.landscape img {
|
804 |
height: auto;
|
805 |
width: 101%;
|
806 |
+
max-width: initial;
|
807 |
}
|
808 |
|
809 |
+
.display-as-grid.invert-ratio div.img-thumbnail.portrait img {
|
810 |
height: 101%;
|
811 |
width: auto;
|
812 |
+
max-width: initial;
|
813 |
}
|
814 |
|
815 |
+
.img-thumbnail img.gmedia-typethumb,
|
816 |
+
.display-as-grid div.img-thumbnail .cb_media-object img.gmedia-typethumb,
|
817 |
+
.display-as-grid div.img-thumbnail .gm-item-cell-media-object img.gmedia-typethumb {
|
818 |
position: absolute;
|
819 |
right: 7px;
|
820 |
bottom: 7px;
|
821 |
height: 75px;
|
822 |
max-height: 60%;
|
823 |
width: auto;
|
824 |
+
max-width: initial;
|
825 |
}
|
826 |
|
827 |
+
.display-as-grid div.img-thumbnail .cb_media-object img.gmedia-typethumb,
|
828 |
+
.display-as-grid div.img-thumbnail .gm-item-cell-media-object img.gmedia-typethumb {
|
829 |
left: auto;
|
830 |
top: auto;
|
831 |
right: 50%;
|
857 |
|
858 |
.thumbwrap .cb_media-object { width: 100%; margin: 0; display: flex; }
|
859 |
|
860 |
+
.cb_media-object .img-thumbnail {
|
861 |
width: 100%;
|
862 |
}
|
863 |
|
990 |
|
991 |
div.plupload_started { float: left; }
|
992 |
|
993 |
+
div.card-body, div#gmedia-msg-panel, #gmedia-service-msg-panel {
|
994 |
-webkit-transition: all .2s ease-in-out;
|
995 |
transition: all .2s ease-in-out;
|
996 |
}
|
997 |
|
998 |
+
.plupload_scroll .plupload_filelist {
|
999 |
+
height: 315px;
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
div.card-body:empty, div#gmedia-msg-panel:empty, #gmedia-service-msg-panel:empty {
|
1003 |
padding: 0;
|
1004 |
}
|
1005 |
|
1035 |
padding: 20px 10px 0;
|
1036 |
}
|
1037 |
|
1038 |
+
div.form-control.selectize-control {
|
1039 |
+
padding: 0 !important;
|
1040 |
+
}
|
1041 |
+
|
1042 |
.selectize-control.input-sm .selectize-input {
|
1043 |
min-height: 30px;
|
1044 |
padding: 2px 10px;
|
1153 |
.object-actions .term-shortcode input,
|
1154 |
.object-actions .term-shortcode .input-buffer { font-family: Courier, sans-serif; font-size: 14px; line-height: 100%; letter-spacing: 0.05em; border: none; box-shadow: none; background-color: #fff; margin: 0; padding: 0;}
|
1155 |
|
1156 |
+
.card-header .term-shortcode {float: left;}
|
1157 |
|
1158 |
+
.card-header .term-shortcode input,
|
1159 |
+
.card-header .term-shortcode .input-buffer { font-family: Courier, sans-serif; font-size: 14px; letter-spacing: 0.05em; }
|
1160 |
|
1161 |
.term-shortcode .input-buffer {position: absolute; top: -1000px; left: -1000px; visibility: hidden; white-space: nowrap;}
|
1162 |
|
1189 |
padding-bottom: 0;
|
1190 |
}
|
1191 |
|
1192 |
+
.btn-link {
|
1193 |
+
text-decoration: none;
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
.btn-link:hover {
|
1197 |
+
text-decoration: underline;
|
1198 |
+
}
|
1199 |
+
|
1200 |
.no-touch a.edit_tag_save.btn-link:hover {
|
1201 |
text-decoration: none;
|
1202 |
}
|
1243 |
background-color: #d0e9c6;
|
1244 |
}
|
1245 |
|
1246 |
+
.choose-module .img-thumbnail {
|
1247 |
margin-bottom: 0;
|
1248 |
}
|
1249 |
|
1251 |
overflow: hidden;
|
1252 |
}
|
1253 |
|
1254 |
+
.media > .img-thumbnail.float-start {
|
1255 |
padding: 4px;
|
1256 |
margin-right: 10px
|
1257 |
}
|
1317 |
right: 0;
|
1318 |
top: 0;
|
1319 |
bottom: 0;
|
1320 |
+
padding: 0.6em 6px 0;
|
1321 |
line-height: 100%;
|
1322 |
}
|
1323 |
|
1345 |
border-top: none;
|
1346 |
}
|
1347 |
|
1348 |
+
body#media-upload .card-header {
|
1349 |
position: relative;
|
1350 |
z-index: 100;
|
1351 |
}
|
1352 |
|
1353 |
+
body#media-upload .card-body {
|
1354 |
position: absolute;
|
1355 |
top: 55px;
|
1356 |
bottom: 0;
|
1361 |
padding-bottom: 0;
|
1362 |
}
|
1363 |
|
1364 |
+
body#media-upload .card-body > .row {
|
1365 |
height: 100%;
|
1366 |
}
|
1367 |
|
1368 |
+
body#media-upload .card-body > .row > div {
|
1369 |
height: 100%;
|
1370 |
overflow: auto;
|
1371 |
padding-top: 15px;
|
1372 |
padding-bottom: 15px;
|
1373 |
}
|
1374 |
|
1375 |
+
body#media-upload .card-body .list-group-item {
|
1376 |
border-width: 0;
|
1377 |
border-top-width: 1px;
|
1378 |
margin: 0;
|
1379 |
}
|
1380 |
|
1381 |
+
body#media-upload .card-body .list-group-item:first-child {
|
1382 |
border-width: 0;
|
1383 |
}
|
1384 |
|
1436 |
padding: 15px;
|
1437 |
}
|
1438 |
|
1439 |
+
body#media-upload .media-upload-sidebar .card-footer {
|
1440 |
min-height: 57px;
|
1441 |
}
|
1442 |
|
1443 |
+
body#media-upload .img-thumbnail {
|
1444 |
margin: 0 5px 5px 0;
|
1445 |
position: relative;
|
1446 |
display: inline-block;
|
1447 |
}
|
1448 |
|
1449 |
+
body#media-upload .img-thumbnail.active {
|
1450 |
background-color: lightblue;
|
1451 |
border-color: cadetblue;
|
1452 |
}
|
1453 |
|
1454 |
+
body#media-upload .img-thumbnail i[class^="fa-"] {
|
1455 |
display: none;
|
1456 |
position: absolute;
|
1457 |
right: -3px;
|
1459 |
font-size: 30px;
|
1460 |
}
|
1461 |
|
1462 |
+
body#media-upload .img-thumbnail.active i[class^="fa-"] {
|
1463 |
display: inline-block;
|
1464 |
}
|
1465 |
|
1503 |
margin: 0;
|
1504 |
}
|
1505 |
|
1506 |
+
body.gmedia-blank .card-header {
|
1507 |
position: relative;
|
1508 |
z-index: 100;
|
1509 |
}
|
1510 |
|
1511 |
+
body.gmedia-blank.gmedia_image_editor .card-body {
|
1512 |
position: absolute;
|
1513 |
top: 55px;
|
1514 |
bottom: 0;
|
1519 |
padding-bottom: 0;
|
1520 |
}
|
1521 |
|
1522 |
+
body.gmedia-blank.gmedia_image_editor .card-body .row {
|
1523 |
height: 100%;
|
1524 |
}
|
1525 |
|
1526 |
+
body.gmedia-blank.gmedia_image_editor .card-body .row > div {
|
1527 |
height: 100%;
|
1528 |
overflow: auto;
|
1529 |
padding-top: 15px;
|
1543 |
padding: 15px;
|
1544 |
}
|
1545 |
|
1546 |
+
body.gmedia-blank .media-edit-sidebar .card-footer {
|
1547 |
position: absolute;
|
1548 |
left: 0;
|
1549 |
bottom: 0;
|
1593 |
background-color: #eee;
|
1594 |
width: 100%;
|
1595 |
height: 600px;
|
1596 |
+
resize: both;
|
1597 |
+
overflow: hidden;
|
1598 |
}
|
1599 |
|
1600 |
#gallery_preview {
|
1648 |
input.sharelink[readonly] { cursor: text; }
|
1649 |
|
1650 |
fieldset.gmediacustomstuff { margin: 0 0 10px; padding: .35em .625em .4em; position: relative; border: 1px solid silver }
|
1651 |
+
fieldset.gmediacustomstuff legend {
|
1652 |
+
width: auto;
|
1653 |
+
float: none;
|
1654 |
+
color: #000;
|
1655 |
+
margin-right: auto;
|
1656 |
+
}
|
1657 |
|
1658 |
.delete-custom-field { margin: 4px 2px 0; cursor: pointer; }
|
1659 |
|
1660 |
+
.newcustomfield-modal { position: absolute; bottom: -0.6em; right: 8px; font-size: 80%; }
|
1661 |
|
1662 |
.gmapp-description, .gmapp-description p {font-size: 15px;}
|
1663 |
|
1691 |
}
|
1692 |
|
1693 |
@media (max-width: 600px) {
|
1694 |
+
.panel-floatingHeader .card-header,
|
1695 |
+
.panel-absoluteHeader .card-header {
|
1696 |
position: static;
|
1697 |
box-shadow: none;
|
1698 |
}
|
1699 |
|
1700 |
+
.panel-floatingHeader .card-header-fake, .panel-absoluteHeader .card-header-fake {
|
1701 |
display: none;
|
1702 |
}
|
1703 |
}
|
1704 |
|
1705 |
@media (max-width: 782px) {
|
1706 |
+
.panel-floatingHeader .card-header {
|
1707 |
top: 46px;
|
1708 |
}
|
1709 |
|
1726 |
}
|
1727 |
|
1728 |
@media (max-width: 991px) {
|
1729 |
+
body#media-upload .card-body > #gmUpload.row {
|
1730 |
overflow-y: auto;
|
1731 |
}
|
1732 |
|
1733 |
+
body#media-upload .card-body > #gmUpload.row > div {
|
1734 |
height: auto;
|
1735 |
}
|
1736 |
|
1796 |
border-color: #eeeeee #dddddd #eeeeee #eeeeee;
|
1797 |
}
|
1798 |
|
1799 |
+
.tabs-left > .nav-tabs .active,
|
1800 |
+
.no-touch .tabs-left > .nav-tabs .active:hover,
|
1801 |
+
.tabs-left > .nav-tabs .active:focus {
|
1802 |
border-color: #dddddd transparent #dddddd #dddddd;
|
1803 |
*border-right-color: #ffffff;
|
1804 |
}
|
1821 |
border-color: #eeeeee #eeeeee #eeeeee #dddddd;
|
1822 |
}
|
1823 |
|
1824 |
+
.tabs-right > .nav-tabs .active,
|
1825 |
+
.no-touch .tabs-right > .nav-tabs .active:hover,
|
1826 |
+
.tabs-right > .nav-tabs .active:focus {
|
1827 |
border-color: #dddddd #dddddd #dddddd transparent;
|
1828 |
*border-left-color: #ffffff;
|
1829 |
}
|
1850 |
.badge-inverse:hover {background-color: #1a1a1a;}
|
1851 |
|
1852 |
/* custom *-xs size for form elements */
|
1853 |
+
.btn-xs,
|
1854 |
+
.btn-group-xs > .btn {
|
1855 |
+
padding: 0.15rem 0.4rem;
|
1856 |
+
font-size: 15px;
|
1857 |
+
border-radius: 0.2rem;
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
.btn-sm,
|
1861 |
+
.btn-group-sm>.btn {
|
1862 |
+
padding: 0.25rem 0.5rem;
|
1863 |
+
font-size: 1rem;
|
1864 |
+
border-radius: 0.2rem;
|
1865 |
+
}
|
1866 |
+
|
1867 |
input[type="date"].input-xs,
|
1868 |
input[type="time"].input-xs,
|
1869 |
input[type="datetime-local"].input-xs,
|
1882 |
|
1883 |
.input-xs {
|
1884 |
height: 22px;
|
1885 |
+
padding-left: 0.7em !important;
|
1886 |
+
padding-right: 0.7em;
|
1887 |
+
font-size: 0.9em !important;
|
1888 |
+
line-height: 1.5 !important;
|
1889 |
border-radius: 3px;
|
1890 |
}
|
1891 |
|
1892 |
select.input-xs {
|
1893 |
height: 22px;
|
1894 |
+
padding-left: 0.7em !important;
|
1895 |
+
font-size: 0.9em !important;
|
1896 |
+
line-height: 1.5 !important;
|
1897 |
}
|
1898 |
|
1899 |
textarea.input-xs,
|
1901 |
height: auto;
|
1902 |
}
|
1903 |
|
1904 |
+
.form-group {
|
1905 |
+
margin-bottom: 15px;
|
1906 |
+
}
|
1907 |
+
|
1908 |
+
.form-group label {
|
1909 |
+
display: inline-block;
|
1910 |
+
max-width: 100%;
|
1911 |
+
margin-bottom: 5px;
|
1912 |
+
font-weight: 700;
|
1913 |
+
}
|
1914 |
+
|
1915 |
.form-group-xs .form-control {
|
1916 |
height: 22px;
|
1917 |
+
padding: 1px 10px;
|
1918 |
font-size: 12px;
|
1919 |
line-height: 1.5;
|
1920 |
border-radius: 3px;
|
1951 |
}
|
1952 |
|
1953 |
.input-group-xs > .form-control,
|
1954 |
+
.input-group-xs > .input-group-text,
|
1955 |
.input-group-xs > .input-group-btn > .btn {
|
|
|
1956 |
padding: 1px 5px;
|
1957 |
font-size: 12px;
|
1958 |
line-height: 1.5;
|
1960 |
}
|
1961 |
|
1962 |
select.input-group-xs > .form-control,
|
1963 |
+
select.input-group-xs > .input-group-text,
|
1964 |
select.input-group-xs > .input-group-btn > .btn {
|
|
|
1965 |
line-height: 22px;
|
1966 |
}
|
1967 |
|
1968 |
textarea.input-group-xs > .form-control,
|
1969 |
+
textarea.input-group-xs > .input-group-text,
|
1970 |
textarea.input-group-xs > .input-group-btn > .btn,
|
1971 |
select[multiple].input-group-xs > .form-control,
|
1972 |
+
select[multiple].input-group-xs > .input-group-text,
|
1973 |
select[multiple].input-group-xs > .input-group-btn > .btn {
|
1974 |
height: auto;
|
1975 |
}
|
1976 |
|
1977 |
+
.input-group-text.input-xs {
|
1978 |
padding: 1px 5px;
|
1979 |
font-size: 12px;
|
1980 |
border-radius: 3px;
|
1981 |
}
|
1982 |
|
1983 |
.input-group .form-control:first-child,
|
1984 |
+
.input-group-text:first-child,
|
1985 |
.input-group-btn:first-child > .btn,
|
1986 |
.input-group-btn:first-child > .btn-group > .btn,
|
1987 |
.input-group-btn:first-child > .dropdown-toggle,
|
1992 |
}
|
1993 |
|
1994 |
.input-group .form-control:last-child,
|
1995 |
+
.input-group-text:last-child,
|
1996 |
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn,
|
1997 |
.input-group-btn:first-child > .btn:not(:first-child),
|
1998 |
.input-group-btn:last-child > .btn,
|
2002 |
border-top-left-radius: 0;
|
2003 |
}
|
2004 |
|
2005 |
+
.input-group-text.btn-primary {
|
2006 |
color: #fff;
|
2007 |
background-color: #337ab7;
|
2008 |
border-color: #2e6da4;
|
2009 |
cursor: pointer;
|
2010 |
}
|
2011 |
|
2012 |
+
div#gallery_options_block .form-control.input-sm {
|
2013 |
+
padding-block: 0;
|
2014 |
+
}
|
2015 |
+
|
2016 |
+
div#gallery_options_block .nav-item {
|
2017 |
+
margin-right: -1px;
|
2018 |
+
}
|
2019 |
+
|
2020 |
+
div#gallery_options_block .nav-item.active {
|
2021 |
+
background-color: #fff;
|
2022 |
+
}
|
2023 |
+
|
2024 |
.notice.updated.gm-message {
|
2025 |
margin-left: 0;
|
2026 |
margin-bottom: 30px;
|
2092 |
display: none;
|
2093 |
}
|
2094 |
|
2095 |
+
#link-selector .link-target {
|
2096 |
+
display: none;
|
2097 |
+
}
|
2098 |
+
|
2099 |
/* Spectrum */
|
2100 |
.form-group .sp-replacer {
|
2101 |
width: 100%;
|
admin/assets/js/gmedia.admin.js
CHANGED
@@ -4,1808 +4,2022 @@
|
|
4 |
var wp = window.wp || {};
|
5 |
var gmedia_DOM;
|
6 |
var GmediaLibrary = {
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
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 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
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 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
};
|
392 |
|
393 |
/**
|
394 |
* Gmedia AddMedia
|
395 |
*/
|
396 |
var GmediaAddMedia = {
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
|
|
|
|
521 |
};
|
522 |
|
523 |
/**
|
524 |
* Gmedia Terms
|
525 |
*/
|
526 |
var GmediaTerms = {
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
655 |
};
|
656 |
|
657 |
var GmediaSelect = {
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
952 |
};
|
953 |
|
954 |
var GmediaFunction = {
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1617 |
jQuery.data(this, 'scrollTimer', setTimeout(function() {
|
1618 |
UpdatePanelHeaders();
|
1619 |
}, 250));*/
|
1620 |
-
|
1621 |
-
|
1622 |
|
1623 |
-
|
1624 |
};
|
1625 |
|
1626 |
-
window.closeModal = function(id) {
|
1627 |
-
|
1628 |
};
|
1629 |
|
1630 |
/*
|
1631 |
* jQuery functions for GRAND Media
|
1632 |
*/
|
1633 |
function GmediaInit() {
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
|
|
|
|
|
|
1681 |
}
|
1682 |
|
1683 |
-
jQuery(function() {
|
1684 |
-
|
1685 |
-
});
|
1686 |
|
1687 |
-
function convertInputsToJSON(form) {
|
1688 |
-
|
1689 |
-
|
1690 |
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
|
1695 |
-
|
1696 |
}
|
1697 |
|
1698 |
-
function gm_parse_query(s) {
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
|
|
|
|
|
|
1714 |
}
|
1715 |
|
1716 |
-
function validateEmail(email) {
|
1717 |
-
|
1718 |
-
|
1719 |
}
|
1720 |
|
1721 |
function getStorage() {
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
}
|
1736 |
|
1737 |
-
function getDocHeight(id) {
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
}
|
1755 |
|
1756 |
// function gmHashCode(str) {
|
1757 |
// var l = str.length,
|
1758 |
// hash = 5381 * l * (str.charCodeAt(0) + l);
|
1759 |
// for (var i = 0; i < str.length; i++) {
|
1760 |
-
// hash += Math.floor((str.charCodeAt(i) + i + 0.33) / (str.charCodeAt(l -
|
1761 |
-
//
|
1762 |
-
//
|
1763 |
-
// }
|
1764 |
-
//
|
1765 |
-
//
|
1766 |
-
//
|
1767 |
-
//
|
1768 |
-
// }
|
1769 |
-
// if (!uuid) {
|
1770 |
-
// uuid = 'xyxx-xxyx-xxxy';
|
1771 |
-
// }
|
1772 |
-
// var d = gmHashCode((site + ':' + lic).toLowerCase());
|
1773 |
-
// var p = d;
|
1774 |
-
// uuid = uuid.replace(/[xy]/g, function(c) {
|
1775 |
-
// var r = d % 16 | 0, v = c === 'x' ? r : (r & 0x7 | 0x8);
|
1776 |
-
// d = Math.floor(d * 15 / 16);
|
1777 |
-
// return v.toString(16);
|
1778 |
-
// });
|
1779 |
-
// var key = p + ': ' + lic + '-' + uuid;
|
1780 |
-
// return key.toLowerCase();
|
1781 |
-
// }
|
1782 |
|
1783 |
function UpdatePanelHeaders() {
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
|
|
|
|
|
|
1803 |
}
|
1804 |
|
1805 |
function setPanelHeadersWidth() {
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
}
|
4 |
var wp = window.wp || {};
|
5 |
var gmedia_DOM;
|
6 |
var GmediaLibrary = {
|
7 |
+
init: function() {
|
8 |
+
window.gm_wavesurfer = {};
|
9 |
+
if ( jQuery( '.gmedia-audio-item' ).length ) {
|
10 |
+
|
11 |
+
jQuery( '.gm-waveform-player' ).each( function() {
|
12 |
+
var data = jQuery( this ).data();
|
13 |
+
data.gmid = data.id;
|
14 |
+
data.id = 'ws' + data.gmid;
|
15 |
+
|
16 |
+
if ( data.peaks ) {
|
17 |
+
jQuery( '.gm-play', this ).show();
|
18 |
+
jQuery( '.gm-pause', this ).hide();
|
19 |
+
|
20 |
+
GmediaLibrary.waveplayer( data, true );
|
21 |
+
}
|
22 |
+
} );
|
23 |
+
gmedia_DOM.on( 'click', '.gm-waveform', function() {
|
24 |
+
var parent = jQuery( this ).parent(),
|
25 |
+
data = parent.data();
|
26 |
+
|
27 |
+
jQuery( this ).remove();
|
28 |
+
|
29 |
+
GmediaLibrary.waveplayer( data );
|
30 |
+
|
31 |
+
if ( data.peaks ) {
|
32 |
+
//window.gm_wavesurfer[data.id].play();
|
33 |
+
}
|
34 |
+
else {
|
35 |
+
window.gm_wavesurfer[data.id].on( 'waveform-ready', function() {
|
36 |
+
jQuery( '.gm-play', parent ).hide();
|
37 |
+
jQuery( '.gm-pause', parent ).show();
|
38 |
+
jQuery( '.spinner', parent ).removeClass( 'is-active' );
|
39 |
+
var peaks = window.gm_wavesurfer[data.id].exportPCM( 1800, 10000,
|
40 |
+
true );
|
41 |
+
var post_data = {
|
42 |
+
action: 'gmedia_save_waveform',
|
43 |
+
id: data.gmid,
|
44 |
+
peaks: peaks,
|
45 |
+
_wpnonce: jQuery( '#_wpnonce' ).val(),
|
46 |
+
};
|
47 |
+
jQuery.post( ajaxurl, post_data,
|
48 |
+
function( return_data, textStatus, jqXHR ) {
|
49 |
+
var data_peaks = window.gm_wavesurfer[data.id].exportPCM( 450,
|
50 |
+
10000, true );
|
51 |
+
parent.attr( 'data-peaks', data_peaks );
|
52 |
+
} );
|
53 |
+
} );
|
54 |
+
}
|
55 |
+
} );
|
56 |
+
gmedia_DOM.on( 'click', '.gm-play, .gm-pause', function() {
|
57 |
+
var parent = jQuery( this ).parent();
|
58 |
+
var data = parent.data();
|
59 |
+
if ( ! parent.hasClass( 'ws-loaded' ) ) {
|
60 |
+
parent.addClass( 'ws-loaded' );
|
61 |
+
window.gm_wavesurfer[data.id].load( data.file, data.peaks );
|
62 |
+
window.gm_wavesurfer[data.id].toggleInteraction();
|
63 |
+
window.gm_wavesurfer[data.id].play();
|
64 |
+
}
|
65 |
+
else {
|
66 |
+
window.gm_wavesurfer[data.id].playPause();
|
67 |
+
}
|
68 |
+
} );
|
69 |
+
|
70 |
+
var resize;
|
71 |
+
jQuery( window ).on( 'resize.gmedia', function() {
|
72 |
+
clearTimeout( resize );
|
73 |
+
resize = setTimeout( function() {
|
74 |
+
jQuery( '.gm-waveform-player' ).each( function() {
|
75 |
+
var data = jQuery( this ).data();
|
76 |
+
if ( data.peaks && window.gm_wavesurfer[data.id] ) {
|
77 |
+
window.gm_wavesurfer[data.id].load( data.file, data.peaks );
|
78 |
+
}
|
79 |
+
} );
|
80 |
+
}, 500 );
|
81 |
+
} );
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( jQuery( 'body' ).hasClass( 'GrandMedia_edit' ) ) {
|
86 |
+
GmediaLibrary.editmode();
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( jQuery( 'body' ).hasClass( 'gmedia_library' ) ) {
|
90 |
+
var previewFrame = jQuery( '#previewFrame', window.parent.document );
|
91 |
+
jQuery( window ).on( 'load.gmedia', function() {
|
92 |
+
setTimeout( function() {
|
93 |
+
previewFrame.animate(
|
94 |
+
{'height': getDocHeight( 'gmedia_iframe_content' ) + 3}, 200 );
|
95 |
+
}, 10 );
|
96 |
+
} );
|
97 |
+
var refresh = ! jQuery( 'body' ).
|
98 |
+
is( '.GrandMedia_select_single, .GrandMedia_select_multiple' );
|
99 |
+
var observer = new MutationObserver( function( mutations ) {
|
100 |
+
previewFrame.height( getDocHeight( 'gmedia_iframe_content' ) + 3 );
|
101 |
+
if ( refresh ) {
|
102 |
+
jQuery( '#previewModal', window.parent.document ).
|
103 |
+
attr( 'data-refresh', 'true' );
|
104 |
+
}
|
105 |
+
} );
|
106 |
+
var gmedia_iframe_content = window.document.getElementById(
|
107 |
+
'gmedia_iframe_content' );
|
108 |
+
observer.observe( gmedia_iframe_content, {
|
109 |
+
childList: true,
|
110 |
+
subtree: true,
|
111 |
+
attributes: true,
|
112 |
+
attributeFilter: ['value'],
|
113 |
+
} );
|
114 |
+
}
|
115 |
+
|
116 |
+
},
|
117 |
+
waveplayer: function( data, draw ) {
|
118 |
+
window.gm_wavesurfer[data.id] = Object.create( WaveSurfer );
|
119 |
+
window.gm_wavesurfer[data.id].init( {
|
120 |
+
container: '#' + data.id,
|
121 |
+
waveColor: '#428bca',
|
122 |
+
progressColor: '#31708f',
|
123 |
+
backend: 'MediaElement',
|
124 |
+
renderer: 'Canvas',
|
125 |
+
height: 60,
|
126 |
+
interact: false,
|
127 |
+
barWidth: 0,
|
128 |
+
} );
|
129 |
+
// Play on audio load
|
130 |
+
var parent = jQuery( window.gm_wavesurfer[data.id].container ).parent();
|
131 |
+
|
132 |
+
if ( ! parent.hasClass( 'ws-loaded' ) ) {
|
133 |
+
if ( draw ) {
|
134 |
+
window.gm_wavesurfer[data.id].backend.setPeaks( data.peaks );
|
135 |
+
window.gm_wavesurfer[data.id].drawBuffer();
|
136 |
+
}
|
137 |
+
else {
|
138 |
+
parent.addClass( 'ws-loaded' );
|
139 |
+
window.gm_wavesurfer[data.id].load( data.file, data.peaks );
|
140 |
+
window.gm_wavesurfer[data.id].toggleInteraction();
|
141 |
+
window.gm_wavesurfer[data.id].play();
|
142 |
+
}
|
143 |
+
}
|
144 |
+
else {
|
145 |
+
window.gm_wavesurfer[data.id].play();
|
146 |
+
}
|
147 |
+
|
148 |
+
jQuery( window.gm_wavesurfer[data.id].container ).
|
149 |
+
on( 'click', function( e ) {
|
150 |
+
if ( ! parent.hasClass( 'ws-loaded' ) ) {
|
151 |
+
parent.addClass( 'ws-loaded' );
|
152 |
+
window.gm_wavesurfer[data.id].load( data.file, data.peaks );
|
153 |
+
window.gm_wavesurfer[data.id].toggleInteraction();
|
154 |
+
window.gm_wavesurfer[data.id].play();
|
155 |
+
}
|
156 |
+
if ( window.gm_wavesurfer[data.id].isPlaying() ) {
|
157 |
+
window.gm_wavesurfer[data.id].backend.media.currentTime = 0;
|
158 |
+
}
|
159 |
+
else {
|
160 |
+
window.gm_wavesurfer[data.id].play();
|
161 |
+
}
|
162 |
+
} );
|
163 |
+
|
164 |
+
window.gm_wavesurfer[data.id].on( 'play', function() {
|
165 |
+
parent.find( '.gm-play' ).hide();
|
166 |
+
parent.find( '.gm-pause' ).show();
|
167 |
+
parent.find( '.spinner' ).removeClass( 'is-active' );
|
168 |
+
|
169 |
+
jQuery.each( window.gm_wavesurfer, function( id ) {
|
170 |
+
if ( id !== data.id && window.gm_wavesurfer[id].isPlaying() ) {
|
171 |
+
window.gm_wavesurfer[id].pause();
|
172 |
+
}
|
173 |
+
} );
|
174 |
+
} );
|
175 |
+
window.gm_wavesurfer[data.id].on( 'pause', function() {
|
176 |
+
parent.find( '.gm-play' ).show();
|
177 |
+
parent.find( '.gm-pause' ).hide();
|
178 |
+
} );
|
179 |
+
window.gm_wavesurfer[data.id].on( 'loading', function( p ) {
|
180 |
+
if ( p === 100 ) {
|
181 |
+
//parent.find('.spinner').removeClass('is-active');
|
182 |
+
}
|
183 |
+
else {
|
184 |
+
parent.find( '.spinner' ).addClass( 'is-active' );
|
185 |
+
}
|
186 |
+
} );
|
187 |
+
},
|
188 |
+
/**
|
189 |
+
* Edit Mode
|
190 |
+
*/
|
191 |
+
editmode: function() {
|
192 |
+
var focus_input_val;
|
193 |
+
// SelectBox for albums
|
194 |
+
var combobox_albums = jQuery( '.combobox_gmedia_album' );
|
195 |
+
var selectize_albums = combobox_albums.selectize( {
|
196 |
+
create: !! combobox_albums.data( 'create' ),
|
197 |
+
onOptionAdd: function( value, data ) {
|
198 |
+
jQuery.each( selectize_albums, function( i, e ) {
|
199 |
+
e.selectize.options[value] = data;
|
200 |
+
} );
|
201 |
+
},
|
202 |
+
onFocus: function() {
|
203 |
+
this.$input.addClass( 'edit-gmedia-ignore' );
|
204 |
+
focus_input_val = this.$input.val();
|
205 |
+
},
|
206 |
+
onBlur: function() {
|
207 |
+
this.$input.removeClass( 'edit-gmedia-ignore' );
|
208 |
+
if ( focus_input_val !== this.$input.val() ) {
|
209 |
+
var inporder = this.$input.prev( '.gm-order-input' );
|
210 |
+
inporder.val( '0' );
|
211 |
+
if ( '' === this.$input.val() ) {
|
212 |
+
inporder.prop( 'disabled', true );
|
213 |
+
}
|
214 |
+
else {
|
215 |
+
inporder.prop( 'disabled', false );
|
216 |
+
}
|
217 |
+
this.$input.trigger( 'change' );
|
218 |
+
}
|
219 |
+
},
|
220 |
+
persist: true,
|
221 |
+
} );
|
222 |
+
|
223 |
+
if ( window.gmedia_categories ) {
|
224 |
+
var categories = jQuery( '.combobox_gmedia_category' );
|
225 |
+
if ( categories.length ) {
|
226 |
+
var categories_data = window.gmedia_categories.map( function( x ) {
|
227 |
+
return {item: x};
|
228 |
+
} );
|
229 |
+
|
230 |
+
var selectize_categories = categories.selectize( {
|
231 |
+
create: function( input ) {
|
232 |
+
if ( categories.data( 'create' ) ) {
|
233 |
+
return {
|
234 |
+
item: input,
|
235 |
+
};
|
236 |
+
}
|
237 |
+
else {
|
238 |
+
return false;
|
239 |
+
}
|
240 |
+
},
|
241 |
+
onOptionAdd: function( value, data ) {
|
242 |
+
jQuery.each( selectize_categories, function( i, e ) {
|
243 |
+
e.selectize.options[value] = data;
|
244 |
+
} );
|
245 |
+
},
|
246 |
+
onFocus: function() {
|
247 |
+
this.$input.addClass( 'edit-gmedia-ignore' );
|
248 |
+
focus_input_val = this.$input.val();
|
249 |
+
},
|
250 |
+
onBlur: function() {
|
251 |
+
this.$input.removeClass( 'edit-gmedia-ignore' );
|
252 |
+
if ( focus_input_val !== this.$input.val() ) {
|
253 |
+
this.$input.trigger( 'change' );
|
254 |
+
}
|
255 |
+
},
|
256 |
+
createOnBlur: true,
|
257 |
+
delimiter: ',',
|
258 |
+
maxItems: null,
|
259 |
+
openOnFocus: true,
|
260 |
+
persist: true,
|
261 |
+
options: categories_data,
|
262 |
+
labelField: 'item',
|
263 |
+
valueField: 'item',
|
264 |
+
searchField: ['item'],
|
265 |
+
hideSelected: true,
|
266 |
+
} );
|
267 |
+
}
|
268 |
+
}
|
269 |
+
if ( window.gmedia_tags ) {
|
270 |
+
var tags = jQuery( '.combobox_gmedia_tag' );
|
271 |
+
if ( tags.length ) {
|
272 |
+
var tags_data = window.gmedia_tags.map( function( x ) {
|
273 |
+
return {item: x};
|
274 |
+
} );
|
275 |
+
|
276 |
+
var selectize_tags = tags.selectize( {
|
277 |
+
create: function( input ) {
|
278 |
+
if ( this.$input.data( 'create' ) ) {
|
279 |
+
var option = {item: input};
|
280 |
+
tags_data.push( option );
|
281 |
+
return option;
|
282 |
+
}
|
283 |
+
else {
|
284 |
+
return false;
|
285 |
+
}
|
286 |
+
},
|
287 |
+
onOptionAdd: function( value, data ) {
|
288 |
+
jQuery.each( selectize_tags, function( i, e ) {
|
289 |
+
e.selectize.options[value] = data;
|
290 |
+
} );
|
291 |
+
},
|
292 |
+
onFocus: function() {
|
293 |
+
this.$input.addClass( 'edit-gmedia-ignore' );
|
294 |
+
focus_input_val = this.$input.val();
|
295 |
+
},
|
296 |
+
onBlur: function() {
|
297 |
+
this.$input.removeClass( 'edit-gmedia-ignore' );
|
298 |
+
if ( focus_input_val !== this.$input.val() ) {
|
299 |
+
this.$input.trigger( 'change' );
|
300 |
+
}
|
301 |
+
},
|
302 |
+
createOnBlur: true,
|
303 |
+
delimiter: ',',
|
304 |
+
maxItems: null,
|
305 |
+
openOnFocus: true,
|
306 |
+
persist: true,
|
307 |
+
options: tags_data,
|
308 |
+
labelField: 'item',
|
309 |
+
valueField: 'item',
|
310 |
+
searchField: ['item'],
|
311 |
+
hideSelected: true,
|
312 |
+
} );
|
313 |
+
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
// Date/Time picker
|
318 |
+
var gmedia_date_temp;
|
319 |
+
jQuery( '.input-group.gmedia_date' ).each( function() {
|
320 |
+
var gm_date_div = this;
|
321 |
+
var date_string = jQuery( 'input', gm_date_div ).val();
|
322 |
+
if ( '0000-00-00 00:00:00' === date_string ) {
|
323 |
+
date_string = '1970-01-01 00:00:00';
|
324 |
+
}
|
325 |
+
var m = moment( date_string, 'YYYY-MM-DD HH:mm:ss' ).toDate();
|
326 |
+
|
327 |
+
let picker = new tempusDominus.TempusDominus(
|
328 |
+
gm_date_div,
|
329 |
+
{
|
330 |
+
allowInputToggle: true,
|
331 |
+
display: {
|
332 |
+
components: {
|
333 |
+
seconds: true,
|
334 |
+
useTwentyfourHour: true,
|
335 |
+
},
|
336 |
+
},
|
337 |
+
},
|
338 |
+
);
|
339 |
+
picker.dates.formatInput = function( date ) {
|
340 |
+
return moment( date ).format( 'YYYY-MM-DD HH:mm:ss' );
|
341 |
+
};
|
342 |
+
picker.dates.setFromInput( m );
|
343 |
+
|
344 |
+
picker.subscribe( tempusDominus.Namespace.events.show, ( e ) => {
|
345 |
+
gmedia_date_temp = jQuery( 'input', gm_date_div ).val();
|
346 |
+
} );
|
347 |
+
picker.subscribe( tempusDominus.Namespace.events.hide, ( e ) => {
|
348 |
+
if ( jQuery( 'input', gm_date_div ).val() !== gmedia_date_temp ) {
|
349 |
+
jQuery( 'input', gm_date_div ).trigger( 'modified' );
|
350 |
+
}
|
351 |
+
} );
|
352 |
+
} );
|
353 |
+
|
354 |
+
// Mask for filename input
|
355 |
+
var inp_filename = jQuery( 'input.gmedia-filename' ).not( '[readonly]' );
|
356 |
+
if ( inp_filename.length ) {
|
357 |
+
inp_filename.alphanum( {
|
358 |
+
allow: '-_',
|
359 |
+
disallow: '',
|
360 |
+
allowSpace: false,
|
361 |
+
allowNumeric: true,
|
362 |
+
allowUpper: true,
|
363 |
+
allowLower: true,
|
364 |
+
allowCaseless: true,
|
365 |
+
allowLatin: true,
|
366 |
+
allowOtherCharSets: false,
|
367 |
+
forceUpper: false,
|
368 |
+
forceLower: false,
|
369 |
+
maxLength: NaN,
|
370 |
+
} );
|
371 |
+
}
|
372 |
+
|
373 |
+
if ( jQuery( '#wp-link-wrap' ).parent().hasClass( 'visually-hidden' ) ) {
|
374 |
+
jQuery( '#wp-link-backdrop, #wp-link-wrap' ).appendTo( 'body' );
|
375 |
+
}
|
376 |
+
jQuery( document ).
|
377 |
+
on( 'click.gmedia', '.gmedia-custom-link', function( e ) {
|
378 |
+
var editorId = jQuery( this ).attr( 'data-target' );
|
379 |
+
window.wpActiveEditor = true;
|
380 |
+
wpLink.open( editorId );
|
381 |
+
wpLink.gmediaCustomLinkTarget = editorId;
|
382 |
+
jQuery( '#wp-link-wrap' ).
|
383 |
+
removeClass( 'has-text-field' ).
|
384 |
+
addClass( 'gmLinkModal' ).
|
385 |
+
find( '.link-target' ).
|
386 |
+
css( 'visibility', 'hidden' );
|
387 |
+
|
388 |
+
return false;
|
389 |
+
} );
|
390 |
+
|
391 |
+
function closeLinkModal() {
|
392 |
+
jQuery( '#wp-link-wrap' ).
|
393 |
+
removeClass( 'gmLinkModal' ).
|
394 |
+
find( '.link-target' ).
|
395 |
+
removeAttr( 'style' );
|
396 |
+
wpLink.close();
|
397 |
+
}
|
398 |
+
|
399 |
+
jQuery( document ).
|
400 |
+
on( 'click.gmedia', '.gmLinkModal #wp-link-submit', function( e ) {
|
401 |
+
e.preventDefault ? e.preventDefault() : e.returnValue = false;
|
402 |
+
e.stopPropagation();
|
403 |
+
|
404 |
+
var link = wpLink.getAttrs();
|
405 |
+
wpLink.textarea = jQuery( '#' + wpLink.gmediaCustomLinkTarget );
|
406 |
+
|
407 |
+
if ( ! link.href ) {
|
408 |
+
closeLinkModal();
|
409 |
+
return;
|
410 |
+
}
|
411 |
+
wpLink.textarea.val( link.href ).trigger( 'change' );
|
412 |
+
closeLinkModal();
|
413 |
+
} );
|
414 |
+
jQuery( document ).
|
415 |
+
on( 'click.gmedia',
|
416 |
+
'#wp-link-cancel, #wp-link-close, #wp-link-backdrop',
|
417 |
+
function( e ) {
|
418 |
+
closeLinkModal();
|
419 |
+
} );
|
420 |
+
|
421 |
+
var related_sortable = jQuery( '.related-media-previews' );
|
422 |
+
if ( related_sortable.length ) {
|
423 |
+
related_sortable.sortable( {
|
424 |
+
items: '.gmedia-related-image',
|
425 |
+
handle: '.image-wrapper',
|
426 |
+
placeholder: 'gmedia-related-image',
|
427 |
+
tolerance: 'pointer',
|
428 |
+
//helper: 'clone',
|
429 |
+
revert: true,
|
430 |
+
forcePlaceholderSize: true,
|
431 |
+
stop: function( event, ui ) {
|
432 |
+
ui.item.find( 'input' ).trigger( 'change' );
|
433 |
+
},
|
434 |
+
} );
|
435 |
+
}
|
436 |
+
|
437 |
+
},
|
438 |
};
|
439 |
|
440 |
/**
|
441 |
* Gmedia AddMedia
|
442 |
*/
|
443 |
var GmediaAddMedia = {
|
444 |
+
init: function() {
|
445 |
+
|
446 |
+
if ( jQuery( 'body' ).hasClass( 'GrandMedia_AddMedia' ) ) {
|
447 |
+
gmedia_DOM.on( 'change', '#uploader_runtime select', function() {
|
448 |
+
if ( 'html4' === jQuery( this ).val() ) {
|
449 |
+
jQuery( '#uploader_chunking' ).addClass( 'hide' );
|
450 |
+
jQuery( '#uploader_urlstream_upload' ).addClass( 'hide' );
|
451 |
+
}
|
452 |
+
else {
|
453 |
+
jQuery( '#uploader_chunking' ).removeClass( 'hide' );
|
454 |
+
jQuery( '#uploader_urlstream_upload' ).removeClass( 'hide' );
|
455 |
+
}
|
456 |
+
} );
|
457 |
+
}
|
458 |
+
|
459 |
+
var albums = jQuery( 'select#combobox_gmedia_album' );
|
460 |
+
if ( albums.length ) {
|
461 |
+
var albums_data = jQuery( 'option', albums );
|
462 |
+
albums.selectize( {
|
463 |
+
create: function( input ) {
|
464 |
+
if ( albums.data( 'create' ) ) {
|
465 |
+
return {
|
466 |
+
value: input,
|
467 |
+
text: input,
|
468 |
+
};
|
469 |
+
}
|
470 |
+
else {
|
471 |
+
return false;
|
472 |
+
}
|
473 |
+
},
|
474 |
+
createOnBlur: true,
|
475 |
+
persist: false,
|
476 |
+
render: {
|
477 |
+
item: function( item, escape ) {
|
478 |
+
if ( 0 === (parseInt( item.value, 10 ) || 0) ) {
|
479 |
+
return '<div>' + escape( item.text ) + '</div>';
|
480 |
+
}
|
481 |
+
if ( item.$order ) {
|
482 |
+
var data = jQuery( albums_data[item.$order] ).data();
|
483 |
+
return '<div>' + escape( data.name ) + ' <small>' +
|
484 |
+
escape( data.meta ) + '</small></div>';
|
485 |
+
}
|
486 |
+
},
|
487 |
+
option: function( item, escape ) {
|
488 |
+
if ( 0 === (parseInt( item.value ) || 0) ) {
|
489 |
+
return '<div class="option">' + escape( item.text ) + '</div>';
|
490 |
+
}
|
491 |
+
if ( item.$order ) {
|
492 |
+
var data = jQuery( albums_data[item.$order] ).data();
|
493 |
+
return '<div class="option">' + escape( data.name ) + ' <small>' +
|
494 |
+
escape( data.meta ) + '</small></div>';
|
495 |
+
}
|
496 |
+
},
|
497 |
+
},
|
498 |
+
} );
|
499 |
+
}
|
500 |
+
|
501 |
+
if ( window.gmedia_tags ) {
|
502 |
+
var tags = jQuery( '#combobox_gmedia_tag' );
|
503 |
+
if ( tags.length ) {
|
504 |
+
var tags_data = window.gmedia_tags.map( function( x ) {
|
505 |
+
return {item: x};
|
506 |
+
} );
|
507 |
+
|
508 |
+
tags.selectize( {
|
509 |
+
create: function( input ) {
|
510 |
+
if ( tags.data( 'create' ) ) {
|
511 |
+
return {
|
512 |
+
item: input,
|
513 |
+
};
|
514 |
+
}
|
515 |
+
else {
|
516 |
+
return false;
|
517 |
+
}
|
518 |
+
},
|
519 |
+
createOnBlur: true,
|
520 |
+
delimiter: ',',
|
521 |
+
maxItems: null,
|
522 |
+
openOnFocus: true,
|
523 |
+
persist: false,
|
524 |
+
options: tags_data,
|
525 |
+
labelField: 'item',
|
526 |
+
valueField: 'item',
|
527 |
+
searchField: ['item'],
|
528 |
+
hideSelected: true,
|
529 |
+
} );
|
530 |
+
}
|
531 |
+
}
|
532 |
+
if ( window.gmedia_categories ) {
|
533 |
+
var categories = jQuery( '#combobox_gmedia_category' );
|
534 |
+
if ( categories.length ) {
|
535 |
+
var categories_data = window.gmedia_categories.map( function( x ) {
|
536 |
+
return {item: x};
|
537 |
+
} );
|
538 |
+
|
539 |
+
categories.selectize( {
|
540 |
+
create: function( input ) {
|
541 |
+
if ( categories.data( 'create' ) ) {
|
542 |
+
return {
|
543 |
+
item: input,
|
544 |
+
};
|
545 |
+
}
|
546 |
+
else {
|
547 |
+
return false;
|
548 |
+
}
|
549 |
+
},
|
550 |
+
createOnBlur: true,
|
551 |
+
delimiter: ',',
|
552 |
+
maxItems: null,
|
553 |
+
openOnFocus: true,
|
554 |
+
persist: false,
|
555 |
+
options: categories_data,
|
556 |
+
labelField: 'item',
|
557 |
+
valueField: 'item',
|
558 |
+
searchField: ['item'],
|
559 |
+
hideSelected: true,
|
560 |
+
} );
|
561 |
+
}
|
562 |
+
}
|
563 |
+
|
564 |
+
},
|
565 |
+
/**
|
566 |
+
* Gmedia Import
|
567 |
+
*/
|
568 |
+
importmode: function() {
|
569 |
+
},
|
570 |
};
|
571 |
|
572 |
/**
|
573 |
* Gmedia Terms
|
574 |
*/
|
575 |
var GmediaTerms = {
|
576 |
+
init: function() {
|
577 |
+
|
578 |
+
if ( jQuery( 'body' ).hasClass( 'GrandMedia_Tags' ) ) {
|
579 |
+
jQuery( '#gm-list-table' ).data( 'edit', false );
|
580 |
+
gmedia_DOM.on( 'keypress', 'input.edit_tag_input', function( e ) {
|
581 |
+
var tagdiv = jQuery( '#tag_' + jQuery( this ).data( 'tag_id' ) );
|
582 |
+
var charCode = e.charCode || e.keyCode || e.which;
|
583 |
+
if ( charCode === 13 ) {
|
584 |
+
e.preventDefault();
|
585 |
+
edit_tag( tagdiv );
|
586 |
+
}
|
587 |
+
} ).on( 'blur', 'input.edit_tag_input', function() {
|
588 |
+
var tagdiv = jQuery( '#tag_' + jQuery( this ).data( 'tag_id' ) );
|
589 |
+
edit_tag( tagdiv );
|
590 |
+
} );
|
591 |
+
|
592 |
+
gmedia_DOM.on( 'click', '.edit_tag_link', function( e ) {
|
593 |
+
e.preventDefault();
|
594 |
+
var id = jQuery( this ).attr( 'href' );
|
595 |
+
jQuery( this ).hide();
|
596 |
+
jQuery( id ).find( '.edit_tag_form' ).show().find( 'input' ).focus();
|
597 |
+
jQuery( '#gm-list-table' ).data( 'edit', true );
|
598 |
+
} );
|
599 |
+
gmedia_DOM.on( 'click', '.edit_tag_save', function( e ) {
|
600 |
+
e.preventDefault();
|
601 |
+
} );
|
602 |
+
|
603 |
+
function edit_tag( tagdiv ) {
|
604 |
+
var inp = tagdiv.find( '.edit_tag_form input' );
|
605 |
+
var new_tag_name = jQuery.trim( inp.val() );
|
606 |
+
var old_tag_name = inp.attr( 'placeholder' );
|
607 |
+
if ( (old_tag_name === new_tag_name) || ('' === new_tag_name) ||
|
608 |
+
jQuery.isNumeric() ) {
|
609 |
+
inp.val( old_tag_name );
|
610 |
+
tagdiv.find( '.edit_tag_form' ).hide();
|
611 |
+
tagdiv.find( '.edit_tag_link' ).show();
|
612 |
+
return;
|
613 |
+
}
|
614 |
+
var post_data = {
|
615 |
+
action: 'gmedia_tag_edit',
|
616 |
+
tag_id: inp.data( 'tag_id' ),
|
617 |
+
tag_name: new_tag_name,
|
618 |
+
_wpnonce_terms: jQuery( '#_wpnonce_terms' ).val(),
|
619 |
+
};
|
620 |
+
jQuery.post( ajaxurl, post_data, function( data, textStatus, jqXHR ) {
|
621 |
+
if ( data.error ) {
|
622 |
+
//inp.val(inp.attr('placeholder'));
|
623 |
+
jQuery( '#gmedia-panel' ).before( data.error );
|
624 |
+
}
|
625 |
+
else {
|
626 |
+
//new_tag_name = new_tag_name.replace(/&/g, '&').replace(/"/g,
|
627 |
+
// '"').replace(/</g, '<').replace(/>/g, '>');
|
628 |
+
inp.attr( 'placeholder', new_tag_name );
|
629 |
+
tagdiv.find( '.edit_tag_link' ).text( new_tag_name ).show();
|
630 |
+
//noinspection JSUnresolvedVariable
|
631 |
+
jQuery( '#gmedia-panel' ).before( data.msg );
|
632 |
+
tagdiv.find( '.edit_tag_form' ).hide();
|
633 |
+
}
|
634 |
+
} );
|
635 |
+
}
|
636 |
+
}
|
637 |
+
|
638 |
+
gmedia_DOM.on( 'click', '.term-shortcode input', function() {
|
639 |
+
this.setSelectionRange( 0, 0 );
|
640 |
+
this.setSelectionRange( 0, this.value.length );
|
641 |
+
} );
|
642 |
+
gmedia_DOM.on( 'change', '.term-shortcode input', function() {
|
643 |
+
shortcode_inp_autowidth( this );
|
644 |
+
} );
|
645 |
+
jQuery( '.term-shortcode input', gmedia_DOM ).each( function( i, e ) {
|
646 |
+
shortcode_inp_autowidth( this );
|
647 |
+
} );
|
648 |
+
|
649 |
+
function shortcode_inp_autowidth( e ) {
|
650 |
+
var inp = jQuery( e ),
|
651 |
+
buffer = inp.next( '.input-buffer' );
|
652 |
+
buffer.text( inp.val() );
|
653 |
+
inp.width( buffer.width() );
|
654 |
+
}
|
655 |
+
|
656 |
+
var sortable = jQuery( '#gm-sortable' );
|
657 |
+
if ( sortable.length &&
|
658 |
+
! jQuery( '#gmedia-panel', sortable ).hasClass( 'gmedia-filtered' ) ) {
|
659 |
+
var sortdiv = jQuery( '#gm-list-table', sortable );
|
660 |
+
var post_data = sortable.data();
|
661 |
+
post_data['idx0'] = parseInt( sortdiv.attr( 'data-idx0' ) );
|
662 |
+
|
663 |
+
var _ids = [];
|
664 |
+
jQuery( '.gm-item-cell', sortdiv ).each( function( index ) {
|
665 |
+
_ids.push( jQuery( this ).attr( 'data-id' ) );
|
666 |
+
} );
|
667 |
+
sortdiv.sortable( {
|
668 |
+
items: '.gm-item-cell',
|
669 |
+
handle: '.cb_media-object',
|
670 |
+
placeholder: 'cb_list-item gm-item-cell col-xs-6 col-sm-4 col-md-3 col-lg-2 gmedia-image-item ui-highlight-placeholder',
|
671 |
+
tolerance: 'pointer',
|
672 |
+
helper: 'clone',
|
673 |
+
revert: true,
|
674 |
+
forcePlaceholderSize: true,
|
675 |
+
stop: function( event, ui ) {
|
676 |
+
var ids = [];
|
677 |
+
jQuery( '.gm-item-cell', sortdiv ).each( function( index ) {
|
678 |
+
ids.push( jQuery( this ).attr( 'data-id' ) );
|
679 |
+
} );
|
680 |
+
|
681 |
+
if ( _ids.toString() !== ids.toString() ) {
|
682 |
+
_ids = ids;
|
683 |
+
jQuery( '.card-header .spinner', sortable ).addClass( 'is-active' );
|
684 |
+
post_data['ids'] = ids;
|
685 |
+
jQuery.post( ajaxurl, post_data,
|
686 |
+
function( data, textStatus, jqXHR ) {
|
687 |
+
jQuery( '.card-header .spinner', sortable ).
|
688 |
+
removeClass( 'is-active' );
|
689 |
+
} );
|
690 |
+
}
|
691 |
+
},
|
692 |
+
} );
|
693 |
+
}
|
694 |
+
|
695 |
+
gmedia_DOM.on( 'change', '#gmedia_term_orderby', function() {
|
696 |
+
if ( 'custom' === jQuery( this ).val() ) {
|
697 |
+
jQuery( '#gmedia_term_order' ).val( 'ASC' ).addClass( 'disabled' );
|
698 |
+
}
|
699 |
+
else {
|
700 |
+
jQuery( '#gmedia_term_order' ).removeClass( 'disabled' );
|
701 |
+
}
|
702 |
+
} );
|
703 |
+
|
704 |
+
// Date/Time picker
|
705 |
+
jQuery( '.input-group.gmedia_date' ).each( function() {
|
706 |
+
var gm_date_div = this;
|
707 |
+
var date_string = jQuery( 'input', gm_date_div ).val();
|
708 |
+
if ( '0000-00-00 00:00:00' === date_string ) {
|
709 |
+
date_string = '1970-01-01 00:00:00';
|
710 |
+
}
|
711 |
+
var m = moment( date_string, 'YYYY-MM-DD HH:mm:ss' ).toDate();
|
712 |
+
|
713 |
+
let picker = new tempusDominus.TempusDominus(
|
714 |
+
gm_date_div,
|
715 |
+
{
|
716 |
+
allowInputToggle: true,
|
717 |
+
display: {
|
718 |
+
components: {
|
719 |
+
seconds: true,
|
720 |
+
useTwentyfourHour: true,
|
721 |
+
},
|
722 |
+
},
|
723 |
+
},
|
724 |
+
);
|
725 |
+
picker.dates.formatInput = function( date ) {
|
726 |
+
return moment( date ).format( 'YYYY-MM-DD HH:mm:ss' );
|
727 |
+
};
|
728 |
+
picker.dates.setFromInput( m );
|
729 |
+
} );
|
730 |
+
},
|
731 |
};
|
732 |
|
733 |
var GmediaSelect = {
|
734 |
+
msg_stack: function( global ) {
|
735 |
+
var gm_cb = jQuery( '.gm-stack input' );
|
736 |
+
var sel = jQuery( '#gm-stack' );
|
737 |
+
if ( ! sel.length ) {
|
738 |
+
return;
|
739 |
+
}
|
740 |
+
|
741 |
+
var arr = sel.val().split( ',' );
|
742 |
+
arr = jQuery.grep( arr, function( e ) {
|
743 |
+
return (e);
|
744 |
+
} );
|
745 |
+
|
746 |
+
if ( global ) {
|
747 |
+
var cur = false;
|
748 |
+
gm_cb.each( function() {
|
749 |
+
cur = jQuery( this );
|
750 |
+
if ( cur.is( ':checked' ) &&
|
751 |
+
(jQuery.inArray( cur.val(), arr ) === -1) ) {
|
752 |
+
cur.prop( 'checked', false );
|
753 |
+
}
|
754 |
+
else if ( ! (cur.is( ':checked' )) &&
|
755 |
+
(jQuery.inArray( cur.val(), arr ) !== -1) ) {
|
756 |
+
cur.prop( 'checked', true );
|
757 |
+
}
|
758 |
+
} );
|
759 |
+
}
|
760 |
+
|
761 |
+
if ( sel.data( 'userid' ) ) {
|
762 |
+
var storedData = getStorage();
|
763 |
+
storedData.set( sel.data( 'key' ), arr.join( '.' ) );
|
764 |
+
}
|
765 |
+
jQuery( '#gm-stack-qty' ).text( arr.length );
|
766 |
+
if ( arr.length ) {
|
767 |
+
jQuery( '#gm-stack-btn' ).removeClass( 'visually-hidden' );
|
768 |
+
jQuery( '.rel-stack-show' ).show();
|
769 |
+
jQuery( '.rel-stack-hide' ).hide();
|
770 |
+
}
|
771 |
+
else {
|
772 |
+
jQuery( '#gm-stack-btn' ).addClass( 'visually-hidden' );
|
773 |
+
jQuery( '.rel-stack-show' ).hide();
|
774 |
+
jQuery( '.rel-stack-hide' ).show();
|
775 |
+
}
|
776 |
+
sel.trigger( 'change' );
|
777 |
+
},
|
778 |
+
msg_selected: function( obj, global ) {
|
779 |
+
var gm_cb = jQuery( '.' + obj + ' input' ),
|
780 |
+
qty_v = gm_cb.length,
|
781 |
+
sel_v = gm_cb.filter( ':checked' ).length,
|
782 |
+
c = jQuery( '#cb_global' );
|
783 |
+
if ( (sel_v !== qty_v) && (0 !== sel_v) ) {
|
784 |
+
c.css( 'opacity', '0.5' ).prop( 'checked', true );
|
785 |
+
}
|
786 |
+
else if ( (sel_v === qty_v) && (0 !== qty_v) ) {
|
787 |
+
c.css( 'opacity', '1' ).prop( 'checked', true );
|
788 |
+
}
|
789 |
+
else if ( 0 === sel_v ) {
|
790 |
+
c.css( 'opacity', '1' ).prop( 'checked', false );
|
791 |
+
}
|
792 |
+
|
793 |
+
var sel = jQuery( '#gm-selected' );
|
794 |
+
if ( ! sel.length ) {
|
795 |
+
return;
|
796 |
+
}
|
797 |
+
|
798 |
+
var arr = sel.val().split( ',' );
|
799 |
+
|
800 |
+
arr = jQuery.grep( arr, function( e ) {
|
801 |
+
return (e);
|
802 |
+
} );
|
803 |
+
if ( global ) {
|
804 |
+
var cur = false;
|
805 |
+
gm_cb.each( function() {
|
806 |
+
cur = jQuery( this );
|
807 |
+
if ( cur.is( ':checked' ) &&
|
808 |
+
(jQuery.inArray( cur.val(), arr ) === -1) ) {
|
809 |
+
arr.push( cur.val() );
|
810 |
+
}
|
811 |
+
else if ( ! (cur.is( ':checked' )) &&
|
812 |
+
(jQuery.inArray( cur.val(), arr ) !== -1) ) {
|
813 |
+
arr = jQuery.grep( arr, function( e ) {
|
814 |
+
return e !== cur.val();
|
815 |
+
} );
|
816 |
+
}
|
817 |
+
} );
|
818 |
+
sel.val( arr.join( ',' ) );
|
819 |
+
}
|
820 |
+
|
821 |
+
if ( sel.data( 'userid' ) ) {
|
822 |
+
var storedData = getStorage();
|
823 |
+
storedData.set( sel.data( 'key' ), arr.join( '.' ) );
|
824 |
+
}
|
825 |
+
jQuery( '#gm-selected-qty' ).text( arr.length );
|
826 |
+
|
827 |
+
var selbtn = jQuery( '#gm-selected-btn' );
|
828 |
+
if ( arr.length ) {
|
829 |
+
selbtn.removeClass( 'visually-hidden' );
|
830 |
+
jQuery( '.rel-selected-show' ).show();
|
831 |
+
jQuery( '.rel-selected-hide' ).hide();
|
832 |
+
}
|
833 |
+
else {
|
834 |
+
if ( ! selbtn.hasClass( 'gm-active' ) ) {
|
835 |
+
jQuery( '#gm-selected-btn' ).addClass( 'visually-hidden' );
|
836 |
+
}
|
837 |
+
jQuery( '.rel-selected-show' ).hide();
|
838 |
+
jQuery( '.rel-selected-hide' ).show();
|
839 |
+
}
|
840 |
+
sel.trigger( 'change' );
|
841 |
+
},
|
842 |
+
chk_all: function( type, obj ) {
|
843 |
+
jQuery( '.' + obj + ' input' ).
|
844 |
+
filter( function() {
|
845 |
+
return type ? jQuery( this ).data( 'type' ) === type : true;
|
846 |
+
} ).
|
847 |
+
prop( 'checked', true ).
|
848 |
+
closest( '.cb_list-item' ).
|
849 |
+
addClass( 'gm-selected' );
|
850 |
+
},
|
851 |
+
chk_none: function( type, obj ) {
|
852 |
+
jQuery( '.' + obj + ' input' ).
|
853 |
+
filter( function() {
|
854 |
+
return type ? jQuery( this ).data( 'type' ) === type : true;
|
855 |
+
} ).
|
856 |
+
prop( 'checked', false ).
|
857 |
+
closest( '.cb_list-item' ).
|
858 |
+
removeClass( 'gm-selected' );
|
859 |
+
},
|
860 |
+
chk_toggle: function( type, obj ) {
|
861 |
+
if ( type ) {
|
862 |
+
if ( jQuery( '.' + obj + ' input:checked' ).filter( function() {
|
863 |
+
return jQuery( this ).data( 'type' ) === type;
|
864 |
+
} ).length ) {
|
865 |
+
GmediaSelect.chk_none( type, obj );
|
866 |
+
}
|
867 |
+
else {
|
868 |
+
GmediaSelect.chk_all( type, obj );
|
869 |
+
}
|
870 |
+
}
|
871 |
+
else {
|
872 |
+
jQuery( '.' + obj + ' input' ).each( function() {
|
873 |
+
jQuery( this ).
|
874 |
+
prop( 'checked', ! jQuery( this ).prop( 'checked' ) ).
|
875 |
+
closest( '.cb_list-item' ).
|
876 |
+
toggleClass( 'gm-selected' );
|
877 |
+
} );
|
878 |
+
}
|
879 |
+
},
|
880 |
+
init: function() {
|
881 |
+
var cb_obj = jQuery( '#cb_global' ).data( 'group' );
|
882 |
+
|
883 |
+
if ( jQuery( '#gm-selected' ).length ) {
|
884 |
+
GmediaSelect.msg_selected( cb_obj );
|
885 |
+
gmedia_DOM.on( 'click', '#gm-selected-clear', function( e ) {
|
886 |
+
jQuery( '#gm-selected' ).val( '' );
|
887 |
+
GmediaSelect.chk_none( false, cb_obj );
|
888 |
+
GmediaSelect.msg_selected( cb_obj );
|
889 |
+
e.preventDefault();
|
890 |
+
} );
|
891 |
+
gmedia_DOM.on( 'click', '#gm-selected-show', function( e ) {
|
892 |
+
jQuery( '#gm-selected-btn' ).submit();
|
893 |
+
e.preventDefault();
|
894 |
+
} );
|
895 |
+
gmedia_DOM.on( 'click', '#gm-stack-in', function( e ) {
|
896 |
+
e.preventDefault();
|
897 |
+
var stack_obj = jQuery( '#gm-stack' ),
|
898 |
+
sel_obj = jQuery( '#gm-selected' ),
|
899 |
+
stack = stack_obj.val().split( ',' ),
|
900 |
+
selected = sel_obj.val().split( ',' ),
|
901 |
+
arr = stack.concat( selected );
|
902 |
+
arr = jQuery.grep( arr, function( e ) {
|
903 |
+
return (e);
|
904 |
+
} );
|
905 |
+
arr = jQuery.unique( arr );
|
906 |
+
stack_obj.val( arr.join( ',' ) );
|
907 |
+
GmediaSelect.msg_stack( true );
|
908 |
+
//sel_obj.val('');
|
909 |
+
//GmediaSelect.chk_none(false, cb_obj);
|
910 |
+
//GmediaSelect.msg_selected(cb_obj);
|
911 |
+
} );
|
912 |
+
gmedia_DOM.on( 'click', '#gm-stack-out', function( e ) {
|
913 |
+
e.preventDefault();
|
914 |
+
var stack_obj = jQuery( '#gm-stack' ),
|
915 |
+
sel_obj = jQuery( '#gm-selected' ),
|
916 |
+
stack = stack_obj.val().split( ',' ),
|
917 |
+
selected = sel_obj.val().split( ',' ),
|
918 |
+
arr = jQuery( stack ).not( selected ).get();
|
919 |
+
arr = jQuery.grep( arr, function( e ) {
|
920 |
+
return (e);
|
921 |
+
} );
|
922 |
+
arr = jQuery.unique( arr );
|
923 |
+
stack_obj.val( arr.join( ',' ) );
|
924 |
+
GmediaSelect.msg_stack( true );
|
925 |
+
//sel_obj.val('');
|
926 |
+
//GmediaSelect.chk_none(false, cb_obj);
|
927 |
+
//GmediaSelect.msg_selected(cb_obj);
|
928 |
+
} );
|
929 |
+
}
|
930 |
+
gmedia_DOM.on( 'click', '#cb_global', function() {
|
931 |
+
if ( jQuery( this ).is( ':checked' ) ) {
|
932 |
+
GmediaSelect.chk_all( false, cb_obj );
|
933 |
+
}
|
934 |
+
else {
|
935 |
+
GmediaSelect.chk_none( false, cb_obj );
|
936 |
+
}
|
937 |
+
GmediaSelect.msg_selected( cb_obj, true );
|
938 |
+
} );
|
939 |
+
gmedia_DOM.on( 'click', '#cb_global-btn li a', function( e ) {
|
940 |
+
var sel = jQuery( this ).data( 'select' );
|
941 |
+
switch ( sel ) {
|
942 |
+
case 'total':
|
943 |
+
GmediaSelect.chk_all( false, cb_obj );
|
944 |
+
break;
|
945 |
+
case 'none':
|
946 |
+
GmediaSelect.chk_none( false, cb_obj );
|
947 |
+
break;
|
948 |
+
case 'reverse':
|
949 |
+
GmediaSelect.chk_toggle( false, cb_obj );
|
950 |
+
break;
|
951 |
+
case 'image':
|
952 |
+
case 'audio':
|
953 |
+
case 'video':
|
954 |
+
GmediaSelect.chk_toggle( sel, cb_obj );
|
955 |
+
break;
|
956 |
+
}
|
957 |
+
GmediaSelect.msg_selected( cb_obj, true );
|
958 |
+
e.preventDefault();
|
959 |
+
} );
|
960 |
+
gmedia_DOM.on( 'change',
|
961 |
+
'.gm-item-check input:checkbox, .cb_object input:checkbox', function() {
|
962 |
+
var selected = jQuery( '#gm-selected' ),
|
963 |
+
arr = selected.val();
|
964 |
+
var cur = jQuery( this ).val();
|
965 |
+
if ( jQuery( this ).is( ':checked' ) ) {
|
966 |
+
if ( arr ) {
|
967 |
+
arr = arr + ',' + cur;
|
968 |
+
}
|
969 |
+
else {
|
970 |
+
arr = cur;
|
971 |
+
}
|
972 |
+
}
|
973 |
+
else {
|
974 |
+
arr = jQuery.grep( arr.split( ',' ), function( a ) {
|
975 |
+
return a !== cur;
|
976 |
+
} ).join( ',' );
|
977 |
+
}
|
978 |
+
jQuery( '#list-item-' + cur ).toggleClass( 'gm-selected' );
|
979 |
+
selected.val( arr );
|
980 |
+
GmediaSelect.msg_selected( cb_obj );
|
981 |
+
} );
|
982 |
+
|
983 |
+
gmedia_DOM.on( 'click', '.gm-item-check input:radio', function() {
|
984 |
+
var id = jQuery( this ).val(), img, checked_thumb, data;
|
985 |
+
jQuery( '#list-item-' + id ).
|
986 |
+
addClass( 'gm-selected' ).
|
987 |
+
siblings().
|
988 |
+
removeClass( 'gm-selected' );
|
989 |
+
img = jQuery( this ).
|
990 |
+
closest( '.img-thumbnail' ).
|
991 |
+
find( '.gmedia-thumb' ).
|
992 |
+
clone();
|
993 |
+
checked_thumb = jQuery( '#gmedia-panel .card-header .checked_thumb' );
|
994 |
+
if ( ! checked_thumb.length ) {
|
995 |
+
checked_thumb = jQuery( '<div class="checked_thumb"></div>' ).
|
996 |
+
appendTo( jQuery( '#gmedia-panel .card-header' ) );
|
997 |
+
}
|
998 |
+
checked_thumb.html( img );
|
999 |
+
data = {'id': id, 'src': img.attr( 'src' )};
|
1000 |
+
window.parent.gmediaTempData = data;
|
1001 |
+
} );
|
1002 |
+
|
1003 |
+
if ( jQuery( '#gm-stack' ).length ) {
|
1004 |
+
GmediaSelect.msg_stack();
|
1005 |
+
gmedia_DOM.on( 'click', '#gm-stack-clear', function( e ) {
|
1006 |
+
jQuery( '#gm-stack' ).val( '' );
|
1007 |
+
jQuery( '.gm-stack input' ).prop( 'checked', false );
|
1008 |
+
GmediaSelect.msg_stack();
|
1009 |
+
e.preventDefault();
|
1010 |
+
} );
|
1011 |
+
gmedia_DOM.on( 'click', '#gm-stack-show', function( e ) {
|
1012 |
+
jQuery( '#gm-stack-btn' ).submit();
|
1013 |
+
e.preventDefault();
|
1014 |
+
} );
|
1015 |
+
|
1016 |
+
}
|
1017 |
+
gmedia_DOM.on( 'change', '.gm-stack input:checkbox', function() {
|
1018 |
+
var selected = jQuery( '#gm-stack' ),
|
1019 |
+
arr = selected.val();
|
1020 |
+
var cur = jQuery( this ).val();
|
1021 |
+
if ( jQuery( this ).is( ':checked' ) ) {
|
1022 |
+
if ( arr ) {
|
1023 |
+
arr = arr + ',' + cur;
|
1024 |
+
}
|
1025 |
+
else {
|
1026 |
+
arr = cur;
|
1027 |
+
}
|
1028 |
+
}
|
1029 |
+
else {
|
1030 |
+
arr = jQuery.grep( arr.split( ',' ), function( a ) {
|
1031 |
+
return a !== cur;
|
1032 |
+
} ).join( ',' );
|
1033 |
+
}
|
1034 |
+
selected.val( arr );
|
1035 |
+
GmediaSelect.msg_stack();
|
1036 |
+
} );
|
1037 |
+
|
1038 |
+
gmedia_DOM.on( 'click', '.term-label', function( e ) {
|
1039 |
+
if ( 'DIV' === e.target.nodeName ) {
|
1040 |
+
if ( ! jQuery( '#gm-list-table' ).data( 'edit' ) ) {
|
1041 |
+
var cb = jQuery( 'input:checkbox', this );
|
1042 |
+
cb.prop( 'checked', ! cb.prop( 'checked' ) ).change();
|
1043 |
+
jQuery( this ).
|
1044 |
+
closest( '.term-list-item' ).
|
1045 |
+
toggleClass( 'gm-selected' );
|
1046 |
+
}
|
1047 |
+
else {
|
1048 |
+
jQuery( '#gm-list-table' ).data( 'edit', false );
|
1049 |
+
}
|
1050 |
+
}
|
1051 |
+
} );
|
1052 |
+
},
|
1053 |
};
|
1054 |
|
1055 |
var GmediaFunction = {
|
1056 |
+
confirm: function( txt ) {
|
1057 |
+
if ( ! txt ) {
|
1058 |
+
return true;
|
1059 |
+
}
|
1060 |
+
var r = false;
|
1061 |
+
//noinspection UnusedCatchParameterJS
|
1062 |
+
try {
|
1063 |
+
r = confirm( txt );
|
1064 |
+
}
|
1065 |
+
catch ( err ) {
|
1066 |
+
alert( 'Disable Popup Blocker' );
|
1067 |
+
}
|
1068 |
+
return r;
|
1069 |
+
},
|
1070 |
+
init: function() {
|
1071 |
+
jQuery( '#toplevel_page_GrandMedia' ).
|
1072 |
+
addClass( 'current' ).
|
1073 |
+
removeClass( 'wp-not-current-submenu' );
|
1074 |
+
if ( ! ('ontouchstart' in document.documentElement) ) {
|
1075 |
+
jQuery( 'html' ).addClass( 'no-touch' );
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
//jQuery(document).ajaxStart(function(a,b,c){
|
1079 |
+
// //jQuery('body').addClass('gmedia-busy');
|
1080 |
+
// jQuery('.card-header .spinner').addClass('is-active');
|
1081 |
+
//}).ajaxStop(function(){
|
1082 |
+
// //jQuery('body').removeClass('gmedia-busy');
|
1083 |
+
// jQuery('.card-header .spinner').removeClass('is-active');
|
1084 |
+
//});
|
1085 |
+
|
1086 |
+
gmedia_DOM.on( 'click', '[data-confirm]', function() {
|
1087 |
+
return GmediaFunction.confirm( jQuery( this ).data( 'confirm' ) );
|
1088 |
+
} );
|
1089 |
+
|
1090 |
+
jQuery( document ).on( 'click.gmedia', '.gm_service_action', function() {
|
1091 |
+
var el = jQuery( this ),
|
1092 |
+
service = jQuery( this ).attr( 'data-action' ),
|
1093 |
+
nonce = jQuery( this ).attr( 'data-nonce' );
|
1094 |
+
var post_data = {
|
1095 |
+
action: 'gmedia_application',
|
1096 |
+
service: service,
|
1097 |
+
_wpnonce: nonce,
|
1098 |
+
};
|
1099 |
+
jQuery.post( ajaxurl, post_data, function( data, textStatus, jqXHR ) {
|
1100 |
+
el.siblings( '.spinner' ).removeClass( 'is-active' );
|
1101 |
+
if ( data.error ) {
|
1102 |
+
jQuery( '#gmedia-service-msg-panel' ).prepend( data.error );
|
1103 |
+
}
|
1104 |
+
else if ( data.message ) {
|
1105 |
+
jQuery( '#gmedia-service-msg-panel' ).html( data.message );
|
1106 |
+
}
|
1107 |
+
} );
|
1108 |
+
|
1109 |
+
el.siblings( '.spinner' ).addClass( 'is-active' );
|
1110 |
+
jQuery( '.gmedia-service__message' ).remove();
|
1111 |
+
} );
|
1112 |
+
|
1113 |
+
gmedia_DOM.on( 'click', '.show-settings-link', function( e ) {
|
1114 |
+
e.preventDefault();
|
1115 |
+
jQuery( '#show-settings-link' ).trigger( 'click' );
|
1116 |
+
} );
|
1117 |
+
|
1118 |
+
gmedia_DOM.on( 'click', '.fit-thumbs', function( e ) {
|
1119 |
+
e.preventDefault();
|
1120 |
+
jQuery( this ).toggleClass( 'btn-success btn-secondary' );
|
1121 |
+
jQuery( '.display-as-grid' ).toggleClass( 'invert-ratio' );
|
1122 |
+
jQuery.get( jQuery( this ).attr( 'href' ), {ajaxload: 1} );
|
1123 |
+
} );
|
1124 |
+
|
1125 |
+
gmedia_DOM.on( 'click', '.gm-cell-more-btn, .gm-cell-title', function() {
|
1126 |
+
jQuery( this ).parent().toggleClass( 'gm-cell-more-active' );
|
1127 |
+
} );
|
1128 |
+
|
1129 |
+
jQuery( 'div.gmedia-modal', gmedia_DOM ).each( function() {
|
1130 |
+
var id = jQuery( this ).attr( 'id' );
|
1131 |
+
jQuery( 'body' ).children( '#' + id ).remove();
|
1132 |
+
jQuery( this ).appendTo( 'body' );
|
1133 |
+
} );
|
1134 |
+
gmedia_DOM.on( 'click', 'a.gmedia-modal', function( e ) {
|
1135 |
+
jQuery( 'body' ).addClass( 'gmedia-busy' );
|
1136 |
+
var modal_div = jQuery( jQuery( this ).attr( 'href' ) );
|
1137 |
+
var post_data = jQuery( this ).data();
|
1138 |
+
post_data['_wpnonce'] = jQuery( '#_wpnonce' ).val();
|
1139 |
+
jQuery.post( ajaxurl, post_data, function( data, textStatus, jqXHR ) {
|
1140 |
+
if ( ! data || ('-1' === data) ) {
|
1141 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1142 |
+
alert( data );
|
1143 |
+
return false;
|
1144 |
+
}
|
1145 |
+
jQuery( '.modal-dialog', modal_div ).html( data );
|
1146 |
+
modal_div.modal( {
|
1147 |
+
backdrop: 'static',
|
1148 |
+
show: true,
|
1149 |
+
keyboard: false,
|
1150 |
+
} ).one( 'hidden.bs.modal', function() {
|
1151 |
+
jQuery( '.modal-dialog', this ).empty();
|
1152 |
+
} );
|
1153 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1154 |
+
} );
|
1155 |
+
e.preventDefault();
|
1156 |
+
} );
|
1157 |
+
|
1158 |
+
gmedia_DOM.on( 'click', 'a.gmedit-modal', function( e ) {
|
1159 |
+
e.preventDefault();
|
1160 |
+
var modal_div = jQuery( jQuery( this ).data( 'bsTarget' ) );
|
1161 |
+
jQuery( '.modal-content', modal_div ).html(
|
1162 |
+
jQuery( '<iframe />', {
|
1163 |
+
name: 'gmeditFrame',
|
1164 |
+
id: 'gmeditFrame',
|
1165 |
+
width: '100%',
|
1166 |
+
height: '500',
|
1167 |
+
src: jQuery( this ).attr( 'href' ),
|
1168 |
+
} ).css( {display: 'block', margin: '4px 0'} ),
|
1169 |
+
);
|
1170 |
+
modal_div.modal( {
|
1171 |
+
backdrop: true,
|
1172 |
+
show: true,
|
1173 |
+
keyboard: false,
|
1174 |
+
} ).one( 'hidden.bs.modal', function() {
|
1175 |
+
jQuery( '.modal-content', this ).empty();
|
1176 |
+
} );
|
1177 |
+
} );
|
1178 |
+
|
1179 |
+
jQuery( document ).on( 'click.gmedia', 'a.preview-modal', function( e ) {
|
1180 |
+
e.preventDefault();
|
1181 |
+
var initiator = jQuery( this ),
|
1182 |
+
data = initiator.data(),
|
1183 |
+
modal_div = jQuery( data['bsTarget'] ),
|
1184 |
+
modal_dialog = jQuery( '.modal-dialog', modal_div ),
|
1185 |
+
modal_body = jQuery( '.modal-body', modal_div ),
|
1186 |
+
modal_title = jQuery( '.modal-title', modal_div ),
|
1187 |
+
title = jQuery( this ).attr( 'data-title' ) ? jQuery( this ).
|
1188 |
+
attr( 'data-title' ) : jQuery( this ).attr( 'title' );
|
1189 |
+
|
1190 |
+
modal_title.text( _.escape( title ) );
|
1191 |
+
|
1192 |
+
if ( data['metainfo'] ) {
|
1193 |
+
modal_dialog.addClass( 'modal-md' );
|
1194 |
+
modal_body.html( jQuery( '#metainfo_' + data['metainfo'] ).html() );
|
1195 |
+
}
|
1196 |
+
else {
|
1197 |
+
var r = data['width'] / data['height'],
|
1198 |
+
w = Math.min( jQuery( window ).width() * 0.98 - 32, data['width'] ),
|
1199 |
+
h = w / r;
|
1200 |
+
modal_dialog.css( {'width': (data['width'] + 32), 'max-width': '98%'} );
|
1201 |
+
if ( data['cls'] ) {
|
1202 |
+
modal_dialog.addClass( data['cls'] );
|
1203 |
+
}
|
1204 |
+
modal_body.html(
|
1205 |
+
jQuery( '<iframe />', {
|
1206 |
+
name: 'previewFrame',
|
1207 |
+
id: 'previewFrame',
|
1208 |
+
width: '100%',
|
1209 |
+
height: h,
|
1210 |
+
src: jQuery( this ).attr( 'href' ),
|
1211 |
+
} ).on( 'load', function() {
|
1212 |
+
jQuery( this.contentWindow.document.body ).css( 'margin', 0 );
|
1213 |
+
jQuery( '.modal-backdrop', modal_div ).
|
1214 |
+
css( {'width': (data['width'] + 32), 'min-width': '100%'} );
|
1215 |
+
} ).css( {display: 'block', margin: '4px 0'} ),
|
1216 |
+
);
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
initiator.addClass( 'previewModal_initiator' );
|
1220 |
+
modal_div.modal( {
|
1221 |
+
backdrop: true,
|
1222 |
+
show: true,
|
1223 |
+
} ).one( 'hidden.bs.modal', function() {
|
1224 |
+
if ( jQuery( 'div.gmedia-modal:visible' ).length ) {
|
1225 |
+
jQuery( 'body' ).addClass( 'modal-open' );
|
1226 |
+
}
|
1227 |
+
modal_title.empty();
|
1228 |
+
modal_body.empty();
|
1229 |
+
modal_dialog.removeAttr( 'style' ).attr( 'class', 'modal-dialog' );
|
1230 |
+
if ( modal_div.attr( 'data-refresh' ) ) {
|
1231 |
+
modal_div.removeAttr( 'data-refresh' );
|
1232 |
+
jQuery( '.card-header .spinner' ).addClass( 'is-active' );
|
1233 |
+
var url = window.location.href;
|
1234 |
+
jQuery.get( url, function( data ) {
|
1235 |
+
jQuery( '#gmedia-panel' ).
|
1236 |
+
html( jQuery( '#gmedia-panel', data ).html() );
|
1237 |
+
GmediaInit();
|
1238 |
+
jQuery( '.card-header .spinner' ).removeClass( 'is-active' );
|
1239 |
+
} );
|
1240 |
+
}
|
1241 |
+
initiator.removeClass( 'previewModal_initiator' );
|
1242 |
+
} );
|
1243 |
+
} );
|
1244 |
+
|
1245 |
+
jQuery( document ).
|
1246 |
+
on( 'click.gmedia', '#previewModal .select_gmedia_image .btn-primary',
|
1247 |
+
function() {
|
1248 |
+
var img,
|
1249 |
+
form = jQuery( '.previewModal_initiator' ).closest( 'form' );
|
1250 |
+
form.find( '.gmedia-cover-id' ).
|
1251 |
+
val( window.gmediaTempData.id ).
|
1252 |
+
trigger( 'change' );
|
1253 |
+
img = form.find( '.gmedia-cover-image img:first-child' );
|
1254 |
+
if ( img.length ) {
|
1255 |
+
img.attr( 'src', window.gmediaTempData.src );
|
1256 |
+
}
|
1257 |
+
else {
|
1258 |
+
jQuery( '<img src="" alt="" />' ).
|
1259 |
+
attr( 'src', window.gmediaTempData.src ).
|
1260 |
+
appendTo( form.find( '.gmedia-cover-image' ) );
|
1261 |
+
}
|
1262 |
+
jQuery( '#previewModal' ).modal( 'hide' );
|
1263 |
+
} );
|
1264 |
+
|
1265 |
+
jQuery( document ).
|
1266 |
+
on( 'click.gmedia', '#previewModal .select_gmedia_related .btn-primary',
|
1267 |
+
function() {
|
1268 |
+
var relatedDiv = jQuery( '.previewModal_initiator' ).
|
1269 |
+
closest( '.form-group' ).
|
1270 |
+
find( '.related-media-previews' );
|
1271 |
+
var fields = relatedDiv.find( 'input' );
|
1272 |
+
var valData = [],
|
1273 |
+
getData = [];
|
1274 |
+
if ( fields ) {
|
1275 |
+
fields.each( function() {
|
1276 |
+
valData.push( jQuery( this ).val() );
|
1277 |
+
} );
|
1278 |
+
}
|
1279 |
+
var storage = getStorage(),
|
1280 |
+
storedData = storage.get( 'gmedia_library:frame' ).
|
1281 |
+
split( '.' );
|
1282 |
+
jQuery.each( storedData, function( i, id ) {
|
1283 |
+
if ( ! id ) {
|
1284 |
+
return true;
|
1285 |
+
}
|
1286 |
+
if ( jQuery.inArray( id, valData ) === -1 ) {
|
1287 |
+
getData.push( id );
|
1288 |
+
}
|
1289 |
+
} );
|
1290 |
+
if ( getData.length ) {
|
1291 |
+
jQuery.get( ajaxurl,
|
1292 |
+
{action: 'gmedia_get_data', gmedia__in: getData},
|
1293 |
+
function( data, textStatus, jqXHR ) {
|
1294 |
+
if ( jQuery.isArray( data ) && data.length ) {
|
1295 |
+
var thumbHTML;
|
1296 |
+
jQuery.each( data, function( i, item ) {
|
1297 |
+
thumbHTML = '<p class="img-thumbnail gmedia-related-image">' +
|
1298 |
+
'<span class="image-wrapper"><img class="gmedia-thumb" src="" alt=""></span>' +
|
1299 |
+
'<span class="gm-remove">×</span>' +
|
1300 |
+
'<input type="hidden" name="meta[_related][]" value="">' +
|
1301 |
+
'</p>';
|
1302 |
+
jQuery( thumbHTML ).
|
1303 |
+
find( 'img' ).
|
1304 |
+
attr( 'src', item.url_thumb ).
|
1305 |
+
end().
|
1306 |
+
find( 'input' ).
|
1307 |
+
val( item.ID ).
|
1308 |
+
end().
|
1309 |
+
appendTo( relatedDiv );
|
1310 |
+
} );
|
1311 |
+
relatedDiv.sortable( 'refresh' );
|
1312 |
+
relatedDiv.closest( 'form' ).
|
1313 |
+
find( 'input[name="title"]' ).
|
1314 |
+
trigger( 'change' );
|
1315 |
+
}
|
1316 |
+
} );
|
1317 |
+
}
|
1318 |
+
storage.set( 'gmedia_library:frame', '' );
|
1319 |
+
jQuery( '#previewModal' ).modal( 'hide' );
|
1320 |
+
} );
|
1321 |
+
|
1322 |
+
jQuery( document ).
|
1323 |
+
on( 'click.gmedia', '.related-media-previews .gm-remove', function() {
|
1324 |
+
var inpTitle = jQuery( this ).
|
1325 |
+
closest( 'form' ).
|
1326 |
+
find( 'input[name="title"]' );
|
1327 |
+
jQuery( this ).closest( '.gmedia-related-image' ).remove();
|
1328 |
+
inpTitle.trigger( 'change' );
|
1329 |
+
} );
|
1330 |
+
|
1331 |
+
jQuery( document ).
|
1332 |
+
on( 'click.gmedia',
|
1333 |
+
'#previewModal .select_gmedia:not(.assign_gmedia_term) .btn-primary',
|
1334 |
+
function() {
|
1335 |
+
var field = jQuery( '.previewModal_initiator' ).
|
1336 |
+
closest( '.form-group' ).
|
1337 |
+
find( '.form-control' );
|
1338 |
+
var valData = field.val().split( ',' );
|
1339 |
+
var storedData = getStorage();
|
1340 |
+
storedData = storedData.get( 'gmedia_library:frame' ).
|
1341 |
+
split( '.' );
|
1342 |
+
valData = jQuery.grep( valData, function( e ) {
|
1343 |
+
return e.trim();
|
1344 |
+
} );
|
1345 |
+
jQuery.each( storedData, function( i, id ) {
|
1346 |
+
if ( ! id ) {
|
1347 |
+
return true;
|
1348 |
+
}
|
1349 |
+
if ( jQuery.inArray( id, valData ) === -1 ) {
|
1350 |
+
valData.push( id );
|
1351 |
+
}
|
1352 |
+
} );
|
1353 |
+
field.val( valData.join( ',' ) );
|
1354 |
+
jQuery( '#previewModal' ).modal( 'hide' );
|
1355 |
+
jQuery( '#buildQuery' ).modal( 'show' );
|
1356 |
+
} );
|
1357 |
+
|
1358 |
+
jQuery( document ).
|
1359 |
+
on( 'click.gmedia',
|
1360 |
+
'#previewModal .select_gmedia:not(.assign_gmedia_term) .btn-secondary',
|
1361 |
+
function() {
|
1362 |
+
jQuery( '#buildQuery' ).modal( 'show' );
|
1363 |
+
} );
|
1364 |
+
|
1365 |
+
jQuery( document ).
|
1366 |
+
on( 'click.gmedia', '#previewModal .assign_gmedia_term .btn-primary',
|
1367 |
+
function() {
|
1368 |
+
jQuery( '.card-header .spinner' ).addClass( 'is-active' );
|
1369 |
+
var url = window.location.href,
|
1370 |
+
post_data = jQuery( '#gmedia-assign-term' ).serialize();
|
1371 |
+
jQuery.post( url, post_data, function( data ) {
|
1372 |
+
jQuery( '.gmedia_term__in' ).
|
1373 |
+
html( jQuery( '.gmedia_term__in', data ).html() );
|
1374 |
+
GmediaInit();
|
1375 |
+
jQuery( '.card-header .spinner' ).removeClass( 'is-active' );
|
1376 |
+
} );
|
1377 |
+
jQuery( '#previewModal' ).modal( 'hide' );
|
1378 |
+
} );
|
1379 |
+
|
1380 |
+
jQuery( document ).
|
1381 |
+
on( 'click.gmedia focus.gmedia', 'input.sharelink', function() {
|
1382 |
+
this.setSelectionRange( 0, this.value.length );
|
1383 |
+
} );
|
1384 |
+
jQuery( document ).on( 'keyup.gmedia', 'input.sharetoemail', function() {
|
1385 |
+
jQuery( '.sharebutton' ).
|
1386 |
+
prop( 'disabled', ! validateEmail( this.value ) );
|
1387 |
+
} );
|
1388 |
+
jQuery( document ).on( 'click.gmedia', '.sharebutton', function() {
|
1389 |
+
var sharetoemail = jQuery( 'input.sharetoemail' );
|
1390 |
+
if ( ! validateEmail( sharetoemail.val() ) ) {
|
1391 |
+
sharetoemail.focus();
|
1392 |
+
sharetoemail.parent().addClass( 'has-error' );
|
1393 |
+
return false;
|
1394 |
+
}
|
1395 |
+
var post_data = jQuery( '#shareForm' ).serialize();
|
1396 |
+
jQuery.post( ajaxurl, post_data, function( data, textStatus, jqXHR ) {
|
1397 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1398 |
+
if ( data ) {
|
1399 |
+
jQuery( '#gm-message' ).append( data );
|
1400 |
+
}
|
1401 |
+
} );
|
1402 |
+
jQuery( '#shareModal' ).modal( 'hide' );
|
1403 |
+
} );
|
1404 |
+
gmedia_DOM.on( 'click', 'a.share-modal', function( e ) {
|
1405 |
+
e.preventDefault();
|
1406 |
+
var data = jQuery( this ).data(),
|
1407 |
+
modal_div = jQuery( data['bsTarget'] ),
|
1408 |
+
postlink = jQuery( this ).attr( 'href' ),
|
1409 |
+
cloudlink = jQuery( this ).attr( 'data-gmediacloud' ),
|
1410 |
+
sharetoemail = jQuery( 'input.sharetoemail' ),
|
1411 |
+
cloudlink_checked = false;
|
1412 |
+
|
1413 |
+
if ( postlink ) {
|
1414 |
+
jQuery( '.sharelink_post', modal_div ).show();
|
1415 |
+
jQuery( '.sharelink_post input[type="text"]', modal_div ).
|
1416 |
+
val( postlink );
|
1417 |
+
jQuery( '.sharelink_post a', modal_div ).attr( 'href', postlink );
|
1418 |
+
}
|
1419 |
+
else {
|
1420 |
+
jQuery( '.sharelink_post', modal_div ).hide();
|
1421 |
+
jQuery( '.sharelink_post input[type="radio"]', modal_div ).
|
1422 |
+
prop( 'checked', false );
|
1423 |
+
cloudlink_checked = true;
|
1424 |
+
}
|
1425 |
+
if ( cloudlink ) {
|
1426 |
+
jQuery( '.sharelink_page', modal_div ).show();
|
1427 |
+
jQuery( '.sharelink_page input[type="text"]', modal_div ).
|
1428 |
+
val( cloudlink );
|
1429 |
+
jQuery( '.sharelink_page a', modal_div ).attr( 'href', cloudlink );
|
1430 |
+
if ( cloudlink_checked ) {
|
1431 |
+
jQuery( '.sharelink_page input[type="radio"]', modal_div ).
|
1432 |
+
prop( 'checked', true );
|
1433 |
+
}
|
1434 |
+
}
|
1435 |
+
else {
|
1436 |
+
jQuery( '.sharelink_page', modal_div ).hide();
|
1437 |
+
}
|
1438 |
+
jQuery( '.sharebutton' ).
|
1439 |
+
prop( 'disabled', ! validateEmail( sharetoemail.val() ) );
|
1440 |
+
|
1441 |
+
modal_div.modal( {
|
1442 |
+
backdrop: true,
|
1443 |
+
show: true,
|
1444 |
+
keyboard: false,
|
1445 |
+
} ).one( 'shown.bs.modal', function() {
|
1446 |
+
jQuery( 'input.sharelink', this ).focus();
|
1447 |
+
} ).one( 'hidden.bs.modal', function() {
|
1448 |
+
jQuery( 'input.sharelink', this ).val( '' );
|
1449 |
+
} );
|
1450 |
+
} );
|
1451 |
+
|
1452 |
+
gmedia_DOM.on( 'click', '.buildquery-modal', function( e ) {
|
1453 |
+
e.preventDefault();
|
1454 |
+
var data = jQuery( this ).data(),
|
1455 |
+
modal_div = jQuery( jQuery( this ).attr( 'href' ) ),
|
1456 |
+
query_field = jQuery( jQuery( this ).attr( 'id' ) + '_field' ),
|
1457 |
+
query = query_field.val();
|
1458 |
+
|
1459 |
+
modal_div.modal( {
|
1460 |
+
backdrop: true,
|
1461 |
+
show: true,
|
1462 |
+
keyboard: false,
|
1463 |
+
} ).one( 'shown.bs.modal', function() {
|
1464 |
+
if ( query ) {
|
1465 |
+
query = gm_parse_query( query );
|
1466 |
+
}
|
1467 |
+
} ).one( 'hidden.bs.modal', function() {} );
|
1468 |
+
} );
|
1469 |
+
|
1470 |
+
jQuery( document ).on( 'click.gmedia', '.buildquerysubmit', function() {
|
1471 |
+
var qform = jQuery( '#buildQuery :input' ).filter( function() {
|
1472 |
+
return !! jQuery( this ).val();
|
1473 |
+
} );
|
1474 |
+
|
1475 |
+
qform = decodeURIComponent( qform.serialize() );
|
1476 |
+
jQuery( '#build_query_field' ).val( qform );
|
1477 |
+
jQuery( '#buildQuery' ).modal( 'hide' );
|
1478 |
+
} );
|
1479 |
+
gmedia_DOM.on( 'click', 'a.newcustomfield-modal', function( e ) {
|
1480 |
+
e.preventDefault();
|
1481 |
+
var data = jQuery( this ).data(),
|
1482 |
+
modal_div = jQuery( jQuery( this ).attr( 'href' ) );
|
1483 |
+
|
1484 |
+
modal_div.modal( {
|
1485 |
+
backdrop: false,
|
1486 |
+
show: true,
|
1487 |
+
keyboard: false,
|
1488 |
+
} ).one( 'shown.bs.modal', function() {
|
1489 |
+
jQuery( 'input.newcustomfield-for-id', this ).val( data['gmid'] );
|
1490 |
+
} ).one( 'hidden.bs.modal', function() {
|
1491 |
+
jQuery( ':input.form-control, input.newcustomfield-for-id', this ).
|
1492 |
+
val( '' );
|
1493 |
+
if ( jQuery( '.newcfield', this ).length ) {
|
1494 |
+
jQuery( 'a.gmediacustomstuff' ).click();
|
1495 |
+
}
|
1496 |
+
} );
|
1497 |
+
} );
|
1498 |
+
jQuery( document ).on( 'click.gmedia', '.customfieldsubmit', function() {
|
1499 |
+
var cform = jQuery( '#newCustomFieldForm' );
|
1500 |
+
if ( ! jQuery( '.newcustomfield-for-id', cform ).val() ) {
|
1501 |
+
jQuery( '#newCustomFieldModal' ).modal( 'hide' );
|
1502 |
+
alert( 'No ID' );
|
1503 |
+
return false;
|
1504 |
+
}
|
1505 |
+
var post_data = cform.serialize();
|
1506 |
+
jQuery.post( ajaxurl, post_data, function( data, textStatus, jqXHR ) {
|
1507 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1508 |
+
if ( data.success ) {
|
1509 |
+
jQuery( '#newCustomFieldModal' ).
|
1510 |
+
modal( 'hide' ).
|
1511 |
+
one( 'hidden.bs.modal', function() {
|
1512 |
+
//noinspection JSUnresolvedVariable
|
1513 |
+
if ( data.newmeta_form ) {
|
1514 |
+
//noinspection JSUnresolvedVariable
|
1515 |
+
jQuery( '#newmeta' ).replaceWith( data.newmeta_form );
|
1516 |
+
}
|
1517 |
+
} );
|
1518 |
+
jQuery( '.row:last', '#gmediacustomstuff_' + data.id ).
|
1519 |
+
append( data.success.data );
|
1520 |
+
}
|
1521 |
+
else {
|
1522 |
+
if ( data.error ) {
|
1523 |
+
if ( '100' === data.error.code ) {
|
1524 |
+
jQuery( '#newCustomFieldModal' ).modal( 'hide' );
|
1525 |
+
}
|
1526 |
+
alert( data.error.message );
|
1527 |
+
}
|
1528 |
+
else {
|
1529 |
+
console.log( data );
|
1530 |
+
}
|
1531 |
+
}
|
1532 |
+
} );
|
1533 |
+
} );
|
1534 |
+
gmedia_DOM.on( 'click', '.delete-custom-field', function() {
|
1535 |
+
var t = jQuery( this ).closest( '.form-group' ),
|
1536 |
+
post_data = convertInputsToJSON( jQuery( ':input', t ) );
|
1537 |
+
if ( ! post_data ) {
|
1538 |
+
return false;
|
1539 |
+
}
|
1540 |
+
var meta_type = jQuery( this ).
|
1541 |
+
closest( 'fieldset' ).
|
1542 |
+
attr( 'data-metatype' );
|
1543 |
+
post_data.action = meta_type + '_delete_custom_field';
|
1544 |
+
post_data.ID = jQuery( this ).closest( 'form' ).attr( 'data-id' );
|
1545 |
+
post_data._wpnonce_custom_field = jQuery( '#_wpnonce_custom_field' ).
|
1546 |
+
val();
|
1547 |
+
jQuery.post( ajaxurl, post_data, function( data, textStatus, jqXHR ) {
|
1548 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1549 |
+
//noinspection JSUnresolvedVariable
|
1550 |
+
if ( data.deleted ) {
|
1551 |
+
//noinspection JSUnresolvedVariable
|
1552 |
+
jQuery.each( data.deleted, function( i, val ) {
|
1553 |
+
jQuery( '.gm-custom-meta-' + val ).remove();
|
1554 |
+
} );
|
1555 |
+
}
|
1556 |
+
else {
|
1557 |
+
if ( data.error ) {
|
1558 |
+
alert( data.error.message );
|
1559 |
+
}
|
1560 |
+
else {
|
1561 |
+
console.log( data );
|
1562 |
+
}
|
1563 |
+
}
|
1564 |
+
} );
|
1565 |
+
} );
|
1566 |
+
|
1567 |
+
gmedia_DOM.on( 'change modified',
|
1568 |
+
'form.edit-gmedia :input:not([name="doaction[]"])', function() {
|
1569 |
+
if ( jQuery( this ).hasClass( 'edit-gmedia-ignore' ) ) {
|
1570 |
+
return;
|
1571 |
+
}
|
1572 |
+
jQuery( 'body' ).addClass( 'gmedia-busy' );
|
1573 |
+
jQuery( '.card-header .spinner' ).addClass( 'is-active' );
|
1574 |
+
var post_data = {
|
1575 |
+
action: 'gmedia_update_data',
|
1576 |
+
data: jQuery( this ).closest( 'form' ).serialize(),
|
1577 |
+
_wpnonce: jQuery( '#_wpnonce' ).val(),
|
1578 |
+
};
|
1579 |
+
jQuery.post( ajaxurl, post_data, function( data, textStatus, jqXHR ) {
|
1580 |
+
var item = jQuery( '#list-item-' + data.ID );
|
1581 |
+
item.find( '.modified' ).text( data.modified );
|
1582 |
+
//noinspection JSUnresolvedVariable
|
1583 |
+
item.find( '.status-album' ).
|
1584 |
+
attr( 'class',
|
1585 |
+
'form-group status-album bg-status-' + data.album_status );
|
1586 |
+
item.find( '.status-item' ).
|
1587 |
+
attr( 'class',
|
1588 |
+
'form-group status-item bg-status-' + data.status );
|
1589 |
+
if ( data.thumbnail ) {
|
1590 |
+
item.find( '.gmedia-cover-image' ).html( data.thumbnail );
|
1591 |
+
}
|
1592 |
+
//if(data.tags) {
|
1593 |
+
// item.find('.gmedia_tags_input').val(data.tags);
|
1594 |
+
//}
|
1595 |
+
//noinspection JSUnresolvedVariable
|
1596 |
+
if ( data.meta_error ) {
|
1597 |
+
jQuery.each( data.meta_error, function( i, err ) {
|
1598 |
+
console.log( err );
|
1599 |
+
alert( err.meta_key + ': ' + err.message );
|
1600 |
+
if ( err.meta_value ) {
|
1601 |
+
jQuery( '.gm-custom-field-' + err.meta_id ).
|
1602 |
+
val( err.meta_value );
|
1603 |
+
}
|
1604 |
+
} );
|
1605 |
+
}
|
1606 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1607 |
+
jQuery( '.card-header .spinner' ).removeClass( 'is-active' );
|
1608 |
+
} );
|
1609 |
+
} );
|
1610 |
+
|
1611 |
+
gmedia_DOM.on( 'click', '.gm-toggle-cb', function( e ) {
|
1612 |
+
var checkBoxes = jQuery( this ).attr( 'href' );
|
1613 |
+
jQuery( checkBoxes + ' :checkbox' ).each( function() {
|
1614 |
+
jQuery( this ).prop( 'checked', ! jQuery( this ).prop( 'checked' ) );
|
1615 |
+
} );
|
1616 |
+
e.preventDefault();
|
1617 |
+
} );
|
1618 |
+
jQuery( document ).
|
1619 |
+
on( 'click.gmedia', '.linkblock [data-href]', function() {
|
1620 |
+
window.location.href = jQuery( this ).data( 'href' );
|
1621 |
+
} );
|
1622 |
+
|
1623 |
+
gmedia_DOM.on( 'click', '.gmedia-import', function() {
|
1624 |
+
jQuery( '#import-action' ).val( jQuery( this ).attr( 'name' ) );
|
1625 |
+
jQuery( '#importModal' ).modal( {
|
1626 |
+
backdrop: 'static',
|
1627 |
+
show: true,
|
1628 |
+
keyboard: false,
|
1629 |
+
} ).one( 'shown.bs.modal', function() {
|
1630 |
+
jQuery( '#import_form' ).submit();
|
1631 |
+
} ).one( 'hidden.bs.modal', function() {
|
1632 |
+
var btn = jQuery( '#import-done' );
|
1633 |
+
btn.text( btn.data( 'reset-text' ) ).prop( 'disabled', true );
|
1634 |
+
jQuery( '#import_window' ).attr( 'src', 'about:blank' );
|
1635 |
+
} );
|
1636 |
+
} );
|
1637 |
+
|
1638 |
+
gmedia_DOM.on( 'click', '.module_install', function( e ) {
|
1639 |
+
e.preventDefault();
|
1640 |
+
jQuery( 'body' ).addClass( 'gmedia-busy' );
|
1641 |
+
var module = jQuery( this ).data( 'module' );
|
1642 |
+
var btn = jQuery( '.module_install' ).
|
1643 |
+
filter( '[data-module="' + module + '"]' );
|
1644 |
+
btn.text( btn.data( 'loading-text' ) );
|
1645 |
+
var post_data = {
|
1646 |
+
action: 'gmedia_module_install',
|
1647 |
+
download: jQuery( this ).attr( 'href' ),
|
1648 |
+
module: module,
|
1649 |
+
_wpnonce: jQuery( '#_wpnonce' ).val(),
|
1650 |
+
};
|
1651 |
+
var pathname = window.location.href + '&time=' + jQuery.now();
|
1652 |
+
jQuery.post( ajaxurl, post_data, function( data, status, xhr ) {
|
1653 |
+
setTimeout( function() {
|
1654 |
+
jQuery( '#gmedia_modules' ).
|
1655 |
+
load( pathname + ' #gmedia_modules_wrapper', function() {
|
1656 |
+
setTimeout( function() {
|
1657 |
+
var update_count = jQuery( '#gmedia_modules' ).
|
1658 |
+
find( '#gmedia_modules_wrapper' ).
|
1659 |
+
attr( 'data-update' );
|
1660 |
+
if ( parseInt( update_count ) ) {
|
1661 |
+
jQuery( '.gm-module-count' ).html( update_count );
|
1662 |
+
}
|
1663 |
+
else {
|
1664 |
+
jQuery( '.gm-module-count' ).remove();
|
1665 |
+
}
|
1666 |
+
}, 1 );
|
1667 |
+
} );
|
1668 |
+
}, 1 );
|
1669 |
+
jQuery( '#gmedia_modules' ).before( data );
|
1670 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1671 |
+
} );
|
1672 |
+
} );
|
1673 |
+
|
1674 |
+
gmedia_DOM.on( 'keydown',
|
1675 |
+
'form :input:visible:not(:submit,:button,:reset,textarea,.allow-key-enter)',
|
1676 |
+
function( e ) {
|
1677 |
+
var charCode = e.charCode || e.keyCode || e.which;
|
1678 |
+
if ( 13 === charCode &&
|
1679 |
+
! jQuery( this ).parent().hasClass( 'selectize-input' ) ) {
|
1680 |
+
var inputs = jQuery( this ).
|
1681 |
+
parents( 'form' ).
|
1682 |
+
eq( 0 ).
|
1683 |
+
find( ':input:visible' );
|
1684 |
+
var inp = inputs[inputs.index( this ) + 1];
|
1685 |
+
if ( inp !== null ) {
|
1686 |
+
jQuery( inp ).focus();
|
1687 |
+
var inp_type = jQuery( inp ).attr( 'type' );
|
1688 |
+
if ( !! inp_type &&
|
1689 |
+
(inp_type === 'text' || inp_type === 'number') ) {
|
1690 |
+
inp.setSelectionRange( 0, inp.value.length );
|
1691 |
+
}
|
1692 |
+
}
|
1693 |
+
e.preventDefault();
|
1694 |
+
return false;
|
1695 |
+
}
|
1696 |
+
} );
|
1697 |
+
|
1698 |
+
var myDefaultAllowList = bootstrap.Tooltip.Default.allowList;
|
1699 |
+
var myCustomRegex = /^data-[\w-]+/;
|
1700 |
+
myDefaultAllowList['*'].push( myCustomRegex );
|
1701 |
+
myDefaultAllowList['*'].push( 'style' );
|
1702 |
+
myDefaultAllowList.button = ['type', 'name'];
|
1703 |
+
myDefaultAllowList.input = ['type', 'name', 'value', 'placeholder'];
|
1704 |
+
myDefaultAllowList.label = [];
|
1705 |
+
|
1706 |
+
var preset_popover = function() {
|
1707 |
+
return jQuery( '#module_presets' ).popover( {
|
1708 |
+
container: '#module_preset',
|
1709 |
+
content: function() {
|
1710 |
+
return jQuery( '#_module_presets' ).html();
|
1711 |
+
},
|
1712 |
+
html: true,
|
1713 |
+
placement: 'bottom',
|
1714 |
+
allowList: myDefaultAllowList,
|
1715 |
+
} ).on( 'show.bs.popover', function() {
|
1716 |
+
jQuery( this ).addClass( 'active' );
|
1717 |
+
} ).on( 'hide.bs.popover', function() {
|
1718 |
+
jQuery( this ).removeClass( 'active' );
|
1719 |
+
} );
|
1720 |
+
};
|
1721 |
+
var preset_popover_obj = preset_popover();
|
1722 |
+
gmedia_DOM.on( 'click', '#module_preset .ajax-submit', function( e ) {
|
1723 |
+
e.preventDefault();
|
1724 |
+
jQuery( 'body' ).addClass( 'gmedia-busy' );
|
1725 |
+
var form = jQuery( '#gmedia-edit-term' );
|
1726 |
+
var post_data = form.serializeArray();
|
1727 |
+
post_data.push( {name: jQuery( this ).attr( 'name' ), value: 1} );
|
1728 |
+
var pathname = window.location.href;
|
1729 |
+
jQuery.post( pathname, jQuery.param( post_data ),
|
1730 |
+
function( data, status, xhr ) {
|
1731 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1732 |
+
data = jQuery( data ).find( '#gmedia-container' );
|
1733 |
+
jQuery( '#gm-message' ).
|
1734 |
+
append( jQuery( '#gm-message', data ).html() );
|
1735 |
+
jQuery( '#save_buttons' ).
|
1736 |
+
html( jQuery( '#save_buttons', data ).html() );
|
1737 |
+
jQuery( '#save_buttons_duplicate' ).
|
1738 |
+
html( jQuery( '#save_buttons_duplicate', data ).html() );
|
1739 |
+
jQuery( '#module_preset' ).
|
1740 |
+
html( jQuery( '#module_preset', data ).html() );
|
1741 |
+
preset_popover();
|
1742 |
+
} );
|
1743 |
+
} );
|
1744 |
+
jQuery( document ).on( 'click.gmedia', function( e ) {
|
1745 |
+
if ( jQuery( e.target ).data( 'toggle' ) !== 'popover'
|
1746 |
+
&& jQuery( e.target ).parents( '.popover.in' ).length === 0 ) {
|
1747 |
+
jQuery( '[data-bs-toggle="popover"]' ).popover( 'hide' );
|
1748 |
+
}
|
1749 |
+
} );
|
1750 |
+
|
1751 |
+
gmedia_DOM.on( 'click', '[data-clicktarget]', function( e ) {
|
1752 |
+
e.preventDefault();
|
1753 |
+
var id = jQuery( this ).attr( 'data-clicktarget' );
|
1754 |
+
jQuery( '#' + id ).click();
|
1755 |
+
} );
|
1756 |
+
|
1757 |
+
gmedia_DOM.on( 'click',
|
1758 |
+
'#module_preset .delpreset span, .module_presets .delpreset span',
|
1759 |
+
function() {
|
1760 |
+
jQuery( 'body' ).addClass( 'gmedia-busy' );
|
1761 |
+
var module_preset = this;
|
1762 |
+
var preset_item_li = jQuery( this ).closest( 'li' );
|
1763 |
+
var preset_id = jQuery( this ).data( 'id' );
|
1764 |
+
var post_data = {
|
1765 |
+
action: 'gmedia_module_preset_delete',
|
1766 |
+
preset_id: preset_id,
|
1767 |
+
_wpnonce: jQuery( '#_wpnonce' ).val(),
|
1768 |
+
};
|
1769 |
+
jQuery.post( ajaxurl, post_data, function( data, status, xhr ) {
|
1770 |
+
if ( data.error ) {
|
1771 |
+
jQuery( '#gm-message' ).append( data.error );
|
1772 |
+
}
|
1773 |
+
else {
|
1774 |
+
preset_item_li.remove();
|
1775 |
+
if ( 'module_presets_list' !== jQuery( this ).attr( 'id' ) ) {
|
1776 |
+
var _module_presets = jQuery( '#module_preset' ).
|
1777 |
+
find( '.popover-content' ).
|
1778 |
+
html();
|
1779 |
+
jQuery( '#_module_presets' ).
|
1780 |
+
replaceWith(
|
1781 |
+
'<script type="text/html" id="_module_presets">' +
|
1782 |
+
_module_presets + '</script>' );
|
1783 |
+
}
|
1784 |
+
}
|
1785 |
+
jQuery( 'body' ).removeClass( 'gmedia-busy' );
|
1786 |
+
} );
|
1787 |
+
} );
|
1788 |
+
|
1789 |
+
gmedia_DOM.on( 'click', '.filter-modules > *', function() {
|
1790 |
+
jQuery( '.filter-modules > .btn-primary' ).
|
1791 |
+
removeClass( 'btn-primary' ).
|
1792 |
+
addClass( 'btn-secondary' );
|
1793 |
+
jQuery( '.filter-modules > .bg-dark' ).
|
1794 |
+
removeClass( 'bg-dark' ).
|
1795 |
+
addClass( 'bg-secondary' );
|
1796 |
+
if ( jQuery( this ).is( 'button' ) ) {
|
1797 |
+
jQuery( this ).addClass( 'btn-primary' ).removeClass( 'btn-secondary' );
|
1798 |
+
}
|
1799 |
+
else {
|
1800 |
+
jQuery( this ).addClass( 'bg-dark' ).removeClass( 'bg-secondary' );
|
1801 |
+
}
|
1802 |
+
var filter = jQuery( this ).attr( 'data-filter' );
|
1803 |
+
jQuery( '#gmedia_modules .media' ).
|
1804 |
+
removeClass( 'module-filtered' ).
|
1805 |
+
filter( '.module-' + filter ).
|
1806 |
+
addClass( 'module-filtered' );
|
1807 |
+
if ( ! jQuery( '#gmedia_modules .module-filtered' ).length ) {
|
1808 |
+
if ( 'not-installed' === filter ) {
|
1809 |
+
jQuery( '#gmedia_modules .nomodules.nomodule-' + filter ).
|
1810 |
+
addClass( 'module-filtered' );
|
1811 |
+
}
|
1812 |
+
else {
|
1813 |
+
jQuery( '#gmedia_modules .nomodules.nomodule-tag' ).
|
1814 |
+
addClass( 'module-filtered' );
|
1815 |
+
}
|
1816 |
+
}
|
1817 |
+
} );
|
1818 |
+
|
1819 |
+
if ( jQuery( '.panel-fixed-header' ).length ) {
|
1820 |
+
setPanelHeadersWidth();
|
1821 |
+
setTimeout( function() {
|
1822 |
+
setPanelHeadersWidth();
|
1823 |
+
}, 800 );
|
1824 |
+
jQuery( window ).on( 'resize.gmedia', function() {
|
1825 |
+
setPanelHeadersWidth();
|
1826 |
+
} );
|
1827 |
+
jQuery( document ).on( 'click.gmedia', '#collapse-menu', function() {
|
1828 |
+
setTimeout( function() {
|
1829 |
+
setPanelHeadersWidth();
|
1830 |
+
}, 10 );
|
1831 |
+
} );
|
1832 |
+
|
1833 |
+
jQuery( window ).on( 'scroll.gmedia', function() {
|
1834 |
+
UpdatePanelHeaders();
|
1835 |
+
/*clearTimeout(jQuery.data(this, 'scrollTimer'));
|
1836 |
jQuery.data(this, 'scrollTimer', setTimeout(function() {
|
1837 |
UpdatePanelHeaders();
|
1838 |
}, 250));*/
|
1839 |
+
} ).trigger( 'scroll.gmedia' );
|
1840 |
+
}
|
1841 |
|
1842 |
+
},
|
1843 |
};
|
1844 |
|
1845 |
+
window.closeModal = function( id ) {
|
1846 |
+
jQuery( '#' + id ).modal( 'hide' );
|
1847 |
};
|
1848 |
|
1849 |
/*
|
1850 |
* jQuery functions for GRAND Media
|
1851 |
*/
|
1852 |
function GmediaInit() {
|
1853 |
+
gmedia_DOM = jQuery( '#gmedia-container' );
|
1854 |
+
gmedia_DOM.off();
|
1855 |
+
jQuery( window ).off( '.gmedia' );
|
1856 |
+
jQuery( document ).off( '.gmedia' );
|
1857 |
+
|
1858 |
+
GmediaSelect.init();
|
1859 |
+
GmediaFunction.init();
|
1860 |
+
|
1861 |
+
if ( jQuery( 'body' ).hasClass( 'GrandMedia' ) ) {
|
1862 |
+
GmediaLibrary.init();
|
1863 |
+
}
|
1864 |
+
if ( jQuery( 'body' ).hasClass( 'GrandMedia_AddMedia' ) ) {
|
1865 |
+
GmediaAddMedia.init();
|
1866 |
+
}
|
1867 |
+
if ( jQuery( 'body' ).
|
1868 |
+
is( '.GrandMedia_Tags,.GrandMedia_Categories,.GrandMedia_Albums,.GrandMedia_Galleries' ) ) {
|
1869 |
+
GmediaTerms.init();
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
var helper, helper_width, title;
|
1873 |
+
jQuery( '[title]', gmedia_DOM ).each( function() {
|
1874 |
+
title = jQuery( this ).attr( 'title' );
|
1875 |
+
if ( title ) {
|
1876 |
+
jQuery( this ).attr( 'title', '' ).attr( 'data-title', title );
|
1877 |
+
}
|
1878 |
+
} );
|
1879 |
+
gmedia_DOM.on( 'mouseenter', '[title]', function( e ) {
|
1880 |
+
title = jQuery( this ).attr( 'data-title' );
|
1881 |
+
if ( title ) {
|
1882 |
+
helper = jQuery( '<div id="gmedia-data-helper"></div>' ).
|
1883 |
+
html( _.escape( title ) ).
|
1884 |
+
appendTo( 'body' );
|
1885 |
+
helper_width = 0;
|
1886 |
+
if ( e.pageX > (window.innerWidth / 2) ) {
|
1887 |
+
helper_width = helper.width() - 25;
|
1888 |
+
helper.addClass( 'tiptoleft' );
|
1889 |
+
}
|
1890 |
+
helper.css( {left: e.clientX - helper_width - 25, top: e.clientY + 25} );
|
1891 |
+
}
|
1892 |
+
else {
|
1893 |
+
jQuery( this ).removeAttr( 'title' );
|
1894 |
+
}
|
1895 |
+
} ).on( 'mousemove', '[title]', function( e ) {
|
1896 |
+
if ( helper ) {
|
1897 |
+
helper.css( {left: e.clientX - helper_width - 25, top: e.clientY + 25} );
|
1898 |
+
}
|
1899 |
+
} ).on( 'mouseleave', '[title]', function( e ) {
|
1900 |
+
jQuery( '#gmedia-data-helper' ).remove();
|
1901 |
+
helper = null;
|
1902 |
+
} );
|
1903 |
}
|
1904 |
|
1905 |
+
jQuery( function() {
|
1906 |
+
GmediaInit();
|
1907 |
+
} );
|
1908 |
|
1909 |
+
function convertInputsToJSON( form ) {
|
1910 |
+
var array = jQuery( form ).serializeArray();
|
1911 |
+
var json = {};
|
1912 |
|
1913 |
+
jQuery.each( array, function() {
|
1914 |
+
json[this.name] = this.value || '';
|
1915 |
+
} );
|
1916 |
|
1917 |
+
return json;
|
1918 |
}
|
1919 |
|
1920 |
+
function gm_parse_query( s ) {
|
1921 |
+
var j = {},
|
1922 |
+
res = s.split( /&/gm ).map( function( e ) {
|
1923 |
+
var o = e.split( /=/ ),
|
1924 |
+
pt = j;
|
1925 |
+
if ( typeof o[1] === 'undefined' ) {
|
1926 |
+
o[1] = '';
|
1927 |
+
}
|
1928 |
+
o[0].replace( /^(\w+)\[([^&]*)\]/, '$1][$2' ).
|
1929 |
+
split( /\]\[/ ).
|
1930 |
+
map( function( e, i, a ) {
|
1931 |
+
if ( e === '' ) {
|
1932 |
+
e = Object.keys( pt ).length;
|
1933 |
+
}
|
1934 |
+
pt = (pt[e] = pt[e] || (i === a.length - 1 ? decodeURIComponent(
|
1935 |
+
o[1].replace( /\+/, ' ' ) ) : {}));
|
1936 |
+
} );
|
1937 |
+
} );
|
1938 |
+
return j;
|
1939 |
}
|
1940 |
|
1941 |
+
function validateEmail( email ) {
|
1942 |
+
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
1943 |
+
return re.test( email );
|
1944 |
}
|
1945 |
|
1946 |
function getStorage() {
|
1947 |
+
// use document.cookie:
|
1948 |
+
return {
|
1949 |
+
set: function( id, data ) {
|
1950 |
+
document.cookie = id + '=' + encodeURIComponent( data );
|
1951 |
+
},
|
1952 |
+
get: function( id ) {
|
1953 |
+
var cookies = document.cookie, parsed = {};
|
1954 |
+
cookies.replace( /([^=]+)=([^;]*);?\s*/g, function( whole, key, value ) {
|
1955 |
+
parsed[key] = decodeURIComponent( value );
|
1956 |
+
} );
|
1957 |
+
return parsed[id];
|
1958 |
+
},
|
1959 |
+
};
|
1960 |
}
|
1961 |
|
1962 |
+
function getDocHeight( id ) {
|
1963 |
+
var H;
|
1964 |
+
if ( id ) {
|
1965 |
+
H = Math.max(
|
1966 |
+
jQuery( '#' + id ).height(),
|
1967 |
+
document.getElementById( id ).clientHeight,
|
1968 |
+
);
|
1969 |
+
}
|
1970 |
+
else {
|
1971 |
+
H = Math.max(
|
1972 |
+
jQuery( document ).height(),
|
1973 |
+
jQuery( window ).height(),
|
1974 |
+
document.documentElement.clientHeight,
|
1975 |
+
);
|
1976 |
+
}
|
1977 |
+
|
1978 |
+
return H;
|
1979 |
}
|
1980 |
|
1981 |
// function gmHashCode(str) {
|
1982 |
// var l = str.length,
|
1983 |
// hash = 5381 * l * (str.charCodeAt(0) + l);
|
1984 |
// for (var i = 0; i < str.length; i++) {
|
1985 |
+
// hash += Math.floor((str.charCodeAt(i) + i + 0.33) / (str.charCodeAt(l -
|
1986 |
+
// i - 1) + l) + (str.charCodeAt(i) + l) * (str.charCodeAt(l - i - 1) + i +
|
1987 |
+
// 0.33)); } return hash; } function gmCreateKey(site, lic, uuid) { if (!lic)
|
1988 |
+
// { lic = '0:lk'; } if (!uuid) { uuid = 'xyxx-xxyx-xxxy'; } var d =
|
1989 |
+
// gmHashCode((site + ':' + lic).toLowerCase()); var p = d; uuid =
|
1990 |
+
// uuid.replace(/[xy]/g, function(c) { var r = d % 16 | 0, v = c === 'x' ? r :
|
1991 |
+
// (r & 0x7 | 0x8); d = Math.floor(d * 15 / 16); return v.toString(16); }); var
|
1992 |
+
// key = p + ': ' + lic + '-' + uuid; return key.toLowerCase(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1993 |
|
1994 |
function UpdatePanelHeaders() {
|
1995 |
+
jQuery( '.panel-fixed-header' ).each( function() {
|
1996 |
+
var el = jQuery( this ),
|
1997 |
+
headerRow = jQuery( '.card-header', this ),
|
1998 |
+
offset = el.offset(),
|
1999 |
+
scrollTop = jQuery( window ).scrollTop(),
|
2000 |
+
floatingHeader = 'panel-floatingHeader',
|
2001 |
+
absoluteHeader = 'panel-absoluteHeader',
|
2002 |
+
pad_top = jQuery( '#wpadminbar' ).height();
|
2003 |
+
|
2004 |
+
if ( (scrollTop > offset.top - pad_top) &&
|
2005 |
+
(scrollTop < offset.top - pad_top +
|
2006 |
+
(el.height() - headerRow.outerHeight( false )) + 4) ) {
|
2007 |
+
el.addClass( floatingHeader ).removeClass( absoluteHeader );
|
2008 |
+
}
|
2009 |
+
else if ( scrollTop > (offset.top - pad_top +
|
2010 |
+
(el.height() - headerRow.outerHeight( false ))) ) {
|
2011 |
+
el.addClass( absoluteHeader ).removeClass( floatingHeader );
|
2012 |
+
}
|
2013 |
+
else {
|
2014 |
+
el.removeClass( absoluteHeader + ' ' + floatingHeader );
|
2015 |
+
}
|
2016 |
+
} );
|
2017 |
}
|
2018 |
|
2019 |
function setPanelHeadersWidth() {
|
2020 |
+
jQuery( '.panel-fixed-header' ).each( function() {
|
2021 |
+
var headerRow = jQuery( '.card-header', this );
|
2022 |
+
headerRow.css( 'width', jQuery( this ).innerWidth() );
|
2023 |
+
jQuery( '.card-header-fake', this ).height( headerRow.outerHeight() );
|
2024 |
+
} );
|
2025 |
}
|
admin/assets/js/gmedia.global.js
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
/**
|
2 |
* Gmedia Globals
|
|
|
3 |
* @var GmediaGallery
|
4 |
*/
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
8 |
}
|
1 |
/**
|
2 |
* Gmedia Globals
|
3 |
+
*
|
4 |
* @var GmediaGallery
|
5 |
*/
|
6 |
+
|
7 |
+
if ( ! ajaxurl ) {
|
8 |
+
//noinspection JSUnresolvedVariable.
|
9 |
+
var ajaxurl = GmediaGallery.ajaxurl;
|
10 |
}
|
admin/assets/js/gmedia.metabox.js
CHANGED
@@ -1,134 +1,135 @@
|
|
1 |
var gmActiveEditor = false;
|
2 |
-
(function($, window, document, undefined) {
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
// });
|
87 |
-
// }
|
88 |
-
// }
|
89 |
-
// });
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
110 |
|
111 |
-
})(jQuery, window, document, undefined);
|
112 |
|
113 |
-
function gmedia_post_modal(el) {
|
114 |
-
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
// function gm_check_scode(id) {
|
@@ -151,111 +152,34 @@ function gmedia_post_modal(el) {
|
|
151 |
// }
|
152 |
//
|
153 |
// function gm_send_to_editor(c) {
|
154 |
-
// var b, a = typeof (tinymce) != 'undefined', f = typeof (QTags) !=
|
155 |
-
//
|
156 |
-
//
|
157 |
-
//
|
158 |
-
//
|
159 |
-
//
|
160 |
-
//
|
161 |
-
//
|
162 |
-
//
|
163 |
-
//
|
164 |
-
//
|
165 |
-
//
|
166 |
-
//
|
167 |
-
//
|
168 |
-
//
|
169 |
-
//
|
170 |
-
//
|
171 |
-
//
|
172 |
-
//
|
173 |
-
//
|
174 |
-
//
|
175 |
-
//
|
176 |
-
//
|
177 |
-
//
|
178 |
-
//
|
179 |
-
//
|
180 |
-
//
|
181 |
-
//
|
182 |
-
//
|
183 |
-
//
|
184 |
-
//
|
185 |
-
// if (c.indexOf('[caption') === 0) {
|
186 |
-
// //noinspection JSUnresolvedVariable
|
187 |
-
// if (b.plugins.wpeditimage) {
|
188 |
-
// //noinspection JSUnresolvedVariable
|
189 |
-
// c = b.plugins.wpeditimage._do_shcode(c);
|
190 |
-
// }
|
191 |
-
// }
|
192 |
-
// else {
|
193 |
-
// c = '<p>' + c + '</p>';
|
194 |
-
// }
|
195 |
-
// b.execCommand('mceInsertContent', false, c);
|
196 |
-
// }
|
197 |
-
// else {
|
198 |
-
// if (f) {
|
199 |
-
// QTags.insertContent(c);
|
200 |
-
// }
|
201 |
-
// else {
|
202 |
-
// document.getElementById(wpActiveEditor).value += c;
|
203 |
-
// }
|
204 |
-
// }
|
205 |
-
// return true;
|
206 |
-
// }
|
207 |
-
//
|
208 |
-
// function gm_delete_scode(c) {
|
209 |
-
// var b, a = typeof (tinymce) != 'undefined', re, html;
|
210 |
-
// if (!wpActiveEditor) {
|
211 |
-
// if (a && tinymce.activeEditor) {
|
212 |
-
// b = tinymce.activeEditor;
|
213 |
-
// wpActiveEditor = b.id;
|
214 |
-
// }
|
215 |
-
// else {
|
216 |
-
// if (gmActiveEditor) {
|
217 |
-
// wpActiveEditor = gmActiveEditor;
|
218 |
-
// }
|
219 |
-
// else {
|
220 |
-
// return false;
|
221 |
-
// }
|
222 |
-
// }
|
223 |
-
// }
|
224 |
-
// else {
|
225 |
-
// if (a) {
|
226 |
-
// if (tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen')) {
|
227 |
-
// b = tinymce.activeEditor;
|
228 |
-
// }
|
229 |
-
// else {
|
230 |
-
// b = tinymce.get(wpActiveEditor);
|
231 |
-
// }
|
232 |
-
// }
|
233 |
-
// }
|
234 |
-
// if (b && !b.isHidden()) {
|
235 |
-
// html = b.getContent();
|
236 |
-
// re = new RegExp('(?:<p>)?\\[gmedia \\s*id=' + c + '\\s*?\\](?:<\\/p>)?', 'g');
|
237 |
-
// b.setContent(html.replace(re, ''));
|
238 |
-
// }
|
239 |
-
// else {
|
240 |
-
// html = document.getElementById(wpActiveEditor).value;
|
241 |
-
// re = new RegExp('\\[gmedia [ ]*id=' + c + '[ ]*?\\](?:\\n\\n|\\n)?', 'g');
|
242 |
-
// html = html.replace(re, '');
|
243 |
-
// document.getElementById(wpActiveEditor).value = html;
|
244 |
-
// }
|
245 |
-
// return true;
|
246 |
-
// }
|
247 |
-
//
|
248 |
-
// function gm_media_button(b) {
|
249 |
-
// var pos, el = jQuery(b).toggleClass('active');
|
250 |
-
// if (el.hasClass('active')) {
|
251 |
-
// pos = el.offset();
|
252 |
-
// pos.top += el.height() + 1;
|
253 |
-
// var w = 300;
|
254 |
-
// jQuery('#gmedia-wraper').appendTo('body').css({'position': 'absolute', 'z-index': 99999, 'width': w}).offset(pos);
|
255 |
-
// jQuery('#gmedia-wraper').draggable({handle: '.title-bar'});
|
256 |
-
// }
|
257 |
-
// else {
|
258 |
-
// jQuery('#gmedia-wraper').removeAttr('style').appendTo('#gmedia-MetaBox .inside');
|
259 |
-
// jQuery('#gmedia-wraper').draggable('destroy');
|
260 |
-
// }
|
261 |
-
// }
|
1 |
var gmActiveEditor = false;
|
2 |
+
(function( $, window, document, undefined ) {
|
3 |
|
4 |
+
// $('body').on('click', 'textarea.wp-editor-area', function() {
|
5 |
+
// gmActiveEditor = $(this).attr('id');
|
6 |
+
// setTimeout(function() {
|
7 |
+
// gm_check_scode(gmActiveEditor);
|
8 |
+
// }, 10);
|
9 |
+
// });
|
10 |
+
//
|
11 |
+
// $('#gmedia-wraper').resizable({
|
12 |
+
// handles: 'e',
|
13 |
+
// start: function(event, ui) {
|
14 |
+
// $('iframe').css('pointer-events', 'none');
|
15 |
+
// },
|
16 |
+
// stop: function(event, ui) {
|
17 |
+
// $('iframe').css('pointer-events', 'auto');
|
18 |
+
// $('#gmedia-images-wrap').trigger('scroll');
|
19 |
+
// },
|
20 |
+
// resize: function(event, ui) {
|
21 |
+
// ui.element.height('auto');
|
22 |
+
// }
|
23 |
+
// });
|
24 |
+
// $('#gmedia-galleries').resizable({
|
25 |
+
// handles: 's',
|
26 |
+
// minHeight: 94,
|
27 |
+
// start: function(event, ui) {
|
28 |
+
// $('iframe').css('pointer-events', 'none');
|
29 |
+
// },
|
30 |
+
// stop: function(event, ui) {
|
31 |
+
// $('iframe').css('pointer-events', 'auto');
|
32 |
+
// ui.element.width('auto');
|
33 |
+
// }
|
34 |
+
// });
|
35 |
+
//
|
36 |
+
// $('li.gmedia-gallery-li').click(function(e) {
|
37 |
+
// if ($(e.target).hasClass('gmedia-gallery-gear')) {
|
38 |
+
// return;
|
39 |
+
// }
|
40 |
+
// var m, html, gm_id = $(this).attr('id').split('-')[1];
|
41 |
+
// if ($(this).hasClass('gmedia-selected')) {
|
42 |
+
// if (gm_delete_scode(gm_id)) {
|
43 |
+
// $(this).removeClass('gmedia-selected');
|
44 |
+
// }
|
45 |
+
// else {
|
46 |
+
// // Show message "Focus textarea"
|
47 |
+
// m = $('#gmedia-message .info-textarea');
|
48 |
+
// m.slideDown(100, function() {
|
49 |
+
// setTimeout(function() {
|
50 |
+
// m.slideUp(100);
|
51 |
+
// }, 1000);
|
52 |
+
// });
|
53 |
+
// }
|
54 |
+
// }
|
55 |
+
// else {
|
56 |
+
// html = '[gmedia id=' + gm_id + ']';
|
57 |
+
// if (gm_send_to_editor(html)) {
|
58 |
+
// $(this).addClass('gmedia-selected');
|
59 |
+
// }
|
60 |
+
// else {
|
61 |
+
// m = $('#gmedia-message .info-textarea');
|
62 |
+
// m.slideDown(100, function() {
|
63 |
+
// setTimeout(function() {
|
64 |
+
// m.slideUp(100);
|
65 |
+
// }, 1000);
|
66 |
+
// });
|
67 |
+
// }
|
68 |
+
// }
|
69 |
+
// e.preventDefault();
|
70 |
+
// });
|
71 |
+
//
|
72 |
+
// setTimeout(function() {
|
73 |
+
// gm_check_scode(false);
|
74 |
+
// }, 1000);
|
75 |
+
//
|
76 |
+
// $('textarea.wp-editor-area').on('keyup', function(e) {
|
77 |
+
// var k = e.keyCode || e.charCode;
|
78 |
+
// if (k == 8 || k == 13 || k == 46) {
|
79 |
+
// var m, content = $(this).val();
|
80 |
+
// m = content.match(/\[gmedia [ ]*id=(\d+)[ ]*?\]/g);
|
81 |
+
// jQuery('#gmedia-galleries-list
|
82 |
+
// li.gmedia-gallery-li').removeClass('gmedia-selected'); if (m) {
|
83 |
+
// jQuery.each(m, function(i, shcode) { var id = shcode.replace(/\[gmedia [
|
84 |
+
// ]*id=(\d+)[ ]*?\]/, '$1'); jQuery('#gmGallery-' +
|
85 |
+
// id).addClass('gmedia-selected'); }); } } });
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
$( document ).on( 'click', '#gmedia-modal', function( e ) {
|
88 |
+
e.stopPropagation();
|
89 |
+
e.preventDefault();
|
90 |
+
gmedia_post_modal( this );
|
91 |
+
} );
|
92 |
|
93 |
+
$( '#postimagediv' ).
|
94 |
+
on( 'click', '#set-gmedia-post-thumbnail', function( e ) {
|
95 |
+
e.stopPropagation();
|
96 |
+
e.preventDefault();
|
97 |
+
gmedia_post_modal();
|
98 |
+
var modal = $( '#__gm-uploader' );
|
99 |
+
var library = modal.find( '#gmedia-modal-library' );
|
100 |
+
if ( ! library.hasClass( 'active' ) ) {
|
101 |
+
var ifr = modal.find( 'iframe' ).clone();
|
102 |
+
ifr.attr( 'src', library.attr( 'href' ) );
|
103 |
+
library.trigger( 'click' );
|
104 |
+
modal.find( 'iframe' ).replaceWith( ifr );
|
105 |
+
}
|
106 |
+
} );
|
107 |
|
108 |
+
})( jQuery, window, document, undefined );
|
109 |
|
110 |
+
function gmedia_post_modal( el ) {
|
111 |
+
var modal = jQuery( '#__gm-uploader' );
|
112 |
|
113 |
+
if ( modal.length ) {
|
114 |
+
modal.css( 'display', 'block' );
|
115 |
+
}
|
116 |
+
else {
|
117 |
+
//var title = jQuery(el).attr('title');
|
118 |
+
modal = jQuery( jQuery( '#tpl__gm-uploader' ).html() );
|
119 |
+
modal.find( '.media-modal-close, .media-modal-backdrop' ).
|
120 |
+
on( 'click', function() {
|
121 |
+
modal.css( 'display', 'none' );
|
122 |
+
} );
|
123 |
+
modal.find( '.media-menu-item' ).on( 'click', function() {
|
124 |
+
jQuery( 'iframe', modal ).attr( 'src', jQuery( this ).attr( 'href' ) );
|
125 |
+
jQuery( this ).
|
126 |
+
addClass( 'active' ).
|
127 |
+
siblings( 'a' ).
|
128 |
+
removeClass( 'active' );
|
129 |
+
jQuery( '.media-frame-title h1', modal ).text( jQuery( this ).text() );
|
130 |
+
} );
|
131 |
+
jQuery( 'body' ).append( modal );
|
132 |
+
}
|
133 |
}
|
134 |
|
135 |
// function gm_check_scode(id) {
|
152 |
// }
|
153 |
//
|
154 |
// function gm_send_to_editor(c) {
|
155 |
+
// var b, a = typeof (tinymce) != 'undefined', f = typeof (QTags) !=
|
156 |
+
// 'undefined'; if (!wpActiveEditor) { if (a && tinymce.activeEditor) { b =
|
157 |
+
// tinymce.activeEditor; wpActiveEditor = b.id; } else { if (gmActiveEditor) {
|
158 |
+
// wpActiveEditor = gmActiveEditor; } else { return false; } } } else { if (a)
|
159 |
+
// { if (tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen'
|
160 |
+
// || tinymce.activeEditor.id == 'wp_mce_fullscreen')) { b =
|
161 |
+
// tinymce.activeEditor; } else { b = tinymce.get(wpActiveEditor); } } } if (b
|
162 |
+
// && !b.isHidden()) { //noinspection JSUnresolvedVariable if (tinymce.isIE &&
|
163 |
+
// b.windowManager.insertimagebookmark) { //noinspection JSUnresolvedVariable
|
164 |
+
// b.selection.moveToBookmark(b.windowManager.insertimagebookmark); } if
|
165 |
+
// (c.indexOf('[caption') === 0) { //noinspection JSUnresolvedVariable if
|
166 |
+
// (b.plugins.wpeditimage) { //noinspection JSUnresolvedVariable c =
|
167 |
+
// b.plugins.wpeditimage._do_shcode(c); } } else { c = '<p>' + c + '</p>'; }
|
168 |
+
// b.execCommand('mceInsertContent', false, c); } else { if (f) {
|
169 |
+
// QTags.insertContent(c); } else {
|
170 |
+
// document.getElementById(wpActiveEditor).value += c; } } return true; }
|
171 |
+
// function gm_delete_scode(c) { var b, a = typeof (tinymce) != 'undefined',
|
172 |
+
// re, html; if (!wpActiveEditor) { if (a && tinymce.activeEditor) { b =
|
173 |
+
// tinymce.activeEditor; wpActiveEditor = b.id; } else { if (gmActiveEditor) {
|
174 |
+
// wpActiveEditor = gmActiveEditor; } else { return false; } } } else { if (a)
|
175 |
+
// { if (tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen'
|
176 |
+
// || tinymce.activeEditor.id == 'wp_mce_fullscreen')) { b =
|
177 |
+
// tinymce.activeEditor; } else { b = tinymce.get(wpActiveEditor); } } } if (b
|
178 |
+
// && !b.isHidden()) { html = b.getContent(); re = new
|
179 |
+
// RegExp('(?:<p>)?\\[gmedia \\s*id=' + c + '\\s*?\\](?:<\\/p>)?', 'g');
|
180 |
+
// b.setContent(html.replace(re, '')); } else { html =
|
181 |
+
// document.getElementById(wpActiveEditor).value; re = new RegExp('\\[gmedia [
|
182 |
+
// ]*id=' + c + '[ ]*?\\](?:\\n\\n|\\n)?', 'g'); html = html.replace(re, '');
|
183 |
+
// document.getElementById(wpActiveEditor).value = html; } return true; }
|
184 |
+
// function gm_media_button(b) { var pos, el = jQuery(b).toggleClass('active');
|
185 |
+
// if (el.hasClass('active')) { pos = el.offset(); pos.top += el.height() + 1; var w = 300; jQuery('#gmedia-wraper').appendTo('body').css({'position': 'absolute', 'z-index': 99999, 'width': w}).offset(pos); jQuery('#gmedia-wraper').draggable({handle: '.title-bar'}); } else { jQuery('#gmedia-wraper').removeAttr('style').appendTo('#gmedia-MetaBox .inside'); jQuery('#gmedia-wraper').draggable('destroy'); } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/class.processor.php
CHANGED
@@ -6,12 +6,14 @@
|
|
6 |
class GmediaProcessor {
|
7 |
|
8 |
private static $me = null;
|
|
|
|
|
|
|
9 |
public $page;
|
10 |
public $gmediablank;
|
11 |
public $url;
|
12 |
public $msg;
|
13 |
public $error;
|
14 |
-
public $user_options = [];
|
15 |
|
16 |
public $display_mode;
|
17 |
public $taxonomy;
|
@@ -25,15 +27,15 @@ class GmediaProcessor {
|
|
25 |
global $pagenow, $gmCore;
|
26 |
// GET variables.
|
27 |
$this->page = $gmCore->_get( 'page' );
|
28 |
-
$this->url = add_query_arg(
|
29 |
if ( 'media.php' === $pagenow ) {
|
30 |
-
add_filter( 'wp_redirect',
|
31 |
}
|
32 |
if ( 'edit-comments.php' === $pagenow ) {
|
33 |
-
add_filter( 'get_comment_text',
|
34 |
}
|
35 |
|
36 |
-
add_action( 'init',
|
37 |
|
38 |
if ( ! $this->page || strpos( $this->page, 'GrandMedia' ) === false ) {
|
39 |
return;
|
@@ -41,7 +43,7 @@ class GmediaProcessor {
|
|
41 |
|
42 |
$this->gmediablank = $gmCore->_get( 'gmediablank' );
|
43 |
if ( $this->gmediablank ) {
|
44 |
-
$this->url = add_query_arg(
|
45 |
}
|
46 |
|
47 |
switch ( $this->page ) {
|
@@ -73,12 +75,14 @@ class GmediaProcessor {
|
|
73 |
*/
|
74 |
public static function selected_items( $key, $post_key = 'selected_items' ) {
|
75 |
|
76 |
-
$selected_items =
|
77 |
if ( $key ) {
|
78 |
if ( isset( $_POST[ $post_key ] ) ) {
|
79 |
-
$
|
|
|
80 |
} elseif ( isset( $_COOKIE[ $key ] ) ) {
|
81 |
-
$
|
|
|
82 |
}
|
83 |
}
|
84 |
|
@@ -88,20 +92,20 @@ class GmediaProcessor {
|
|
88 |
/**
|
89 |
* @param bool|string|array $author_id_list
|
90 |
*
|
91 |
-
* @return array
|
92 |
*/
|
93 |
public static function filter_by_author( $author_id_list = false ) {
|
94 |
global $user_ID, $gmCore;
|
95 |
|
96 |
-
if (
|
97 |
$author = false;
|
98 |
if ( ! $gmCore->caps['gmedia_show_others_media'] ) {
|
99 |
-
$author =
|
100 |
}
|
101 |
} else {
|
102 |
$author = wp_parse_id_list( $author_id_list );
|
103 |
if ( ! $gmCore->caps['gmedia_show_others_media'] ) {
|
104 |
-
$author = array_intersect(
|
105 |
}
|
106 |
}
|
107 |
|
@@ -112,8 +116,9 @@ class GmediaProcessor {
|
|
112 |
* Autoloader
|
113 |
*/
|
114 |
public static function autoload() {
|
|
|
115 |
$path_ = GMEDIA_ABSPATH . 'admin/processor/class.processor.';
|
116 |
-
$page =
|
117 |
switch ( $page ) {
|
118 |
case 'GrandMedia':
|
119 |
/** @var $gmProcessorLibrary */
|
@@ -159,7 +164,7 @@ class GmediaProcessor {
|
|
159 |
|
160 |
return $gmProcessorWPMedia;
|
161 |
default:
|
162 |
-
if ( self::$me
|
163 |
self::$me = new GmediaProcessor();
|
164 |
}
|
165 |
|
@@ -193,7 +198,7 @@ class GmediaProcessor {
|
|
193 |
|
194 |
$screen_options = get_user_meta( $user_ID, 'gm_screen_options', true );
|
195 |
if ( ! is_array( $screen_options ) ) {
|
196 |
-
$screen_options =
|
197 |
}
|
198 |
|
199 |
return array_merge( $gmGallery->options['gm_screen_options'], $screen_options );
|
@@ -202,8 +207,7 @@ class GmediaProcessor {
|
|
202 |
/**
|
203 |
* Do diff process before lib shell
|
204 |
*/
|
205 |
-
protected function processor() {
|
206 |
-
}
|
207 |
|
208 |
/**
|
209 |
* @param string $cookie_key
|
@@ -216,22 +220,23 @@ class GmediaProcessor {
|
|
216 |
unset( $_COOKIE[ $cookie_key ] );
|
217 |
}
|
218 |
|
219 |
-
return
|
220 |
}
|
221 |
|
222 |
/**
|
223 |
* redirect to original referer after update
|
224 |
*
|
225 |
-
* @param $location
|
226 |
-
* @param $status
|
227 |
*
|
228 |
* @return mixed
|
229 |
*/
|
230 |
public function redirect( $location, $status ) {
|
231 |
-
global $pagenow;
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
235 |
} else {
|
236 |
return $location;
|
237 |
}
|
@@ -243,13 +248,13 @@ class GmediaProcessor {
|
|
243 |
/**
|
244 |
* Add thumb to gmedia comment text in admin
|
245 |
*
|
246 |
-
* @param $comment_content
|
247 |
-
* @param $comment
|
248 |
-
* @param $args
|
249 |
*
|
250 |
* @return string $comment_content
|
251 |
*/
|
252 |
-
function gmedia_comment_text( $comment_content, $comment, $args ) {
|
253 |
global $post;
|
254 |
if ( ! $post ) {
|
255 |
return $comment_content;
|
@@ -258,7 +263,7 @@ class GmediaProcessor {
|
|
258 |
if ( 'gmedia' === $post->post_type ) {
|
259 |
global $gmDB, $gmCore;
|
260 |
$gmedia = $gmDB->get_post_gmedia( $post->ID );
|
261 |
-
$thumb = '<div class="alignright" style="clear:right;"><img class="gmedia-thumb" style="max-height:72px;" src="' . $gmCore->gm_get_media_image( $gmedia, 'thumb', false ) . '" alt=""/></div>';
|
262 |
$comment_content = $thumb . $comment_content;
|
263 |
}
|
264 |
|
6 |
class GmediaProcessor {
|
7 |
|
8 |
private static $me = null;
|
9 |
+
|
10 |
+
public $user_options = array();
|
11 |
+
|
12 |
public $page;
|
13 |
public $gmediablank;
|
14 |
public $url;
|
15 |
public $msg;
|
16 |
public $error;
|
|
|
17 |
|
18 |
public $display_mode;
|
19 |
public $taxonomy;
|
27 |
global $pagenow, $gmCore;
|
28 |
// GET variables.
|
29 |
$this->page = $gmCore->_get( 'page' );
|
30 |
+
$this->url = add_query_arg( array( 'page' => $this->page ), admin_url( 'admin.php' ) );
|
31 |
if ( 'media.php' === $pagenow ) {
|
32 |
+
add_filter( 'wp_redirect', array( $this, 'redirect' ), 10, 2 );
|
33 |
}
|
34 |
if ( 'edit-comments.php' === $pagenow ) {
|
35 |
+
add_filter( 'get_comment_text', array( $this, 'gmedia_comment_text' ), 10, 3 );
|
36 |
}
|
37 |
|
38 |
+
add_action( 'init', array( $this, 'controller' ) );
|
39 |
|
40 |
if ( ! $this->page || strpos( $this->page, 'GrandMedia' ) === false ) {
|
41 |
return;
|
43 |
|
44 |
$this->gmediablank = $gmCore->_get( 'gmediablank' );
|
45 |
if ( $this->gmediablank ) {
|
46 |
+
$this->url = add_query_arg( array( 'gmediablank' => $this->gmediablank ), $this->url );
|
47 |
}
|
48 |
|
49 |
switch ( $this->page ) {
|
75 |
*/
|
76 |
public static function selected_items( $key, $post_key = 'selected_items' ) {
|
77 |
|
78 |
+
$selected_items = array();
|
79 |
if ( $key ) {
|
80 |
if ( isset( $_POST[ $post_key ] ) ) {
|
81 |
+
$sel_string = sanitize_text_field( wp_unslash( $_POST[ $post_key ] ) );
|
82 |
+
$selected_items = array_filter( explode( ',', $sel_string ), 'is_numeric' );
|
83 |
} elseif ( isset( $_COOKIE[ $key ] ) ) {
|
84 |
+
$sel_string = sanitize_text_field( wp_unslash( $_COOKIE[ $key ] ) );
|
85 |
+
$selected_items = array_filter( explode( '.', $sel_string ), 'is_numeric' );
|
86 |
}
|
87 |
}
|
88 |
|
92 |
/**
|
93 |
* @param bool|string|array $author_id_list
|
94 |
*
|
95 |
+
* @return array
|
96 |
*/
|
97 |
public static function filter_by_author( $author_id_list = false ) {
|
98 |
global $user_ID, $gmCore;
|
99 |
|
100 |
+
if ( false === $author_id_list ) {
|
101 |
$author = false;
|
102 |
if ( ! $gmCore->caps['gmedia_show_others_media'] ) {
|
103 |
+
$author = array( $user_ID, 0 );
|
104 |
}
|
105 |
} else {
|
106 |
$author = wp_parse_id_list( $author_id_list );
|
107 |
if ( ! $gmCore->caps['gmedia_show_others_media'] ) {
|
108 |
+
$author = array_intersect( array( $user_ID, 0 ), $author );
|
109 |
}
|
110 |
}
|
111 |
|
116 |
* Autoloader
|
117 |
*/
|
118 |
public static function autoload() {
|
119 |
+
global $gmCore;
|
120 |
$path_ = GMEDIA_ABSPATH . 'admin/processor/class.processor.';
|
121 |
+
$page = $gmCore->_get( 'page', '' );
|
122 |
switch ( $page ) {
|
123 |
case 'GrandMedia':
|
124 |
/** @var $gmProcessorLibrary */
|
164 |
|
165 |
return $gmProcessorWPMedia;
|
166 |
default:
|
167 |
+
if ( null === self::$me ) {
|
168 |
self::$me = new GmediaProcessor();
|
169 |
}
|
170 |
|
198 |
|
199 |
$screen_options = get_user_meta( $user_ID, 'gm_screen_options', true );
|
200 |
if ( ! is_array( $screen_options ) ) {
|
201 |
+
$screen_options = array();
|
202 |
}
|
203 |
|
204 |
return array_merge( $gmGallery->options['gm_screen_options'], $screen_options );
|
207 |
/**
|
208 |
* Do diff process before lib shell
|
209 |
*/
|
210 |
+
protected function processor() {}
|
|
|
211 |
|
212 |
/**
|
213 |
* @param string $cookie_key
|
220 |
unset( $_COOKIE[ $cookie_key ] );
|
221 |
}
|
222 |
|
223 |
+
return array();
|
224 |
}
|
225 |
|
226 |
/**
|
227 |
* redirect to original referer after update
|
228 |
*
|
229 |
+
* @param string $location
|
230 |
+
* @param string $status
|
231 |
*
|
232 |
* @return mixed
|
233 |
*/
|
234 |
public function redirect( $location, $status ) {
|
235 |
+
global $pagenow, $gmCore;
|
236 |
+
$ref = $gmCore->_post( '_wp_original_http_referer' );
|
237 |
+
if ( 'media.php' === $pagenow && $ref ) {
|
238 |
+
if ( strpos( $ref, 'GrandMedia' ) !== false ) {
|
239 |
+
return $ref;
|
240 |
} else {
|
241 |
return $location;
|
242 |
}
|
248 |
/**
|
249 |
* Add thumb to gmedia comment text in admin
|
250 |
*
|
251 |
+
* @param string $comment_content
|
252 |
+
* @param string $comment
|
253 |
+
* @param array $args
|
254 |
*
|
255 |
* @return string $comment_content
|
256 |
*/
|
257 |
+
public function gmedia_comment_text( $comment_content, $comment, $args ) {
|
258 |
global $post;
|
259 |
if ( ! $post ) {
|
260 |
return $comment_content;
|
263 |
if ( 'gmedia' === $post->post_type ) {
|
264 |
global $gmDB, $gmCore;
|
265 |
$gmedia = $gmDB->get_post_gmedia( $post->ID );
|
266 |
+
$thumb = '<div class="alignright" style="clear:right;"><img class="gmedia-thumb" style="max-height:72px;" src="' . esc_url( $gmCore->gm_get_media_image( $gmedia, 'thumb', false ) ) . '" alt=""/></div>';
|
267 |
$comment_content = $thumb . $comment_content;
|
268 |
}
|
269 |
|
admin/functions.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
function gm_get_admin_url( $add_args =
|
4 |
global $gmCore;
|
5 |
|
6 |
return $gmCore->get_admin_url( $add_args, $remove_args, $uri, $preserve_args );
|
7 |
}
|
8 |
|
9 |
function gm_panel_classes( $classes ) {
|
10 |
-
echo implode( ' ', (array) $classes );
|
11 |
}
|
12 |
|
13 |
-
function gmedia_term_choose_author_field( $selected = false, $_args =
|
14 |
global $gmCore;
|
15 |
|
16 |
$user_ID = get_current_user_id();
|
@@ -18,12 +18,12 @@ function gmedia_term_choose_author_field( $selected = false, $_args = [] ) {
|
|
18 |
$selected = $user_ID;
|
19 |
}
|
20 |
|
21 |
-
$user_ids = gm_user_can( 'delete_others_media' ) ? $gmCore->get_editable_user_ids() :
|
22 |
if ( $user_ids && gm_user_can( 'edit_others_media' ) ) {
|
23 |
if ( ! in_array( $user_ID, $user_ids, true ) ) {
|
24 |
-
|
25 |
}
|
26 |
-
$args =
|
27 |
'include' => $user_ids,
|
28 |
'include_selected' => true,
|
29 |
'name' => 'term[global]',
|
@@ -31,11 +31,11 @@ function gmedia_term_choose_author_field( $selected = false, $_args = [] ) {
|
|
31 |
'class' => 'form-control input-sm',
|
32 |
'multi' => true,
|
33 |
'show_option_all' => __( 'Shared', 'grand-media' ),
|
34 |
-
|
35 |
$args = array_merge( $args, $_args );
|
36 |
wp_dropdown_users( $args );
|
37 |
} else {
|
38 |
-
echo '<input type="hidden" name="term[global]" value="' . $user_ID . '"/>';
|
39 |
-
echo '<div>' . get_the_author_meta( 'display_name', $user_ID ) . '</div>';
|
40 |
}
|
41 |
}
|
1 |
<?php
|
2 |
|
3 |
+
function gm_get_admin_url( $add_args = array(), $remove_args = array(), $uri = false, $preserve_args = array() ) {
|
4 |
global $gmCore;
|
5 |
|
6 |
return $gmCore->get_admin_url( $add_args, $remove_args, $uri, $preserve_args );
|
7 |
}
|
8 |
|
9 |
function gm_panel_classes( $classes ) {
|
10 |
+
echo esc_attr( implode( ' ', (array) $classes ) );
|
11 |
}
|
12 |
|
13 |
+
function gmedia_term_choose_author_field( $selected = false, $_args = array() ) {
|
14 |
global $gmCore;
|
15 |
|
16 |
$user_ID = get_current_user_id();
|
18 |
$selected = $user_ID;
|
19 |
}
|
20 |
|
21 |
+
$user_ids = gm_user_can( 'delete_others_media' ) ? $gmCore->get_editable_user_ids() : array( $user_ID );
|
22 |
if ( $user_ids && gm_user_can( 'edit_others_media' ) ) {
|
23 |
if ( ! in_array( $user_ID, $user_ids, true ) ) {
|
24 |
+
$user_ids[] = $user_ID;
|
25 |
}
|
26 |
+
$args = array(
|
27 |
'include' => $user_ids,
|
28 |
'include_selected' => true,
|
29 |
'name' => 'term[global]',
|
31 |
'class' => 'form-control input-sm',
|
32 |
'multi' => true,
|
33 |
'show_option_all' => __( 'Shared', 'grand-media' ),
|
34 |
+
);
|
35 |
$args = array_merge( $args, $_args );
|
36 |
wp_dropdown_users( $args );
|
37 |
} else {
|
38 |
+
echo '<input type="hidden" name="term[global]" value="' . intval( $user_ID ) . '"/>';
|
39 |
+
echo '<div>' . esc_html( get_the_author_meta( 'display_name', $user_ID ) ) . '</div>';
|
40 |
}
|
41 |
}
|
admin/logs.php
CHANGED
@@ -3,12 +3,9 @@
|
|
3 |
* Gmedia Logs
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
-
global $user_ID, $wpdb, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
12 |
|
13 |
$gmedia_url = $gmProcessor->url;
|
14 |
$gmedia_user_options = $gmProcessor->user_options;
|
@@ -19,14 +16,14 @@ if ( isset( $_GET['do_gmedia'] ) && 'clear_logs' === $_GET['do_gmedia'] ) {
|
|
19 |
}
|
20 |
|
21 |
|
22 |
-
$gmedia_filter =
|
23 |
|
24 |
$openPage = ! empty( $_GET['pager'] ) ? (int) $_GET['pager'] : 1;
|
25 |
|
26 |
-
$where
|
27 |
-
$
|
28 |
-
$
|
29 |
-
$lim
|
30 |
|
31 |
if ( isset( $_POST['filter_author'] ) ) {
|
32 |
$authors = $gmCore->_post( 'author_ids' );
|
@@ -38,45 +35,49 @@ if ( isset( $_GET['author'] ) ) {
|
|
38 |
$gmedia_filter['author'] = $author;
|
39 |
}
|
40 |
if ( isset( $_GET['log_event'] ) ) {
|
41 |
-
$
|
42 |
-
|
|
|
43 |
}
|
44 |
if ( isset( $_GET['s'] ) ) {
|
45 |
-
$
|
46 |
-
if ( '#' === substr( $
|
47 |
-
$ids = wp_parse_id_list( substr( $
|
48 |
$where .= ' AND l.ID IN (\'' . implode( "','", $ids ) . '\')';
|
49 |
-
$
|
50 |
-
$gmedia_filter['search'] = $
|
51 |
}
|
52 |
-
if ( ! empty( $
|
53 |
-
// added slashes screw with quote grouping when done early, so done later
|
54 |
-
$
|
55 |
|
56 |
-
// split the words
|
57 |
-
preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $
|
58 |
-
$search_terms = array_map(
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
61 |
|
62 |
$n = '%';
|
63 |
$searchand = '';
|
64 |
|
65 |
-
foreach ( (array) $search_terms as $
|
66 |
-
$
|
67 |
-
$
|
68 |
-
$searchand
|
69 |
}
|
70 |
|
71 |
-
$
|
72 |
-
if ( count( $search_terms ) > 1 && $search_terms[0] !== $
|
73 |
-
$
|
74 |
}
|
75 |
|
76 |
-
if ( ! empty( $
|
77 |
-
$
|
78 |
}
|
79 |
-
$gmedia_filter['search'] = $
|
80 |
}
|
81 |
}
|
82 |
|
@@ -86,84 +87,83 @@ if ( $limit > 0 ) {
|
|
86 |
$lim = " LIMIT {$offset}, {$limit}";
|
87 |
}
|
88 |
|
89 |
-
$query = "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}gmedia_log AS l INNER JOIN {$wpdb->prefix}gmedia AS g ON g.ID = l.ID WHERE 1=1 $where $
|
90 |
//echo '<pre>' . print_r($query, true) . '</pre>';
|
91 |
$logs = $wpdb->get_results( $query );
|
92 |
-
$totalResult = (int) $wpdb->get_var(
|
93 |
|
94 |
if ( ( 1 > $limit ) || ( 0 === $totalResult ) ) {
|
95 |
-
$limit
|
96 |
-
$
|
97 |
} else {
|
98 |
-
$
|
99 |
}
|
100 |
|
101 |
-
$gmDB->pages = $
|
102 |
$gmDB->openPage = $openPage;
|
103 |
$gmedia_pager = $gmDB->query_pager();
|
104 |
|
105 |
?>
|
106 |
-
<div class="
|
107 |
-
<div class="
|
108 |
-
<div class="
|
109 |
-
<div class="
|
110 |
<div class="clearfix">
|
111 |
-
<?php
|
112 |
|
113 |
-
<div class="btn-toolbar
|
114 |
<?php if ( ! $gmProcessor->gmediablank ) { ?>
|
115 |
-
<a title="<?php
|
116 |
<?php } ?>
|
117 |
</div>
|
118 |
</div>
|
119 |
|
120 |
-
<?php echo $gmedia_pager; ?>
|
121 |
|
122 |
<div class="spinner"></div>
|
123 |
|
124 |
</div>
|
125 |
-
<div class="btn-toolbar
|
126 |
<div class="btn-group">
|
127 |
<?php if ( ! empty( $gmedia_filter ) ) { ?>
|
128 |
-
<a class="btn btn-warning" title="<?php
|
129 |
<?php } else { ?>
|
130 |
-
<button type="button" class="btn btn-
|
131 |
<?php } ?>
|
132 |
-
<button type="button" class="btn btn-
|
133 |
-
<span class="
|
134 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
135 |
</button>
|
136 |
<ul class="dropdown-menu" role="menu">
|
137 |
-
<li role="presentation" class="dropdown-header"><?php
|
138 |
<li class="gmedia_author<?php echo esc_attr( isset( $gmedia_filter['author'] ) ? ' active' : '' ); ?>">
|
139 |
-
<a href="#libModal" data-modal="filter_author" data-action="gmedia_get_modal"
|
140 |
</li>
|
141 |
-
<li role="presentation" class="dropdown-header"><?php
|
142 |
<li class="gmedia_event<?php echo esc_attr( ( isset( $gmedia_filter['log_event'] ) && 'view' === $gmedia_filter['log_event'] ) ? ' active' : '' ); ?>">
|
143 |
-
<a href="<?php echo esc_url( add_query_arg(
|
144 |
</li>
|
145 |
<li class="gmedia_event<?php echo esc_attr( ( isset( $gmedia_filter['log_event'] ) && 'like' === $gmedia_filter['log_event'] ) ? ' active' : '' ); ?>">
|
146 |
-
<a href="<?php echo esc_url( add_query_arg(
|
147 |
</li>
|
148 |
<li class="gmedia_event<?php echo esc_attr( ( isset( $gmedia_filter['log_event'] ) && 'rate' === $gmedia_filter['log_event'] ) ? ' active' : '' ); ?>">
|
149 |
-
<a href="<?php echo esc_url( add_query_arg(
|
150 |
</li>
|
151 |
</ul>
|
152 |
</div>
|
153 |
-
<a class="btn btn-danger
|
154 |
|
155 |
</div>
|
156 |
|
157 |
</div>
|
158 |
-
<form class="
|
159 |
<?php
|
160 |
if ( empty( $gmGallery->options['license_key'] ) ) {
|
161 |
?>
|
162 |
-
<div class="alert alert-warning" role="alert"><strong><?php
|
163 |
<?php
|
164 |
} elseif ( ! empty( $gmGallery->options['disable_logs'] ) ) {
|
165 |
?>
|
166 |
-
<div class="alert alert-warning" role="alert"><strong><?php
|
167 |
<?php
|
168 |
}
|
169 |
?>
|
@@ -171,11 +171,11 @@ $gmedia_pager = $gmDB->query_pager();
|
|
171 |
<table class="table table-condensed table-hover">
|
172 |
<thead>
|
173 |
<tr>
|
174 |
-
<th><?php
|
175 |
-
<th><?php
|
176 |
-
<th><?php
|
177 |
-
<th><?php
|
178 |
-
<th><?php
|
179 |
</tr>
|
180 |
</thead>
|
181 |
<tbody>
|
@@ -186,7 +186,7 @@ $gmedia_pager = $gmDB->query_pager();
|
|
186 |
?>
|
187 |
<tr>
|
188 |
<td style="width:150px;">
|
189 |
-
<div class="thumbnail" style="margin-bottom: 0;">
|
190 |
<?php
|
191 |
$images = $gmCore->gm_get_media_image( $item, 'all' );
|
192 |
$thumb = '<img class="gmedia-thumb" src="' . $images['thumb'] . '" alt=""/>';
|
@@ -194,91 +194,97 @@ $gmedia_pager = $gmDB->query_pager();
|
|
194 |
if ( ! empty( $images['icon'] ) ) {
|
195 |
$thumb .= '<img class="gmedia-typethumb" src="' . $images['icon'] . '" alt=""/>';
|
196 |
}
|
197 |
-
echo $thumb;
|
198 |
?>
|
199 |
</div>
|
200 |
</td>
|
201 |
<td>
|
202 |
-
<p class="media-meta"><span class="
|
203 |
<p class="media-meta">
|
204 |
-
<span class="
|
205 |
<?php
|
206 |
if ( $item->album ) {
|
207 |
-
$terms_album =
|
208 |
foreach ( $item->album as $c ) {
|
209 |
-
$terms_album[] =
|
210 |
}
|
211 |
$terms_album = join( ', ', $terms_album );
|
212 |
} else {
|
213 |
$terms_album = '—';
|
214 |
}
|
215 |
-
echo $terms_album;
|
216 |
?>
|
217 |
-
<br/><span class="
|
218 |
<?php
|
219 |
if ( $item->categories ) {
|
220 |
-
$terms_category =
|
221 |
foreach ( $item->categories as $c ) {
|
222 |
-
$terms_category[] =
|
223 |
}
|
224 |
$terms_category = join( ', ', $terms_category );
|
225 |
} else {
|
226 |
$terms_category = __( 'Uncategorized', 'grand-media' );
|
227 |
}
|
228 |
-
echo $terms_category;
|
229 |
?>
|
230 |
-
<br/><span class="
|
231 |
<?php
|
232 |
if ( $item->tags ) {
|
233 |
-
$terms_tag =
|
234 |
foreach ( $item->tags as $c ) {
|
235 |
-
$terms_tag[] =
|
236 |
}
|
237 |
$terms_tag = join( ', ', $terms_tag );
|
238 |
} else {
|
239 |
$terms_tag = '—';
|
240 |
}
|
241 |
-
echo $terms_tag;
|
242 |
?>
|
243 |
</p>
|
244 |
<p class="media-meta">
|
245 |
-
<span class="
|
246 |
-
<?php echo ( isset( $item->meta['views'][0] ) ? $item->meta['views'][0] : '0' ) . ' / ' . ( isset( $item->meta['likes'][0] ) ? $item->meta['likes'][0] : '0' ); ?>
|
247 |
|
248 |
-
<?php
|
249 |
-
|
250 |
-
|
|
|
|
|
251 |
<?php } ?>
|
252 |
-
<br/><span class="
|
253 |
-
<br/><span class="
|
254 |
</p>
|
255 |
</td>
|
256 |
-
<td><p><?php echo $item->log_date; ?></p></td>
|
257 |
<td>
|
258 |
-
<p
|
|
|
259 |
$author_name = $item->log_author ? get_user_option( 'display_name', $item->log_author ) : __( 'Guest', 'grand-media' );
|
260 |
-
printf( '<a class="gmedia-author" href="%s">%s</a>', esc_url( add_query_arg(
|
261 |
-
|
262 |
-
|
|
|
263 |
</td>
|
264 |
-
<td><p
|
|
|
265 |
switch ( $item->log ) {
|
266 |
case 'view':
|
267 |
-
|
268 |
break;
|
269 |
case 'like':
|
270 |
-
|
271 |
break;
|
272 |
case 'rate':
|
273 |
-
echo __( 'Rate', 'grand-media' ) . ": {$item->log_data}";
|
274 |
break;
|
275 |
}
|
276 |
-
|
|
|
277 |
</tr>
|
278 |
<?php
|
279 |
}
|
280 |
} else {
|
281 |
-
echo '<tr><td colspan="5" style="font-weight: bold; text-align: center; padding: 30px 0;">' .
|
282 |
}
|
283 |
?>
|
284 |
</tbody>
|
3 |
* Gmedia Logs
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
+
global $user_ID, $wpdb, $gmDB, $gmCore, $gmGallery, $gmProcessor, $gm_allowed_tags;
|
9 |
|
10 |
$gmedia_url = $gmProcessor->url;
|
11 |
$gmedia_user_options = $gmProcessor->user_options;
|
16 |
}
|
17 |
|
18 |
|
19 |
+
$gmedia_filter = array();
|
20 |
|
21 |
$openPage = ! empty( $_GET['pager'] ) ? (int) $_GET['pager'] : 1;
|
22 |
|
23 |
+
$where = '';
|
24 |
+
$log_search = '';
|
25 |
+
$log_orderby = 'ORDER BY l.' . esc_sql( $gmedia_user_options['orderby_gmedia_log'] ) . ' ' . esc_sql( $gmedia_user_options['sortorder_gmedia_log'] );
|
26 |
+
$lim = '';
|
27 |
|
28 |
if ( isset( $_POST['filter_author'] ) ) {
|
29 |
$authors = $gmCore->_post( 'author_ids' );
|
35 |
$gmedia_filter['author'] = $author;
|
36 |
}
|
37 |
if ( isset( $_GET['log_event'] ) ) {
|
38 |
+
$gmedia_filter['log_event'] = $gmCore->_get( 'log_event' );
|
39 |
+
|
40 |
+
$where .= $wpdb->prepare( 'AND l.log = %s ', $gmedia_filter['log_event'] );
|
41 |
}
|
42 |
if ( isset( $_GET['s'] ) ) {
|
43 |
+
$log_s = trim( $gmCore->_get( 's' ) );
|
44 |
+
if ( '#' === substr( $log_s, 0, 1 ) ) {
|
45 |
+
$ids = wp_parse_id_list( substr( $log_s, 1 ) );
|
46 |
$where .= ' AND l.ID IN (\'' . implode( "','", $ids ) . '\')';
|
47 |
+
$log_s = false;
|
48 |
+
$gmedia_filter['search'] = $log_s;
|
49 |
}
|
50 |
+
if ( ! empty( $log_s ) ) {
|
51 |
+
// added slashes screw with quote grouping when done early, so done later.
|
52 |
+
$log_s = stripslashes( $log_s );
|
53 |
|
54 |
+
// split the words in an array if seperated by a space or comma.
|
55 |
+
preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $log_s, $matches );
|
56 |
+
$search_terms = array_map(
|
57 |
+
function ( $a ) {
|
58 |
+
return trim( $a, "\"'\n\r " );
|
59 |
+
},
|
60 |
+
$matches[0]
|
61 |
+
);
|
62 |
|
63 |
$n = '%';
|
64 |
$searchand = '';
|
65 |
|
66 |
+
foreach ( (array) $search_terms as $search_term ) {
|
67 |
+
$search_term = addslashes_gpc( $search_term );
|
68 |
+
$log_search .= "{$searchand}(g.title LIKE '{$n}{$search_term}{$n}') OR (g.description LIKE '{$n}{$search_term}{$n}')";
|
69 |
+
$searchand = ' AND ';
|
70 |
}
|
71 |
|
72 |
+
$search_term = esc_sql( $log_s );
|
73 |
+
if ( count( $search_terms ) > 1 && $search_terms[0] !== $log_s ) {
|
74 |
+
$log_search .= " OR (g.title LIKE '{$n}{$search_term}{$n}') OR (g.description LIKE '{$n}{$search_term}{$n}')";
|
75 |
}
|
76 |
|
77 |
+
if ( ! empty( $log_search ) ) {
|
78 |
+
$log_search = " AND ({$log_search}) ";
|
79 |
}
|
80 |
+
$gmedia_filter['search'] = $log_s;
|
81 |
}
|
82 |
}
|
83 |
|
87 |
$lim = " LIMIT {$offset}, {$limit}";
|
88 |
}
|
89 |
|
90 |
+
$query = "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}gmedia_log AS l INNER JOIN {$wpdb->prefix}gmedia AS g ON g.ID = l.ID WHERE 1=1 $where $log_search $log_orderby $lim";
|
91 |
//echo '<pre>' . print_r($query, true) . '</pre>';
|
92 |
$logs = $wpdb->get_results( $query );
|
93 |
+
$totalResult = (int) $wpdb->get_var( 'SELECT FOUND_ROWS()' );
|
94 |
|
95 |
if ( ( 1 > $limit ) || ( 0 === $totalResult ) ) {
|
96 |
+
$limit = $totalResult;
|
97 |
+
$log_pages = 1;
|
98 |
} else {
|
99 |
+
$log_pages = ceil( $totalResult / $limit );
|
100 |
}
|
101 |
|
102 |
+
$gmDB->pages = $log_pages;
|
103 |
$gmDB->openPage = $openPage;
|
104 |
$gmedia_pager = $gmDB->query_pager();
|
105 |
|
106 |
?>
|
107 |
+
<div class="card m-0 mw-100 p-0 panel-fixed-header" id="gmedia-panel">
|
108 |
+
<div class="card-header-fake"></div>
|
109 |
+
<div class="card-header bg-light clearfix" style="padding-bottom:2px;">
|
110 |
+
<div class="float-end" style="margin-bottom:3px;">
|
111 |
<div class="clearfix">
|
112 |
+
<?php require GMEDIA_ABSPATH . 'admin/tpl/search-form.php'; ?>
|
113 |
|
114 |
+
<div class="btn-toolbar gap-4 float-end" style="margin-bottom:4px; margin-left:4px;">
|
115 |
<?php if ( ! $gmProcessor->gmediablank ) { ?>
|
116 |
+
<a title="<?php esc_attr_e( 'More Screen Settings', 'grand-media' ); ?>" class="show-settings-link float-end btn btn-secondary btn-xs"><i class="fa-solid fa-gear"></i></a>
|
117 |
<?php } ?>
|
118 |
</div>
|
119 |
</div>
|
120 |
|
121 |
+
<?php echo wp_kses( $gmedia_pager, $gm_allowed_tags ); ?>
|
122 |
|
123 |
<div class="spinner"></div>
|
124 |
|
125 |
</div>
|
126 |
+
<div class="btn-toolbar gap-4 float-start" style="margin-bottom:7px;">
|
127 |
<div class="btn-group">
|
128 |
<?php if ( ! empty( $gmedia_filter ) ) { ?>
|
129 |
+
<a class="btn btn-warning" title="<?php esc_attr_e( 'Reset Filter', 'grand-media' ); ?>" rel="total" href="<?php echo esc_url( gm_get_admin_url( array(), array(), $gmedia_url ) ); ?>"><?php esc_html_e( 'Reset Filter', 'grand-media' ); ?></a>
|
130 |
<?php } else { ?>
|
131 |
+
<button type="button" class="btn btn-secondary" data-bs-toggle="dropdown"><?php esc_html_e( 'Filter', 'grand-media' ); ?></button>
|
132 |
<?php } ?>
|
133 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
134 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
135 |
</button>
|
136 |
<ul class="dropdown-menu" role="menu">
|
137 |
+
<li role="presentation" class="dropdown-header"><?php esc_html_e( 'FILTER BY AUTHOR', 'grand-media' ); ?></li>
|
138 |
<li class="gmedia_author<?php echo esc_attr( isset( $gmedia_filter['author'] ) ? ' active' : '' ); ?>">
|
139 |
+
<a class="dropdown-item gmedia-modal" href="#libModal" data-bs-toggle="modal" data-modal="filter_author" data-action="gmedia_get_modal"><?php esc_html_e( 'Choose authors', 'grand-media' ); ?></a>
|
140 |
</li>
|
141 |
+
<li role="presentation" class="dropdown-header"><?php esc_html_e( 'FILTER BY EVENT', 'grand-media' ); ?></li>
|
142 |
<li class="gmedia_event<?php echo esc_attr( ( isset( $gmedia_filter['log_event'] ) && 'view' === $gmedia_filter['log_event'] ) ? ' active' : '' ); ?>">
|
143 |
+
<a class="dropdown-item" href="<?php echo esc_url( add_query_arg( array( 'log_event' => 'view' ), $gmedia_url ) ); ?>"><?php esc_html_e( 'View / Play', 'grand-media' ); ?></a>
|
144 |
</li>
|
145 |
<li class="gmedia_event<?php echo esc_attr( ( isset( $gmedia_filter['log_event'] ) && 'like' === $gmedia_filter['log_event'] ) ? ' active' : '' ); ?>">
|
146 |
+
<a class="dropdown-item" href="<?php echo esc_url( add_query_arg( array( 'log_event' => 'like' ), $gmedia_url ) ); ?>"><?php esc_html_e( 'Like', 'grand-media' ); ?></a>
|
147 |
</li>
|
148 |
<li class="gmedia_event<?php echo esc_attr( ( isset( $gmedia_filter['log_event'] ) && 'rate' === $gmedia_filter['log_event'] ) ? ' active' : '' ); ?>">
|
149 |
+
<a class="dropdown-item" href="<?php echo esc_url( add_query_arg( array( 'log_event' => 'rate' ), $gmedia_url ) ); ?>"><?php esc_html_e( 'Rate', 'grand-media' ); ?></a>
|
150 |
</li>
|
151 |
</ul>
|
152 |
</div>
|
153 |
+
<a class="btn btn-danger float-start" href="<?php echo esc_url( wp_nonce_url( gm_get_admin_url( array( 'do_gmedia' => 'clear_logs' ), array(), $gmedia_url ), 'gmedia_clear_logs', '_wpnonce_clear_logs' ) ); ?>" data-confirm="<?php esc_attr_e( "You are about to clear all Gmedia logs.\n\r'Cancel' to stop, 'OK' to clear.", 'grand-media' ); ?>"><?php esc_html_e( 'Clear Logs', 'grand-media' ); ?></a>
|
154 |
|
155 |
</div>
|
156 |
|
157 |
</div>
|
158 |
+
<form class="card-body" id="gm-log-table" style="margin-bottom:4px;">
|
159 |
<?php
|
160 |
if ( empty( $gmGallery->options['license_key'] ) ) {
|
161 |
?>
|
162 |
+
<div class="alert alert-warning" role="alert"><strong><?php esc_html_e( 'It\'s a premium feature. Gmedia Logger requires License Key.' ); ?></strong></div>
|
163 |
<?php
|
164 |
} elseif ( ! empty( $gmGallery->options['disable_logs'] ) ) {
|
165 |
?>
|
166 |
+
<div class="alert alert-warning" role="alert"><strong><?php esc_html_e( 'Gmedia Logger is disabled in settings.' ); ?></strong></div>
|
167 |
<?php
|
168 |
}
|
169 |
?>
|
171 |
<table class="table table-condensed table-hover">
|
172 |
<thead>
|
173 |
<tr>
|
174 |
+
<th><?php esc_html_e( 'Media', 'grand-media' ); ?></th>
|
175 |
+
<th><?php esc_html_e( 'Info', 'grand-media' ); ?></th>
|
176 |
+
<th><?php esc_html_e( 'Log Date', 'grand-media' ); ?></th>
|
177 |
+
<th><?php esc_html_e( 'User / IP', 'grand-media' ); ?></th>
|
178 |
+
<th><?php esc_html_e( 'Event', 'grand-media' ); ?></th>
|
179 |
</tr>
|
180 |
</thead>
|
181 |
<tbody>
|
186 |
?>
|
187 |
<tr>
|
188 |
<td style="width:150px;">
|
189 |
+
<div class="img-thumbnail" style="margin-bottom: 0;">
|
190 |
<?php
|
191 |
$images = $gmCore->gm_get_media_image( $item, 'all' );
|
192 |
$thumb = '<img class="gmedia-thumb" src="' . $images['thumb'] . '" alt=""/>';
|
194 |
if ( ! empty( $images['icon'] ) ) {
|
195 |
$thumb .= '<img class="gmedia-typethumb" src="' . $images['icon'] . '" alt=""/>';
|
196 |
}
|
197 |
+
echo wp_kses_post( $thumb );
|
198 |
?>
|
199 |
</div>
|
200 |
</td>
|
201 |
<td>
|
202 |
+
<p class="media-meta"><span class="badge label-default">#<?php echo (int) $item->ID; ?>:</span> <b><?php echo esc_html( $item->title ); ?> </b></p>
|
203 |
<p class="media-meta">
|
204 |
+
<span class="badge label-default"><?php esc_html_e( 'Album', 'grand-media' ); ?>:</span>
|
205 |
<?php
|
206 |
if ( $item->album ) {
|
207 |
+
$terms_album = array();
|
208 |
foreach ( $item->album as $c ) {
|
209 |
+
$terms_album[] = $c->name;
|
210 |
}
|
211 |
$terms_album = join( ', ', $terms_album );
|
212 |
} else {
|
213 |
$terms_album = '—';
|
214 |
}
|
215 |
+
echo esc_html( $terms_album );
|
216 |
?>
|
217 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Category', 'grand-media' ); ?>:</span>
|
218 |
<?php
|
219 |
if ( $item->categories ) {
|
220 |
+
$terms_category = array();
|
221 |
foreach ( $item->categories as $c ) {
|
222 |
+
$terms_category[] = $c->name;
|
223 |
}
|
224 |
$terms_category = join( ', ', $terms_category );
|
225 |
} else {
|
226 |
$terms_category = __( 'Uncategorized', 'grand-media' );
|
227 |
}
|
228 |
+
echo esc_html( $terms_category );
|
229 |
?>
|
230 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Tags', 'grand-media' ); ?>:</span>
|
231 |
<?php
|
232 |
if ( $item->tags ) {
|
233 |
+
$terms_tag = array();
|
234 |
foreach ( $item->tags as $c ) {
|
235 |
+
$terms_tag[] = $c->name;
|
236 |
}
|
237 |
$terms_tag = join( ', ', $terms_tag );
|
238 |
} else {
|
239 |
$terms_tag = '—';
|
240 |
}
|
241 |
+
echo esc_html( $terms_tag );
|
242 |
?>
|
243 |
</p>
|
244 |
<p class="media-meta">
|
245 |
+
<span class="badge label-default"><?php esc_html_e( 'Views / Likes', 'grand-media' ); ?>:</span>
|
246 |
+
<?php echo ( isset( $item->meta['views'][0] ) ? (int) $item->meta['views'][0] : '0' ) . ' / ' . ( isset( $item->meta['likes'][0] ) ? (int) $item->meta['likes'][0] : '0' ); ?>
|
247 |
|
248 |
+
<?php
|
249 |
+
if ( isset( $item->meta['_rating'][0] ) ) {
|
250 |
+
$ratings = maybe_unserialize( $item->meta['_rating'][0] );
|
251 |
+
?>
|
252 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Rating', 'grand-media' ); ?>:</span> <?php echo esc_html( round( $ratings['value'], 2 ) . ' / ' . $ratings['votes'] ); ?>
|
253 |
<?php } ?>
|
254 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Type', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->mime_type ); ?>
|
255 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Filename', 'grand-media' ); ?>:</span> <a href="<?php echo esc_url( gm_get_admin_url( array( 'page' => 'GrandMedia', 'gmedia__in' => $item->ID ), array(), $gmedia_url ) ); ?>"><?php echo esc_html( $item->gmuid ); ?></a>
|
256 |
</p>
|
257 |
</td>
|
258 |
+
<td><p><?php echo esc_html( $item->log_date ); ?></p></td>
|
259 |
<td>
|
260 |
+
<p>
|
261 |
+
<?php
|
262 |
$author_name = $item->log_author ? get_user_option( 'display_name', $item->log_author ) : __( 'Guest', 'grand-media' );
|
263 |
+
printf( '<a class="gmedia-author" href="%s">%s</a>', esc_url( add_query_arg( array( 'author' => $item->log_author ), $gmedia_url ) ), esc_html( $author_name ) );
|
264 |
+
?>
|
265 |
+
</p>
|
266 |
+
<p class="media-meta"><span class="badge label-default"><?php esc_html_e( 'IP Address', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->ip_address ); ?></p>
|
267 |
</td>
|
268 |
+
<td><p>
|
269 |
+
<?php
|
270 |
switch ( $item->log ) {
|
271 |
case 'view':
|
272 |
+
esc_html_e( 'View / Play', 'grand-media' );
|
273 |
break;
|
274 |
case 'like':
|
275 |
+
esc_html_e( 'Like', 'grand-media' );
|
276 |
break;
|
277 |
case 'rate':
|
278 |
+
echo esc_html( __( 'Rate', 'grand-media' ) . ": {$item->log_data}" );
|
279 |
break;
|
280 |
}
|
281 |
+
?>
|
282 |
+
</p></td>
|
283 |
</tr>
|
284 |
<?php
|
285 |
}
|
286 |
} else {
|
287 |
+
echo '<tr><td colspan="5" style="font-weight: bold; text-align: center; padding: 30px 0;">' . esc_html__( 'No Records.', 'grand-media' ) . '</td></tr>';
|
288 |
}
|
289 |
?>
|
290 |
</tbody>
|
admin/pages/addmedia/addmedia.php
CHANGED
@@ -3,22 +3,19 @@
|
|
3 |
* Gmedia AddMedia
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
-
global $user_ID, $gmGallery, $gmProcessor, $gmCore, $gmDB;
|
12 |
|
13 |
$url = $gmProcessor->url;
|
14 |
$import = $gmProcessor->import;
|
15 |
?>
|
16 |
|
17 |
-
<div class="
|
18 |
|
19 |
-
<?php
|
20 |
|
21 |
-
<div class="
|
22 |
<div class="container-fluid gmAddMedia">
|
23 |
<?php
|
24 |
if ( ! $import ) {
|
3 |
* Gmedia AddMedia
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
+
global $user_ID, $gmGallery, $gmProcessor, $gmCore, $gmDB, $gm_allowed_tags;
|
9 |
|
10 |
$url = $gmProcessor->url;
|
11 |
$import = $gmProcessor->import;
|
12 |
?>
|
13 |
|
14 |
+
<div class="card m-0 mw-100 p-0">
|
15 |
|
16 |
+
<?php require dirname( __FILE__ ) . '/tpl/panel-heading.php'; ?>
|
17 |
|
18 |
+
<div class="card-body" id="gmedia-msg-panel"></div>
|
19 |
<div class="container-fluid gmAddMedia">
|
20 |
<?php
|
21 |
if ( ! $import ) {
|
admin/pages/addmedia/tpl/assign-terms.php
CHANGED
@@ -3,12 +3,10 @@
|
|
3 |
* @var $user_ID
|
4 |
* @var $gmGallery
|
5 |
* @var $gmDB
|
|
|
6 |
*/
|
7 |
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
die( '-1' );
|
11 |
-
}
|
12 |
|
13 |
if ( gm_user_can( 'terms' ) ) {
|
14 |
global $gmCore;
|
@@ -16,60 +14,61 @@ if ( gm_user_can( 'terms' ) ) {
|
|
16 |
<div class="form-group">
|
17 |
<?php
|
18 |
$term_type = 'gmedia_album';
|
19 |
-
$global = gm_user_can( 'edit_others_media' ) ? '' :
|
20 |
-
$gm_terms = $gmDB->get_terms( $term_type,
|
21 |
|
22 |
$terms_album = '';
|
23 |
if ( count( $gm_terms ) ) {
|
24 |
$selected = (int) $gmCore->_get( 'album' );
|
25 |
-
foreach ( $gm_terms as $
|
26 |
$author_name = '';
|
27 |
-
if ( $
|
28 |
if ( gm_user_can( 'edit_others_media' ) ) {
|
29 |
-
|
|
|
30 |
}
|
31 |
} else {
|
32 |
$author_name .= ' (' . __( 'shared', 'grand-media' ) . ')';
|
33 |
}
|
34 |
-
if ( 'publish' !== $
|
35 |
-
$author_name .= ' [' . $
|
36 |
}
|
37 |
-
$terms_album .= '<option value="' . $
|
38 |
}
|
39 |
}
|
40 |
?>
|
41 |
-
<label><?php
|
42 |
-
<select id="combobox_gmedia_album" name="terms[gmedia_album]" data-create="<?php echo esc_attr( gm_user_can( 'album_manage' ) ? 'true' : 'false' ); ?>" class="form-control input-sm" placeholder="<?php
|
43 |
<option value=""></option>
|
44 |
-
<?php echo $terms_album; ?>
|
45 |
</select>
|
46 |
</div>
|
47 |
|
48 |
<div class="form-group">
|
49 |
<?php
|
50 |
$term_type = 'gmedia_category';
|
51 |
-
$gm_category_terms = $gmDB->get_terms( $term_type,
|
52 |
$selected = (int) $gmCore->_get( 'category' );
|
53 |
$selected = isset( $gm_category_terms[ $selected ] ) ? $gm_category_terms[ $selected ] : '';
|
54 |
?>
|
55 |
-
<label><?php
|
56 |
-
<input id="combobox_gmedia_category" name="terms[gmedia_category]" data-create="<?php echo esc_attr( gm_user_can( 'category_manage' ) ? 'true' : 'false' ); ?>" class="form-control input-sm" value="<?php echo esc_attr( $selected ); ?>" placeholder="<?php
|
57 |
</div>
|
58 |
|
59 |
<div class="form-group">
|
60 |
<?php
|
61 |
$term_type = 'gmedia_tag';
|
62 |
-
$gm_tag_terms = $gmDB->get_terms( $term_type,
|
63 |
$selected = (int) $gmCore->_get( 'tag' );
|
64 |
$selected = isset( $gm_tag_terms[ $selected ] ) ? $gm_tag_terms[ $selected ] : '';
|
65 |
?>
|
66 |
-
<label><?php
|
67 |
-
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" data-create="<?php echo esc_attr( gm_user_can( 'tag_manage' ) ? 'true' : 'false' ); ?>" class="form-control input-sm" value="<?php echo esc_attr( $selected ); ?>" placeholder="<?php
|
68 |
</div>
|
69 |
<script type="text/javascript">
|
70 |
-
|
71 |
-
|
72 |
</script>
|
73 |
<?php } else { ?>
|
74 |
-
<p><?php
|
75 |
<?php } ?>
|
3 |
* @var $user_ID
|
4 |
* @var $gmGallery
|
5 |
* @var $gmDB
|
6 |
+
* @var $gm_allowed_tags
|
7 |
*/
|
8 |
|
9 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
10 |
|
11 |
if ( gm_user_can( 'terms' ) ) {
|
12 |
global $gmCore;
|
14 |
<div class="form-group">
|
15 |
<?php
|
16 |
$term_type = 'gmedia_album';
|
17 |
+
$global = gm_user_can( 'edit_others_media' ) ? '' : array( 0, $user_ID );
|
18 |
+
$gm_terms = $gmDB->get_terms( $term_type, array( 'global' => $global, 'orderby' => 'global_desc_name' ) );
|
19 |
|
20 |
$terms_album = '';
|
21 |
if ( count( $gm_terms ) ) {
|
22 |
$selected = (int) $gmCore->_get( 'album' );
|
23 |
+
foreach ( $gm_terms as $_term ) {
|
24 |
$author_name = '';
|
25 |
+
if ( $_term->global ) {
|
26 |
if ( gm_user_can( 'edit_others_media' ) ) {
|
27 |
+
// translators: author name.
|
28 |
+
$author_name .= ' ' . sprintf( esc_html__( 'by %s', 'grand-media' ), esc_html( get_the_author_meta( 'display_name', $_term->global ) ) );
|
29 |
}
|
30 |
} else {
|
31 |
$author_name .= ' (' . __( 'shared', 'grand-media' ) . ')';
|
32 |
}
|
33 |
+
if ( 'publish' !== $_term->status ) {
|
34 |
+
$author_name .= ' [' . $_term->status . ']';
|
35 |
}
|
36 |
+
$terms_album .= '<option value="' . intval( $_term->term_id ) . '" data-name="' . esc_attr( $_term->name ) . '" data-meta="' . esc_attr( $author_name ) . '" ' . selected( $selected, $_term->term_id, false ) . '>' . esc_html( $_term->name . $author_name ) . '</option>' . "\n";
|
37 |
}
|
38 |
}
|
39 |
?>
|
40 |
+
<label><?php esc_html_e( 'Add to Album', 'grand-media' ); ?> </label>
|
41 |
+
<select id="combobox_gmedia_album" name="terms[gmedia_album]" data-create="<?php echo esc_attr( gm_user_can( 'album_manage' ) ? 'true' : 'false' ); ?>" class="form-control input-sm" placeholder="<?php esc_attr_e( 'Album Name...', 'grand-media' ); ?>">
|
42 |
<option value=""></option>
|
43 |
+
<?php echo wp_kses( $terms_album, $gm_allowed_tags ); ?>
|
44 |
</select>
|
45 |
</div>
|
46 |
|
47 |
<div class="form-group">
|
48 |
<?php
|
49 |
$term_type = 'gmedia_category';
|
50 |
+
$gm_category_terms = $gmDB->get_terms( $term_type, array( 'fields' => 'id=>names' ) );
|
51 |
$selected = (int) $gmCore->_get( 'category' );
|
52 |
$selected = isset( $gm_category_terms[ $selected ] ) ? $gm_category_terms[ $selected ] : '';
|
53 |
?>
|
54 |
+
<label><?php esc_html_e( 'Assign Categories', 'grand-media' ); ?></label>
|
55 |
+
<input id="combobox_gmedia_category" name="terms[gmedia_category]" data-create="<?php echo esc_attr( gm_user_can( 'category_manage' ) ? 'true' : 'false' ); ?>" class="form-control input-sm" value="<?php echo esc_attr( $selected ); ?>" placeholder="<?php esc_attr_e( 'Uncategorized', 'grand-media' ); ?>"/>
|
56 |
</div>
|
57 |
|
58 |
<div class="form-group">
|
59 |
<?php
|
60 |
$term_type = 'gmedia_tag';
|
61 |
+
$gm_tag_terms = $gmDB->get_terms( $term_type, array( 'fields' => 'id=>names' ) );
|
62 |
$selected = (int) $gmCore->_get( 'tag' );
|
63 |
$selected = isset( $gm_tag_terms[ $selected ] ) ? $gm_tag_terms[ $selected ] : '';
|
64 |
?>
|
65 |
+
<label><?php esc_html_e( 'Add Tags', 'grand-media' ); ?> </label>
|
66 |
+
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" data-create="<?php echo esc_attr( gm_user_can( 'tag_manage' ) ? 'true' : 'false' ); ?>" class="form-control input-sm" value="<?php echo esc_attr( $selected ); ?>" placeholder="<?php esc_attr_e( 'Add Tags...', 'grand-media' ); ?>"/>
|
67 |
</div>
|
68 |
<script type="text/javascript">
|
69 |
+
var gmedia_categories = <?php echo wp_json_encode( array_values( $gm_category_terms ) ); ?>;
|
70 |
+
var gmedia_tags = <?php echo wp_json_encode( array_values( $gm_tag_terms ) ); ?>;
|
71 |
</script>
|
72 |
<?php } else { ?>
|
73 |
+
<p><?php esc_html_e( 'You are not allowed to assign terms', 'grand-media' ); ?></p>
|
74 |
<?php } ?>
|
admin/pages/addmedia/tpl/import.php
CHANGED
@@ -3,22 +3,19 @@
|
|
3 |
* Gmedia Import
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
if ( ! gm_user_can( 'upload' ) ) {
|
12 |
-
|
13 |
|
14 |
return;
|
15 |
}
|
16 |
|
17 |
global $wpdb;
|
18 |
|
19 |
-
$gmediaURL = plugins_url(
|
20 |
-
$gm_terms =
|
21 |
-
$import_tab =
|
22 |
?>
|
23 |
<form class="row" id="import_form" name="import_form" target="import_window" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="POST" accept-charset="utf-8" style="padding:20px 0 10px;">
|
24 |
<div class="col-md-4">
|
@@ -27,55 +24,58 @@ $import_tab = [];
|
|
27 |
<input type="hidden" name="action" value="gmedia_import_handler"/>
|
28 |
<input type="hidden" id="import-action" name="import" value=""/>
|
29 |
|
30 |
-
<?php
|
31 |
|
32 |
</fieldset>
|
33 |
</div>
|
34 |
|
35 |
<div class="col-md-8 tabable">
|
36 |
<ul class="nav nav-tabs" style="padding:0 10px;">
|
37 |
-
<li class="
|
38 |
<?php
|
39 |
-
|
40 |
-
|
|
|
|
|
41 |
<?php
|
42 |
}
|
43 |
-
|
44 |
-
|
|
|
|
|
45 |
<?php
|
46 |
-
}
|
|
|
47 |
</ul>
|
48 |
<div class="tab-content">
|
49 |
<fieldset id="import_folder" class="tab-pane active">
|
50 |
-
<?php echo "<style type='text/css'>@import url('{$gmediaURL}/assets/jqueryFileTree/jqueryFileTree.css');</style>\n"; ?>
|
51 |
-
<?php echo "<script type='text/javascript' src='{$gmediaURL}/assets/jqueryFileTree/jqueryFileTree.js'></script>\n"; ?>
|
52 |
<input type="hidden" id="folderpath" name="path" value="/"/>
|
53 |
|
54 |
<div class="tab-inside">
|
55 |
-
<h5><?php
|
56 |
|
57 |
<div id="file_browser"></div>
|
58 |
</div>
|
59 |
<div class="tab-footer">
|
60 |
-
<div class="checkbox
|
61 |
-
<div><label><input type="checkbox" name="delete_source" value="1"/> <?php
|
62 |
-
<div><label><input type="checkbox" name="skip_exists" value="skip"> <?php
|
63 |
-
<div class="help-block"><?php
|
64 |
</div>
|
65 |
-
<button class="
|
66 |
</div>
|
67 |
<script type="text/javascript">
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
</script>
|
80 |
</fieldset>
|
81 |
|
@@ -86,9 +86,9 @@ $import_tab = [];
|
|
86 |
if ( ! empty( $import_tab['flagallery'] ) ) {
|
87 |
?>
|
88 |
<div class="tab-inside">
|
89 |
-
<p><?php
|
90 |
-
<h5><?php
|
91 |
-
<small>(<a href="#toggle-flaggalery" class="gm-toggle-cb"><?php
|
92 |
</h5>
|
93 |
<div id="toggle-flaggalery">
|
94 |
<?php foreach ( $import_tab['flagallery'] as $gallery ) { ?>
|
@@ -101,14 +101,14 @@ $import_tab = [];
|
|
101 |
</div>
|
102 |
</div>
|
103 |
<div class="tab-footer">
|
104 |
-
<div class="checkbox
|
105 |
-
<label><input type="checkbox" name="skip_exists" value="skip"> <?php
|
106 |
-
<div class="help-block"><?php
|
107 |
</div>
|
108 |
-
<button class="
|
109 |
</div>
|
110 |
<?php } else { ?>
|
111 |
-
<p class="tab-inside"><?php
|
112 |
<?php } ?>
|
113 |
</fieldset>
|
114 |
<?php } ?>
|
@@ -120,9 +120,9 @@ $import_tab = [];
|
|
120 |
if ( ! empty( $import_tab['nextgen'] ) ) {
|
121 |
?>
|
122 |
<div class="tab-inside">
|
123 |
-
<p><?php
|
124 |
-
<h5><?php
|
125 |
-
<small>(<a href="#toggle-nextgen" class="gm-toggle-cb"><?php
|
126 |
</h5>
|
127 |
<div id="toggle-nextgen">
|
128 |
<?php foreach ( $import_tab['nextgen'] as $gallery ) { ?>
|
@@ -134,14 +134,14 @@ $import_tab = [];
|
|
134 |
</div>
|
135 |
</div>
|
136 |
<div class="tab-footer">
|
137 |
-
<div class="checkbox
|
138 |
-
<label><input type="checkbox" name="skip_exists" value="skip"> <?php
|
139 |
-
<div class="help-block"><?php
|
140 |
</div>
|
141 |
-
<button class="
|
142 |
</div>
|
143 |
<?php } else { ?>
|
144 |
-
<p class="tab-inside"><?php
|
145 |
<?php } ?>
|
146 |
</fieldset>
|
147 |
<?php } ?>
|
@@ -155,22 +155,22 @@ $import_tab = [];
|
|
155 |
<div class="modal-dialog">
|
156 |
<div class="modal-content">
|
157 |
<div class="modal-header">
|
158 |
-
<
|
159 |
-
<
|
160 |
</div>
|
161 |
<div class="modal-body">
|
162 |
<script type="text/javascript">
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
</script>
|
170 |
<iframe name="import_window" id="import_window" src="about:blank" width="100%" height="300" onload="gmedia_import_done()"></iframe>
|
171 |
</div>
|
172 |
<div class="modal-footer">
|
173 |
-
<button type="button" id="import-done" class="btn btn-primary" data-dismiss="modal" data-complete-text="<?php
|
174 |
</div>
|
175 |
</div>
|
176 |
</div>
|
3 |
* Gmedia Import
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
if ( ! gm_user_can( 'upload' ) ) {
|
9 |
+
esc_html_e( 'You do not have permissions to import media', 'grand-media' );
|
10 |
|
11 |
return;
|
12 |
}
|
13 |
|
14 |
global $wpdb;
|
15 |
|
16 |
+
$gmediaURL = plugins_url( '', dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) );
|
17 |
+
$gm_terms = array();
|
18 |
+
$import_tab = array();
|
19 |
?>
|
20 |
<form class="row" id="import_form" name="import_form" target="import_window" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="POST" accept-charset="utf-8" style="padding:20px 0 10px;">
|
21 |
<div class="col-md-4">
|
24 |
<input type="hidden" name="action" value="gmedia_import_handler"/>
|
25 |
<input type="hidden" id="import-action" name="import" value=""/>
|
26 |
|
27 |
+
<?php require dirname( __FILE__ ) . '/assign-terms.php'; ?>
|
28 |
|
29 |
</fieldset>
|
30 |
</div>
|
31 |
|
32 |
<div class="col-md-8 tabable">
|
33 |
<ul class="nav nav-tabs" style="padding:0 10px;">
|
34 |
+
<li class="nav-item m-0"><a class="nav-link active" href="#import_folder" data-bs-toggle="tab"><?php esc_html_e( 'Import Server Folder', 'grand-media' ); ?></a></li>
|
35 |
<?php
|
36 |
+
$import_tab['flagallery'] = $wpdb->get_var( "show tables like '{$wpdb->prefix}flag_gallery'" );
|
37 |
+
if ( $import_tab['flagallery'] ) {
|
38 |
+
?>
|
39 |
+
<li class="nav-item m-0"><a class="nav-link" href="#import_flagallery" data-bs-toggle="tab"><?php esc_html_e( 'FlAGallery plugin', 'grand-media' ); ?></a></li>
|
40 |
<?php
|
41 |
}
|
42 |
+
$import_tab['nextgen'] = $wpdb->get_var( "show tables like '{$wpdb->prefix}ngg_gallery'" );
|
43 |
+
if ( $import_tab['nextgen'] ) {
|
44 |
+
?>
|
45 |
+
<li class="nav-item m-0"><a class="nav-link" href="#import_nextgen" data-bs-toggle="tab"><?php esc_html_e( 'NextGen plugin', 'grand-media' ); ?></a></li>
|
46 |
<?php
|
47 |
+
}
|
48 |
+
?>
|
49 |
</ul>
|
50 |
<div class="tab-content">
|
51 |
<fieldset id="import_folder" class="tab-pane active">
|
|
|
|
|
52 |
<input type="hidden" id="folderpath" name="path" value="/"/>
|
53 |
|
54 |
<div class="tab-inside">
|
55 |
+
<h5><?php esc_html_e( 'Sever folders', 'grand-media' ); ?>:</h5>
|
56 |
|
57 |
<div id="file_browser"></div>
|
58 |
</div>
|
59 |
<div class="tab-footer">
|
60 |
+
<div class="checkbox float-start">
|
61 |
+
<div><label><input type="checkbox" name="delete_source" value="1"/> <?php esc_html_e( 'delete source files after importing', 'grand-media' ); ?></label></div>
|
62 |
+
<div><label><input type="checkbox" name="skip_exists" value="skip"> <?php esc_html_e( 'Skip if file with the same name already exists in Gmedia Library', 'grand-media' ); ?></label></div>
|
63 |
+
<div class="help-block"><?php esc_html_e( 'Note: duplicates will be skipped in any way (checked by file hash)' ); ?></div>
|
64 |
</div>
|
65 |
+
<button class="float-end btn btn-info gmedia-import" data-bs-toggle="modal" data-bs-target="#importModal" type="button" name="import-folder" value="true"><?php esc_html_e( 'Import folder', 'grand-media' ); ?></button>
|
66 |
</div>
|
67 |
<script type="text/javascript">
|
68 |
+
/* <![CDATA[ */
|
69 |
+
jQuery(document).ready(function() {
|
70 |
+
jQuery('#file_browser').fileTree({
|
71 |
+
script: ajaxurl + "?action=gmedia_ftp_browser&_wpnonce=<?php echo esc_js( wp_create_nonce( 'GmediaGallery' ) ); ?>",
|
72 |
+
root: '/',
|
73 |
+
loadMessage: "<?php esc_attr_e( 'loading...', 'grand-media' ); ?>",
|
74 |
+
}, function(path) {
|
75 |
+
jQuery('#folderpath').val(path);
|
76 |
+
});
|
77 |
+
});
|
78 |
+
/* ]]> */
|
79 |
</script>
|
80 |
</fieldset>
|
81 |
|
86 |
if ( ! empty( $import_tab['flagallery'] ) ) {
|
87 |
?>
|
88 |
<div class="tab-inside">
|
89 |
+
<p><?php esc_html_e( 'If Album is not specified, then gallery name will be used as Album', 'grand-media' ); ?></p>
|
90 |
+
<h5><?php esc_html_e( 'Flagallery Galleries', 'grand-media' ); ?>:
|
91 |
+
<small>(<a href="#toggle-flaggalery" class="gm-toggle-cb"><?php esc_html_e( 'Toggle checkboxes', 'grand-media' ); ?></a>)</small>
|
92 |
</h5>
|
93 |
<div id="toggle-flaggalery">
|
94 |
<?php foreach ( $import_tab['flagallery'] as $gallery ) { ?>
|
101 |
</div>
|
102 |
</div>
|
103 |
<div class="tab-footer">
|
104 |
+
<div class="checkbox float-start">
|
105 |
+
<label><input type="checkbox" name="skip_exists" value="skip"> <?php esc_html_e( 'Skip if file with the same name already exists in Gmedia Library', 'grand-media' ); ?></label>
|
106 |
+
<div class="help-block"><?php esc_html_e( 'Note: duplicates will be skipped in any way (checked by file hash)' ); ?></div>
|
107 |
</div>
|
108 |
+
<button class="float-end btn btn-info gmedia-import" data-bs-toggle="modal" data-bs-target="#importModal" type="button" name="import-flagallery" value="true"><?php esc_html_e( 'Import', 'grand-media' ); ?></button>
|
109 |
</div>
|
110 |
<?php } else { ?>
|
111 |
+
<p class="tab-inside"><?php esc_html_e( 'There are no created galleries in this plugin.', 'grand-media' ); ?></p>
|
112 |
<?php } ?>
|
113 |
</fieldset>
|
114 |
<?php } ?>
|
120 |
if ( ! empty( $import_tab['nextgen'] ) ) {
|
121 |
?>
|
122 |
<div class="tab-inside">
|
123 |
+
<p><?php esc_html_e( 'If Album is not specified, then gallery name will be used as Album', 'grand-media' ); ?></p>
|
124 |
+
<h5><?php esc_html_e( 'NextGen Galleries', 'grand-media' ); ?>:
|
125 |
+
<small>(<a href="#toggle-nextgen" class="gm-toggle-cb"><?php esc_html_e( 'Toggle checkboxes', 'grand-media' ); ?></a>)</small>
|
126 |
</h5>
|
127 |
<div id="toggle-nextgen">
|
128 |
<?php foreach ( $import_tab['nextgen'] as $gallery ) { ?>
|
134 |
</div>
|
135 |
</div>
|
136 |
<div class="tab-footer">
|
137 |
+
<div class="checkbox float-start">
|
138 |
+
<label><input type="checkbox" name="skip_exists" value="skip"> <?php esc_html_e( 'Skip if file with the same name already exists in Gmedia Library', 'grand-media' ); ?></label>
|
139 |
+
<div class="help-block"><?php esc_html_e( 'Note: duplicates will be skipped in any way (checked by file hash)' ); ?></div>
|
140 |
</div>
|
141 |
+
<button class="float-end btn btn-info gmedia-import" data-bs-toggle="modal" data-bs-target="#importModal" type="button" name="import-nextgen" value="true"><?php esc_html_e( 'Import', 'grand-media' ); ?></button>
|
142 |
</div>
|
143 |
<?php } else { ?>
|
144 |
+
<p class="tab-inside"><?php esc_html_e( 'There are no created galleries in this plugin.', 'grand-media' ); ?></p>
|
145 |
<?php } ?>
|
146 |
</fieldset>
|
147 |
<?php } ?>
|
155 |
<div class="modal-dialog">
|
156 |
<div class="modal-content">
|
157 |
<div class="modal-header">
|
158 |
+
<h4 class="modal-title"><?php esc_html_e( 'Import', 'grand-media' ); ?></h4>
|
159 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
160 |
</div>
|
161 |
<div class="modal-body">
|
162 |
<script type="text/javascript">
|
163 |
+
function gmedia_import_done() {
|
164 |
+
if (jQuery('#importModal').is(':visible')) {
|
165 |
+
var btn = jQuery('#import-done');
|
166 |
+
btn.text(btn.data('complete-text')).prop('disabled', false);
|
167 |
+
}
|
168 |
+
}
|
169 |
</script>
|
170 |
<iframe name="import_window" id="import_window" src="about:blank" width="100%" height="300" onload="gmedia_import_done()"></iframe>
|
171 |
</div>
|
172 |
<div class="modal-footer">
|
173 |
+
<button type="button" id="import-done" class="btn btn-primary" data-bs-dismiss="modal" data-complete-text="<?php esc_attr_e( 'Close', 'grand-media' ); ?>" disabled="disabled"><?php esc_html_e( 'Working...', 'grand-media' ); ?></button>
|
174 |
</div>
|
175 |
</div>
|
176 |
</div>
|
admin/pages/addmedia/tpl/panel-heading.php
CHANGED
@@ -1,41 +1,42 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* @var $url
|
9 |
* @var $import
|
10 |
*/
|
11 |
global $gmCore, $gmProcessor;
|
12 |
-
$extra_tools = ( $gmProcessor->gmediablank || ( defined( 'GMEDIA_IFRAME' ) && GMEDIA_IFRAME ) )
|
13 |
?>
|
14 |
-
<div class="
|
15 |
-
<?php
|
16 |
-
|
|
|
17 |
?>
|
18 |
-
<div class="btn-toolbar
|
19 |
-
<?php
|
20 |
-
|
|
|
21 |
?>
|
22 |
-
<a class="btn btn-
|
23 |
<?php
|
24 |
-
}
|
|
|
25 |
|
26 |
<div class="btn-group">
|
27 |
-
<a class="btn btn<?php echo ! $import ? '-primary active' : '-
|
28 |
<?php if ( gm_user_can( 'import' ) ) { ?>
|
29 |
-
<a class="btn btn<?php echo $import ? '-primary active' : '-
|
30 |
<?php } ?>
|
31 |
</div>
|
32 |
<?php if ( $import && gm_user_can( 'import' ) ) { ?>
|
33 |
-
<a class="btn btn-
|
34 |
<?php } ?>
|
35 |
</div>
|
36 |
<?php } ?>
|
37 |
-
<div id="total-progress-info" class="progress
|
38 |
-
<?php
|
|
|
39 |
if ( ! $import ) {
|
40 |
$msg = __( 'Add files to the upload queue and click the start button', 'grand-media' );
|
41 |
} else {
|
@@ -43,9 +44,9 @@ $extra_tools = ( $gmProcessor->gmediablank || ( defined( 'GMEDIA_IFRAME' ) && GM
|
|
43 |
}
|
44 |
?>
|
45 |
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0;">
|
46 |
-
<div style="padding: 2px 10px;"><?php echo $msg; ?></div>
|
47 |
</div>
|
48 |
-
<div style="padding: 2px 10px;"><?php echo $msg; ?></div>
|
49 |
</div>
|
50 |
<div class="spinner"></div>
|
51 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* @var $url
|
6 |
* @var $import
|
7 |
*/
|
8 |
global $gmCore, $gmProcessor;
|
9 |
+
$extra_tools = ! ( ( $gmProcessor->gmediablank || ( defined( 'GMEDIA_IFRAME' ) && GMEDIA_IFRAME ) ) );
|
10 |
?>
|
11 |
+
<div class="card-header bg-light clearfix">
|
12 |
+
<?php
|
13 |
+
if ( $extra_tools ) {
|
14 |
+
$refurl = strpos( wp_get_referer(), 'edit_term' ) ? wp_get_referer() : false;
|
15 |
?>
|
16 |
+
<div class="btn-toolbar gap-4 float-start" style="white-space:nowrap;">
|
17 |
+
<?php
|
18 |
+
if ( $refurl ) {
|
19 |
+
$referer = $gmCore->get_admin_url( array(), array(), $refurl );
|
20 |
?>
|
21 |
+
<a class="btn btn-secondary float-start" style="margin-right:20px;" href="<?php echo esc_url( $referer ); ?>"><?php esc_html_e( 'Go Back', 'grand-media' ); ?></a>
|
22 |
<?php
|
23 |
+
}
|
24 |
+
?>
|
25 |
|
26 |
<div class="btn-group">
|
27 |
+
<a class="btn btn<?php echo ! $import ? '-primary active' : '-secondary'; ?>" href="<?php echo esc_url( gm_get_admin_url( array(), array( 'import' ), $url ) ); ?>"><?php esc_html_e( 'Upload Files', 'grand-media' ); ?></a>
|
28 |
<?php if ( gm_user_can( 'import' ) ) { ?>
|
29 |
+
<a class="btn btn<?php echo $import ? '-primary active' : '-secondary'; ?>" href="<?php echo esc_url( gm_get_admin_url( array( 'import' => 1 ), array(), $url ) ); ?>"><?php esc_html_e( 'Import', 'grand-media' ); ?></a>
|
30 |
<?php } ?>
|
31 |
</div>
|
32 |
<?php if ( $import && gm_user_can( 'import' ) ) { ?>
|
33 |
+
<a class="btn btn-secondary" href="<?php echo esc_url( admin_url( 'admin.php?page=GrandMedia_WordpressLibrary' ) ); ?>"><?php esc_html_e( 'Import from WP Media Library', 'grand-media' ); ?></a>
|
34 |
<?php } ?>
|
35 |
</div>
|
36 |
<?php } ?>
|
37 |
+
<div id="total-progress-info" class="progress float-end h-auto">
|
38 |
+
<?php
|
39 |
+
$msg = '';
|
40 |
if ( ! $import ) {
|
41 |
$msg = __( 'Add files to the upload queue and click the start button', 'grand-media' );
|
42 |
} else {
|
44 |
}
|
45 |
?>
|
46 |
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0;">
|
47 |
+
<div style="padding: 2px 10px;"><?php echo esc_html( $msg ); ?></div>
|
48 |
</div>
|
49 |
+
<div style="padding: 2px 10px;"><?php echo esc_html( $msg ); ?></div>
|
50 |
</div>
|
51 |
<div class="spinner"></div>
|
52 |
</div>
|
admin/pages/addmedia/tpl/upload.php
CHANGED
@@ -7,13 +7,10 @@
|
|
7 |
* @var $gmCore
|
8 |
*/
|
9 |
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
-
die( '-1' );
|
13 |
-
}
|
14 |
|
15 |
if ( ! gm_user_can( 'upload' ) ) {
|
16 |
-
|
17 |
|
18 |
return;
|
19 |
}
|
@@ -25,143 +22,151 @@ $maxchunksize_mb = floor( $maxupsize_mb * 0.9 );
|
|
25 |
|
26 |
$screen_options = $gmProcessor->user_options;
|
27 |
|
28 |
-
$gm_terms =
|
29 |
|
30 |
?>
|
31 |
<form class="row" id="gmUpload" name="upload_form" method="POST" accept-charset="utf-8" onsubmit="return false;">
|
32 |
<div class="col-md-4" id="uploader_multipart_params">
|
33 |
<br/>
|
34 |
<?php if ( 'false' === $screen_options['uploader_chunking'] || ( 'html4' === $screen_options['uploader_runtime'] ) ) { ?>
|
35 |
-
<p class="clearfix text-
|
36 |
<?php } else { ?>
|
37 |
-
<p class="clearfix text-
|
38 |
-
<span class="
|
39 |
-
<span class="
|
40 |
</p>
|
41 |
<?php } ?>
|
42 |
|
43 |
-
<div class="form-group">
|
44 |
-
<label><?php
|
45 |
<select name="set_title" class="form-control input-sm">
|
46 |
-
<option value="exif"><?php
|
47 |
-
<option value="filename"><?php
|
48 |
-
<option value="empty"><?php
|
49 |
</select>
|
50 |
</div>
|
51 |
-
<div class="form-group">
|
52 |
-
<label><?php
|
53 |
<select name="set_status" class="form-control input-sm">
|
54 |
-
<option value="inherit"><?php
|
55 |
-
<option value="publish"><?php
|
56 |
-
<option value="private"><?php
|
57 |
-
<option value="draft"><?php
|
58 |
</select>
|
59 |
</div>
|
60 |
|
61 |
<hr/>
|
62 |
|
63 |
-
<?php
|
64 |
|
65 |
</div>
|
66 |
<div class="col-md-8" id="pluploadUploader">
|
67 |
-
<p><?php
|
68 |
<?php
|
69 |
$mime_types = get_allowed_mime_types( $user_ID );
|
70 |
-
$type_ext =
|
71 |
-
$filters =
|
72 |
foreach ( $mime_types as $ext => $mime ) {
|
73 |
-
$
|
74 |
-
$type_ext[ $
|
75 |
}
|
76 |
foreach ( $type_ext as $filter => $ext ) {
|
77 |
-
$filters[] =
|
78 |
'title' => $filter,
|
79 |
'extensions' => str_replace( '|', ',', implode( ',', $ext ) ),
|
80 |
-
|
81 |
}
|
82 |
?>
|
83 |
<script type="text/javascript">
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
$('#pluploadUploader').plupload({
|
88 |
-
<?php if('auto' !== $screen_options['uploader_runtime']){ ?>
|
89 |
-
runtimes: '<?php echo $screen_options['uploader_runtime']; ?>',
|
90 |
-
<?php } ?>
|
91 |
-
url: '<?php echo $gmCore->punyencode( admin_url( 'admin-ajax.php' ) ); ?>',
|
92 |
-
<?php if(( 'true' === $screen_options['uploader_urlstream_upload'] ) && ( 'html4' !== $screen_options['uploader_runtime'] )){ ?>
|
93 |
-
urlstream_upload: true,
|
94 |
-
multipart: false,
|
95 |
-
<?php } else{ ?>
|
96 |
-
multipart: true,
|
97 |
-
<?php } ?>
|
98 |
-
multipart_params: {action: 'gmedia_upload_handler', _wpnonce_upload: '<?php echo wp_create_nonce( 'gmedia_upload' ); ?>', params: ''},
|
99 |
-
<?php if('true' === $screen_options['uploader_chunking'] && ( 'html4' !== $screen_options['uploader_runtime'] )){ ?>
|
100 |
-
max_file_size: '2000Mb',
|
101 |
-
chunk_size: <?php echo min( $maxchunksize, $screen_options['uploader_chunk_size'] * 1024 * 1024 ); ?>,
|
102 |
-
<?php } else{ ?>
|
103 |
-
max_file_size: <?php echo $maxupsize; ?>,
|
104 |
-
<?php } ?>
|
105 |
-
max_retries: 2,
|
106 |
-
unique_names: false,
|
107 |
-
rename: true,
|
108 |
-
sortable: true,
|
109 |
-
dragdrop: true,
|
110 |
-
views: {
|
111 |
-
list: true,
|
112 |
-
thumbs: true,
|
113 |
-
active: 'thumbs'
|
114 |
-
},
|
115 |
-
filters: <?php echo wp_json_encode( $filters ); ?>,
|
116 |
-
flash_swf_url: '<?php echo $gmCore->punyencode( $gmCore->gmedia_url ); ?>/assets/plupload/Moxie.swf',
|
117 |
-
silverlight_xap_url: '<?php echo $gmCore->punyencode( $gmCore->gmedia_url ); ?>/assets/plupload/Moxie.xap'
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
-
|
|
|
165 |
</script>
|
166 |
</div>
|
167 |
</form>
|
7 |
* @var $gmCore
|
8 |
*/
|
9 |
|
10 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
11 |
|
12 |
if ( ! gm_user_can( 'upload' ) ) {
|
13 |
+
esc_html_e( 'You do not have permissions to upload media', 'grand-media' );
|
14 |
|
15 |
return;
|
16 |
}
|
22 |
|
23 |
$screen_options = $gmProcessor->user_options;
|
24 |
|
25 |
+
$gm_terms = array();
|
26 |
|
27 |
?>
|
28 |
<form class="row" id="gmUpload" name="upload_form" method="POST" accept-charset="utf-8" onsubmit="return false;">
|
29 |
<div class="col-md-4" id="uploader_multipart_params">
|
30 |
<br/>
|
31 |
<?php if ( 'false' === $screen_options['uploader_chunking'] || ( 'html4' === $screen_options['uploader_runtime'] ) ) { ?>
|
32 |
+
<p class="clearfix text-end"><span class="badge label-default"><?php echo esc_html( __( 'Maximum file size', 'grand-media' ) . ": {$maxupsize_mb}Mb" ); ?></span></p>
|
33 |
<?php } else { ?>
|
34 |
+
<p class="clearfix text-end hidden">
|
35 |
+
<span class="badge label-default"><?php echo esc_html( __( 'Maximum $_POST size', 'grand-media' ) . ": {$maxupsize_mb}Mb" ); ?></span>
|
36 |
+
<span class="badge label-default"><?php echo esc_html( __( 'Chunk size', 'grand-media' ) . ': ' . min( $maxchunksize_mb, $screen_options['uploader_chunk_size'] ) . 'Mb' ); ?></span>
|
37 |
</p>
|
38 |
<?php } ?>
|
39 |
|
40 |
+
<div class="form-group form-group-xs">
|
41 |
+
<label><?php esc_html_e( 'Title', 'grand-media' ); ?></label>
|
42 |
<select name="set_title" class="form-control input-sm">
|
43 |
+
<option value="exif"><?php esc_html_e( 'EXIF or File Name', 'grand-media' ); ?></option>
|
44 |
+
<option value="filename"><?php esc_html_e( 'File Name', 'grand-media' ); ?></option>
|
45 |
+
<option value="empty"><?php esc_html_e( 'Empty', 'grand-media' ); ?></option>
|
46 |
</select>
|
47 |
</div>
|
48 |
+
<div class="form-group form-group-xs">
|
49 |
+
<label><?php esc_html_e( 'Status', 'grand-media' ); ?></label>
|
50 |
<select name="set_status" class="form-control input-sm">
|
51 |
+
<option value="inherit"><?php esc_html_e( 'Same as Album or Public', 'grand-media' ); ?></option>
|
52 |
+
<option value="publish"><?php esc_html_e( 'Public', 'grand-media' ); ?></option>
|
53 |
+
<option value="private"><?php esc_html_e( 'Private', 'grand-media' ); ?></option>
|
54 |
+
<option value="draft"><?php esc_html_e( 'Draft', 'grand-media' ); ?></option>
|
55 |
</select>
|
56 |
</div>
|
57 |
|
58 |
<hr/>
|
59 |
|
60 |
+
<?php require dirname( __FILE__ ) . '/assign-terms.php'; ?>
|
61 |
|
62 |
</div>
|
63 |
<div class="col-md-8" id="pluploadUploader">
|
64 |
+
<p><?php esc_html_e( "You browser doesn't have Flash or HTML5 support. Check also if page have no JavaScript errors.", 'grand-media' ); ?></p>
|
65 |
<?php
|
66 |
$mime_types = get_allowed_mime_types( $user_ID );
|
67 |
+
$type_ext = array();
|
68 |
+
$filters = array();
|
69 |
foreach ( $mime_types as $ext => $mime ) {
|
70 |
+
$_type = strtok( $mime, '/' );
|
71 |
+
$type_ext[ $_type ][] = $ext;
|
72 |
}
|
73 |
foreach ( $type_ext as $filter => $ext ) {
|
74 |
+
$filters[] = array(
|
75 |
'title' => $filter,
|
76 |
'extensions' => str_replace( '|', ',', implode( ',', $ext ) ),
|
77 |
+
);
|
78 |
}
|
79 |
?>
|
80 |
<script type="text/javascript">
|
81 |
+
// Convert divs to queue widgets when the DOM is ready
|
82 |
+
var gmedia_uploader;
|
83 |
+
jQuery(function($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
+
function gmediaInitUploader() {
|
86 |
+
//noinspection JSDuplicatedDeclaration
|
87 |
+
$('#pluploadUploader').pluploadQueue({
|
88 |
+
<?php if ( 'auto' !== $screen_options['uploader_runtime'] ) { ?>
|
89 |
+
runtimes: '<?php echo esc_js( $screen_options['uploader_runtime'] ); ?>',
|
90 |
+
<?php } ?>
|
91 |
+
url: '<?php echo esc_js( $gmCore->punyencode( admin_url( 'admin-ajax.php' ) ) ); ?>',
|
92 |
+
<?php if ( ( 'true' === $screen_options['uploader_urlstream_upload'] ) && ( 'html4' !== $screen_options['uploader_runtime'] ) ) { ?>
|
93 |
+
urlstream_upload: true,
|
94 |
+
multipart: false,
|
95 |
+
<?php } else { ?>
|
96 |
+
multipart: true,
|
97 |
+
<?php } ?>
|
98 |
+
multipart_params: {action: 'gmedia_upload_handler', _wpnonce_upload: '<?php echo esc_attr( wp_create_nonce( 'gmedia_upload' ) ); ?>', params: ''},
|
99 |
+
<?php if ( 'true' === $screen_options['uploader_chunking'] && ( 'html4' !== $screen_options['uploader_runtime'] ) ) { ?>
|
100 |
+
max_file_size: '2000Mb',
|
101 |
+
chunk_size: <?php echo esc_js( min( $maxchunksize, $screen_options['uploader_chunk_size'] * 1024 * 1024 ) ); ?>,
|
102 |
+
<?php } else { ?>
|
103 |
+
max_file_size: <?php echo esc_js( $maxupsize ); ?>,
|
104 |
+
<?php } ?>
|
105 |
+
max_retries: 2,
|
106 |
+
unique_names: false,
|
107 |
+
rename: true,
|
108 |
+
sortable: true,
|
109 |
+
dragdrop: true,
|
110 |
+
views: {
|
111 |
+
list: false,
|
112 |
+
thumbs: true,
|
113 |
+
active: 'thumbs',
|
114 |
+
},
|
115 |
+
filters: <?php echo wp_json_encode( $filters ); ?>
|
116 |
+
});
|
117 |
+
var closebtn = '<button type="button" class="btn-close m-0 float-end" data-bs-dismiss="alert" aria-label="Close"></button>';
|
118 |
+
var resetbtn = '<a href="#" class="plupload_reset" style="display: inline-block;"><i class="fa-solid fa-arrow-rotate-right"></i></a>';
|
119 |
+
gmedia_uploader = $('#pluploadUploader').pluploadQueue();
|
120 |
+
gmedia_uploader.bind('PostInit', function(up) {
|
121 |
+
$('.plupload_filelist_footer .plupload_file_action').html(resetbtn).on('click', '.plupload_reset', function(e) {
|
122 |
+
e.preventDefault();
|
123 |
+
up.removeAllEventListeners();
|
124 |
+
up.destroy();
|
125 |
+
gmediaInitUploader();
|
126 |
+
});
|
127 |
+
});
|
128 |
+
gmedia_uploader.bind('BeforeUpload', function(up, file) {
|
129 |
+
up.settings.multipart_params.params = jQuery('#uploader_multipart_params :input').serialize();
|
130 |
+
});
|
131 |
+
gmedia_uploader.bind('ChunkUploaded', function(up, file, info) {
|
132 |
+
//console.log('[ChunkUploaded] File:', file, "Info:", info);
|
133 |
+
var response = jQuery.parseJSON(info.response);
|
134 |
+
if (response && response.error) {
|
135 |
+
up.stop();
|
136 |
+
file.status = plupload.FAILED;
|
137 |
+
//jQuery('<div/>').addClass('alert alert-danger alert-dismissable').html(closebtn + '<strong>' + response.id + ':</strong> ' + response.error.message).appendTo('#gmedia-msg-panel');
|
138 |
+
console.log('[ChunkUploaded] ', response.error);
|
139 |
+
up.trigger('QueueChanged StateChanged');
|
140 |
+
up.trigger('UploadProgress', file);
|
141 |
+
up.start();
|
142 |
+
}
|
143 |
+
});
|
144 |
+
gmedia_uploader.bind('FileUploaded', function(up, file, info) {
|
145 |
+
//console.log('[FileUploaded] File:', file, "Info:", info);
|
146 |
+
var response = jQuery.parseJSON(info.response);
|
147 |
+
if (response && response.error) {
|
148 |
+
file.status = plupload.FAILED;
|
149 |
+
jQuery('<div></div>').addClass('alert alert-danger alert-dismissable').html(closebtn + '<strong>' + response.id + ':</strong> ' + response.error.message).appendTo('#gm-message');
|
150 |
+
console.log('[FileUploaded] ', response.error);
|
151 |
+
}
|
152 |
+
});
|
153 |
+
gmedia_uploader.bind('UploadProgress', function(up, file) {
|
154 |
+
var percent = gmedia_uploader.total.percent;
|
155 |
+
$('#total-progress-info .progress-bar').css('width', percent + '%').attr('aria-valuenow', percent);
|
156 |
+
});
|
157 |
+
gmedia_uploader.bind('Error', function(up, args) {
|
158 |
+
console.log('[Error] ', args);
|
159 |
+
jQuery('<div></div>').addClass('alert alert-danger alert-dismissable').html(closebtn + '<strong>' + args.file.name + ':</strong> ' + args.message + ' ' + args.status).appendTo('#gm-message');
|
160 |
+
});
|
161 |
+
gmedia_uploader.bind('UploadComplete', function(up, files) {
|
162 |
+
console.log('[UploadComplete]', files);
|
163 |
+
$('<div></div>').addClass('alert alert-success alert-dismissable').html(closebtn + "<?php esc_attr_e( 'Upload finished', 'grand-media' ); ?>").appendTo('#gm-message');
|
164 |
+
$('#total-progress-info .progress-bar').css('width', '0').attr('aria-valuenow', '0');
|
165 |
+
});
|
166 |
+
}
|
167 |
|
168 |
+
gmediaInitUploader();
|
169 |
+
});
|
170 |
</script>
|
171 |
</div>
|
172 |
</form>
|
admin/pages/galleries/edit-gallery.php
CHANGED
@@ -3,15 +3,12 @@
|
|
3 |
* Gmedia Gallery Edit
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
12 |
|
13 |
$term_id = $gmCore->_get( 'edit_term' );
|
14 |
-
$gmedia_url = add_query_arg(
|
15 |
$gmedia_user_options = $gmProcessor->user_options;
|
16 |
$gmedia_term_taxonomy = $gmProcessor->taxonomy;
|
17 |
$taxterm = $gmProcessor->taxterm;
|
@@ -31,11 +28,11 @@ gmedia_gallery_more_data( $term );
|
|
31 |
|
32 |
$gmedia_modules = get_gmedia_modules( false );
|
33 |
|
34 |
-
$default_options =
|
35 |
$presets = false;
|
36 |
-
$default_preset =
|
37 |
-
$load_preset =
|
38 |
-
$global_preset =
|
39 |
|
40 |
$gmedia_filter = gmedia_gallery_query_data( $term->meta['_query'] );
|
41 |
|
@@ -43,7 +40,7 @@ $gmedia_filter = gmedia_gallery_query_data( $term->meta['_query'] );
|
|
43 |
* @var $module_path
|
44 |
*/
|
45 |
if ( $term->module['name'] ) {
|
46 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
47 |
foreach ( $presets as $i => $preset ) {
|
48 |
if ( '[' . $term->module['name'] . ']' === $preset->name ) {
|
49 |
if ( 0 === (int) $preset->global ) {
|
@@ -86,22 +83,25 @@ if ( $term->module['name'] ) {
|
|
86 |
$default_options = $gmCore->array_replace_recursive( $default_options, $default_preset );
|
87 |
}
|
88 |
} else {
|
89 |
-
|
|
|
90 |
}
|
91 |
} else {
|
92 |
-
|
|
|
93 |
}
|
94 |
} else {
|
95 |
-
$alert[] =
|
96 |
}
|
97 |
|
98 |
if ( ! empty( $alert ) ) {
|
99 |
-
echo $gmCore->alert( 'danger', $alert );
|
100 |
}
|
101 |
|
102 |
if ( ! empty( $load_preset ) ) {
|
103 |
$term->meta['_settings'][ $term->module['name'] ] = $gmCore->array_replace_recursive( $term->meta['_settings'][ $term->module['name'] ], $load_preset );
|
104 |
-
|
|
|
105 |
}
|
106 |
if ( ! empty( $term->meta['_settings'][ $term->module['name'] ] ) ) {
|
107 |
$gallery_settings = $gmCore->array_replace_recursive( $default_options, $term->meta['_settings'][ $term->module['name'] ] );
|
@@ -110,7 +110,7 @@ if ( ! empty( $term->meta['_settings'][ $term->module['name'] ] ) ) {
|
|
110 |
}
|
111 |
|
112 |
/** @noinspection PhpIncludeInspection */
|
113 |
-
|
114 |
|
115 |
$reset_settings = $gmCore->array_diff_keyval_recursive( $default_options, $gallery_settings, true );
|
116 |
|
@@ -118,20 +118,20 @@ do_action( 'gmedia_gallery_before_panel' );
|
|
118 |
?>
|
119 |
|
120 |
<?php
|
121 |
-
$limitation = empty( $gmGallery->options['license_key'] ) && in_array( $term->module['name'],
|
122 |
if ( $limitation ) {
|
123 |
?>
|
124 |
-
<div style="overflow:hidden; margin-bottom: 6px; padding: 10px; background-color: #fff; border: 1px solid red; border-radius: 5px; font-size: 14px; font-weight: bold;"><?php
|
125 |
<?php
|
126 |
}
|
127 |
?>
|
128 |
|
129 |
-
<div class="
|
130 |
|
131 |
<?php
|
132 |
-
|
133 |
|
134 |
-
|
135 |
?>
|
136 |
|
137 |
</div>
|
@@ -140,18 +140,18 @@ if ( $limitation ) {
|
|
140 |
do_action( "gmedia_term_{$taxterm}_after_panel", $term );
|
141 |
do_action( 'gmedia_gallery_after_panel' );
|
142 |
|
143 |
-
|
144 |
-
|
145 |
?>
|
146 |
<div class="modal fade gmedia-modal" id="previewModal" tabindex="-1" role="dialog" aria-hidden="true">
|
147 |
<div class="modal-dialog">
|
148 |
<div class="modal-content">
|
149 |
<div class="modal-header">
|
150 |
-
<div class="btn-toolbar pull-right" style="margin-top:-4px;">
|
151 |
-
<button type="button" class="btn btn-primary"><?php _e( 'Submit', 'grand-media' ); ?></button>
|
152 |
-
<button type="button" class="btn btn-default" data-dismiss="modal"><?php _e( 'Close', 'grand-media' ); ?></button>
|
153 |
-
</div>
|
154 |
<h4 class="modal-title"></h4>
|
|
|
|
|
|
|
|
|
155 |
</div>
|
156 |
<div class="modal-body"></div>
|
157 |
</div>
|
3 |
* Gmedia Gallery Edit
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
9 |
|
10 |
$term_id = $gmCore->_get( 'edit_term' );
|
11 |
+
$gmedia_url = add_query_arg( array( 'edit_term' => $term_id ), $gmProcessor->url );
|
12 |
$gmedia_user_options = $gmProcessor->user_options;
|
13 |
$gmedia_term_taxonomy = $gmProcessor->taxonomy;
|
14 |
$taxterm = $gmProcessor->taxterm;
|
28 |
|
29 |
$gmedia_modules = get_gmedia_modules( false );
|
30 |
|
31 |
+
$default_options = array();
|
32 |
$presets = false;
|
33 |
+
$default_preset = array();
|
34 |
+
$load_preset = array();
|
35 |
+
$global_preset = array();
|
36 |
|
37 |
$gmedia_filter = gmedia_gallery_query_data( $term->meta['_query'] );
|
38 |
|
40 |
* @var $module_path
|
41 |
*/
|
42 |
if ( $term->module['name'] ) {
|
43 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $term->module['name'] ) );
|
44 |
foreach ( $presets as $i => $preset ) {
|
45 |
if ( '[' . $term->module['name'] . ']' === $preset->name ) {
|
46 |
if ( 0 === (int) $preset->global ) {
|
83 |
$default_options = $gmCore->array_replace_recursive( $default_options, $default_preset );
|
84 |
}
|
85 |
} else {
|
86 |
+
// translators: module name.
|
87 |
+
$alert[] = sprintf( esc_html__( 'Module `%s` is broken. Choose another module from the list.' ), esc_html( $term->module['name'] ) );
|
88 |
}
|
89 |
} else {
|
90 |
+
// translators: module name.
|
91 |
+
$alert[] = sprintf( esc_html__( 'Can\'t get module with name `%s`. Choose module from the list.' ), esc_html( $term->module['name'] ) );
|
92 |
}
|
93 |
} else {
|
94 |
+
$alert[] = esc_html__( 'Module is not selected for this gallery. Choose module from the list.' );
|
95 |
}
|
96 |
|
97 |
if ( ! empty( $alert ) ) {
|
98 |
+
echo wp_kses_post( $gmCore->alert( 'danger', $alert ) );
|
99 |
}
|
100 |
|
101 |
if ( ! empty( $load_preset ) ) {
|
102 |
$term->meta['_settings'][ $term->module['name'] ] = $gmCore->array_replace_recursive( $term->meta['_settings'][ $term->module['name'] ], $load_preset );
|
103 |
+
// translators: presert name.
|
104 |
+
echo wp_kses_post( $gmCore->alert( 'info', sprintf( esc_html__( 'Preset `%s` loaded. To apply it for current gallery click Save button' ), esc_html( $load_preset['name'] ) ) ) );
|
105 |
}
|
106 |
if ( ! empty( $term->meta['_settings'][ $term->module['name'] ] ) ) {
|
107 |
$gallery_settings = $gmCore->array_replace_recursive( $default_options, $term->meta['_settings'][ $term->module['name'] ] );
|
110 |
}
|
111 |
|
112 |
/** @noinspection PhpIncludeInspection */
|
113 |
+
require_once GMEDIA_ABSPATH . 'inc/module.options.php';
|
114 |
|
115 |
$reset_settings = $gmCore->array_diff_keyval_recursive( $default_options, $gallery_settings, true );
|
116 |
|
118 |
?>
|
119 |
|
120 |
<?php
|
121 |
+
$limitation = empty( $gmGallery->options['license_key'] ) && in_array( $term->module['name'], array( 'amron', 'phantom', 'cubik-lite', 'photomania', 'wp-videoplayer', 'jq-mplayer', 'minima' ), true );
|
122 |
if ( $limitation ) {
|
123 |
?>
|
124 |
+
<div style="overflow:hidden; margin-bottom: 6px; padding: 10px; background-color: #fff; border: 1px solid red; border-radius: 5px; font-size: 14px; font-weight: bold;"><?php echo wp_kses_post( __( 'Note: Free version allows you to show maximum 40 images per gallery on the frontend. Purchase license key <a href="https://codeasily.com/gmedia-premium/" target="_blank">here</a>. It\'s a one time payment.', 'grand-media' ) ); ?></div>
|
125 |
<?php
|
126 |
}
|
127 |
?>
|
128 |
|
129 |
+
<div class="card m-0 mw-100 p-0 panel-fixed-header">
|
130 |
|
131 |
<?php
|
132 |
+
require dirname( __FILE__ ) . '/tpl/gallery-panel-heading.php';
|
133 |
|
134 |
+
require dirname( __FILE__ ) . "/tpl/{$taxterm}-edit-item.php";
|
135 |
?>
|
136 |
|
137 |
</div>
|
140 |
do_action( "gmedia_term_{$taxterm}_after_panel", $term );
|
141 |
do_action( 'gmedia_gallery_after_panel' );
|
142 |
|
143 |
+
require dirname( __FILE__ ) . '/tpl/choose-module.php';
|
144 |
+
require GMEDIA_ABSPATH . 'admin/tpl/modal-share.php';
|
145 |
?>
|
146 |
<div class="modal fade gmedia-modal" id="previewModal" tabindex="-1" role="dialog" aria-hidden="true">
|
147 |
<div class="modal-dialog">
|
148 |
<div class="modal-content">
|
149 |
<div class="modal-header">
|
|
|
|
|
|
|
|
|
150 |
<h4 class="modal-title"></h4>
|
151 |
+
<div class="btn-toolbar gap-4 float-end" style="margin-top:-4px;">
|
152 |
+
<button type="button" class="btn btn-primary"><?php esc_html_e( 'Submit', 'grand-media' ); ?></button>
|
153 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
154 |
+
</div>
|
155 |
</div>
|
156 |
<div class="modal-body"></div>
|
157 |
</div>
|
admin/pages/galleries/functions.php
CHANGED
@@ -3,31 +3,31 @@
|
|
3 |
function gmedia_gallery_actions( $item ) {
|
4 |
global $gmCore, $gmProcessor;
|
5 |
|
6 |
-
$actions =
|
7 |
|
8 |
-
$filter_href = $gmCore->get_admin_url(
|
9 |
$filter_class = 'gm_filter_in_lib';
|
10 |
-
$actions['filter'] = '<a title="' .
|
11 |
|
12 |
-
$share_icon = '<
|
13 |
if ( 'draft' !== $item->status ) {
|
14 |
-
$actions['share'] = '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="share-modal" title="' .
|
15 |
} else {
|
16 |
-
$actions['share'] =
|
17 |
}
|
18 |
|
19 |
-
$edit_icon = '<
|
20 |
if ( $item->allow_edit ) {
|
21 |
-
$actions['edit'] = '<a title="' .
|
22 |
} else {
|
23 |
-
$actions['edit'] =
|
24 |
}
|
25 |
|
26 |
-
$trash_icon = '<
|
27 |
if ( $item->allow_delete ) {
|
28 |
-
$actions['delete'] = '<a class="trash-icon" title="' .
|
29 |
} else {
|
30 |
-
$actions['delete'] =
|
31 |
}
|
32 |
|
33 |
return apply_filters( 'gmedia_gallery_actions', $actions );
|
3 |
function gmedia_gallery_actions( $item ) {
|
4 |
global $gmCore, $gmProcessor;
|
5 |
|
6 |
+
$actions = array();
|
7 |
|
8 |
+
$filter_href = $gmCore->get_admin_url( array( 'page' => 'GrandMedia', 'gallery' => $item->term_id ), array(), true );
|
9 |
$filter_class = 'gm_filter_in_lib';
|
10 |
+
$actions['filter'] = '<a title="' . esc_attr__( 'Filter in Gmedia Library', 'grand-media' ) . '" href="' . esc_url( $filter_href ) . '" class="' . esc_attr( $filter_class ) . '"><i class="fa-solid fa-filter"></i></a>';
|
11 |
|
12 |
+
$share_icon = '<i class="fa-solid fa-share-from-square"></i>';
|
13 |
if ( 'draft' !== $item->status ) {
|
14 |
+
$actions['share'] = '<a target="_blank" data-bs-toggle="modal" data-bs-target="#shareModal" data-share="' . esc_attr( $item->term_id ) . '" class="share-modal" title="' . esc_attr__( 'Share', 'grand-media' ) . '" data-gmediacloud="' . esc_url( $item->cloud_link ) . '" href="' . esc_url( $item->post_link ) . '">' . $share_icon . '</a>';
|
15 |
} else {
|
16 |
+
$actions['share'] = '<span class="action-inactive">' . $share_icon . '</span>';
|
17 |
}
|
18 |
|
19 |
+
$edit_icon = '<i class="fa-solid fa-pen-to-square"></i>';
|
20 |
if ( $item->allow_edit ) {
|
21 |
+
$actions['edit'] = '<a title="' . esc_attr__( 'Edit', 'grand-media' ) . '" href="' . esc_url( add_query_arg( array( 'edit_term' => $item->term_id ), $gmProcessor->url ) ) . '">' . $edit_icon . '</a>';
|
22 |
} else {
|
23 |
+
$actions['edit'] = '<span class="action-inactive">' . $edit_icon . '</span>';
|
24 |
}
|
25 |
|
26 |
+
$trash_icon = '<i class="fa-solid fa-trash-can"></i>';
|
27 |
if ( $item->allow_delete ) {
|
28 |
+
$actions['delete'] = '<a class="trash-icon" title="' . esc_attr__( 'Delete', 'grand-media' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'do_gmedia_terms' => 'delete', 'ids' => $item->term_id ), $gmProcessor->url ), 'gmedia_delete', '_wpnonce_delete' ) ) . '" data-confirm="' . esc_attr__( "You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ) . '">' . $trash_icon . '</a>';
|
29 |
} else {
|
30 |
+
$actions['delete'] = '<span class="action-inactive">' . $trash_icon . '</span>';
|
31 |
}
|
32 |
|
33 |
return apply_filters( 'gmedia_gallery_actions', $actions );
|
admin/pages/galleries/galleries.php
CHANGED
@@ -3,12 +3,9 @@
|
|
3 |
* Gmedia Terms
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
-
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
12 |
|
13 |
$gmedia_url = $gmProcessor->url;
|
14 |
$gmedia_user_options = $gmProcessor->user_options;
|
@@ -20,22 +17,24 @@ $gmedia_terms_pager = $gmDB->query_pager();
|
|
20 |
$gmedia_modules = get_gmedia_modules( false );
|
21 |
|
22 |
?>
|
23 |
-
<div class="
|
24 |
|
25 |
<?php
|
26 |
-
|
27 |
|
28 |
do_action( 'gmedia_before_galleries_list' );
|
29 |
?>
|
30 |
|
31 |
-
<form class="list-group <?php echo $gmedia_term_taxonomy; ?>" id="gm-list-table" style="margin-bottom:4px;">
|
32 |
<?php
|
|
|
|
|
33 |
$taxterm = $gmProcessor->taxterm;
|
34 |
if ( count( $gmedia_terms ) ) {
|
35 |
foreach ( $gmedia_terms as &$item ) {
|
36 |
gmedia_gallery_more_data( $item );
|
37 |
|
38 |
-
$item->classes =
|
39 |
if ( 'publish' !== $item->status ) {
|
40 |
if ( 'private' === $item->status ) {
|
41 |
$item->classes[] = 'list-group-item-info';
|
@@ -55,8 +54,6 @@ $gmedia_modules = get_gmedia_modules( false );
|
|
55 |
} else {
|
56 |
include GMEDIA_ABSPATH . 'admin/pages/terms/tpl/no-items.php';
|
57 |
}
|
58 |
-
wp_original_referer_field( true, 'previous' );
|
59 |
-
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
60 |
?>
|
61 |
</form>
|
62 |
<?php
|
@@ -65,5 +62,5 @@ $gmedia_modules = get_gmedia_modules( false );
|
|
65 |
</div>
|
66 |
|
67 |
<?php
|
68 |
-
|
69 |
-
|
3 |
* Gmedia Terms
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
+
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor, $gm_allowed_tags;
|
9 |
|
10 |
$gmedia_url = $gmProcessor->url;
|
11 |
$gmedia_user_options = $gmProcessor->user_options;
|
17 |
$gmedia_modules = get_gmedia_modules( false );
|
18 |
|
19 |
?>
|
20 |
+
<div class="card m-0 mw-100 p-0 panel-fixed-header" id="gmedia-panel">
|
21 |
|
22 |
<?php
|
23 |
+
require dirname( __FILE__ ) . '/tpl/galleries-panel-heading.php';
|
24 |
|
25 |
do_action( 'gmedia_before_galleries_list' );
|
26 |
?>
|
27 |
|
28 |
+
<form class="list-group <?php echo esc_attr( $gmedia_term_taxonomy ); ?>" id="gm-list-table" style="margin-bottom:4px; border-top-left-radius: 0; border-top-right-radius: 0;">
|
29 |
<?php
|
30 |
+
wp_original_referer_field( true, 'previous' );
|
31 |
+
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
32 |
$taxterm = $gmProcessor->taxterm;
|
33 |
if ( count( $gmedia_terms ) ) {
|
34 |
foreach ( $gmedia_terms as &$item ) {
|
35 |
gmedia_gallery_more_data( $item );
|
36 |
|
37 |
+
$item->classes = array();
|
38 |
if ( 'publish' !== $item->status ) {
|
39 |
if ( 'private' === $item->status ) {
|
40 |
$item->classes[] = 'list-group-item-info';
|
54 |
} else {
|
55 |
include GMEDIA_ABSPATH . 'admin/pages/terms/tpl/no-items.php';
|
56 |
}
|
|
|
|
|
57 |
?>
|
58 |
</form>
|
59 |
<?php
|
62 |
</div>
|
63 |
|
64 |
<?php
|
65 |
+
require dirname( __FILE__ ) . '/tpl/choose-module.php';
|
66 |
+
require GMEDIA_ABSPATH . 'admin/tpl/modal-share.php';
|
admin/pages/galleries/tpl/choose-module.php
CHANGED
@@ -1,37 +1,34 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* @var $gmedia_modules
|
9 |
* @var $gmedia_url
|
10 |
*/
|
11 |
|
12 |
-
global $gmCore, $gmDB, $gmGallery;
|
13 |
?>
|
14 |
<div class="modal fade gmedia-modal" id="chooseModuleModal" tabindex="-1" role="dialog" aria-hidden="true">
|
15 |
<div class="modal-dialog">
|
16 |
<div class="modal-content">
|
17 |
<div class="modal-header">
|
18 |
-
<
|
19 |
-
<
|
20 |
</div>
|
21 |
<div class="modal-body linkblock">
|
22 |
<?php
|
23 |
if ( ! empty( $gmedia_modules['in'] ) ) {
|
24 |
-
foreach ( $gmedia_modules['in'] as $
|
25 |
/**
|
26 |
* @var $module_name
|
27 |
* @var $module_url
|
28 |
* @var $module_path
|
29 |
*/
|
30 |
-
extract( $
|
31 |
if ( ! is_file( $module_path . '/index.php' ) ) {
|
32 |
continue;
|
33 |
}
|
34 |
-
$module_info =
|
35 |
/** @noinspection PhpIncludeInspection */
|
36 |
include $module_path . '/index.php';
|
37 |
if ( empty( $module_info ) ) {
|
@@ -39,31 +36,31 @@ global $gmCore, $gmDB, $gmGallery;
|
|
39 |
}
|
40 |
$mclass = ' module-' . $module_info['type'] . ' module-' . $module_info['status'];
|
41 |
?>
|
42 |
-
<div class="choose-module media<?php echo $mclass; ?>">
|
43 |
-
<a class="thumbnail
|
44 |
<img class="media-object" src="<?php echo esc_url( $module_url . '/screenshot.png' ); ?>" alt="<?php echo esc_attr( $module_info['title'] ); ?>" width="100"/>
|
45 |
</a>
|
46 |
|
47 |
-
<div class="media-body" style="margin-left:
|
48 |
-
<h4 class="media-heading"><?php echo $module_info['title']; ?></h4>
|
49 |
-
<p class="version" style="margin: 6px 0;"><?php echo __( 'Version', 'grand-media' ) . ': ' . $module_info['version']; ?></p>
|
50 |
-
<div class="description collapse" id="collapseDescr_<?php echo $module_name; ?>"><?php echo nl2br( $module_info['description'] ); ?></div>
|
51 |
-
<div class="action-buttons text-
|
52 |
-
<a href="<?php echo esc_url( $gmCore->get_admin_url(
|
53 |
|
54 |
-
<a href="<?php echo esc_url( add_query_arg(
|
55 |
</div>
|
56 |
</div>
|
57 |
</div>
|
58 |
<?php
|
59 |
}
|
60 |
} else {
|
61 |
-
|
62 |
}
|
63 |
?>
|
64 |
</div>
|
65 |
<div class="modal-footer">
|
66 |
-
<button type="button" class="btn btn-
|
67 |
</div>
|
68 |
</div>
|
69 |
</div>
|
@@ -71,25 +68,25 @@ global $gmCore, $gmDB, $gmGallery;
|
|
71 |
|
72 |
<div class="modal fade gmedia-modal" id="changeModuleModal" tabindex="-1" role="dialog" aria-hidden="true">
|
73 |
<div class="modal-dialog">
|
74 |
-
<form class="modal-content" autocomplete="off" method="post" action="<?php echo esc_url( $gmCore->get_admin_url(
|
75 |
<div class="modal-header">
|
76 |
-
<
|
77 |
-
<
|
78 |
</div>
|
79 |
<div class="modal-body">
|
80 |
<?php
|
81 |
if ( ! empty( $gmedia_modules['in'] ) ) {
|
82 |
?>
|
83 |
<div class="form-group">
|
84 |
-
<label><?php
|
85 |
<select class="form-control input-sm" name="gmedia_gallery_module">
|
86 |
<?php
|
87 |
-
echo '<option value="">' .
|
88 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
89 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
90 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
91 |
-
$option =
|
92 |
-
$option[] = '<option value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title']
|
93 |
foreach ( $presets as $preset ) {
|
94 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
95 |
continue;
|
@@ -99,30 +96,31 @@ global $gmCore, $gmDB, $gmGallery;
|
|
99 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
100 |
}
|
101 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
102 |
-
$option[] = '<option value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author
|
103 |
} else {
|
104 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
105 |
-
$option[] = '<option value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
106 |
}
|
107 |
}
|
108 |
-
echo implode( '', $option );
|
109 |
echo '</optgroup>';
|
110 |
-
}
|
|
|
111 |
</select>
|
112 |
|
113 |
-
<p class="help-block"><?php
|
114 |
</div>
|
115 |
<?php
|
116 |
wp_nonce_field( 'gmedia_gallery_module', '_wpnonce_gallery_module' );
|
117 |
wp_referer_field();
|
118 |
} else {
|
119 |
-
|
120 |
}
|
121 |
?>
|
122 |
</div>
|
123 |
<div class="modal-footer">
|
124 |
-
<button type="submit" class="btn btn-primary"><?php
|
125 |
-
<button type="button" class="btn btn-
|
126 |
</div>
|
127 |
</form>
|
128 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* @var $gmedia_modules
|
6 |
* @var $gmedia_url
|
7 |
*/
|
8 |
|
9 |
+
global $gmCore, $gmDB, $gmGallery, $gm_allowed_tags;
|
10 |
?>
|
11 |
<div class="modal fade gmedia-modal" id="chooseModuleModal" tabindex="-1" role="dialog" aria-hidden="true">
|
12 |
<div class="modal-dialog">
|
13 |
<div class="modal-content">
|
14 |
<div class="modal-header">
|
15 |
+
<h4 class="modal-title"><?php esc_html_e( 'Choose Module for Gallery', 'grand-media' ); ?></h4>
|
16 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
17 |
</div>
|
18 |
<div class="modal-body linkblock">
|
19 |
<?php
|
20 |
if ( ! empty( $gmedia_modules['in'] ) ) {
|
21 |
+
foreach ( $gmedia_modules['in'] as $_m ) {
|
22 |
/**
|
23 |
* @var $module_name
|
24 |
* @var $module_url
|
25 |
* @var $module_path
|
26 |
*/
|
27 |
+
extract( $_m );
|
28 |
if ( ! is_file( $module_path . '/index.php' ) ) {
|
29 |
continue;
|
30 |
}
|
31 |
+
$module_info = array();
|
32 |
/** @noinspection PhpIncludeInspection */
|
33 |
include $module_path . '/index.php';
|
34 |
if ( empty( $module_info ) ) {
|
36 |
}
|
37 |
$mclass = ' module-' . $module_info['type'] . ' module-' . $module_info['status'];
|
38 |
?>
|
39 |
+
<div class="choose-module media<?php echo esc_attr( $mclass ); ?>">
|
40 |
+
<a class="img-thumbnail float-start" role="button" data-bs-toggle="collapse" href="#collapseDescr_<?php echo esc_attr( $module_name ); ?>" aria-expanded="false" aria-controls="collapseDescr_<?php echo esc_attr( $module_name ); ?>">
|
41 |
<img class="media-object" src="<?php echo esc_url( $module_url . '/screenshot.png' ); ?>" alt="<?php echo esc_attr( $module_info['title'] ); ?>" width="100"/>
|
42 |
</a>
|
43 |
|
44 |
+
<div class="media-body" style="margin-left:130px;">
|
45 |
+
<h4 class="media-heading"><?php echo esc_html( $module_info['title'] ); ?></h4>
|
46 |
+
<p class="version" style="margin: 6px 0;"><?php echo esc_html( __( 'Version', 'grand-media' ) . ': ' . $module_info['version'] ); ?></p>
|
47 |
+
<div class="description collapse" id="collapseDescr_<?php echo esc_attr( $module_name ); ?>"><?php echo wp_kses_post( nl2br( $module_info['description'] ) ); ?></div>
|
48 |
+
<div class="action-buttons text-end">
|
49 |
+
<a href="<?php echo esc_url( $gmCore->get_admin_url( array( 'page' => 'GrandMedia_Modules', 'preset_module' => $module_name ), array(), admin_url( 'admin.php' ) ) ); ?>" class="btn btn-sm btn-secondary"><?php esc_html_e( 'Create Preset', 'grand-media' ); ?></a>
|
50 |
|
51 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'gallery_module' => $module_name ), $gmedia_url ) ); ?>" class="btn btn-sm btn-primary"><?php esc_html_e( 'Create Gallery', 'grand-media' ); ?></a>
|
52 |
</div>
|
53 |
</div>
|
54 |
</div>
|
55 |
<?php
|
56 |
}
|
57 |
} else {
|
58 |
+
esc_html_e( 'No installed modules', 'grand-media' );
|
59 |
}
|
60 |
?>
|
61 |
</div>
|
62 |
<div class="modal-footer">
|
63 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Cancel', 'grand-media' ); ?></button>
|
64 |
</div>
|
65 |
</div>
|
66 |
</div>
|
68 |
|
69 |
<div class="modal fade gmedia-modal" id="changeModuleModal" tabindex="-1" role="dialog" aria-hidden="true">
|
70 |
<div class="modal-dialog">
|
71 |
+
<form class="modal-content" autocomplete="off" method="post" action="<?php echo esc_url( $gmCore->get_admin_url( array(), array(), $gmedia_url ) ); ?>">
|
72 |
<div class="modal-header">
|
73 |
+
<h4 class="modal-title"><?php esc_html_e( 'Change Module/Preset for Galleries', 'grand-media' ); ?></h4>
|
74 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
75 |
</div>
|
76 |
<div class="modal-body">
|
77 |
<?php
|
78 |
if ( ! empty( $gmedia_modules['in'] ) ) {
|
79 |
?>
|
80 |
<div class="form-group">
|
81 |
+
<label><?php esc_html_e( 'Change Module/Preset for Galleries', 'grand-media' ); ?>:</label>
|
82 |
<select class="form-control input-sm" name="gmedia_gallery_module">
|
83 |
<?php
|
84 |
+
echo '<option value="">' . esc_html__( 'Choose Module/Preset' ) . '</option>';
|
85 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
86 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
87 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $mfold ) );
|
88 |
+
$option = array();
|
89 |
+
$option[] = '<option value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title'] . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
90 |
foreach ( $presets as $preset ) {
|
91 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
92 |
continue;
|
96 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
97 |
}
|
98 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
99 |
+
$option[] = '<option value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
100 |
} else {
|
101 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
102 |
+
$option[] = '<option value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
103 |
}
|
104 |
}
|
105 |
+
echo wp_kses( implode( '', $option ), $gm_allowed_tags );
|
106 |
echo '</optgroup>';
|
107 |
+
}
|
108 |
+
?>
|
109 |
</select>
|
110 |
|
111 |
+
<p class="help-block"><?php esc_html_e( 'Chosen module will be applied for selected galleries.', 'grand-media' ); ?></p>
|
112 |
</div>
|
113 |
<?php
|
114 |
wp_nonce_field( 'gmedia_gallery_module', '_wpnonce_gallery_module' );
|
115 |
wp_referer_field();
|
116 |
} else {
|
117 |
+
esc_html_e( 'No installed modules', 'grand-media' );
|
118 |
}
|
119 |
?>
|
120 |
</div>
|
121 |
<div class="modal-footer">
|
122 |
+
<button type="submit" class="btn btn-primary"><?php esc_html_e( 'Apply', 'grand-media' ); ?></button>
|
123 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Cancel', 'grand-media' ); ?></button>
|
124 |
</div>
|
125 |
</form>
|
126 |
</div>
|
admin/pages/galleries/tpl/galleries-panel-heading.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Panel heading for terms
|
@@ -10,64 +7,69 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
10 |
* @var $gmedia_term_taxonomy
|
11 |
* @var $gmedia_terms_pager
|
12 |
* @var $gmProcessor
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
?>
|
15 |
-
<div class="
|
16 |
-
<div class="
|
17 |
-
<div class="
|
18 |
<div class="clearfix">
|
19 |
-
<?php
|
20 |
|
21 |
-
<div class="btn-toolbar
|
22 |
-
<a title="<?php
|
23 |
</div>
|
24 |
</div>
|
25 |
|
26 |
-
<?php echo $gmedia_terms_pager; ?>
|
27 |
|
28 |
<div class="spinner"></div>
|
29 |
</div>
|
30 |
|
31 |
-
<div class="btn-toolbar
|
32 |
<div class="btn-group gm-checkgroup" id="cb_global-btn">
|
33 |
-
<span class="btn btn-
|
34 |
-
<button type="button" class="btn btn-
|
35 |
-
<span class="
|
36 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
37 |
</button>
|
38 |
<ul class="dropdown-menu" role="menu">
|
39 |
-
<li><a data-select="total" href="#"><?php
|
40 |
-
<li><a data-select="none" href="#"><?php
|
41 |
-
<li class="divider"></li>
|
42 |
-
<li><a data-select="reverse" href="#" title="<?php
|
43 |
</ul>
|
44 |
</div>
|
45 |
|
46 |
-
<div class="btn-group"
|
47 |
-
<a class="btn btn-primary" href="#chooseModuleModal" data-toggle="modal"><?php
|
48 |
</div>
|
49 |
|
50 |
<?php if ( ! empty( $gmedia_terms ) ) { ?>
|
51 |
<div class="btn-group">
|
52 |
-
<a class="btn btn-
|
53 |
-
<button type="button" class="btn btn-
|
54 |
-
<span class="
|
55 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
56 |
</button>
|
57 |
<?php
|
58 |
$rel_selected_show = 'rel-selected-show';
|
59 |
$rel_selected_hide = 'rel-selected-hide';
|
60 |
?>
|
61 |
<ul class="dropdown-menu" role="menu">
|
62 |
-
<li class="dropdown-header <?php echo $rel_selected_hide; ?>"><span><?php
|
63 |
<li class="<?php echo esc_attr( $rel_selected_show ); ?>">
|
64 |
-
<a href="#changeModuleModal" data-toggle="modal"><?php
|
65 |
</li>
|
66 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms_delete' ) ? '' : ' disabled' ) ); ?>">
|
67 |
-
<a
|
68 |
-
'do_gmedia_terms' => 'delete',
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
71 |
</li>
|
72 |
<?php do_action( 'gmedia_galleries_action_list' ); ?>
|
73 |
</ul>
|
@@ -79,20 +81,27 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
79 |
$filter_selected = $gmCore->_req( 'filter' );
|
80 |
$filter_selected_arg = $filter_selected ? false : 'selected';
|
81 |
?>
|
82 |
-
<form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo esc_url( add_query_arg(
|
83 |
-
<button type="submit" class="btn btn<?php echo ( 'selected'
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
86 |
<input type="hidden" id="gm-selected" data-userid="<?php echo absint( $user_ID ); ?>" data-key="<?php echo esc_attr( GmediaProcessor_Galleries::$cookie_key ); ?>" name="selected_items" value="<?php echo esc_attr( implode( ',', $gmProcessor->selected_items ) ); ?>"/>
|
87 |
<ul class="dropdown-menu" role="menu">
|
88 |
-
<li><a id="gm-selected-show" href="#show"
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
96 |
</ul>
|
97 |
</form>
|
98 |
<?php } ?>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Panel heading for terms
|
7 |
* @var $gmedia_term_taxonomy
|
8 |
* @var $gmedia_terms_pager
|
9 |
* @var $gmProcessor
|
10 |
+
* @var $user_ID
|
11 |
+
* @var $gmedia_url
|
12 |
+
* @var $gmCore
|
13 |
+
* @var $gm_allowed_tags
|
14 |
*/
|
15 |
?>
|
16 |
+
<div class="card-header-fake"></div>
|
17 |
+
<div class="card-header bg-light clearfix" style="padding-bottom:2px;">
|
18 |
+
<div class="float-end" style="margin-bottom:3px;">
|
19 |
<div class="clearfix">
|
20 |
+
<?php require GMEDIA_ABSPATH . 'admin/tpl/search-form.php'; ?>
|
21 |
|
22 |
+
<div class="btn-toolbar gap-4 float-end" style="margin-bottom:4px; margin-left:4px;">
|
23 |
+
<a title="<?php esc_attr_e( 'More Screen Settings', 'grand-media' ); ?>" class="show-settings-link float-end btn btn-secondary btn-xs"><i class="fa-solid fa-gear"></i></a>
|
24 |
</div>
|
25 |
</div>
|
26 |
|
27 |
+
<?php echo wp_kses( $gmedia_terms_pager, $gm_allowed_tags ); ?>
|
28 |
|
29 |
<div class="spinner"></div>
|
30 |
</div>
|
31 |
|
32 |
+
<div class="btn-toolbar gap-4 float-start" style="margin-bottom:7px;">
|
33 |
<div class="btn-group gm-checkgroup" id="cb_global-btn">
|
34 |
+
<span class="btn btn-secondary active"><input class="doaction" id="cb_global" data-group="cb_object" type="checkbox"/></span>
|
35 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
36 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
37 |
</button>
|
38 |
<ul class="dropdown-menu" role="menu">
|
39 |
+
<li><a class="dropdown-item" data-select="total" href="#"><?php esc_html_e( 'All', 'grand-media' ); ?></a></li>
|
40 |
+
<li><a class="dropdown-item" data-select="none" href="#"><?php esc_html_e( 'None', 'grand-media' ); ?></a></li>
|
41 |
+
<li><hr class="dropdown-divider"></li>
|
42 |
+
<li><a class="dropdown-item" data-select="reverse" href="#" title="<?php esc_attr_e( 'Reverse only visible items', 'grand-media' ); ?>"><?php esc_html_e( 'Reverse', 'grand-media' ); ?></a></li>
|
43 |
</ul>
|
44 |
</div>
|
45 |
|
46 |
+
<div class="btn-group">
|
47 |
+
<a class="btn btn-primary" href="#chooseModuleModal" data-bs-toggle="modal"><?php esc_html_e( 'Create Gallery', 'grand-media' ); ?></a>
|
48 |
</div>
|
49 |
|
50 |
<?php if ( ! empty( $gmedia_terms ) ) { ?>
|
51 |
<div class="btn-group">
|
52 |
+
<a class="btn btn-secondary" href="#"><?php esc_html_e( 'Action', 'grand-media' ); ?></a>
|
53 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
54 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
55 |
</button>
|
56 |
<?php
|
57 |
$rel_selected_show = 'rel-selected-show';
|
58 |
$rel_selected_hide = 'rel-selected-hide';
|
59 |
?>
|
60 |
<ul class="dropdown-menu" role="menu">
|
61 |
+
<li class="dropdown-header <?php echo esc_attr( $rel_selected_hide ); ?>"><span><?php esc_html_e( 'Select items to see more actions', 'grand-media' ); ?></span></li>
|
62 |
<li class="<?php echo esc_attr( $rel_selected_show ); ?>">
|
63 |
+
<a class="dropdown-item" href="#changeModuleModal" data-bs-toggle="modal"><?php esc_html_e( 'Change Module/Preset for Galleries', 'grand-media' ); ?></a>
|
64 |
</li>
|
65 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms_delete' ) ? '' : ' disabled' ) ); ?>">
|
66 |
+
<a
|
67 |
+
href="<?php echo esc_url( wp_nonce_url( $gmCore->get_admin_url( array( 'do_gmedia_terms' => 'delete', 'ids' => 'selected' ), array( 'filter' ) ), 'gmedia_delete', '_wpnonce_delete' ) ); ?>"
|
68 |
+
class="dropdown-item gmedia-delete"
|
69 |
+
data-confirm="<?php esc_attr_e( "You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ); ?>"
|
70 |
+
>
|
71 |
+
<?php esc_html_e( 'Delete Selected Items', 'grand-media' ); ?>
|
72 |
+
</a>
|
73 |
</li>
|
74 |
<?php do_action( 'gmedia_galleries_action_list' ); ?>
|
75 |
</ul>
|
81 |
$filter_selected = $gmCore->_req( 'filter' );
|
82 |
$filter_selected_arg = $filter_selected ? false : 'selected';
|
83 |
?>
|
84 |
+
<form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo esc_url( add_query_arg( array( 'filter' => $filter_selected_arg ), $gmedia_url ) ); ?>" method="post">
|
85 |
+
<button type="submit" class="btn btn<?php echo ( 'selected' === $filter_selected ) ? '-success' : '-info'; ?>">
|
86 |
+
<?php
|
87 |
+
// translators: number.
|
88 |
+
echo wp_kses_post( sprintf( __( '%s selected', 'grand-media' ), '<span id="gm-selected-qty">' . count( $gmProcessor->selected_items ) . '</span>' ) );
|
89 |
+
?>
|
90 |
+
</button>
|
91 |
+
<button type="button" class="btn btn-info dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
92 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span></button>
|
93 |
<input type="hidden" id="gm-selected" data-userid="<?php echo absint( $user_ID ); ?>" data-key="<?php echo esc_attr( GmediaProcessor_Galleries::$cookie_key ); ?>" name="selected_items" value="<?php echo esc_attr( implode( ',', $gmProcessor->selected_items ) ); ?>"/>
|
94 |
<ul class="dropdown-menu" role="menu">
|
95 |
+
<li><a class="dropdown-item" id="gm-selected-show" href="#show">
|
96 |
+
<?php
|
97 |
+
if ( ! $filter_selected ) {
|
98 |
+
esc_html_e( 'Show only selected items', 'grand-media' );
|
99 |
+
} else {
|
100 |
+
esc_html_e( 'Show all gmedia items', 'grand-media' );
|
101 |
+
}
|
102 |
+
?>
|
103 |
+
</a></li>
|
104 |
+
<li><a class="dropdown-item" id="gm-selected-clear" href="#clear"><?php esc_html_e( 'Clear selected items', 'grand-media' ); ?></a></li>
|
105 |
</ul>
|
106 |
</form>
|
107 |
<?php } ?>
|
admin/pages/galleries/tpl/gallery-edit-item.php
CHANGED
@@ -1,77 +1,101 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Edit Gallery Form
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
?>
|
11 |
<form method="post" id="gmedia-edit-term" name="gmEditTerm" data-id="<?php echo absint( $term_id ); ?>" action="<?php echo esc_url( $gmedia_url ); ?>">
|
12 |
-
<div class="
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
<div class="row">
|
23 |
-
<div class="col-
|
24 |
<div class="row">
|
25 |
-
<div class="col-
|
26 |
<div class="form-group">
|
27 |
-
<label><?php
|
28 |
-
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr( $term->name ); ?>" placeholder="<?php
|
29 |
</div>
|
30 |
<div class="form-group">
|
31 |
-
<label><?php
|
32 |
<input type="text" class="form-control input-sm" name="term[slug]" value="<?php echo esc_attr( $term->slug ); ?>"/>
|
33 |
</div>
|
34 |
<div class="form-group">
|
35 |
-
<label><?php
|
36 |
<?php
|
37 |
-
wp_editor(
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
47 |
?>
|
48 |
</div>
|
49 |
</div>
|
50 |
-
<div class="col-
|
51 |
<div class="form-group">
|
52 |
-
<label><?php
|
53 |
<?php gmedia_term_choose_author_field( $term->global ); ?>
|
54 |
</div>
|
55 |
<div class="form-group">
|
56 |
-
<label><?php
|
57 |
<select name="term[status]" class="form-control input-sm">
|
58 |
-
<option value="publish"<?php selected( $term->status, 'publish' ); ?>><?php
|
59 |
-
<option value="private"<?php selected( $term->status, 'private' ); ?>><?php
|
60 |
-
<option value="draft"<?php selected( $term->status, 'draft' ); ?>><?php
|
61 |
</select>
|
62 |
</div>
|
63 |
<div class="form-group">
|
64 |
-
<label><?php
|
65 |
-
<textarea
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
</div>
|
70 |
</div>
|
71 |
</div>
|
72 |
</div>
|
73 |
|
74 |
-
<div class="col-
|
75 |
<div class="form-group">
|
76 |
<label>
|
77 |
<input type="hidden" name="term[term_id]" value="<?php echo absint( $term_id ); ?>"/>
|
@@ -84,48 +108,57 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
84 |
<div>
|
85 |
<div class="btn-group btn-group" id="save_buttons">
|
86 |
<?php if ( $term->module['name'] !== $term->meta['_module'] ) { ?>
|
87 |
-
<a href="<?php echo esc_url( $gmedia_url ); ?>" class="btn btn-
|
88 |
-
<button type="submit" name="gmedia_gallery_save" class="btn btn-primary"><?php
|
89 |
<?php } else { ?>
|
90 |
-
<?php
|
|
|
91 |
if ( ! empty( $reset_settings ) ) {
|
92 |
?>
|
93 |
-
<button type="submit" name="gmedia_gallery_reset" class="btn btn-
|
94 |
<?php } ?>
|
95 |
-
<button type="submit" name="gmedia_gallery_save" class="btn btn-primary"><?php
|
96 |
<?php } ?>
|
97 |
</div>
|
98 |
</div>
|
99 |
</div>
|
100 |
|
101 |
-
<p><b><?php
|
102 |
-
<p><b><?php
|
103 |
-
<p
|
|
|
|
|
104 |
if ( $term->module['name'] !== $term->meta['_module'] ) {
|
105 |
-
echo '<br /><b>' .
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
108 |
<input type="hidden" name="term[module]" value="<?php echo esc_attr( $term->module['name'] ); ?>">
|
109 |
-
<?php
|
110 |
-
|
|
|
111 |
if ( $term->module['name'] !== $term->meta['_module'] ) {
|
112 |
$params['gmedia_module'] = $term->module['name'];
|
113 |
}
|
114 |
$params['iframe'] = 1;
|
115 |
?>
|
116 |
-
<p><b><?php
|
117 |
-
<br/><a target="_blank" href="<?php echo esc_url( $term->cloud_link ); ?>"><?php echo $term->cloud_link; ?></a>
|
118 |
</p>
|
119 |
<?php if ( $term->post_link ) { ?>
|
120 |
-
<p><b><?php
|
121 |
-
<br/><a target="_blank" href="<?php echo esc_url( $term->post_link ); ?>"><?php echo $term->post_link; ?></a>
|
122 |
</p>
|
123 |
<?php } ?>
|
124 |
-
<div class="help-block">
|
125 |
-
<?php
|
126 |
-
<?php
|
127 |
-
|
128 |
-
|
|
|
|
|
129 |
</div>
|
130 |
<?php } ?>
|
131 |
</div>
|
@@ -136,39 +169,43 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
136 |
?>
|
137 |
|
138 |
<hr/>
|
139 |
-
<div class="
|
140 |
-
<
|
|
|
|
|
141 |
<div class="btn-group">
|
142 |
-
<button type="button" class="btn btn-
|
143 |
</div>
|
144 |
<script type="text/html" id="_module_presets">
|
145 |
<div style="padding-top: 5px;">
|
146 |
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
147 |
<p>
|
148 |
-
<button type="button" name="module_preset_save_global" class="ajax-submit btn btn-
|
149 |
</p>
|
150 |
<?php } ?>
|
151 |
<p style="white-space: nowrap">
|
152 |
-
<button type="button" name="module_preset_save_default" class="ajax-submit btn btn-
|
153 |
-
<em><?php
|
154 |
<?php if ( ! empty( $default_preset ) ) { ?>
|
155 |
-
<button type="button" name="module_preset_restore_original" class="ajax-submit btn btn-
|
156 |
<input type="hidden" name="preset_default" value="<?php echo absint( $default_preset['term_id'] ); ?>"/>
|
157 |
<?php } ?>
|
158 |
</p>
|
159 |
<div class="form-group clearfix" style="border-top: 1px solid #444444; padding-top: 5px;">
|
160 |
-
<label><?php
|
161 |
|
162 |
-
<div class="input-group input-group-
|
163 |
-
<input type="text" class="form-control
|
164 |
-
<span class="input-group-btn"><button type="button" name="module_preset_save" class="ajax-submit btn btn-primary"><?php
|
165 |
</div>
|
166 |
</div>
|
167 |
|
168 |
<?php if ( ! empty( $presets ) ) { ?>
|
169 |
<ul class="list-group presetlist">
|
170 |
-
<?php
|
171 |
-
|
|
|
|
|
172 |
|
173 |
$count = 1;
|
174 |
$name = trim( str_replace( '[' . $term->module['name'] . ']', '', $preset->name, $count ) );
|
@@ -183,35 +220,33 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
183 |
$by = ' <small style="white-space:nowrap">[' . esc_html( get_the_author_meta( 'display_name', $preset->global ) ) . ']</small>';
|
184 |
}
|
185 |
$li_item = '
|
186 |
-
<li class="list-group-item" id="gm-preset-' . $preset->term_id . '">';
|
187 |
-
if ( $user_ID
|
188 |
-
$li_item .= '<span class="delpreset"><span class="
|
189 |
}
|
190 |
$li_item .= '
|
191 |
-
<a href="' . $href . '">' . esc_html( $name ) . $by . '</a>
|
192 |
</li>';
|
193 |
|
194 |
$li[] = $li_item;
|
195 |
}
|
196 |
-
echo implode( '', $li );
|
197 |
?>
|
198 |
</ul>
|
199 |
<?php } ?>
|
200 |
</div>
|
201 |
</script>
|
202 |
</div>
|
203 |
-
|
204 |
-
<h5><?php _e( 'Module Settings', 'grand-media' ); ?></h5>
|
205 |
</div>
|
206 |
<?php
|
207 |
$gallery_link_default = $gmCore->gmcloudlink( $term->term_id, $term->taxterm, true );
|
208 |
-
|
209 |
?>
|
210 |
<?php if ( ! empty( $alert ) ) { ?>
|
211 |
<script type="text/javascript">
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
</script>
|
216 |
<?php } ?>
|
217 |
</div>
|
@@ -220,7 +255,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
220 |
|
221 |
<?php
|
222 |
|
223 |
-
|
224 |
|
225 |
if ( $term_id ) {
|
226 |
$customfield_meta_type = 'gmedia_term';
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Edit Gallery Form
|
6 |
+
*
|
7 |
+
* @var $term_id
|
8 |
+
* @var $term
|
9 |
+
* @var $gmedia_url
|
10 |
+
* @var $gmedia_term_taxonomy
|
11 |
+
* @var $gmCore
|
12 |
+
* @var $default_options
|
13 |
+
* @var $gallery_settings
|
14 |
+
* @var $user_ID
|
15 |
*/
|
16 |
?>
|
17 |
<form method="post" id="gmedia-edit-term" name="gmEditTerm" data-id="<?php echo absint( $term_id ); ?>" action="<?php echo esc_url( $gmedia_url ); ?>">
|
18 |
+
<div class="card-body">
|
19 |
+
<?php
|
20 |
+
/*
|
21 |
+
?>
|
22 |
+
<h4 style="margin-top:0;">
|
23 |
+
<?php if($term_id) { ?>
|
24 |
+
<span class="float-end"><?php echo esc_html( __('ID', 'grand-media') . ": {$term->term_id}" ); ?></span>
|
25 |
+
<?php esc_html_e('Edit Gallery', 'grand-media'); ?>: <em><?php echo esc_html($term->name); ?></em>
|
26 |
+
<?php
|
27 |
+
} else {
|
28 |
+
esc_html_e('New Gallery');
|
29 |
+
}
|
30 |
+
?>
|
31 |
+
</h4>
|
32 |
+
<?php
|
33 |
+
*/
|
34 |
+
?>
|
35 |
|
36 |
<div class="row">
|
37 |
+
<div class="col-md-8">
|
38 |
<div class="row">
|
39 |
+
<div class="col-sm-6">
|
40 |
<div class="form-group">
|
41 |
+
<label><?php esc_html_e( 'Name', 'grand-media' ); ?></label>
|
42 |
+
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr( $term->name ); ?>" placeholder="<?php esc_attr_e( 'Gallery Name', 'grand-media' ); ?>" required/>
|
43 |
</div>
|
44 |
<div class="form-group">
|
45 |
+
<label><?php esc_html_e( 'Slug', 'grand-media' ); ?></label>
|
46 |
<input type="text" class="form-control input-sm" name="term[slug]" value="<?php echo esc_attr( $term->slug ); ?>"/>
|
47 |
</div>
|
48 |
<div class="form-group">
|
49 |
+
<label><?php esc_html_e( 'Description', 'grand-media' ); ?></label>
|
50 |
<?php
|
51 |
+
wp_editor(
|
52 |
+
$term->description,
|
53 |
+
"gallery{$term->term_id}_description",
|
54 |
+
array(
|
55 |
+
'editor_class' => 'form-control input-sm',
|
56 |
+
'editor_height' => 120,
|
57 |
+
'wpautop' => false,
|
58 |
+
'media_buttons' => false,
|
59 |
+
'textarea_name' => 'term[description]',
|
60 |
+
'textarea_rows' => '4',
|
61 |
+
'tinymce' => false,
|
62 |
+
'quicktags' => array( 'buttons' => apply_filters( 'gmedia_editor_quicktags', 'strong,em,link,ul,li,close' ) ),
|
63 |
+
)
|
64 |
+
);
|
65 |
?>
|
66 |
</div>
|
67 |
</div>
|
68 |
+
<div class="col-sm-6">
|
69 |
<div class="form-group">
|
70 |
+
<label><?php esc_html_e( 'Author', 'grand-media' ); ?></label>
|
71 |
<?php gmedia_term_choose_author_field( $term->global ); ?>
|
72 |
</div>
|
73 |
<div class="form-group">
|
74 |
+
<label><?php esc_html_e( 'Status', 'grand-media' ); ?></label>
|
75 |
<select name="term[status]" class="form-control input-sm">
|
76 |
+
<option value="publish"<?php selected( $term->status, 'publish' ); ?>><?php esc_html_e( 'Public', 'grand-media' ); ?></option>
|
77 |
+
<option value="private"<?php selected( $term->status, 'private' ); ?>><?php esc_html_e( 'Private', 'grand-media' ); ?></option>
|
78 |
+
<option value="draft"<?php selected( $term->status, 'draft' ); ?>><?php esc_html_e( 'Draft', 'grand-media' ); ?></option>
|
79 |
</select>
|
80 |
</div>
|
81 |
<div class="form-group">
|
82 |
+
<label><?php esc_html_e( 'Query Args.', 'grand-media' ); ?></label>
|
83 |
+
<textarea
|
84 |
+
class="form-control input-sm"
|
85 |
+
id="build_query_field"
|
86 |
+
style="height:120px;"
|
87 |
+
title="<?php esc_attr_e( "Click 'Build Query' button and choose query arguments for this gallery" ); ?>"
|
88 |
+
placeholder="<?php esc_attr_e( "Click 'Build Query' button for help with Query Args.\nIf you leave this field empty then whole Library will be loaded. That's could exceed your server's PHP Memory Limit.", 'grand-media' ); ?>"
|
89 |
+
rows="2"
|
90 |
+
name="term[query]"
|
91 |
+
><?php echo empty( $gmedia_filter['query_args'] ) ? '' : esc_html( urldecode( build_query( $gmedia_filter['query_args'] ) ) ); ?></textarea>
|
92 |
+
<p class="help-block text-end pt-3"><a id="build_query" class="btn btn-sm btn-success buildquery-modal" data-bs-toggle="modal" href="#buildQuery" style="font-size:90%;"><?php esc_html_e( 'Build Query', 'grand-media' ); ?></a></p>
|
93 |
</div>
|
94 |
</div>
|
95 |
</div>
|
96 |
</div>
|
97 |
|
98 |
+
<div class="col-md-4">
|
99 |
<div class="form-group">
|
100 |
<label>
|
101 |
<input type="hidden" name="term[term_id]" value="<?php echo absint( $term_id ); ?>"/>
|
108 |
<div>
|
109 |
<div class="btn-group btn-group" id="save_buttons">
|
110 |
<?php if ( $term->module['name'] !== $term->meta['_module'] ) { ?>
|
111 |
+
<a href="<?php echo esc_url( $gmedia_url ); ?>" class="btn btn-secondary"><?php esc_html_e( 'Cancel preview module', 'grand-media' ); ?></a>
|
112 |
+
<button type="submit" name="gmedia_gallery_save" class="btn btn-primary"><?php esc_html_e( 'Save with new module', 'grand-media' ); ?></button>
|
113 |
<?php } else { ?>
|
114 |
+
<?php
|
115 |
+
$reset_settings = $gmCore->array_diff_keyval_recursive( $default_options, $gallery_settings, true );
|
116 |
if ( ! empty( $reset_settings ) ) {
|
117 |
?>
|
118 |
+
<button type="submit" name="gmedia_gallery_reset" class="btn btn-secondary" data-confirm="<?php esc_attr_e( 'Confirm reset module settings to default preset' ); ?>"><?php esc_html_e( 'Reset to default', 'grand-media' ); ?></button>
|
119 |
<?php } ?>
|
120 |
+
<button type="submit" name="gmedia_gallery_save" class="btn btn-primary"><?php esc_html_e( 'Save', 'grand-media' ); ?></button>
|
121 |
<?php } ?>
|
122 |
</div>
|
123 |
</div>
|
124 |
</div>
|
125 |
|
126 |
+
<p><b><?php esc_html_e( 'Gallery ID:' ); ?></b> #<?php echo intval( $term_id ); ?></p>
|
127 |
+
<p><b><?php esc_html_e( 'Last edited:' ); ?></b> <?php echo esc_html( $term->meta['_edited'] ); ?></p>
|
128 |
+
<p>
|
129 |
+
<?php
|
130 |
+
echo '<b>' . esc_html__( 'Gallery module:' ) . '</b> <a href="#chooseModuleModal" data-bs-toggle="modal" title="' . esc_attr__( 'Change module for gallery', 'grand-media' ) . '">' . esc_html( $term->meta['_module'] ) . '</a>';
|
131 |
if ( $term->module['name'] !== $term->meta['_module'] ) {
|
132 |
+
echo '<br /><b>' . esc_html__( 'Preview module:' ) . '</b> ' . esc_html( $term->module['name'] );
|
133 |
+
// translators: module name.
|
134 |
+
echo '<br /><span class="text-danger">' . sprintf( esc_html__( 'Note: Module changed to %s, but not saved yet' ), esc_html( $term->module['name'] ) ) . '</span>';
|
135 |
+
}
|
136 |
+
?>
|
137 |
+
</p>
|
138 |
<input type="hidden" name="term[module]" value="<?php echo esc_attr( $term->module['name'] ); ?>">
|
139 |
+
<?php
|
140 |
+
if ( $term_id ) {
|
141 |
+
$params = array();
|
142 |
if ( $term->module['name'] !== $term->meta['_module'] ) {
|
143 |
$params['gmedia_module'] = $term->module['name'];
|
144 |
}
|
145 |
$params['iframe'] = 1;
|
146 |
?>
|
147 |
+
<p><b><?php esc_html_e( 'GmediaCloud page URL for current gallery:' ); ?></b>
|
148 |
+
<br/><a target="_blank" href="<?php echo esc_url( $term->cloud_link ); ?>"><?php echo esc_html( $term->cloud_link ); ?></a>
|
149 |
</p>
|
150 |
<?php if ( $term->post_link ) { ?>
|
151 |
+
<p><b><?php esc_html_e( 'Gmedia Post URL for current gallery:' ); ?></b>
|
152 |
+
<br/><a target="_blank" href="<?php echo esc_url( $term->post_link ); ?>"><?php echo esc_html( $term->post_link ); ?></a>
|
153 |
</p>
|
154 |
<?php } ?>
|
155 |
+
<div class="help-block text-secondary small">
|
156 |
+
<?php echo wp_kses_post( __( 'update <a href="options-permalink.php">Permalink Settings</a> if above link not working', 'grand-media' ) ); ?>
|
157 |
+
<?php
|
158 |
+
if ( current_user_can( 'manage_options' ) ) {
|
159 |
+
echo '<br>' . wp_kses_post( __( 'More info about GmediaCloud Pages and GmediaCloud Settings can be found <a href="admin.php?page=GrandMedia_Settings#gmedia_settings_cloud">here</a>', 'grand-media' ) );
|
160 |
+
}
|
161 |
+
?>
|
162 |
</div>
|
163 |
<?php } ?>
|
164 |
</div>
|
169 |
?>
|
170 |
|
171 |
<hr/>
|
172 |
+
<div class="align-items-center bg-gradient bg-light border d-flex justify-content-between p-2 mb-4 rounded">
|
173 |
+
<h5 class="m-0"><?php esc_html_e( 'Module Settings', 'grand-media' ); ?></h5>
|
174 |
+
|
175 |
+
<div class="btn-toolbar gap-4 float-end" id="module_preset">
|
176 |
<div class="btn-group">
|
177 |
+
<button type="button" class="btn btn-secondary<?php echo ( $term->module['name'] !== $term->meta['_module'] ) ? ' disabled' : ''; ?>" id="module_presets"><?php esc_html_e( 'Module Presets', 'grand-media' ); ?></button>
|
178 |
</div>
|
179 |
<script type="text/html" id="_module_presets">
|
180 |
<div style="padding-top: 5px;">
|
181 |
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
182 |
<p>
|
183 |
+
<button type="button" name="module_preset_save_global" class="ajax-submit btn btn-secondary btn-xs" style="width:100%"><?php esc_html_e( 'Save as Global Preset', 'grand-media' ); ?></button>
|
184 |
</p>
|
185 |
<?php } ?>
|
186 |
<p style="white-space: nowrap">
|
187 |
+
<button type="button" name="module_preset_save_default" class="ajax-submit btn btn-secondary btn-xs"><?php esc_html_e( 'Save as Default', 'grand-media' ); ?></button>
|
188 |
+
<em><?php esc_html_e( 'or', 'grand-media' ); ?></em>
|
189 |
<?php if ( ! empty( $default_preset ) ) { ?>
|
190 |
+
<button type="button" name="module_preset_restore_original" class="ajax-submit btn btn-secondary btn-xs"><?php esc_html_e( 'Restore Original', 'grand-media' ); ?></button>
|
191 |
<input type="hidden" name="preset_default" value="<?php echo absint( $default_preset['term_id'] ); ?>"/>
|
192 |
<?php } ?>
|
193 |
</p>
|
194 |
<div class="form-group clearfix" style="border-top: 1px solid #444444; padding-top: 5px;">
|
195 |
+
<label><?php esc_html_e( 'Save Preset as:', 'grand-media' ); ?></label>
|
196 |
|
197 |
+
<div class="input-group input-group-xs">
|
198 |
+
<input type="text" class="form-control form-control-sm" name="module_preset_name" placeholder="<?php esc_attr_e( 'Preset Name', 'grand-media' ); ?>" value=""/>
|
199 |
+
<span class="input-group-btn"><button type="button" name="module_preset_save" class="ajax-submit btn btn-primary h-100"><?php esc_html_e( 'Save', 'grand-media' ); ?></button></span>
|
200 |
</div>
|
201 |
</div>
|
202 |
|
203 |
<?php if ( ! empty( $presets ) ) { ?>
|
204 |
<ul class="list-group presetlist">
|
205 |
+
<?php
|
206 |
+
$li = array();
|
207 |
+
foreach ( $presets as $preset ) {
|
208 |
+
$href = $gmCore->get_admin_url( array( 'preset' => $preset->term_id ), array() );
|
209 |
|
210 |
$count = 1;
|
211 |
$name = trim( str_replace( '[' . $term->module['name'] . ']', '', $preset->name, $count ) );
|
220 |
$by = ' <small style="white-space:nowrap">[' . esc_html( get_the_author_meta( 'display_name', $preset->global ) ) . ']</small>';
|
221 |
}
|
222 |
$li_item = '
|
223 |
+
<li class="list-group-item" id="gm-preset-' . intval( $preset->term_id ) . '">';
|
224 |
+
if ( $user_ID === $preset->global || ( (int) $preset->global && $gmCore->caps['gmedia_edit_others_media'] ) || current_user_can( 'manage_options' ) ) {
|
225 |
+
$li_item .= '<span class="delpreset"><span class="badge-error rounded-1" data-id="' . intval( $preset->term_id ) . '">×</span></span>';
|
226 |
}
|
227 |
$li_item .= '
|
228 |
+
<a href="' . esc_url( $href ) . '">' . esc_html( $name ) . $by . '</a>
|
229 |
</li>';
|
230 |
|
231 |
$li[] = $li_item;
|
232 |
}
|
233 |
+
echo wp_kses_post( implode( '', $li ) );
|
234 |
?>
|
235 |
</ul>
|
236 |
<?php } ?>
|
237 |
</div>
|
238 |
</script>
|
239 |
</div>
|
|
|
|
|
240 |
</div>
|
241 |
<?php
|
242 |
$gallery_link_default = $gmCore->gmcloudlink( $term->term_id, $term->taxterm, true );
|
243 |
+
require GMEDIA_ABSPATH . 'admin/pages/galleries/tpl/module-settings.php';
|
244 |
?>
|
245 |
<?php if ( ! empty( $alert ) ) { ?>
|
246 |
<script type="text/javascript">
|
247 |
+
jQuery(function($) {
|
248 |
+
$('#chooseModuleModal').modal('show');
|
249 |
+
});
|
250 |
</script>
|
251 |
<?php } ?>
|
252 |
</div>
|
255 |
|
256 |
<?php
|
257 |
|
258 |
+
require GMEDIA_ABSPATH . 'admin/pages/galleries/tpl/modal-build-query.php';
|
259 |
|
260 |
if ( $term_id ) {
|
261 |
$customfield_meta_type = 'gmedia_term';
|
admin/pages/galleries/tpl/gallery-list-item.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Gallery list item
|
@@ -11,9 +8,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
11 |
* @var $gmedia_url
|
12 |
*/
|
13 |
?>
|
14 |
-
<div class="cb_list-item list-group-item gallery-list-item <?php echo implode( ' ', $item->classes ); ?>" id="list-item-<?php echo absint( $item->term_id ); ?>" data-id="<?php echo absint( $item->term_id ); ?>" data-type="<?php echo esc_attr( $item->module['name'] ); ?>">
|
15 |
<div class="row cb_object">
|
16 |
-
<div class="col-
|
17 |
<label class="cb_media-object cb_media-object-gallery">
|
18 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->module['name'] ); ?>" value="<?php echo absint( $item->term_id ); ?>"/>
|
19 |
</label>
|
@@ -21,66 +18,68 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
<div class="media-info-body" style="margin-left:35px;">
|
22 |
<p class="media-title">
|
23 |
<?php if ( $item->allow_edit ) { ?>
|
24 |
-
<a class="term_name" href="<?php echo esc_url( add_query_arg(
|
25 |
<?php } else { ?>
|
26 |
<span class="term_name"><?php echo esc_html( $item->name ); ?></span>
|
27 |
<?php } ?>
|
28 |
</p>
|
29 |
|
30 |
<p class="media-meta">
|
31 |
-
<span class="
|
32 |
</p>
|
33 |
|
34 |
<p class="media-caption"><?php echo esc_html( nl2br( $item->description ) ); ?></p>
|
35 |
|
36 |
-
<p class="media-meta" title="<?php
|
37 |
-
<span class="
|
38 |
</p>
|
39 |
</div>
|
40 |
</div>
|
41 |
-
<div class="col-
|
42 |
<div class="object-actions gallery-object-actions">
|
43 |
-
<?php
|
44 |
-
|
|
|
45 |
?>
|
46 |
</div>
|
47 |
<p class="media-meta">
|
48 |
-
<span class="
|
49 |
<?php if ( empty( $item->module['info'] ) ) { ?>
|
50 |
-
<span class="bg-danger text-center"><?php
|
51 |
<?php } ?>
|
52 |
-
<br><span class="
|
53 |
-
<br><span class="
|
54 |
<?php
|
55 |
/*
|
56 |
$gallery_tabs = reset($term_meta['_query']);
|
57 |
$tax_tabs = key($term_meta['_query']);
|
58 |
if ('gmedia__in' == $tax_tabs) {
|
59 |
-
|
60 |
$gmedia_ids = wp_parse_id_list($gallery_tabs[0]);
|
61 |
-
|
62 |
-
|
|
|
63 |
} else {
|
64 |
$tabs = $gmDB->get_terms($tax_tabs, array('include' => $gallery_tabs));
|
65 |
$terms_source = array();
|
66 |
if ('gmedia_category' == $tax_tabs) {
|
67 |
-
|
68 |
foreach ($tabs as $t) {
|
69 |
$terms_source[] = sprintf('<a class="gm_gallery_source gm_category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $t->term_id), $lib_url)), esc_html($t->name));
|
70 |
}
|
71 |
} elseif ('gmedia_album' == $tax_tabs) {
|
72 |
-
|
73 |
foreach ($tabs as $t) {
|
74 |
$terms_source[] = sprintf('<a class="gm_gallery_source gm_album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $t->term_id), $lib_url)), esc_html($t->name));
|
75 |
}
|
76 |
} elseif ('gmedia_tag' == $tax_tabs) {
|
77 |
-
|
78 |
foreach ($tabs as $t) {
|
79 |
$terms_source[] = sprintf('<a class="gm_gallery_source gm_tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $t->term_id), $lib_url)), esc_html($t->name));
|
80 |
}
|
81 |
}
|
82 |
if (! empty($terms_source)) {
|
83 |
-
echo ' (' . join(', ', $terms_source) . ')';
|
84 |
}
|
85 |
}
|
86 |
*/
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Gallery list item
|
8 |
* @var $gmedia_url
|
9 |
*/
|
10 |
?>
|
11 |
+
<div class="cb_list-item list-group-item gallery-list-item <?php echo esc_attr( implode( ' ', $item->classes ) ); ?>" id="list-item-<?php echo absint( $item->term_id ); ?>" data-id="<?php echo absint( $item->term_id ); ?>" data-type="<?php echo esc_attr( $item->module['name'] ); ?>">
|
12 |
<div class="row cb_object">
|
13 |
+
<div class="col-sm-7">
|
14 |
<label class="cb_media-object cb_media-object-gallery">
|
15 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->module['name'] ); ?>" value="<?php echo absint( $item->term_id ); ?>"/>
|
16 |
</label>
|
18 |
<div class="media-info-body" style="margin-left:35px;">
|
19 |
<p class="media-title">
|
20 |
<?php if ( $item->allow_edit ) { ?>
|
21 |
+
<a class="term_name" href="<?php echo esc_url( add_query_arg( array( 'edit_term' => $item->term_id ), $gmedia_url ) ); ?>"><?php echo esc_html( $item->name ); ?></a>
|
22 |
<?php } else { ?>
|
23 |
<span class="term_name"><?php echo esc_html( $item->name ); ?></span>
|
24 |
<?php } ?>
|
25 |
</p>
|
26 |
|
27 |
<p class="media-meta">
|
28 |
+
<span class="badge label-default"><?php esc_html_e( 'Author', 'grand-media' ); ?>:</span> <?php echo $item->global ? esc_html( $item->author_name ) : '—'; ?>
|
29 |
</p>
|
30 |
|
31 |
<p class="media-caption"><?php echo esc_html( nl2br( $item->description ) ); ?></p>
|
32 |
|
33 |
+
<p class="media-meta" title="<?php esc_attr_e( 'Shortcode', 'grand-media' ); ?>" style="font-weight:bold">
|
34 |
+
<span class="badge label-default"><?php esc_html_e( 'Shortcode', 'grand-media' ); ?>:</span> [gmedia id=<?php echo absint( $item->term_id ); ?>]
|
35 |
</p>
|
36 |
</div>
|
37 |
</div>
|
38 |
+
<div class="col-sm-5">
|
39 |
<div class="object-actions gallery-object-actions">
|
40 |
+
<?php
|
41 |
+
$action_links = gmedia_gallery_actions( $item );
|
42 |
+
echo wp_kses_post( implode( '', $action_links ) );
|
43 |
?>
|
44 |
</div>
|
45 |
<p class="media-meta">
|
46 |
+
<span class="badge label-default"><?php esc_html_e( 'Module', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->module['name'] ); ?>
|
47 |
<?php if ( empty( $item->module['info'] ) ) { ?>
|
48 |
+
<span class="bg-danger text-center"><?php esc_html_e( 'Module broken. Reinstall module', 'grand-media' ); ?></span>
|
49 |
<?php } ?>
|
50 |
+
<br><span class="badge label-default"><?php esc_html_e( 'Last Edited', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->meta['_edited'] ); ?>
|
51 |
+
<br><span class="badge label-default"><?php esc_html_e( 'Query Args.', 'grand-media' ); ?>:</span> <?php echo ! empty( $item->meta['_query'] ) ? esc_html( str_replace( ',"', ', "', wp_json_encode( $item->meta['_query'] ) ) ) : ''; ?>
|
52 |
<?php
|
53 |
/*
|
54 |
$gallery_tabs = reset($term_meta['_query']);
|
55 |
$tax_tabs = key($term_meta['_query']);
|
56 |
if ('gmedia__in' == $tax_tabs) {
|
57 |
+
esc_html_e('Selected Gmedia', 'grand-media');
|
58 |
$gmedia_ids = wp_parse_id_list($gallery_tabs[0]);
|
59 |
+
// translators: number.
|
60 |
+
$gal_source = sprintf('<a class="gm_gallery_source selected__in" href="%s">' . esc_html__('Show %d items in Gmedia Library', 'grand-media') . '</a>', esc_url(add_query_arg(array('gmedia__in' => implode(',', $gmedia_ids)), $lib_url)), count($gmedia_ids));
|
61 |
+
echo wp_kses_post(" ($gal_source)");
|
62 |
} else {
|
63 |
$tabs = $gmDB->get_terms($tax_tabs, array('include' => $gallery_tabs));
|
64 |
$terms_source = array();
|
65 |
if ('gmedia_category' == $tax_tabs) {
|
66 |
+
esc_html_e('Categories', 'grand-media');
|
67 |
foreach ($tabs as $t) {
|
68 |
$terms_source[] = sprintf('<a class="gm_gallery_source gm_category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $t->term_id), $lib_url)), esc_html($t->name));
|
69 |
}
|
70 |
} elseif ('gmedia_album' == $tax_tabs) {
|
71 |
+
esc_html_e('Albums', 'grand-media');
|
72 |
foreach ($tabs as $t) {
|
73 |
$terms_source[] = sprintf('<a class="gm_gallery_source gm_album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $t->term_id), $lib_url)), esc_html($t->name));
|
74 |
}
|
75 |
} elseif ('gmedia_tag' == $tax_tabs) {
|
76 |
+
esc_html_e('Tags', 'grand-media');
|
77 |
foreach ($tabs as $t) {
|
78 |
$terms_source[] = sprintf('<a class="gm_gallery_source gm_tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $t->term_id), $lib_url)), esc_html($t->name));
|
79 |
}
|
80 |
}
|
81 |
if (! empty($terms_source)) {
|
82 |
+
echo ' (' . wp_kses_post( join(', ', $terms_source) ) . ')';
|
83 |
}
|
84 |
}
|
85 |
*/
|
admin/pages/galleries/tpl/gallery-panel-heading.php
CHANGED
@@ -1,64 +1,64 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Panel heading for term
|
9 |
*
|
10 |
* @var $term_id
|
|
|
|
|
11 |
* @var $gmedia_term_taxonomy
|
12 |
* @var $gmProcessor
|
13 |
* @var $gmCore
|
14 |
*/
|
15 |
$curpage = $gmCore->_get( 'page', 'GrandMedia' );
|
16 |
$refurl = strpos( wp_get_referer(), "page={$curpage}" ) ? wp_get_referer() : $gmProcessor->url;
|
17 |
-
$referer = remove_query_arg(
|
18 |
?>
|
19 |
-
<div class="
|
20 |
-
<div class="
|
21 |
-
<div class="btn-toolbar
|
22 |
-
<a class="btn btn-
|
23 |
|
24 |
<?php if ( $term_id ) { ?>
|
25 |
<div class="btn-group">
|
26 |
-
<a class="btn btn-
|
27 |
-
<button type="button" class="btn btn-
|
28 |
-
<span class="
|
29 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
30 |
</button>
|
31 |
<ul class="dropdown-menu" role="menu">
|
32 |
-
<li><a href="<?php echo esc_url( add_query_arg(
|
33 |
<?php
|
34 |
-
echo '<li' . ( ( 'draft' !== $term->status ) ? '' : ' class="disabled"' ) . '><a target="_blank" class="share-modal" data-target="#shareModal" data-share="' . $term->term_id . '" data-gmediacloud="' . $term->cloud_link . '" href="' . $term->post_link . '">' .
|
35 |
|
36 |
-
echo '<li' . ( $term->allow_delete ? '' : ' class="disabled"' ) . '
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
40 |
?>
|
41 |
</ul>
|
42 |
</div>
|
43 |
<?php } ?>
|
44 |
<?php if ( $term_id ) { ?>
|
45 |
-
<div class="term-shortcode
|
46 |
<div class="input-buffer"></div>
|
47 |
</div>
|
48 |
-
|
|
|
49 |
do_action( 'gmedia_gallery_btn_toolbar' );
|
50 |
?>
|
51 |
</div>
|
52 |
|
53 |
-
<div class="btn-group
|
54 |
<?php if ( $term->module['name'] !== $term->meta['_module'] ) { ?>
|
55 |
-
<a href="<?php echo esc_url( $gmedia_url ); ?>" class="btn btn-
|
56 |
-
<button type="button" onclick="jQuery('button[name=gmedia_gallery_save]').trigger('click');" class="btn btn-primary"><?php
|
57 |
<?php } else { ?>
|
58 |
<?php if ( ! empty( $reset_settings ) ) { ?>
|
59 |
-
<button type="button" onclick="jQuery('button[name=gmedia_gallery_reset]').trigger('click');" class="btn btn-
|
60 |
<?php } ?>
|
61 |
-
<button type="button" onclick="jQuery('button[name=gmedia_gallery_save]').trigger('click');" class="btn btn-primary"><?php
|
62 |
<?php } ?>
|
63 |
</div>
|
64 |
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Panel heading for term
|
6 |
*
|
7 |
* @var $term_id
|
8 |
+
* @var $term
|
9 |
+
* @var $gmedia_url
|
10 |
* @var $gmedia_term_taxonomy
|
11 |
* @var $gmProcessor
|
12 |
* @var $gmCore
|
13 |
*/
|
14 |
$curpage = $gmCore->_get( 'page', 'GrandMedia' );
|
15 |
$refurl = strpos( wp_get_referer(), "page={$curpage}" ) ? wp_get_referer() : $gmProcessor->url;
|
16 |
+
$referer = remove_query_arg( array( 'edit_term', 'gallery_module' ), $refurl );
|
17 |
?>
|
18 |
+
<div class="card-header-fake"></div>
|
19 |
+
<div class="card-header bg-light clearfix">
|
20 |
+
<div class="btn-toolbar gap-4 float-start">
|
21 |
+
<a class="btn btn-secondary float-start" href="<?php echo esc_url( $referer ); ?>"><?php esc_html_e( 'Go Back', 'grand-media' ); ?></a>
|
22 |
|
23 |
<?php if ( $term_id ) { ?>
|
24 |
<div class="btn-group">
|
25 |
+
<a class="btn btn-secondary" href="#"><?php esc_html_e( 'Action', 'grand-media' ); ?></a>
|
26 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
27 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
28 |
</button>
|
29 |
<ul class="dropdown-menu" role="menu">
|
30 |
+
<li><a class="dropdown-item" href="<?php echo esc_url( add_query_arg( array( 'page' => 'GrandMedia', 'gallery' => $term->term_id ), $gmProcessor->url ) ); ?>"><?php esc_html_e( 'Show in Gmedia Library', 'grand-media' ); ?></a></li>
|
31 |
<?php
|
32 |
+
echo '<li' . ( ( 'draft' !== $term->status ) ? '' : ' class="disabled"' ) . '><a target="_blank" class="dropdown-item share-modal" data-bs-toggle="modal" data-bs-target="#shareModal" data-share="' . esc_attr( $term->term_id ) . '" data-gmediacloud="' . esc_url( $term->cloud_link ) . '" href="' . esc_url( $term->post_link ) . '">' . esc_html__( 'Share', 'grand-media' ) . '</a></li>';
|
33 |
|
34 |
+
echo '<li' . ( $term->allow_delete ? '' : ' class="disabled"' ) . '>
|
35 |
+
<a
|
36 |
+
class="dropdown-item"
|
37 |
+
href="' . esc_url( wp_nonce_url( gm_get_admin_url( array( 'do_gmedia_terms' => 'delete', 'ids' => $term->term_id ), array( 'edit_term' ), $gmProcessor->url ), 'gmedia_delete', '_wpnonce_delete' ) ) . '"
|
38 |
+
data-confirm="' . esc_html__( "You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ) . '">' . esc_html__( 'Delete', 'grand-media' ) . '</a></li>';
|
39 |
?>
|
40 |
</ul>
|
41 |
</div>
|
42 |
<?php } ?>
|
43 |
<?php if ( $term_id ) { ?>
|
44 |
+
<div class="term-shortcode float-start"><input type="text" title="<?php esc_attr_e( 'Shortcode' ); ?>" class="form-control h-100 float-start" value="<?php echo esc_attr( '[gmedia id=' . absint( $term_id ) . ']' ); ?>" readonly/>
|
45 |
<div class="input-buffer"></div>
|
46 |
</div>
|
47 |
+
<?php
|
48 |
+
}
|
49 |
do_action( 'gmedia_gallery_btn_toolbar' );
|
50 |
?>
|
51 |
</div>
|
52 |
|
53 |
+
<div class="btn-group float-end" id="save_buttons_duplicate">
|
54 |
<?php if ( $term->module['name'] !== $term->meta['_module'] ) { ?>
|
55 |
+
<a href="<?php echo esc_url( $gmedia_url ); ?>" class="btn btn-secondary"><?php esc_html_e( 'Cancel preview module', 'grand-media' ); ?></a>
|
56 |
+
<button type="button" onclick="jQuery('button[name=gmedia_gallery_save]').trigger('click');" class="btn btn-primary"><?php esc_html_e( 'Save with new module', 'grand-media' ); ?></button>
|
57 |
<?php } else { ?>
|
58 |
<?php if ( ! empty( $reset_settings ) ) { ?>
|
59 |
+
<button type="button" onclick="jQuery('button[name=gmedia_gallery_reset]').trigger('click');" class="btn btn-secondary"><?php esc_html_e( 'Reset to default', 'grand-media' ); ?></button>
|
60 |
<?php } ?>
|
61 |
+
<button type="button" onclick="jQuery('button[name=gmedia_gallery_save]').trigger('click');" class="btn btn-primary"><?php esc_html_e( 'Save', 'grand-media' ); ?></button>
|
62 |
<?php } ?>
|
63 |
</div>
|
64 |
|
admin/pages/galleries/tpl/modal-build-query.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Modal for Build Query
|
@@ -10,82 +7,85 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
10 |
* @var $gm_album_terms
|
11 |
* @var $gm_category_terms
|
12 |
* @var $gm_tag_terms
|
|
|
13 |
*/
|
14 |
global $user_ID, $gmDB, $gmCore
|
15 |
?>
|
16 |
<div class="modal fade gmedia-modal" id="buildQuery" tabindex="-1" role="dialog" aria-hidden="true">
|
17 |
-
<div class="modal-dialog" style="width:700px;">
|
18 |
<div class="modal-content">
|
19 |
<div class="modal-header">
|
20 |
-
<
|
21 |
-
|
22 |
-
<button type="button" class="btn btn-
|
23 |
-
<button type="button" class="btn btn-
|
|
|
24 |
</div>
|
25 |
-
<h4 class="modal-title"><?php _e( 'Query Parameters' ); ?></h4>
|
26 |
</div>
|
27 |
-
<div class="modal-body">
|
28 |
|
29 |
<?php
|
30 |
$query_data = $gmedia_filter['query_data'];
|
31 |
-
if ( gm_user_can( 'terms' ) ) {
|
|
|
32 |
<div class="form-group">
|
33 |
<?php
|
34 |
$term_type = 'gmedia_album';
|
35 |
-
$args =
|
36 |
if ( gm_user_can( 'edit_others_media' ) ) {
|
37 |
$args['global'] = '';
|
38 |
} else {
|
39 |
-
$args['global'] =
|
40 |
}
|
41 |
$gm_album_terms = $gmDB->get_terms( $term_type, $args );
|
42 |
|
43 |
-
$no_term =
|
44 |
'term_id' => 0,
|
45 |
'name' => __( 'No Album', 'grand-media' ),
|
46 |
-
|
47 |
if ( count( $gm_album_terms ) ) {
|
48 |
foreach ( $gm_album_terms as &$_term ) {
|
49 |
unset( $_term->description );
|
50 |
unset( $_term->taxonomy );
|
51 |
-
|
|
|
52 |
/* ('publish' === $_term->status? '' : " [{$_term->status}]") . ' (' . $_term->count . ')';*/
|
53 |
}
|
54 |
}
|
55 |
-
$gm_album_terms = array_merge(
|
56 |
-
$query_gmedia_albums =
|
57 |
$exclude_albums = false;
|
58 |
-
if ( ! empty( $query_data['album__in'] ) || (
|
59 |
$query_gmedia_albums = wp_parse_id_list( $query_data['album__in'] );
|
60 |
-
} elseif ( ! empty( $query_data['album__not_in'] ) || (
|
61 |
$query_gmedia_albums = wp_parse_id_list( $query_data['album__not_in'] );
|
62 |
$exclude_albums = true;
|
63 |
}
|
64 |
?>
|
65 |
-
<label><?php
|
66 |
|
67 |
<div class="row">
|
68 |
-
<div class="col-
|
69 |
-
<input id="query_album__" name="album__in" data-include="album__in" data-exclude="album__not_in" class="form-control gm-selectize input-
|
70 |
</div>
|
71 |
-
<div class="col-
|
72 |
-
<div class="checkbox"><label><input class="query_switch" data-target="query_album__" type="checkbox"<?php echo $exclude_albums ? ' checked="checked"' : ''; ?> /> <?php
|
73 |
</div>
|
74 |
</div>
|
75 |
<div class="row">
|
76 |
-
<div class="col-
|
77 |
-
|
78 |
</div>
|
79 |
-
<div class="col-
|
80 |
-
<label><?php
|
81 |
-
<select name="albums_order" class="form-control input-
|
82 |
-
<option <?php selected( $query_data['albums_order'], '' ); ?> value=""><?php
|
83 |
-
<option <?php selected( $query_data['albums_order'], 'id' ); ?> value="id"><?php
|
84 |
-
<option <?php selected( $query_data['albums_order'], 'id_desc' ); ?> value="desc"><?php
|
85 |
-
<option <?php selected( $query_data['albums_order'], 'name' ); ?> value="name"><?php
|
86 |
-
<option <?php selected( $query_data['albums_order'], 'name_desc' ); ?> value="name_desc"><?php
|
87 |
-
<option <?php selected( $query_data['albums_order'], 'date' ); ?> value="date"><?php
|
88 |
-
<option <?php selected( $query_data['albums_order'], 'date_desc' ); ?> value="date_desc"><?php
|
89 |
</select>
|
90 |
</div>
|
91 |
</div>
|
@@ -94,26 +94,26 @@ global $user_ID, $gmDB, $gmCore
|
|
94 |
<div class="form-group">
|
95 |
<?php
|
96 |
$term_type = 'gmedia_category';
|
97 |
-
$gm_category_terms = $gmDB->get_terms( $term_type,
|
98 |
|
99 |
-
$no_term =
|
100 |
'term_id' => 0,
|
101 |
'name' => __( 'Uncategorized', 'grand-media' ),
|
102 |
-
|
103 |
-
$gm_category_terms = array_merge(
|
104 |
?>
|
105 |
<div class="row">
|
106 |
-
<div class="col-
|
107 |
-
<label><?php
|
108 |
-
<input name="category__in" class="form-control input-
|
109 |
</div>
|
110 |
-
<div class="col-
|
111 |
-
<label><?php
|
112 |
-
<input name="category__and" class="form-control input-
|
113 |
</div>
|
114 |
-
<div class="col-
|
115 |
-
<label><?php
|
116 |
-
<input name="category__not_in" class="form-control input-
|
117 |
</div>
|
118 |
</div>
|
119 |
</div>
|
@@ -121,175 +121,190 @@ global $user_ID, $gmDB, $gmCore
|
|
121 |
<div class="form-group">
|
122 |
<?php
|
123 |
$term_type = 'gmedia_tag';
|
124 |
-
$gm_tag_terms = $gmDB->get_terms( $term_type,
|
125 |
?>
|
126 |
<div class="row">
|
127 |
-
<div class="col-
|
128 |
-
<label><?php
|
129 |
-
<input name="tag__in" class="form-control input-
|
130 |
</div>
|
131 |
-
<div class="col-
|
132 |
-
<label><?php
|
133 |
-
<input name="tag__and" class="form-control input-
|
134 |
</div>
|
135 |
-
<div class="col-
|
136 |
-
<label><?php
|
137 |
-
<input name="tag__not_in" class="form-control input-
|
138 |
</div>
|
139 |
</div>
|
140 |
</div>
|
141 |
|
142 |
<?php } ?>
|
143 |
<div class="form-group">
|
144 |
-
<label><?php
|
145 |
|
146 |
<div class="row">
|
147 |
-
<div class="col-
|
148 |
-
<select name="terms_relation" class="form-control input-
|
149 |
-
<option <?php selected( $query_data['terms_relation'], '' ); ?> value=""><?php
|
150 |
-
<option <?php selected( $query_data['terms_relation'], 'AND' ); ?> value="AND"><?php
|
151 |
-
<option <?php selected( $query_data['terms_relation'], 'OR' ); ?> value="OR"><?php
|
152 |
</select>
|
153 |
</div>
|
154 |
-
<div class="col-
|
155 |
-
<p class="help-block"><?php
|
156 |
</div>
|
157 |
</div>
|
158 |
</div>
|
159 |
<div class="form-group">
|
160 |
-
<label><?php
|
161 |
|
162 |
<div class="row">
|
163 |
-
<div class="col-
|
164 |
-
<input type="text" class="form-control input-
|
165 |
</div>
|
166 |
-
<div class="col-
|
167 |
-
<div class="checkbox"><label><input type="checkbox" name="exact" value="yes"<?php echo $query_data['exact'] ? ' checked="checked"' : ''; ?> /> <?php
|
168 |
</div>
|
169 |
</div>
|
170 |
</div>
|
171 |
<div class="form-group">
|
172 |
<div class="row">
|
173 |
-
<div class="col-
|
174 |
-
<div class="
|
175 |
-
<a
|
176 |
-
|
177 |
-
'
|
178 |
-
'gmediablank' => 'library',
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
</div>
|
181 |
-
<label><?php
|
182 |
</div>
|
183 |
</div>
|
184 |
<div class="row">
|
185 |
-
<div class="col-
|
186 |
-
<?php
|
|
|
187 |
if ( ! empty( $query_data['gmedia__in'] ) ) {
|
188 |
$query_gmedia_items = $query_data['gmedia__in'];
|
189 |
} elseif ( ! empty( $query_data['gmedia__not_in'] ) ) {
|
190 |
$query_gmedia_items = $query_data['gmedia__not_in'];
|
191 |
}
|
192 |
?>
|
193 |
-
<textarea id="query_gmedia__" name="gmedia__in" data-include="gmedia__in" data-exclude="gmedia__not_in" rows="1" class="form-control input-
|
194 |
</div>
|
195 |
-
<div class="col-
|
196 |
-
<div class="checkbox"
|
|
|
|
|
197 |
</div>
|
198 |
</div>
|
199 |
-
<p class="help-block"><?php
|
200 |
</div>
|
201 |
<div class="form-group">
|
202 |
<div class="row">
|
203 |
-
<div class="col-
|
204 |
-
<label><?php
|
205 |
<?php
|
206 |
-
$mime_types =
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
$mime_type_val = is_array( $query_data['mime_type'] ) ? implode( ',', $query_data['mime_type'] ) : str_replace( ', ', ',', $query_data['mime_type'] );
|
214 |
?>
|
215 |
-
<input name="mime_type" class="form-control input-
|
216 |
</div>
|
217 |
-
<div class="col-
|
218 |
-
<label><?php
|
219 |
-
<?php
|
|
|
220 |
$user_ids = $gmCore->get_editable_user_ids();
|
221 |
if ( ! in_array( $user_ID, $user_ids, true ) ) {
|
222 |
-
|
223 |
}
|
224 |
-
$filter_users = get_users(
|
225 |
$users = '';
|
226 |
-
$_users =
|
227 |
if ( count( $filter_users ) ) {
|
228 |
$author__in = wp_parse_id_list( $query_data['author__in'] );
|
229 |
foreach ( (array) $filter_users as $user ) {
|
230 |
$user->ID = (int) $user->ID;
|
231 |
$_selected = in_array( $user->ID, $author__in, true ) ? ' selected="selected"' : '';
|
232 |
-
$users .=
|
233 |
-
$_users[] =
|
234 |
}
|
235 |
}
|
236 |
-
$query_authors =
|
237 |
if ( ! empty( $query_data['author__in'] ) ) {
|
238 |
$query_authors = $query_data['author__in'];
|
239 |
} elseif ( ! empty( $query_data['author__not_in'] ) ) {
|
240 |
$query_authors = $query_data['author__not_in'];
|
241 |
}
|
242 |
?>
|
243 |
-
<input id="query_author__" name="author__in" data-include="author__in" data-exclude="author__not_in" class="form-control input-
|
244 |
<?php } else { ?>
|
245 |
-
<input type="text" readonly="readonly" name="author__in" class="form-control input-
|
246 |
<?php } ?>
|
247 |
</div>
|
248 |
<?php if ( gm_user_can( 'show_others_media' ) ) { ?>
|
249 |
-
<div class="col-
|
250 |
<label> </label>
|
251 |
-
<div class="checkbox"
|
|
|
|
|
252 |
</div>
|
253 |
<?php } ?>
|
254 |
</div>
|
255 |
</div>
|
256 |
<div class="form-group">
|
257 |
<div class="row">
|
258 |
-
<div class="col-
|
259 |
-
<label><?php
|
260 |
-
<input type="text" class="form-control input-
|
261 |
</div>
|
262 |
-
<div class="col-
|
263 |
-
<label><?php
|
264 |
-
<input type="text" class="form-control input-
|
265 |
</div>
|
266 |
-
<div class="col-
|
267 |
-
<label><?php
|
268 |
-
<input type="text" class="form-control input-
|
269 |
</div>
|
270 |
</div>
|
271 |
</div>
|
272 |
<div class="form-group">
|
273 |
-
<?php
|
|
|
274 |
if ( $i ) {
|
275 |
continue;
|
276 |
}
|
277 |
?>
|
278 |
<div class="row">
|
279 |
-
<div class="col-
|
280 |
-
<label><?php
|
281 |
-
<input type="text" class="form-control input-
|
282 |
-
<span class="help-block"><?php
|
283 |
</div>
|
284 |
-
<div class="col-
|
285 |
-
<label><?php
|
286 |
-
<input type="text" class="form-control input-
|
287 |
-
<span class="help-block"><?php
|
288 |
</div>
|
289 |
-
<div class="col-
|
290 |
-
<label><?php
|
291 |
-
<select class="form-control input-
|
292 |
-
<option <?php selected( $q['compare'], '' ); ?> value=""><?php
|
293 |
<option <?php selected( $q['compare'], '=' ); ?> value="=">=</option>
|
294 |
<option <?php selected( $q['compare'], '!=' ); ?> value="!=">!=</option>
|
295 |
<option <?php selected( $q['compare'], '>' ); ?> value=">">></option>
|
@@ -298,20 +313,24 @@ global $user_ID, $gmDB, $gmCore
|
|
298 |
<option <?php selected( $q['compare'], '<=' ); ?> value="<="><=</option>
|
299 |
<option <?php selected( $q['compare'], 'LIKE' ); ?> value="LIKE">LIKE</option>
|
300 |
<option <?php selected( $q['compare'], 'NOT LIKE' ); ?> value="NOT LIKE">NOT LIKE</option>
|
301 |
-
<?php
|
|
|
|
|
302 |
<option <?php selected($q['compare'], 'IN'); ?> value="IN">IN</option>
|
303 |
<option <?php selected($q['compare'], 'NOT IN'); ?> value="NOT IN">NOT IN</option>
|
304 |
<option <?php selected($q['compare'], 'BETWEEN'); ?> value="BETWEEN">BETWEEN</option>
|
305 |
<option <?php selected($q['compare'], 'NOT BETWEEN'); ?> value="NOT BETWEEN">NOT BETWEEN</option>
|
306 |
-
<?php
|
|
|
|
|
307 |
<option <?php selected( $q['compare'], 'EXISTS' ); ?> value="EXISTS">EXISTS</option>
|
308 |
</select>
|
309 |
-
<span class="help-block"><?php
|
310 |
</div>
|
311 |
-
<div class="col-
|
312 |
-
<label><?php
|
313 |
-
<select class="form-control input-
|
314 |
-
<option <?php selected( $q['type'], '' ); ?> value=""><?php
|
315 |
<option <?php selected( $q['type'], 'CHAR' ); ?> value="CHAR">CHAR</option>
|
316 |
<option <?php selected( $q['type'], 'NUMERIC' ); ?> value="NUMERIC">NUMERIC</option>
|
317 |
<option <?php selected( $q['type'], 'DECIMAL' ); ?> value="DECIMAL">DECIMAL</option>
|
@@ -322,236 +341,237 @@ global $user_ID, $gmDB, $gmCore
|
|
322 |
<option <?php selected( $q['type'], 'SIGNED' ); ?> value="SIGNED">SIGNED</option>
|
323 |
<option <?php selected( $q['type'], 'UNSIGNED' ); ?> value="UNSIGNED">UNSIGNED</option>
|
324 |
</select>
|
325 |
-
<span class="help-block"><?php
|
326 |
</div>
|
327 |
</div>
|
328 |
<?php } ?>
|
329 |
</div>
|
330 |
<div class="form-group">
|
331 |
<div class="row">
|
332 |
-
<div class="col-
|
333 |
-
<label><?php
|
334 |
-
<select class="form-control input-
|
335 |
-
<option <?php selected( $query_data['order'], '' ); ?> value=""><?php
|
336 |
-
<option <?php selected( $query_data['order'], 'DESC' ); ?> value="DESC"><?php
|
337 |
-
<option <?php selected( $query_data['order'], 'ASC' ); ?> value="ASC"><?php
|
338 |
</select>
|
339 |
-
<span class="help-block"><?php
|
340 |
</div>
|
341 |
-
<div class="col-
|
342 |
-
<label><?php
|
343 |
-
<select class="form-control input-
|
344 |
-
<option <?php selected( $query_data['orderby'], '' ); ?> value=""><?php
|
345 |
-
<option <?php selected( $query_data['orderby'], 'id' ); ?> value="ID"><?php
|
346 |
-
<option <?php selected( $query_data['orderby'], 'title' ); ?> value="title"><?php
|
347 |
-
<option <?php selected( $query_data['orderby'], 'gmuid' ); ?> value="gmuid"><?php
|
348 |
-
<option <?php selected( $query_data['orderby'], 'author' ); ?> value="author"><?php
|
349 |
-
<option <?php selected( $query_data['orderby'], 'gmedia__in' ); ?> value="gmedia__in"><?php
|
350 |
-
<option <?php selected( $query_data['orderby'], 'date' ); ?> value="date"><?php
|
351 |
-
<option <?php selected( $query_data['orderby'], 'modified' ); ?> value="modified"><?php
|
352 |
-
<option <?php selected( $query_data['orderby'], '_created_timestamp' ); ?> value="_created_timestamp"><?php
|
353 |
-
<option <?php selected( $query_data['orderby'], 'comment_count' ); ?> value="comment_count"><?php
|
354 |
-
<option <?php selected( $query_data['orderby'], 'views' ); ?> value="views"><?php
|
355 |
-
<option <?php selected( $query_data['orderby'], 'likes' ); ?> value="likes"><?php
|
356 |
-
<option <?php selected( $query_data['orderby'], '_size' ); ?> value="_size"><?php
|
357 |
-
<option <?php selected( $query_data['orderby'], 'meta_value' ); ?> value="meta_value"><?php
|
358 |
-
<option <?php selected( $query_data['orderby'], 'meta_value_num' ); ?> value="meta_value_num"><?php
|
359 |
-
<option <?php selected( $query_data['orderby'], 'rand' ); ?> value="rand"><?php
|
360 |
-
<option <?php selected( $query_data['orderby'], 'none' ); ?> value="none"><?php
|
361 |
</select>
|
362 |
-
<span class="help-block"><?php
|
363 |
</div>
|
364 |
-
<div class="col-
|
365 |
-
<label><?php
|
366 |
-
<input type="text" class="form-control input-
|
367 |
-
<span class="help-block"><?php
|
368 |
</div>
|
369 |
</div>
|
370 |
</div>
|
371 |
</div>
|
372 |
<script type="text/javascript">
|
373 |
-
|
374 |
-
|
375 |
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
|
|
|
|
451 |
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
|
465 |
-
|
466 |
-
|
467 |
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
<?php } ?>
|
502 |
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
|
550 |
</script>
|
551 |
<div class="modal-footer">
|
552 |
-
<button type="button" class="btn btn-
|
553 |
-
<button type="button" class="btn btn-primary buildquerysubmit"><?php
|
554 |
-
<button type="button" class="btn btn-
|
555 |
</div>
|
556 |
</div>
|
557 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Modal for Build Query
|
7 |
* @var $gm_album_terms
|
8 |
* @var $gm_category_terms
|
9 |
* @var $gm_tag_terms
|
10 |
+
* @var $gmedia_filter
|
11 |
*/
|
12 |
global $user_ID, $gmDB, $gmCore
|
13 |
?>
|
14 |
<div class="modal fade gmedia-modal" id="buildQuery" tabindex="-1" role="dialog" aria-hidden="true">
|
15 |
+
<div class="modal-dialog mw-100" style="width:700px;">
|
16 |
<div class="modal-content">
|
17 |
<div class="modal-header">
|
18 |
+
<h4 class="modal-title"><?php esc_html_e( 'Query Parameters' ); ?></h4>
|
19 |
+
<div class="float-end" style="margin-top:-4px;">
|
20 |
+
<button type="button" class="btn btn-secondary buildqueryreset"><?php esc_html_e( 'Reset', 'grand-media' ); ?></button>
|
21 |
+
<button type="button" class="btn btn-primary buildquerysubmit"><?php esc_html_e( 'Build Query', 'grand-media' ); ?></button>
|
22 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
23 |
</div>
|
|
|
24 |
</div>
|
25 |
+
<div class="modal-body small">
|
26 |
|
27 |
<?php
|
28 |
$query_data = $gmedia_filter['query_data'];
|
29 |
+
if ( gm_user_can( 'terms' ) ) {
|
30 |
+
?>
|
31 |
<div class="form-group">
|
32 |
<?php
|
33 |
$term_type = 'gmedia_album';
|
34 |
+
$args = array();
|
35 |
if ( gm_user_can( 'edit_others_media' ) ) {
|
36 |
$args['global'] = '';
|
37 |
} else {
|
38 |
+
$args['global'] = array( 0, $user_ID );
|
39 |
}
|
40 |
$gm_album_terms = $gmDB->get_terms( $term_type, $args );
|
41 |
|
42 |
+
$no_term = array(
|
43 |
'term_id' => 0,
|
44 |
'name' => __( 'No Album', 'grand-media' ),
|
45 |
+
);
|
46 |
if ( count( $gm_album_terms ) ) {
|
47 |
foreach ( $gm_album_terms as &$_term ) {
|
48 |
unset( $_term->description );
|
49 |
unset( $_term->taxonomy );
|
50 |
+
// translators: author name.
|
51 |
+
$_term->by_author = $_term->global ? sprintf( esc_html__( 'by %s', 'grand-media' ), esc_html( get_the_author_meta( 'display_name', $_term->global ) ) ) : '';
|
52 |
/* ('publish' === $_term->status? '' : " [{$_term->status}]") . ' (' . $_term->count . ')';*/
|
53 |
}
|
54 |
}
|
55 |
+
$gm_album_terms = array_merge( array( $no_term ), $gm_album_terms );
|
56 |
+
$query_gmedia_albums = array();
|
57 |
$exclude_albums = false;
|
58 |
+
if ( ! empty( $query_data['album__in'] ) || ( '0' === $query_data['album__in'] ) ) {
|
59 |
$query_gmedia_albums = wp_parse_id_list( $query_data['album__in'] );
|
60 |
+
} elseif ( ! empty( $query_data['album__not_in'] ) || ( '0' === $query_data['album__not_in'] ) ) {
|
61 |
$query_gmedia_albums = wp_parse_id_list( $query_data['album__not_in'] );
|
62 |
$exclude_albums = true;
|
63 |
}
|
64 |
?>
|
65 |
+
<label><?php esc_html_e( 'Albums', 'grand-media' ); ?> </label>
|
66 |
|
67 |
<div class="row">
|
68 |
+
<div class="col-sm-8">
|
69 |
+
<input id="query_album__" name="album__in" data-include="album__in" data-exclude="album__not_in" class="form-control gm-selectize input-xs" value="<?php echo esc_attr( implode( ',', $query_gmedia_albums ) ); ?>" placeholder="<?php esc_attr_e( 'Any Album...', 'grand-media' ); ?>"/>
|
70 |
</div>
|
71 |
+
<div class="col-sm-4">
|
72 |
+
<div class="checkbox"><label><input class="query_switch" data-target="query_album__" type="checkbox"<?php echo $exclude_albums ? ' checked="checked"' : ''; ?> /> <?php esc_html_e( 'Exclude selected Albums', 'grand-media' ); ?></label></div>
|
73 |
</div>
|
74 |
</div>
|
75 |
<div class="row">
|
76 |
+
<div class="col-sm-8">
|
77 |
+
<p class="help-block"><?php esc_html_e( 'To show all albums just select `No Album` in dropdown above then tick `Exclude selected Albums`, so it exclude all images without Album and show other images.', 'grand-media' ); ?></p>
|
78 |
</div>
|
79 |
+
<div class="col-sm-4">
|
80 |
+
<label><?php esc_html_e( 'Albums Order', 'grand-media' ); ?> </label>
|
81 |
+
<select name="albums_order" class="form-control input-xs">
|
82 |
+
<option <?php selected( $query_data['albums_order'], '' ); ?> value=""><?php esc_html_e( 'No Order' ); ?></option>
|
83 |
+
<option <?php selected( $query_data['albums_order'], 'id' ); ?> value="id"><?php esc_html_e( 'By ID (ASC)' ); ?></option>
|
84 |
+
<option <?php selected( $query_data['albums_order'], 'id_desc' ); ?> value="desc"><?php esc_html_e( 'By ID (DESC)' ); ?></option>
|
85 |
+
<option <?php selected( $query_data['albums_order'], 'name' ); ?> value="name"><?php esc_html_e( 'By Name (ASC)' ); ?></option>
|
86 |
+
<option <?php selected( $query_data['albums_order'], 'name_desc' ); ?> value="name_desc"><?php esc_html_e( 'By Name (DESC)' ); ?></option>
|
87 |
+
<option <?php selected( $query_data['albums_order'], 'date' ); ?> value="date"><?php esc_html_e( 'By Date (ASC)' ); ?></option>
|
88 |
+
<option <?php selected( $query_data['albums_order'], 'date_desc' ); ?> value="date_desc"><?php esc_html_e( 'By Date (DESC)' ); ?></option>
|
89 |
</select>
|
90 |
</div>
|
91 |
</div>
|
94 |
<div class="form-group">
|
95 |
<?php
|
96 |
$term_type = 'gmedia_category';
|
97 |
+
$gm_category_terms = $gmDB->get_terms( $term_type, array( 'fields' => 'names_count' ) );
|
98 |
|
99 |
+
$no_term = array(
|
100 |
'term_id' => 0,
|
101 |
'name' => __( 'Uncategorized', 'grand-media' ),
|
102 |
+
);
|
103 |
+
$gm_category_terms = array_merge( array( $no_term ), $gm_category_terms );
|
104 |
?>
|
105 |
<div class="row">
|
106 |
+
<div class="col-sm-4">
|
107 |
+
<label><?php esc_html_e( '[IN] Categories', 'grand-media' ); ?></label>
|
108 |
+
<input name="category__in" class="form-control input-xs gm_cat_in gm-selectize combobox_gmedia_category" value="<?php echo esc_attr( implode( ',', wp_parse_id_list( $query_data['category__in'] ) ) ); ?>" placeholder="<?php esc_attr_e( 'Either of chosen Categories...', 'grand-media' ); ?>"/>
|
109 |
</div>
|
110 |
+
<div class="col-sm-4">
|
111 |
+
<label><?php esc_html_e( '[AND] Categories', 'grand-media' ); ?></label>
|
112 |
+
<input name="category__and" class="form-control input-xs gm_cat_and gm-selectize combobox_gmedia_category" value="<?php echo esc_attr( implode( ',', wp_parse_id_list( $query_data['category__and'] ) ) ); ?>" placeholder="<?php esc_attr_e( 'Have all chosen Categories...', 'grand-media' ); ?>"/>
|
113 |
</div>
|
114 |
+
<div class="col-sm-4">
|
115 |
+
<label><?php esc_html_e( '[NOT IN] Categories', 'grand-media' ); ?></label>
|
116 |
+
<input name="category__not_in" class="form-control input-xs gm_cat_not_in gm-selectize combobox_gmedia_category" value="<?php echo esc_attr( implode( ',', wp_parse_id_list( $query_data['category__not_in'] ) ) ); ?>" placeholder="<?php esc_attr_e( 'Exclude Categories...', 'grand-media' ); ?>"/>
|
117 |
</div>
|
118 |
</div>
|
119 |
</div>
|
121 |
<div class="form-group">
|
122 |
<?php
|
123 |
$term_type = 'gmedia_tag';
|
124 |
+
$gm_tag_terms = $gmDB->get_terms( $term_type, array( 'fields' => 'names_count' ) );
|
125 |
?>
|
126 |
<div class="row">
|
127 |
+
<div class="col-sm-4">
|
128 |
+
<label><?php esc_html_e( '[IN] Tags', 'grand-media' ); ?> </label>
|
129 |
+
<input name="tag__in" class="form-control input-xs gm-selectize combobox_gmedia_tag" value="<?php echo esc_attr( implode( ',', wp_parse_id_list( $query_data['tag__in'] ) ) ); ?>" placeholder="<?php esc_attr_e( 'Either of chosen Tags...', 'grand-media' ); ?>"/>
|
130 |
</div>
|
131 |
+
<div class="col-sm-4">
|
132 |
+
<label><?php esc_html_e( '[AND] Tags', 'grand-media' ); ?> </label>
|
133 |
+
<input name="tag__and" class="form-control input-xs gm-selectize combobox_gmedia_tag" value="<?php echo esc_attr( implode( ',', wp_parse_id_list( $query_data['tag__and'] ) ) ); ?>" placeholder="<?php esc_attr_e( 'Have all chosen Tags...', 'grand-media' ); ?>"/>
|
134 |
</div>
|
135 |
+
<div class="col-sm-4">
|
136 |
+
<label><?php esc_html_e( '[NOT IN] Tags', 'grand-media' ); ?> </label>
|
137 |
+
<input name="tag__not_in" class="form-control input-xs gm-selectize combobox_gmedia_tag" value="<?php echo esc_attr( implode( ',', wp_parse_id_list( $query_data['tag__not_in'] ) ) ); ?>" placeholder="<?php esc_attr_e( 'Exclude Tags...', 'grand-media' ); ?>"/>
|
138 |
</div>
|
139 |
</div>
|
140 |
</div>
|
141 |
|
142 |
<?php } ?>
|
143 |
<div class="form-group">
|
144 |
+
<label><?php esc_html_e( 'Terms Relation', 'grand-media' ); ?> </label>
|
145 |
|
146 |
<div class="row">
|
147 |
+
<div class="col-sm-4">
|
148 |
+
<select name="terms_relation" class="form-control input-xs">
|
149 |
+
<option <?php selected( $query_data['terms_relation'], '' ); ?> value=""><?php esc_html_e( 'Default (OR)' ); ?></option>
|
150 |
+
<option <?php selected( $query_data['terms_relation'], 'AND' ); ?> value="AND"><?php esc_html_e( 'AND' ); ?></option>
|
151 |
+
<option <?php selected( $query_data['terms_relation'], 'OR' ); ?> value="OR"><?php esc_html_e( 'OR' ); ?></option>
|
152 |
</select>
|
153 |
</div>
|
154 |
+
<div class="col-sm-8">
|
155 |
+
<p class="help-block"><?php esc_html_e( 'allows you to describe the relationship between the taxonomy queries', 'grand-media' ); ?></p>
|
156 |
</div>
|
157 |
</div>
|
158 |
</div>
|
159 |
<div class="form-group">
|
160 |
+
<label><?php esc_html_e( 'Search', 'grand-media' ); ?></label>
|
161 |
|
162 |
<div class="row">
|
163 |
+
<div class="col-sm-8">
|
164 |
+
<input type="text" class="form-control input-xs" placeholder="<?php esc_attr_e( 'Search string or terms separated by comma', 'grand-media' ); ?>" value="<?php echo esc_attr( $query_data['s'] ); ?>" name="s">
|
165 |
</div>
|
166 |
+
<div class="col-sm-4">
|
167 |
+
<div class="checkbox"><label><input type="checkbox" name="exact" value="yes"<?php echo $query_data['exact'] ? ' checked="checked"' : ''; ?> /> <?php esc_html_e( 'Search exactly string', 'grand-media' ); ?></label></div>
|
168 |
</div>
|
169 |
</div>
|
170 |
</div>
|
171 |
<div class="form-group">
|
172 |
<div class="row">
|
173 |
+
<div class="col-sm-8">
|
174 |
+
<div class="float-end">
|
175 |
+
<a
|
176 |
+
id="_use_lib_selected"
|
177 |
+
title="<?php esc_attr_e( 'Select Media', 'grand-media' ); ?>"
|
178 |
+
href="<?php echo esc_url( $gmCore->get_admin_url( array( 'page' => 'GrandMedia', 'mode' => 'select_multiple', 'gmediablank' => 'library' ), array(), true ) ); ?>"
|
179 |
+
class="label label-primary preview-modal"
|
180 |
+
data-bs-toggle="modal"
|
181 |
+
data-bs-target="#previewModal"
|
182 |
+
data-width="1200"
|
183 |
+
data-height="500"
|
184 |
+
data-cls="select_gmedia"
|
185 |
+
>
|
186 |
+
<?php esc_html_e( 'Select in Library', 'grand-media' ); ?>
|
187 |
+
</a>
|
188 |
</div>
|
189 |
+
<label><?php esc_html_e( 'Gmedia IDs <small class="text-muted">separated by comma</small>', 'grand-media' ); ?> </label>
|
190 |
</div>
|
191 |
</div>
|
192 |
<div class="row">
|
193 |
+
<div class="col-sm-8">
|
194 |
+
<?php
|
195 |
+
$query_gmedia_items = array();
|
196 |
if ( ! empty( $query_data['gmedia__in'] ) ) {
|
197 |
$query_gmedia_items = $query_data['gmedia__in'];
|
198 |
} elseif ( ! empty( $query_data['gmedia__not_in'] ) ) {
|
199 |
$query_gmedia_items = $query_data['gmedia__not_in'];
|
200 |
}
|
201 |
?>
|
202 |
+
<textarea id="query_gmedia__" name="gmedia__in" data-include="gmedia__in" data-exclude="gmedia__not_in" rows="1" class="form-control input-xs" style="resize:vertical;" placeholder="<?php esc_attr_e( 'Gmedia IDs...', 'grand-media' ); ?>"><?php echo esc_textarea( implode( ',', wp_parse_id_list( $query_gmedia_items ) ) ); ?></textarea>
|
203 |
</div>
|
204 |
+
<div class="col-sm-4">
|
205 |
+
<div class="checkbox">
|
206 |
+
<label><input class="query_switch" data-target="query_gmedia__" type="checkbox"<?php echo ( empty( $query_data['gmedia__in'] ) && ! empty( $query_data['gmedia__not_in'] ) ) ? ' checked="checked"' : ''; ?> /> <?php esc_html_e( 'Exclude selected Items', 'grand-media' ); ?>
|
207 |
+
</label></div>
|
208 |
</div>
|
209 |
</div>
|
210 |
+
<p class="help-block"><?php esc_html_e( 'You can select items you want to add here right in Gmedia Library and then return here and click button "Use selected in Library"', 'grand-media' ); ?></p>
|
211 |
</div>
|
212 |
<div class="form-group">
|
213 |
<div class="row">
|
214 |
+
<div class="col-sm-4">
|
215 |
+
<label><?php esc_html_e( 'Mime Type', 'grand-media' ); ?> </label>
|
216 |
<?php
|
217 |
+
$mime_types = array(
|
218 |
+
array( 'value' => 'image', 'text' => 'Image' ),
|
219 |
+
array( 'value' => 'audio', 'text' => 'Audio' ),
|
220 |
+
array( 'value' => 'video', 'text' => 'Video' ),
|
221 |
+
array( 'value' => 'text', 'text' => 'Text' ),
|
222 |
+
array( 'value' => 'application', 'text' => 'Application' ),
|
223 |
+
);
|
224 |
$mime_type_val = is_array( $query_data['mime_type'] ) ? implode( ',', $query_data['mime_type'] ) : str_replace( ', ', ',', $query_data['mime_type'] );
|
225 |
?>
|
226 |
+
<input name="mime_type" class="form-control input-xs gm-selectize gmedia-combobox" data-options='<?php echo wp_json_encode( $mime_types ); ?>' value="<?php echo esc_attr( $mime_type_val ); ?>" placeholder="<?php esc_attr_e( 'All types...', 'grand-media' ); ?>"/>
|
227 |
</div>
|
228 |
+
<div class="col-sm-4">
|
229 |
+
<label><?php esc_html_e( 'Authors', 'grand-media' ); ?></label>
|
230 |
+
<?php
|
231 |
+
if ( gm_user_can( 'show_others_media' ) ) {
|
232 |
$user_ids = $gmCore->get_editable_user_ids();
|
233 |
if ( ! in_array( $user_ID, $user_ids, true ) ) {
|
234 |
+
$user_ids[] = $user_ID;
|
235 |
}
|
236 |
+
$filter_users = get_users( array( 'include' => $user_ids ) );
|
237 |
$users = '';
|
238 |
+
$_users = array();
|
239 |
if ( count( $filter_users ) ) {
|
240 |
$author__in = wp_parse_id_list( $query_data['author__in'] );
|
241 |
foreach ( (array) $filter_users as $user ) {
|
242 |
$user->ID = (int) $user->ID;
|
243 |
$_selected = in_array( $user->ID, $author__in, true ) ? ' selected="selected"' : '';
|
244 |
+
$users .= '<option value="' . intval( $user->ID ) . '" ' . $_selected . '>' . esc_html( $user->display_name ) . '</option>';
|
245 |
+
$_users[] = array( 'value' => $user->ID, 'text' => esc_html( $user->display_name ) );
|
246 |
}
|
247 |
}
|
248 |
+
$query_authors = array();
|
249 |
if ( ! empty( $query_data['author__in'] ) ) {
|
250 |
$query_authors = $query_data['author__in'];
|
251 |
} elseif ( ! empty( $query_data['author__not_in'] ) ) {
|
252 |
$query_authors = $query_data['author__not_in'];
|
253 |
}
|
254 |
?>
|
255 |
+
<input id="query_author__" name="author__in" data-include="author__in" data-exclude="author__not_in" class="form-control input-xs gm-selectize gmedia-combobox" data-options='<?php echo esc_attr( str_replace( "'", "\'", wp_json_encode( $_users ) ) ); ?>' value="<?php echo esc_attr( implode( ',', wp_parse_id_list( $query_authors ) ) ); ?>" placeholder="<?php esc_attr_e( 'All authors...', 'grand-media' ); ?>"/>
|
256 |
<?php } else { ?>
|
257 |
+
<input type="text" readonly="readonly" name="author__in" class="form-control input-xs" value="<?php the_author_meta( 'display_name', $user_ID ); ?>"/>
|
258 |
<?php } ?>
|
259 |
</div>
|
260 |
<?php if ( gm_user_can( 'show_others_media' ) ) { ?>
|
261 |
+
<div class="col-sm-4">
|
262 |
<label> </label>
|
263 |
+
<div class="checkbox">
|
264 |
+
<label><input class="query_switch" data-target="query_author__" type="checkbox"<?php echo ( empty( $query_data['author__in'] ) && ! empty( $query_data['author__not_in'] ) ) ? ' checked="checked"' : ''; ?> /> <?php esc_html_e( 'Exclude Authors', 'grand-media' ); ?></label>
|
265 |
+
</div>
|
266 |
</div>
|
267 |
<?php } ?>
|
268 |
</div>
|
269 |
</div>
|
270 |
<div class="form-group">
|
271 |
<div class="row">
|
272 |
+
<div class="col-sm-4">
|
273 |
+
<label><?php esc_html_e( 'Year', 'grand-media' ); ?></label>
|
274 |
+
<input type="text" class="form-control input-xs" placeholder="<?php esc_attr_e( '4 digit year e.g. 2011', 'grand-media' ); ?>" value="<?php echo esc_attr( $query_data['year'] ); ?>" name="year">
|
275 |
</div>
|
276 |
+
<div class="col-sm-4">
|
277 |
+
<label><?php esc_html_e( 'Month', 'grand-media' ); ?></label>
|
278 |
+
<input type="text" class="form-control input-xs" placeholder="<?php esc_attr_e( 'from 1 to 12', 'grand-media' ); ?>" value="<?php echo esc_attr( $query_data['monthnum'] ); ?>" name="monthnum">
|
279 |
</div>
|
280 |
+
<div class="col-sm-4">
|
281 |
+
<label><?php esc_html_e( 'Day', 'grand-media' ); ?></label>
|
282 |
+
<input type="text" class="form-control input-xs" placeholder="<?php esc_attr_e( 'from 1 to 31', 'grand-media' ); ?>" value="<?php echo esc_attr( $query_data['day'] ); ?>" name="day">
|
283 |
</div>
|
284 |
</div>
|
285 |
</div>
|
286 |
<div class="form-group">
|
287 |
+
<?php
|
288 |
+
foreach ( $query_data['meta_query'] as $i => $q ) {
|
289 |
if ( $i ) {
|
290 |
continue;
|
291 |
}
|
292 |
?>
|
293 |
<div class="row">
|
294 |
+
<div class="col-sm-6 col-md-3">
|
295 |
+
<label><?php esc_html_e( 'Custom Field Key', 'grand-media' ); ?></label>
|
296 |
+
<input type="text" class="form-control input-xs" value="<?php echo esc_attr( $q['key'] ); ?>" name="meta_query[<?php echo (int) $i; ?>][key]">
|
297 |
+
<span class="help-block small"><?php esc_html_e( 'Display items with this field key', 'grand-media' ); ?></span>
|
298 |
</div>
|
299 |
+
<div class="col-sm-6 col-md-3">
|
300 |
+
<label><?php esc_html_e( 'Custom Field Value', 'grand-media' ); ?></label>
|
301 |
+
<input type="text" class="form-control input-xs" value="<?php echo esc_attr( $q['value'] ); ?>" name="meta_query[<?php echo (int) $i; ?>][value]">
|
302 |
+
<span class="help-block small"><?php esc_html_e( 'Display items with this field value', 'grand-media' ); ?></span>
|
303 |
</div>
|
304 |
+
<div class="col-sm-6 col-md-3">
|
305 |
+
<label><?php esc_html_e( 'Compare Operator', 'grand-media' ); ?></label>
|
306 |
+
<select class="form-control input-xs" name="meta_query[<?php echo (int) $i; ?>][compare]">
|
307 |
+
<option <?php selected( $q['compare'], '' ); ?> value=""><?php esc_html_e( 'Default', 'grand-media' ); ?> (=)</option>
|
308 |
<option <?php selected( $q['compare'], '=' ); ?> value="=">=</option>
|
309 |
<option <?php selected( $q['compare'], '!=' ); ?> value="!=">!=</option>
|
310 |
<option <?php selected( $q['compare'], '>' ); ?> value=">">></option>
|
313 |
<option <?php selected( $q['compare'], '<=' ); ?> value="<="><=</option>
|
314 |
<option <?php selected( $q['compare'], 'LIKE' ); ?> value="LIKE">LIKE</option>
|
315 |
<option <?php selected( $q['compare'], 'NOT LIKE' ); ?> value="NOT LIKE">NOT LIKE</option>
|
316 |
+
<?php
|
317 |
+
/*
|
318 |
+
?>
|
319 |
<option <?php selected($q['compare'], 'IN'); ?> value="IN">IN</option>
|
320 |
<option <?php selected($q['compare'], 'NOT IN'); ?> value="NOT IN">NOT IN</option>
|
321 |
<option <?php selected($q['compare'], 'BETWEEN'); ?> value="BETWEEN">BETWEEN</option>
|
322 |
<option <?php selected($q['compare'], 'NOT BETWEEN'); ?> value="NOT BETWEEN">NOT BETWEEN</option>
|
323 |
+
<?php
|
324 |
+
*/
|
325 |
+
?>
|
326 |
<option <?php selected( $q['compare'], 'EXISTS' ); ?> value="EXISTS">EXISTS</option>
|
327 |
</select>
|
328 |
+
<span class="help-block small"><?php esc_html_e( 'Operator to test the field value', 'grand-media' ); ?></span>
|
329 |
</div>
|
330 |
+
<div class="col-sm-6 col-md-3">
|
331 |
+
<label><?php esc_html_e( 'Meta Type', 'grand-media' ); ?></label>
|
332 |
+
<select class="form-control input-xs" name="meta_query[<?php echo (int) $i; ?>][type]">
|
333 |
+
<option <?php selected( $q['type'], '' ); ?> value=""><?php esc_html_e( 'Default', 'grand-media' ); ?> (CHAR)</option>
|
334 |
<option <?php selected( $q['type'], 'CHAR' ); ?> value="CHAR">CHAR</option>
|
335 |
<option <?php selected( $q['type'], 'NUMERIC' ); ?> value="NUMERIC">NUMERIC</option>
|
336 |
<option <?php selected( $q['type'], 'DECIMAL' ); ?> value="DECIMAL">DECIMAL</option>
|
341 |
<option <?php selected( $q['type'], 'SIGNED' ); ?> value="SIGNED">SIGNED</option>
|
342 |
<option <?php selected( $q['type'], 'UNSIGNED' ); ?> value="UNSIGNED">UNSIGNED</option>
|
343 |
</select>
|
344 |
+
<span class="help-block small"><?php esc_html_e( 'Custom field type', 'grand-media' ); ?></span>
|
345 |
</div>
|
346 |
</div>
|
347 |
<?php } ?>
|
348 |
</div>
|
349 |
<div class="form-group">
|
350 |
<div class="row">
|
351 |
+
<div class="col-sm-6 col-md-3">
|
352 |
+
<label><?php esc_html_e( 'Order', 'grand-media' ); ?></label>
|
353 |
+
<select class="form-control input-xs" name="order">
|
354 |
+
<option <?php selected( $query_data['order'], '' ); ?> value=""><?php esc_html_e( 'Default (DESC)', 'grand-media' ); ?></option>
|
355 |
+
<option <?php selected( $query_data['order'], 'DESC' ); ?> value="DESC"><?php esc_html_e( 'DESC', 'grand-media' ); ?></option>
|
356 |
+
<option <?php selected( $query_data['order'], 'ASC' ); ?> value="ASC"><?php esc_html_e( 'ASC', 'grand-media' ); ?></option>
|
357 |
</select>
|
358 |
+
<span class="help-block small"><?php esc_html_e( 'Ascending or Descending order', 'grand-media' ); ?></span>
|
359 |
</div>
|
360 |
+
<div class="col-sm-6 col-md-3">
|
361 |
+
<label><?php esc_html_e( 'Order by', 'grand-media' ); ?></label>
|
362 |
+
<select class="form-control input-xs" name="orderby">
|
363 |
+
<option <?php selected( $query_data['orderby'], '' ); ?> value=""><?php esc_html_e( 'Default (ID)', 'grand-media' ); ?></option>
|
364 |
+
<option <?php selected( $query_data['orderby'], 'id' ); ?> value="ID"><?php esc_html_e( 'ID', 'grand-media' ); ?></option>
|
365 |
+
<option <?php selected( $query_data['orderby'], 'title' ); ?> value="title"><?php esc_html_e( 'Title', 'grand-media' ); ?></option>
|
366 |
+
<option <?php selected( $query_data['orderby'], 'gmuid' ); ?> value="gmuid"><?php esc_html_e( 'Filename', 'grand-media' ); ?></option>
|
367 |
+
<option <?php selected( $query_data['orderby'], 'author' ); ?> value="author"><?php esc_html_e( 'Author', 'grand-media' ); ?></option>
|
368 |
+
<option <?php selected( $query_data['orderby'], 'gmedia__in' ); ?> value="gmedia__in"><?php esc_html_e( 'Selected Order', 'grand-media' ); ?></option>
|
369 |
+
<option <?php selected( $query_data['orderby'], 'date' ); ?> value="date"><?php esc_html_e( 'Date', 'grand-media' ); ?></option>
|
370 |
+
<option <?php selected( $query_data['orderby'], 'modified' ); ?> value="modified"><?php esc_html_e( 'Modified Date', 'grand-media' ); ?></option>
|
371 |
+
<option <?php selected( $query_data['orderby'], '_created_timestamp' ); ?> value="_created_timestamp"><?php esc_html_e( 'Created Timestamp', 'grand-media' ); ?></option>
|
372 |
+
<option <?php selected( $query_data['orderby'], 'comment_count' ); ?> value="comment_count"><?php esc_html_e( 'Comment Count', 'grand-media' ); ?></option>
|
373 |
+
<option <?php selected( $query_data['orderby'], 'views' ); ?> value="views"><?php esc_html_e( 'Views Count', 'grand-media' ); ?></option>
|
374 |
+
<option <?php selected( $query_data['orderby'], 'likes' ); ?> value="likes"><?php esc_html_e( 'Likes Count', 'grand-media' ); ?></option>
|
375 |
+
<option <?php selected( $query_data['orderby'], '_size' ); ?> value="_size"><?php esc_html_e( 'File Size', 'grand-media' ); ?></option>
|
376 |
+
<option <?php selected( $query_data['orderby'], 'meta_value' ); ?> value="meta_value"><?php esc_html_e( 'Custom Field Value', 'grand-media' ); ?></option>
|
377 |
+
<option <?php selected( $query_data['orderby'], 'meta_value_num' ); ?> value="meta_value_num"><?php esc_html_e( 'Custom Field Value (Numeric)', 'grand-media' ); ?></option>
|
378 |
+
<option <?php selected( $query_data['orderby'], 'rand' ); ?> value="rand"><?php esc_html_e( 'Random', 'grand-media' ); ?></option>
|
379 |
+
<option <?php selected( $query_data['orderby'], 'none' ); ?> value="none"><?php esc_html_e( 'None', 'grand-media' ); ?></option>
|
380 |
</select>
|
381 |
+
<span class="help-block small"><?php esc_html_e( 'Sort retrieved posts by', 'grand-media' ); ?></span>
|
382 |
</div>
|
383 |
+
<div class="col-sm-6 col-md-3">
|
384 |
+
<label><?php esc_html_e( 'Limit', 'grand-media' ); ?></label>
|
385 |
+
<input type="text" class="form-control input-xs" value="<?php echo esc_attr( $query_data['limit'] ); ?>" name="limit" placeholder="<?php esc_attr_e( 'leave empty for no limit', 'grand-media' ); ?>">
|
386 |
+
<span class="help-block small"><?php esc_html_e( 'Limit number of gmedia items', 'grand-media' ); ?></span>
|
387 |
</div>
|
388 |
</div>
|
389 |
</div>
|
390 |
</div>
|
391 |
<script type="text/javascript">
|
392 |
+
jQuery(function($) {
|
393 |
+
<?php if ( gm_user_can( 'terms' ) ) { ?>
|
394 |
|
395 |
+
var gmedia_albums = <?php echo wp_json_encode( array_values( $gm_album_terms ) ); ?>;
|
396 |
+
var gmedia_categories = <?php echo wp_json_encode( array_values( $gm_category_terms ) ); ?>;
|
397 |
+
var gmedia_tags = <?php echo wp_json_encode( array_values( $gm_tag_terms ) ); ?>;
|
398 |
+
$('#query_album__').selectize({
|
399 |
+
plugins: ['drag_drop'],
|
400 |
+
create: false,
|
401 |
+
options: gmedia_albums,
|
402 |
+
hideSelected: true,
|
403 |
+
allowEmptyOption: true,
|
404 |
+
valueField: 'term_id',
|
405 |
+
searchField: ['name'],
|
406 |
+
//labelField: 'name',
|
407 |
+
render: {
|
408 |
+
item: function(item, escape) {
|
409 |
+
var count = '';
|
410 |
+
var status = '';
|
411 |
+
var author = '';
|
412 |
+
var term_id = '';
|
413 |
+
if (parseInt(item.term_id)) {
|
414 |
+
count = '(' + escape(item.count) + ')';
|
415 |
+
status = (typeof item.status !== 'undefined' && ('publish' !== item.status)) ? ' [' + item.status + '] ' : '';
|
416 |
+
author = ' ' + item.by_author;
|
417 |
+
term_id = '[' + item.term_id + '] ';
|
418 |
+
}
|
419 |
+
return '<div>' + term_id + escape(item.name) + ' <small>' + count + status + author + '</small></div>';
|
420 |
+
},
|
421 |
+
option: function(item, escape) {
|
422 |
+
var count = '';
|
423 |
+
var status = '';
|
424 |
+
var author = '';
|
425 |
+
var term_id = '';
|
426 |
+
if (parseInt(item.term_id)) {
|
427 |
+
count = '(' + escape(item.count) + ')';
|
428 |
+
status = (typeof item.status !== 'undefined' && ('publish' !== item.status)) ? ' [' + item.status + '] ' : '';
|
429 |
+
author = ' ' + item.by_author;
|
430 |
+
term_id = '[' + item.term_id + '] ';
|
431 |
+
}
|
432 |
+
return '<div>[' + item.term_id + '] ' + escape(item.name) + ' <small>' + count + status + author + '</small></div>';
|
433 |
+
},
|
434 |
+
},
|
435 |
|
436 |
+
});
|
437 |
+
var cats = $('.combobox_gmedia_category').selectize({
|
438 |
+
plugins: ['drag_drop'],
|
439 |
+
create: false,
|
440 |
+
options: gmedia_categories,
|
441 |
+
preload: true,
|
442 |
+
hideSelected: true,
|
443 |
+
allowEmptyOption: true,
|
444 |
+
valueField: 'term_id',
|
445 |
+
searchField: ['name'],
|
446 |
+
disabledField: 'disable',
|
447 |
+
//labelField: 'name',
|
448 |
+
render: {
|
449 |
+
item: function(item, escape) {
|
450 |
+
var count = '';
|
451 |
+
var term_id = '';
|
452 |
+
if (parseInt(item.term_id)) {
|
453 |
+
count = ' <small>(' + escape(item.count) + ')</small>';
|
454 |
+
term_id = '[' + item.term_id + '] ';
|
455 |
+
}
|
456 |
+
return '<div>' + term_id + escape(item.name) + count + '</div>';
|
457 |
+
},
|
458 |
+
option: function(item, escape) {
|
459 |
+
if (('category__and' === this.$input[0].name) && !item.term_id) {
|
460 |
+
item.disable = true;
|
461 |
+
return '<div></div>';
|
462 |
+
}
|
463 |
+
var count = '';
|
464 |
+
var term_id = '';
|
465 |
+
if (parseInt(item.term_id)) {
|
466 |
+
count = ' <small>(' + escape(item.count) + ')</small>';
|
467 |
+
term_id = '[' + item.term_id + '] ';
|
468 |
+
}
|
469 |
+
return '<div>' + term_id + escape(item.name) + count + '</div>';
|
470 |
+
},
|
471 |
+
},
|
472 |
|
473 |
+
}).on('change', function() {
|
474 |
+
var allSelected = [];
|
475 |
+
jQuery.each(cats, function(i, e) {
|
476 |
+
allSelected = jQuery.merge(allSelected, e.selectize.items);
|
477 |
+
});
|
478 |
|
479 |
+
jQuery.each(cats, function(i, e) {
|
480 |
+
var orig_items = e.selectize.items;
|
481 |
+
e.selectize.items = allSelected;
|
482 |
+
e.selectize.currentResults = e.selectize.search();
|
483 |
+
e.selectize.refreshOptions(false);
|
484 |
+
e.selectize.items = orig_items;
|
485 |
|
486 |
+
});
|
487 |
+
});
|
488 |
|
489 |
+
var tags = $('.combobox_gmedia_tag').selectize({
|
490 |
+
plugins: ['drag_drop'],
|
491 |
+
create: false,
|
492 |
+
options: gmedia_tags,
|
493 |
+
hideSelected: true,
|
494 |
+
allowEmptyOption: true,
|
495 |
+
valueField: 'term_id',
|
496 |
+
searchField: ['name'],
|
497 |
+
render: {
|
498 |
+
item: function(item, escape) {
|
499 |
+
return '<div>[' + item.term_id + '] ' + escape(item.name) + ' <small>(' + escape(item.count) + ')</small></div>';
|
500 |
+
},
|
501 |
+
option: function(item, escape) {
|
502 |
+
return '<div>[' + item.term_id + '] ' + escape(item.name) + ' <small>(' + escape(item.count) + ')</small></div>';
|
503 |
+
},
|
504 |
+
},
|
505 |
|
506 |
+
}).on('change', function() {
|
507 |
+
var allSelected = [];
|
508 |
+
jQuery.each(tags, function(i, e) {
|
509 |
+
allSelected = jQuery.merge(allSelected, e.selectize.items);
|
510 |
+
});
|
511 |
|
512 |
+
jQuery.each(tags, function(i, e) {
|
513 |
+
var orig_items = e.selectize.items;
|
514 |
+
e.selectize.items = allSelected;
|
515 |
+
e.selectize.currentResults = e.selectize.search();
|
516 |
+
e.selectize.refreshOptions(false);
|
517 |
+
e.selectize.items = orig_items;
|
518 |
|
519 |
+
});
|
520 |
+
});
|
521 |
+
<?php } ?>
|
|
|
522 |
|
523 |
+
$('.gmedia-combobox').each(function() {
|
524 |
+
var select = $(this).selectize({
|
525 |
+
create: false,
|
526 |
+
hideSelected: true,
|
527 |
+
options: $(this).data('options'),
|
528 |
+
});
|
529 |
+
});
|
530 |
|
531 |
+
$('.query_switch').on('click', function() {
|
532 |
+
var el = $('#' + $(this).attr('data-target'));
|
533 |
+
if ($(this).is(':checked')) {
|
534 |
+
el.attr('name', el.attr('data-exclude'));
|
535 |
+
}
|
536 |
+
else {
|
537 |
+
el.attr('name', el.attr('data-include'));
|
538 |
+
}
|
539 |
+
});
|
540 |
+
$('#use_lib_selected').on('click', function() {
|
541 |
+
var field = $('#query_gmedia__');
|
542 |
+
var valData = field.val().split(',');
|
543 |
+
var storedData = getStorage();
|
544 |
+
storedData = storedData.get('gmedia_library').split('.');
|
545 |
+
valData = $.grep(valData, function(e) {
|
546 |
+
return e;
|
547 |
+
});
|
548 |
+
$.each(storedData, function(i, id) {
|
549 |
+
if (!id) {
|
550 |
+
return true;
|
551 |
+
}
|
552 |
+
if ($.inArray(id, valData) === -1) {
|
553 |
+
valData.push(id);
|
554 |
+
}
|
555 |
+
});
|
556 |
+
field.val(valData.join(','));
|
557 |
+
});
|
558 |
|
559 |
+
$('.buildqueryreset').on('click', function() {
|
560 |
+
$('input.gm-selectize, select.gm-selectize', '#buildQuery').each(function() {
|
561 |
+
this.selectize.clear();
|
562 |
+
});
|
563 |
+
$('input[type="text"], select, textarea', '#buildQuery').each(function() {
|
564 |
+
$(this).val('');
|
565 |
+
});
|
566 |
+
$('input[type="checkbox"]', '#buildQuery').prop('checked', false);
|
567 |
+
});
|
568 |
+
});
|
569 |
|
570 |
</script>
|
571 |
<div class="modal-footer">
|
572 |
+
<button type="button" class="btn btn-secondary buildqueryreset"><?php esc_html_e( 'Reset', 'grand-media' ); ?></button>
|
573 |
+
<button type="button" class="btn btn-primary buildquerysubmit"><?php esc_html_e( 'Build Query', 'grand-media' ); ?></button>
|
574 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
575 |
</div>
|
576 |
</div>
|
577 |
</div>
|
admin/pages/galleries/tpl/module-settings.php
CHANGED
@@ -1,26 +1,29 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Module Settings
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
global $gmGallery;
|
11 |
?>
|
12 |
<div class="row">
|
13 |
<div class="col-lg-5 tabable tabs-left">
|
14 |
-
<ul class="nav nav-tabs" id="galleryTabs">
|
15 |
<?php if ( isset( $module_info ) ) { ?>
|
16 |
-
<li class="text-center">
|
17 |
-
<strong><?php echo $module_info['title']; ?></strong><a href="#chooseModuleModal" data-toggle="modal" style="padding:5px 0;"><img src="<?php echo esc_url( $term->module['url'] . '/screenshot.png' ); ?>" alt="<?php echo esc_attr( $module_info['title'] ); ?>" width="100" style="height:auto;"/></a>
|
18 |
</li>
|
19 |
<?php } else { ?>
|
20 |
-
<li class="text-center"><strong><?php echo $term->module['name']; ?></strong>
|
21 |
|
22 |
-
<p><?php
|
23 |
-
<a href="#chooseModuleModal" data-toggle="modal" style="padding:5px 0;"><img src="<?php echo esc_url( $term->module['url'] . '/screenshot.png' ); ?>" alt="<?php echo esc_attr( $term->module['name'] ); ?>" width="100" style="height:auto;"/></a>
|
24 |
</li>
|
25 |
<?php } ?>
|
26 |
<?php
|
@@ -40,16 +43,17 @@ global $gmGallery;
|
|
40 |
|
41 |
</div>
|
42 |
<div class="col-lg-7">
|
43 |
-
<?php
|
|
|
44 |
$bgcolor = empty( $gmGallery->options['preview_bgcolor'] ) ? 'ffffff' : $gmGallery->options['preview_bgcolor'];
|
45 |
$params['is_admin_preview'] = 1;
|
46 |
?>
|
47 |
<div class="clearfix">
|
48 |
-
<div class="form-group
|
49 |
-
<b><?php
|
50 |
</div>
|
51 |
<div class="gallery_preview">
|
52 |
-
<iframe id="gallery_preview" style="background-color:<?php echo "#$bgcolor"; ?>;padding:5px;" name="gallery_preview" src="<?php echo esc_url( add_query_arg( $params, set_url_scheme( $gallery_link_default, 'admin' ) ) ); ?>"></iframe>
|
53 |
</div>
|
54 |
<?php } ?>
|
55 |
</div>
|
@@ -60,16 +64,15 @@ global $gmGallery;
|
|
60 |
if (hash) {
|
61 |
$('#galleryTabs a').eq(hash.replace('#tab-', '')).tab('show');
|
62 |
}
|
63 |
-
$('.gallery_preview').resizable();
|
64 |
$('#gmedia-edit-term').on('submit', function(e) {
|
65 |
if ($('#build_query_field').val() === '') {
|
66 |
-
var conf_txt = "<?php
|
67 |
if (!GmediaFunction.confirm(conf_txt)) {
|
68 |
e.preventDefault();
|
69 |
return false;
|
70 |
}
|
71 |
}
|
72 |
-
$(this).attr('action', $(this).attr('action') + '#tab-' + $('#galleryTabs
|
73 |
});
|
74 |
|
75 |
var main = $('#gallery_options_block');
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Module Settings
|
6 |
+
*
|
7 |
+
* @var $term
|
8 |
+
* @var $term_id
|
9 |
+
* @var $default_options
|
10 |
+
* @var $gallery_settings
|
11 |
+
* @var $gallery_link_default
|
12 |
*/
|
13 |
global $gmGallery;
|
14 |
?>
|
15 |
<div class="row">
|
16 |
<div class="col-lg-5 tabable tabs-left">
|
17 |
+
<ul class="flex-column nav nav-tabs small" id="galleryTabs" style="max-width: 180px;">
|
18 |
<?php if ( isset( $module_info ) ) { ?>
|
19 |
+
<li class="d-flex flex-column text-center">
|
20 |
+
<strong><?php echo esc_html( $module_info['title'] ); ?></strong><a href="#chooseModuleModal" data-bs-toggle="modal" style="padding:5px 0;"><img src="<?php echo esc_url( $term->module['url'] . '/screenshot.png' ); ?>" alt="<?php echo esc_attr( $module_info['title'] ); ?>" width="100" style="height:auto;"/></a>
|
21 |
</li>
|
22 |
<?php } else { ?>
|
23 |
+
<li class="text-center"><strong><?php echo esc_html( $term->module['name'] ); ?></strong>
|
24 |
|
25 |
+
<p><?php esc_html_e( 'This module is broken or outdated. Please, go to Modules page and update/install module or choose another one for this gallery', 'grand-media' ); ?></p>
|
26 |
+
<a href="#chooseModuleModal" data-bs-toggle="modal" style="padding:5px 0;"><img src="<?php echo esc_url( $term->module['url'] . '/screenshot.png' ); ?>" alt="<?php echo esc_attr( $term->module['name'] ); ?>" width="100" style="height:auto;"/></a>
|
27 |
</li>
|
28 |
<?php } ?>
|
29 |
<?php
|
43 |
|
44 |
</div>
|
45 |
<div class="col-lg-7">
|
46 |
+
<?php
|
47 |
+
if ( $term_id || isset( $preset_module ) ) {
|
48 |
$bgcolor = empty( $gmGallery->options['preview_bgcolor'] ) ? 'ffffff' : $gmGallery->options['preview_bgcolor'];
|
49 |
$params['is_admin_preview'] = 1;
|
50 |
?>
|
51 |
<div class="clearfix">
|
52 |
+
<div class="form-group float-end" style="margin:-10px 0 5px 0;"><input type="text" data-type="color" class="form-control form-control-sm input-sm pt-0 pb-0" id="preview_color" name="preview_bgcolor" value="<?php echo esc_attr( $bgcolor ); ?>" placeholder="ffffff" size="7"/></div>
|
53 |
+
<b><?php esc_html_e( 'Gallery Preview:' ); ?></b>
|
54 |
</div>
|
55 |
<div class="gallery_preview">
|
56 |
+
<iframe id="gallery_preview" style="background-color:<?php echo esc_attr( "#$bgcolor" ); ?>;padding:5px;" name="gallery_preview" src="<?php echo esc_url( add_query_arg( $params, set_url_scheme( $gallery_link_default, 'admin' ) ) ); ?>"></iframe>
|
57 |
</div>
|
58 |
<?php } ?>
|
59 |
</div>
|
64 |
if (hash) {
|
65 |
$('#galleryTabs a').eq(hash.replace('#tab-', '')).tab('show');
|
66 |
}
|
|
|
67 |
$('#gmedia-edit-term').on('submit', function(e) {
|
68 |
if ($('#build_query_field').val() === '') {
|
69 |
+
var conf_txt = "<?php esc_attr_e( 'Warning: Query Args. field is empty! Show in gallery all files from Gmedia Library?', 'grand-media' ); ?>";
|
70 |
if (!GmediaFunction.confirm(conf_txt)) {
|
71 |
e.preventDefault();
|
72 |
return false;
|
73 |
}
|
74 |
}
|
75 |
+
$(this).attr('action', $(this).attr('action') + '#tab-' + $('#galleryTabs a.active').parent().index());
|
76 |
});
|
77 |
|
78 |
var main = $('#gallery_options_block');
|
admin/pages/library/functions.php
CHANGED
@@ -4,10 +4,10 @@ function gmedia_item_thumbnail( $item ) {
|
|
4 |
global $gmCore;
|
5 |
|
6 |
$images = $gmCore->gm_get_media_image( $item, 'all' );
|
7 |
-
$thumb = '<img class="gmedia-thumb" src="' . $images['thumb'] . '" alt=""/>';
|
8 |
|
9 |
if ( ! empty( $images['icon'] ) ) {
|
10 |
-
$thumb .= '<img class="gmedia-typethumb" src="' . $images['icon'] . '" alt=""/>';
|
11 |
}
|
12 |
|
13 |
return $thumb;
|
@@ -16,52 +16,80 @@ function gmedia_item_thumbnail( $item ) {
|
|
16 |
function gmedia_item_actions( $item ) {
|
17 |
global $gmCore, $gmProcessor;
|
18 |
|
19 |
-
if ( ! in_array( $gmProcessor->mode,
|
20 |
-
$share_icon = '<
|
21 |
if ( 'draft' !== $item->status ) {
|
22 |
if ( ! empty( $item->post_id ) ) {
|
23 |
$cloud_link = get_permalink( $item->post_id );
|
24 |
} else {
|
25 |
$cloud_link = $gmCore->gmcloudlink( $item->ID, 'single' );
|
26 |
}
|
27 |
-
$share = '<a target="_blank" data-target="#shareModal" data-share="' . $item->ID . '" class="share-modal" title="' . __( 'Share Gmedia Post', 'grand-media' ) . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
|
28 |
} else {
|
29 |
$share = "<span class='action-inactive'>$share_icon</span>";
|
30 |
}
|
31 |
|
32 |
-
$edit_icon = '<
|
33 |
if ( gm_user_can( 'edit_media' ) ) {
|
34 |
-
if ( ( (int) $item->author
|
35 |
-
$edit_data_data = $gmProcessor->gmediablank ? '' : ' data-target="#previewModal" data-width="1200" data-height="500" data-cls="edit_gmedia_item" class="preview-modal"';
|
36 |
-
$edit_data = '<a href="' .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
} else {
|
39 |
$edit_data = "<span class='action-inactive'>$edit_icon</span>";
|
40 |
}
|
41 |
|
42 |
-
$info_icon = '<
|
43 |
$metainfo = $gmCore->metadata_text( $item->ID );
|
44 |
if ( $metainfo ) {
|
45 |
-
$info = '<a href="#metaInfo" data-target="#previewModal" data-metainfo="' . $item->ID . '" class="preview-modal" title="' .
|
46 |
-
$info .= '<div class="metainfo hidden" id="metainfo_' . $item->ID . '">' . nl2br( $metainfo ) . '</div>';
|
47 |
} else {
|
48 |
$info = "<span class='action-inactive'>$info_icon</span>";
|
49 |
}
|
50 |
|
51 |
$db_delete = '';
|
52 |
-
$delete_icon = '<
|
53 |
-
if ( ( gm_user_can( 'delete_media' ) && ( (int) $item->author
|
54 |
-
$delete = '<a class="text-danger" href="' .
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
if ( $gmCore->_get( 'showmore' ) ) {
|
60 |
-
$erase_icon = '<
|
61 |
-
$db_delete = '<a class="text-danger" href="' .
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
} else {
|
67 |
$delete = "<span class='action-inactive'>$delete_icon</span>";
|
@@ -69,26 +97,35 @@ function gmedia_item_actions( $item ) {
|
|
69 |
}
|
70 |
|
71 |
if ( 'image' === $item->type && $item->editor ) {
|
72 |
-
$edit_image_icon = '<
|
73 |
-
if ( ( gm_user_can( 'edit_media' ) && ( (int) $item->author
|
74 |
-
$edit_image = '<a href="' .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
} else {
|
76 |
$edit_image = "<span class='action-inactive'>$edit_image_icon</span>";
|
77 |
}
|
78 |
|
79 |
-
$show_icon = '<
|
80 |
-
$show = '<a href="' . $gmCore->gm_get_media_image( $item, 'web' ) . '" data-target="#previewModal" data-width="' . $item->msize['width'] . '" data-height="' . $item->msize['height'] . '" class="preview-modal" title="' . esc_attr__( 'Show Large Image', 'grand-media' ) . '">' . $show_icon . '</a>';
|
81 |
|
82 |
-
} elseif ( in_array( $item->ext,
|
83 |
-
$show_icon = '<
|
84 |
-
$show = '<a href="' . $item->url . '" data-target="#previewModal" data-width="' . $item->msize['width'] . '" data-height="' . $item->msize['height'] . '" class="preview-modal" title="' . esc_attr__( 'Play', 'grand-media' ) . '">' . $show_icon . '</a>';
|
85 |
} else {
|
86 |
-
$show_icon = '<
|
87 |
-
$show = '<a href="' . $item->url . '" title="' .
|
88 |
}
|
89 |
|
90 |
-
$duplicate_icon = '<
|
91 |
-
$duplicate = '<a href="' . wp_nonce_url( gm_get_admin_url(
|
92 |
|
93 |
$actions = compact( 'share', 'edit_data', 'edit_image', 'show', 'info', 'duplicate', 'delete', 'db_delete' );
|
94 |
|
@@ -103,7 +140,7 @@ function gmedia_filter_message() {
|
|
103 |
echo '<div class="custom-message alert alert-info">';
|
104 |
foreach ( $gmProcessor->filters as $key => $value ) {
|
105 |
echo '<div class="custom-message-row">';
|
106 |
-
echo '<strong><a href="#libModal" data-modal="' . esc_attr( $key ) . '" data-action="gmedia_get_modal" class="gmedia-modal">' . esc_html( $value['title'] ) . '</a>: </strong>';
|
107 |
echo esc_html( implode( ', ', $value['filter'] ) );
|
108 |
echo '</div>';
|
109 |
}
|
@@ -114,19 +151,18 @@ function gmedia_filter_message() {
|
|
114 |
function gmedia_alert_message() {
|
115 |
global $gmProcessor;
|
116 |
do_action( 'before_gmedia_alert_message' );
|
117 |
-
if ( ( $gmProcessor->mode
|
118 |
?>
|
119 |
<div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
|
120 |
-
<button type="button" class="close" data-dismiss="alert">
|
121 |
-
|
122 |
-
<strong><?php _e( 'Info:', 'grand-media' ); ?></strong> <?php _e( 'You are not allowed to edit others media', 'grand-media' ); ?>
|
123 |
</div>
|
124 |
<?php
|
125 |
}
|
126 |
}
|
127 |
|
128 |
/**
|
129 |
-
* @param $item
|
130 |
*
|
131 |
* @return string
|
132 |
*/
|
@@ -147,12 +183,11 @@ function gmedia_waveform_player( $item ) {
|
|
147 |
} else {
|
148 |
$peaks = '';
|
149 |
}
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
<button type="button" class="btn btn-sm btn-info gm-
|
|
|
154 |
<span style="float:none;" class="spinner"></span>
|
155 |
</div>';
|
156 |
-
|
157 |
-
return $content;
|
158 |
}
|
4 |
global $gmCore;
|
5 |
|
6 |
$images = $gmCore->gm_get_media_image( $item, 'all' );
|
7 |
+
$thumb = '<img class="gmedia-thumb" src="' . esc_url( $images['thumb'] ) . '" alt=""/>';
|
8 |
|
9 |
if ( ! empty( $images['icon'] ) ) {
|
10 |
+
$thumb .= '<img class="gmedia-typethumb" src="' . esc_url( $images['icon'] ) . '" alt=""/>';
|
11 |
}
|
12 |
|
13 |
return $thumb;
|
16 |
function gmedia_item_actions( $item ) {
|
17 |
global $gmCore, $gmProcessor;
|
18 |
|
19 |
+
if ( ! in_array( $gmProcessor->mode, array( 'select_single', 'select_multiple' ), true ) ) {
|
20 |
+
$share_icon = '<i class="fa-solid fa-share-from-square"></i>';
|
21 |
if ( 'draft' !== $item->status ) {
|
22 |
if ( ! empty( $item->post_id ) ) {
|
23 |
$cloud_link = get_permalink( $item->post_id );
|
24 |
} else {
|
25 |
$cloud_link = $gmCore->gmcloudlink( $item->ID, 'single' );
|
26 |
}
|
27 |
+
$share = '<a target="_blank" data-bs-toggle="modal" data-bs-target="#shareModal" data-share="' . $item->ID . '" class="share-modal" title="' . __( 'Share Gmedia Post', 'grand-media' ) . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
|
28 |
} else {
|
29 |
$share = "<span class='action-inactive'>$share_icon</span>";
|
30 |
}
|
31 |
|
32 |
+
$edit_icon = '<i class="fa-solid fa-pen-to-square"></i>';
|
33 |
if ( gm_user_can( 'edit_media' ) ) {
|
34 |
+
if ( ( get_current_user_id() === (int) $item->author ) || gm_user_can( 'edit_others_media' ) ) {
|
35 |
+
$edit_data_data = $gmProcessor->gmediablank ? '' : ' data-bs-toggle="modal" data-bs-target="#previewModal" data-width="1200" data-height="500" data-cls="edit_gmedia_item" class="preview-modal"';
|
36 |
+
$edit_data = '<a href="' . esc_url(
|
37 |
+
add_query_arg(
|
38 |
+
array(
|
39 |
+
'page' => 'GrandMedia',
|
40 |
+
'mode' => 'edit',
|
41 |
+
'gmediablank' => 'library',
|
42 |
+
'gmedia__in' => $item->ID,
|
43 |
+
),
|
44 |
+
$gmProcessor->url
|
45 |
+
)
|
46 |
+
) . '"' . $edit_data_data . ' id="gmdataedit' . intval( $item->ID ) . '" title="' . esc_html__( 'Edit Data', 'grand-media' ) . '">' . $edit_icon . '</a>';
|
47 |
}
|
48 |
} else {
|
49 |
$edit_data = "<span class='action-inactive'>$edit_icon</span>";
|
50 |
}
|
51 |
|
52 |
+
$info_icon = '<i class="fa-solid fa-circle-info"></i>';
|
53 |
$metainfo = $gmCore->metadata_text( $item->ID );
|
54 |
if ( $metainfo ) {
|
55 |
+
$info = '<a href="#metaInfo" data-bs-toggle="modal" data-bs-target="#previewModal" data-metainfo="' . intval( $item->ID ) . '" class="preview-modal" title="' . esc_html__( 'Exif/Meta Info', 'grand-media' ) . '">' . $info_icon . '</a>';
|
56 |
+
$info .= '<div class="metainfo hidden" id="metainfo_' . intval( $item->ID ) . '">' . nl2br( $metainfo ) . '</div>';
|
57 |
} else {
|
58 |
$info = "<span class='action-inactive'>$info_icon</span>";
|
59 |
}
|
60 |
|
61 |
$db_delete = '';
|
62 |
+
$delete_icon = '<i class="fa-solid fa-trash-can"></i>';
|
63 |
+
if ( ( gm_user_can( 'delete_media' ) && ( get_current_user_id() === (int) $item->author ) ) || gm_user_can( 'delete_others_media' ) ) {
|
64 |
+
$delete = '<a class="text-danger" href="' . esc_url(
|
65 |
+
wp_nonce_url(
|
66 |
+
gm_get_admin_url(
|
67 |
+
array(
|
68 |
+
'do_gmedia' => 'delete',
|
69 |
+
'ids' => $item->ID,
|
70 |
+
)
|
71 |
+
),
|
72 |
+
'gmedia_delete',
|
73 |
+
'_wpnonce_delete'
|
74 |
+
)
|
75 |
+
// translators: file path.
|
76 |
+
) . '" data-confirm="' . sprintf( esc_html__( "You are about to permanently delete %s file.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ), esc_url( $item->gmuid ) ) . '" title="' . esc_html__( 'Delete', 'grand-media' ) . '">' . $delete_icon . '</a>';
|
77 |
|
78 |
if ( $gmCore->_get( 'showmore' ) ) {
|
79 |
+
$erase_icon = '<i class="fa-solid fa-delete-left"></i>';
|
80 |
+
$db_delete = '<a class="text-danger" href="' . esc_url(
|
81 |
+
wp_nonce_url(
|
82 |
+
gm_get_admin_url(
|
83 |
+
array(
|
84 |
+
'do_gmedia' => 'delete__save_original',
|
85 |
+
'ids' => $item->ID,
|
86 |
+
)
|
87 |
+
),
|
88 |
+
'gmedia_delete',
|
89 |
+
'_wpnonce_delete'
|
90 |
+
)
|
91 |
+
// translators: file path.
|
92 |
+
) . '" data-confirm="' . sprintf( esc_html__( "You are about to delete record from DB for %s file.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ), esc_url( $item->gmuid ) ) . '" title="' . esc_html__( 'Delete DB record (leave file on the server)', 'grand-media' ) . '">' . $erase_icon . '</a>';
|
93 |
}
|
94 |
} else {
|
95 |
$delete = "<span class='action-inactive'>$delete_icon</span>";
|
97 |
}
|
98 |
|
99 |
if ( 'image' === $item->type && $item->editor ) {
|
100 |
+
$edit_image_icon = '<i class="fa-solid fa-circle-half-stroke"></i>';
|
101 |
+
if ( ( gm_user_can( 'edit_media' ) && ( get_current_user_id() === (int) $item->author ) ) || gm_user_can( 'edit_others_media' ) ) {
|
102 |
+
$edit_image = '<a href="' . esc_url(
|
103 |
+
add_query_arg(
|
104 |
+
array(
|
105 |
+
'page' => 'GrandMedia',
|
106 |
+
'gmediablank' => 'image_editor',
|
107 |
+
'id' => $item->ID,
|
108 |
+
),
|
109 |
+
$gmProcessor->url
|
110 |
+
)
|
111 |
+
) . '" data-bs-toggle="modal" data-bs-target="#gmeditModal" class="gmedit-modal" id="gmimageedit' . intval( $item->ID ) . '" title="' . esc_html__( 'Edit Image', 'grand-media' ) . '">' . $edit_image_icon . '</a>';
|
112 |
} else {
|
113 |
$edit_image = "<span class='action-inactive'>$edit_image_icon</span>";
|
114 |
}
|
115 |
|
116 |
+
$show_icon = '<i class="fa-solid fa-maximize"></i>';
|
117 |
+
$show = '<a href="' . esc_url( $gmCore->gm_get_media_image( $item, 'web' ) ) . '" data-bs-toggle="modal" data-bs-target="#previewModal" data-width="' . esc_attr( $item->msize['width'] ) . '" data-height="' . esc_attr( $item->msize['height'] ) . '" class="preview-modal" title="' . esc_attr__( 'Show Large Image', 'grand-media' ) . '">' . $show_icon . '</a>';
|
118 |
|
119 |
+
} elseif ( in_array( $item->ext, array( 'mp3', 'ogg', 'wav', 'ogg', 'mp4', 'mpeg', 'webm' ), true ) ) {
|
120 |
+
$show_icon = '<i class="fa-solid fa-play"></i>';
|
121 |
+
$show = '<a href="' . esc_url( $item->url ) . '" data-bs-toggle="modal" data-bs-target="#previewModal" data-width="' . esc_attr( $item->msize['width'] ) . '" data-height="' . esc_attr( $item->msize['height'] ) . '" class="preview-modal" title="' . esc_attr__( 'Play', 'grand-media' ) . '">' . $show_icon . '</a>';
|
122 |
} else {
|
123 |
+
$show_icon = '<i class="fa-solid fa-cloud-arrow-down"></i>';
|
124 |
+
$show = '<a href="' . esc_url( $item->url ) . '" title="' . esc_html__( 'Download', 'grand-media' ) . '" download="' . esc_attr( $item->gmuid ) . '">' . $show_icon . '</a>';
|
125 |
}
|
126 |
|
127 |
+
$duplicate_icon = '<i class="fa-solid fa-copy"></i>';
|
128 |
+
$duplicate = '<a href="' . wp_nonce_url( gm_get_admin_url( array( 'do_gmedia' => 'duplicate', 'ids' => $item->ID ) ), 'gmedia_action', '_wpnonce_action' ) . '" title="' . __( 'Duplicate', 'grand-media' ) . '">' . $duplicate_icon . '</a>';
|
129 |
|
130 |
$actions = compact( 'share', 'edit_data', 'edit_image', 'show', 'info', 'duplicate', 'delete', 'db_delete' );
|
131 |
|
140 |
echo '<div class="custom-message alert alert-info">';
|
141 |
foreach ( $gmProcessor->filters as $key => $value ) {
|
142 |
echo '<div class="custom-message-row">';
|
143 |
+
echo '<strong><a href="#libModal" data-bs-toggle="modal" data-modal="' . esc_attr( $key ) . '" data-action="gmedia_get_modal" class="gmedia-modal">' . esc_html( $value['title'] ) . '</a>: </strong>';
|
144 |
echo esc_html( implode( ', ', $value['filter'] ) );
|
145 |
echo '</div>';
|
146 |
}
|
151 |
function gmedia_alert_message() {
|
152 |
global $gmProcessor;
|
153 |
do_action( 'before_gmedia_alert_message' );
|
154 |
+
if ( ( 'edit' === $gmProcessor->mode ) && gm_user_can( 'show_others_media' ) && ! gm_user_can( 'edit_others_media' ) ) {
|
155 |
?>
|
156 |
<div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
|
157 |
+
<button type="button" class="btn-close float-end m-0" data-bs-dismiss="alert" aria-label="Close"></button>
|
158 |
+
<strong><?php esc_html_e( 'Info:', 'grand-media' ); ?></strong> <?php esc_html_e( 'You are not allowed to edit others media', 'grand-media' ); ?>
|
|
|
159 |
</div>
|
160 |
<?php
|
161 |
}
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
+
* @param object $item
|
166 |
*
|
167 |
* @return string
|
168 |
*/
|
183 |
} else {
|
184 |
$peaks = '';
|
185 |
}
|
186 |
+
|
187 |
+
return '
|
188 |
+
<div class="gm-waveform-player" data-id="' . intval( $item->ID ) . '" data-file="' . esc_url( $item->url ) . '" data-peaks="' . esc_attr( $peaks ) . '">
|
189 |
+
<div id="ws' . intval( $item->ID ) . '"></div>' . ( $peaks ? '' : ( '<button type="button" class="btn btn-sm btn-info gm-waveform">' . esc_html__( 'Create & Save WaveForm', 'grand-media' ) . '</button>' ) ) . '<button type="button" class="btn btn-sm btn-info gm-play" style="display:none;">' . esc_html__( 'Play', 'grand-media' ) . '</button>
|
190 |
+
<button type="button" class="btn btn-sm btn-info gm-pause" style="display:none;">' . esc_html__( 'Pause', 'grand-media' ) . '</button>
|
191 |
<span style="float:none;" class="spinner"></span>
|
192 |
</div>';
|
|
|
|
|
193 |
}
|
admin/pages/library/library.php
CHANGED
@@ -3,19 +3,16 @@
|
|
3 |
* Gmedia Library
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
-
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor, $gmProcessorLibrary;
|
12 |
|
13 |
-
$panel_class =
|
14 |
$gmedia_url = $gmProcessor->url;
|
15 |
$gmedia_user_options = $gmProcessor->user_options;
|
16 |
|
17 |
$_get_filter = $gmCore->_get( 'filter' );
|
18 |
-
if ( $_get_filter && (
|
19 |
$gmProcessorLibrary->query_args['mime_type'] = $_get_filter;
|
20 |
}
|
21 |
|
@@ -31,7 +28,7 @@ if ( isset( $gmedia_filter['author__in'] ) && ! gm_user_can( 'show_others_media'
|
|
31 |
unset( $gmDB->filter['author__in'] );
|
32 |
unset( $gmedia_filter['author__in'] );
|
33 |
}
|
34 |
-
if ( $_get_filter && (
|
35 |
unset( $gmDB->filter['mime_type'] );
|
36 |
unset( $gmedia_filter['mime_type'] );
|
37 |
}
|
@@ -65,22 +62,22 @@ if ( $gmProcessorLibrary->mode ) {
|
|
65 |
|
66 |
<?php gmedia_filter_message(); ?>
|
67 |
|
68 |
-
<div class="
|
69 |
|
70 |
-
<?php
|
71 |
|
72 |
-
<div class="
|
73 |
-
<div class="list-group clearfix" id="gm-list-table" data-idx0="<?php echo absint( $idx0 + 1 ); ?>">
|
74 |
<?php
|
75 |
if ( count( $gmedia_query ) ) {
|
76 |
|
77 |
gmedia_alert_message();
|
78 |
|
79 |
-
if ( ! ( $gmProcessor->mode
|
80 |
foreach ( $gmedia_query as &$item ) {
|
81 |
gmedia_item_more_data( $item );
|
82 |
|
83 |
-
$item->classes =
|
84 |
if ( 'publish' !== $item->status ) {
|
85 |
if ( 'private' === $item->status ) {
|
86 |
$item->classes[] = 'list-group-item-info';
|
@@ -89,7 +86,7 @@ if ( $gmProcessorLibrary->mode ) {
|
|
89 |
}
|
90 |
}
|
91 |
$item->selected = in_array( $item->ID, (array) $gmProcessor->selected_items, true );
|
92 |
-
if ( $item->selected && ( $gmProcessor->mode
|
93 |
$item->classes[] = 'gm-selected';
|
94 |
}
|
95 |
$item->in_stack = in_array( $item->ID, (array) $gmProcessor->stack_items, true );
|
@@ -100,18 +97,18 @@ if ( $gmProcessorLibrary->mode ) {
|
|
100 |
echo '<div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div>';
|
101 |
}
|
102 |
} elseif ( gm_user_can( 'edit_media' ) ) {
|
103 |
-
$gm_category_terms = $gmDB->get_terms( 'gmedia_category',
|
104 |
-
$gm_tag_terms = $gmDB->get_terms( 'gmedia_tag',
|
105 |
?>
|
106 |
<script type="text/javascript">
|
107 |
-
|
108 |
-
|
109 |
</script>
|
110 |
<?php
|
111 |
foreach ( $gmedia_query as &$item ) {
|
112 |
gmedia_item_more_data( $item );
|
113 |
|
114 |
-
$item->classes =
|
115 |
if ( 'publish' !== $item->status ) {
|
116 |
if ( 'private' === $item->status ) {
|
117 |
$item->classes[] = 'list-group-item-info';
|
@@ -134,11 +131,12 @@ if ( $gmProcessorLibrary->mode ) {
|
|
134 |
}
|
135 |
} else {
|
136 |
include dirname( __FILE__ ) . '/tpl/no-items.php';
|
137 |
-
}
|
|
|
138 |
</div>
|
139 |
|
140 |
<?php
|
141 |
-
|
142 |
|
143 |
wp_original_referer_field( true, 'previous' );
|
144 |
wp_nonce_field( 'GmediaGallery' );
|
@@ -150,7 +148,7 @@ if ( $gmProcessorLibrary->mode ) {
|
|
150 |
</div>
|
151 |
<?php if ( gm_user_can( 'edit_media' ) ) { ?>
|
152 |
<div class="modal fade gmedia-modal" id="gmeditModal" tabindex="-1" role="dialog" aria-hidden="true">
|
153 |
-
<div class="modal-dialog modal-
|
154 |
<div class="modal-content"></div>
|
155 |
</div>
|
156 |
</div>
|
@@ -159,11 +157,11 @@ if ( $gmProcessorLibrary->mode ) {
|
|
159 |
<div class="modal-dialog">
|
160 |
<div class="modal-content">
|
161 |
<div class="modal-header">
|
162 |
-
<div class="btn-toolbar pull-right" style="margin-top:-4px;">
|
163 |
-
<button type="button" class="btn btn-primary"><?php _e( 'Submit', 'grand-media' ); ?></button>
|
164 |
-
<button type="button" class="btn btn-default" data-dismiss="modal"><?php _e( 'Close', 'grand-media' ); ?></button>
|
165 |
-
</div>
|
166 |
<h4 class="modal-title"></h4>
|
|
|
|
|
|
|
|
|
167 |
</div>
|
168 |
<div class="modal-body"></div>
|
169 |
</div>
|
@@ -171,9 +169,9 @@ if ( $gmProcessorLibrary->mode ) {
|
|
171 |
</div>
|
172 |
|
173 |
<?php
|
174 |
-
|
175 |
|
176 |
-
if ( $gmProcessor->mode
|
177 |
$customfield_meta_type = 'gmedia';
|
178 |
include GMEDIA_ABSPATH . 'admin/tpl/modal-customfield.php';
|
179 |
}
|
3 |
* Gmedia Library
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
+
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor, $gmProcessorLibrary, $gm_allowed_tags;
|
9 |
|
10 |
+
$panel_class = array();
|
11 |
$gmedia_url = $gmProcessor->url;
|
12 |
$gmedia_user_options = $gmProcessor->user_options;
|
13 |
|
14 |
$_get_filter = $gmCore->_get( 'filter' );
|
15 |
+
if ( $_get_filter && ( 'selected' !== $_get_filter ) ) {
|
16 |
$gmProcessorLibrary->query_args['mime_type'] = $_get_filter;
|
17 |
}
|
18 |
|
28 |
unset( $gmDB->filter['author__in'] );
|
29 |
unset( $gmedia_filter['author__in'] );
|
30 |
}
|
31 |
+
if ( $_get_filter && ( 'selected' !== $_get_filter ) ) {
|
32 |
unset( $gmDB->filter['mime_type'] );
|
33 |
unset( $gmedia_filter['mime_type'] );
|
34 |
}
|
62 |
|
63 |
<?php gmedia_filter_message(); ?>
|
64 |
|
65 |
+
<div class="card m-0 mw-100 p-0 <?php gm_panel_classes( $panel_class ); ?>" id="gmedia-panel">
|
66 |
|
67 |
+
<?php require dirname( __FILE__ ) . '/tpl/panel-heading.php'; ?>
|
68 |
|
69 |
+
<div class="card-body"></div>
|
70 |
+
<div class="list-group clearfix <?php echo 'grid' === $display_mode_gmedia ? 'list-group-horizontal' : ''; ?>" id="gm-list-table" data-idx0="<?php echo absint( $idx0 + 1 ); ?>">
|
71 |
<?php
|
72 |
if ( count( $gmedia_query ) ) {
|
73 |
|
74 |
gmedia_alert_message();
|
75 |
|
76 |
+
if ( ! ( 'edit' === $gmProcessor->mode ) ) {
|
77 |
foreach ( $gmedia_query as &$item ) {
|
78 |
gmedia_item_more_data( $item );
|
79 |
|
80 |
+
$item->classes = array( 'gmedia-' . $item->type . '-item' );
|
81 |
if ( 'publish' !== $item->status ) {
|
82 |
if ( 'private' === $item->status ) {
|
83 |
$item->classes[] = 'list-group-item-info';
|
86 |
}
|
87 |
}
|
88 |
$item->selected = in_array( $item->ID, (array) $gmProcessor->selected_items, true );
|
89 |
+
if ( $item->selected && ( 'select_single' !== $gmProcessor->mode ) ) {
|
90 |
$item->classes[] = 'gm-selected';
|
91 |
}
|
92 |
$item->in_stack = in_array( $item->ID, (array) $gmProcessor->stack_items, true );
|
97 |
echo '<div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div><div class="gm-item-cell-blank"></div>';
|
98 |
}
|
99 |
} elseif ( gm_user_can( 'edit_media' ) ) {
|
100 |
+
$gm_category_terms = $gmDB->get_terms( 'gmedia_category', array( 'fields' => 'names' ) );
|
101 |
+
$gm_tag_terms = $gmDB->get_terms( 'gmedia_tag', array( 'fields' => 'names' ) );
|
102 |
?>
|
103 |
<script type="text/javascript">
|
104 |
+
var gmedia_categories = <?php echo wp_json_encode( $gm_category_terms ); ?>;
|
105 |
+
var gmedia_tags = <?php echo wp_json_encode( $gm_tag_terms ); ?>;
|
106 |
</script>
|
107 |
<?php
|
108 |
foreach ( $gmedia_query as &$item ) {
|
109 |
gmedia_item_more_data( $item );
|
110 |
|
111 |
+
$item->classes = array( 'gmedia-' . $item->type . '-item' );
|
112 |
if ( 'publish' !== $item->status ) {
|
113 |
if ( 'private' === $item->status ) {
|
114 |
$item->classes[] = 'list-group-item-info';
|
131 |
}
|
132 |
} else {
|
133 |
include dirname( __FILE__ ) . '/tpl/no-items.php';
|
134 |
+
}
|
135 |
+
?>
|
136 |
</div>
|
137 |
|
138 |
<?php
|
139 |
+
require dirname( __FILE__ ) . '/tpl/panel-footer.php';
|
140 |
|
141 |
wp_original_referer_field( true, 'previous' );
|
142 |
wp_nonce_field( 'GmediaGallery' );
|
148 |
</div>
|
149 |
<?php if ( gm_user_can( 'edit_media' ) ) { ?>
|
150 |
<div class="modal fade gmedia-modal" id="gmeditModal" tabindex="-1" role="dialog" aria-hidden="true">
|
151 |
+
<div class="modal-dialog modal-xl">
|
152 |
<div class="modal-content"></div>
|
153 |
</div>
|
154 |
</div>
|
157 |
<div class="modal-dialog">
|
158 |
<div class="modal-content">
|
159 |
<div class="modal-header">
|
|
|
|
|
|
|
|
|
160 |
<h4 class="modal-title"></h4>
|
161 |
+
<div class="btn-toolbar gap-4 float-end" style="margin-top:-4px;">
|
162 |
+
<button type="button" class="btn btn-primary"><?php esc_html_e( 'Submit', 'grand-media' ); ?></button>
|
163 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
164 |
+
</div>
|
165 |
</div>
|
166 |
<div class="modal-body"></div>
|
167 |
</div>
|
169 |
</div>
|
170 |
|
171 |
<?php
|
172 |
+
require GMEDIA_ABSPATH . 'admin/tpl/modal-share.php';
|
173 |
|
174 |
+
if ( 'edit' === $gmProcessor->mode ) {
|
175 |
$customfield_meta_type = 'gmedia';
|
176 |
include GMEDIA_ABSPATH . 'admin/tpl/modal-customfield.php';
|
177 |
}
|
admin/pages/library/tpl/edit-item.php
CHANGED
@@ -1,65 +1,70 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
?>
|
11 |
-
<form class="cb_list-item list-group-item row d-row edit-gmedia <?php echo implode( ' ', $item->classes ); ?>" id="list-item-<?php echo absint( $item->ID ); ?>" data-id="<?php echo absint( $item->ID ); ?>" data-type="<?php echo esc_attr( $item->type ); ?>" role="form">
|
12 |
<div class="col-sm-4" style="max-width:340px;">
|
13 |
<input name="ID" type="hidden" value="<?php echo absint( $item->ID ); ?>"/>
|
14 |
<div class="thumbwrap">
|
15 |
<div class="cb_media-object">
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
</div>
|
20 |
-
<label class="gm-item-check"><input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
21 |
<label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
22 |
</div>
|
23 |
<div class="gmedia-actions">
|
24 |
-
<?php
|
|
|
25 |
unset( $media_action_links['edit_data'] );
|
26 |
-
echo implode( ' | ', $media_action_links );
|
27 |
?>
|
28 |
</div>
|
29 |
<?php
|
30 |
if ( 'audio' === $item->type ) {
|
31 |
-
echo gmedia_waveform_player( $item );
|
32 |
}
|
33 |
?>
|
34 |
<div class="form-group">
|
35 |
-
<label><?php
|
36 |
-
<a
|
37 |
-
|
38 |
-
'page' => 'GrandMedia',
|
39 |
-
'mode' => 'select_multiple',
|
40 |
-
'gmediablank' => 'library',
|
41 |
-
], [], true ) ); ?>"
|
42 |
class="preview-modal"
|
43 |
-
data-target="#previewModal"
|
44 |
data-width="1200"
|
45 |
data-height="500"
|
46 |
data-cls="select_gmedia_related"
|
47 |
-
title="<?php
|
48 |
-
<?php
|
49 |
-
<
|
50 |
</a>
|
51 |
</label>
|
52 |
<div class="related-media-previews">
|
53 |
<?php
|
54 |
-
$related_ids = isset( $item->meta['_related'][0] ) ? $item->meta['_related'][0] :
|
55 |
if ( ! empty( $related_ids ) ) {
|
56 |
-
$related_media = $gmDB->get_gmedias(
|
57 |
foreach ( $related_media as $r_item ) {
|
58 |
-
|
59 |
-
<
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
}
|
64 |
}
|
65 |
?>
|
@@ -69,83 +74,90 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
69 |
<div class="col-sm-8">
|
70 |
<div class="row">
|
71 |
<div class="form-group col-lg-6">
|
72 |
-
<label><?php
|
73 |
-
<input name="title" type="text" class="form-control input-sm" placeholder="<?php
|
74 |
</div>
|
75 |
<div class="form-group col-lg-6">
|
76 |
-
<label><?php
|
77 |
<div class="input-group">
|
78 |
<input name="link" type="text" class="form-control input-sm gmedia-custom-link-field" id="gmlink<?php echo absint( $item->ID ); ?>" value="<?php echo esc_attr( $item->link ); ?>"/>
|
79 |
-
<span class="input-group-btn"><button type="button" class="btn btn-
|
80 |
</div>
|
81 |
</div>
|
82 |
</div>
|
83 |
<div class="row">
|
84 |
<div class="form-group col-lg-6">
|
85 |
-
<label><?php
|
86 |
-
<?php
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
97 |
} else {
|
98 |
-
echo
|
99 |
-
}
|
|
|
100 |
</div>
|
101 |
<div class="col-lg-6">
|
102 |
<?php if ( gm_user_can( 'terms' ) ) { ?>
|
103 |
<?php
|
104 |
$alb_id = empty( $item->album ) ? 0 : reset( $item->album )->term_id;
|
105 |
$term_type = 'gmedia_album';
|
106 |
-
$args =
|
107 |
if ( ! gm_user_can( 'edit_others_media' ) ) {
|
108 |
-
$args =
|
109 |
}
|
110 |
$gm_terms = $gmDB->get_terms( $term_type, $args );
|
111 |
|
112 |
$terms_album = '';
|
113 |
$album_status = 'none';
|
114 |
if ( count( $gm_terms ) ) {
|
115 |
-
foreach ( $gm_terms as $
|
116 |
$author_name = '';
|
117 |
-
if ( $
|
118 |
if ( gm_user_can( 'edit_others_media' ) ) {
|
119 |
-
|
|
|
120 |
}
|
121 |
} else {
|
122 |
-
$author_name .= ' (' .
|
123 |
}
|
124 |
-
if ( 'publish' !== $
|
125 |
-
$author_name .= ' [' . $
|
126 |
}
|
127 |
|
128 |
$selected_option = '';
|
129 |
-
if ( $alb_id === $
|
130 |
$selected_option = ' selected="selected"';
|
131 |
-
$album_status = $
|
132 |
}
|
133 |
-
$terms_album .= '<option' . $selected_option . ' value="' . $
|
134 |
}
|
135 |
}
|
136 |
?>
|
137 |
-
<div class="form-group status-album bg-status-<?php echo $album_status; ?>">
|
138 |
-
<label><?php
|
139 |
-
<input type="text" class="gm-order-input" name="gmedia_album_order" title="<?php
|
140 |
-
<select name="terms[gmedia_album]" data-create="<?php echo esc_attr( gm_user_can( 'album_manage' ) ? 'true' : 'false' ); ?>" class="combobox_gmedia_album form-control input-sm" placeholder="<?php
|
141 |
<option<?php echo $alb_id ? '' : ' selected="selected"'; ?> value=""></option>
|
142 |
-
<?php echo $terms_album; ?>
|
143 |
</select>
|
144 |
</div>
|
145 |
|
146 |
<?php
|
147 |
if ( ! empty( $item->categories ) ) {
|
148 |
-
$terms_category =
|
149 |
foreach ( $item->categories as $c ) {
|
150 |
$terms_category[] = esc_html( $c->name );
|
151 |
}
|
@@ -155,13 +167,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
155 |
}
|
156 |
?>
|
157 |
<div class="form-group">
|
158 |
-
<label><?php
|
159 |
-
<input name="terms[gmedia_category]" data-create="<?php echo esc_attr( gm_user_can( 'category_manage' ) ? 'true' : 'false' ); ?>" class="combobox_gmedia_category form-control input-sm" value="<?php echo esc_attr( $terms_category ); ?>" placeholder="<?php
|
160 |
</div>
|
161 |
|
162 |
<?php
|
163 |
if ( ! empty( $item->tags ) ) {
|
164 |
-
$terms_tag =
|
165 |
foreach ( $item->tags as $c ) {
|
166 |
$terms_tag[] = esc_html( $c->name );
|
167 |
}
|
@@ -171,7 +183,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
171 |
}
|
172 |
?>
|
173 |
<div class="form-group">
|
174 |
-
<label><?php
|
175 |
<input name="terms[gmedia_tag]" data-create="<?php echo esc_attr( gm_user_can( 'tag_manage' ) ? 'true' : 'false' ); ?>" class="combobox_gmedia_tag form-control input-sm" value="<?php echo esc_attr( $terms_tag ); ?>"/>
|
176 |
</div>
|
177 |
<?php } ?>
|
@@ -181,42 +193,67 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
181 |
<div class="col-lg-6">
|
182 |
<?php if ( 'image' === $item->type ) { ?>
|
183 |
<div class="form-group">
|
184 |
-
<label><?php
|
185 |
-
<input type="text" class="form-control input-sm" name="meta[_image_alt]" value="<?php echo esc_attr( isset( $item->meta['_image_alt'][0] ) ? esc_attr( $item->meta['_image_alt'][0] ) : '' ); ?>" placeholder="<?php
|
186 |
</div>
|
187 |
<?php } ?>
|
188 |
<div class="form-group">
|
189 |
-
<label><?php
|
190 |
-
<small style="white-space:nowrap;">(ext: .<?php echo $item->ext; ?>)</small>
|
191 |
</label>
|
192 |
<input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php echo ( ! gm_user_can( 'delete_others_media' ) && ( (int) $item->author !== $user_ID ) ) ? 'readonly' : ''; ?> value="<?php echo esc_attr( pathinfo( $item->gmuid, PATHINFO_FILENAME ) ); ?>"/>
|
193 |
</div>
|
194 |
<div class="form-group">
|
195 |
-
<label><?php
|
196 |
|
197 |
-
<div
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
</div>
|
201 |
</div>
|
202 |
-
<div class="form-group status-item bg-status-<?php echo $item->status; ?>">
|
203 |
-
<label><?php
|
204 |
<select name="status" class="form-control input-sm">
|
205 |
-
<option <?php selected( $item->status, 'publish' ); ?> value="publish"><?php
|
206 |
-
<option <?php selected( $item->status, 'private' ); ?> value="private"><?php
|
207 |
-
<option <?php selected( $item->status, 'draft' ); ?> value="draft"><?php
|
208 |
</select>
|
209 |
</div>
|
210 |
<?php if ( ! empty( $item->post_id ) ) { ?>
|
211 |
<div class="form-group">
|
212 |
-
<a
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
</a>
|
216 |
-
<label><?php
|
217 |
<select name="comment_status" class="form-control input-sm">
|
218 |
-
<option <?php selected( $item->comment_status, 'open' ); ?> value="open"><?php
|
219 |
-
<option <?php selected( $item->comment_status, 'closed' ); ?> value="closed"><?php
|
220 |
</select>
|
221 |
</div>
|
222 |
<?php } ?>
|
@@ -224,72 +261,88 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
224 |
<div class="col-lg-6">
|
225 |
<?php if ( 'image' !== $item->type || ( 'image' === $item->type && ! $item->editor ) ) { ?>
|
226 |
<div class="form-group">
|
227 |
-
<label
|
228 |
-
|
|
|
|
|
|
|
|
|
229 |
<div class="input-group">
|
230 |
-
<input type="text" class="form-control input-sm gmedia-cover-id" name="meta[_cover]" value="<?php echo esc_attr( isset( $item->meta['_cover'][0] ) ? $item->meta['_cover'][0] : '' ); ?>" placeholder="<?php
|
231 |
-
<span class="input-group-btn"
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
</div>
|
238 |
</div>
|
239 |
<?php } ?>
|
240 |
<?php if ( ( 'image' === $item->type ) || ( 'video' === $item->type ) ) { ?>
|
241 |
<div class="form-group">
|
242 |
-
<label><?php
|
243 |
|
244 |
-
<div class="input-group
|
245 |
-
<input name="meta[_gps]" type="text" class="form-control input-sm gps_map_coordinates" value="<?php echo esc_attr( $item->gps ); ?>" placeholder="<?php
|
246 |
-
<span class="input-group-btn"
|
247 |
-
|
|
|
|
|
|
|
248 |
</div>
|
249 |
</div>
|
250 |
<?php } ?>
|
251 |
<p class="media-meta">
|
252 |
-
<span class="
|
253 |
-
<br/><span class="
|
254 |
-
<br/><span class="
|
255 |
-
<br/><span class="
|
256 |
<?php if ( ( 'image' === $item->type ) && $item->editor && ! empty( $item->meta['_metadata'] ) ) { ?>
|
257 |
-
<br/><span class="
|
258 |
<?php
|
259 |
$is_file_original = (bool) $item->path_original;
|
260 |
-
if ( $is_file_original ) {
|
|
|
261 |
<a href="<?php echo esc_url( $item->url_original ); ?>"
|
262 |
-
data-target="#previewModal"
|
263 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['original']['width'] ); ?>"
|
264 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['original']['height'] ); ?>"
|
265 |
class="preview-modal"
|
266 |
-
title="<?php
|
267 |
<?php } else { ?>
|
268 |
-
<span title="<?php
|
269 |
<?php } ?>
|
270 |
<a href="<?php echo esc_url( $item->url ); ?>"
|
271 |
-
data-target="#previewModal"
|
272 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['web']['width'] ); ?>"
|
273 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['web']['height'] ); ?>"
|
274 |
class="preview-modal"
|
275 |
-
title="<?php
|
276 |
<a href="<?php echo esc_url( $item->url_thumb ); ?>"
|
277 |
-
data-target="#previewModal"
|
278 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['thumb']['width'] ); ?>"
|
279 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['thumb']['height'] ); ?>"
|
280 |
class="preview-modal"
|
281 |
-
title="<?php
|
282 |
-
<br/><span class="
|
283 |
-
|
284 |
-
echo $gmCore->filesize( $item->
|
|
|
|
|
285 |
<?php } else { ?>
|
286 |
-
<br/><span class="
|
287 |
<?php } ?>
|
288 |
<?php if ( ! empty( $item->meta['_created_timestamp'][0] ) ) { ?>
|
289 |
-
<br/><span class="
|
290 |
<?php } ?>
|
291 |
-
<br/><span class="
|
292 |
-
<br/><span class="
|
293 |
</p>
|
294 |
</div>
|
295 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
+
* Gmedia Item for List View in Library
|
6 |
+
*
|
7 |
+
* @var $user_ID
|
8 |
+
* @var $gmDB
|
9 |
+
* @var $gmCore
|
10 |
+
* @var $item
|
11 |
+
* @var $gmedia_user_options
|
12 |
+
* @var $gmProcessor
|
13 |
+
* @var $resultPerPage
|
14 |
+
* @var $gm_allowed_tags
|
15 |
*/
|
16 |
?>
|
17 |
+
<form class="cb_list-item list-group-item row d-row edit-gmedia <?php echo esc_attr( implode( ' ', $item->classes ) ); ?>" id="list-item-<?php echo absint( $item->ID ); ?>" data-id="<?php echo absint( $item->ID ); ?>" data-type="<?php echo esc_attr( $item->type ); ?>" role="form">
|
18 |
<div class="col-sm-4" style="max-width:340px;">
|
19 |
<input name="ID" type="hidden" value="<?php echo absint( $item->ID ); ?>"/>
|
20 |
<div class="thumbwrap">
|
21 |
<div class="cb_media-object">
|
22 |
+
<span data-clicktarget="gmcheckbox<?php echo absint( $item->ID ); ?>" class="img-thumbnail gmedia-cover-image">
|
23 |
+
<?php echo wp_kses_post( gmedia_item_thumbnail( $item ) ); ?>
|
24 |
+
</span>
|
25 |
</div>
|
26 |
+
<label class="gm-item-check" id="gmcheckbox<?php echo absint( $item->ID ); ?>"><input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
27 |
<label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
28 |
</div>
|
29 |
<div class="gmedia-actions">
|
30 |
+
<?php
|
31 |
+
$media_action_links = gmedia_item_actions( $item );
|
32 |
unset( $media_action_links['edit_data'] );
|
33 |
+
echo wp_kses_post( implode( ' | ', $media_action_links ) );
|
34 |
?>
|
35 |
</div>
|
36 |
<?php
|
37 |
if ( 'audio' === $item->type ) {
|
38 |
+
echo wp_kses_post( gmedia_waveform_player( $item ) );
|
39 |
}
|
40 |
?>
|
41 |
<div class="form-group">
|
42 |
+
<label><?php esc_html_e( 'Related Media', 'grand-media' ); ?>:
|
43 |
+
<a
|
44 |
+
href="<?php echo esc_url( $gmCore->get_admin_url( array( 'page' => 'GrandMedia', 'mode' => 'select_multiple', 'gmediablank' => 'library' ), array(), true ) ); ?>"
|
|
|
|
|
|
|
|
|
45 |
class="preview-modal"
|
46 |
+
data-bs-toggle="modal" data-bs-target="#previewModal"
|
47 |
data-width="1200"
|
48 |
data-height="500"
|
49 |
data-cls="select_gmedia_related"
|
50 |
+
title="<?php esc_attr_e( 'Choose Related Media', 'grand-media' ); ?>">
|
51 |
+
<?php esc_html_e( 'choose' ); ?>
|
52 |
+
<i class='fa-solid fa-image'></i>
|
53 |
</a>
|
54 |
</label>
|
55 |
<div class="related-media-previews">
|
56 |
<?php
|
57 |
+
$related_ids = isset( $item->meta['_related'][0] ) ? $item->meta['_related'][0] : array();
|
58 |
if ( ! empty( $related_ids ) ) {
|
59 |
+
$related_media = $gmDB->get_gmedias( array( 'gmedia__in' => $related_ids, 'orderby' => 'gmedia__in' ) );
|
60 |
foreach ( $related_media as $r_item ) {
|
61 |
+
?>
|
62 |
+
<p class="img-thumbnail gmedia-related-image">
|
63 |
+
<span class="image-wrapper"><?php echo wp_kses_post( gmedia_item_thumbnail( $r_item ) ); ?></span>
|
64 |
+
<span class="gm-remove">×</span>
|
65 |
+
<input type="hidden" name="meta[_related][]" value="<?php echo absint( $r_item->ID ); ?>"/>
|
66 |
+
</p>
|
67 |
+
<?php
|
68 |
}
|
69 |
}
|
70 |
?>
|
74 |
<div class="col-sm-8">
|
75 |
<div class="row">
|
76 |
<div class="form-group col-lg-6">
|
77 |
+
<label><?php esc_html_e( 'Title', 'grand-media' ); ?></label>
|
78 |
+
<input name="title" type="text" class="form-control input-sm" placeholder="<?php esc_attr_e( 'Title', 'grand-media' ); ?>" value="<?php echo esc_attr( $item->title ); ?>">
|
79 |
</div>
|
80 |
<div class="form-group col-lg-6">
|
81 |
+
<label><?php esc_html_e( 'Link URL', 'grand-media' ); ?></label>
|
82 |
<div class="input-group">
|
83 |
<input name="link" type="text" class="form-control input-sm gmedia-custom-link-field" id="gmlink<?php echo absint( $item->ID ); ?>" value="<?php echo esc_attr( $item->link ); ?>"/>
|
84 |
+
<span class="input-group-btn"><button type="button" class="btn btn-primary gmedia-custom-link" data-target="gmlink<?php echo absint( $item->ID ); ?>" title="<?php esc_attr_e( 'Link to existing WP content', 'grand-media' ); ?>"><i class='fa-solid fa-link'></i></button></span>
|
85 |
</div>
|
86 |
</div>
|
87 |
</div>
|
88 |
<div class="row">
|
89 |
<div class="form-group col-lg-6">
|
90 |
+
<label><?php esc_html_e( 'Description', 'grand-media' ); ?></label>
|
91 |
+
<?php
|
92 |
+
if ( ( 'false' !== $gmedia_user_options['library_edit_quicktags'] ) || ( $gmProcessor->gmediablank && ( 1 === $resultPerPage ) ) ) {
|
93 |
+
wp_editor(
|
94 |
+
$item->description,
|
95 |
+
"gm{$item->ID}_description",
|
96 |
+
array(
|
97 |
+
'editor_class' => 'form-control input-sm',
|
98 |
+
'editor_height' => 140,
|
99 |
+
'wpautop' => false,
|
100 |
+
'media_buttons' => false,
|
101 |
+
'textarea_name' => 'description',
|
102 |
+
'textarea_rows' => '4',
|
103 |
+
'tinymce' => false,
|
104 |
+
'quicktags' => array( 'buttons' => apply_filters( 'gmedia_editor_quicktags', 'strong,em,link,ul,li,close' ) ),
|
105 |
+
)
|
106 |
+
);
|
107 |
} else {
|
108 |
+
echo '<textarea id="gm' . intval( $item->ID ) . '_description" class="form-control input-sm" name="description" cols="20" rows="4" style="height:174px">' . esc_textarea( $item->description ) . '</textarea>';
|
109 |
+
}
|
110 |
+
?>
|
111 |
</div>
|
112 |
<div class="col-lg-6">
|
113 |
<?php if ( gm_user_can( 'terms' ) ) { ?>
|
114 |
<?php
|
115 |
$alb_id = empty( $item->album ) ? 0 : reset( $item->album )->term_id;
|
116 |
$term_type = 'gmedia_album';
|
117 |
+
$args = array();
|
118 |
if ( ! gm_user_can( 'edit_others_media' ) ) {
|
119 |
+
$args = array( 'global' => array( 0, $user_ID ), 'orderby' => 'global_desc_name' );
|
120 |
}
|
121 |
$gm_terms = $gmDB->get_terms( $term_type, $args );
|
122 |
|
123 |
$terms_album = '';
|
124 |
$album_status = 'none';
|
125 |
if ( count( $gm_terms ) ) {
|
126 |
+
foreach ( $gm_terms as $gm_term ) {
|
127 |
$author_name = '';
|
128 |
+
if ( $gm_term->global ) {
|
129 |
if ( gm_user_can( 'edit_others_media' ) ) {
|
130 |
+
// translators: author name.
|
131 |
+
$author_name .= ' ' . sprintf( esc_html__( 'by %s', 'grand-media' ), esc_html( get_the_author_meta( 'display_name', $gm_term->global ) ) );
|
132 |
}
|
133 |
} else {
|
134 |
+
$author_name .= ' (' . esc_html__( 'shared', 'grand-media' ) . ')';
|
135 |
}
|
136 |
+
if ( 'publish' !== $gm_term->status ) {
|
137 |
+
$author_name .= ' [' . $gm_term->status . ']';
|
138 |
}
|
139 |
|
140 |
$selected_option = '';
|
141 |
+
if ( $alb_id === $gm_term->term_id ) {
|
142 |
$selected_option = ' selected="selected"';
|
143 |
+
$album_status = $gm_term->status;
|
144 |
}
|
145 |
+
$terms_album .= '<option' . $selected_option . ' value="' . esc_attr( $gm_term->term_id ) . '">' . esc_html( $gm_term->name . $author_name ) . '</option>' . "\n";
|
146 |
}
|
147 |
}
|
148 |
?>
|
149 |
+
<div class="form-group status-album bg-status-<?php echo esc_attr( $album_status ); ?>">
|
150 |
+
<label><?php esc_html_e( 'Album ', 'grand-media' ); ?></label>
|
151 |
+
<input type="text" class="gm-order-input" name="gmedia_album_order" title="<?php esc_attr_e( 'Sort order (custom) in the chosen Album', 'grand-media' ); ?>" value="<?php echo absint( $alb_id ? reset( $item->album )->gmedia_order : 0 ); ?>" <?php echo $alb_id ? '' : 'disabled'; ?>/>
|
152 |
+
<select name="terms[gmedia_album]" data-create="<?php echo esc_attr( gm_user_can( 'album_manage' ) ? 'true' : 'false' ); ?>" class="combobox_gmedia_album form-control input-sm" placeholder="<?php esc_attr_e( 'Album Name...', 'grand-media' ); ?>">
|
153 |
<option<?php echo $alb_id ? '' : ' selected="selected"'; ?> value=""></option>
|
154 |
+
<?php echo wp_kses( $terms_album, $gm_allowed_tags ); ?>
|
155 |
</select>
|
156 |
</div>
|
157 |
|
158 |
<?php
|
159 |
if ( ! empty( $item->categories ) ) {
|
160 |
+
$terms_category = array();
|
161 |
foreach ( $item->categories as $c ) {
|
162 |
$terms_category[] = esc_html( $c->name );
|
163 |
}
|
167 |
}
|
168 |
?>
|
169 |
<div class="form-group">
|
170 |
+
<label><?php esc_html_e( 'Categories', 'grand-media' ); ?></label>
|
171 |
+
<input name="terms[gmedia_category]" data-create="<?php echo esc_attr( gm_user_can( 'category_manage' ) ? 'true' : 'false' ); ?>" class="combobox_gmedia_category form-control input-sm" value="<?php echo esc_attr( $terms_category ); ?>" placeholder="<?php esc_attr_e( 'Uncategorized', 'grand-media' ); ?>"/>
|
172 |
</div>
|
173 |
|
174 |
<?php
|
175 |
if ( ! empty( $item->tags ) ) {
|
176 |
+
$terms_tag = array();
|
177 |
foreach ( $item->tags as $c ) {
|
178 |
$terms_tag[] = esc_html( $c->name );
|
179 |
}
|
183 |
}
|
184 |
?>
|
185 |
<div class="form-group">
|
186 |
+
<label><?php esc_html_e( 'Tags ', 'grand-media' ); ?></label>
|
187 |
<input name="terms[gmedia_tag]" data-create="<?php echo esc_attr( gm_user_can( 'tag_manage' ) ? 'true' : 'false' ); ?>" class="combobox_gmedia_tag form-control input-sm" value="<?php echo esc_attr( $terms_tag ); ?>"/>
|
188 |
</div>
|
189 |
<?php } ?>
|
193 |
<div class="col-lg-6">
|
194 |
<?php if ( 'image' === $item->type ) { ?>
|
195 |
<div class="form-group">
|
196 |
+
<label><?php esc_html_e( 'Alternative Text', 'grand-media' ); ?></label>
|
197 |
+
<input type="text" class="form-control input-sm" name="meta[_image_alt]" value="<?php echo esc_attr( isset( $item->meta['_image_alt'][0] ) ? esc_attr( $item->meta['_image_alt'][0] ) : '' ); ?>" placeholder="<?php esc_attr_e( 'if empty, same as Title', 'grand-media' ); ?>"/>
|
198 |
</div>
|
199 |
<?php } ?>
|
200 |
<div class="form-group">
|
201 |
+
<label><?php esc_html_e( 'Filename', 'grand-media' ); ?>
|
202 |
+
<small style="white-space:nowrap;">(ext: .<?php echo esc_html( $item->ext ); ?>)</small>
|
203 |
</label>
|
204 |
<input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php echo ( ! gm_user_can( 'delete_others_media' ) && ( (int) $item->author !== $user_ID ) ) ? 'readonly' : ''; ?> value="<?php echo esc_attr( pathinfo( $item->gmuid, PATHINFO_FILENAME ) ); ?>"/>
|
205 |
</div>
|
206 |
<div class="form-group">
|
207 |
+
<label><?php esc_html_e( 'Date', 'grand-media' ); ?></label>
|
208 |
|
209 |
+
<div
|
210 |
+
class="input-group gmedia_date"
|
211 |
+
id="datetimepicker<?php echo absint( $item->ID ); ?>"
|
212 |
+
data-td-target-input="nearest"
|
213 |
+
data-td-target-toggle="nearest"
|
214 |
+
data-date-format="YYYY-MM-DD HH:mm:ss"
|
215 |
+
>
|
216 |
+
<input
|
217 |
+
name="date"
|
218 |
+
id="datetimepicker<?php echo absint( $item->ID ); ?>Input"
|
219 |
+
data-td-target="#datetimepicker<?php echo absint( $item->ID ); ?>"
|
220 |
+
type="text"
|
221 |
+
readonly="readonly"
|
222 |
+
class="form-control input-sm"
|
223 |
+
value="<?php echo esc_attr( $item->date ); ?>"
|
224 |
+
/>
|
225 |
+
<span
|
226 |
+
class="input-group-text btn-primary"
|
227 |
+
data-td-target="#datetimepicker<?php echo absint( $item->ID ); ?>"
|
228 |
+
data-td-toggle="datetimepicker"
|
229 |
+
><i class='fa-solid fa-calendar-days'></i></span>
|
230 |
</div>
|
231 |
</div>
|
232 |
+
<div class="form-group status-item bg-status-<?php echo esc_attr( $item->status ); ?>">
|
233 |
+
<label><?php esc_html_e( 'Status', 'grand-media' ); ?></label>
|
234 |
<select name="status" class="form-control input-sm">
|
235 |
+
<option <?php selected( $item->status, 'publish' ); ?> value="publish"><?php esc_html_e( 'Public', 'grand-media' ); ?></option>
|
236 |
+
<option <?php selected( $item->status, 'private' ); ?> value="private"><?php esc_html_e( 'Private', 'grand-media' ); ?></option>
|
237 |
+
<option <?php selected( $item->status, 'draft' ); ?> value="draft"><?php esc_html_e( 'Draft', 'grand-media' ); ?></option>
|
238 |
</select>
|
239 |
</div>
|
240 |
<?php if ( ! empty( $item->post_id ) ) { ?>
|
241 |
<div class="form-group">
|
242 |
+
<a
|
243 |
+
href="<?php echo esc_url( add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_id' => $item->ID ), $gmProcessor->url ) ); ?>"
|
244 |
+
data-bs-toggle="modal"
|
245 |
+
data-bs-target="#previewModal"
|
246 |
+
data-width="900"
|
247 |
+
data-height="500"
|
248 |
+
class="preview-modal gmpost-com-count float-end"
|
249 |
+
title="<?php esc_attr_e( 'Comments', 'grand-media' ); ?>">
|
250 |
+
<b class="comment-count"><?php echo intval( $item->comment_count ); ?></b>
|
251 |
+
<i class='fa-solid fa-comment'></i>
|
252 |
</a>
|
253 |
+
<label><?php esc_html_e( 'Comment Status', 'grand-media' ); ?></label>
|
254 |
<select name="comment_status" class="form-control input-sm">
|
255 |
+
<option <?php selected( $item->comment_status, 'open' ); ?> value="open"><?php esc_html_e( 'Open', 'grand-media' ); ?></option>
|
256 |
+
<option <?php selected( $item->comment_status, 'closed' ); ?> value="closed"><?php esc_html_e( 'Closed', 'grand-media' ); ?></option>
|
257 |
</select>
|
258 |
</div>
|
259 |
<?php } ?>
|
261 |
<div class="col-lg-6">
|
262 |
<?php if ( 'image' !== $item->type || ( 'image' === $item->type && ! $item->editor ) ) { ?>
|
263 |
<div class="form-group">
|
264 |
+
<label>
|
265 |
+
<?php
|
266 |
+
esc_html_e( 'Custom Cover', 'grand-media' );
|
267 |
+
echo ' <small>(' . esc_html__( 'media image ID', 'grand-media' ) . ')</small>';
|
268 |
+
?>
|
269 |
+
</label>
|
270 |
<div class="input-group">
|
271 |
+
<input type="text" class="form-control input-sm gmedia-cover-id" name="meta[_cover]" value="<?php echo esc_attr( isset( $item->meta['_cover'][0] ) ? $item->meta['_cover'][0] : '' ); ?>" placeholder="<?php esc_attr_e( 'Gmedia Image ID', 'grand-media' ); ?>"/>
|
272 |
+
<span class="input-group-btn">
|
273 |
+
<a href="<?php echo esc_url( $gmCore->get_admin_url( array( 'page' => 'GrandMedia', 'mode' => 'select_single', 'gmediablank' => 'library', 'filter' => 'image' ), array(), true ) ); ?>"
|
274 |
+
class="btn btn-primary preview-modal"
|
275 |
+
data-bs-toggle="modal"
|
276 |
+
data-bs-target="#previewModal"
|
277 |
+
data-width="1200"
|
278 |
+
data-height="500"
|
279 |
+
data-cls="select_gmedia_image"
|
280 |
+
title="<?php esc_attr_e( 'Choose Cover Image', 'grand-media' ); ?>">
|
281 |
+
<i class='fa-solid fa-image'></i>
|
282 |
+
</a>
|
283 |
+
</span>
|
284 |
</div>
|
285 |
</div>
|
286 |
<?php } ?>
|
287 |
<?php if ( ( 'image' === $item->type ) || ( 'video' === $item->type ) ) { ?>
|
288 |
<div class="form-group">
|
289 |
+
<label><?php esc_html_e( 'GPS Location', 'grand-media' ); ?></label>
|
290 |
|
291 |
+
<div class="input-group">
|
292 |
+
<input name="meta[_gps]" type="text" class="form-control input-sm gps_map_coordinates" value="<?php echo esc_attr( $item->gps ); ?>" placeholder="<?php esc_attr_e( 'Latitude, Longtitude', 'grand-media' ); ?>" autocomplete="off"/>
|
293 |
+
<span class="input-group-btn">
|
294 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'map_editor', 'id' => $item->ID ), $gmProcessor->url ) ); ?>" class="btn btn-primary gmedit-modal" data-bs-toggle="modal" data-bs-target="#gmeditModal">
|
295 |
+
<i class='fa-solid fa-location-dot'></i>
|
296 |
+
</a>
|
297 |
+
</span>
|
298 |
</div>
|
299 |
</div>
|
300 |
<?php } ?>
|
301 |
<p class="media-meta">
|
302 |
+
<span class="badge label-default"><?php esc_html_e( 'Author', 'grand-media' ); ?>:</span> <?php echo esc_html( get_the_author_meta( 'display_name', $item->author ) ); ?>
|
303 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'ID', 'grand-media' ); ?>:</span> <strong><?php echo absint( $item->ID ); ?></strong>
|
304 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Post ID', 'grand-media' ); ?>:</span> <strong><?php echo esc_html( $item->post_id ); ?></strong>
|
305 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Type', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->mime_type ); ?>
|
306 |
<?php if ( ( 'image' === $item->type ) && $item->editor && ! empty( $item->meta['_metadata'] ) ) { ?>
|
307 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Dimensions', 'grand-media' ); ?>:</span>
|
308 |
<?php
|
309 |
$is_file_original = (bool) $item->path_original;
|
310 |
+
if ( $is_file_original ) {
|
311 |
+
?>
|
312 |
<a href="<?php echo esc_url( $item->url_original ); ?>"
|
313 |
+
data-bs-toggle="modal" data-bs-target="#previewModal"
|
314 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['original']['width'] ); ?>"
|
315 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['original']['height'] ); ?>"
|
316 |
class="preview-modal"
|
317 |
+
title="<?php esc_attr_e( 'Original', 'grand-media' ); ?>"><?php echo esc_html( $item->meta['_metadata'][0]['original']['width'] . '×' . $item->meta['_metadata'][0]['original']['height'] ); ?></a>,
|
318 |
<?php } else { ?>
|
319 |
+
<span title="<?php esc_attr_e( 'Original', 'grand-media' ); ?>"><?php echo esc_html( $item->meta['_metadata'][0]['original']['width'] . '×' . $item->meta['_metadata'][0]['original']['height'] ); ?></span>,
|
320 |
<?php } ?>
|
321 |
<a href="<?php echo esc_url( $item->url ); ?>"
|
322 |
+
data-bs-toggle="modal" data-bs-target="#previewModal"
|
323 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['web']['width'] ); ?>"
|
324 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['web']['height'] ); ?>"
|
325 |
class="preview-modal"
|
326 |
+
title="<?php esc_attr_e( 'Webimage', 'grand-media' ); ?>"><?php echo esc_html( $item->meta['_metadata'][0]['web']['width'] . '×' . $item->meta['_metadata'][0]['web']['height'] ); ?></a>,
|
327 |
<a href="<?php echo esc_url( $item->url_thumb ); ?>"
|
328 |
+
data-bs-toggle="modal" data-bs-target="#previewModal"
|
329 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['thumb']['width'] ); ?>"
|
330 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['thumb']['height'] ); ?>"
|
331 |
class="preview-modal"
|
332 |
+
title="<?php esc_attr_e( 'Thumbnail', 'grand-media' ); ?>"><?php echo esc_html( $item->meta['_metadata'][0]['thumb']['width'] . '×' . $item->meta['_metadata'][0]['thumb']['height'] ); ?></a>
|
333 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'File Size', 'grand-media' ); ?>:</span>
|
334 |
+
<?php
|
335 |
+
echo esc_html( $is_file_original ? $gmCore->filesize( $item->path_original ) : '—' ) . ', ';
|
336 |
+
echo esc_html( $gmCore->filesize( $item->path ) . ', ' . $gmCore->filesize( $item->path_thumb ) );
|
337 |
+
?>
|
338 |
<?php } else { ?>
|
339 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'File Size', 'grand-media' ); ?>:</span> <?php echo esc_html( $gmCore->filesize( $item->path ) ); ?>
|
340 |
<?php } ?>
|
341 |
<?php if ( ! empty( $item->meta['_created_timestamp'][0] ) ) { ?>
|
342 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Created', 'grand-media' ); ?>:</span> <?php echo esc_html( gmdate( 'Y-m-d H:i:s ', $item->meta['_created_timestamp'][0] ) ); ?>
|
343 |
<?php } ?>
|
344 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Uploaded', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->date ); ?>
|
345 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Last Edited', 'grand-media' ); ?>:</span> <span class="gm-last-edited modified"><?php echo esc_html( $item->modified ); ?></span>
|
346 |
</p>
|
347 |
</div>
|
348 |
</div>
|
admin/pages/library/tpl/grid-item.php
CHANGED
@@ -1,22 +1,25 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Gmedia Item for Grid View in Library
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
?>
|
11 |
-
<div class="cb_list-item gm-item-cell col-xs-6 col-sm-4 col-md-3 col-lg-2 <?php echo implode( ' ', $item->classes ); ?>" id="list-item-<?php echo absint( $item->ID ); ?>" data-id="<?php echo absint( $item->ID ); ?>" data-type="<?php echo esc_attr( $item->type ); ?>">
|
12 |
-
<div class="thumbnail <?php echo ( $item->img_ratio >= 1 ) ? 'landscape' : 'portrait'; ?>">
|
13 |
<div class="cb_media-object">
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
</div>
|
18 |
-
<label class="gm-item-check">
|
19 |
-
<?php if ( $gmProcessor->mode
|
20 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/>
|
21 |
<?php } else { ?>
|
22 |
<input name="doaction[]" type="radio" data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/>
|
@@ -24,62 +27,71 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
24 |
</label>
|
25 |
<label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
26 |
<div class="gm-cell-more">
|
27 |
-
<span class="gm-cell-more-btn
|
28 |
<div class="gm-cell-more-content">
|
29 |
-
<p class="media-meta"><span class="
|
30 |
-
<br/><span class="
|
31 |
<?php
|
32 |
if ( $item->album ) {
|
33 |
-
$terms_album =
|
34 |
foreach ( $item->album as $c ) {
|
35 |
-
$terms_album[] = sprintf( '<a class="album" href="%s">%s</a>', esc_url( add_query_arg(
|
36 |
}
|
37 |
$terms_album = join( ', ', $terms_album );
|
38 |
} else {
|
39 |
-
$terms_album = sprintf( '<a class="album" href="%s">%s</a>', esc_url( add_query_arg(
|
40 |
}
|
41 |
-
echo $terms_album;
|
42 |
?>
|
43 |
-
<br/><span class="
|
44 |
<?php
|
45 |
if ( $item->categories ) {
|
46 |
-
$terms_category =
|
47 |
foreach ( $item->categories as $c ) {
|
48 |
-
$terms_category[] = sprintf( '<a class="category" href="%s">%s</a>', esc_url( add_query_arg(
|
49 |
}
|
50 |
$terms_category = join( ', ', $terms_category );
|
51 |
} else {
|
52 |
-
$terms_category = sprintf( '<a class="category" href="%s">%s</a>', esc_url( add_query_arg(
|
53 |
}
|
54 |
-
echo $terms_category;
|
55 |
?>
|
56 |
-
<br/><span class="
|
57 |
<?php
|
58 |
if ( $item->tags ) {
|
59 |
-
$terms_tag =
|
60 |
foreach ( $item->tags as $c ) {
|
61 |
-
$terms_tag[] = sprintf( '<a class="tag" href="%s">%s</a>', esc_url( add_query_arg(
|
62 |
}
|
63 |
$terms_tag = join( ', ', $terms_tag );
|
64 |
} else {
|
65 |
$terms_tag = '—';
|
66 |
}
|
67 |
-
echo $terms_tag;
|
68 |
?>
|
69 |
|
70 |
<?php if ( isset( $item->post_id ) ) { ?>
|
71 |
-
<br/><span class="
|
72 |
-
<a
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
</a>
|
76 |
<?php } ?>
|
77 |
-
<br/><span class="
|
78 |
-
<?php echo ( isset( $item->meta['views'][0] ) ? $item->meta['views'][0] :
|
79 |
|
80 |
-
<?php
|
81 |
-
|
82 |
-
|
|
|
|
|
83 |
<?php } ?>
|
84 |
</p>
|
85 |
</div>
|
@@ -88,8 +100,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
88 |
<div class="gm-cell-bottom">
|
89 |
<div class="gm-cell-title"><span><?php echo esc_html( $item->title ); ?> </span></div>
|
90 |
<div class="gmedia-actions">
|
91 |
-
<?php
|
92 |
-
|
|
|
93 |
?>
|
94 |
</div>
|
95 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Gmedia Item for Grid View in Library
|
6 |
+
*
|
7 |
+
* @var $gmProcessor
|
8 |
+
* @var $gmCore
|
9 |
+
* @var $gmDB
|
10 |
+
* @var $item
|
11 |
+
* @var $gmedia_url
|
12 |
*/
|
13 |
?>
|
14 |
+
<div class="cb_list-item gm-item-cell col-xs-6 col-sm-4 col-md-3 col-lg-2 <?php echo esc_attr( implode( ' ', $item->classes ) ); ?>" id="list-item-<?php echo absint( $item->ID ); ?>" data-id="<?php echo absint( $item->ID ); ?>" data-type="<?php echo esc_attr( $item->type ); ?>">
|
15 |
+
<div class="img-thumbnail <?php echo ( $item->img_ratio >= 1 ) ? 'landscape' : 'portrait'; ?>">
|
16 |
<div class="cb_media-object">
|
17 |
+
<span<?php echo in_array( $gmProcessor->mode, array( 'select_single', 'select_multiple' ), true ) ? '' : ' data-clicktarget="gmcheckbox' . intval( $item->ID ) . '"'; ?> class="centered">
|
18 |
+
<?php echo wp_kses_post( gmedia_item_thumbnail( $item ) ); ?>
|
19 |
+
</span>
|
20 |
</div>
|
21 |
+
<label class="gm-item-check" id="gmcheckbox<?php echo absint( $item->ID ); ?>">
|
22 |
+
<?php if ( 'select_single' !== $gmProcessor->mode ) { ?>
|
23 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/>
|
24 |
<?php } else { ?>
|
25 |
<input name="doaction[]" type="radio" data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/>
|
27 |
</label>
|
28 |
<label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
29 |
<div class="gm-cell-more">
|
30 |
+
<span class="gm-cell-more-btn fa-solid fa-bars"></span>
|
31 |
<div class="gm-cell-more-content">
|
32 |
+
<p class="media-meta"><span class="badge label-default"><?php esc_html_e( 'ID', 'grand-media' ); ?>:</span> #<?php echo absint( $item->ID ); ?>
|
33 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Album', 'grand-media' ); ?>:</span>
|
34 |
<?php
|
35 |
if ( $item->album ) {
|
36 |
+
$terms_album = array();
|
37 |
foreach ( $item->album as $c ) {
|
38 |
+
$terms_album[] = sprintf( '<a class="album" href="%s">%s</a>', esc_url( add_query_arg( array( 'album__in' => $c->term_id ), $gmedia_url ) ), esc_html( $c->name ) );
|
39 |
}
|
40 |
$terms_album = join( ', ', $terms_album );
|
41 |
} else {
|
42 |
+
$terms_album = sprintf( '<a class="album" href="%s">%s</a>', esc_url( add_query_arg( array( 'album__in' => 0 ), $gmedia_url ) ), '—' );
|
43 |
}
|
44 |
+
echo wp_kses_post( $terms_album );
|
45 |
?>
|
46 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Category', 'grand-media' ); ?>:</span>
|
47 |
<?php
|
48 |
if ( $item->categories ) {
|
49 |
+
$terms_category = array();
|
50 |
foreach ( $item->categories as $c ) {
|
51 |
+
$terms_category[] = sprintf( '<a class="category" href="%s">%s</a>', esc_url( add_query_arg( array( 'category__in' => $c->term_id ), $gmedia_url ) ), esc_html( $c->name ) );
|
52 |
}
|
53 |
$terms_category = join( ', ', $terms_category );
|
54 |
} else {
|
55 |
+
$terms_category = sprintf( '<a class="category" href="%s">%s</a>', esc_url( add_query_arg( array( 'category__in' => 0 ), $gmedia_url ) ), __( 'Uncategorized', 'grand-media' ) );
|
56 |
}
|
57 |
+
echo wp_kses_post( $terms_category );
|
58 |
?>
|
59 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Tags', 'grand-media' ); ?>:</span>
|
60 |
<?php
|
61 |
if ( $item->tags ) {
|
62 |
+
$terms_tag = array();
|
63 |
foreach ( $item->tags as $c ) {
|
64 |
+
$terms_tag[] = sprintf( '<a class="tag" href="%s">%s</a>', esc_url( add_query_arg( array( 'tag__in' => $c->term_id ), $gmedia_url ) ), esc_html( $c->name ) );
|
65 |
}
|
66 |
$terms_tag = join( ', ', $terms_tag );
|
67 |
} else {
|
68 |
$terms_tag = '—';
|
69 |
}
|
70 |
+
echo wp_kses_post( $terms_tag );
|
71 |
?>
|
72 |
|
73 |
<?php if ( isset( $item->post_id ) ) { ?>
|
74 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Comments', 'grand-media' ); ?>:</span>
|
75 |
+
<a
|
76 |
+
href="<?php echo esc_url( add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_id' => $item->ID ), $gmProcessor->url ) ); ?>"
|
77 |
+
data-bs-toggle="modal"
|
78 |
+
data-bs-target="#previewModal"
|
79 |
+
data-width="900"
|
80 |
+
data-height="500"
|
81 |
+
class="preview-modal gmpost-com-count"
|
82 |
+
title="<?php esc_attr_e( 'Comments', 'grand-media' ); ?>">
|
83 |
+
<b class="comment-count"><?php echo intval( $item->comment_count ); ?></b>
|
84 |
+
<i class='fa-solid fa-comment'></i>
|
85 |
</a>
|
86 |
<?php } ?>
|
87 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Views / Likes', 'grand-media' ); ?>:</span>
|
88 |
+
<?php echo intval( isset( $item->meta['views'][0] ) ? $item->meta['views'][0] : 0 ) . ' / ' . intval( isset( $item->meta['likes'][0] ) ? $item->meta['likes'][0] : 0 ); ?>
|
89 |
|
90 |
+
<?php
|
91 |
+
if ( isset( $item->meta['_rating'][0] ) ) {
|
92 |
+
$ratings = maybe_unserialize( $item->meta['_rating'][0] );
|
93 |
+
?>
|
94 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Rating', 'grand-media' ); ?>:</span> <?php echo esc_html( round( $ratings['value'], 2 ) . ' / ' . $ratings['votes'] ); ?>
|
95 |
<?php } ?>
|
96 |
</p>
|
97 |
</div>
|
100 |
<div class="gm-cell-bottom">
|
101 |
<div class="gm-cell-title"><span><?php echo esc_html( $item->title ); ?> </span></div>
|
102 |
<div class="gmedia-actions">
|
103 |
+
<?php
|
104 |
+
$media_action_links = gmedia_item_actions( $item );
|
105 |
+
echo wp_kses_post( implode( ' ', $media_action_links ) );
|
106 |
?>
|
107 |
</div>
|
108 |
</div>
|
admin/pages/library/tpl/list-item.php
CHANGED
@@ -1,40 +1,42 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Gmedia Item for List View in Library
|
9 |
*
|
|
|
10 |
* @var $gmCore
|
|
|
11 |
* @var $item
|
|
|
12 |
*/
|
13 |
?>
|
14 |
-
<div class="cb_list-item list-group-item d-row clearfix <?php echo implode( ' ', $item->classes ); ?>" id="list-item-<?php echo absint( $item->ID ); ?>" data-id="<?php echo absint( $item->ID ); ?>" data-type="<?php echo esc_attr( $item->type ); ?>">
|
15 |
<div class="gmedia_id">#<?php echo absint( $item->ID ); ?></div>
|
16 |
-
<div class="col-sm-4" style="max-width:
|
17 |
<div class="thumbwrap">
|
18 |
<div class="cb_media-object">
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
</div>
|
23 |
-
<label class="gm-item-check"><input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
24 |
<label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
25 |
</div>
|
26 |
<?php
|
27 |
if ( 'audio' === $item->type ) {
|
28 |
-
echo gmedia_waveform_player( $item );
|
29 |
}
|
30 |
?>
|
31 |
<div class="related-media-previews">
|
32 |
<?php
|
33 |
-
$related_ids = isset( $item->meta['_related'][0] ) ? $item->meta['_related'][0] :
|
34 |
if ( ! empty( $related_ids ) ) {
|
35 |
-
$related_media = $gmDB->get_gmedias(
|
36 |
foreach ( $related_media as $r_item ) {
|
37 |
-
|
|
|
|
|
38 |
}
|
39 |
}
|
40 |
?>
|
@@ -48,119 +50,132 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
48 |
<div class="in-library media-caption"><?php echo nl2br( esc_html( $item->description ) ); ?></div>
|
49 |
|
50 |
<p class="media-meta">
|
51 |
-
<span class="
|
52 |
-
<br/><span class="
|
53 |
<?php
|
54 |
if ( $item->album ) {
|
55 |
-
$terms_album =
|
56 |
foreach ( $item->album as $c ) {
|
57 |
-
$terms_album[] = sprintf( '<a class="album" href="%s">%s</a>', esc_url( add_query_arg(
|
58 |
}
|
59 |
$terms_album = join( ', ', $terms_album );
|
60 |
} else {
|
61 |
-
$terms_album = sprintf( '<a class="album" href="%s">%s</a>', esc_url( add_query_arg(
|
62 |
}
|
63 |
-
echo $terms_album;
|
64 |
?>
|
65 |
-
<br/><span class="
|
66 |
<?php
|
67 |
if ( $item->categories ) {
|
68 |
-
$terms_category =
|
69 |
foreach ( $item->categories as $c ) {
|
70 |
-
$terms_category[] = sprintf( '<a class="category" href="%s">%s</a>', esc_url( add_query_arg(
|
71 |
}
|
72 |
$terms_category = join( ', ', $terms_category );
|
73 |
} else {
|
74 |
-
$terms_category = sprintf( '<a class="category" href="%s">%s</a>', esc_url( add_query_arg(
|
75 |
}
|
76 |
-
echo $terms_category;
|
77 |
?>
|
78 |
-
<br/><span class="
|
79 |
<?php
|
80 |
if ( $item->tags ) {
|
81 |
-
$terms_tag =
|
82 |
foreach ( $item->tags as $c ) {
|
83 |
-
$terms_tag[] = sprintf( '<a class="tag" href="%s">%s</a>', esc_url( add_query_arg(
|
84 |
}
|
85 |
$terms_tag = join( ', ', $terms_tag );
|
86 |
} else {
|
87 |
$terms_tag = '—';
|
88 |
}
|
89 |
-
echo $terms_tag;
|
90 |
?>
|
91 |
</p>
|
92 |
</div>
|
93 |
<div class="col-lg-6">
|
94 |
<div class="media-meta gmedia-actions" style="margin:0 0 10px 0;">
|
95 |
-
<?php
|
96 |
-
|
|
|
97 |
?>
|
98 |
</div>
|
99 |
<?php if ( isset( $item->post_id ) ) { ?>
|
100 |
<p class="media-meta">
|
101 |
-
<span class="
|
102 |
-
<a
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
</a>
|
106 |
</p>
|
107 |
<?php } ?>
|
108 |
<p class="media-meta">
|
109 |
-
<span class="
|
110 |
-
<?php echo ( isset( $item->meta['views'][0] ) ? $item->meta['views'][0] :
|
111 |
|
112 |
-
<?php
|
113 |
-
|
114 |
-
|
|
|
|
|
115 |
<?php } ?>
|
116 |
-
<br/><span class="
|
117 |
-
<br/><span class="
|
118 |
<?php if ( ! empty( $item->link ) ) { ?>
|
119 |
-
<a href="<?php echo esc_url( $item->link ); ?>"><?php echo
|
120 |
<?php
|
121 |
} else {
|
122 |
echo '—';
|
123 |
-
}
|
|
|
124 |
<?php if ( ! empty( $item->gps ) ) { ?>
|
125 |
-
<br/><span class="
|
126 |
<?php } ?>
|
127 |
</p>
|
128 |
<p class="media-meta">
|
129 |
-
<span class="
|
130 |
-
<?php
|
|
|
131 |
?>
|
132 |
-
<br/><span class="
|
133 |
<?php
|
134 |
$is_file_original = (bool) $item->path_original;
|
135 |
-
if ( $is_file_original ) {
|
|
|
136 |
<a href="<?php echo esc_url( $item->url_original ); ?>"
|
137 |
-
data-target="#previewModal"
|
138 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['original']['width'] ); ?>"
|
139 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['original']['height'] ); ?>"
|
140 |
class="preview-modal"
|
141 |
-
title="<?php
|
142 |
<?php } else { ?>
|
143 |
-
<span title="<?php
|
144 |
<?php } ?>
|
145 |
<a href="<?php echo esc_url( $item->url ); ?>"
|
146 |
-
data-target="#previewModal"
|
147 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['web']['width'] ); ?>"
|
148 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['web']['height'] ); ?>"
|
149 |
class="preview-modal"
|
150 |
-
title="<?php
|
151 |
<a href="<?php echo esc_url( $item->url_thumb ); ?>"
|
152 |
-
data-target="#previewModal"
|
153 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['thumb']['width'] ); ?>"
|
154 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['thumb']['height'] ); ?>"
|
155 |
class="preview-modal"
|
156 |
-
title="<?php
|
157 |
<?php } ?>
|
158 |
-
<br/><span class="
|
159 |
<?php if ( ! empty( $item->meta['_created_timestamp'][0] ) ) { ?>
|
160 |
-
<br/><span class="
|
161 |
<?php } ?>
|
162 |
-
<br/><span class="
|
163 |
-
<br/><span class="
|
164 |
</p>
|
165 |
</div>
|
166 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Gmedia Item for List View in Library
|
6 |
*
|
7 |
+
* @var $gmProcessor
|
8 |
* @var $gmCore
|
9 |
+
* @var $gmDB
|
10 |
* @var $item
|
11 |
+
* @var $gmedia_url
|
12 |
*/
|
13 |
?>
|
14 |
+
<div class="cb_list-item list-group-item d-row clearfix <?php echo esc_attr( implode( ' ', $item->classes ) ); ?>" id="list-item-<?php echo absint( $item->ID ); ?>" data-id="<?php echo absint( $item->ID ); ?>" data-type="<?php echo esc_attr( $item->type ); ?>">
|
15 |
<div class="gmedia_id">#<?php echo absint( $item->ID ); ?></div>
|
16 |
+
<div class="col-sm-4" style="max-width:310px;">
|
17 |
<div class="thumbwrap">
|
18 |
<div class="cb_media-object">
|
19 |
+
<span data-clicktarget="gmcheckbox<?php echo absint( $item->ID ); ?>" class="img-thumbnail">
|
20 |
+
<?php echo wp_kses_post( gmedia_item_thumbnail( $item ) ); ?>
|
21 |
+
</span>
|
22 |
</div>
|
23 |
+
<label class="gm-item-check" id="gmcheckbox<?php echo absint( $item->ID ); ?>"><input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
24 |
<label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack ? ' checked="checked"' : ''; ?> data-type="<?php echo esc_attr( $item->type ); ?>" value="<?php echo absint( $item->ID ); ?>"/></label>
|
25 |
</div>
|
26 |
<?php
|
27 |
if ( 'audio' === $item->type ) {
|
28 |
+
echo wp_kses_post( gmedia_waveform_player( $item ) );
|
29 |
}
|
30 |
?>
|
31 |
<div class="related-media-previews">
|
32 |
<?php
|
33 |
+
$related_ids = isset( $item->meta['_related'][0] ) ? $item->meta['_related'][0] : array();
|
34 |
if ( ! empty( $related_ids ) ) {
|
35 |
+
$related_media = $gmDB->get_gmedias( array( 'gmedia__in' => $related_ids, 'orderby' => 'gmedia__in' ) );
|
36 |
foreach ( $related_media as $r_item ) {
|
37 |
+
?>
|
38 |
+
<p class="img-thumbnail gmedia-related-image"><span class="image-wrapper"><?php echo esc_url( gmedia_item_thumbnail( $r_item ) ); ?></span></p>
|
39 |
+
<?php
|
40 |
}
|
41 |
}
|
42 |
?>
|
50 |
<div class="in-library media-caption"><?php echo nl2br( esc_html( $item->description ) ); ?></div>
|
51 |
|
52 |
<p class="media-meta">
|
53 |
+
<span class="badge label-default"><?php esc_html_e( 'Author', 'grand-media' ); ?>:</span> <?php printf( '<a class="gmedia-author" href="%s">%s</a>', esc_url( add_query_arg( array( 'author' => $item->author ), $gmedia_url ) ), esc_html( get_user_option( 'display_name', $item->author ) ) ); ?>
|
54 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Album', 'grand-media' ); ?>:</span>
|
55 |
<?php
|
56 |
if ( $item->album ) {
|
57 |
+
$terms_album = array();
|
58 |
foreach ( $item->album as $c ) {
|
59 |
+
$terms_album[] = sprintf( '<a class="album" href="%s">%s</a>', esc_url( add_query_arg( array( 'album__in' => $c->term_id ), $gmedia_url ) ), esc_html( $c->name ) );
|
60 |
}
|
61 |
$terms_album = join( ', ', $terms_album );
|
62 |
} else {
|
63 |
+
$terms_album = sprintf( '<a class="album" href="%s">%s</a>', esc_url( add_query_arg( array( 'album__in' => 0 ), $gmedia_url ) ), '—' );
|
64 |
}
|
65 |
+
echo wp_kses_post( $terms_album );
|
66 |
?>
|
67 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Category', 'grand-media' ); ?>:</span>
|
68 |
<?php
|
69 |
if ( $item->categories ) {
|
70 |
+
$terms_category = array();
|
71 |
foreach ( $item->categories as $c ) {
|
72 |
+
$terms_category[] = sprintf( '<a class="category" href="%s">%s</a>', esc_url( add_query_arg( array( 'category__in' => $c->term_id ), $gmedia_url ) ), esc_html( $c->name ) );
|
73 |
}
|
74 |
$terms_category = join( ', ', $terms_category );
|
75 |
} else {
|
76 |
+
$terms_category = sprintf( '<a class="category" href="%s">%s</a>', esc_url( add_query_arg( array( 'category__in' => 0 ), $gmedia_url ) ), __( 'Uncategorized', 'grand-media' ) );
|
77 |
}
|
78 |
+
echo wp_kses_post( $terms_category );
|
79 |
?>
|
80 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Tags', 'grand-media' ); ?>:</span>
|
81 |
<?php
|
82 |
if ( $item->tags ) {
|
83 |
+
$terms_tag = array();
|
84 |
foreach ( $item->tags as $c ) {
|
85 |
+
$terms_tag[] = sprintf( '<a class="tag" href="%s">%s</a>', esc_url( add_query_arg( array( 'tag__in' => $c->term_id ), $gmedia_url ) ), esc_html( $c->name ) );
|
86 |
}
|
87 |
$terms_tag = join( ', ', $terms_tag );
|
88 |
} else {
|
89 |
$terms_tag = '—';
|
90 |
}
|
91 |
+
echo wp_kses_post( $terms_tag );
|
92 |
?>
|
93 |
</p>
|
94 |
</div>
|
95 |
<div class="col-lg-6">
|
96 |
<div class="media-meta gmedia-actions" style="margin:0 0 10px 0;">
|
97 |
+
<?php
|
98 |
+
$media_action_links = gmedia_item_actions( $item );
|
99 |
+
echo wp_kses_post( implode( ' | ', $media_action_links ) );
|
100 |
?>
|
101 |
</div>
|
102 |
<?php if ( isset( $item->post_id ) ) { ?>
|
103 |
<p class="media-meta">
|
104 |
+
<span class="badge label-default"><?php esc_html_e( 'Comments', 'grand-media' ); ?>:</span>
|
105 |
+
<a
|
106 |
+
href="<?php echo esc_url( add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_id' => $item->ID ), $gmProcessor->url ) ); ?>"
|
107 |
+
data-bs-toggle="modal"
|
108 |
+
data-bs-target="#previewModal"
|
109 |
+
data-width="900"
|
110 |
+
data-height="500"
|
111 |
+
class="preview-modal gmpost-com-count"
|
112 |
+
title="<?php esc_attr_e( 'Comments', 'grand-media' ); ?>">
|
113 |
+
<b class="comment-count"><?php echo intval( $item->comment_count ); ?></b>
|
114 |
+
<i class='fa-solid fa-comment'></i>
|
115 |
</a>
|
116 |
</p>
|
117 |
<?php } ?>
|
118 |
<p class="media-meta">
|
119 |
+
<span class="badge label-default"><?php esc_html_e( 'Views / Likes', 'grand-media' ); ?>:</span>
|
120 |
+
<?php echo intval( isset( $item->meta['views'][0] ) ? $item->meta['views'][0] : 0 ) . ' / ' . intval( isset( $item->meta['likes'][0] ) ? $item->meta['likes'][0] : 0 ); ?>
|
121 |
|
122 |
+
<?php
|
123 |
+
if ( isset( $item->meta['_rating'][0] ) ) {
|
124 |
+
$ratings = maybe_unserialize( $item->meta['_rating'][0] );
|
125 |
+
?>
|
126 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Rating', 'grand-media' ); ?>:</span> <?php echo esc_html( round( $ratings['value'], 2 ) . ' / ' . $ratings['votes'] ); ?>
|
127 |
<?php } ?>
|
128 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Status', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->status ); ?>
|
129 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Link', 'grand-media' ); ?>:</span>
|
130 |
<?php if ( ! empty( $item->link ) ) { ?>
|
131 |
+
<a href="<?php echo esc_url( $item->link ); ?>"><?php echo esc_html( $item->link ); ?></a>
|
132 |
<?php
|
133 |
} else {
|
134 |
echo '—';
|
135 |
+
}
|
136 |
+
?>
|
137 |
<?php if ( ! empty( $item->gps ) ) { ?>
|
138 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'GPS Location', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->gps ); ?>
|
139 |
<?php } ?>
|
140 |
</p>
|
141 |
<p class="media-meta">
|
142 |
+
<span class="badge label-default"><?php esc_html_e( 'Type', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->mime_type ); ?>
|
143 |
+
<?php
|
144 |
+
if ( ( 'image' === $item->type ) && $item->editor && ! empty( $item->meta['_metadata'] ) ) {
|
145 |
?>
|
146 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Dimensions', 'grand-media' ); ?>:</span>
|
147 |
<?php
|
148 |
$is_file_original = (bool) $item->path_original;
|
149 |
+
if ( $is_file_original ) {
|
150 |
+
?>
|
151 |
<a href="<?php echo esc_url( $item->url_original ); ?>"
|
152 |
+
data-bs-toggle="modal" data-bs-target="#previewModal"
|
153 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['original']['width'] ); ?>"
|
154 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['original']['height'] ); ?>"
|
155 |
class="preview-modal"
|
156 |
+
title="<?php esc_attr_e( 'Original', 'grand-media' ); ?>"><?php echo esc_html( $item->meta['_metadata'][0]['original']['width'] . '×' . $item->meta['_metadata'][0]['original']['height'] ); ?></a>,
|
157 |
<?php } else { ?>
|
158 |
+
<span title="<?php esc_attr_e( 'Original', 'grand-media' ); ?>"><?php echo esc_html( $item->meta['_metadata'][0]['original']['width'] . '×' . $item->meta['_metadata'][0]['original']['height'] ); ?></span>,
|
159 |
<?php } ?>
|
160 |
<a href="<?php echo esc_url( $item->url ); ?>"
|
161 |
+
data-bs-toggle="modal" data-bs-target="#previewModal"
|
162 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['web']['width'] ); ?>"
|
163 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['web']['height'] ); ?>"
|
164 |
class="preview-modal"
|
165 |
+
title="<?php esc_attr_e( 'Webimage', 'grand-media' ); ?>"><?php echo esc_html( $item->meta['_metadata'][0]['web']['width'] . '×' . $item->meta['_metadata'][0]['web']['height'] ); ?></a>,
|
166 |
<a href="<?php echo esc_url( $item->url_thumb ); ?>"
|
167 |
+
data-bs-toggle="modal" data-bs-target="#previewModal"
|
168 |
data-width="<?php echo esc_attr( $item->meta['_metadata'][0]['thumb']['width'] ); ?>"
|
169 |
data-height="<?php echo esc_attr( $item->meta['_metadata'][0]['thumb']['height'] ); ?>"
|
170 |
class="preview-modal"
|
171 |
+
title="<?php esc_attr_e( 'Thumbnail', 'grand-media' ); ?>"><?php echo esc_html( $item->meta['_metadata'][0]['thumb']['width'] . '×' . $item->meta['_metadata'][0]['thumb']['height'] ); ?></a>
|
172 |
<?php } ?>
|
173 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Filename', 'grand-media' ); ?>:</span> <a href="<?php echo esc_url( $item->url ); ?>" download="<?php echo esc_attr( $item->gmuid ); ?>"><?php echo esc_html( $item->gmuid ); ?></a>
|
174 |
<?php if ( ! empty( $item->meta['_created_timestamp'][0] ) ) { ?>
|
175 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Created', 'grand-media' ); ?>:</span> <?php echo esc_html( gmdate( 'Y-m-d H:i:s ', $item->meta['_created_timestamp'][0] ) ); ?>
|
176 |
<?php } ?>
|
177 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Uploaded', 'grand-media' ); ?>:</span> <?php echo esc_html( $item->date ); ?>
|
178 |
+
<br/><span class="badge label-default"><?php esc_html_e( 'Last Edited', 'grand-media' ); ?>:</span> <span class="gm-last-edited modified"><?php echo esc_html( $item->modified ); ?></span>
|
179 |
</p>
|
180 |
</div>
|
181 |
</div>
|
admin/pages/library/tpl/no-items.php
CHANGED
@@ -1,29 +1,30 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
global $gmCore, $gmProcessor;
|
7 |
?>
|
8 |
<div class="list-group-item">
|
9 |
<div class="well well-lg text-center">
|
10 |
-
<?php
|
11 |
-
|
|
|
12 |
} else {
|
13 |
-
echo '<h4>' .
|
14 |
if ( gm_user_can( 'upload' ) && ! $gmProcessor->gmediablank ) {
|
15 |
-
$args =
|
16 |
if ( $gmProcessor->edit_term ) {
|
17 |
$taxterm = $gmProcessor->taxterm;
|
18 |
$args[ $taxterm ] = $gmProcessor->edit_term;
|
19 |
}
|
20 |
?>
|
21 |
<p>
|
22 |
-
<a href="<?php echo esc_url( gm_get_admin_url( $args,
|
23 |
-
<
|
24 |
</a>
|
25 |
</p>
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
</div>
|
29 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
3 |
+
|
|
|
|
|
4 |
global $gmCore, $gmProcessor;
|
5 |
?>
|
6 |
<div class="list-group-item">
|
7 |
<div class="well well-lg text-center">
|
8 |
+
<?php
|
9 |
+
if ( 'duplicates' === $gmCore->_get( 'gmedia__in' ) ) {
|
10 |
+
echo '<h4>' . esc_html__( 'No duplicates in Gmedia Library.', 'grand-media' ) . '</h4>';
|
11 |
} else {
|
12 |
+
echo '<h4>' . esc_html__( 'No items to show.', 'grand-media' ) . '</h4>';
|
13 |
if ( gm_user_can( 'upload' ) && ! $gmProcessor->gmediablank ) {
|
14 |
+
$args = array( 'page' => 'GrandMedia_AddMedia' );
|
15 |
if ( $gmProcessor->edit_term ) {
|
16 |
$taxterm = $gmProcessor->taxterm;
|
17 |
$args[ $taxterm ] = $gmProcessor->edit_term;
|
18 |
}
|
19 |
?>
|
20 |
<p>
|
21 |
+
<a href="<?php echo esc_url( gm_get_admin_url( $args, array(), true ) ); ?>" class="btn btn-success">
|
22 |
+
<i class='fa-solid fa-plus'></i> <?php esc_html_e( 'Add Media', 'grand-media' ); ?>
|
23 |
</a>
|
24 |
</p>
|
25 |
+
<?php
|
26 |
+
}
|
27 |
+
}
|
28 |
+
?>
|
29 |
</div>
|
30 |
</div>
|
admin/pages/library/tpl/panel-footer.php
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
<div class="panel-footer clearfix">
|
8 |
-
<?php echo $gmedia_pager; ?>
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
/**
|
5 |
+
* @var $gmedia_pager
|
6 |
+
* @var $gm_allowed_tags
|
7 |
+
*/?>
|
8 |
+
<div class="card-footer clearfix">
|
9 |
+
<?php echo wp_kses( $gmedia_pager, $gm_allowed_tags ); ?>
|
10 |
+
|
11 |
+
<a href="#top" class="btn btn-secondary btn-sm"><i class='fa-solid fa-arrow-up'></i> <?php esc_html_e( 'Back to top', 'grand-media' ); ?></a>
|
12 |
</div>
|
admin/pages/library/tpl/panel-heading.php
CHANGED
@@ -1,68 +1,80 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* @var $gmCore
|
9 |
* @var $gmProcessor
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
?>
|
12 |
-
<div class="
|
13 |
-
<div class="
|
14 |
-
<div class="
|
15 |
<div class="clearfix">
|
16 |
-
<?php
|
17 |
|
18 |
-
<div class="btn-toolbar
|
19 |
-
<?php
|
20 |
-
|
21 |
-
<?php } ?>
|
22 |
-
|
23 |
-
<?php if ( $gmProcessor->mode !== 'edit' ) {
|
24 |
$view = $gmProcessor->gmediablank ? '_frame' : '';
|
25 |
$display_mode_gmedia = $gmProcessor->display_mode;
|
26 |
-
if (
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
</div>
|
31 |
<?php
|
32 |
}
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
<?php } ?>
|
37 |
</div>
|
38 |
</div>
|
39 |
|
40 |
-
<?php echo $gmedia_pager; ?>
|
41 |
|
42 |
<div class="spinner"></div>
|
43 |
|
44 |
</div>
|
45 |
-
<div class="btn-toolbar
|
46 |
-
<?php if ( $gmProcessor->mode
|
47 |
<div class="btn-group gm-checkgroup" id="cb_global-btn">
|
48 |
-
<span class="btn btn-
|
49 |
-
<button type="button" class="btn btn-
|
50 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span></button>
|
51 |
<ul class="dropdown-menu" role="menu">
|
52 |
-
<li><a data-select="total" href="#"><?php
|
53 |
-
<li><a data-select="none" href="#"><?php
|
54 |
-
<li
|
55 |
-
|
56 |
-
|
57 |
-
<li><a data-select="
|
58 |
-
<li class="
|
59 |
-
<li><a data-select="
|
|
|
|
|
|
|
|
|
60 |
</ul>
|
61 |
</div>
|
62 |
<?php } ?>
|
63 |
|
64 |
<div class="btn-group">
|
65 |
-
<?php
|
|
|
66 |
$curr_mime = explode( ',', $gmCore->_get( 'mime_type', 'total' ) );
|
67 |
if ( isset( $gmedia_filter['gmedia__in'] ) ) {
|
68 |
if ( ( 'show' === $gmCore->_get( 'stack' ) || 'selected' === $gmCore->_get( 'filter' ) ) ) {
|
@@ -75,25 +87,23 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
75 |
}
|
76 |
?>
|
77 |
<?php if ( ! empty( $gmedia_filter ) ) { ?>
|
78 |
-
<a class="btn btn-warning" title="<?php
|
79 |
<?php } else { ?>
|
80 |
-
<button type="button" class="btn btn-
|
81 |
<?php } ?>
|
82 |
-
<button type="button" class="btn btn-
|
83 |
-
<span class="
|
84 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
85 |
</button>
|
86 |
<ul class="dropdown-menu" role="menu">
|
87 |
<?php if ( gm_user_can( 'show_others_media' ) ) { ?>
|
88 |
-
<li role="presentation" class="dropdown-header"><?php
|
89 |
<li class="gmedia_author">
|
90 |
-
<a href="#libModal" data-modal="filter_author" data-action="gmedia_get_modal" class="gmedia-modal"><?php
|
91 |
</li>
|
92 |
<?php } ?>
|
93 |
|
94 |
<?php
|
95 |
-
|
96 |
-
$gm_qty_badge = [
|
97 |
'total' => '',
|
98 |
'image' => '',
|
99 |
'audio' => '',
|
@@ -101,108 +111,128 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
101 |
'text' => '',
|
102 |
'application' => '',
|
103 |
'other' => '',
|
104 |
-
|
105 |
|
106 |
foreach ( $gmedia_count as $key => $value ) {
|
107 |
-
$gm_qty_badge[ $key ] = '<span class="badge
|
108 |
}
|
109 |
?>
|
110 |
-
<li role="presentation" class="dropdown-header"><?php
|
111 |
-
<li class="total<?php echo in_array( 'total', $curr_mime, true ) ? ' active' : ''; ?>"
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
<li class="
|
|
|
|
|
|
|
|
|
|
|
116 |
<li class="application<?php echo ( ( in_array( 'application', $curr_mime, true ) || in_array( 'text', $curr_mime, true ) ) ? ' active' : '' ) . ( $gmedia_count['other'] ? '' : ' disabled' ); ?>">
|
117 |
-
<a rel="application" href="<?php echo esc_url( gm_get_admin_url(
|
118 |
<?php } ?>
|
119 |
|
120 |
-
<li role="presentation" class="dropdown-header"><?php
|
121 |
-
<li class="filter_categories<?php echo isset( $gmedia_filter['category__in'] ) ? ' active' : ''; ?>"
|
|
|
122 |
<?php if ( ! ( $gmProcessor->edit_term && 'album' === $gmProcessor->taxterm ) ) { ?>
|
123 |
-
<li class="filter_albums<?php echo isset( $gmedia_filter['album__in'] ) ? ' active' : ''; ?>"
|
|
|
124 |
<?php } ?>
|
125 |
-
<li class="filter_tags<?php echo isset( $gmedia_filter['tag__in'] ) ? ' active' : ''; ?>"><a href="#libModal" data-modal="filter_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php
|
126 |
<?php do_action( 'gmedia_filter_list' ); ?>
|
127 |
</ul>
|
128 |
</div>
|
129 |
|
130 |
-
<?php if ( ! in_array( $gmProcessor->mode,
|
131 |
<div class="btn-group">
|
132 |
-
<?php
|
133 |
-
|
|
|
134 |
} else {
|
135 |
-
$edit_mode_href = gm_get_admin_url(
|
136 |
-
}
|
|
|
137 |
<?php if ( gm_user_can( 'edit_media' ) ) { ?>
|
138 |
-
<a class="btn btn-
|
139 |
<?php } else { ?>
|
140 |
-
<button type="button" class="btn btn-
|
141 |
<?php } ?>
|
142 |
-
<button type="button" class="btn btn-
|
143 |
-
<span class="
|
144 |
<?php
|
145 |
$rel_selected_show = 'rel-selected-show';
|
146 |
$rel_selected_hide = 'rel-selected-hide';
|
147 |
?>
|
148 |
<ul class="dropdown-menu" role="menu">
|
149 |
-
<?php if ( ! ( $gmProcessor->mode
|
150 |
<li class="<?php echo esc_attr( gm_user_can( 'edit_media' ) ? '' : 'disabled' ); ?>">
|
151 |
-
<a class="edit-mode-link" href="<?php echo esc_url( $edit_mode_href ); ?>"><?php
|
152 |
</li>
|
153 |
<?php } else { ?>
|
154 |
-
<li><a href="<?php echo esc_url( $edit_mode_href ); ?>"><?php
|
155 |
<?php } ?>
|
156 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'edit_media' ) ? '' : ' disabled' ) ); ?>">
|
157 |
-
<a href="#libModal" data-modal="batch_edit" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="gmedia-modal"><?php
|
158 |
|
159 |
-
<li class="
|
|
|
|
|
160 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
161 |
-
<a href="#libModal" data-modal="assign_album" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="gmedia-modal"><?php
|
162 |
</li>
|
163 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
164 |
-
<a href="<?php echo esc_url( wp_nonce_url( gm_get_admin_url(
|
165 |
</li>
|
166 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
167 |
-
<a href="#libModal" data-modal="assign_category" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="gmedia-modal"><?php
|
168 |
</li>
|
169 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
170 |
-
<a href="#libModal" data-modal="unassign_category" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="gmedia-modal"><?php
|
171 |
</li>
|
172 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
173 |
-
<a href="#libModal" data-modal="add_tags" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="gmedia-modal"><?php
|
174 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
175 |
-
<a href="#libModal" data-modal="delete_tags" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="gmedia-modal"><?php
|
176 |
</li>
|
177 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'delete_media' ) ? '' : ' disabled' ) ); ?>">
|
178 |
-
<a
|
179 |
-
|
180 |
-
'ids'
|
181 |
-
|
|
|
|
|
182 |
</li>
|
183 |
|
184 |
<?php if ( ! $gmProcessor->gmediablank ) { ?>
|
185 |
-
<li class="
|
|
|
|
|
186 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'edit_media' ) ? '' : ' disabled' ) ); ?>">
|
187 |
-
<a href="<?php echo esc_url( wp_nonce_url( gm_get_admin_url(
|
188 |
</li>
|
189 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'edit_media' ) ? '' : ' disabled' ) ); ?>">
|
190 |
-
<a href="<?php echo esc_url( wp_nonce_url( gm_get_admin_url(
|
191 |
</li>
|
192 |
|
193 |
-
<li class="divider"></li>
|
194 |
<li>
|
195 |
-
<
|
|
|
|
|
|
|
196 |
</li>
|
197 |
<?php } ?>
|
198 |
|
199 |
-
<li class="
|
200 |
-
|
|
|
|
|
201 |
<?php do_action( 'gmedia_action_list' ); ?>
|
202 |
|
203 |
</ul>
|
204 |
</div>
|
205 |
-
|
|
|
206 |
do_action( 'gmedia_library_btn_toolbar' );
|
207 |
?>
|
208 |
|
@@ -213,46 +243,53 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
213 |
$filter_selected = ( 'selected' === $gmCore->_req( 'filter' ) );
|
214 |
$filter_selected_arg = $filter_selected ? false : 'selected';
|
215 |
?>
|
216 |
-
<form class="btn-group" id="gm-stack-btn" name="gm-stack-form" action="<?php echo esc_url( gm_get_admin_url(
|
217 |
-
|
218 |
-
<button type="
|
219 |
-
|
220 |
-
|
|
|
|
|
221 |
<ul class="dropdown-menu" role="menu">
|
222 |
-
<li><a id="gm-stack-show" href="#show"
|
|
|
223 |
if ( ! $filter_stack ) {
|
224 |
-
|
225 |
} else {
|
226 |
-
|
227 |
}
|
228 |
-
|
229 |
-
|
|
|
230 |
<li class="<?php echo esc_attr( gm_user_can( 'gallery_manage' ) ? '' : 'disabled' ); ?>">
|
231 |
-
<a href="#libModal" data-modal="quick_gallery_stack" data-action="gmedia_get_modal" data-ckey="gmedia_<?php echo absint( $user_ID ); ?>_libstack" class="gmedia-modal"><?php
|
232 |
</li>
|
233 |
</ul>
|
234 |
</form>
|
235 |
|
236 |
-
<?php if ( $gmProcessor->mode
|
237 |
-
<form class="btn-group<?php echo $filter_selected ? ' gm-active' : ''; ?>" id="gm-selected-btn" name="gm-selected-form" action="<?php echo esc_url( gm_get_admin_url(
|
238 |
-
|
239 |
-
<button type="
|
240 |
-
|
|
|
241 |
<input type="hidden" id="gm-selected" data-userid="<?php echo absint( $user_ID ); ?>" data-key="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" name="selected_items" value="<?php echo esc_attr( implode( ',', $gmProcessor->selected_items ) ); ?>"/>
|
242 |
<ul class="dropdown-menu" role="menu">
|
243 |
-
<li><a id="gm-selected-show" href="#show"
|
|
|
244 |
if ( ! $filter_selected ) {
|
245 |
-
|
246 |
} else {
|
247 |
-
|
248 |
}
|
249 |
-
|
250 |
-
|
251 |
-
<li><a id="gm-
|
252 |
-
<li><a id="gm-stack-
|
253 |
-
|
|
|
254 |
<li class="<?php echo esc_attr( gm_user_can( 'gallery_manage' ) ? '' : 'disabled' ); ?>">
|
255 |
-
<a href="#libModal" data-modal="quick_gallery" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="gmedia-modal"><?php
|
256 |
</li>
|
257 |
<?php } ?>
|
258 |
</ul>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* @var $gmCore
|
6 |
* @var $gmProcessor
|
7 |
+
* @var $user_ID
|
8 |
+
* @var $gmedia_user_options
|
9 |
+
* @var $gmedia_pager
|
10 |
+
* @var $gmedia_url
|
11 |
+
* @var $gmedia_count
|
12 |
+
* @var $gm_allowed_tags
|
13 |
*/
|
14 |
?>
|
15 |
+
<div class="card-header-fake"></div>
|
16 |
+
<div class="card-header bg-light clearfix" style="padding-bottom:2px;">
|
17 |
+
<div class="float-end" style="margin-bottom:3px;">
|
18 |
<div class="clearfix">
|
19 |
+
<?php require GMEDIA_ABSPATH . 'admin/tpl/search-form.php'; ?>
|
20 |
|
21 |
+
<div class="btn-toolbar gap-2 float-end" style="margin-bottom:4px; margin-left:4px;">
|
22 |
+
<?php
|
23 |
+
if ( 'edit' !== $gmProcessor->mode ) {
|
|
|
|
|
|
|
24 |
$view = $gmProcessor->gmediablank ? '_frame' : '';
|
25 |
$display_mode_gmedia = $gmProcessor->display_mode;
|
26 |
+
if ( 'grid' === $display_mode_gmedia ) {
|
27 |
+
?>
|
28 |
+
<a title="<?php esc_attr_e( 'Thumbnails Fit/Fill Cell', 'grand-media' ); ?>" href="<?php echo esc_url( gm_get_admin_url( array( 'grid_cell_fit' => 'toggle' ) ) ); ?>" class="fit-thumbs btn btn<?php echo ( 'true' === $gmedia_user_options["grid_cell_fit_gmedia{$view}"] ) ? '-success active' : '-secondary'; ?> btn-xs"><i class='fa-solid fa-eye'></i></a>
|
29 |
+
<?php
|
30 |
+
}
|
31 |
+
if ( ! $gmProcessor->edit_term && ! in_array( $gmProcessor->mode, array( 'select_single', 'select_mutiple' ), true ) ) {
|
32 |
+
?>
|
33 |
+
<div class="btn-group">
|
34 |
+
<a title="<?php esc_attr_e( 'Show as Grid', 'grand-media' ); ?>" href="<?php echo esc_url( gm_get_admin_url( array( 'display_mode' => 'grid' ) ) ); ?>" class="btn btn<?php echo ( 'grid' === $display_mode_gmedia ) ? '-primary active' : '-secondary'; ?> btn-xs"><i class='fa-solid fa-table-cells'></i></a>
|
35 |
+
<a title="<?php esc_attr_e( 'Show as List', 'grand-media' ); ?>" href="<?php echo esc_url( gm_get_admin_url( array( 'display_mode' => 'list' ) ) ); ?>" class="btn btn<?php echo ( 'list' === $display_mode_gmedia ) ? '-primary active' : '-secondary'; ?> btn-xs"><i class='fa-solid fa-table-list'></i></a>
|
36 |
</div>
|
37 |
<?php
|
38 |
}
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
|
42 |
+
<?php if ( ! $gmProcessor->gmediablank ) { ?>
|
43 |
+
<a title="<?php esc_attr_e( 'More Screen Settings', 'grand-media' ); ?>" class="show-settings-link btn btn-secondary btn-xs"><i class="fa-solid fa-gear"></i></a>
|
44 |
<?php } ?>
|
45 |
</div>
|
46 |
</div>
|
47 |
|
48 |
+
<?php echo wp_kses( $gmedia_pager, $gm_allowed_tags ); ?>
|
49 |
|
50 |
<div class="spinner"></div>
|
51 |
|
52 |
</div>
|
53 |
+
<div class="btn-toolbar gap-2 float-start" style="margin-bottom:7px;">
|
54 |
+
<?php if ( 'select_single' !== $gmProcessor->mode ) { ?>
|
55 |
<div class="btn-group gm-checkgroup" id="cb_global-btn">
|
56 |
+
<span class="btn btn-secondary active"><input class="doaction" id="cb_global" data-group="gm-item-check" type="checkbox"/></span>
|
57 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded='false'><span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span></button>
|
|
|
58 |
<ul class="dropdown-menu" role="menu">
|
59 |
+
<li><a class="dropdown-item" data-select="total" href="#"><?php esc_html_e( 'All', 'grand-media' ); ?></a></li>
|
60 |
+
<li><a class="dropdown-item" data-select="none" href="#"><?php esc_html_e( 'None', 'grand-media' ); ?></a></li>
|
61 |
+
<li>
|
62 |
+
<hr class='dropdown-divider'>
|
63 |
+
</li>
|
64 |
+
<li><a class="dropdown-item" data-select="image" href="#"><?php esc_html_e( 'Images', 'grand-media' ); ?></a></li>
|
65 |
+
<li><a class="dropdown-item" data-select="audio" href="#"><?php esc_html_e( 'Audio', 'grand-media' ); ?></a></li>
|
66 |
+
<li><a class="dropdown-item" data-select="video" href="#"><?php esc_html_e( 'Video', 'grand-media' ); ?></a></li>
|
67 |
+
<li>
|
68 |
+
<hr class='dropdown-divider'>
|
69 |
+
</li>
|
70 |
+
<li><a class="dropdown-item" data-select="reverse" href="#" title="<?php esc_attr_e( 'Reverse only visible items', 'grand-media' ); ?>"><?php esc_html_e( 'Reverse', 'grand-media' ); ?></a></li>
|
71 |
</ul>
|
72 |
</div>
|
73 |
<?php } ?>
|
74 |
|
75 |
<div class="btn-group">
|
76 |
+
<?php
|
77 |
+
// todo: !!!!!
|
78 |
$curr_mime = explode( ',', $gmCore->_get( 'mime_type', 'total' ) );
|
79 |
if ( isset( $gmedia_filter['gmedia__in'] ) ) {
|
80 |
if ( ( 'show' === $gmCore->_get( 'stack' ) || 'selected' === $gmCore->_get( 'filter' ) ) ) {
|
87 |
}
|
88 |
?>
|
89 |
<?php if ( ! empty( $gmedia_filter ) ) { ?>
|
90 |
+
<a class="btn btn-warning" title="<?php esc_attr_e( 'Reset Filter', 'grand-media' ); ?>" rel="total" href="<?php echo esc_url( gm_get_admin_url( array(), array(), $gmedia_url ) ); ?>"><?php esc_html_e( 'Reset Filter', 'grand-media' ); ?></a>
|
91 |
<?php } else { ?>
|
92 |
+
<button type="button" class="btn btn-secondary" data-bs-toggle="dropdown"><?php esc_html_e( 'Filter', 'grand-media' ); ?></button>
|
93 |
<?php } ?>
|
94 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
95 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
96 |
</button>
|
97 |
<ul class="dropdown-menu" role="menu">
|
98 |
<?php if ( gm_user_can( 'show_others_media' ) ) { ?>
|
99 |
+
<li role="presentation" class="dropdown-header"><?php esc_html_e( 'FILTER BY AUTHOR', 'grand-media' ); ?></li>
|
100 |
<li class="gmedia_author">
|
101 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="filter_author" data-action="gmedia_get_modal" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Choose authors', 'grand-media' ); ?></a>
|
102 |
</li>
|
103 |
<?php } ?>
|
104 |
|
105 |
<?php
|
106 |
+
$gm_qty_badge = array(
|
|
|
107 |
'total' => '',
|
108 |
'image' => '',
|
109 |
'audio' => '',
|
111 |
'text' => '',
|
112 |
'application' => '',
|
113 |
'other' => '',
|
114 |
+
);
|
115 |
|
116 |
foreach ( $gmedia_count as $key => $value ) {
|
117 |
+
$gm_qty_badge[ $key ] = '<span class="badge badge-info float-end">' . (int) $value . '</span>';
|
118 |
}
|
119 |
?>
|
120 |
+
<li role="presentation" class="dropdown-header"><?php esc_html_e( 'TYPE', 'grand-media' ); ?></li>
|
121 |
+
<li class="total<?php echo in_array( 'total', $curr_mime, true ) ? ' active' : ''; ?>">
|
122 |
+
<a class="dropdown-item" rel="total" href="<?php echo esc_url( gm_get_admin_url( array(), array( 'mime_type', 'pager' ) ) ); ?>"><?php echo wp_kses_post( $gm_qty_badge['total'] . esc_html__( 'All', 'grand-media' ) ); ?></a>
|
123 |
+
</li>
|
124 |
+
<?php if ( 'select_single' !== $gmProcessor->mode ) { ?>
|
125 |
+
<li class="image<?php echo ( in_array( 'image', $curr_mime, true ) ? ' active' : '' ) . ( $gmedia_count['image'] ? '' : ' disabled' ); ?>">
|
126 |
+
<a class="dropdown-item" rel="image" href="<?php echo esc_url( gm_get_admin_url( array( 'mime_type' => 'image' ), array( 'pager' ) ) ); ?>"><?php echo wp_kses_post( $gm_qty_badge['image'] . esc_html__( 'Images', 'grand-media' ) ); ?></a></li>
|
127 |
+
<li class="audio<?php echo ( in_array( 'audio', $curr_mime, true ) ? ' active' : '' ) . ( $gmedia_count['audio'] ? '' : ' disabled' ); ?>">
|
128 |
+
<a class="dropdown-item" rel="audio" href="<?php echo esc_url( gm_get_admin_url( array( 'mime_type' => 'audio' ), array( 'pager' ) ) ); ?>"><?php echo wp_kses_post( $gm_qty_badge['audio'] . esc_html__( 'Audio', 'grand-media' ) ); ?></a></li>
|
129 |
+
<li class="video<?php echo ( in_array( 'video', $curr_mime, true ) ? ' active' : '' ) . ( $gmedia_count['video'] ? '' : ' disabled' ); ?>">
|
130 |
+
<a class="dropdown-item" rel="video" href="<?php echo esc_url( gm_get_admin_url( array( 'mime_type' => 'video' ), array( 'pager' ) ) ); ?>"><?php echo wp_kses_post( $gm_qty_badge['video'] . esc_html__( 'Video', 'grand-media' ) ); ?></a></li>
|
131 |
<li class="application<?php echo ( ( in_array( 'application', $curr_mime, true ) || in_array( 'text', $curr_mime, true ) ) ? ' active' : '' ) . ( $gmedia_count['other'] ? '' : ' disabled' ); ?>">
|
132 |
+
<a class="dropdown-item" rel="application" href="<?php echo esc_url( gm_get_admin_url( array( 'mime_type' => 'application,text' ), array( 'pager' ) ) ); ?>"><?php echo wp_kses_post( $gm_qty_badge['other'] . esc_html__( 'Other', 'grand-media' ) ); ?></a></li>
|
133 |
<?php } ?>
|
134 |
|
135 |
+
<li role="presentation" class="dropdown-header"><?php esc_html_e( 'COLLECTIONS', 'grand-media' ); ?></li>
|
136 |
+
<li class="filter_categories<?php echo isset( $gmedia_filter['category__in'] ) ? ' active' : ''; ?>">
|
137 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="filter_categories" data-action="gmedia_get_modal" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Categories', 'grand-media' ); ?></a></li>
|
138 |
<?php if ( ! ( $gmProcessor->edit_term && 'album' === $gmProcessor->taxterm ) ) { ?>
|
139 |
+
<li class="filter_albums<?php echo isset( $gmedia_filter['album__in'] ) ? ' active' : ''; ?>">
|
140 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="filter_albums" data-action="gmedia_get_modal" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Albums', 'grand-media' ); ?></a></li>
|
141 |
<?php } ?>
|
142 |
+
<li class="filter_tags<?php echo isset( $gmedia_filter['tag__in'] ) ? ' active' : ''; ?>"><a href="#libModal" data-bs-toggle="modal" data-modal="filter_tags" data-action="gmedia_get_modal" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Tags', 'grand-media' ); ?></a></li>
|
143 |
<?php do_action( 'gmedia_filter_list' ); ?>
|
144 |
</ul>
|
145 |
</div>
|
146 |
|
147 |
+
<?php if ( ! in_array( $gmProcessor->mode, array( 'select_single', 'select_mutiple' ), true ) ) { ?>
|
148 |
<div class="btn-group">
|
149 |
+
<?php
|
150 |
+
if ( 'edit' !== $gmProcessor->mode ) {
|
151 |
+
$edit_mode_href = gm_get_admin_url( array( 'mode' => 'edit' ) );
|
152 |
} else {
|
153 |
+
$edit_mode_href = gm_get_admin_url( array(), array( 'mode' ) );
|
154 |
+
}
|
155 |
+
?>
|
156 |
<?php if ( gm_user_can( 'edit_media' ) ) { ?>
|
157 |
+
<a class="btn btn-secondary edit-mode-link" title="<?php esc_attr_e( 'Toggle Edit Mode', 'grand-media' ); ?>" href="<?php echo esc_url( $edit_mode_href ); ?>"><?php esc_html_e( 'Action', 'grand-media' ); ?></a>
|
158 |
<?php } else { ?>
|
159 |
+
<button type="button" class="btn btn-secondary"><?php esc_html_e( 'Action', 'grand-media' ); ?></button>
|
160 |
<?php } ?>
|
161 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
162 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span></button>
|
163 |
<?php
|
164 |
$rel_selected_show = 'rel-selected-show';
|
165 |
$rel_selected_hide = 'rel-selected-hide';
|
166 |
?>
|
167 |
<ul class="dropdown-menu" role="menu">
|
168 |
+
<?php if ( ! ( 'edit' === $gmProcessor->mode ) ) { ?>
|
169 |
<li class="<?php echo esc_attr( gm_user_can( 'edit_media' ) ? '' : 'disabled' ); ?>">
|
170 |
+
<a class="dropdown-item edit-mode-link" href="<?php echo esc_url( $edit_mode_href ); ?>"><?php esc_html_e( 'Enter Edit Mode', 'grand-media' ); ?></a>
|
171 |
</li>
|
172 |
<?php } else { ?>
|
173 |
+
<li><a class="dropdown-item" href="<?php echo esc_url( $edit_mode_href ); ?>"><?php esc_html_e( 'Exit Edit Mode', 'grand-media' ); ?></a></li>
|
174 |
<?php } ?>
|
175 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'edit_media' ) ? '' : ' disabled' ) ); ?>">
|
176 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="batch_edit" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Batch Edit', 'grand-media' ); ?></a></li>
|
177 |
|
178 |
+
<li class="<?php echo esc_attr( $rel_selected_show ); ?>">
|
179 |
+
<hr class="dropdown-divider">
|
180 |
+
</li>
|
181 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
182 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="assign_album" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Move to Album...', 'grand-media' ); ?></a>
|
183 |
</li>
|
184 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
185 |
+
<a class="dropdown-item" href="<?php echo esc_url( wp_nonce_url( gm_get_admin_url( array( 'do_gmedia' => 'unassign_album' ) ), 'gmedia_action', '_wpnonce_action' ) ); ?>" data-confirm="<?php esc_attr_e( "You are about to remove the selected items from assigned albums.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ); ?>"><?php esc_html_e( 'Remove from Album', 'grand-media' ); ?></a>
|
186 |
</li>
|
187 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
188 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="assign_category" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Assign Categories...', 'grand-media' ); ?></a>
|
189 |
</li>
|
190 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
191 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="unassign_category" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Unassign Categories...', 'grand-media' ); ?></a>
|
192 |
</li>
|
193 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
194 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="add_tags" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Add Tags...', 'grand-media' ); ?></a></li>
|
195 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms' ) ? '' : ' disabled' ) ); ?>">
|
196 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="delete_tags" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Delete Tags...', 'grand-media' ); ?></a>
|
197 |
</li>
|
198 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'delete_media' ) ? '' : ' disabled' ) ); ?>">
|
199 |
+
<a
|
200 |
+
class="dropdown-item"
|
201 |
+
href="<?php echo esc_url( wp_nonce_url( gm_get_admin_url( array( 'do_gmedia' => 'delete', 'ids' => 'selected' ), array( 'filter' ) ), 'gmedia_delete', '_wpnonce_delete' ) ); ?>"
|
202 |
+
class="dropdown-item gmedia-delete"
|
203 |
+
data-confirm="<?php esc_attr_e( "You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ); ?>"
|
204 |
+
><?php esc_html_e( 'Delete Selected Items', 'grand-media' ); ?></a>
|
205 |
</li>
|
206 |
|
207 |
<?php if ( ! $gmProcessor->gmediablank ) { ?>
|
208 |
+
<li class="<?php echo esc_attr( $rel_selected_show ); ?>">
|
209 |
+
<hr class="dropdown-divider">
|
210 |
+
</li>
|
211 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'edit_media' ) ? '' : ' disabled' ) ); ?>">
|
212 |
+
<a href="<?php echo esc_url( wp_nonce_url( gm_get_admin_url( array( 'do_gmedia' => 'recreate' ), array() ), 'gmedia_action', '_wpnonce_action' ) ); ?>" class="dropdown-item gmedia-update"><?php esc_html_e( 'Re-create Images (heavy process)', 'grand-media' ); ?></a>
|
213 |
</li>
|
214 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'edit_media' ) ? '' : ' disabled' ) ); ?>">
|
215 |
+
<a href="<?php echo esc_url( wp_nonce_url( gm_get_admin_url( array( 'do_gmedia' => 'update_meta' ), array() ), 'gmedia_action', '_wpnonce_action' ) ); ?>" class="dropdown-item gmedia-update"><?php esc_html_e( 'Update Metadata in Database', 'grand-media' ); ?></a>
|
216 |
</li>
|
217 |
|
|
|
218 |
<li>
|
219 |
+
<hr class="dropdown-divider">
|
220 |
+
</li>
|
221 |
+
<li>
|
222 |
+
<a class="dropdown-item" href="<?php echo esc_url( gm_get_admin_url( array( 'page' => 'GrandMedia', 'gmedia__in' => 'duplicates' ), array(), true ) ); ?>"><?php esc_html_e( 'Show Duplicates in Library', 'grand-media' ); ?></a>
|
223 |
</li>
|
224 |
<?php } ?>
|
225 |
|
226 |
+
<li class="<?php echo esc_attr( $rel_selected_hide ); ?>">
|
227 |
+
<hr class="dropdown-divider">
|
228 |
+
</li>
|
229 |
+
<li class="dropdown-header <?php echo esc_attr( $rel_selected_hide ); ?>"><span><?php esc_html_e( 'Select items to see more actions', 'grand-media' ); ?></span></li>
|
230 |
<?php do_action( 'gmedia_action_list' ); ?>
|
231 |
|
232 |
</ul>
|
233 |
</div>
|
234 |
+
<?php
|
235 |
+
}
|
236 |
do_action( 'gmedia_library_btn_toolbar' );
|
237 |
?>
|
238 |
|
243 |
$filter_selected = ( 'selected' === $gmCore->_req( 'filter' ) );
|
244 |
$filter_selected_arg = $filter_selected ? false : 'selected';
|
245 |
?>
|
246 |
+
<form class="btn-group" id="gm-stack-btn" name="gm-stack-form" action="<?php echo esc_url( gm_get_admin_url( array( 'stack' => $filter_stack_arg, 'filter' => $filter_selected ), array(), $gmedia_url ) ); ?>" method="post">
|
247 |
+
<?php // translators: number. ?>
|
248 |
+
<button type="submit" class="btn btn<?php echo ( 'show' === $filter_stack ) ? '-success' : '-info'; ?>"><?php echo wp_kses_post( sprintf( __( '%s in Stack', 'grand-media' ), '<span id="gm-stack-qty">' . count( $gmProcessor->stack_items ) . '</span>' ) ); ?></button>
|
249 |
+
<button type="button" class="btn btn-info dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
250 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
251 |
+
</button>
|
252 |
+
<input type="hidden" id="gm-stack" data-userid="<?php echo absint( $user_ID ); ?>" data-key="gmedia_<?php echo absint( $user_ID ); ?>_libstack" name="stack_items" value="<?php echo esc_attr( implode( ',', $gmProcessor->stack_items ) ); ?>"/>
|
253 |
<ul class="dropdown-menu" role="menu">
|
254 |
+
<li><a class='dropdown-item' id="gm-stack-show" href="#show">
|
255 |
+
<?php
|
256 |
if ( ! $filter_stack ) {
|
257 |
+
esc_html_e( 'Show Stack', 'grand-media' );
|
258 |
} else {
|
259 |
+
esc_html_e( 'Show Library', 'grand-media' );
|
260 |
}
|
261 |
+
?>
|
262 |
+
</a></li>
|
263 |
+
<li><a class='dropdown-item' id="gm-stack-clear" href="#clear"><?php esc_html_e( 'Clear Stack', 'grand-media' ); ?></a></li>
|
264 |
<li class="<?php echo esc_attr( gm_user_can( 'gallery_manage' ) ? '' : 'disabled' ); ?>">
|
265 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="quick_gallery_stack" data-action="gmedia_get_modal" data-ckey="gmedia_<?php echo absint( $user_ID ); ?>_libstack" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Quick Gallery from Stack', 'grand-media' ); ?></a>
|
266 |
</li>
|
267 |
</ul>
|
268 |
</form>
|
269 |
|
270 |
+
<?php if ( 'select_single' !== $gmProcessor->mode ) { ?>
|
271 |
+
<form class="btn-group<?php echo $filter_selected ? ' gm-active' : ''; ?>" id="gm-selected-btn" name="gm-selected-form" action="<?php echo esc_url( gm_get_admin_url( array( 'stack' => $filter_stack, 'filter' => $filter_selected_arg ), array(), $gmedia_url ) ); ?>" method="post">
|
272 |
+
<?php // translators: number. ?>
|
273 |
+
<button type="submit" class="btn btn<?php echo $filter_selected ? '-success' : '-info'; ?>"><?php echo wp_kses_post( sprintf( __( '%s selected', 'grand-media' ), '<span id="gm-selected-qty">' . count( $gmProcessor->selected_items ) . '</span>' ) ); ?></button>
|
274 |
+
<button type="button" class="btn btn-info dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
275 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span></button>
|
276 |
<input type="hidden" id="gm-selected" data-userid="<?php echo absint( $user_ID ); ?>" data-key="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" name="selected_items" value="<?php echo esc_attr( implode( ',', $gmProcessor->selected_items ) ); ?>"/>
|
277 |
<ul class="dropdown-menu" role="menu">
|
278 |
+
<li><a class='dropdown-item' id="gm-selected-show" href="#show">
|
279 |
+
<?php
|
280 |
if ( ! $filter_selected ) {
|
281 |
+
esc_html_e( 'Show only selected items', 'grand-media' );
|
282 |
} else {
|
283 |
+
esc_html_e( 'Show all gmedia items', 'grand-media' );
|
284 |
}
|
285 |
+
?>
|
286 |
+
</a></li>
|
287 |
+
<li><a class='dropdown-item' id="gm-selected-clear" href="#clear"><?php esc_html_e( 'Clear selected items', 'grand-media' ); ?></a></li>
|
288 |
+
<li><a class='dropdown-item' id="gm-stack-in" href="#stack_add"><?php esc_html_e( 'Add selected items to Stack', 'grand-media' ); ?></a></li>
|
289 |
+
<li><a class='dropdown-item' id="gm-stack-out" href="#stack_remove"><?php esc_html_e( 'Remove selected items from Stack', 'grand-media' ); ?></a></li>
|
290 |
+
<?php if ( 'select_multiple' !== $gmProcessor->mode ) { ?>
|
291 |
<li class="<?php echo esc_attr( gm_user_can( 'gallery_manage' ) ? '' : 'disabled' ); ?>">
|
292 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="quick_gallery" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Library::$cookie_key ); ?>" class="dropdown-item gmedia-modal"><?php esc_html_e( 'Quick Gallery from Selected', 'grand-media' ); ?></a>
|
293 |
</li>
|
294 |
<?php } ?>
|
295 |
</ul>
|
admin/pages/modules/edit-preset.php
CHANGED
@@ -3,16 +3,13 @@
|
|
3 |
* Gmedia Gallery Edit
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
12 |
|
13 |
$term_id = (int) $gmCore->_get( 'preset', 0 );
|
14 |
$preset_module = $gmCore->_get( 'preset_module' );
|
15 |
-
$gmedia_url = add_query_arg(
|
16 |
$gmedia_term_taxonomy = 'gmedia_module';
|
17 |
$taxterm = str_replace( 'gmedia_', '', $gmedia_term_taxonomy );
|
18 |
|
@@ -29,7 +26,7 @@ $gmedia_modules = get_gmedia_modules( false );
|
|
29 |
|
30 |
$default_module_demo_query_args = get_user_option( 'gmedia_preset_demo_query_args' );
|
31 |
$gmedia_filter = gmedia_gallery_query_data( $default_module_demo_query_args );
|
32 |
-
$default_options =
|
33 |
|
34 |
if ( isset( $gmedia_modules['in'][ $term->module['name'] ] ) ) {
|
35 |
|
@@ -47,14 +44,16 @@ if ( isset( $gmedia_modules['in'][ $term->module['name'] ] ) ) {
|
|
47 |
include $module_path . '/settings.php';
|
48 |
|
49 |
} else {
|
50 |
-
|
|
|
51 |
}
|
52 |
} else {
|
53 |
-
|
|
|
54 |
}
|
55 |
|
56 |
if ( ! empty( $alert ) ) {
|
57 |
-
echo $gmCore->alert( 'danger', $alert );
|
58 |
}
|
59 |
|
60 |
if ( ! empty( $term->module['settings'] ) ) {
|
@@ -63,21 +62,21 @@ if ( ! empty( $term->module['settings'] ) ) {
|
|
63 |
$gallery_settings = $default_options;
|
64 |
}
|
65 |
|
66 |
-
$params =
|
67 |
-
$gallery_link_default = add_query_arg(
|
68 |
|
69 |
/** @noinspection PhpIncludeInspection */
|
70 |
-
|
71 |
|
72 |
do_action( 'gmedia_module_preset_before_panel' );
|
73 |
?>
|
74 |
|
75 |
-
<div class="
|
76 |
|
77 |
<?php
|
78 |
-
|
79 |
|
80 |
-
|
81 |
?>
|
82 |
|
83 |
</div>
|
@@ -89,11 +88,11 @@ do_action( 'gmedia_module_preset_after_panel' );
|
|
89 |
<div class="modal-dialog">
|
90 |
<div class="modal-content">
|
91 |
<div class="modal-header">
|
92 |
-
<div class="btn-toolbar pull-right" style="margin-top:-4px;">
|
93 |
-
<button type="button" class="btn btn-primary"><?php _e( 'Submit', 'grand-media' ); ?></button>
|
94 |
-
<button type="button" class="btn btn-default" data-dismiss="modal"><?php _e( 'Close', 'grand-media' ); ?></button>
|
95 |
-
</div>
|
96 |
<h4 class="modal-title"></h4>
|
|
|
|
|
|
|
|
|
97 |
</div>
|
98 |
<div class="modal-body"></div>
|
99 |
</div>
|
3 |
* Gmedia Gallery Edit
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
9 |
|
10 |
$term_id = (int) $gmCore->_get( 'preset', 0 );
|
11 |
$preset_module = $gmCore->_get( 'preset_module' );
|
12 |
+
$gmedia_url = add_query_arg( array( 'preset_module' => $preset_module, 'preset' => $term_id ), $gmProcessor->url );
|
13 |
$gmedia_term_taxonomy = 'gmedia_module';
|
14 |
$taxterm = str_replace( 'gmedia_', '', $gmedia_term_taxonomy );
|
15 |
|
26 |
|
27 |
$default_module_demo_query_args = get_user_option( 'gmedia_preset_demo_query_args' );
|
28 |
$gmedia_filter = gmedia_gallery_query_data( $default_module_demo_query_args );
|
29 |
+
$default_options = array();
|
30 |
|
31 |
if ( isset( $gmedia_modules['in'][ $term->module['name'] ] ) ) {
|
32 |
|
44 |
include $module_path . '/settings.php';
|
45 |
|
46 |
} else {
|
47 |
+
// translators: module name.
|
48 |
+
$alert[] = sprintf( esc_html__( 'Module `%s` is broken. Choose another module from the list.' ), esc_html( $module_name ) );
|
49 |
}
|
50 |
} else {
|
51 |
+
// translators: module name.
|
52 |
+
$alert[] = sprintf( esc_html__( 'Can\'t get module with name `%s`. Choose module from the list.' ), esc_html( $term->module['name'] ) );
|
53 |
}
|
54 |
|
55 |
if ( ! empty( $alert ) ) {
|
56 |
+
echo wp_kses_post( $gmCore->alert( 'danger', $alert ) );
|
57 |
}
|
58 |
|
59 |
if ( ! empty( $term->module['settings'] ) ) {
|
62 |
$gallery_settings = $default_options;
|
63 |
}
|
64 |
|
65 |
+
$params = array();
|
66 |
+
$gallery_link_default = add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'module_preview', 'module' => $term->module['name'], 'preset' => $term->term_id, 'query' => $gmedia_filter['query_args'] ), admin_url( 'admin.php' ) );
|
67 |
|
68 |
/** @noinspection PhpIncludeInspection */
|
69 |
+
require_once GMEDIA_ABSPATH . 'inc/module.options.php';
|
70 |
|
71 |
do_action( 'gmedia_module_preset_before_panel' );
|
72 |
?>
|
73 |
|
74 |
+
<div class="card m-0 mw-100 p-0 panel-fixed-header">
|
75 |
|
76 |
<?php
|
77 |
+
require dirname( __FILE__ ) . '/tpl/module-preset-panel-heading.php';
|
78 |
|
79 |
+
require dirname( __FILE__ ) . '/tpl/module-preset-edit-item.php';
|
80 |
?>
|
81 |
|
82 |
</div>
|
88 |
<div class="modal-dialog">
|
89 |
<div class="modal-content">
|
90 |
<div class="modal-header">
|
|
|
|
|
|
|
|
|
91 |
<h4 class="modal-title"></h4>
|
92 |
+
<div class="btn-toolbar gap-4 float-end" style="margin-top:-4px;">
|
93 |
+
<button type="button" class="btn btn-primary"><?php esc_html_e( 'Submit', 'grand-media' ); ?></button>
|
94 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
95 |
+
</div>
|
96 |
</div>
|
97 |
<div class="modal-body"></div>
|
98 |
</div>
|
admin/pages/modules/functions.php
CHANGED
@@ -3,49 +3,54 @@
|
|
3 |
* Modules functions
|
4 |
*/
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
function gmedia_module_action_buttons( $module ) {
|
7 |
global $gmCore, $gmProcessor, $gmGallery;
|
8 |
|
9 |
-
$buttons =
|
10 |
if ( ( 'remote' === $module['place'] ) && ! empty( $module['buy'] ) ) {
|
11 |
//$sale = !empty($module['sale'])? 'onsale' : '';
|
12 |
-
$buttons['buy'] = '<a class="btn btn-primary" href="' . $module['buy'] . '" target="_blank">' .
|
13 |
}
|
14 |
|
15 |
if ( ( ! empty( $module['status'] ) && 'premium' === $module['status'] ) && empty( $module['buy'] ) && empty( $gmGallery->options['license_name'] ) ) {
|
16 |
-
$buttons['premium'] = '<a class="btn btn-success" style="font-weight: bold;" target="_blank" href="https://codeasily.com/gmedia-premium/">' .
|
17 |
} else {
|
18 |
if ( 'remote' === $module['place'] && ! empty( $module['download'] ) ) {
|
19 |
if ( ( ! empty( $module['status'] ) && 'premium' === $module['status'] ) && empty( $gmGallery->options['license_name'] ) ) {
|
20 |
-
$buttons['premium'] = '<a class="btn btn-success" style="font-weight: bold;" target="_blank" href="https://codeasily.com/gmedia-premium/">' .
|
21 |
} else {
|
22 |
-
$buttons['install'] = '<a class="btn btn-primary ' . ( gm_user_can( 'module_manage' ) ? 'module_install' : 'disabled' ) . '" data-module="' . $module['name'] . '" data-loading-text="' .
|
23 |
}
|
24 |
} elseif ( 'remote' !== $module['place'] ) {
|
25 |
-
$buttons['create'] = '<a class="btn btn-success" href="' . $gmCore->get_admin_url(
|
26 |
}
|
27 |
}
|
28 |
|
29 |
-
if ( ! empty( $module['demo'] ) && $module['demo']
|
30 |
-
$buttons['demo'] = '<a class="btn btn-
|
31 |
}
|
32 |
if ( ! empty( $module['update'] ) && 'remote' !== $module['place'] ) {
|
33 |
if ( empty( $module['buy'] ) ) {
|
34 |
if ( 'free' === $module['status'] || ! empty( $gmGallery->options['license_name'] ) ) {
|
35 |
-
$buttons['update'] = '<a class="btn btn-warning module_install" data-module="' . $module['name'] . '" data-loading-text="' .
|
36 |
}
|
37 |
} else {
|
38 |
if ( ! empty( $module['download'] ) && ! empty( $gmGallery->options['license_name'] ) ) {
|
39 |
-
$buttons['update'] = '<a class="btn btn-warning module_install" data-module="' . $module['name'] . '" data-loading-text="' .
|
40 |
}
|
41 |
-
$buttons['update2'] = '<a class="btn btn-warning" target="_blank" href="' . esc_url( $module['buy'] ) . '">' . __( 'Download Update (no license required)', 'grand-media' ) . " (v{$module['update']})</a>
|
42 |
}
|
43 |
}
|
44 |
if ( ( 'remote' !== $module['place'] ) && ( 'amron' !== $module['name'] ) && gm_user_can( 'module_manage' ) ) {
|
45 |
-
$buttons['delete'] = '<a class="btn btn-danger" href="' . wp_nonce_url( $gmCore->get_admin_url(
|
46 |
}
|
47 |
if ( ! empty( $module['download'] ) && ( 'free' === $module['status'] || ! empty( $gmGallery->options['license_name'] ) ) ) {
|
48 |
-
$buttons['download'] = '<a class="btn btn-link" href="' . $module['download'] . '" download="' . $module['name'] . '">' .
|
49 |
}
|
50 |
|
51 |
return $buttons;
|
@@ -54,7 +59,6 @@ function gmedia_module_action_buttons( $module ) {
|
|
54 |
function gmedia_module_preset_more_data( &$item ) {
|
55 |
global $gmCore, $user_ID;
|
56 |
|
57 |
-
|
58 |
if ( ! $item || is_wp_error( $item ) ) {
|
59 |
$item = new stdClass();
|
60 |
gmedia_module_preset_more_data( $item );
|
@@ -66,11 +70,12 @@ function gmedia_module_preset_more_data( &$item ) {
|
|
66 |
$item->term_id = 0;
|
67 |
$item->name = '';
|
68 |
$item->taxonomy = 'gmedia_module';
|
69 |
-
$item->description =
|
70 |
$item->global = $user_ID;
|
71 |
$item->status = $gmCore->_get( 'preset_module', 'amron' );
|
72 |
} else {
|
73 |
-
|
|
|
74 |
$item = new stdClass();
|
75 |
gmedia_module_preset_more_data( $item );
|
76 |
|
@@ -82,7 +87,7 @@ function gmedia_module_preset_more_data( &$item ) {
|
|
82 |
|
83 |
$item->module = $gmCore->get_module_path( $item->status );
|
84 |
|
85 |
-
$module_info =
|
86 |
if ( is_file( $item->module['path'] . '/index.php' ) ) {
|
87 |
include $item->module['path'] . '/index.php';
|
88 |
|
3 |
* Modules functions
|
4 |
*/
|
5 |
|
6 |
+
/**
|
7 |
+
* @param array $module
|
8 |
+
*
|
9 |
+
* @return array
|
10 |
+
*/
|
11 |
function gmedia_module_action_buttons( $module ) {
|
12 |
global $gmCore, $gmProcessor, $gmGallery;
|
13 |
|
14 |
+
$buttons = array();
|
15 |
if ( ( 'remote' === $module['place'] ) && ! empty( $module['buy'] ) ) {
|
16 |
//$sale = !empty($module['sale'])? 'onsale' : '';
|
17 |
+
$buttons['buy'] = '<a class="btn btn-primary" href="' . esc_url( $module['buy'] ) . '" target="_blank">' . esc_html__( 'Buy Now (no license required)', 'grand-media' ) . ' <span>' . esc_html( $module['price'] ) . '</span></a>';
|
18 |
}
|
19 |
|
20 |
if ( ( ! empty( $module['status'] ) && 'premium' === $module['status'] ) && empty( $module['buy'] ) && empty( $gmGallery->options['license_name'] ) ) {
|
21 |
+
$buttons['premium'] = '<a class="btn btn-success" style="font-weight: bold;" target="_blank" href="https://codeasily.com/gmedia-premium/">' . esc_html__( 'Get Premium', 'grand-media' ) . '</a>';
|
22 |
} else {
|
23 |
if ( 'remote' === $module['place'] && ! empty( $module['download'] ) ) {
|
24 |
if ( ( ! empty( $module['status'] ) && 'premium' === $module['status'] ) && empty( $gmGallery->options['license_name'] ) ) {
|
25 |
+
$buttons['premium'] = '<a class="btn btn-success" style="font-weight: bold;" target="_blank" href="https://codeasily.com/gmedia-premium/">' . esc_html__( 'Get Premium', 'grand-media' ) . '</a>';
|
26 |
} else {
|
27 |
+
$buttons['install'] = '<a class="btn btn-primary ' . ( gm_user_can( 'module_manage' ) ? 'module_install' : 'disabled' ) . '" data-module="' . esc_attr( $module['name'] ) . '" data-loading-text="' . esc_attr__( 'Loading...', 'grand-media' ) . '" href="' . esc_url( $module['download'] ) . '">' . esc_html__( 'Install Module', 'grand-media' ) . '</a>';
|
28 |
}
|
29 |
} elseif ( 'remote' !== $module['place'] ) {
|
30 |
+
$buttons['create'] = '<a class="btn btn-success" href="' . esc_url( $gmCore->get_admin_url( array( 'page' => 'GrandMedia_Galleries', 'gallery_module' => $module['name'] ), array(), true ) ) . '">' . esc_html__( 'Create Gallery', 'grand-media' ) . '</a>';
|
31 |
}
|
32 |
}
|
33 |
|
34 |
+
if ( ! empty( $module['demo'] ) && '#' !== $module['demo'] ) {
|
35 |
+
$buttons['demo'] = '<a class="btn btn-secondary" target="_blank" href="' . esc_url( $module['demo'] ) . '">' . esc_html__( 'View Demo', 'grand-media' ) . '</a>';
|
36 |
}
|
37 |
if ( ! empty( $module['update'] ) && 'remote' !== $module['place'] ) {
|
38 |
if ( empty( $module['buy'] ) ) {
|
39 |
if ( 'free' === $module['status'] || ! empty( $gmGallery->options['license_name'] ) ) {
|
40 |
+
$buttons['update'] = '<a class="btn btn-warning module_install" data-module="' . esc_attr( $module['name'] ) . '" data-loading-text="' . esc_attr__( 'Loading...', 'grand-media' ) . '" href="' . esc_url( $module['download'] ) . '">' . esc_html( __( 'Update Module', 'grand-media' ) . " (v{$module['update']})" ) . '</a>';
|
41 |
}
|
42 |
} else {
|
43 |
if ( ! empty( $module['download'] ) && ! empty( $gmGallery->options['license_name'] ) ) {
|
44 |
+
$buttons['update'] = '<a class="btn btn-warning module_install" data-module="' . esc_attr( $module['name'] ) . '" data-loading-text="' . esc_attr__( 'Loading...', 'grand-media' ) . '" href="' . esc_url( $module['download'] ) . '">' . esc_html( __( 'Update Module (license required)', 'grand-media' ) . " (v{$module['update']})" ) . '</a>';
|
45 |
}
|
46 |
+
$buttons['update2'] = '<a class="btn btn-warning" target="_blank" href="' . esc_url( $module['buy'] ) . '">' . esc_html( __( 'Download Update (no license required)', 'grand-media' ) . " (v{$module['update']})" ) . '</a>';
|
47 |
}
|
48 |
}
|
49 |
if ( ( 'remote' !== $module['place'] ) && ( 'amron' !== $module['name'] ) && gm_user_can( 'module_manage' ) ) {
|
50 |
+
$buttons['delete'] = '<a class="btn btn-danger" href="' . wp_nonce_url( $gmCore->get_admin_url( array( 'delete_module' => $module['name'] ), array(), $gmProcessor->url ), 'gmedia_module_delete', '_wpnonce_module_delete' ) . '">' . esc_html__( 'Delete Module', 'grand-media' ) . '</a>';
|
51 |
}
|
52 |
if ( ! empty( $module['download'] ) && ( 'free' === $module['status'] || ! empty( $gmGallery->options['license_name'] ) ) ) {
|
53 |
+
$buttons['download'] = '<a class="btn btn-link" href="' . esc_url( $module['download'] ) . '" download="' . esc_attr( $module['name'] ) . '">' . esc_html__( 'Download module ZIP', 'grand-media' ) . '</a>';
|
54 |
}
|
55 |
|
56 |
return $buttons;
|
59 |
function gmedia_module_preset_more_data( &$item ) {
|
60 |
global $gmCore, $user_ID;
|
61 |
|
|
|
62 |
if ( ! $item || is_wp_error( $item ) ) {
|
63 |
$item = new stdClass();
|
64 |
gmedia_module_preset_more_data( $item );
|
70 |
$item->term_id = 0;
|
71 |
$item->name = '';
|
72 |
$item->taxonomy = 'gmedia_module';
|
73 |
+
$item->description = array();
|
74 |
$item->global = $user_ID;
|
75 |
$item->status = $gmCore->_get( 'preset_module', 'amron' );
|
76 |
} else {
|
77 |
+
$preset_module = $gmCore->_get( 'preset_module' );
|
78 |
+
if ( $preset_module && $item->status !== $preset_module ) {
|
79 |
$item = new stdClass();
|
80 |
gmedia_module_preset_more_data( $item );
|
81 |
|
87 |
|
88 |
$item->module = $gmCore->get_module_path( $item->status );
|
89 |
|
90 |
+
$module_info = array( 'type' => '—' );
|
91 |
if ( is_file( $item->module['path'] . '/index.php' ) ) {
|
92 |
include $item->module['path'] . '/index.php';
|
93 |
|
admin/pages/modules/modules.php
CHANGED
@@ -3,16 +3,13 @@
|
|
3 |
* Gmedia Modules
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
global $gmCore, $gmProcessor, $gmGallery, $gmDB;
|
12 |
|
13 |
$gmedia_url = $gmProcessor->url;
|
14 |
$modules = $gmProcessor->modules;
|
15 |
-
$tags =
|
16 |
if ( ! empty( $modules['xml'] ) ) {
|
17 |
foreach ( $modules['xml'] as $module ) {
|
18 |
$tags = array_merge( $tags, $module['tags'] );
|
@@ -25,27 +22,29 @@ if ( ! empty( $tags ) ) {
|
|
25 |
//echo '<pre style="max-height: 500px; overflow:auto;">' . print_r($modules, true) . '</pre>';
|
26 |
|
27 |
if ( isset( $modules['error'] ) ) {
|
28 |
-
echo $gmCore->alert( 'danger', $modules['error'] );
|
29 |
}
|
30 |
|
31 |
?>
|
32 |
<div id="gmedia_modules">
|
33 |
<div id="gmedia_modules_wrapper" data-update="<?php echo esc_attr( $gmGallery->options['modules_update'] ); ?>">
|
34 |
-
<div class="
|
35 |
-
<div class="
|
36 |
<div class="clearfix">
|
37 |
-
<a href="#installModuleModal" class="btn btn-primary
|
38 |
|
39 |
-
<div class="btn-group
|
40 |
-
<button type="button" data-filter="collection" class="btn btn-primary"><?php
|
41 |
-
|
42 |
-
<button type="button" data-filter="
|
|
|
|
|
43 |
</div>
|
44 |
|
45 |
<?php if ( ! empty( $tags ) ) { ?>
|
46 |
-
<div class="btn-group
|
47 |
-
<button type="button" class="btn btn-
|
48 |
-
Feature Filters
|
49 |
</button>
|
50 |
</div>
|
51 |
<?php } ?>
|
@@ -53,15 +52,15 @@ if ( isset( $modules['error'] ) ) {
|
|
53 |
<?php if ( ! empty( $tags ) ) { ?>
|
54 |
<div class="collapse" id="collapseFeatures">
|
55 |
<div class="filter-modules" style="padding-top: 10px;">
|
56 |
-
<?php foreach ( $tags as $
|
57 |
-
<span style="cursor: pointer;" data-filter="tag-<?php echo sanitize_key( $
|
58 |
<?php } ?>
|
59 |
</div>
|
60 |
</div>
|
61 |
<?php } ?>
|
62 |
</div>
|
63 |
-
<div class="
|
64 |
-
<div class="
|
65 |
<?php
|
66 |
// installed modules.
|
67 |
if ( ! empty( $modules['in'] ) ) {
|
@@ -71,16 +70,17 @@ if ( isset( $modules['error'] ) ) {
|
|
71 |
if ( $module['update'] ) {
|
72 |
$module['mclass'] .= ' module-update';
|
73 |
}
|
74 |
-
foreach ( $module['tags'] as $
|
75 |
-
$module['mclass'] .= ' module-tag-' . sanitize_key( $
|
76 |
}
|
77 |
|
78 |
-
include
|
79 |
|
80 |
}
|
81 |
}
|
82 |
|
83 |
-
if ( ! empty( $modules['out'] ) ) {
|
|
|
84 |
<?php
|
85 |
//$out_dirpath = dirname($gmGallery->options['modules_xml']);
|
86 |
$out_dirpath = 'https://codeasily.com/gmedia_modules';
|
@@ -89,8 +89,8 @@ if ( isset( $modules['error'] ) ) {
|
|
89 |
if ( $module['update'] ) {
|
90 |
$module['mclass'] .= ' module-update';
|
91 |
}
|
92 |
-
foreach ( $module['tags'] as $
|
93 |
-
$module['mclass'] .= ' module-tag-' . sanitize_key( $
|
94 |
}
|
95 |
$module['screenshot_url'] = $out_dirpath . '/' . $module['name'] . '.png';
|
96 |
|
@@ -101,10 +101,10 @@ if ( isset( $modules['error'] ) ) {
|
|
101 |
wp_nonce_field( 'GmediaGallery' );
|
102 |
?>
|
103 |
<div class="media nomodules nomodule-not-installed">
|
104 |
-
<h4 class="media-heading"><?php
|
105 |
</div>
|
106 |
<div class="media nomodules nomodule-tag">
|
107 |
-
<h4 class="media-heading"><?php
|
108 |
</div>
|
109 |
</div>
|
110 |
</div>
|
3 |
* Gmedia Modules
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
global $gmCore, $gmProcessor, $gmGallery, $gmDB;
|
9 |
|
10 |
$gmedia_url = $gmProcessor->url;
|
11 |
$modules = $gmProcessor->modules;
|
12 |
+
$tags = array();
|
13 |
if ( ! empty( $modules['xml'] ) ) {
|
14 |
foreach ( $modules['xml'] as $module ) {
|
15 |
$tags = array_merge( $tags, $module['tags'] );
|
22 |
//echo '<pre style="max-height: 500px; overflow:auto;">' . print_r($modules, true) . '</pre>';
|
23 |
|
24 |
if ( isset( $modules['error'] ) ) {
|
25 |
+
echo wp_kses_post( $gmCore->alert( 'danger', $modules['error'] ) );
|
26 |
}
|
27 |
|
28 |
?>
|
29 |
<div id="gmedia_modules">
|
30 |
<div id="gmedia_modules_wrapper" data-update="<?php echo esc_attr( $gmGallery->options['modules_update'] ); ?>">
|
31 |
+
<div class="card m-0 mw-100 p-0">
|
32 |
+
<div class="card-header bg-light clearfix">
|
33 |
<div class="clearfix">
|
34 |
+
<a href="#installModuleModal" class="btn btn-primary float-end<?php echo current_user_can( 'manage_options' ) ? '' : ' disabled'; ?>" data-bs-toggle="modal"><?php esc_html_e( 'Install Module ZIP' ); ?></a>
|
35 |
|
36 |
+
<div class="btn-group float-start filter-modules" style="margin-right: 10px;">
|
37 |
+
<button type="button" data-filter="collection" class="btn btn-primary"><?php esc_html_e( 'All Modules', 'grand-media' ); ?>
|
38 |
+
<span class="badge badge-error gm-module-count-<?php echo intval( $gmGallery->options['modules_update'] ); ?>" title="<?php esc_attr_e( 'Modules Updates', 'grand-media' ); ?>"><?php echo intval( $gmGallery->options['modules_update'] ); ?></span></button>
|
39 |
+
<button type="button" data-filter="not-installed" class="btn btn-secondary"><?php esc_html_e( 'New Modules', 'grand-media' ); ?>
|
40 |
+
<span class="badge badge-success gm-module-count-<?php echo intval( $gmGallery->options['modules_new'] ); ?>" title="<?php esc_attr_e( 'New Modules', 'grand-media' ); ?>"><?php echo intval( $gmGallery->options['modules_new'] ); ?></span></button>
|
41 |
+
<button type="button" data-filter="tag-trend" class="btn btn-secondary"><?php esc_html_e( 'Trends', 'grand-media' ); ?></button>
|
42 |
</div>
|
43 |
|
44 |
<?php if ( ! empty( $tags ) ) { ?>
|
45 |
+
<div class="btn-group float-start">
|
46 |
+
<button type="button" class="btn btn-secondary dropdown-toggle" onclick="jQuery(this).toggleClass('active');" data-bs-toggle="collapse" data-bs-target="#collapseFeatures" aria-expanded="false" aria-controls="collapseFeatures">
|
47 |
+
Feature Filters
|
48 |
</button>
|
49 |
</div>
|
50 |
<?php } ?>
|
52 |
<?php if ( ! empty( $tags ) ) { ?>
|
53 |
<div class="collapse" id="collapseFeatures">
|
54 |
<div class="filter-modules" style="padding-top: 10px;">
|
55 |
+
<?php foreach ( $tags as $_tag ) { ?>
|
56 |
+
<span style="cursor: pointer;" data-filter="tag-<?php echo sanitize_key( $_tag ); ?>" class="badge bg-secondary"><?php echo esc_html( strtoupper( $_tag ) ); ?></span>
|
57 |
<?php } ?>
|
58 |
</div>
|
59 |
</div>
|
60 |
<?php } ?>
|
61 |
</div>
|
62 |
+
<div class="card-body" id="gmedia-msg-panel"></div>
|
63 |
+
<div class="card-body modules-body">
|
64 |
<?php
|
65 |
// installed modules.
|
66 |
if ( ! empty( $modules['in'] ) ) {
|
70 |
if ( $module['update'] ) {
|
71 |
$module['mclass'] .= ' module-update';
|
72 |
}
|
73 |
+
foreach ( $module['tags'] as $_tag ) {
|
74 |
+
$module['mclass'] .= ' module-tag-' . sanitize_key( $_tag );
|
75 |
}
|
76 |
|
77 |
+
include dirname( __FILE__ ) . '/tpl/module-item.php';
|
78 |
|
79 |
}
|
80 |
}
|
81 |
|
82 |
+
if ( ! empty( $modules['out'] ) ) {
|
83 |
+
?>
|
84 |
<?php
|
85 |
//$out_dirpath = dirname($gmGallery->options['modules_xml']);
|
86 |
$out_dirpath = 'https://codeasily.com/gmedia_modules';
|
89 |
if ( $module['update'] ) {
|
90 |
$module['mclass'] .= ' module-update';
|
91 |
}
|
92 |
+
foreach ( $module['tags'] as $_tag ) {
|
93 |
+
$module['mclass'] .= ' module-tag-' . sanitize_key( $_tag );
|
94 |
}
|
95 |
$module['screenshot_url'] = $out_dirpath . '/' . $module['name'] . '.png';
|
96 |
|
101 |
wp_nonce_field( 'GmediaGallery' );
|
102 |
?>
|
103 |
<div class="media nomodules nomodule-not-installed">
|
104 |
+
<h4 class="media-heading"><?php esc_html_e( 'No modules to show', 'grand-media' ); ?></h4>
|
105 |
</div>
|
106 |
<div class="media nomodules nomodule-tag">
|
107 |
+
<h4 class="media-heading"><?php esc_html_e( 'No modules to show', 'grand-media' ); ?></h4>
|
108 |
</div>
|
109 |
</div>
|
110 |
</div>
|
admin/pages/modules/tpl/modal-modulezip.php
CHANGED
@@ -1,29 +1,28 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Modal to install Module ZIP
|
|
|
|
|
9 |
*/
|
10 |
?>
|
11 |
<div class="modal fade gmedia-modal" id="installModuleModal" tabindex="-1" role="dialog" aria-hidden="true">
|
12 |
<div class="modal-dialog">
|
13 |
<form class="modal-content" method="post" enctype="multipart/form-data" action="<?php echo esc_url( $gmedia_url ); ?>">
|
14 |
<div class="modal-header">
|
15 |
-
<
|
16 |
-
<
|
17 |
</div>
|
18 |
<div class="modal-body">
|
19 |
-
<p class="install-help"><?php
|
20 |
<?php wp_nonce_field( 'gmedia_module', '_wpnonce_module' ); ?>
|
21 |
-
<label class="screen-reader-text" for="modulezip"><?php
|
22 |
<input type="file" id="modulezip" name="modulezip"/>
|
23 |
</div>
|
24 |
<div class="modal-footer">
|
25 |
-
<button type="button" class="btn btn-
|
26 |
-
<button type="submit" class="btn btn-primary"><?php
|
27 |
</div>
|
28 |
</form>
|
29 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Modal to install Module ZIP
|
6 |
+
*
|
7 |
+
* @var $gmedia_url
|
8 |
*/
|
9 |
?>
|
10 |
<div class="modal fade gmedia-modal" id="installModuleModal" tabindex="-1" role="dialog" aria-hidden="true">
|
11 |
<div class="modal-dialog">
|
12 |
<form class="modal-content" method="post" enctype="multipart/form-data" action="<?php echo esc_url( $gmedia_url ); ?>">
|
13 |
<div class="modal-header">
|
14 |
+
<h4 class="modal-title"><?php esc_html_e( 'Install a module in .zip format' ); ?></h4>
|
15 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
16 |
</div>
|
17 |
<div class="modal-body">
|
18 |
+
<p class="install-help"><?php esc_html_e( 'If you have a module in a .zip format, you may install it by uploading it here.' ); ?></p>
|
19 |
<?php wp_nonce_field( 'gmedia_module', '_wpnonce_module' ); ?>
|
20 |
+
<label class="screen-reader-text" for="modulezip"><?php esc_html_e( 'Module zip file' ); ?></label>
|
21 |
<input type="file" id="modulezip" name="modulezip"/>
|
22 |
</div>
|
23 |
<div class="modal-footer">
|
24 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Cancel', 'grand-media' ); ?></button>
|
25 |
+
<button type="submit" class="btn btn-primary"><?php esc_html_e( 'Install', 'grand-media' ); ?></button>
|
26 |
</div>
|
27 |
</form>
|
28 |
</div>
|
admin/pages/modules/tpl/module-item.php
CHANGED
@@ -1,35 +1,34 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Module List Item
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
-
global $gmGallery, $gmDB, $gmCore, $user_ID;
|
12 |
?>
|
13 |
-
<div class="media<?php echo $module['mclass']; ?>">
|
14 |
<div class="row">
|
15 |
<div class="col-sm-3">
|
16 |
-
<div class="thumbnail">
|
17 |
<img class="media-object" src="<?php echo esc_url( $module['screenshot_url'] ); ?>" alt="<?php echo esc_attr( $module['title'] ); ?>" width="320" height="240"/>
|
18 |
</div>
|
19 |
</div>
|
20 |
-
<div class="<?php echo( ( $module['place']
|
21 |
-
<h4 class="media-heading"><?php echo $module['title']; ?></h4>
|
22 |
|
23 |
-
<p class="version"><?php echo __( 'Version', 'grand-media' ) . ': ' . $module['version']; ?></p>
|
24 |
<?php if ( isset( $module['info'] ) ) { ?>
|
25 |
-
<div class="module_info"><?php echo str_replace( "\n", '<br />', (string) $module['info'] ); ?></div>
|
26 |
<?php } ?>
|
27 |
-
<div class="description"><?php echo str_replace( "\n", '<br />', (string) $module['description'] ); ?></div>
|
28 |
<hr/>
|
29 |
<p class="buttons">
|
30 |
<?php
|
31 |
$buttons = gmedia_module_action_buttons( $module );
|
32 |
-
echo implode( ' ', $buttons );
|
33 |
?>
|
34 |
</p>
|
35 |
</div>
|
@@ -37,23 +36,23 @@ global $gmGallery, $gmDB, $gmCore, $user_ID;
|
|
37 |
if ( 'remote' !== $module['place'] ) {
|
38 |
?>
|
39 |
<div class="col-sm-4">
|
40 |
-
<div id="module_presets_list" class="module_presets module_presets_<?php echo $module['name'] ?>">
|
41 |
<h4 class="media-heading" style="margin-bottom:10px;">
|
42 |
<?php if ( 'free' === $module['status'] || ! empty( $gmGallery->options['license_name'] ) || ! empty( $module['buy'] ) ) { ?>
|
43 |
-
<a href="<?php echo esc_url( $gmCore->get_admin_url(
|
44 |
<?php } else { ?>
|
45 |
-
<a href="https://codeasily.com/gmedia-premium/" title="<?php
|
46 |
<?php } ?>
|
47 |
-
<?php
|
48 |
<?php
|
49 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
50 |
if ( ! empty( $presets ) ) {
|
51 |
?>
|
52 |
<ul class="list-group presetlist">
|
53 |
<?php
|
54 |
-
$li =
|
55 |
foreach ( $presets as $preset ) {
|
56 |
-
$href = $gmCore->get_admin_url(
|
57 |
|
58 |
$count = 1;
|
59 |
$name = trim( str_replace( '[' . $module['name'] . ']', '', $preset->name, $count ) );
|
@@ -61,9 +60,9 @@ global $gmGallery, $gmDB, $gmCore, $user_ID;
|
|
61 |
$global_preset = false;
|
62 |
if ( ! $name ) {
|
63 |
if ( (int) $preset->global ) {
|
64 |
-
$name =
|
65 |
} else {
|
66 |
-
$name =
|
67 |
$global_preset = true;
|
68 |
}
|
69 |
}
|
@@ -71,13 +70,13 @@ global $gmGallery, $gmDB, $gmCore, $user_ID;
|
|
71 |
$by = ' <small style="white-space:nowrap">[' . esc_html( get_the_author_meta( 'display_name', $preset->global ) ) . ']</small>';
|
72 |
}
|
73 |
$li_item = '
|
74 |
-
<li class="list-group-item" id="gm-preset-' . $preset->term_id . '">
|
75 |
-
<span class="gm-preset-id">ID: ' . $preset->term_id . '</span>';
|
76 |
if ( $user_ID === $preset->global || $gmCore->caps['gmedia_edit_others_media'] ) {
|
77 |
-
$li_item .= '<span class="delpreset"><span class="
|
78 |
}
|
79 |
$li_item .= '
|
80 |
-
<a href="' . $href . '">' .
|
81 |
</li>';
|
82 |
if ( $global_preset ) {
|
83 |
if ( current_user_can( 'manage_options' ) ) {
|
@@ -87,7 +86,7 @@ global $gmGallery, $gmDB, $gmCore, $user_ID;
|
|
87 |
$li[] = $li_item;
|
88 |
}
|
89 |
}
|
90 |
-
echo implode( '', $li );
|
91 |
?>
|
92 |
</ul>
|
93 |
<?php } ?>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Module List Item
|
6 |
+
*
|
7 |
+
* @var $module
|
8 |
*/
|
9 |
|
10 |
+
global $gmGallery, $gmDB, $gmCore, $user_ID, $gm_allowed_tags;
|
11 |
?>
|
12 |
+
<div class="media<?php echo esc_attr( $module['mclass'] ); ?>">
|
13 |
<div class="row">
|
14 |
<div class="col-sm-3">
|
15 |
+
<div class="img-thumbnail">
|
16 |
<img class="media-object" src="<?php echo esc_url( $module['screenshot_url'] ); ?>" alt="<?php echo esc_attr( $module['title'] ); ?>" width="320" height="240"/>
|
17 |
</div>
|
18 |
</div>
|
19 |
+
<div class="<?php echo( ( 'remote' === $module['place'] ) ? 'col-sm-9' : 'col-sm-5' ); ?>">
|
20 |
+
<h4 class="media-heading"><?php echo esc_html( $module['title'] ); ?></h4>
|
21 |
|
22 |
+
<p class="version"><?php echo esc_html( __( 'Version', 'grand-media' ) . ': ' . $module['version'] ); ?></p>
|
23 |
<?php if ( isset( $module['info'] ) ) { ?>
|
24 |
+
<div class="module_info"><?php echo wp_kses_post( str_replace( "\n", '<br />', (string) $module['info'] ) ); ?></div>
|
25 |
<?php } ?>
|
26 |
+
<div class="description"><?php echo wp_kses_post( str_replace( "\n", '<br />', (string) $module['description'] ) ); ?></div>
|
27 |
<hr/>
|
28 |
<p class="buttons">
|
29 |
<?php
|
30 |
$buttons = gmedia_module_action_buttons( $module );
|
31 |
+
echo wp_kses( implode( ' ', $buttons ), $gm_allowed_tags );
|
32 |
?>
|
33 |
</p>
|
34 |
</div>
|
36 |
if ( 'remote' !== $module['place'] ) {
|
37 |
?>
|
38 |
<div class="col-sm-4">
|
39 |
+
<div id="module_presets_list" class="module_presets module_presets_<?php echo esc_attr( $module['name'] ); ?>">
|
40 |
<h4 class="media-heading" style="margin-bottom:10px;">
|
41 |
<?php if ( 'free' === $module['status'] || ! empty( $gmGallery->options['license_name'] ) || ! empty( $module['buy'] ) ) { ?>
|
42 |
+
<a href="<?php echo esc_url( $gmCore->get_admin_url( array( 'page' => 'GrandMedia_Modules', 'preset_module' => $module['name'] ), array(), admin_url( 'admin.php' ) ) ); ?>" class="addpreset float-end"><span class="badge-success rounded-1">+</span></a>
|
43 |
<?php } else { ?>
|
44 |
+
<a href="https://codeasily.com/gmedia-premium/" title="<?php esc_attr_e( 'Get Premium', 'grand-media' ); ?>" class="addpreset float-end"><span class="badge-success rounded-1">+</span></a>
|
45 |
<?php } ?>
|
46 |
+
<?php esc_html_e( 'Presets', 'grand-media' ); ?></h4>
|
47 |
<?php
|
48 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $module['name'] ) );
|
49 |
if ( ! empty( $presets ) ) {
|
50 |
?>
|
51 |
<ul class="list-group presetlist">
|
52 |
<?php
|
53 |
+
$li = array();
|
54 |
foreach ( $presets as $preset ) {
|
55 |
+
$href = $gmCore->get_admin_url( array( 'page' => 'GrandMedia_Modules', 'preset' => $preset->term_id ), array(), admin_url( 'admin.php' ) );
|
56 |
|
57 |
$count = 1;
|
58 |
$name = trim( str_replace( '[' . $module['name'] . ']', '', $preset->name, $count ) );
|
60 |
$global_preset = false;
|
61 |
if ( ! $name ) {
|
62 |
if ( (int) $preset->global ) {
|
63 |
+
$name = esc_html__( 'Default Settings', 'grand-media' );
|
64 |
} else {
|
65 |
+
$name = esc_html__( 'Global Settings', 'grand-media' );
|
66 |
$global_preset = true;
|
67 |
}
|
68 |
}
|
70 |
$by = ' <small style="white-space:nowrap">[' . esc_html( get_the_author_meta( 'display_name', $preset->global ) ) . ']</small>';
|
71 |
}
|
72 |
$li_item = '
|
73 |
+
<li class="list-group-item" id="gm-preset-' . esc_attr( $preset->term_id ) . '">
|
74 |
+
<span class="gm-preset-id">ID: ' . esc_html( $preset->term_id ) . '</span>';
|
75 |
if ( $user_ID === $preset->global || $gmCore->caps['gmedia_edit_others_media'] ) {
|
76 |
+
$li_item .= '<span class="delpreset"><span class="badge-error rounded-1" data-id="' . esc_attr( $preset->term_id ) . '">×</span></span>';
|
77 |
}
|
78 |
$li_item .= '
|
79 |
+
<a href="' . esc_url( $href ) . '">' . $name . $by . '</a>
|
80 |
</li>';
|
81 |
if ( $global_preset ) {
|
82 |
if ( current_user_can( 'manage_options' ) ) {
|
86 |
$li[] = $li_item;
|
87 |
}
|
88 |
}
|
89 |
+
echo wp_kses_post( implode( '', $li ) );
|
90 |
?>
|
91 |
</ul>
|
92 |
<?php } ?>
|
admin/pages/modules/tpl/module-preset-edit-item.php
CHANGED
@@ -1,58 +1,68 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Edit Gallery Form
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
global $user_ID;
|
11 |
?>
|
12 |
|
13 |
<form method="post" id="gmedia-edit-term" name="gmEditTerm" data-id="<?php echo absint( $term_id ); ?>" action="<?php echo esc_url( $gmedia_url ); ?>">
|
14 |
-
<div class="
|
15 |
<h4 style="margin-top:0;">
|
16 |
-
<?php
|
|
|
17 |
$is_preset = 'edit';
|
18 |
?>
|
19 |
-
<span class="
|
20 |
-
<?php
|
21 |
-
|
|
|
|
|
|
|
22 |
$is_preset = 'new';
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
</h4>
|
26 |
-
<div class="row">
|
27 |
<div class="col-sm-5">
|
28 |
<div class="form-group">
|
29 |
-
<label><?php
|
30 |
-
<?php
|
|
|
31 |
if ( (int) $term->global ) {
|
32 |
$is_preset = 'default';
|
33 |
} else {
|
34 |
$is_preset = 'global';
|
35 |
}
|
36 |
?>
|
37 |
-
<input type="text" class="form-control input-sm" name="term[name]" value="<?php
|
38 |
<input type="hidden" name="module_preset_save_default" value="1"/>
|
39 |
<?php } else { ?>
|
40 |
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr( $term->name ); ?>" placeholder="<?php echo esc_attr( $term->name ? $term->name : __( 'Preset Name', 'grand-media' ) ); ?>"/>
|
41 |
<?php } ?>
|
42 |
</div>
|
43 |
<div class="form-group">
|
44 |
-
<label><?php
|
45 |
<?php
|
46 |
-
if (
|
47 |
echo '<input type="hidden" name="term[global]" value="0"/>';
|
48 |
-
echo '<div>' .
|
49 |
} else {
|
50 |
-
$_args =
|
51 |
if ( ! (int) $term->global ) {
|
52 |
$_args['selected'] = $user_ID;
|
53 |
}
|
54 |
gmedia_term_choose_author_field( $term->global, $_args );
|
55 |
-
}
|
|
|
56 |
</div>
|
57 |
<input type="hidden" name="term[term_id]" value="<?php echo absint( $term_id ); ?>"/>
|
58 |
<input type="hidden" name="term[module]" value="<?php echo esc_attr( $term->module['name'] ); ?>"/>
|
@@ -61,38 +71,38 @@ global $user_ID;
|
|
61 |
wp_nonce_field( 'GmediaGallery' );
|
62 |
wp_referer_field();
|
63 |
?>
|
64 |
-
<div class="
|
65 |
-
<?php if (
|
66 |
-
<button type="submit" name="module_preset_save_global" class="btn btn-
|
67 |
-
<?php if (
|
68 |
-
<button type="submit" name="module_preset_save_default" class="btn btn-
|
69 |
<?php
|
70 |
}
|
71 |
}
|
72 |
$submit_name = 'module_preset_save';
|
73 |
-
if (
|
74 |
$submit_name = 'module_preset_save_default';
|
75 |
}
|
76 |
-
if (
|
77 |
$submit_name = 'module_preset_save_global';
|
78 |
}
|
79 |
?>
|
80 |
-
<button type="submit" name="<?php echo esc_attr( $submit_name ); ?>" class="btn btn-primary btn-sm"><?php
|
81 |
</div>
|
82 |
</div>
|
83 |
|
84 |
-
<div class="col-sm-5
|
85 |
<div class="form-group">
|
86 |
-
<div class="
|
87 |
-
<label><?php
|
88 |
-
<textarea class="form-control input-sm" id="build_query_field" style="height:64px;" rows="2" name="term[query]"><?php echo
|
89 |
</div>
|
90 |
</div>
|
91 |
</div>
|
92 |
|
93 |
<hr/>
|
94 |
<?php
|
95 |
-
|
96 |
?>
|
97 |
|
98 |
</div>
|
@@ -100,5 +110,5 @@ global $user_ID;
|
|
100 |
</form>
|
101 |
|
102 |
<?php
|
103 |
-
|
104 |
?>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Edit Gallery Form
|
6 |
+
*
|
7 |
+
* @var $term_id
|
8 |
+
* @var $gmedia_url
|
9 |
+
* @var $term
|
10 |
+
* @var $gmedia_term_taxonomy
|
11 |
*/
|
12 |
global $user_ID;
|
13 |
?>
|
14 |
|
15 |
<form method="post" id="gmedia-edit-term" name="gmEditTerm" data-id="<?php echo absint( $term_id ); ?>" action="<?php echo esc_url( $gmedia_url ); ?>">
|
16 |
+
<div class="card-body">
|
17 |
<h4 style="margin-top:0;">
|
18 |
+
<?php
|
19 |
+
if ( $term_id ) {
|
20 |
$is_preset = 'edit';
|
21 |
?>
|
22 |
+
<span class="float-end"><?php echo esc_html( __( 'ID', 'grand-media' ) . ": {$term->term_id}" ); ?></span>
|
23 |
+
<?php
|
24 |
+
// translators: preset name.
|
25 |
+
printf( esc_html__( 'Edit %s Preset', 'grand-media' ), esc_html( $term->module['info']['title'] ) );
|
26 |
+
echo ': <em>' . esc_html( $term->name ) . '</em>';
|
27 |
+
} else {
|
28 |
$is_preset = 'new';
|
29 |
+
// translators: preset name.
|
30 |
+
printf( esc_html__( 'New %s Preset', 'grand-media' ), esc_html( $term->module['info']['title'] ) );
|
31 |
+
}
|
32 |
+
?>
|
33 |
</h4>
|
34 |
+
<div class="row justify-content-between">
|
35 |
<div class="col-sm-5">
|
36 |
<div class="form-group">
|
37 |
+
<label><?php esc_html_e( 'Name', 'grand-media' ); ?></label>
|
38 |
+
<?php
|
39 |
+
if ( $term_id && ! $term->name ) {
|
40 |
if ( (int) $term->global ) {
|
41 |
$is_preset = 'default';
|
42 |
} else {
|
43 |
$is_preset = 'global';
|
44 |
}
|
45 |
?>
|
46 |
+
<input type="text" class="form-control input-sm" name="term[name]" value="<?php 'global' === $is_preset ? esc_attr_e( 'Global Settings', 'grand-media' ) : esc_attr_e( 'Default Settings', 'grand-media' ); ?>" readonly/>
|
47 |
<input type="hidden" name="module_preset_save_default" value="1"/>
|
48 |
<?php } else { ?>
|
49 |
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr( $term->name ); ?>" placeholder="<?php echo esc_attr( $term->name ? $term->name : __( 'Preset Name', 'grand-media' ) ); ?>"/>
|
50 |
<?php } ?>
|
51 |
</div>
|
52 |
<div class="form-group">
|
53 |
+
<label><?php esc_html_e( 'Author', 'grand-media' ); ?></label>
|
54 |
<?php
|
55 |
+
if ( 'global' === $is_preset ) {
|
56 |
echo '<input type="hidden" name="term[global]" value="0"/>';
|
57 |
+
echo '<div>' . esc_html__( 'Global Preset', 'grand-media' ) . '</div>';
|
58 |
} else {
|
59 |
+
$_args = array( 'show_option_all' => '' );
|
60 |
if ( ! (int) $term->global ) {
|
61 |
$_args['selected'] = $user_ID;
|
62 |
}
|
63 |
gmedia_term_choose_author_field( $term->global, $_args );
|
64 |
+
}
|
65 |
+
?>
|
66 |
</div>
|
67 |
<input type="hidden" name="term[term_id]" value="<?php echo absint( $term_id ); ?>"/>
|
68 |
<input type="hidden" name="term[module]" value="<?php echo esc_attr( $term->module['name'] ); ?>"/>
|
71 |
wp_nonce_field( 'GmediaGallery' );
|
72 |
wp_referer_field();
|
73 |
?>
|
74 |
+
<div class="float-end" id="save_buttons">
|
75 |
+
<?php if ( 'global' !== $is_preset ) { ?>
|
76 |
+
<button type="submit" name="module_preset_save_global" class="btn btn-secondary btn-sm"><?php esc_html_e( 'Save as Global Preset', 'grand-media' ); ?></button>
|
77 |
+
<?php if ( 'default' !== $is_preset ) { ?>
|
78 |
+
<button type="submit" name="module_preset_save_default" class="btn btn-secondary btn-sm"><?php esc_html_e( 'Save as Default User Preset', 'grand-media' ); ?></button>
|
79 |
<?php
|
80 |
}
|
81 |
}
|
82 |
$submit_name = 'module_preset_save';
|
83 |
+
if ( 'default' === $is_preset ) {
|
84 |
$submit_name = 'module_preset_save_default';
|
85 |
}
|
86 |
+
if ( 'global' === $is_preset ) {
|
87 |
$submit_name = 'module_preset_save_global';
|
88 |
}
|
89 |
?>
|
90 |
+
<button type="submit" name="<?php echo esc_attr( $submit_name ); ?>" class="btn btn-primary btn-sm"><?php esc_html_e( 'Save', 'grand-media' ); ?></button>
|
91 |
</div>
|
92 |
</div>
|
93 |
|
94 |
+
<div class="col-sm-5">
|
95 |
<div class="form-group">
|
96 |
+
<div class="float-end"><a id="build_query" class="btn btn-primary btn-xs buildquery-modal" href="#buildQuery" data-bs-toggle="modal" style="font-size:90%;"><?php esc_html_e( 'Build Query', 'grand-media' ); ?></a></div>
|
97 |
+
<label><?php esc_html_e( 'Query Args. for Preset Demo', 'grand-media' ); ?></label>
|
98 |
+
<textarea class="form-control input-sm" id="build_query_field" style="height:64px;" rows="2" name="term[query]"><?php echo empty( $gmedia_filter['query_args'] ) ? 'limit=20' : esc_html( urldecode( build_query( $gmedia_filter['query_args'] ) ) ); ?></textarea>
|
99 |
</div>
|
100 |
</div>
|
101 |
</div>
|
102 |
|
103 |
<hr/>
|
104 |
<?php
|
105 |
+
require GMEDIA_ABSPATH . 'admin/pages/galleries/tpl/module-settings.php';
|
106 |
?>
|
107 |
|
108 |
</div>
|
110 |
</form>
|
111 |
|
112 |
<?php
|
113 |
+
require GMEDIA_ABSPATH . 'admin/pages/galleries/tpl/modal-build-query.php';
|
114 |
?>
|
admin/pages/modules/tpl/module-preset-panel-heading.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Panel heading for term
|
@@ -12,24 +9,24 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
12 |
* @var $term
|
13 |
*/
|
14 |
?>
|
15 |
-
<div class="
|
16 |
-
<div class="
|
17 |
-
<div class="btn-toolbar
|
18 |
-
<a class="btn btn-
|
19 |
|
20 |
<?php if ( $term_id ) { ?>
|
21 |
<div class="btn-group">
|
22 |
-
<a class="btn btn-
|
23 |
-
<button type="button" class="btn btn-
|
24 |
-
<span class="
|
25 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
26 |
</button>
|
27 |
<ul class="dropdown-menu" role="menu">
|
28 |
-
<li><a href="<?php echo esc_url( add_query_arg(
|
29 |
</ul>
|
30 |
</div>
|
31 |
|
32 |
-
|
|
|
33 |
<?php } ?>
|
34 |
</div>
|
35 |
<div class="spinner"></div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Panel heading for term
|
9 |
* @var $term
|
10 |
*/
|
11 |
?>
|
12 |
+
<div class="card-header-fake"></div>
|
13 |
+
<div class="card-header bg-light clearfix">
|
14 |
+
<div class="btn-toolbar gap-4 float-start">
|
15 |
+
<a class="btn btn-secondary float-start" style="margin-right:20px;" href="<?php echo esc_url( remove_query_arg( array( 'preset_module', 'preset' ), wp_get_referer() ) ); ?>"><?php esc_html_e( 'Go Back', 'grand-media' ); ?></a>
|
16 |
|
17 |
<?php if ( $term_id ) { ?>
|
18 |
<div class="btn-group">
|
19 |
+
<a class="btn btn-secondary" href="#"><?php esc_html_e( 'Action', 'grand-media' ); ?></a>
|
20 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
21 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
22 |
</button>
|
23 |
<ul class="dropdown-menu" role="menu">
|
24 |
+
<li><a class="dropdown-item" href="<?php echo esc_url( add_query_arg( array( 'page' => 'GrandMedia_Galleries', 'gallery_module' => $term->module['name'], 'preset' => $term->term_id ), admin_url( 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Create Gallery with this preset', 'grand-media' ); ?></a></li>
|
25 |
</ul>
|
26 |
</div>
|
27 |
|
28 |
+
<?php // translators: preset name. ?>
|
29 |
+
<a class="btn btn-info float-start" style="margin-left:20px;" href="<?php echo esc_url( $gmCore->get_admin_url( array( 'preset_module' => $term->module['name'] ), array( 'preset' ) ) ); ?>"><?php printf( esc_html__( 'New %s Preset', 'grand-media' ), esc_html( $term->module['info']['title'] ) ); ?></a>
|
30 |
<?php } ?>
|
31 |
</div>
|
32 |
<div class="spinner"></div>
|
admin/pages/settings/settings.php
CHANGED
@@ -1,55 +1,51 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Gmedia Settings
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
-
|
11 |
-
|
12 |
-
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
13 |
|
14 |
$url = $gmProcessor->url;
|
15 |
$pk = isset( $gmGallery->options['purchase_key'] ) ? $gmGallery->options['purchase_key'] : '';
|
16 |
$lk = isset( $gmGallery->options['license_key'] ) ? $gmGallery->options['license_key'] : '';
|
17 |
?>
|
18 |
|
19 |
-
<form id="gmediaSettingsForm" class="
|
20 |
-
<div class="
|
21 |
-
<div class="btn-toolbar
|
22 |
<div class="btn-group">
|
23 |
-
<button type="submit" name="gmedia_settings_reset" class="btn btn-
|
24 |
-
<button type="submit" name="gmedia_settings_save" class="btn btn-primary"><?php
|
25 |
</div>
|
26 |
</div>
|
27 |
<?php
|
28 |
wp_nonce_field( 'gmedia_settings', '_wpnonce_settings' );
|
29 |
?>
|
30 |
</div>
|
31 |
-
<div class="
|
32 |
-
<div class="container-fluid">
|
33 |
<div class="tabable tabs-left">
|
34 |
-
<ul id="settingsTabs" class="nav nav-tabs" style="padding:10px 0;">
|
35 |
-
<li class="
|
36 |
-
<li><a href="#gmedia_settings_other" data-toggle="tab"><?php
|
37 |
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
38 |
-
<li><a href="#gmedia_settings_permalinks" data-toggle="tab"><?php
|
39 |
-
<li><a href="#gmedia_settings_cloud" data-toggle="tab"><?php
|
40 |
-
<li><a href="#gmedia_settings_roles" data-toggle="tab"><?php
|
41 |
<?php } ?>
|
42 |
-
<li><a href="#gmedia_settings_sysinfo" data-toggle="tab"><?php
|
43 |
</ul>
|
44 |
<div class="tab-content" style="padding-top:21px;">
|
45 |
<?php
|
46 |
-
|
47 |
-
|
48 |
if ( current_user_can( 'manage_options' ) ) {
|
49 |
include dirname( __FILE__ ) . '/tpl/permalinks.php';
|
50 |
include dirname( __FILE__ ) . '/tpl/roles.php';
|
51 |
}
|
52 |
-
|
53 |
?>
|
54 |
|
55 |
</div>
|
@@ -62,8 +58,8 @@ $lk = isset( $gmGallery->options['license_key'] ) ? $gmGallery->options['licens
|
|
62 |
hash = hash.replace('_tab', '');
|
63 |
$('#settingsTabs a[href="' + hash + '"]').tab('show');
|
64 |
}
|
65 |
-
$('#gmediaSettingsForm').on('submit', function() {
|
66 |
-
$(this).attr('action', $(this).attr('action') + $('#settingsTabs
|
67 |
});
|
68 |
});
|
69 |
</script>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
3 |
+
|
4 |
/**
|
5 |
* Gmedia Settings
|
6 |
*/
|
7 |
|
8 |
+
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor, $gm_allowed_tags;
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
$url = $gmProcessor->url;
|
11 |
$pk = isset( $gmGallery->options['purchase_key'] ) ? $gmGallery->options['purchase_key'] : '';
|
12 |
$lk = isset( $gmGallery->options['license_key'] ) ? $gmGallery->options['license_key'] : '';
|
13 |
?>
|
14 |
|
15 |
+
<form id="gmediaSettingsForm" class="card m-0 mw-100 p-0" method="post" action="<?php echo esc_url( $url ); ?>">
|
16 |
+
<div class="card-header bg-light clearfix">
|
17 |
+
<div class="btn-toolbar gap-4 float-start">
|
18 |
<div class="btn-group">
|
19 |
+
<button type="submit" name="gmedia_settings_reset" class="btn btn-secondary" data-confirm="<?php esc_attr_e( 'Reset all Gmedia settings?', 'grand-media' ); ?>"><?php esc_html_e( 'Reset Settings', 'grand-media' ); ?></button>
|
20 |
+
<button type="submit" name="gmedia_settings_save" class="btn btn-primary"><?php esc_html_e( 'Update', 'grand-media' ); ?></button>
|
21 |
</div>
|
22 |
</div>
|
23 |
<?php
|
24 |
wp_nonce_field( 'gmedia_settings', '_wpnonce_settings' );
|
25 |
?>
|
26 |
</div>
|
27 |
+
<div class="card-body" id="gmedia-msg-panel"></div>
|
28 |
+
<div class="container-fluid small">
|
29 |
<div class="tabable tabs-left">
|
30 |
+
<ul id="settingsTabs" class="nav nav-tabs flex-column" style="padding:10px 0;">
|
31 |
+
<li class="nav-item"><a class="nav-link text-dark active" href="#gmedia_premium" data-bs-toggle="tab"><?php esc_html_e( 'Premium Settings', 'grand-media' ); ?></a></li>
|
32 |
+
<li class="nav-item"><a class="nav-link text-dark" href="#gmedia_settings_other" data-bs-toggle="tab"><?php esc_html_e( 'Other Settings', 'grand-media' ); ?></a></li>
|
33 |
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
34 |
+
<li class="nav-item"><a class="nav-link text-dark" href="#gmedia_settings_permalinks" data-bs-toggle="tab"><?php esc_html_e( 'Permalinks', 'grand-media' ); ?></a></li>
|
35 |
+
<li class="nav-item"><a class="nav-link text-dark" href="#gmedia_settings_cloud" data-bs-toggle="tab"><?php esc_html_e( 'GmediaCloud Page', 'grand-media' ); ?></a></li>
|
36 |
+
<li class="nav-item"><a class="nav-link text-dark" href="#gmedia_settings_roles" data-bs-toggle="tab"><?php esc_html_e( 'Roles/Capabilities Manager', 'grand-media' ); ?></a></li>
|
37 |
<?php } ?>
|
38 |
+
<li class="nav-item"><a class="nav-link text-dark" href="#gmedia_settings_sysinfo" data-bs-toggle="tab"><?php esc_html_e( 'System Info', 'grand-media' ); ?></a></li>
|
39 |
</ul>
|
40 |
<div class="tab-content" style="padding-top:21px;">
|
41 |
<?php
|
42 |
+
require dirname( __FILE__ ) . '/tpl/license.php';
|
43 |
+
require dirname( __FILE__ ) . '/tpl/common.php';
|
44 |
if ( current_user_can( 'manage_options' ) ) {
|
45 |
include dirname( __FILE__ ) . '/tpl/permalinks.php';
|
46 |
include dirname( __FILE__ ) . '/tpl/roles.php';
|
47 |
}
|
48 |
+
require dirname( __FILE__ ) . '/tpl/system.php';
|
49 |
?>
|
50 |
|
51 |
</div>
|
58 |
hash = hash.replace('_tab', '');
|
59 |
$('#settingsTabs a[href="' + hash + '"]').tab('show');
|
60 |
}
|
61 |
+
$('#gmediaSettingsForm').on('submit', function(e) {
|
62 |
+
$(this).attr('action', $(this).attr('action') + $('#settingsTabs a.active').attr('href') + '_tab');
|
63 |
});
|
64 |
});
|
65 |
</script>
|
admin/pages/settings/tpl/common.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Common Settings
|
@@ -13,58 +10,58 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
?>
|
14 |
<fieldset id="gmedia_settings_other" class="tab-pane">
|
15 |
<div class="form-group">
|
16 |
-
<label><?php
|
17 |
<select name="set[uninstall_dropdata]" class="form-control input-sm">
|
18 |
-
<option value="all" <?php selected( $gmGallery->options['uninstall_dropdata'], 'all' ); ?>><?php
|
19 |
-
<option value="db" <?php selected( $gmGallery->options['uninstall_dropdata'], 'db' ); ?>><?php
|
20 |
-
<option value="none" <?php selected( $gmGallery->options['uninstall_dropdata'], 'none' ); ?>><?php
|
21 |
</select>
|
22 |
</div>
|
23 |
|
24 |
<hr/>
|
25 |
<div class="form-group">
|
26 |
-
<label><?php esc_html_e( 'Google API Key', 'grand-media' ) ?></label>
|
27 |
<div class="row">
|
28 |
<div class="col-xs-6">
|
29 |
-
<input type="text" name="set[google_api_key]" class="form-control input-sm" value="<?php echo esc_attr( $gmGallery->options['google_api_key'] ) ?>">
|
30 |
</div>
|
31 |
<div class="col-xs-6">
|
32 |
-
<p style="padding-top: 5px"><a target="_blank" href="https://support.google.com/googleapi/answer/6158862"><?php
|
33 |
</div>
|
34 |
</div>
|
35 |
-
<p class="help-block"><?php
|
36 |
</div>
|
37 |
|
38 |
<hr/>
|
39 |
<div class="form-group">
|
40 |
-
<label><?php esc_html_e( 'Cache expiration', 'grand-media' ) ?></label>
|
41 |
<div class="row">
|
42 |
<div class="col-xs-6">
|
43 |
<input type="number" name="set[cache_expiration]" class="form-control input-sm" value="<?php echo absint( $gmGallery->options['cache_expiration'] ); ?>">
|
44 |
</div>
|
45 |
</div>
|
46 |
-
<p class="help-block"><?php
|
47 |
</div>
|
48 |
|
49 |
<hr/>
|
50 |
<div class="form-group row">
|
51 |
<div class="col-xs-6">
|
52 |
-
<label><?php
|
53 |
<select name="set[in_tag_orderby]" class="form-control input-sm">
|
54 |
-
<option value="ID" <?php selected( $gmGallery->options['in_tag_orderby'], 'ID' ); ?>><?php
|
55 |
-
<option value="title" <?php selected( $gmGallery->options['in_tag_orderby'], 'title' ); ?>><?php
|
56 |
-
<option value="gmuid" <?php selected( $gmGallery->options['in_tag_orderby'], 'gmuid' ); ?>><?php
|
57 |
-
<option value="date" <?php selected( $gmGallery->options['in_tag_orderby'], 'date' ); ?>><?php
|
58 |
-
<option value="modified" <?php selected( $gmGallery->options['in_tag_orderby'], 'modified' ); ?>><?php
|
59 |
-
<option value="comment_count" <?php selected( $gmGallery->options['in_tag_orderby'], 'comment_count' ); ?>><?php
|
60 |
-
<option value="rand" <?php selected( $gmGallery->options['in_tag_orderby'], 'rand' ); ?>><?php
|
61 |
</select>
|
62 |
</div>
|
63 |
<div class="col-xs-6">
|
64 |
-
<label><?php
|
65 |
<select name="set[in_tag_order]" class="form-control input-sm">
|
66 |
-
<option value="DESC" <?php selected( $gmGallery->options['in_tag_order'], 'DESC' ); ?>><?php
|
67 |
-
<option value="ASC" <?php selected( $gmGallery->options['in_tag_order'], 'ASC' ); ?>><?php
|
68 |
</select>
|
69 |
</div>
|
70 |
</div>
|
@@ -73,73 +70,74 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
73 |
<div class="form-group">
|
74 |
<div class="row">
|
75 |
<div class="col-xs-6">
|
76 |
-
<label><?php
|
77 |
<select name="set[in_category_orderby]" class="form-control input-sm">
|
78 |
-
<option value="ID" <?php selected( $gmGallery->options['in_category_orderby'], 'ID' ); ?>><?php
|
79 |
-
<option value="title" <?php selected( $gmGallery->options['in_category_orderby'], 'title' ); ?>><?php
|
80 |
-
<option value="gmuid" <?php selected( $gmGallery->options['in_category_orderby'], 'gmuid' ); ?>><?php
|
81 |
-
<option value="date" <?php selected( $gmGallery->options['in_category_orderby'], 'date' ); ?>><?php
|
82 |
-
<option value="modified" <?php selected( $gmGallery->options['in_category_orderby'], 'modified' ); ?>><?php
|
83 |
-
<option value="comment_count" <?php selected( $gmGallery->options['in_category_orderby'], 'comment_count' ); ?>><?php
|
84 |
-
<option value="rand" <?php selected( $gmGallery->options['in_category_orderby'], 'rand' ); ?>><?php
|
85 |
</select>
|
86 |
</div>
|
87 |
<div class="col-xs-6">
|
88 |
-
<label><?php
|
89 |
<select name="set[in_category_order]" class="form-control input-sm">
|
90 |
-
<option value="DESC" <?php selected( $gmGallery->options['in_category_order'], 'DESC' ); ?>><?php
|
91 |
-
<option value="ASC" <?php selected( $gmGallery->options['in_category_order'], 'ASC' ); ?>><?php
|
92 |
</select>
|
93 |
</div>
|
94 |
</div>
|
95 |
-
<p class="help-block"><?php
|
96 |
</div>
|
97 |
|
98 |
<hr/>
|
99 |
<div class="form-group">
|
100 |
<div class="row">
|
101 |
<div class="col-xs-6">
|
102 |
-
<label><?php
|
103 |
<select name="set[in_album_orderby]" class="form-control input-sm">
|
104 |
-
<option value="ID" <?php selected( $gmGallery->options['in_album_orderby'], 'ID' ); ?>><?php
|
105 |
-
<option value="title" <?php selected( $gmGallery->options['in_album_orderby'], 'title' ); ?>><?php
|
106 |
-
<option value="gmuid" <?php selected( $gmGallery->options['in_album_orderby'], 'gmuid' ); ?>><?php
|
107 |
-
<option value="date" <?php selected( $gmGallery->options['in_album_orderby'], 'date' ); ?>><?php
|
108 |
-
<option value="modified" <?php selected( $gmGallery->options['in_album_orderby'], 'modified' ); ?>><?php
|
109 |
-
<option value="comment_count" <?php selected( $gmGallery->options['in_album_orderby'], 'comment_count' ); ?>><?php
|
110 |
-
<option value="rand" <?php selected( $gmGallery->options['in_album_orderby'], 'rand' ); ?>><?php
|
111 |
</select>
|
112 |
</div>
|
113 |
<div class="col-xs-6">
|
114 |
-
<label><?php
|
115 |
<select name="set[in_album_order]" class="form-control input-sm">
|
116 |
-
<option value="DESC" <?php selected( $gmGallery->options['in_album_order'], 'DESC' ); ?>><?php
|
117 |
-
<option value="ASC" <?php selected( $gmGallery->options['in_album_order'], 'ASC' ); ?>><?php
|
118 |
</select>
|
119 |
</div>
|
120 |
</div>
|
121 |
-
<p class="help-block"><?php
|
122 |
</div>
|
123 |
<div class="form-group">
|
124 |
-
<label><?php
|
125 |
<select name="set[in_album_status]" class="form-control input-sm">
|
126 |
-
<option value="publish" <?php selected( $gmGallery->options['in_album_status'], 'publish' ); ?>><?php
|
127 |
-
<option value="private" <?php selected( $gmGallery->options['in_album_status'], 'private' ); ?>><?php
|
128 |
-
<option value="draft" <?php selected( $gmGallery->options['in_album_status'], 'draft' ); ?>><?php
|
129 |
</select>
|
130 |
</div>
|
131 |
|
132 |
<hr/>
|
133 |
<?php $gmedia_modules = get_gmedia_modules( false ); ?>
|
134 |
<div class="form-group">
|
135 |
-
<label><?php
|
136 |
<select class="form-control input-sm" name="set[default_gmedia_module]">
|
137 |
-
<?php
|
|
|
138 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
139 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
140 |
$selected = selected( $gmGallery->options['default_gmedia_module'], esc_attr( $mfold ), false );
|
141 |
-
$option =
|
142 |
-
$option[] = '<option ' . $selected . ' value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title']
|
143 |
foreach ( $presets as $preset ) {
|
144 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
145 |
continue;
|
@@ -150,102 +148,109 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
150 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
151 |
}
|
152 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
153 |
-
$option[] = '<option ' . $selected . ' value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author
|
154 |
} else {
|
155 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
156 |
-
$option[] = '<option ' . $selected . ' value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
157 |
}
|
158 |
}
|
159 |
-
echo implode( '', $option );
|
160 |
echo '</optgroup>';
|
161 |
-
}
|
|
|
162 |
</select>
|
163 |
|
164 |
-
<p class="help-block"><?php
|
165 |
</div>
|
166 |
|
167 |
<hr/>
|
168 |
<div class="form-group">
|
169 |
-
<label><?php
|
170 |
<div class="checkbox" style="margin:0;">
|
171 |
<input type="hidden" name="set[notify_new_modules]" value="0"/>
|
172 |
-
<label><input type="checkbox" name="set[notify_new_modules]" value="1" <?php checked( $gmGallery->options['notify_new_modules'], '1' ); ?> /> <?php
|
173 |
</div>
|
174 |
</div>
|
175 |
|
176 |
<hr/>
|
177 |
<div class="form-group">
|
178 |
-
<label><?php
|
179 |
<div class="checkbox" style="margin:0;">
|
180 |
<input type="hidden" name="set[wp_author_related_gmedia]" value="0"/>
|
181 |
-
<label><input type="checkbox" name="set[wp_author_related_gmedia]" value="1" <?php checked( $gmGallery->options['wp_author_related_gmedia'], '1' ); ?> /> <?php
|
182 |
</div>
|
183 |
<div class="checkbox" style="margin:0;">
|
184 |
<input type="hidden" name="set[wp_author_related_gmedia_album]" value="0"/>
|
185 |
-
<label><input type="checkbox" name="set[wp_author_related_gmedia_album]" value="1" <?php checked( $gmGallery->options['wp_author_related_gmedia_album'], '1' ); ?> /> <?php
|
186 |
</div>
|
187 |
<div class="checkbox" style="margin:0;">
|
188 |
<input type="hidden" name="set[wp_author_related_gmedia_gallery]" value="0"/>
|
189 |
-
<label><input type="checkbox" name="set[wp_author_related_gmedia_gallery]" value="1" <?php checked( $gmGallery->options['wp_author_related_gmedia_gallery'], '1' ); ?> /> <?php
|
190 |
</div>
|
191 |
</div>
|
192 |
|
193 |
<hr/>
|
194 |
<div class="form-group">
|
195 |
-
<label><?php
|
196 |
|
197 |
<div class="checkbox" style="margin:0;">
|
198 |
<input type="hidden" name="set[name2title_capitalize]" value="0"/>
|
199 |
-
<label><input type="checkbox" name="set[name2title_capitalize]" value="1" <?php checked( $gmGallery->options['name2title_capitalize'], '1' ); ?> /> <?php
|
200 |
</div>
|
201 |
</div>
|
202 |
|
203 |
<hr/>
|
204 |
<div class="form-group">
|
205 |
-
<label><?php
|
206 |
|
207 |
<div class="checkbox" style="margin:0;">
|
208 |
<input type="hidden" name="set[isolation_mode]" value="0"/>
|
209 |
-
<label><input type="checkbox" name="set[isolation_mode]" value="1" <?php checked( $gmGallery->options['isolation_mode'], '1' ); ?> /> <?php
|
210 |
|
211 |
-
<p class="help-block"><?php
|
212 |
</div>
|
213 |
</div>
|
214 |
<div class="form-group">
|
215 |
-
<label><?php
|
216 |
|
217 |
<div class="checkbox" style="margin:0;">
|
218 |
<input type="hidden" name="set[shortcode_raw]" value="0"/>
|
219 |
-
<label><input type="checkbox" name="set[shortcode_raw]" value="1" <?php checked( $gmGallery->options['shortcode_raw'], '1' ); ?> /> <?php
|
220 |
|
221 |
-
<p class="help-block"><?php
|
222 |
</div>
|
223 |
</div>
|
224 |
<div class="form-group">
|
225 |
-
<label><?php
|
226 |
|
227 |
<div class="checkbox" style="margin:0;">
|
228 |
<input type="hidden" name="set[debug_mode]" value=""/>
|
229 |
-
<label><input type="checkbox" name="set[debug_mode]" value="1" <?php checked( $gmGallery->options['debug_mode'], '1' ); ?> /> <?php
|
230 |
</div>
|
231 |
</div>
|
232 |
<?php
|
233 |
$allowed_post_types = (array) $gmGallery->options['gmedia_post_types_support'];
|
234 |
-
$args =
|
235 |
'public' => true,
|
236 |
'show_ui' => true,
|
237 |
'_builtin' => false,
|
238 |
-
|
239 |
-
$output = 'objects'; // names or objects, note names is the default
|
240 |
-
$operator = 'and'; // 'and' or 'or'
|
241 |
$post_types = get_post_types( $args, $output, $operator );
|
242 |
-
if ( ! empty( $post_types ) ) {
|
|
|
243 |
<div class="form-group">
|
244 |
-
<label style="margin-bottom:-5px;"><?php
|
245 |
<input type="hidden" name="set[gmedia_post_types_support]" value=""/>
|
246 |
<?php
|
247 |
-
foreach ( $post_types as $
|
248 |
-
|
|
|
|
|
|
|
|
|
|
|
249 |
<?php } ?>
|
250 |
</div>
|
251 |
<?php } ?>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Common Settings
|
10 |
?>
|
11 |
<fieldset id="gmedia_settings_other" class="tab-pane">
|
12 |
<div class="form-group">
|
13 |
+
<label><?php esc_html_e( 'When delete (uninstall) plugin', 'grand-media' ); ?>:</label>
|
14 |
<select name="set[uninstall_dropdata]" class="form-control input-sm">
|
15 |
+
<option value="all" <?php selected( $gmGallery->options['uninstall_dropdata'], 'all' ); ?>><?php esc_html_e( 'Delete database and all uploaded files', 'grand-media' ); ?></option>
|
16 |
+
<option value="db" <?php selected( $gmGallery->options['uninstall_dropdata'], 'db' ); ?>><?php esc_html_e( 'Delete database only and leave uploaded files', 'grand-media' ); ?></option>
|
17 |
+
<option value="none" <?php selected( $gmGallery->options['uninstall_dropdata'], 'none' ); ?>><?php esc_html_e( 'Do not delete database and uploaded files', 'grand-media' ); ?></option>
|
18 |
</select>
|
19 |
</div>
|
20 |
|
21 |
<hr/>
|
22 |
<div class="form-group">
|
23 |
+
<label><?php esc_html_e( 'Google API Key', 'grand-media' ); ?></label>
|
24 |
<div class="row">
|
25 |
<div class="col-xs-6">
|
26 |
+
<input type="text" name="set[google_api_key]" class="form-control input-sm" value="<?php echo esc_attr( $gmGallery->options['google_api_key'] ); ?>">
|
27 |
</div>
|
28 |
<div class="col-xs-6">
|
29 |
+
<p style="padding-top: 5px"><a target="_blank" href="https://support.google.com/googleapi/answer/6158862"><?php esc_html_e( 'How to create a Google API Key', 'grand-media' ); ?></a></p>
|
30 |
</div>
|
31 |
</div>
|
32 |
+
<p class="help-block"><?php esc_html_e( 'This API key is required to using Google Map in admin and in the gallery modules.', 'grand-media' ); ?></p>
|
33 |
</div>
|
34 |
|
35 |
<hr/>
|
36 |
<div class="form-group">
|
37 |
+
<label><?php esc_html_e( 'Cache expiration', 'grand-media' ); ?></label>
|
38 |
<div class="row">
|
39 |
<div class="col-xs-6">
|
40 |
<input type="number" name="set[cache_expiration]" class="form-control input-sm" value="<?php echo absint( $gmGallery->options['cache_expiration'] ); ?>">
|
41 |
</div>
|
42 |
</div>
|
43 |
+
<p class="help-block"><?php esc_html_e( 'Set 0 to disable cache for Gmedia Modules. Cache also reset automatically every time you save or update item in Gmedia Library or update any term or gallery.', 'grand-media' ); ?></p>
|
44 |
</div>
|
45 |
|
46 |
<hr/>
|
47 |
<div class="form-group row">
|
48 |
<div class="col-xs-6">
|
49 |
+
<label><?php esc_html_e( 'In Tags order gmedia', 'grand-media' ); ?></label>
|
50 |
<select name="set[in_tag_orderby]" class="form-control input-sm">
|
51 |
+
<option value="ID" <?php selected( $gmGallery->options['in_tag_orderby'], 'ID' ); ?>><?php esc_html_e( 'by ID', 'grand-media' ); ?></option>
|
52 |
+
<option value="title" <?php selected( $gmGallery->options['in_tag_orderby'], 'title' ); ?>><?php esc_html_e( 'by title', 'grand-media' ); ?></option>
|
53 |
+
<option value="gmuid" <?php selected( $gmGallery->options['in_tag_orderby'], 'gmuid' ); ?>><?php esc_html_e( 'by filename', 'grand-media' ); ?></option>
|
54 |
+
<option value="date" <?php selected( $gmGallery->options['in_tag_orderby'], 'date' ); ?>><?php esc_html_e( 'by date', 'grand-media' ); ?></option>
|
55 |
+
<option value="modified" <?php selected( $gmGallery->options['in_tag_orderby'], 'modified' ); ?>><?php esc_html_e( 'by last modified date', 'grand-media' ); ?></option>
|
56 |
+
<option value="comment_count" <?php selected( $gmGallery->options['in_tag_orderby'], 'comment_count' ); ?>><?php esc_html_e( 'by comment count', 'grand-media' ); ?></option>
|
57 |
+
<option value="rand" <?php selected( $gmGallery->options['in_tag_orderby'], 'rand' ); ?>><?php esc_html_e( 'Random', 'grand-media' ); ?></option>
|
58 |
</select>
|
59 |
</div>
|
60 |
<div class="col-xs-6">
|
61 |
+
<label><?php esc_html_e( 'Sort order', 'grand-media' ); ?></label>
|
62 |
<select name="set[in_tag_order]" class="form-control input-sm">
|
63 |
+
<option value="DESC" <?php selected( $gmGallery->options['in_tag_order'], 'DESC' ); ?>><?php esc_html_e( 'DESC', 'grand-media' ); ?></option>
|
64 |
+
<option value="ASC" <?php selected( $gmGallery->options['in_tag_order'], 'ASC' ); ?>><?php esc_html_e( 'ASC', 'grand-media' ); ?></option>
|
65 |
</select>
|
66 |
</div>
|
67 |
</div>
|
70 |
<div class="form-group">
|
71 |
<div class="row">
|
72 |
<div class="col-xs-6">
|
73 |
+
<label><?php esc_html_e( 'In Category order gmedia (set default order)', 'grand-media' ); ?></label>
|
74 |
<select name="set[in_category_orderby]" class="form-control input-sm">
|
75 |
+
<option value="ID" <?php selected( $gmGallery->options['in_category_orderby'], 'ID' ); ?>><?php esc_html_e( 'by ID', 'grand-media' ); ?></option>
|
76 |
+
<option value="title" <?php selected( $gmGallery->options['in_category_orderby'], 'title' ); ?>><?php esc_html_e( 'by title', 'grand-media' ); ?></option>
|
77 |
+
<option value="gmuid" <?php selected( $gmGallery->options['in_category_orderby'], 'gmuid' ); ?>><?php esc_html_e( 'by filename', 'grand-media' ); ?></option>
|
78 |
+
<option value="date" <?php selected( $gmGallery->options['in_category_orderby'], 'date' ); ?>><?php esc_html_e( 'by date', 'grand-media' ); ?></option>
|
79 |
+
<option value="modified" <?php selected( $gmGallery->options['in_category_orderby'], 'modified' ); ?>><?php esc_html_e( 'by last modified date', 'grand-media' ); ?></option>
|
80 |
+
<option value="comment_count" <?php selected( $gmGallery->options['in_category_orderby'], 'comment_count' ); ?>><?php esc_html_e( 'by comment count', 'grand-media' ); ?></option>
|
81 |
+
<option value="rand" <?php selected( $gmGallery->options['in_category_orderby'], 'rand' ); ?>><?php esc_html_e( 'Random', 'grand-media' ); ?></option>
|
82 |
</select>
|
83 |
</div>
|
84 |
<div class="col-xs-6">
|
85 |
+
<label><?php esc_html_e( 'Sort order', 'grand-media' ); ?></label>
|
86 |
<select name="set[in_category_order]" class="form-control input-sm">
|
87 |
+
<option value="DESC" <?php selected( $gmGallery->options['in_category_order'], 'DESC' ); ?>><?php esc_html_e( 'DESC', 'grand-media' ); ?></option>
|
88 |
+
<option value="ASC" <?php selected( $gmGallery->options['in_category_order'], 'ASC' ); ?>><?php esc_html_e( 'ASC', 'grand-media' ); ?></option>
|
89 |
</select>
|
90 |
</div>
|
91 |
</div>
|
92 |
+
<p class="help-block"><?php esc_html_e( 'This option could be rewritten by individual category settings.', 'grand-media' ); ?></p>
|
93 |
</div>
|
94 |
|
95 |
<hr/>
|
96 |
<div class="form-group">
|
97 |
<div class="row">
|
98 |
<div class="col-xs-6">
|
99 |
+
<label><?php esc_html_e( 'In Album order gmedia (set default order)', 'grand-media' ); ?></label>
|
100 |
<select name="set[in_album_orderby]" class="form-control input-sm">
|
101 |
+
<option value="ID" <?php selected( $gmGallery->options['in_album_orderby'], 'ID' ); ?>><?php esc_html_e( 'by ID', 'grand-media' ); ?></option>
|
102 |
+
<option value="title" <?php selected( $gmGallery->options['in_album_orderby'], 'title' ); ?>><?php esc_html_e( 'by title', 'grand-media' ); ?></option>
|
103 |
+
<option value="gmuid" <?php selected( $gmGallery->options['in_album_orderby'], 'gmuid' ); ?>><?php esc_html_e( 'by filename', 'grand-media' ); ?></option>
|
104 |
+
<option value="date" <?php selected( $gmGallery->options['in_album_orderby'], 'date' ); ?>><?php esc_html_e( 'by date', 'grand-media' ); ?></option>
|
105 |
+
<option value="modified" <?php selected( $gmGallery->options['in_album_orderby'], 'modified' ); ?>><?php esc_html_e( 'by last modified date', 'grand-media' ); ?></option>
|
106 |
+
<option value="comment_count" <?php selected( $gmGallery->options['in_album_orderby'], 'comment_count' ); ?>><?php esc_html_e( 'by comment count', 'grand-media' ); ?></option>
|
107 |
+
<option value="rand" <?php selected( $gmGallery->options['in_album_orderby'], 'rand' ); ?>><?php esc_html_e( 'Random', 'grand-media' ); ?></option>
|
108 |
</select>
|
109 |
</div>
|
110 |
<div class="col-xs-6">
|
111 |
+
<label><?php esc_html_e( 'Sort order', 'grand-media' ); ?></label>
|
112 |
<select name="set[in_album_order]" class="form-control input-sm">
|
113 |
+
<option value="DESC" <?php selected( $gmGallery->options['in_album_order'], 'DESC' ); ?>><?php esc_html_e( 'DESC', 'grand-media' ); ?></option>
|
114 |
+
<option value="ASC" <?php selected( $gmGallery->options['in_album_order'], 'ASC' ); ?>><?php esc_html_e( 'ASC', 'grand-media' ); ?></option>
|
115 |
</select>
|
116 |
</div>
|
117 |
</div>
|
118 |
+
<p class="help-block"><?php esc_html_e( 'This option could be rewritten by individual category settings.', 'grand-media' ); ?></p>
|
119 |
</div>
|
120 |
<div class="form-group">
|
121 |
+
<label><?php esc_html_e( 'Set default Album status', 'grand-media' ); ?></label>
|
122 |
<select name="set[in_album_status]" class="form-control input-sm">
|
123 |
+
<option value="publish" <?php selected( $gmGallery->options['in_album_status'], 'publish' ); ?>><?php esc_html_e( 'Public', 'grand-media' ); ?></option>
|
124 |
+
<option value="private" <?php selected( $gmGallery->options['in_album_status'], 'private' ); ?>><?php esc_html_e( 'Private', 'grand-media' ); ?></option>
|
125 |
+
<option value="draft" <?php selected( $gmGallery->options['in_album_status'], 'draft' ); ?>><?php esc_html_e( 'Draft', 'grand-media' ); ?></option>
|
126 |
</select>
|
127 |
</div>
|
128 |
|
129 |
<hr/>
|
130 |
<?php $gmedia_modules = get_gmedia_modules( false ); ?>
|
131 |
<div class="form-group">
|
132 |
+
<label><?php esc_html_e( 'Choose default module', 'grand-media' ); ?>:</label>
|
133 |
<select class="form-control input-sm" name="set[default_gmedia_module]">
|
134 |
+
<?php
|
135 |
+
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
136 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
137 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $mfold ) );
|
138 |
$selected = selected( $gmGallery->options['default_gmedia_module'], esc_attr( $mfold ), false );
|
139 |
+
$option = array();
|
140 |
+
$option[] = '<option ' . $selected . ' value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title'] . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
141 |
foreach ( $presets as $preset ) {
|
142 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
143 |
continue;
|
148 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
149 |
}
|
150 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
151 |
+
$option[] = '<option ' . $selected . ' value="' . esc_attr( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
152 |
} else {
|
153 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
154 |
+
$option[] = '<option ' . $selected . ' value="' . esc_attr( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
155 |
}
|
156 |
}
|
157 |
+
echo wp_kses( implode( '', $option ), $gm_allowed_tags );
|
158 |
echo '</optgroup>';
|
159 |
+
}
|
160 |
+
?>
|
161 |
</select>
|
162 |
|
163 |
+
<p class="help-block"><?php esc_html_e( 'Chosen module will be used for terms pages.', 'grand-media' ); ?></p>
|
164 |
</div>
|
165 |
|
166 |
<hr/>
|
167 |
<div class="form-group">
|
168 |
+
<label><?php esc_html_e( 'Notifications', 'grand-media' ); ?></label>
|
169 |
<div class="checkbox" style="margin:0;">
|
170 |
<input type="hidden" name="set[notify_new_modules]" value="0"/>
|
171 |
+
<label><input type="checkbox" name="set[notify_new_modules]" value="1" <?php checked( $gmGallery->options['notify_new_modules'], '1' ); ?> /> <?php esc_html_e( 'Show notification label about new modules (green conter)', 'grand-media' ); ?> </label>
|
172 |
</div>
|
173 |
</div>
|
174 |
|
175 |
<hr/>
|
176 |
<div class="form-group">
|
177 |
+
<label><?php esc_html_e( 'Choose what to show on Author Profile pages', 'grand-media' ); ?></label>
|
178 |
<div class="checkbox" style="margin:0;">
|
179 |
<input type="hidden" name="set[wp_author_related_gmedia]" value="0"/>
|
180 |
+
<label><input type="checkbox" name="set[wp_author_related_gmedia]" value="1" <?php checked( $gmGallery->options['wp_author_related_gmedia'], '1' ); ?> /> <?php esc_html_e( 'Gmedia Posts (media items from Gmedia Libary)', 'grand-media' ); ?> </label>
|
181 |
</div>
|
182 |
<div class="checkbox" style="margin:0;">
|
183 |
<input type="hidden" name="set[wp_author_related_gmedia_album]" value="0"/>
|
184 |
+
<label><input type="checkbox" name="set[wp_author_related_gmedia_album]" value="1" <?php checked( $gmGallery->options['wp_author_related_gmedia_album'], '1' ); ?> /> <?php esc_html_e( 'Gmedia Albums', 'grand-media' ); ?> </label>
|
185 |
</div>
|
186 |
<div class="checkbox" style="margin:0;">
|
187 |
<input type="hidden" name="set[wp_author_related_gmedia_gallery]" value="0"/>
|
188 |
+
<label><input type="checkbox" name="set[wp_author_related_gmedia_gallery]" value="1" <?php checked( $gmGallery->options['wp_author_related_gmedia_gallery'], '1' ); ?> /> <?php esc_html_e( 'Gmedia Galleries', 'grand-media' ); ?> </label>
|
189 |
</div>
|
190 |
</div>
|
191 |
|
192 |
<hr/>
|
193 |
<div class="form-group">
|
194 |
+
<label><?php esc_html_e( 'When set title from filename', 'grand-media' ); ?>:</label>
|
195 |
|
196 |
<div class="checkbox" style="margin:0;">
|
197 |
<input type="hidden" name="set[name2title_capitalize]" value="0"/>
|
198 |
+
<label><input type="checkbox" name="set[name2title_capitalize]" value="1" <?php checked( $gmGallery->options['name2title_capitalize'], '1' ); ?> /> <?php esc_html_e( 'Make the first letter of each word capitalized (Title Case)', 'grand-media' ); ?> </label>
|
199 |
</div>
|
200 |
</div>
|
201 |
|
202 |
<hr/>
|
203 |
<div class="form-group">
|
204 |
+
<label><?php esc_html_e( 'Forbid other plugins to load their JS and CSS on Gmedia admin pages', 'grand-media' ); ?>:</label>
|
205 |
|
206 |
<div class="checkbox" style="margin:0;">
|
207 |
<input type="hidden" name="set[isolation_mode]" value="0"/>
|
208 |
+
<label><input type="checkbox" name="set[isolation_mode]" value="1" <?php checked( $gmGallery->options['isolation_mode'], '1' ); ?> /> <?php esc_html_e( 'Enable Gmedia admin panel Isolation Mode', 'grand-media' ); ?> </label>
|
209 |
|
210 |
+
<p class="help-block"><?php esc_html_e( 'This option could help to avoid JS and CSS conflicts with other plugins in admin panel.', 'grand-media' ); ?></p>
|
211 |
</div>
|
212 |
</div>
|
213 |
<div class="form-group">
|
214 |
+
<label><?php esc_html_e( 'Forbid theme to format Gmedia shortcode\'s content', 'grand-media' ); ?>:</label>
|
215 |
|
216 |
<div class="checkbox" style="margin:0;">
|
217 |
<input type="hidden" name="set[shortcode_raw]" value="0"/>
|
218 |
+
<label><input type="checkbox" name="set[shortcode_raw]" value="1" <?php checked( $gmGallery->options['shortcode_raw'], '1' ); ?> /> <?php esc_html_e( 'Raw output for Gmedia Shortcode', 'grand-media' ); ?> </label>
|
219 |
|
220 |
+
<p class="help-block"><?php esc_html_e( 'Some themes reformat shortcodes and break it functionality (mostly when you add description to images). Turning this on should solve this problem.', 'grand-media' ); ?></p>
|
221 |
</div>
|
222 |
</div>
|
223 |
<div class="form-group">
|
224 |
+
<label><?php esc_html_e( 'Debug Mode', 'grand-media' ); ?>:</label>
|
225 |
|
226 |
<div class="checkbox" style="margin:0;">
|
227 |
<input type="hidden" name="set[debug_mode]" value=""/>
|
228 |
+
<label><input type="checkbox" name="set[debug_mode]" value="1" <?php checked( $gmGallery->options['debug_mode'], '1' ); ?> /> <?php esc_html_e( 'Enable Debug Mode on Gmedia admin pages', 'grand-media' ); ?> </label>
|
229 |
</div>
|
230 |
</div>
|
231 |
<?php
|
232 |
$allowed_post_types = (array) $gmGallery->options['gmedia_post_types_support'];
|
233 |
+
$args = array(
|
234 |
'public' => true,
|
235 |
'show_ui' => true,
|
236 |
'_builtin' => false,
|
237 |
+
);
|
238 |
+
$output = 'objects'; // names or objects, note names is the default.
|
239 |
+
$operator = 'and'; // 'and' or 'or'.
|
240 |
$post_types = get_post_types( $args, $output, $operator );
|
241 |
+
if ( ! empty( $post_types ) ) {
|
242 |
+
?>
|
243 |
<div class="form-group">
|
244 |
+
<label style="margin-bottom:-5px;"><?php esc_html_e( 'Enable Gmedia Library button on custom post types', 'grand-media' ); ?>:</label>
|
245 |
<input type="hidden" name="set[gmedia_post_types_support]" value=""/>
|
246 |
<?php
|
247 |
+
foreach ( $post_types as $p_type ) {
|
248 |
+
?>
|
249 |
+
<div class="checkbox">
|
250 |
+
<label>
|
251 |
+
<input type="checkbox" name="set[gmedia_post_types_support][]" value="<?php echo esc_attr( $p_type->name ); ?>" <?php echo in_array( $p_type->name, $allowed_post_types, true ) ? 'checked="checked"' : ''; ?> /> <?php echo esc_html( $p_type->label . ' (' . $p_type->name . ')' ); ?>
|
252 |
+
</label>
|
253 |
+
</div>
|
254 |
<?php } ?>
|
255 |
</div>
|
256 |
<?php } ?>
|
admin/pages/settings/tpl/license.php
CHANGED
@@ -1,99 +1,104 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
|
|
7 |
/**
|
8 |
* License Key
|
|
|
|
|
|
|
9 |
*/
|
10 |
?>
|
11 |
<fieldset id="gmedia_premium" class="tab-pane active">
|
12 |
-
<p><?php
|
13 |
|
14 |
<div class="row">
|
15 |
<div class="form-group col-xs-5">
|
16 |
-
<label><?php
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
<input type="text" name="set[purchase_key]" id="purchase_key" class="form-control input-sm" value="<?php echo esc_attr( $pk ); ?>"/>
|
20 |
|
21 |
<div class="manual_license_activate"<?php echo( ( 'manual' === $gmCore->_get( 'license_activate' ) ) ? '' : ' style="display:none;"' ); ?>>
|
22 |
-
<label style="margin-top:7px;"><?php
|
23 |
<input type="text" name="set[license_name]" id="license_name" class="form-control input-sm" value="<?php echo esc_attr( $gmGallery->options['license_name'] ); ?>"/>
|
24 |
-
<label style="margin-top:7px;"><?php
|
25 |
<input type="text" name="set[license_key]" id="license_key" class="form-control input-sm" value="<?php echo esc_attr( $lk ); ?>"/>
|
26 |
-
<label style="margin-top:7px;"><?php
|
27 |
<input type="text" name="set[license_key2]" id="license_key2" class="form-control input-sm" value="<?php echo esc_attr( $gmGallery->options['license_key2'] ); ?>"/>
|
28 |
</div>
|
29 |
</div>
|
30 |
<?php if ( ! ( 'manual' === $gmCore->_get( 'license_activate' ) || ! empty( $pk ) ) ) { ?>
|
31 |
<div class="form-group col-xs-7">
|
32 |
<label> </label>
|
33 |
-
<button style="display:block;" class="btn btn-success btn-sm" type="submit" name="license-key-activate"><?php
|
34 |
</div>
|
35 |
<?php } ?>
|
36 |
</div>
|
37 |
<fieldset <?php echo( empty( $gmGallery->options['license_name'] ) ? 'disabled' : '' ); ?>>
|
38 |
<hr/>
|
39 |
<div class="form-group">
|
40 |
-
<label><?php
|
41 |
<div class="checkbox" style="margin:0;">
|
42 |
<input type="hidden" name="set[delete_originals]" value="0"/>
|
43 |
-
<label><input type="checkbox" name="set[delete_originals]" value="1" <?php checked( $gmGallery->options['delete_originals'], '1' ); ?> /> <?php
|
44 |
</label>
|
45 |
</div>
|
46 |
-
<p class="help-block"><?php
|
47 |
</div>
|
48 |
|
49 |
<div class="form-group">
|
50 |
-
<label><?php
|
51 |
<div class="checkbox" style="margin:0;">
|
52 |
<input type="hidden" name="set[disable_logs]" value="0"/>
|
53 |
-
<label><input type="checkbox" name="set[disable_logs]" value="1" <?php checked( $gmGallery->options['disable_logs'], '1' ); ?> /> <?php
|
54 |
</label>
|
55 |
</div>
|
56 |
</div>
|
57 |
|
58 |
<hr/>
|
59 |
<div class="form-group">
|
60 |
-
<label><?php
|
61 |
<div class="checkbox" style="margin:0;">
|
62 |
<input type="hidden" name="set[wp_term_related_gmedia]" value="0"/>
|
63 |
-
<label><input type="checkbox" name="set[wp_term_related_gmedia]" value="1" <?php checked( $gmGallery->options['wp_term_related_gmedia'], '1' ); ?> /> <?php
|
64 |
</label>
|
65 |
</div>
|
66 |
<div class="checkbox" style="margin:0;">
|
67 |
<input type="hidden" name="set[wp_post_related_gmedia]" value="0"/>
|
68 |
-
<label><input type="checkbox" name="set[wp_post_related_gmedia]" value="1" <?php checked( $gmGallery->options['wp_post_related_gmedia'], '1' ); ?> /> <?php
|
69 |
</label>
|
70 |
</div>
|
71 |
</div>
|
72 |
|
73 |
<hr/>
|
74 |
<div class="form-group">
|
75 |
-
<label><?php
|
76 |
<div class="checkbox" style="margin:0;">
|
77 |
<input type="hidden" name="set[feedback]" value="0"/>
|
78 |
-
<label><input type="checkbox" name="set[feedback]" value="1" <?php checked( $gmGallery->options['feedback'], '1' ); ?> /> <?php
|
79 |
</label>
|
80 |
</div>
|
81 |
-
<p class="help-block"><?php
|
82 |
</div>
|
83 |
<div class="form-group">
|
84 |
-
<label><?php
|
85 |
<div class="checkbox" style="margin:0;">
|
86 |
<input type="hidden" name="set[twitter]" value="0"/>
|
87 |
-
<label><input type="checkbox" name="set[twitter]" value="1" <?php checked( $gmGallery->options['twitter'], '1' ); ?> /> <?php
|
88 |
</label>
|
89 |
</div>
|
90 |
-
<p class="help-block"><?php
|
91 |
</div>
|
92 |
<div class="form-group">
|
93 |
-
<label><?php
|
94 |
<div class="checkbox" style="margin:0;">
|
95 |
<input type="hidden" name="set[disable_ads]" value="0"/>
|
96 |
-
<label><input type="checkbox" name="set[disable_ads]" value="1" <?php checked( $gmGallery->options['disable_ads'], '1' ); ?> /> <?php
|
97 |
</label>
|
98 |
</div>
|
99 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
+
global $gmCore, $gmGallery;
|
5 |
/**
|
6 |
* License Key
|
7 |
+
*
|
8 |
+
* @var $pk
|
9 |
+
* @var $lk
|
10 |
*/
|
11 |
?>
|
12 |
<fieldset id="gmedia_premium" class="tab-pane active">
|
13 |
+
<p><?php esc_html_e( 'Enter Gmedia Premium Key to remove backlink label from premium gallery modules and unlock settings below.' ); ?></p>
|
14 |
|
15 |
<div class="row">
|
16 |
<div class="form-group col-xs-5">
|
17 |
+
<label><?php esc_html_e( 'Gmedia Premium Key', 'grand-media' ); ?>:
|
18 |
+
<?php
|
19 |
+
if ( isset( $gmGallery->options['license_name'] ) ) {
|
20 |
+
echo '<em>' . esc_html( $gmGallery->options['license_name'] ) . '</em>';
|
21 |
+
}
|
22 |
+
?>
|
23 |
+
</label>
|
24 |
<input type="text" name="set[purchase_key]" id="purchase_key" class="form-control input-sm" value="<?php echo esc_attr( $pk ); ?>"/>
|
25 |
|
26 |
<div class="manual_license_activate"<?php echo( ( 'manual' === $gmCore->_get( 'license_activate' ) ) ? '' : ' style="display:none;"' ); ?>>
|
27 |
+
<label style="margin-top:7px;"><?php esc_html_e( 'License Name', 'grand-media' ); ?>:</label>
|
28 |
<input type="text" name="set[license_name]" id="license_name" class="form-control input-sm" value="<?php echo esc_attr( $gmGallery->options['license_name'] ); ?>"/>
|
29 |
+
<label style="margin-top:7px;"><?php esc_html_e( 'License Key', 'grand-media' ); ?>:</label>
|
30 |
<input type="text" name="set[license_key]" id="license_key" class="form-control input-sm" value="<?php echo esc_attr( $lk ); ?>"/>
|
31 |
+
<label style="margin-top:7px;"><?php esc_html_e( 'Additional Key', 'grand-media' ); ?>:</label>
|
32 |
<input type="text" name="set[license_key2]" id="license_key2" class="form-control input-sm" value="<?php echo esc_attr( $gmGallery->options['license_key2'] ); ?>"/>
|
33 |
</div>
|
34 |
</div>
|
35 |
<?php if ( ! ( 'manual' === $gmCore->_get( 'license_activate' ) || ! empty( $pk ) ) ) { ?>
|
36 |
<div class="form-group col-xs-7">
|
37 |
<label> </label>
|
38 |
+
<button style="display:block;" class="btn btn-success btn-sm" type="submit" name="license-key-activate"><?php esc_html_e( 'Activate Key', 'grand-media' ); ?></button>
|
39 |
</div>
|
40 |
<?php } ?>
|
41 |
</div>
|
42 |
<fieldset <?php echo( empty( $gmGallery->options['license_name'] ) ? 'disabled' : '' ); ?>>
|
43 |
<hr/>
|
44 |
<div class="form-group">
|
45 |
+
<label><?php esc_html_e( 'Delete original images', 'grand-media' ); ?>:</label>
|
46 |
<div class="checkbox" style="margin:0;">
|
47 |
<input type="hidden" name="set[delete_originals]" value="0"/>
|
48 |
+
<label><input type="checkbox" name="set[delete_originals]" value="1" <?php checked( $gmGallery->options['delete_originals'], '1' ); ?> /> <?php esc_html_e( 'Do not keep original images on the server', 'grand-media' ); ?>
|
49 |
</label>
|
50 |
</div>
|
51 |
+
<p class="help-block"><?php esc_html_e( 'Warning: You can\'t undo this operation. Checking this option you agree to delete original images. You will not be able: restore images after modification in the Image Editor; re-create web-optimized images; ...', 'grand-media' ); ?></p>
|
52 |
</div>
|
53 |
|
54 |
<div class="form-group">
|
55 |
+
<label><?php esc_html_e( 'Disable Logs', 'grand-media' ); ?>:</label>
|
56 |
<div class="checkbox" style="margin:0;">
|
57 |
<input type="hidden" name="set[disable_logs]" value="0"/>
|
58 |
+
<label><input type="checkbox" name="set[disable_logs]" value="1" <?php checked( $gmGallery->options['disable_logs'], '1' ); ?> /> <?php esc_html_e( 'Disable Gmedia Logs page', 'grand-media' ); ?>
|
59 |
</label>
|
60 |
</div>
|
61 |
</div>
|
62 |
|
63 |
<hr/>
|
64 |
<div class="form-group">
|
65 |
+
<label><?php esc_html_e( 'Gmedia Tags & Categories', 'grand-media' ); ?></label>
|
66 |
<div class="checkbox" style="margin:0;">
|
67 |
<input type="hidden" name="set[wp_term_related_gmedia]" value="0"/>
|
68 |
+
<label><input type="checkbox" name="set[wp_term_related_gmedia]" value="1" <?php checked( $gmGallery->options['wp_term_related_gmedia'], '1' ); ?> /> <?php esc_html_e( 'Show Related Media from Gmedia library for WordPress native tags & categories', 'grand-media' ); ?>
|
69 |
</label>
|
70 |
</div>
|
71 |
<div class="checkbox" style="margin:0;">
|
72 |
<input type="hidden" name="set[wp_post_related_gmedia]" value="0"/>
|
73 |
+
<label><input type="checkbox" name="set[wp_post_related_gmedia]" value="1" <?php checked( $gmGallery->options['wp_post_related_gmedia'], '1' ); ?> /> <?php esc_html_e( 'Show Related Media from Gmedia library for WordPress Posts based on tags', 'grand-media' ); ?>
|
74 |
</label>
|
75 |
</div>
|
76 |
</div>
|
77 |
|
78 |
<hr/>
|
79 |
<div class="form-group">
|
80 |
+
<label><?php esc_html_e( 'Show "Any Feedback?" in the Sidebar', 'grand-media' ); ?>:</label>
|
81 |
<div class="checkbox" style="margin:0;">
|
82 |
<input type="hidden" name="set[feedback]" value="0"/>
|
83 |
+
<label><input type="checkbox" name="set[feedback]" value="1" <?php checked( $gmGallery->options['feedback'], '1' ); ?> /> <?php esc_html_e( 'Show "Any Feedback?"', 'grand-media' ); ?>
|
84 |
</label>
|
85 |
</div>
|
86 |
+
<p class="help-block"><?php esc_html_e( 'I\'d be very happy if you leave positive feedback about plugin on the WordPress.org Directory. Thank You!', 'grand-media' ); ?></p>
|
87 |
</div>
|
88 |
<div class="form-group">
|
89 |
+
<label><?php esc_html_e( 'Show Twitter News in the Sidebar', 'grand-media' ); ?>:</label>
|
90 |
<div class="checkbox" style="margin:0;">
|
91 |
<input type="hidden" name="set[twitter]" value="0"/>
|
92 |
+
<label><input type="checkbox" name="set[twitter]" value="1" <?php checked( $gmGallery->options['twitter'], '1' ); ?> /> <?php esc_html_e( 'Show Twitter News', 'grand-media' ); ?>
|
93 |
</label>
|
94 |
</div>
|
95 |
+
<p class="help-block"><?php esc_html_e( 'Follow Gmedia on twitter to not miss info about new modules and plugin updates.', 'grand-media' ); ?></p>
|
96 |
</div>
|
97 |
<div class="form-group">
|
98 |
+
<label><?php esc_html_e( 'Hide WoowGallery Ad Banner', 'grand-media' ); ?>:</label>
|
99 |
<div class="checkbox" style="margin:0;">
|
100 |
<input type="hidden" name="set[disable_ads]" value="0"/>
|
101 |
+
<label><input type="checkbox" name="set[disable_ads]" value="1" <?php checked( $gmGallery->options['disable_ads'], '1' ); ?> /> <?php esc_html_e( 'Hide WoowGallery Banner', 'grand-media' ); ?>
|
102 |
</label>
|
103 |
</div>
|
104 |
</div>
|
admin/pages/settings/tpl/permalinks.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Permalinks and GmediaCloud page settings
|
@@ -14,110 +11,111 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
*/
|
15 |
?>
|
16 |
<fieldset id="gmedia_settings_permalinks" class="tab-pane">
|
17 |
-
<h4><?php
|
18 |
<div class="form-group">
|
19 |
-
<label><?php
|
20 |
<input type="text" name="set[gmedia_post_slug]" value="<?php echo esc_attr( $gmGallery->options['gmedia_post_slug'] ); ?>" class="form-control input-sm"/>
|
21 |
|
22 |
-
<p class="help-block"><?php
|
23 |
</div>
|
24 |
<div class="form-group">
|
25 |
<div class="checkbox" style="margin:0;">
|
26 |
<input type="hidden" name="set[gmedia_has_archive]" value="0"/>
|
27 |
-
<label><input type="checkbox" name="set[gmedia_has_archive]" value="1" <?php checked( $gmGallery->options['gmedia_has_archive'], '1' ); ?> /> <?php
|
28 |
</div>
|
29 |
</div>
|
30 |
<div class="form-group">
|
31 |
<div class="checkbox" style="margin:0;">
|
32 |
<input type="hidden" name="set[gmedia_exclude_from_search]" value="0"/>
|
33 |
-
<label><input type="checkbox" name="set[gmedia_exclude_from_search]" value="1" <?php checked( $gmGallery->options['gmedia_exclude_from_search'], '1' ); ?> /> <?php
|
34 |
</div>
|
35 |
</div>
|
36 |
<div class="form-group">
|
37 |
-
<label><?php
|
38 |
<select name="set[default_gmedia_comment_status]" class="form-control input-sm">
|
39 |
-
<option value="open" <?php selected( $gmGallery->options['default_gmedia_comment_status'], 'open' ); ?>><?php
|
40 |
-
<option value="closed" <?php selected( $gmGallery->options['default_gmedia_comment_status'], 'closed' ); ?>><?php
|
41 |
</select>
|
42 |
|
43 |
-
<p class="help-block"><?php
|
44 |
</div>
|
45 |
|
46 |
<hr/>
|
47 |
-
<h4><?php
|
48 |
<div class="form-group">
|
49 |
-
<label><?php
|
50 |
<input type="text" name="set[gmedia_album_post_slug]" value="<?php echo esc_attr( $gmGallery->options['gmedia_album_post_slug'] ); ?>" class="form-control input-sm"/>
|
51 |
|
52 |
-
<p class="help-block"><?php
|
53 |
</div>
|
54 |
<div class="form-group">
|
55 |
<div class="checkbox" style="margin:0;">
|
56 |
<input type="hidden" name="set[gmedia_album_has_archive]" value="0"/>
|
57 |
-
<label><input type="checkbox" name="set[gmedia_album_has_archive]" value="1" <?php checked( $gmGallery->options['gmedia_album_has_archive'], '1' ); ?> /> <?php
|
58 |
</div>
|
59 |
</div>
|
60 |
<div class="form-group">
|
61 |
<div class="checkbox" style="margin:0;">
|
62 |
<input type="hidden" name="set[gmedia_album_exclude_from_search]" value="0"/>
|
63 |
-
<label><input type="checkbox" name="set[gmedia_album_exclude_from_search]" value="1" <?php checked( $gmGallery->options['gmedia_album_exclude_from_search'], '1' ); ?> /> <?php
|
64 |
</div>
|
65 |
</div>
|
66 |
|
67 |
<hr/>
|
68 |
-
<h4><?php
|
69 |
<div class="form-group">
|
70 |
-
<label><?php
|
71 |
<input type="text" name="set[gmedia_gallery_post_slug]" value="<?php echo esc_attr( $gmGallery->options['gmedia_gallery_post_slug'] ); ?>" class="form-control input-sm"/>
|
72 |
|
73 |
-
<p class="help-block"><?php
|
74 |
</div>
|
75 |
<div class="form-group">
|
76 |
<div class="checkbox" style="margin:0;">
|
77 |
<input type="hidden" name="set[gmedia_gallery_has_archive]" value="0"/>
|
78 |
-
<label><input type="checkbox" name="set[gmedia_gallery_has_archive]" value="1" <?php checked( $gmGallery->options['gmedia_gallery_has_archive'], '1' ); ?> /> <?php
|
79 |
</div>
|
80 |
</div>
|
81 |
<div class="form-group">
|
82 |
<div class="checkbox" style="margin:0;">
|
83 |
<input type="hidden" name="set[gmedia_gallery_exclude_from_search]" value="0"/>
|
84 |
-
<label><input type="checkbox" name="set[gmedia_gallery_exclude_from_search]" value="1" <?php checked( $gmGallery->options['gmedia_gallery_exclude_from_search'], '1' ); ?> /> <?php
|
|
|
85 |
</div>
|
86 |
</div>
|
87 |
|
88 |
</fieldset>
|
89 |
|
90 |
<fieldset id="gmedia_settings_cloud" class="tab-pane">
|
91 |
-
<p><?php
|
92 |
|
93 |
-
<p><?php
|
94 |
<br/>
|
95 |
|
96 |
<div class="form-group">
|
97 |
-
<label><?php
|
98 |
<input type="text" name="GmediaHashID_salt" value="<?php echo esc_attr( get_option( 'GmediaHashID_salt' ) ); ?>" class="form-control input-sm"/>
|
99 |
|
100 |
-
<p class="help-block"><?php
|
101 |
</div>
|
102 |
<div class="form-group">
|
103 |
-
<label><?php
|
104 |
<input type="text" name="set[endpoint]" value="<?php echo esc_attr( $gmGallery->options['endpoint'] ); ?>" class="form-control input-sm"/>
|
105 |
|
106 |
-
<p class="help-block"><?php
|
107 |
</div>
|
108 |
<div class="form-group">
|
109 |
-
<label><?php
|
110 |
<select name="set[gmediacloud_socialbuttons]" class="form-control input-sm">
|
111 |
-
<option value="1" <?php selected( $gmGallery->options['gmediacloud_socialbuttons'], '1' ); ?>><?php
|
112 |
-
<option value="0" <?php selected( $gmGallery->options['gmediacloud_socialbuttons'], '0' ); ?>><?php
|
113 |
</select>
|
114 |
</div>
|
115 |
<div class="form-group">
|
116 |
-
<label><?php
|
117 |
-
<textarea name="set[gmediacloud_footer_js]" rows="4" cols="20" class="form-control input-sm"><?php echo
|
118 |
</div>
|
119 |
<div class="form-group">
|
120 |
-
<label><?php
|
121 |
-
<textarea name="set[gmediacloud_footer_css]" rows="4" cols="20" class="form-control input-sm"><?php echo
|
122 |
</div>
|
123 |
</fieldset>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Permalinks and GmediaCloud page settings
|
11 |
*/
|
12 |
?>
|
13 |
<fieldset id="gmedia_settings_permalinks" class="tab-pane">
|
14 |
+
<h4><?php esc_html_e( 'Gmedia Library Items', 'grand-media' ); ?></h4>
|
15 |
<div class="form-group">
|
16 |
+
<label><?php esc_html_e( 'Gmedia Base', 'grand-media' ); ?>:</label>
|
17 |
<input type="text" name="set[gmedia_post_slug]" value="<?php echo esc_attr( $gmGallery->options['gmedia_post_slug'] ); ?>" class="form-control input-sm"/>
|
18 |
|
19 |
+
<p class="help-block"><?php esc_html_e( 'Base for gmedia post url.', 'grand-media' ); ?></p>
|
20 |
</div>
|
21 |
<div class="form-group">
|
22 |
<div class="checkbox" style="margin:0;">
|
23 |
<input type="hidden" name="set[gmedia_has_archive]" value="0"/>
|
24 |
+
<label><input type="checkbox" name="set[gmedia_has_archive]" value="1" <?php checked( $gmGallery->options['gmedia_has_archive'], '1' ); ?> /> <?php esc_html_e( 'Allow Gmedia Posts Archive page', 'grand-media' ); ?> </label>
|
25 |
</div>
|
26 |
</div>
|
27 |
<div class="form-group">
|
28 |
<div class="checkbox" style="margin:0;">
|
29 |
<input type="hidden" name="set[gmedia_exclude_from_search]" value="0"/>
|
30 |
+
<label><input type="checkbox" name="set[gmedia_exclude_from_search]" value="1" <?php checked( $gmGallery->options['gmedia_exclude_from_search'], '1' ); ?> /> <?php esc_html_e( 'Exclude Gmedia Library Items from WordPress search results on the Frontend', 'grand-media' ); ?> </label>
|
31 |
</div>
|
32 |
</div>
|
33 |
<div class="form-group">
|
34 |
+
<label><?php esc_html_e( 'Default comment status for new gmedia items', 'grand-media' ); ?>:</label>
|
35 |
<select name="set[default_gmedia_comment_status]" class="form-control input-sm">
|
36 |
+
<option value="open" <?php selected( $gmGallery->options['default_gmedia_comment_status'], 'open' ); ?>><?php esc_html_e( 'Open', 'grand-media' ); ?></option>
|
37 |
+
<option value="closed" <?php selected( $gmGallery->options['default_gmedia_comment_status'], 'closed' ); ?>><?php esc_html_e( 'Closed', 'grand-media' ); ?></option>
|
38 |
</select>
|
39 |
|
40 |
+
<p class="help-block"><?php esc_html_e( '(These setting may be overridden for individual gmedia items.)', 'grand-media' ); ?></p>
|
41 |
</div>
|
42 |
|
43 |
<hr/>
|
44 |
+
<h4><?php esc_html_e( 'Gmedia Albums', 'grand-media' ); ?></h4>
|
45 |
<div class="form-group">
|
46 |
+
<label><?php esc_html_e( 'Gmedia Album Base', 'grand-media' ); ?>:</label>
|
47 |
<input type="text" name="set[gmedia_album_post_slug]" value="<?php echo esc_attr( $gmGallery->options['gmedia_album_post_slug'] ); ?>" class="form-control input-sm"/>
|
48 |
|
49 |
+
<p class="help-block"><?php esc_html_e( 'Base for gmedia album post url.', 'grand-media' ); ?></p>
|
50 |
</div>
|
51 |
<div class="form-group">
|
52 |
<div class="checkbox" style="margin:0;">
|
53 |
<input type="hidden" name="set[gmedia_album_has_archive]" value="0"/>
|
54 |
+
<label><input type="checkbox" name="set[gmedia_album_has_archive]" value="1" <?php checked( $gmGallery->options['gmedia_album_has_archive'], '1' ); ?> /> <?php esc_html_e( 'Allow Gmedia Albums Archive page', 'grand-media' ); ?> </label>
|
55 |
</div>
|
56 |
</div>
|
57 |
<div class="form-group">
|
58 |
<div class="checkbox" style="margin:0;">
|
59 |
<input type="hidden" name="set[gmedia_album_exclude_from_search]" value="0"/>
|
60 |
+
<label><input type="checkbox" name="set[gmedia_album_exclude_from_search]" value="1" <?php checked( $gmGallery->options['gmedia_album_exclude_from_search'], '1' ); ?> /> <?php esc_html_e( 'Exclude Gmedia Albums from WordPress search results on the Frontend', 'grand-media' ); ?> </label>
|
61 |
</div>
|
62 |
</div>
|
63 |
|
64 |
<hr/>
|
65 |
+
<h4><?php esc_html_e( 'Gmedia Galleries', 'grand-media' ); ?></h4>
|
66 |
<div class="form-group">
|
67 |
+
<label><?php esc_html_e( 'Gmedia Gallery Base', 'grand-media' ); ?>:</label>
|
68 |
<input type="text" name="set[gmedia_gallery_post_slug]" value="<?php echo esc_attr( $gmGallery->options['gmedia_gallery_post_slug'] ); ?>" class="form-control input-sm"/>
|
69 |
|
70 |
+
<p class="help-block"><?php esc_html_e( 'Base for gmedia gallery post url.', 'grand-media' ); ?></p>
|
71 |
</div>
|
72 |
<div class="form-group">
|
73 |
<div class="checkbox" style="margin:0;">
|
74 |
<input type="hidden" name="set[gmedia_gallery_has_archive]" value="0"/>
|
75 |
+
<label><input type="checkbox" name="set[gmedia_gallery_has_archive]" value="1" <?php checked( $gmGallery->options['gmedia_gallery_has_archive'], '1' ); ?> /> <?php esc_html_e( 'Allow Gmedia Galleries Archive page', 'grand-media' ); ?> </label>
|
76 |
</div>
|
77 |
</div>
|
78 |
<div class="form-group">
|
79 |
<div class="checkbox" style="margin:0;">
|
80 |
<input type="hidden" name="set[gmedia_gallery_exclude_from_search]" value="0"/>
|
81 |
+
<label><input type="checkbox" name="set[gmedia_gallery_exclude_from_search]" value="1" <?php checked( $gmGallery->options['gmedia_gallery_exclude_from_search'], '1' ); ?> /> <?php esc_html_e( 'Exclude Gmedia Galleries from WordPress search results on the Frontend', 'grand-media' ); ?>
|
82 |
+
</label>
|
83 |
</div>
|
84 |
</div>
|
85 |
|
86 |
</fieldset>
|
87 |
|
88 |
<fieldset id="gmedia_settings_cloud" class="tab-pane">
|
89 |
+
<p><?php esc_html_e( 'GmediaCloud is full window template to show your galleries, albums and other gmedia content', 'grand-media' ); ?></p>
|
90 |
|
91 |
+
<p><?php esc_html_e( 'Each module can have it\'s own design for GmediaCloud. Here you can set default module wich will be used for sharing Albums, Tags, Categories and single Gmedia Items.', 'grand-media' ); ?></p>
|
92 |
<br/>
|
93 |
|
94 |
<div class="form-group">
|
95 |
+
<label><?php esc_html_e( 'HashID salt for unique template URL', 'grand-media' ); ?>:</label>
|
96 |
<input type="text" name="GmediaHashID_salt" value="<?php echo esc_attr( get_option( 'GmediaHashID_salt' ) ); ?>" class="form-control input-sm"/>
|
97 |
|
98 |
+
<p class="help-block"><?php esc_html_e( 'Changing this string you\'ll change Gmedia template URLs.', 'grand-media' ); ?></p>
|
99 |
</div>
|
100 |
<div class="form-group">
|
101 |
+
<label><?php esc_html_e( 'Permalink Endpoint (GmediaCloud base)', 'grand-media' ); ?>:</label>
|
102 |
<input type="text" name="set[endpoint]" value="<?php echo esc_attr( $gmGallery->options['endpoint'] ); ?>" class="form-control input-sm"/>
|
103 |
|
104 |
+
<p class="help-block"><?php esc_html_e( 'Changing endpoint you\'ll change Gmedia template URLs.', 'grand-media' ); ?></p>
|
105 |
</div>
|
106 |
<div class="form-group">
|
107 |
+
<label><?php esc_html_e( 'Top Bar Social Buttons', 'grand-media' ); ?></label>
|
108 |
<select name="set[gmediacloud_socialbuttons]" class="form-control input-sm">
|
109 |
+
<option value="1" <?php selected( $gmGallery->options['gmediacloud_socialbuttons'], '1' ); ?>><?php esc_html_e( 'Show Social Buttons', 'grand-media' ); ?></option>
|
110 |
+
<option value="0" <?php selected( $gmGallery->options['gmediacloud_socialbuttons'], '0' ); ?>><?php esc_html_e( 'Hide Social Buttons', 'grand-media' ); ?></option>
|
111 |
</select>
|
112 |
</div>
|
113 |
<div class="form-group">
|
114 |
+
<label><?php esc_html_e( 'Additional JS code for GmediaCloud Page', 'grand-media' ); ?>:</label>
|
115 |
+
<textarea name="set[gmediacloud_footer_js]" rows="4" cols="20" class="form-control input-sm"><?php echo esc_html( stripslashes( $gmGallery->options['gmediacloud_footer_js'] ) ); ?></textarea>
|
116 |
</div>
|
117 |
<div class="form-group">
|
118 |
+
<label><?php esc_html_e( 'Additional CSS code for GmediaCloud Page', 'grand-media' ); ?>:</label>
|
119 |
+
<textarea name="set[gmediacloud_footer_css]" rows="4" cols="20" class="form-control input-sm"><?php echo esc_html( stripslashes( $gmGallery->options['gmediacloud_footer_css'] ) ); ?></textarea>
|
120 |
</div>
|
121 |
</fieldset>
|
admin/pages/settings/tpl/roles.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Capabilities Manager
|
@@ -11,118 +8,118 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
11 |
*/
|
12 |
?>
|
13 |
<fieldset id="gmedia_settings_roles" class="tab-pane">
|
14 |
-
<p><?php
|
15 |
|
16 |
<div class="form-group">
|
17 |
-
<label><?php
|
18 |
<select name="capability[gmedia_library]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_library' ) ); ?></select>
|
19 |
|
20 |
-
<p class="help-block"><?php
|
21 |
</div>
|
22 |
<hr/>
|
23 |
|
24 |
<div class="form-group">
|
25 |
-
<label><?php
|
26 |
<select name="capability[gmedia_upload]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_upload' ) ); ?></select>
|
27 |
|
28 |
-
<p class="help-block"><?php
|
29 |
</div>
|
30 |
<div class="col-xs-offset-1">
|
31 |
<div class="form-group">
|
32 |
-
<label><?php
|
33 |
<select name="capability[gmedia_import]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_import' ) ); ?></select>
|
34 |
|
35 |
-
<p class="help-block"><?php
|
36 |
</div>
|
37 |
</div>
|
38 |
|
39 |
<div class="form-group">
|
40 |
-
<label><?php
|
41 |
<select name="capability[gmedia_show_others_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_show_others_media' ) ); ?></select>
|
42 |
|
43 |
-
<p class="help-block"><?php
|
44 |
</div>
|
45 |
<div class="form-group">
|
46 |
-
<label><?php
|
47 |
<select name="capability[gmedia_edit_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_edit_media' ) ); ?></select>
|
48 |
|
49 |
-
<p class="help-block"><?php
|
50 |
</div>
|
51 |
<div class="col-xs-offset-1">
|
52 |
<div class="form-group">
|
53 |
-
<label><?php
|
54 |
<select name="capability[gmedia_edit_others_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_edit_others_media' ) ); ?></select>
|
55 |
|
56 |
-
<p class="help-block"><?php
|
57 |
</div>
|
58 |
</div>
|
59 |
<div class="form-group">
|
60 |
-
<label><?php
|
61 |
<select name="capability[gmedia_delete_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_delete_media' ) ); ?></select>
|
62 |
|
63 |
-
<p class="help-block"><?php
|
64 |
</div>
|
65 |
<div class="col-xs-offset-1">
|
66 |
<div class="form-group">
|
67 |
-
<label><?php
|
68 |
<select name="capability[gmedia_delete_others_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_delete_others_media' ) ); ?></select>
|
69 |
|
70 |
-
<p class="help-block"><?php
|
71 |
</div>
|
72 |
</div>
|
73 |
|
74 |
<div class="form-group">
|
75 |
-
<label><?php
|
76 |
<select name="capability[gmedia_terms]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_terms' ) ); ?></select>
|
77 |
|
78 |
-
<p class="help-block"><?php
|
79 |
</div>
|
80 |
<div class="col-xs-offset-1">
|
81 |
<div class="form-group">
|
82 |
-
<label><?php
|
83 |
<select name="capability[gmedia_album_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_album_manage' ) ); ?></select>
|
84 |
|
85 |
-
<p class="help-block"><?php
|
86 |
</div>
|
87 |
<div class="form-group">
|
88 |
-
<label><?php
|
89 |
<select name="capability[gmedia_category_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_category_manage' ) ); ?></select>
|
90 |
|
91 |
-
<p class="help-block"><?php
|
92 |
</div>
|
93 |
<div class="form-group">
|
94 |
-
<label><?php
|
95 |
<select name="capability[gmedia_tag_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_tag_manage' ) ); ?></select>
|
96 |
|
97 |
-
<p class="help-block"><?php
|
98 |
</div>
|
99 |
<div class="form-group">
|
100 |
-
<label><?php
|
101 |
<select name="capability[gmedia_terms_delete]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_terms_delete' ) ); ?></select>
|
102 |
|
103 |
-
<p class="help-block"><?php
|
104 |
</div>
|
105 |
</div>
|
106 |
|
107 |
<div class="form-group">
|
108 |
-
<label><?php
|
109 |
<select name="capability[gmedia_gallery_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_gallery_manage' ) ); ?></select>
|
110 |
|
111 |
-
<p class="help-block"><?php
|
112 |
</div>
|
113 |
|
114 |
<div class="form-group">
|
115 |
-
<label><?php
|
116 |
<select name="capability[gmedia_module_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_module_manage' ) ); ?></select>
|
117 |
|
118 |
-
<p class="help-block"><?php
|
119 |
</div>
|
120 |
|
121 |
<div class="form-group">
|
122 |
-
<label><?php
|
123 |
<select name="capability[gmedia_settings]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_settings' ) ); ?></select>
|
124 |
|
125 |
-
<p class="help-block"><?php
|
126 |
</div>
|
127 |
|
128 |
</fieldset>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Capabilities Manager
|
8 |
*/
|
9 |
?>
|
10 |
<fieldset id="gmedia_settings_roles" class="tab-pane">
|
11 |
+
<p><?php esc_html_e( /** @lang text */ 'Select the lowest role which should be able to access the follow capabilities. Gmedia Gallery supports the standard roles from WordPress.', 'grand-media' ); ?></p>
|
12 |
|
13 |
<div class="form-group">
|
14 |
+
<label><?php esc_html_e( 'Gmedia Library', 'grand-media' ); ?>:</label>
|
15 |
<select name="capability[gmedia_library]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_library' ) ); ?></select>
|
16 |
|
17 |
+
<p class="help-block"><?php esc_html_e( 'Who can view Gmedia Gallery admin pages', 'grand-media' ); ?></p>
|
18 |
</div>
|
19 |
<hr/>
|
20 |
|
21 |
<div class="form-group">
|
22 |
+
<label><?php esc_html_e( 'Upload Media Files', 'grand-media' ); ?>:</label>
|
23 |
<select name="capability[gmedia_upload]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_upload' ) ); ?></select>
|
24 |
|
25 |
+
<p class="help-block"><?php esc_html_e( 'Who can upload files to Gmedia Library', 'grand-media' ); ?></p>
|
26 |
</div>
|
27 |
<div class="col-xs-offset-1">
|
28 |
<div class="form-group">
|
29 |
+
<label><?php esc_html_e( 'Import Media Files', 'grand-media' ); ?>:</label>
|
30 |
<select name="capability[gmedia_import]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_import' ) ); ?></select>
|
31 |
|
32 |
+
<p class="help-block"><?php esc_html_e( 'Who can import files to Gmedia Library', 'grand-media' ); ?></p>
|
33 |
</div>
|
34 |
</div>
|
35 |
|
36 |
<div class="form-group">
|
37 |
+
<label><?php esc_html_e( 'Show Others Media in Library', 'grand-media' ); ?>:</label>
|
38 |
<select name="capability[gmedia_show_others_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_show_others_media' ) ); ?></select>
|
39 |
|
40 |
+
<p class="help-block"><?php esc_html_e( 'Who can see files uploaded by other users. Also this setting allows to see private media when user logged in.', 'grand-media' ); ?></p>
|
41 |
</div>
|
42 |
<div class="form-group">
|
43 |
+
<label><?php esc_html_e( 'Edit Media', 'grand-media' ); ?>:</label>
|
44 |
<select name="capability[gmedia_edit_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_edit_media' ) ); ?></select>
|
45 |
|
46 |
+
<p class="help-block"><?php esc_html_e( 'Who can edit media title, description and other properties of uploaded files', 'grand-media' ); ?></p>
|
47 |
</div>
|
48 |
<div class="col-xs-offset-1">
|
49 |
<div class="form-group">
|
50 |
+
<label><?php esc_html_e( 'Edit Others Media', 'grand-media' ); ?>:</label>
|
51 |
<select name="capability[gmedia_edit_others_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_edit_others_media' ) ); ?></select>
|
52 |
|
53 |
+
<p class="help-block"><?php esc_html_e( 'Who can edit files, albums/tags and galleries of other users', 'grand-media' ); ?></p>
|
54 |
</div>
|
55 |
</div>
|
56 |
<div class="form-group">
|
57 |
+
<label><?php esc_html_e( 'Delete Media', 'grand-media' ); ?>:</label>
|
58 |
<select name="capability[gmedia_delete_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_delete_media' ) ); ?></select>
|
59 |
|
60 |
+
<p class="help-block"><?php esc_html_e( 'Who can delete uploaded files from Gmedia Library', 'grand-media' ); ?></p>
|
61 |
</div>
|
62 |
<div class="col-xs-offset-1">
|
63 |
<div class="form-group">
|
64 |
+
<label><?php esc_html_e( 'Delete Others Media', 'grand-media' ); ?>:</label>
|
65 |
<select name="capability[gmedia_delete_others_media]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_delete_others_media' ) ); ?></select>
|
66 |
|
67 |
+
<p class="help-block"><?php esc_html_e( 'Who can delete files, albums/tags and galleries of other users', 'grand-media' ); ?></p>
|
68 |
</div>
|
69 |
</div>
|
70 |
|
71 |
<div class="form-group">
|
72 |
+
<label><?php esc_html_e( 'Albums, Tags...', 'grand-media' ); ?>:</label>
|
73 |
<select name="capability[gmedia_terms]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_terms' ) ); ?></select>
|
74 |
|
75 |
+
<p class="help-block"><?php esc_html_e( 'Who can assign available terms to media files', 'grand-media' ); ?></p>
|
76 |
</div>
|
77 |
<div class="col-xs-offset-1">
|
78 |
<div class="form-group">
|
79 |
+
<label><?php esc_html_e( 'Manage Albums', 'grand-media' ); ?>:</label>
|
80 |
<select name="capability[gmedia_album_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_album_manage' ) ); ?></select>
|
81 |
|
82 |
+
<p class="help-block"><?php esc_html_e( 'Who can create and edit own albums. It is required "Edit Others Media" capability to edit others and shared albums', 'grand-media' ); ?></p>
|
83 |
</div>
|
84 |
<div class="form-group">
|
85 |
+
<label><?php esc_html_e( 'Manage Categories', 'grand-media' ); ?>:</label>
|
86 |
<select name="capability[gmedia_category_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_category_manage' ) ); ?></select>
|
87 |
|
88 |
+
<p class="help-block"><?php esc_html_e( 'Who can create new categories. It is required "Edit Others Media" capability to edit categories', 'grand-media' ); ?></p>
|
89 |
</div>
|
90 |
<div class="form-group">
|
91 |
+
<label><?php esc_html_e( 'Manage Tags', 'grand-media' ); ?>:</label>
|
92 |
<select name="capability[gmedia_tag_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_tag_manage' ) ); ?></select>
|
93 |
|
94 |
+
<p class="help-block"><?php esc_html_e( 'Who can create new tags. It is required "Edit Others Media" capability to edit tags', 'grand-media' ); ?></p>
|
95 |
</div>
|
96 |
<div class="form-group">
|
97 |
+
<label><?php esc_html_e( 'Delete Terms', 'grand-media' ); ?>:</label>
|
98 |
<select name="capability[gmedia_terms_delete]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_terms_delete' ) ); ?></select>
|
99 |
|
100 |
+
<p class="help-block"><?php esc_html_e( 'Who can delete own albums. It is required "Delete Others Media" capability to delete others terms', 'grand-media' ); ?></p>
|
101 |
</div>
|
102 |
</div>
|
103 |
|
104 |
<div class="form-group">
|
105 |
+
<label><?php esc_html_e( 'Galleries', 'grand-media' ); ?>:</label>
|
106 |
<select name="capability[gmedia_gallery_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_gallery_manage' ) ); ?></select>
|
107 |
|
108 |
+
<p class="help-block"><?php esc_html_e( 'Who can create, edit and delete own galleries', 'grand-media' ); ?></p>
|
109 |
</div>
|
110 |
|
111 |
<div class="form-group">
|
112 |
+
<label><?php esc_html_e( 'Modules', 'grand-media' ); ?>:</label>
|
113 |
<select name="capability[gmedia_module_manage]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_module_manage' ) ); ?></select>
|
114 |
|
115 |
+
<p class="help-block"><?php esc_html_e( 'Who can manage modules', 'grand-media' ); ?></p>
|
116 |
</div>
|
117 |
|
118 |
<div class="form-group">
|
119 |
+
<label><?php esc_html_e( 'Settings', 'grand-media' ); ?>:</label>
|
120 |
<select name="capability[gmedia_settings]" class="form-control input-sm"><?php wp_dropdown_roles( $gmDB->get_role( 'gmedia_settings' ) ); ?></select>
|
121 |
|
122 |
+
<p class="help-block"><?php esc_html_e( 'Who can change settings. Note: Capabilites can be changed only by administrator', 'grand-media' ); ?></p>
|
123 |
</div>
|
124 |
|
125 |
</fieldset>
|
admin/pages/settings/tpl/system.php
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
|
|
7 |
/**
|
8 |
* System info (under construction)
|
9 |
*/
|
@@ -13,11 +11,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
if ( ( function_exists( 'memory_get_usage' ) ) && ( ini_get( 'memory_limit' ) ) ) {
|
14 |
$memory_limit = ini_get( 'memory_limit' );
|
15 |
$memory_usage = round( memory_get_usage() / ( 1024 * 1024 ), 1 );
|
16 |
-
echo '<p>' . __( 'PHP Memory Limit: ', 'grand-media' ) . $memory_limit . '</p>';
|
17 |
-
echo '<p>' . __( 'PHP Memory Used: ', 'grand-media' ) . $memory_usage . 'M</p>';
|
18 |
}
|
19 |
?>
|
20 |
-
<p><?php
|
21 |
|
22 |
<?php
|
23 |
if ( $gmCore->_get( 'showdb' ) ) {
|
@@ -28,10 +26,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
$images['grand-media'] = glob( $gmCore->upload['path'] . '/*', GLOB_NOSORT );
|
29 |
$images['images'] = glob( $gmCore->upload['path'] . '/image/*', GLOB_NOSORT );
|
30 |
$images['thumbs'] = glob( $gmCore->upload['path'] . '/thumb/*', GLOB_NOSORT );
|
31 |
-
echo '<pre style="max-height:400px; overflow:auto;">' . print_r( $gmedia, true ) . '</pre>';
|
32 |
-
echo '<pre style="max-height:400px; overflow:auto;">' . print_r( $images, true ) . '</pre>';
|
33 |
-
echo '<pre style="max-height:400px; overflow:auto;">' . print_r( $terms, true ) . '</pre>';
|
34 |
-
echo '<pre style="max-height:400px; overflow:auto;">' . print_r( $relation, true ) . '</pre>';
|
35 |
}
|
36 |
?>
|
37 |
</fieldset>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
+
global $gmCore
|
5 |
/**
|
6 |
* System info (under construction)
|
7 |
*/
|
11 |
if ( ( function_exists( 'memory_get_usage' ) ) && ( ini_get( 'memory_limit' ) ) ) {
|
12 |
$memory_limit = ini_get( 'memory_limit' );
|
13 |
$memory_usage = round( memory_get_usage() / ( 1024 * 1024 ), 1 );
|
14 |
+
echo '<p>' . esc_html( __( 'PHP Memory Limit: ', 'grand-media' ) . $memory_limit ) . '</p>';
|
15 |
+
echo '<p>' . esc_html( __( 'PHP Memory Used: ', 'grand-media' ) . $memory_usage ) . 'M</p>';
|
16 |
}
|
17 |
?>
|
18 |
+
<p><?php esc_html_e( 'Under construction...', 'grand-media' ); ?></p>
|
19 |
|
20 |
<?php
|
21 |
if ( $gmCore->_get( 'showdb' ) ) {
|
26 |
$images['grand-media'] = glob( $gmCore->upload['path'] . '/*', GLOB_NOSORT );
|
27 |
$images['images'] = glob( $gmCore->upload['path'] . '/image/*', GLOB_NOSORT );
|
28 |
$images['thumbs'] = glob( $gmCore->upload['path'] . '/thumb/*', GLOB_NOSORT );
|
29 |
+
echo '<pre style="max-height:400px; overflow:auto;">' . esc_html( print_r( $gmedia, true ) ) . '</pre>';
|
30 |
+
echo '<pre style="max-height:400px; overflow:auto;">' . esc_html( print_r( $images, true ) ) . '</pre>';
|
31 |
+
echo '<pre style="max-height:400px; overflow:auto;">' . esc_html( print_r( $terms, true ) ) . '</pre>';
|
32 |
+
echo '<pre style="max-height:400px; overflow:auto;">' . esc_html( print_r( $relation, true ) ) . '</pre>';
|
33 |
}
|
34 |
?>
|
35 |
</fieldset>
|
admin/pages/terms/edit-term.php
CHANGED
@@ -3,15 +3,12 @@
|
|
3 |
* Gmedia Term (Album, Category) Edit
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
12 |
|
13 |
$term_id = $gmCore->_get( 'edit_term' );
|
14 |
-
$gmedia_url = add_query_arg(
|
15 |
$gmedia_user_options = $gmProcessor->user_options;
|
16 |
$gmedia_term_taxonomy = $gmProcessor->taxonomy;
|
17 |
$taxterm = $gmProcessor->taxterm;
|
@@ -35,21 +32,21 @@ do_action( 'gmedia_term_before_panel' );
|
|
35 |
if ( 'album' === $taxterm ) {
|
36 |
$_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_module_preset'][0] : '';
|
37 |
$_module = $gmCore->getModulePreset( $_module_preset );
|
38 |
-
$limitation = empty( $gmGallery->options['license_key'] ) && in_array( $_module['module'],
|
39 |
if ( $limitation ) {
|
40 |
?>
|
41 |
-
<div style="overflow:hidden; margin-bottom: 6px; padding: 10px; background-color: #fff; border: 1px solid red; border-radius: 5px; font-size: 14px; font-weight: bold;"><?php
|
42 |
<?php
|
43 |
}
|
44 |
}
|
45 |
?>
|
46 |
|
47 |
-
<div class="
|
48 |
|
49 |
<?php
|
50 |
-
|
51 |
|
52 |
-
|
53 |
?>
|
54 |
|
55 |
</div>
|
3 |
* Gmedia Term (Album, Category) Edit
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
9 |
|
10 |
$term_id = $gmCore->_get( 'edit_term' );
|
11 |
+
$gmedia_url = add_query_arg( array( 'edit_term' => $term_id ), $gmProcessor->url );
|
12 |
$gmedia_user_options = $gmProcessor->user_options;
|
13 |
$gmedia_term_taxonomy = $gmProcessor->taxonomy;
|
14 |
$taxterm = $gmProcessor->taxterm;
|
32 |
if ( 'album' === $taxterm ) {
|
33 |
$_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_module_preset'][0] : '';
|
34 |
$_module = $gmCore->getModulePreset( $_module_preset );
|
35 |
+
$limitation = empty( $gmGallery->options['license_key'] ) && in_array( $_module['module'], array( 'amron', 'phantom', 'cubik-lite', 'photomania', 'wp-videoplayer', 'jq-mplayer', 'minima' ), true );
|
36 |
if ( $limitation ) {
|
37 |
?>
|
38 |
+
<div style="overflow:hidden; margin-bottom: 6px; padding: 10px; background-color: #fff; border: 1px solid red; border-radius: 5px; font-size: 14px; font-weight: bold;"><?php echo wp_kses_post( __( 'Note: Free version allows you to show maximum 40 images per gallery on the frontend. Purchase license key <a href="https://codeasily.com/gmedia-premium/" target="_blank">here</a>. It\'s a one time payment.', 'grand-media' ) ); ?></div>
|
39 |
<?php
|
40 |
}
|
41 |
}
|
42 |
?>
|
43 |
|
44 |
+
<div class="card m-0 mb-3 mw-100 p-0 panel-fixed-header">
|
45 |
|
46 |
<?php
|
47 |
+
require dirname( __FILE__ ) . '/tpl/term-panel-heading.php';
|
48 |
|
49 |
+
require dirname( __FILE__ ) . "/tpl/{$taxterm}-edit-item.php";
|
50 |
?>
|
51 |
|
52 |
</div>
|
admin/pages/terms/functions.php
CHANGED
@@ -25,20 +25,20 @@ function gmedia_term_item_thumbnails( $term_item, $qty = 7 ) {
|
|
25 |
$order = 'DESC';
|
26 |
break;
|
27 |
}
|
28 |
-
$args =
|
29 |
'no_found_rows' => true,
|
30 |
'per_page' => $qty,
|
31 |
-
$term__in =>
|
32 |
'author' => gm_user_can( 'show_others_media' ) ? 0 : get_current_user_id(),
|
33 |
'orderby' => isset( $term_item->meta['_orderby'][0] ) ? $term_item->meta['_orderby'][0] : $orderby,
|
34 |
'order' => isset( $term_item->meta['_order'][0] ) ? $term_item->meta['_order'][0] : $order,
|
35 |
-
|
36 |
|
37 |
$gmedias = $gmDB->get_gmedias( $args );
|
38 |
if ( ! empty( $gmedias ) ) {
|
39 |
foreach ( $gmedias as $gmedia_item ) {
|
40 |
?>
|
41 |
-
<img style="z-index:<?php echo $qty --; ?>;" src="<?php echo esc_url( $gmCore->gm_get_media_image( $gmedia_item, 'thumb', false ) ); ?>" alt="<?php echo esc_attr( $gmedia_item->ID ); ?>" title="<?php echo esc_attr( $gmedia_item->title ); ?>"/>
|
42 |
<?php
|
43 |
}
|
44 |
}
|
@@ -55,33 +55,45 @@ function gmedia_term_item_actions( $item ) {
|
|
55 |
global $gmCore, $gmProcessor;
|
56 |
|
57 |
$taxterm = $gmProcessor->taxterm;
|
58 |
-
$actions =
|
59 |
|
60 |
//$actions['shortcode'] = '<div class="term-shortcode"><input type="text" readonly value="[gm ' . $taxterm . '=' . $item->term_id . ']"><div class="input-buffer"></div></div>';
|
61 |
|
62 |
-
$filter_href = $gmCore->get_admin_url(
|
63 |
$filter_class = 'gm_filter_in_lib';
|
64 |
$count = '';
|
65 |
-
if ( in_array( $item->taxonomy,
|
66 |
-
$count = '<span class="gm_term_count">' . $item->count . '</span>';
|
67 |
if ( ! $item->count ) {
|
68 |
$filter_class .= ' action-inactive';
|
69 |
}
|
70 |
}
|
71 |
-
$actions['filter'] = '<a title="' .
|
72 |
|
73 |
-
$share_icon = '<
|
74 |
if ( 'draft' !== $item->status ) {
|
75 |
-
$actions['share'] = '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="text-warning share-modal" title="' .
|
76 |
} else {
|
77 |
-
$actions['share'] = '<span class="action-inactive">' . $share_icon . ' ' . __( 'Share', 'grand-media' ) . '</span>';
|
78 |
}
|
79 |
|
80 |
-
$trash_icon = '<
|
81 |
if ( $item->allow_delete ) {
|
82 |
-
$actions['delete'] = '<a class="trash-icon" title="' .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
} else {
|
84 |
-
$actions['delete'] =
|
85 |
}
|
86 |
|
87 |
return apply_filters( 'gmedia_term_item_actions', $actions );
|
@@ -107,13 +119,14 @@ add_action( 'gmedia_term_album_after_panel', 'gmedia_term_album_after_panel' );
|
|
107 |
function gmedia_term_album_after_panel( $term ) {
|
108 |
global $gmCore, $gmProcessor, $gmProcessorLibrary;
|
109 |
|
110 |
-
$taxin
|
|
|
111 |
$gmProcessorLibrary->query_args['terms_relation'] = 'AND';
|
112 |
if ( ! empty( $gmProcessorLibrary->query_args[ $taxin ] ) ) {
|
113 |
-
$gmProcessorLibrary->query_args["{$gmProcessor->taxterm}__and"] = wp_parse_id_list( array_merge( $gmProcessorLibrary->query_args[ $taxin ],
|
114 |
unset( $gmProcessorLibrary->query_args[ $taxin ] );
|
115 |
} else {
|
116 |
-
$gmProcessorLibrary->query_args[ $taxin ] =
|
117 |
}
|
118 |
$gmProcessorLibrary->display_mode = 'grid';
|
119 |
|
@@ -121,14 +134,14 @@ function gmedia_term_album_after_panel( $term ) {
|
|
121 |
|
122 |
$atts = 'class="gmedia_term__in"';
|
123 |
if ( isset( $term->meta['_orderby'][0] ) && ( 'custom' === $term->meta['_orderby'][0] ) ) {
|
124 |
-
$atts .= ' id="gm-sortable" data-term_id="' . $term->term_id . '" data-action="gmedia_term_sortorder" data-_wpnonce_terms="' . wp_create_nonce( 'gmedia_terms' ) . '"';
|
125 |
add_action( 'before_gmedia_filter_message', 'before_gmedia_filter_message' );
|
126 |
} else {
|
127 |
add_action( 'before_gmedia_filter_message', 'before_gmedia_filter_message2' );
|
128 |
}
|
129 |
-
echo
|
130 |
-
echo $gmCore->alert( 'success', $gmProcessor->msg );
|
131 |
-
echo $gmCore->alert( 'danger', $gmProcessor->error );
|
132 |
include GMEDIA_ABSPATH . 'admin/pages/library/library.php';
|
133 |
echo '</div>';
|
134 |
}
|
@@ -136,36 +149,36 @@ function gmedia_term_album_after_panel( $term ) {
|
|
136 |
function before_gmedia_filter_message() {
|
137 |
global $gmProcessorLibrary;
|
138 |
if ( empty( $gmProcessorLibrary->dbfilter ) ) {
|
139 |
-
echo '<div class="custom-message alert alert-info">' .
|
140 |
} else {
|
141 |
-
echo '<div class="custom-message alert alert-warning">' .
|
142 |
}
|
143 |
}
|
144 |
|
145 |
function before_gmedia_filter_message2() {
|
146 |
-
echo '<div class="custom-message alert alert-info">' .
|
147 |
}
|
148 |
|
149 |
add_action( 'gmedia_term_category_after_panel', 'gmedia_term_category_after_panel' );
|
150 |
function gmedia_term_category_after_panel( $term ) {
|
151 |
global $gmCore, $gmProcessor, $gmProcessorLibrary;
|
152 |
|
153 |
-
$taxin
|
|
|
154 |
$gmProcessorLibrary->query_args['terms_relation'] = 'AND';
|
155 |
if ( ! empty( $gmProcessorLibrary->query_args[ $taxin ] ) ) {
|
156 |
-
$gmProcessorLibrary->query_args["{$gmProcessor->taxterm}__and"] = wp_parse_id_list( array_merge( $gmProcessorLibrary->query_args[ $taxin ],
|
157 |
unset( $gmProcessorLibrary->query_args[ $taxin ] );
|
158 |
} else {
|
159 |
-
$gmProcessorLibrary->query_args[ $taxin ] =
|
160 |
}
|
161 |
$gmProcessorLibrary->display_mode = 'grid';
|
162 |
|
163 |
$gmProcessor = $gmProcessorLibrary;
|
164 |
|
165 |
-
|
166 |
-
echo
|
167 |
-
echo $gmCore->alert( '
|
168 |
-
|
169 |
-
include( GMEDIA_ABSPATH . 'admin/pages/library/library.php' );
|
170 |
echo '</div>';
|
171 |
}
|
25 |
$order = 'DESC';
|
26 |
break;
|
27 |
}
|
28 |
+
$args = array(
|
29 |
'no_found_rows' => true,
|
30 |
'per_page' => $qty,
|
31 |
+
$term__in => array( $term_item->term_id ),
|
32 |
'author' => gm_user_can( 'show_others_media' ) ? 0 : get_current_user_id(),
|
33 |
'orderby' => isset( $term_item->meta['_orderby'][0] ) ? $term_item->meta['_orderby'][0] : $orderby,
|
34 |
'order' => isset( $term_item->meta['_order'][0] ) ? $term_item->meta['_order'][0] : $order,
|
35 |
+
);
|
36 |
|
37 |
$gmedias = $gmDB->get_gmedias( $args );
|
38 |
if ( ! empty( $gmedias ) ) {
|
39 |
foreach ( $gmedias as $gmedia_item ) {
|
40 |
?>
|
41 |
+
<img style="z-index:<?php echo (int) $qty --; ?>;" src="<?php echo esc_url( $gmCore->gm_get_media_image( $gmedia_item, 'thumb', false ) ); ?>" alt="<?php echo esc_attr( $gmedia_item->ID ); ?>" title="<?php echo esc_attr( $gmedia_item->title ); ?>"/>
|
42 |
<?php
|
43 |
}
|
44 |
}
|
55 |
global $gmCore, $gmProcessor;
|
56 |
|
57 |
$taxterm = $gmProcessor->taxterm;
|
58 |
+
$actions = array();
|
59 |
|
60 |
//$actions['shortcode'] = '<div class="term-shortcode"><input type="text" readonly value="[gm ' . $taxterm . '=' . $item->term_id . ']"><div class="input-buffer"></div></div>';
|
61 |
|
62 |
+
$filter_href = $gmCore->get_admin_url( array( 'page' => 'GrandMedia', "{$taxterm}__in" => $item->term_id ), array(), true );
|
63 |
$filter_class = 'gm_filter_in_lib';
|
64 |
$count = '';
|
65 |
+
if ( in_array( $item->taxonomy, array( 'gmedia_album', 'gmedia_tag', 'gmedia_category' ), true ) ) {
|
66 |
+
$count = '<span class="gm_term_count">' . intval( $item->count ) . '</span>';
|
67 |
if ( ! $item->count ) {
|
68 |
$filter_class .= ' action-inactive';
|
69 |
}
|
70 |
}
|
71 |
+
$actions['filter'] = '<a title="' . esc_html__( 'Filter in Gmedia Library', 'grand-media' ) . '" href="' . esc_url( $filter_href ) . '" class="' . esc_attr( $filter_class ) . '">' . $count . '<i class="fa-solid fa-filter"></i></a>';
|
72 |
|
73 |
+
$share_icon = '<i class="fa-solid fa-share-from-square"></i>';
|
74 |
if ( 'draft' !== $item->status ) {
|
75 |
+
$actions['share'] = '<a target="_blank" data-bs-toggle="modal" data-bs-target="#shareModal" data-share="' . esc_attr( $item->term_id ) . '" class="text-warning share-modal" title="' . esc_attr__( 'Share', 'grand-media' ) . '" data-gmediacloud="' . esc_url( $item->cloud_link ) . '" href="' . esc_url( $item->post_link ) . '">' . wp_kses_post( $share_icon . ' ' . __( 'Share', 'grand-media' ) ) . '</a>';
|
76 |
} else {
|
77 |
+
$actions['share'] = '<span class="action-inactive">' . wp_kses_post( $share_icon . ' ' . __( 'Share', 'grand-media' ) ) . '</span>';
|
78 |
}
|
79 |
|
80 |
+
$trash_icon = '<i class="fa-solid fa-trash-can"></i>';
|
81 |
if ( $item->allow_delete ) {
|
82 |
+
$actions['delete'] = '<a class="trash-icon" title="' . esc_attr__( 'Delete', 'grand-media' ) . '" href="' . esc_url(
|
83 |
+
wp_nonce_url(
|
84 |
+
add_query_arg(
|
85 |
+
array(
|
86 |
+
'do_gmedia_terms' => 'delete',
|
87 |
+
'ids' => $item->term_id,
|
88 |
+
),
|
89 |
+
$gmProcessor->url
|
90 |
+
),
|
91 |
+
'gmedia_delete',
|
92 |
+
'_wpnonce_delete'
|
93 |
+
)
|
94 |
+
) . '" data-confirm="' . esc_attr__( "You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ) . '">' . wp_kses_post( $trash_icon ) . '</a>';
|
95 |
} else {
|
96 |
+
$actions['delete'] = '<span class="action-inactive">' . wp_kses_post( $trash_icon ) . '</span>';
|
97 |
}
|
98 |
|
99 |
return apply_filters( 'gmedia_term_item_actions', $actions );
|
119 |
function gmedia_term_album_after_panel( $term ) {
|
120 |
global $gmCore, $gmProcessor, $gmProcessorLibrary;
|
121 |
|
122 |
+
$taxin = "{$gmProcessor->taxterm}__in";
|
123 |
+
|
124 |
$gmProcessorLibrary->query_args['terms_relation'] = 'AND';
|
125 |
if ( ! empty( $gmProcessorLibrary->query_args[ $taxin ] ) ) {
|
126 |
+
$gmProcessorLibrary->query_args["{$gmProcessor->taxterm}__and"] = wp_parse_id_list( array_merge( $gmProcessorLibrary->query_args[ $taxin ], array( $term->term_id ) ) );
|
127 |
unset( $gmProcessorLibrary->query_args[ $taxin ] );
|
128 |
} else {
|
129 |
+
$gmProcessorLibrary->query_args[ $taxin ] = array( (int) $term->term_id );
|
130 |
}
|
131 |
$gmProcessorLibrary->display_mode = 'grid';
|
132 |
|
134 |
|
135 |
$atts = 'class="gmedia_term__in"';
|
136 |
if ( isset( $term->meta['_orderby'][0] ) && ( 'custom' === $term->meta['_orderby'][0] ) ) {
|
137 |
+
$atts .= ' id="gm-sortable" data-term_id="' . esc_attr( $term->term_id ) . '" data-action="gmedia_term_sortorder" data-_wpnonce_terms="' . esc_attr( wp_create_nonce( 'gmedia_terms' ) ) . '"';
|
138 |
add_action( 'before_gmedia_filter_message', 'before_gmedia_filter_message' );
|
139 |
} else {
|
140 |
add_action( 'before_gmedia_filter_message', 'before_gmedia_filter_message2' );
|
141 |
}
|
142 |
+
echo '<div ' . wp_kses_data( $atts ) . '>';
|
143 |
+
echo wp_kses_post( $gmCore->alert( 'success', $gmProcessor->msg ) );
|
144 |
+
echo wp_kses_post( $gmCore->alert( 'danger', $gmProcessor->error ) );
|
145 |
include GMEDIA_ABSPATH . 'admin/pages/library/library.php';
|
146 |
echo '</div>';
|
147 |
}
|
149 |
function before_gmedia_filter_message() {
|
150 |
global $gmProcessorLibrary;
|
151 |
if ( empty( $gmProcessorLibrary->dbfilter ) ) {
|
152 |
+
echo '<div class="custom-message alert alert-info">' . esc_html__( "You can drag'n'drop items below to reorder. Order saves automatically after you drop the item. Also you can set order position number manually when edit item.", 'grand-media' ) . '</div>';
|
153 |
} else {
|
154 |
+
echo '<div class="custom-message alert alert-warning">' . esc_html__( "Drag'n'drop functionality disabled. Reset filters to enable drag'n'drop.", 'grand-media' ) . '</div>';
|
155 |
}
|
156 |
}
|
157 |
|
158 |
function before_gmedia_filter_message2() {
|
159 |
+
echo '<div class="custom-message alert alert-info">' . esc_html__( "To enable drag'n'drop to reorder functionality for items you must update album's `Order gmedia` field to `Custom Order`.", 'grand-media' ) . '</div>';
|
160 |
}
|
161 |
|
162 |
add_action( 'gmedia_term_category_after_panel', 'gmedia_term_category_after_panel' );
|
163 |
function gmedia_term_category_after_panel( $term ) {
|
164 |
global $gmCore, $gmProcessor, $gmProcessorLibrary;
|
165 |
|
166 |
+
$taxin = "{$gmProcessor->taxterm}__in";
|
167 |
+
|
168 |
$gmProcessorLibrary->query_args['terms_relation'] = 'AND';
|
169 |
if ( ! empty( $gmProcessorLibrary->query_args[ $taxin ] ) ) {
|
170 |
+
$gmProcessorLibrary->query_args["{$gmProcessor->taxterm}__and"] = wp_parse_id_list( array_merge( $gmProcessorLibrary->query_args[ $taxin ], array( $term->term_id ) ) );
|
171 |
unset( $gmProcessorLibrary->query_args[ $taxin ] );
|
172 |
} else {
|
173 |
+
$gmProcessorLibrary->query_args[ $taxin ] = array( (int) $term->term_id );
|
174 |
}
|
175 |
$gmProcessorLibrary->display_mode = 'grid';
|
176 |
|
177 |
$gmProcessor = $gmProcessorLibrary;
|
178 |
|
179 |
+
echo '<div class="gmedia_term__in">';
|
180 |
+
echo wp_kses_post( $gmCore->alert( 'success', $gmProcessor->msg ) );
|
181 |
+
echo wp_kses_post( $gmCore->alert( 'danger', $gmProcessor->error ) );
|
182 |
+
include GMEDIA_ABSPATH . 'admin/pages/library/library.php';
|
|
|
183 |
echo '</div>';
|
184 |
}
|
admin/pages/terms/terms.php
CHANGED
@@ -3,10 +3,7 @@
|
|
3 |
* Gmedia Terms
|
4 |
*/
|
5 |
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
die( '-1' );
|
9 |
-
}
|
10 |
|
11 |
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
12 |
|
@@ -19,22 +16,24 @@ $gmedia_terms_count = $gmDB->count_gmedia();
|
|
19 |
$gmedia_terms_pager = $gmDB->query_pager();
|
20 |
|
21 |
?>
|
22 |
-
<div class="
|
23 |
|
24 |
<?php
|
25 |
-
|
26 |
|
27 |
do_action( 'gmedia_before_terms_list' );
|
28 |
?>
|
29 |
|
30 |
-
<form class="list-group <?php echo $gmedia_term_taxonomy; ?>" id="gm-list-table" style="margin-bottom:4px;">
|
31 |
<?php
|
|
|
|
|
32 |
$taxterm = $gmProcessor->taxterm;
|
33 |
if ( count( $gmedia_terms ) ) {
|
34 |
foreach ( $gmedia_terms as &$item ) {
|
35 |
gmedia_term_item_more_data( $item );
|
36 |
|
37 |
-
$item->classes =
|
38 |
if ( 'publish' !== $item->status ) {
|
39 |
if ( 'private' === $item->status ) {
|
40 |
$item->classes[] = 'list-group-item-info';
|
@@ -54,8 +53,6 @@ $gmedia_terms_pager = $gmDB->query_pager();
|
|
54 |
} else {
|
55 |
include dirname( __FILE__ ) . '/tpl/no-items.php';
|
56 |
}
|
57 |
-
wp_original_referer_field( true, 'previous' );
|
58 |
-
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
59 |
?>
|
60 |
</form>
|
61 |
<?php
|
@@ -65,4 +62,4 @@ $gmedia_terms_pager = $gmDB->query_pager();
|
|
65 |
|
66 |
<?php
|
67 |
|
68 |
-
|
3 |
* Gmedia Terms
|
4 |
*/
|
5 |
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
7 |
|
8 |
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
9 |
|
16 |
$gmedia_terms_pager = $gmDB->query_pager();
|
17 |
|
18 |
?>
|
19 |
+
<div class="card m-0 mw-100 p-0 panel-fixed-header" id="gmedia-panel">
|
20 |
|
21 |
<?php
|
22 |
+
require dirname( __FILE__ ) . '/tpl/terms-panel-heading.php';
|
23 |
|
24 |
do_action( 'gmedia_before_terms_list' );
|
25 |
?>
|
26 |
|
27 |
+
<form class="list-group <?php echo esc_attr( $gmedia_term_taxonomy ); ?>" id="gm-list-table" style="margin-bottom:4px; border-top-left-radius: 0; border-top-right-radius: 0;">
|
28 |
<?php
|
29 |
+
wp_original_referer_field( true, 'previous' );
|
30 |
+
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
31 |
$taxterm = $gmProcessor->taxterm;
|
32 |
if ( count( $gmedia_terms ) ) {
|
33 |
foreach ( $gmedia_terms as &$item ) {
|
34 |
gmedia_term_item_more_data( $item );
|
35 |
|
36 |
+
$item->classes = array();
|
37 |
if ( 'publish' !== $item->status ) {
|
38 |
if ( 'private' === $item->status ) {
|
39 |
$item->classes[] = 'list-group-item-info';
|
53 |
} else {
|
54 |
include dirname( __FILE__ ) . '/tpl/no-items.php';
|
55 |
}
|
|
|
|
|
56 |
?>
|
57 |
</form>
|
58 |
<?php
|
62 |
|
63 |
<?php
|
64 |
|
65 |
+
require GMEDIA_ABSPATH . 'admin/tpl/modal-share.php';
|
admin/pages/terms/tpl/album-create-item.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Add Album Form
|
@@ -10,68 +7,71 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
10 |
global $gmProcessor, $gmGallery;
|
11 |
$gmedia_url = $gmProcessor->url;
|
12 |
?>
|
13 |
-
<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="
|
14 |
<div class="row">
|
15 |
-
<div class="col-
|
16 |
<div class="form-group">
|
17 |
-
<label><?php
|
18 |
-
<input type="text" class="form-control input-sm" name="term[name]" placeholder="<?php
|
19 |
</div>
|
20 |
<div class="form-group">
|
21 |
-
<label><?php
|
22 |
<?php
|
23 |
-
wp_editor(
|
24 |
-
'
|
25 |
-
'
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
?>
|
34 |
</div>
|
35 |
</div>
|
36 |
-
<div class="col-
|
37 |
<div class="row">
|
38 |
-
<div class="col-
|
39 |
<div class="form-group">
|
40 |
-
<label><?php
|
41 |
<select name="term[meta][_orderby]" class="form-control input-sm">
|
42 |
-
<option value="ID" <?php selected( $gmGallery->options['in_album_orderby'], 'ID' ); ?>><?php
|
43 |
-
<option value="title" <?php selected( $gmGallery->options['in_album_orderby'], 'title' ); ?>><?php
|
44 |
-
<option value="gmuid" <?php selected( $gmGallery->options['in_album_orderby'], 'gmuid' ); ?>><?php
|
45 |
-
<option value="date" <?php selected( $gmGallery->options['in_album_orderby'], 'date' ); ?>><?php
|
46 |
-
<option value="modified" <?php selected( $gmGallery->options['in_album_orderby'], 'modified' ); ?>><?php
|
47 |
-
<option value="_created_timestamp" <?php selected( $gmGallery->options['in_album_orderby'], '_created_timestamp' ); ?>><?php
|
48 |
-
<option value="comment_count" <?php selected( $gmGallery->options['in_album_orderby'], 'comment_count' ); ?>><?php
|
49 |
-
<option value="views" <?php selected( $gmGallery->options['in_album_orderby'], 'views' ); ?>><?php
|
50 |
-
<option value="likes" <?php selected( $gmGallery->options['in_album_orderby'], 'likes' ); ?>><?php
|
51 |
-
<option value="_size" <?php selected( $gmGallery->options['in_album_orderby'], '_size' ); ?>><?php
|
52 |
-
<option value="rand" <?php selected( $gmGallery->options['in_album_orderby'], 'rand' ); ?>><?php
|
53 |
</select>
|
54 |
</div>
|
55 |
<div class="form-group">
|
56 |
-
<label><?php
|
57 |
<select name="term[meta][_order]" class="form-control input-sm">
|
58 |
-
<option value="DESC" <?php selected( $gmGallery->options['in_album_order'], 'DESC' ); ?>><?php
|
59 |
-
<option value="ASC" <?php selected( $gmGallery->options['in_album_order'], 'ASC' ); ?>><?php
|
60 |
</select>
|
61 |
</div>
|
62 |
<div class="form-group">
|
63 |
-
<label><?php
|
64 |
<select class="form-control input-sm" id="term_module_preset" name="term[meta][_module_preset]">
|
65 |
-
<option value=""<?php
|
66 |
-
|
67 |
-
|
68 |
-
<?php global $gmDB, $user_ID;
|
69 |
$gmedia_modules = get_gmedia_modules( false );
|
70 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
71 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
72 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
73 |
-
$option =
|
74 |
-
$option[] = '<option value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title']
|
75 |
foreach ( $presets as $preset ) {
|
76 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
77 |
continue;
|
@@ -81,41 +81,45 @@ $gmedia_url = $gmProcessor->url;
|
|
81 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
82 |
}
|
83 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
84 |
-
$option[] = '<option value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author
|
85 |
} else {
|
86 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
87 |
-
$option[] = '<option value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
88 |
}
|
89 |
}
|
90 |
-
echo implode( '', $option );
|
91 |
echo '</optgroup>';
|
92 |
}
|
93 |
?>
|
94 |
</select>
|
95 |
</div>
|
96 |
</div>
|
97 |
-
<div class="col-
|
98 |
<div class="form-group">
|
99 |
-
<label><?php
|
100 |
<?php gmedia_term_choose_author_field(); ?>
|
101 |
</div>
|
102 |
<div class="form-group">
|
103 |
-
<label><?php
|
104 |
<select name="term[status]" class="form-control input-sm">
|
105 |
-
<option value="publish" <?php selected( $gmGallery->options['in_album_status'], 'publish' ); ?>><?php
|
106 |
-
<option value="private" <?php selected( $gmGallery->options['in_album_status'], 'private' ); ?>><?php
|
107 |
-
<option value="draft" <?php selected( $gmGallery->options['in_album_status'], 'draft' ); ?>><?php
|
108 |
</select>
|
109 |
</div>
|
110 |
-
<?php
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
119 |
<div class="form-group">
|
120 |
<label> </label>
|
121 |
<?php
|
@@ -123,7 +127,7 @@ $gmedia_url = $gmProcessor->url;
|
|
123 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
124 |
?>
|
125 |
<input type="hidden" name="term[taxonomy]" value="gmedia_album"/>
|
126 |
-
<button style="display:block" type="submit" class="btn btn-primary btn-sm" name="gmedia_album_save"><?php
|
127 |
</div>
|
128 |
</div>
|
129 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Add Album Form
|
7 |
global $gmProcessor, $gmGallery;
|
8 |
$gmedia_url = $gmProcessor->url;
|
9 |
?>
|
10 |
+
<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="card-body" action="<?php echo esc_url( $gmedia_url ); ?>" style="padding-bottom:0; border-bottom:1px solid #ddd;">
|
11 |
<div class="row">
|
12 |
+
<div class="col-sm-6">
|
13 |
<div class="form-group">
|
14 |
+
<label><?php esc_html_e( 'Name', 'grand-media' ); ?></label>
|
15 |
+
<input type="text" class="form-control input-sm" name="term[name]" placeholder="<?php esc_attr_e( 'Album Name', 'grand-media' ); ?>" required/>
|
16 |
</div>
|
17 |
<div class="form-group">
|
18 |
+
<label><?php esc_html_e( 'Description', 'grand-media' ); ?></label>
|
19 |
<?php
|
20 |
+
wp_editor(
|
21 |
+
'',
|
22 |
+
'album_description',
|
23 |
+
array(
|
24 |
+
'editor_class' => 'form-control input-sm',
|
25 |
+
'editor_height' => 120,
|
26 |
+
'wpautop' => false,
|
27 |
+
'media_buttons' => false,
|
28 |
+
'textarea_name' => 'term[description]',
|
29 |
+
'textarea_rows' => '4',
|
30 |
+
'tinymce' => false,
|
31 |
+
'quicktags' => array( 'buttons' => apply_filters( 'gmedia_editor_quicktags', 'strong,em,link,ul,li,close' ) ),
|
32 |
+
)
|
33 |
+
);
|
34 |
?>
|
35 |
</div>
|
36 |
</div>
|
37 |
+
<div class="col-sm-6">
|
38 |
<div class="row">
|
39 |
+
<div class="col-sm-6">
|
40 |
<div class="form-group">
|
41 |
+
<label><?php esc_html_e( 'Order gmedia', 'grand-media' ); ?></label>
|
42 |
<select name="term[meta][_orderby]" class="form-control input-sm">
|
43 |
+
<option value="ID" <?php selected( $gmGallery->options['in_album_orderby'], 'ID' ); ?>><?php esc_html_e( 'by ID', 'grand-media' ); ?></option>
|
44 |
+
<option value="title" <?php selected( $gmGallery->options['in_album_orderby'], 'title' ); ?>><?php esc_html_e( 'by title', 'grand-media' ); ?></option>
|
45 |
+
<option value="gmuid" <?php selected( $gmGallery->options['in_album_orderby'], 'gmuid' ); ?>><?php esc_html_e( 'by filename', 'grand-media' ); ?></option>
|
46 |
+
<option value="date" <?php selected( $gmGallery->options['in_album_orderby'], 'date' ); ?>><?php esc_html_e( 'by date', 'grand-media' ); ?></option>
|
47 |
+
<option value="modified" <?php selected( $gmGallery->options['in_album_orderby'], 'modified' ); ?>><?php esc_html_e( 'by last modified date', 'grand-media' ); ?></option>
|
48 |
+
<option value="_created_timestamp" <?php selected( $gmGallery->options['in_album_orderby'], '_created_timestamp' ); ?>><?php esc_html_e( 'by created timestamp', 'grand-media' ); ?></option>
|
49 |
+
<option value="comment_count" <?php selected( $gmGallery->options['in_album_orderby'], 'comment_count' ); ?>><?php esc_html_e( 'by comment count', 'grand-media' ); ?></option>
|
50 |
+
<option value="views" <?php selected( $gmGallery->options['in_album_orderby'], 'views' ); ?>><?php esc_html_e( 'by views', 'grand-media' ); ?></option>
|
51 |
+
<option value="likes" <?php selected( $gmGallery->options['in_album_orderby'], 'likes' ); ?>><?php esc_html_e( 'by likes', 'grand-media' ); ?></option>
|
52 |
+
<option value="_size" <?php selected( $gmGallery->options['in_album_orderby'], '_size' ); ?>><?php esc_html_e( 'by file size', 'grand-media' ); ?></option>
|
53 |
+
<option value="rand" <?php selected( $gmGallery->options['in_album_orderby'], 'rand' ); ?>><?php esc_html_e( 'Random', 'grand-media' ); ?></option>
|
54 |
</select>
|
55 |
</div>
|
56 |
<div class="form-group">
|
57 |
+
<label><?php esc_html_e( 'Sort order', 'grand-media' ); ?></label>
|
58 |
<select name="term[meta][_order]" class="form-control input-sm">
|
59 |
+
<option value="DESC" <?php selected( $gmGallery->options['in_album_order'], 'DESC' ); ?>><?php esc_html_e( 'DESC', 'grand-media' ); ?></option>
|
60 |
+
<option value="ASC" <?php selected( $gmGallery->options['in_album_order'], 'ASC' ); ?>><?php esc_html_e( 'ASC', 'grand-media' ); ?></option>
|
61 |
</select>
|
62 |
</div>
|
63 |
<div class="form-group">
|
64 |
+
<label><?php esc_html_e( 'Module/Preset', 'grand-media' ); ?></label>
|
65 |
<select class="form-control input-sm" id="term_module_preset" name="term[meta][_module_preset]">
|
66 |
+
<option value="" <?php echo empty( $term->meta['_module_preset'][0] ) ? 'selected="selected"' : ''; ?>><?php esc_html_e( 'Default module in Global Settings', 'grand-media' ); ?></option>
|
67 |
+
<?php
|
68 |
+
global $gmDB, $user_ID, $gm_allowed_tags;
|
|
|
69 |
$gmedia_modules = get_gmedia_modules( false );
|
70 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
71 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
72 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $mfold ) );
|
73 |
+
$option = array();
|
74 |
+
$option[] = '<option value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title'] . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
75 |
foreach ( $presets as $preset ) {
|
76 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
77 |
continue;
|
81 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
82 |
}
|
83 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
84 |
+
$option[] = '<option value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
85 |
} else {
|
86 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
87 |
+
$option[] = '<option value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
88 |
}
|
89 |
}
|
90 |
+
echo wp_kses( implode( '', $option ), $gm_allowed_tags );
|
91 |
echo '</optgroup>';
|
92 |
}
|
93 |
?>
|
94 |
</select>
|
95 |
</div>
|
96 |
</div>
|
97 |
+
<div class="col-sm-6">
|
98 |
<div class="form-group">
|
99 |
+
<label><?php esc_html_e( 'Author', 'grand-media' ); ?></label>
|
100 |
<?php gmedia_term_choose_author_field(); ?>
|
101 |
</div>
|
102 |
<div class="form-group">
|
103 |
+
<label><?php esc_html_e( 'Status', 'grand-media' ); ?></label>
|
104 |
<select name="term[status]" class="form-control input-sm">
|
105 |
+
<option value="publish" <?php selected( $gmGallery->options['in_album_status'], 'publish' ); ?>><?php esc_html_e( 'Public', 'grand-media' ); ?></option>
|
106 |
+
<option value="private" <?php selected( $gmGallery->options['in_album_status'], 'private' ); ?>><?php esc_html_e( 'Private', 'grand-media' ); ?></option>
|
107 |
+
<option value="draft" <?php selected( $gmGallery->options['in_album_status'], 'draft' ); ?>><?php esc_html_e( 'Draft', 'grand-media' ); ?></option>
|
108 |
</select>
|
109 |
</div>
|
110 |
+
<?php
|
111 |
+
/*
|
112 |
+
?>
|
113 |
+
<div class="form-group">
|
114 |
+
<label><?php esc_html_e('Comment Status', 'grand-media'); ?></label>
|
115 |
+
<select name="term[comment_status]" class="form-control input-sm">
|
116 |
+
<option <?php echo ('open' == $gmGallery->options['default_gmedia_term_comment_status'])? 'selected="selected"' : ''; ?> value="open"><?php esc_html_e('Open', 'grand-media'); ?></option>
|
117 |
+
<option <?php echo ('closed' == $gmGallery->options['default_gmedia_term_comment_status'])? 'selected="selected"' : ''; ?> value="closed"><?php esc_html_e('Closed', 'grand-media'); ?></option>
|
118 |
+
</select>
|
119 |
+
</div>
|
120 |
+
<?php
|
121 |
+
*/
|
122 |
+
?>
|
123 |
<div class="form-group">
|
124 |
<label> </label>
|
125 |
<?php
|
127 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
128 |
?>
|
129 |
<input type="hidden" name="term[taxonomy]" value="gmedia_album"/>
|
130 |
+
<button style="display:block" type="submit" class="btn btn-primary btn-sm" name="gmedia_album_save"><?php esc_html_e( 'Add New Album', 'grand-media' ); ?></button>
|
131 |
</div>
|
132 |
</div>
|
133 |
</div>
|
admin/pages/terms/tpl/album-edit-item.php
CHANGED
@@ -1,116 +1,124 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
|
|
7 |
/**
|
8 |
* Edit Album Form
|
|
|
|
|
9 |
*/
|
10 |
$_orderby = ! empty( $term->meta['_orderby'][0] ) ? $term->meta['_orderby'][0] : $gmGallery->options['in_album_orderby'];
|
11 |
$_order = ! empty( $term->meta['_order'][0] ) ? $term->meta['_order'][0] : $gmGallery->options['in_album_order'];
|
12 |
$_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_module_preset'][0] : '';
|
13 |
?>
|
14 |
-
<form method="post" id="gmedia-edit-term" name="gmEditTerm" class="
|
15 |
<h4 style="margin-top:0;">
|
16 |
-
<span class="
|
17 |
-
<?php
|
18 |
</h4>
|
19 |
|
20 |
<div class="row">
|
21 |
-
<div class="col-
|
22 |
<div class="form-group">
|
23 |
-
<label><?php
|
24 |
-
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr( $term->name ); ?>" placeholder="<?php
|
25 |
</div>
|
26 |
<div class="form-group row">
|
27 |
-
<div class="col-
|
28 |
-
<label><?php
|
29 |
<?php gmedia_term_choose_author_field( $term->global ); ?>
|
30 |
</div>
|
31 |
-
<div class="col-
|
32 |
-
<label><?php
|
33 |
<select name="term[status]" class="form-control input-sm">
|
34 |
-
<option value="publish"<?php selected( $term->status, 'publish' ); ?>><?php
|
35 |
-
<option value="private"<?php selected( $term->status, 'private' ); ?>><?php
|
36 |
-
<option value="draft"<?php selected( $term->status, 'draft' ); ?>><?php
|
37 |
</select>
|
38 |
<div class="cb-help-block">
|
39 |
-
<div class="checkbox" style="margin-bottom:0;"><label><input type="checkbox" name="term[status_global]" value="1">
|
40 |
</div>
|
41 |
</div>
|
42 |
</div>
|
43 |
|
44 |
<div class="form-group">
|
45 |
-
<label><?php
|
46 |
<?php
|
47 |
-
wp_editor(
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
57 |
?>
|
58 |
</div>
|
59 |
-
<div class="text-
|
60 |
<?php
|
61 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
62 |
wp_referer_field();
|
63 |
?>
|
64 |
<input type="hidden" name="term[term_id]" value="<?php echo absint( $term->term_id ); ?>"/>
|
65 |
<input type="hidden" name="term[taxonomy]" value="<?php echo esc_attr( $term->taxonomy ); ?>"/>
|
66 |
-
<button type="submit" class="btn btn-primary btn-sm" name="gmedia_album_save"><?php
|
67 |
</div>
|
68 |
</div>
|
69 |
-
<div class="col-
|
70 |
<div class="row">
|
71 |
-
<div class="col-
|
72 |
<div class="form-group">
|
73 |
-
<label><?php
|
74 |
<select name="term[meta][_orderby]" id="gmedia_term_orderby" class="form-control input-sm">
|
75 |
-
<option value="custom"<?php selected( $_orderby, 'custom' ); ?>><?php
|
76 |
-
<option value="ID"<?php selected( $_orderby, 'ID' ); ?>><?php
|
77 |
-
<option value="title"<?php selected( $_orderby, 'title' ); ?>><?php
|
78 |
-
<option value="gmuid"<?php selected( $_orderby, 'gmuid' ); ?>><?php
|
79 |
-
<option value="date"<?php selected( $_orderby, 'date' ); ?>><?php
|
80 |
-
<option value="modified"<?php selected( $_orderby, 'modified' ); ?>><?php
|
81 |
-
<option value="_created_timestamp" <?php selected( $_orderby, '_created_timestamp' ); ?>><?php
|
82 |
-
<option value="comment_count" <?php selected( $_orderby, 'comment_count' ); ?>><?php
|
83 |
-
<option value="views" <?php selected( $_orderby, 'views' ); ?>><?php
|
84 |
-
<option value="likes" <?php selected( $_orderby, 'likes' ); ?>><?php
|
85 |
-
<option value="_size" <?php selected( $_orderby, '_size' ); ?>><?php
|
86 |
-
<option value="rand"<?php selected( $_orderby, 'rand' ); ?>><?php
|
87 |
</select>
|
88 |
</div>
|
89 |
<div class="form-group">
|
90 |
-
<label><?php
|
91 |
<select id="gmedia_term_order" name="term[meta][_order]" class="form-control input-sm<?php echo ( 'custom' === $_orderby ) ? ' disabled' : ''; ?>">
|
92 |
-
<option value="DESC"<?php selected( $_order, 'DESC' ); ?>><?php
|
93 |
-
<option value="ASC"<?php selected( $_order, 'ASC' ); ?>><?php
|
94 |
</select>
|
95 |
<div class="cb-help-block">
|
96 |
-
<div class="checkbox" style="margin-bottom:0;"><label><input id="reset_order_option" type="checkbox" name="term[reset_custom_order]" value="1">
|
97 |
</div>
|
98 |
</div>
|
99 |
<div class="form-group">
|
100 |
-
<label><?php
|
101 |
<select class="form-control input-sm" id="term_module_preset" name="term[meta][_module_preset]">
|
102 |
-
<option value=""
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
|
|
106 |
$gmedia_modules = get_gmedia_modules( false );
|
107 |
|
108 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
109 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
110 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
111 |
$selected = selected( $_module_preset, esc_attr( $mfold ), false );
|
112 |
-
$option =
|
113 |
-
$option[] = '<option ' . $selected . ' value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title']
|
114 |
foreach ( $presets as $preset ) {
|
115 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
116 |
continue;
|
@@ -121,76 +129,113 @@ $_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_mo
|
|
121 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
122 |
}
|
123 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
124 |
-
$option[] = '<option ' . $selected . ' value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author
|
125 |
} else {
|
126 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
127 |
-
$option[] = '<option ' . $selected . ' value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
128 |
}
|
129 |
}
|
130 |
-
echo implode( '', $option );
|
131 |
echo '</optgroup>';
|
132 |
}
|
133 |
?>
|
134 |
</select>
|
135 |
</div>
|
136 |
-
<p><a href="<?php echo esc_url( $term->cloud_link ); ?>" target="_blank"><?php
|
137 |
<?php if ( $term->post_link ) { ?>
|
138 |
-
<p><a href="<?php echo esc_url( $term->post_link ); ?>" target="_blank"><?php
|
139 |
-
|
|
|
140 |
|
141 |
-
/*
|
|
|
142 |
<div class="form-group">
|
143 |
-
<a href="<?php echo esc_url( add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_term_id' => $term->term_id), $gmProcessor->url) ); ?>" data-target="#previewModal" data-width="900" data-height="500" class="preview-modal gmpost-com-count
|
144 |
-
<b class="comment-count"><?php echo $term->comment_count; ?></b>
|
145 |
-
<
|
146 |
</a>
|
147 |
-
<label><?php
|
148 |
<select name="term[comment_status]" class="form-control input-sm">
|
149 |
-
<option value="open"<?php selected($term->comment_status, 'open'); ?>><?php
|
150 |
-
<option value="closed"<?php selected($term->comment_status, 'closed'); ?>><?php
|
151 |
</select>
|
152 |
</div>
|
153 |
-
<?php }
|
|
|
|
|
154 |
</div>
|
155 |
-
<div class="col-
|
156 |
<?php if ( isset( $term->slug ) ) { ?>
|
157 |
<div class="form-group">
|
158 |
-
<label><?php
|
159 |
<input type="text" class="form-control input-sm" name="term[slug]" value="<?php echo esc_attr( $term->slug ); ?>"/>
|
160 |
</div>
|
161 |
<?php } ?>
|
162 |
<?php if ( isset( $term->post_date ) ) { ?>
|
163 |
<div class="form-group">
|
164 |
-
<label><?php
|
165 |
|
166 |
-
<div
|
167 |
-
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
</div>
|
170 |
</div>
|
171 |
<?php } ?>
|
172 |
<?php $cover_id = isset( $term->meta['_cover'][0] ) ? $term->meta['_cover'][0] : ''; ?>
|
173 |
<div class="form-group">
|
174 |
-
<label><?php
|
175 |
<div class="input-group">
|
176 |
-
<input type="text" class="form-control input-sm gmedia-cover-id" name="term[meta][_cover]" value="<?php echo esc_attr( $cover_id ); ?>" placeholder="<?php
|
177 |
-
<span class="input-group-btn"
|
178 |
-
|
179 |
-
'mode'
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
</div>
|
184 |
</div>
|
185 |
-
<div class="gm-img-thumbnail gmedia-cover-image"
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
189 |
} else {
|
190 |
-
echo '<strong class="text-danger">' .
|
191 |
}
|
192 |
}
|
193 |
-
|
|
|
194 |
</div>
|
195 |
</div>
|
196 |
</div>
|
@@ -213,12 +258,12 @@ $_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_mo
|
|
213 |
<div class="modal-dialog">
|
214 |
<div class="modal-content">
|
215 |
<div class="modal-header">
|
216 |
-
<
|
217 |
-
<
|
218 |
</div>
|
219 |
<form class="modal-body" method="post" id="newCustomFieldForm">
|
220 |
<?php
|
221 |
-
echo $gmCore->meta_form(
|
222 |
wp_nonce_field( 'gmedia_custom_field', '_wpnonce_custom_field' );
|
223 |
wp_referer_field();
|
224 |
?>
|
@@ -226,8 +271,8 @@ $_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_mo
|
|
226 |
<input type="hidden" class="newcustomfield-for-id" name="ID" value=""/>
|
227 |
</form>
|
228 |
<div class="modal-footer">
|
229 |
-
<button type="button" class="btn btn-primary customfieldsubmit"><?php
|
230 |
-
<button type="button" class="btn btn-
|
231 |
</div>
|
232 |
</div>
|
233 |
</div>
|
@@ -237,8 +282,8 @@ $_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_mo
|
|
237 |
<div class="modal-dialog">
|
238 |
<div class="modal-content">
|
239 |
<div class="modal-header">
|
240 |
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
241 |
<h4 class="modal-title"></h4>
|
|
|
242 |
</div>
|
243 |
<div class="modal-body"></div>
|
244 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
+
global $gmGallery, $gmCore, $gm_allowed_tags, $gmDB, $user_ID;
|
5 |
/**
|
6 |
* Edit Album Form
|
7 |
+
*
|
8 |
+
* @var $term
|
9 |
*/
|
10 |
$_orderby = ! empty( $term->meta['_orderby'][0] ) ? $term->meta['_orderby'][0] : $gmGallery->options['in_album_orderby'];
|
11 |
$_order = ! empty( $term->meta['_order'][0] ) ? $term->meta['_order'][0] : $gmGallery->options['in_album_order'];
|
12 |
$_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_module_preset'][0] : '';
|
13 |
?>
|
14 |
+
<form method="post" id="gmedia-edit-term" name="gmEditTerm" class="card-body" data-id="<?php echo absint( $term->term_id ); ?>" action="<?php echo esc_url( gm_get_admin_url() ); ?>">
|
15 |
<h4 style="margin-top:0;">
|
16 |
+
<span class="float-end"><?php echo esc_html( __( 'ID', 'grand-media' ) . ": {$term->term_id}" ); ?></span>
|
17 |
+
<?php esc_html_e( 'Edit Album' ); ?>: <em><?php echo esc_html( $term->name ); ?></em>
|
18 |
</h4>
|
19 |
|
20 |
<div class="row">
|
21 |
+
<div class="col-sm-6">
|
22 |
<div class="form-group">
|
23 |
+
<label><?php esc_html_e( 'Name', 'grand-media' ); ?></label>
|
24 |
+
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr( $term->name ); ?>" placeholder="<?php esc_attr_e( 'Album Name', 'grand-media' ); ?>" required/>
|
25 |
</div>
|
26 |
<div class="form-group row">
|
27 |
+
<div class="col-sm-6">
|
28 |
+
<label><?php esc_html_e( 'Author', 'grand-media' ); ?></label>
|
29 |
<?php gmedia_term_choose_author_field( $term->global ); ?>
|
30 |
</div>
|
31 |
+
<div class="col-sm-6">
|
32 |
+
<label><?php esc_html_e( 'Status', 'grand-media' ); ?></label>
|
33 |
<select name="term[status]" class="form-control input-sm">
|
34 |
+
<option value="publish"<?php selected( $term->status, 'publish' ); ?>><?php esc_html_e( 'Public', 'grand-media' ); ?></option>
|
35 |
+
<option value="private"<?php selected( $term->status, 'private' ); ?>><?php esc_html_e( 'Private', 'grand-media' ); ?></option>
|
36 |
+
<option value="draft"<?php selected( $term->status, 'draft' ); ?>><?php esc_html_e( 'Draft', 'grand-media' ); ?></option>
|
37 |
</select>
|
38 |
<div class="cb-help-block">
|
39 |
+
<div class="checkbox" style="margin-bottom:0;"><label><input type="checkbox" name="term[status_global]" value="1"> <small><?php esc_html_e( 'Apply Status for all items in album', 'grand-media' ); ?></small> </label></div>
|
40 |
</div>
|
41 |
</div>
|
42 |
</div>
|
43 |
|
44 |
<div class="form-group">
|
45 |
+
<label><?php esc_html_e( 'Description', 'grand-media' ); ?></label>
|
46 |
<?php
|
47 |
+
wp_editor(
|
48 |
+
$term->description,
|
49 |
+
"album{$term->term_id}_description",
|
50 |
+
array(
|
51 |
+
'editor_class' => 'form-control input-sm',
|
52 |
+
'editor_height' => 120,
|
53 |
+
'wpautop' => false,
|
54 |
+
'media_buttons' => false,
|
55 |
+
'textarea_name' => 'term[description]',
|
56 |
+
'textarea_rows' => '4',
|
57 |
+
'tinymce' => false,
|
58 |
+
'quicktags' => array( 'buttons' => apply_filters( 'gmedia_editor_quicktags', 'strong,em,link,ul,li,close' ) ),
|
59 |
+
)
|
60 |
+
);
|
61 |
?>
|
62 |
</div>
|
63 |
+
<div class="text-end">
|
64 |
<?php
|
65 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
66 |
wp_referer_field();
|
67 |
?>
|
68 |
<input type="hidden" name="term[term_id]" value="<?php echo absint( $term->term_id ); ?>"/>
|
69 |
<input type="hidden" name="term[taxonomy]" value="<?php echo esc_attr( $term->taxonomy ); ?>"/>
|
70 |
+
<button type="submit" class="btn btn-primary btn-sm" name="gmedia_album_save"><?php esc_html_e( 'Update', 'grand-media' ); ?></button>
|
71 |
</div>
|
72 |
</div>
|
73 |
+
<div class="col-sm-6">
|
74 |
<div class="row">
|
75 |
+
<div class="col-sm-6">
|
76 |
<div class="form-group">
|
77 |
+
<label><?php esc_html_e( 'Order gmedia', 'grand-media' ); ?></label>
|
78 |
<select name="term[meta][_orderby]" id="gmedia_term_orderby" class="form-control input-sm">
|
79 |
+
<option value="custom"<?php selected( $_orderby, 'custom' ); ?>><?php esc_html_e( 'Custom Order', 'grand-media' ); ?></option>
|
80 |
+
<option value="ID"<?php selected( $_orderby, 'ID' ); ?>><?php esc_html_e( 'by ID', 'grand-media' ); ?></option>
|
81 |
+
<option value="title"<?php selected( $_orderby, 'title' ); ?>><?php esc_html_e( 'by title', 'grand-media' ); ?></option>
|
82 |
+
<option value="gmuid"<?php selected( $_orderby, 'gmuid' ); ?>><?php esc_html_e( 'by filename', 'grand-media' ); ?></option>
|
83 |
+
<option value="date"<?php selected( $_orderby, 'date' ); ?>><?php esc_html_e( 'by date', 'grand-media' ); ?></option>
|
84 |
+
<option value="modified"<?php selected( $_orderby, 'modified' ); ?>><?php esc_html_e( 'by last modified date', 'grand-media' ); ?></option>
|
85 |
+
<option value="_created_timestamp" <?php selected( $_orderby, '_created_timestamp' ); ?>><?php esc_html_e( 'by created timestamp', 'grand-media' ); ?></option>
|
86 |
+
<option value="comment_count" <?php selected( $_orderby, 'comment_count' ); ?>><?php esc_html_e( 'by comment count', 'grand-media' ); ?></option>
|
87 |
+
<option value="views" <?php selected( $_orderby, 'views' ); ?>><?php esc_html_e( 'by views', 'grand-media' ); ?></option>
|
88 |
+
<option value="likes" <?php selected( $_orderby, 'likes' ); ?>><?php esc_html_e( 'by likes', 'grand-media' ); ?></option>
|
89 |
+
<option value="_size" <?php selected( $_orderby, '_size' ); ?>><?php esc_html_e( 'by file size', 'grand-media' ); ?></option>
|
90 |
+
<option value="rand"<?php selected( $_orderby, 'rand' ); ?>><?php esc_html_e( 'Random', 'grand-media' ); ?></option>
|
91 |
</select>
|
92 |
</div>
|
93 |
<div class="form-group">
|
94 |
+
<label><?php esc_html_e( 'Sort order', 'grand-media' ); ?></label>
|
95 |
<select id="gmedia_term_order" name="term[meta][_order]" class="form-control input-sm<?php echo ( 'custom' === $_orderby ) ? ' disabled' : ''; ?>">
|
96 |
+
<option value="DESC"<?php selected( $_order, 'DESC' ); ?>><?php esc_html_e( 'DESC', 'grand-media' ); ?></option>
|
97 |
+
<option value="ASC"<?php selected( $_order, 'ASC' ); ?>><?php esc_html_e( 'ASC', 'grand-media' ); ?></option>
|
98 |
</select>
|
99 |
<div class="cb-help-block">
|
100 |
+
<div class="checkbox" style="margin-bottom:0;"><label><input id="reset_order_option" type="checkbox" name="term[reset_custom_order]" value="1"> <small><?php esc_html_e( 'Reset custom order', 'grand-media' ); ?></small> </label></div>
|
101 |
</div>
|
102 |
</div>
|
103 |
<div class="form-group">
|
104 |
+
<label><?php esc_html_e( 'Module/Preset', 'grand-media' ); ?></label>
|
105 |
<select class="form-control input-sm" id="term_module_preset" name="term[meta][_module_preset]">
|
106 |
+
<option value=""
|
107 |
+
<?php
|
108 |
+
if ( '' === $_module_preset ) {
|
109 |
+
echo ' selected="selected"';
|
110 |
+
}
|
111 |
+
?>
|
112 |
+
><?php esc_html_e( 'Default module in Global Settings', 'grand-media' ); ?></option>
|
113 |
+
<?php
|
114 |
$gmedia_modules = get_gmedia_modules( false );
|
115 |
|
116 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
117 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
118 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $mfold ) );
|
119 |
$selected = selected( $_module_preset, esc_attr( $mfold ), false );
|
120 |
+
$option = array();
|
121 |
+
$option[] = '<option ' . $selected . ' value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title'] . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
122 |
foreach ( $presets as $preset ) {
|
123 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
124 |
continue;
|
129 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
130 |
}
|
131 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
132 |
+
$option[] = '<option ' . $selected . ' value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
133 |
} else {
|
134 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
135 |
+
$option[] = '<option ' . $selected . ' value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
136 |
}
|
137 |
}
|
138 |
+
echo wp_kses( implode( '', $option ), $gm_allowed_tags );
|
139 |
echo '</optgroup>';
|
140 |
}
|
141 |
?>
|
142 |
</select>
|
143 |
</div>
|
144 |
+
<p><a href="<?php echo esc_url( $term->cloud_link ); ?>" target="_blank"><?php esc_html_e( 'View GmediaCloud Page', 'grand-media' ); ?></a></p>
|
145 |
<?php if ( $term->post_link ) { ?>
|
146 |
+
<p><a href="<?php echo esc_url( $term->post_link ); ?>" target="_blank"><?php esc_html_e( 'View WordPress Post', 'grand-media' ); ?></a></p>
|
147 |
+
<?php
|
148 |
+
}
|
149 |
|
150 |
+
/*
|
151 |
+
if(isset($term->comment_status)){ ?>
|
152 |
<div class="form-group">
|
153 |
+
<a href="<?php echo esc_url( add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_term_id' => $term->term_id), $gmProcessor->url) ); ?>" data-bs-toggle="modal" data-bs-target="#previewModal" data-width="900" data-height="500" class="preview-modal gmpost-com-count float-end" title="<?php echo esc_attr('Comments', 'grand-media'); ?>">
|
154 |
+
<b class="comment-count"><?php echo esc_html( $term->comment_count ); ?></b>
|
155 |
+
<i class='fa-solid fa-comment'></i>
|
156 |
</a>
|
157 |
+
<label><?php esc_html_e('Comment Status', 'grand-media'); ?></label>
|
158 |
<select name="term[comment_status]" class="form-control input-sm">
|
159 |
+
<option value="open"<?php selected($term->comment_status, 'open'); ?>><?php esc_html_e('Open', 'grand-media'); ?></option>
|
160 |
+
<option value="closed"<?php selected($term->comment_status, 'closed'); ?>><?php esc_html_e('Closed', 'grand-media'); ?></option>
|
161 |
</select>
|
162 |
</div>
|
163 |
+
<?php }
|
164 |
+
*/
|
165 |
+
?>
|
166 |
</div>
|
167 |
+
<div class="col-sm-6">
|
168 |
<?php if ( isset( $term->slug ) ) { ?>
|
169 |
<div class="form-group">
|
170 |
+
<label><?php esc_html_e( 'Slug', 'grand-media' ); ?></label>
|
171 |
<input type="text" class="form-control input-sm" name="term[slug]" value="<?php echo esc_attr( $term->slug ); ?>"/>
|
172 |
</div>
|
173 |
<?php } ?>
|
174 |
<?php if ( isset( $term->post_date ) ) { ?>
|
175 |
<div class="form-group">
|
176 |
+
<label><?php esc_html_e( 'Date', 'grand-media' ); ?></label>
|
177 |
|
178 |
+
<div
|
179 |
+
class="input-group gmedia_date"
|
180 |
+
id="datetimepicker<?php echo absint( $term->term_id ); ?>"
|
181 |
+
data-td-target-input="nearest"
|
182 |
+
data-td-target-toggle="nearest"
|
183 |
+
data-date-format="YYYY-MM-DD HH:mm:ss"
|
184 |
+
>
|
185 |
+
<input
|
186 |
+
name="term[post_date]"
|
187 |
+
id="datetimepicker<?php echo absint( $term->term_id ); ?>Input"
|
188 |
+
data-td-target="#datetimepicker<?php echo absint( $term->term_id ); ?>"
|
189 |
+
type="text"
|
190 |
+
readonly="readonly"
|
191 |
+
class="form-control input-sm"
|
192 |
+
value="<?php echo esc_attr( $term->post_date ); ?>"
|
193 |
+
tabindex="-1"
|
194 |
+
/>
|
195 |
+
<span
|
196 |
+
class="input-group-text btn-primary"
|
197 |
+
data-td-target="#datetimepicker<?php echo absint( $term->term_id ); ?>"
|
198 |
+
data-td-toggle="datetimepicker"
|
199 |
+
><i class='fa-solid fa-calendar-days'></i></span>
|
200 |
</div>
|
201 |
</div>
|
202 |
<?php } ?>
|
203 |
<?php $cover_id = isset( $term->meta['_cover'][0] ) ? $term->meta['_cover'][0] : ''; ?>
|
204 |
<div class="form-group">
|
205 |
+
<label><?php esc_html_e( 'Album Cover', 'grand-media' ); ?></label>
|
206 |
<div class="input-group">
|
207 |
+
<input type="text" class="form-control input-sm gmedia-cover-id" name="term[meta][_cover]" value="<?php echo esc_attr( $cover_id ); ?>" placeholder="<?php esc_attr_e( 'Gmedia Image ID', 'grand-media' ); ?>"/>
|
208 |
+
<span class="input-group-btn">
|
209 |
+
<a
|
210 |
+
href="<?php echo esc_url( $gmCore->get_admin_url( array( 'page' => 'GrandMedia', 'mode' => 'select_single', 'gmediablank' => 'library', 'filter' => 'image' ), array(), true ) ); ?>"
|
211 |
+
class="btn btn-primary preview-modal"
|
212 |
+
data-bs-toggle="modal"
|
213 |
+
data-bs-target="#previewModal"
|
214 |
+
data-width="1200"
|
215 |
+
data-height="500"
|
216 |
+
data-cls="select_gmedia_image"
|
217 |
+
title="<?php esc_attr_e( 'Choose Cover Image', 'grand-media' ); ?>"
|
218 |
+
>
|
219 |
+
<i class='fa-solid fa-image'></i>
|
220 |
+
</a>
|
221 |
+
</span>
|
222 |
</div>
|
223 |
</div>
|
224 |
+
<div class="gm-img-thumbnail gmedia-cover-image">
|
225 |
+
<?php
|
226 |
+
$cover_id = intval( $cover_id );
|
227 |
+
if ( $cover_id ) {
|
228 |
+
$cover = $gmDB->get_gmedia( $cover_id );
|
229 |
+
if ( $cover ) {
|
230 |
+
?>
|
231 |
+
<img src="<?php echo esc_url( $gmCore->gm_get_media_image( $cover, 'thumb' ) ); ?>" alt=""/>
|
232 |
+
<?php
|
233 |
} else {
|
234 |
+
echo '<strong class="text-danger">' . esc_html__( 'No image with such ID', 'grand-media' ) . '</strong>';
|
235 |
}
|
236 |
}
|
237 |
+
?>
|
238 |
+
</div>
|
239 |
</div>
|
240 |
</div>
|
241 |
</div>
|
258 |
<div class="modal-dialog">
|
259 |
<div class="modal-content">
|
260 |
<div class="modal-header">
|
261 |
+
<h4 class="modal-title"><?php esc_html_e( 'Add New Custom Field' ); ?></h4>
|
262 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
263 |
</div>
|
264 |
<form class="modal-body" method="post" id="newCustomFieldForm">
|
265 |
<?php
|
266 |
+
echo wp_kses( $gmCore->meta_form( 'gmedia_term' ), $gm_allowed_tags );
|
267 |
wp_nonce_field( 'gmedia_custom_field', '_wpnonce_custom_field' );
|
268 |
wp_referer_field();
|
269 |
?>
|
271 |
<input type="hidden" class="newcustomfield-for-id" name="ID" value=""/>
|
272 |
</form>
|
273 |
<div class="modal-footer">
|
274 |
+
<button type="button" class="btn btn-primary customfieldsubmit"><?php esc_html_e( 'Add', 'grand-media' ); ?></button>
|
275 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
276 |
</div>
|
277 |
</div>
|
278 |
</div>
|
282 |
<div class="modal-dialog">
|
283 |
<div class="modal-content">
|
284 |
<div class="modal-header">
|
|
|
285 |
<h4 class="modal-title"></h4>
|
286 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
287 |
</div>
|
288 |
<div class="modal-body"></div>
|
289 |
</div>
|
admin/pages/terms/tpl/album-list-item.php
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
die( '-1' );
|
5 |
-
}
|
6 |
|
7 |
/**
|
8 |
* Album list item
|
@@ -11,37 +8,41 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
11 |
* @var $gmedia_url
|
12 |
*/
|
13 |
?>
|
14 |
-
<div class="cb_list-item list-group-item term-list-item <?php echo implode( ' ', $item->classes ); ?>">
|
15 |
<div class="row cb_object">
|
16 |
-
<div class="col-
|
17 |
-
<div class="checkbox">
|
18 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> value="<?php echo absint( $item->term_id ); ?>"/>
|
19 |
<?php if ( $item->allow_edit ) { ?>
|
20 |
-
<a class="term_name" href="<?php echo esc_url( add_query_arg(
|
21 |
<?php } else { ?>
|
22 |
<span class="term_name"><?php echo esc_html( $item->name ); ?></span>
|
23 |
<?php } ?>
|
24 |
-
<br/><span class="term_info_author"
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
31 |
<br/><span class="term_id">ID: <?php echo absint( $item->term_id ); ?></span>
|
32 |
<?php if ( ! empty( $item->post_date ) ) { ?>
|
33 |
-
<date class="term_date"><?php echo $item->post_date; ?></date>
|
34 |
<?php } ?>
|
35 |
|
36 |
<div class="object-actions">
|
37 |
-
<?php
|
38 |
-
|
39 |
-
echo
|
|
|
40 |
?>
|
41 |
</div>
|
42 |
</div>
|
43 |
</div>
|
44 |
-
<div class="col-
|
45 |
<?php gmedia_term_item_thumbnails( $item ); ?>
|
46 |
</div>
|
47 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Album list item
|
8 |
* @var $gmedia_url
|
9 |
*/
|
10 |
?>
|
11 |
+
<div class="cb_list-item list-group-item term-list-item <?php echo esc_attr( implode( ' ', $item->classes ) ); ?>">
|
12 |
<div class="row cb_object">
|
13 |
+
<div class="col-sm-6 term-label">
|
14 |
+
<div class="checkbox position-relative">
|
15 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> value="<?php echo absint( $item->term_id ); ?>"/>
|
16 |
<?php if ( $item->allow_edit ) { ?>
|
17 |
+
<a class="term_name" href="<?php echo esc_url( add_query_arg( array( 'edit_term' => $item->term_id ), $gmedia_url ) ); ?>"><?php echo esc_html( $item->name ); ?></a>
|
18 |
<?php } else { ?>
|
19 |
<span class="term_name"><?php echo esc_html( $item->name ); ?></span>
|
20 |
<?php } ?>
|
21 |
+
<br/><span class="term_info_author">
|
22 |
+
<?php
|
23 |
+
if ( $item->global ) {
|
24 |
+
// translators: author name.
|
25 |
+
echo $item->author_name ? sprintf( esc_html__( 'by %s', 'grand-media' ), esc_html( $item->author_name ) ) : '(' . esc_html__( 'deleted author', 'grand-media' ) . ')';
|
26 |
+
} else {
|
27 |
+
echo '(' . esc_html__( 'no author', 'grand-media' ) . ')';
|
28 |
+
}
|
29 |
+
?>
|
30 |
+
</span>
|
31 |
<br/><span class="term_id">ID: <?php echo absint( $item->term_id ); ?></span>
|
32 |
<?php if ( ! empty( $item->post_date ) ) { ?>
|
33 |
+
<date class="term_date"><?php echo esc_html( $item->post_date ); ?></date>
|
34 |
<?php } ?>
|
35 |
|
36 |
<div class="object-actions">
|
37 |
+
<?php
|
38 |
+
$action_links = gmedia_term_item_actions( $item );
|
39 |
+
echo wp_kses_post( $action_links['share'] );
|
40 |
+
echo '<br/>' . wp_kses_post( $action_links['filter'] . $action_links['delete'] );
|
41 |
?>
|
42 |
</div>
|
43 |
</div>
|
44 |
</div>
|
45 |
+
<div class="col-sm-6">
|
46 |
<?php gmedia_term_item_thumbnails( $item ); ?>
|
47 |
</div>
|
48 |
</div>
|
admin/pages/terms/tpl/category-create-item.php
CHANGED
@@ -1,81 +1,88 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* Add Album Form
|
8 |
*/
|
9 |
-
global $gmProcessor, $gmGallery;
|
10 |
$gmedia_url = $gmProcessor->url;
|
11 |
|
12 |
$_orderby = $gmGallery->options['in_category_orderby'];
|
13 |
$_order = $gmGallery->options['in_category_order'];
|
14 |
?>
|
15 |
-
<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="
|
16 |
<div class="row">
|
17 |
-
<div class="col-
|
18 |
<div class="form-group">
|
19 |
-
<label><?php
|
20 |
-
<input type="text" class="form-control input-sm" name="term[name]" placeholder="<?php
|
21 |
</div>
|
22 |
<div class="form-group">
|
23 |
-
<label><?php
|
24 |
<?php
|
25 |
-
wp_editor(
|
26 |
-
'
|
27 |
-
'
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
?>
|
36 |
</div>
|
37 |
</div>
|
38 |
-
<div class="col-
|
39 |
<div class="form-group row">
|
40 |
-
<div class="col-
|
41 |
-
<label><?php
|
42 |
<select name="term[meta][_orderby]" class="form-control input-sm">
|
43 |
-
<option value="ID"<?php selected( $_orderby, 'ID' ); ?>><?php
|
44 |
-
<option value="title"<?php selected( $_orderby, 'title' ); ?>><?php
|
45 |
-
<option value="gmuid"<?php selected( $_orderby, 'gmuid' ); ?>><?php
|
46 |
-
<option value="date"<?php selected( $_orderby, 'date' ); ?>><?php
|
47 |
-
<option value="modified"<?php selected( $_orderby, 'modified' ); ?>><?php
|
48 |
-
<option value="_created_timestamp" <?php selected( $_orderby, '_created_timestamp' ); ?>><?php
|
49 |
-
<option value="comment_count" <?php selected( $_orderby, 'comment_count' ); ?>><?php
|
50 |
-
<option value="views" <?php selected( $_orderby, 'views' ); ?>><?php
|
51 |
-
<option value="likes" <?php selected( $_orderby, 'likes' ); ?>><?php
|
52 |
-
<option value="_size" <?php selected( $_orderby, '_size' ); ?>><?php
|
53 |
-
<option value="rand"<?php selected( $_orderby, 'rand' ); ?>><?php
|
54 |
</select>
|
55 |
</div>
|
56 |
-
<div class="col-
|
57 |
-
<label><?php
|
58 |
<select name="term[meta][_order]" class="form-control input-sm">
|
59 |
-
<option value="DESC"<?php selected( $_order, 'DESC' ); ?>><?php
|
60 |
-
<option value="ASC"<?php selected( $_order, 'ASC' ); ?>><?php
|
61 |
</select>
|
62 |
</div>
|
63 |
</div>
|
64 |
<div class="row">
|
65 |
-
<div class="col-
|
66 |
<div class="form-group">
|
67 |
-
<label><?php
|
68 |
<select class="form-control input-sm" id="term_module_preset" name="term[meta][_module_preset]">
|
69 |
-
<option value=""
|
|
|
|
|
70 |
echo ' selected="selected"';
|
71 |
-
}
|
72 |
-
|
|
|
|
|
|
|
73 |
$gmedia_modules = get_gmedia_modules( false );
|
74 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
75 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
76 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
77 |
-
$option =
|
78 |
-
$option[] = '<option value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title']
|
79 |
foreach ( $presets as $preset ) {
|
80 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
81 |
continue;
|
@@ -85,20 +92,20 @@ $_order = $gmGallery->options['in_category_order'];
|
|
85 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
86 |
}
|
87 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
88 |
-
$option[] = '<option value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author
|
89 |
} else {
|
90 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
91 |
-
$option[] = '<option value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
92 |
}
|
93 |
}
|
94 |
-
echo implode( '', $option );
|
95 |
echo '</optgroup>';
|
96 |
}
|
97 |
?>
|
98 |
</select>
|
99 |
</div>
|
100 |
</div>
|
101 |
-
<div class="col-
|
102 |
<div class="form-group">
|
103 |
<label> </label>
|
104 |
<?php
|
@@ -106,7 +113,7 @@ $_order = $gmGallery->options['in_category_order'];
|
|
106 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
107 |
?>
|
108 |
<input type="hidden" name="term[taxonomy]" value="gmedia_category"/>
|
109 |
-
<button style="display:block" type="submit" class="btn btn-primary btn-sm" name="gmedia_category_save"><?php
|
110 |
</div>
|
111 |
</div>
|
112 |
</div>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Add Album Form
|
6 |
*/
|
7 |
+
global $gmProcessor, $gmGallery, $gm_allowed_tags;
|
8 |
$gmedia_url = $gmProcessor->url;
|
9 |
|
10 |
$_orderby = $gmGallery->options['in_category_orderby'];
|
11 |
$_order = $gmGallery->options['in_category_order'];
|
12 |
?>
|
13 |
+
<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="card-body" action="<?php echo esc_url( $gmedia_url ); ?>" style="padding-bottom:0; border-bottom:1px solid #ddd;">
|
14 |
<div class="row">
|
15 |
+
<div class="col-sm-6">
|
16 |
<div class="form-group">
|
17 |
+
<label><?php esc_html_e( 'Name', 'grand-media' ); ?></label>
|
18 |
+
<input type="text" class="form-control input-sm" name="term[name]" placeholder="<?php esc_attr_e( 'Category Name', 'grand-media' ); ?>" required/>
|
19 |
</div>
|
20 |
<div class="form-group">
|
21 |
+
<label><?php esc_html_e( 'Description', 'grand-media' ); ?></label>
|
22 |
<?php
|
23 |
+
wp_editor(
|
24 |
+
'',
|
25 |
+
'category_description',
|
26 |
+
array(
|
27 |
+
'editor_class' => 'form-control input-sm',
|
28 |
+
'editor_height' => 120,
|
29 |
+
'wpautop' => false,
|
30 |
+
'media_buttons' => false,
|
31 |
+
'textarea_name' => 'term[description]',
|
32 |
+
'textarea_rows' => '4',
|
33 |
+
'tinymce' => false,
|
34 |
+
'quicktags' => array( 'buttons' => apply_filters( 'gmedia_editor_quicktags', 'strong,em,link,ul,li,close' ) ),
|
35 |
+
)
|
36 |
+
);
|
37 |
?>
|
38 |
</div>
|
39 |
</div>
|
40 |
+
<div class="col-sm-6">
|
41 |
<div class="form-group row">
|
42 |
+
<div class="col-sm-6">
|
43 |
+
<label><?php esc_html_e( 'Order gmedia', 'grand-media' ); ?></label>
|
44 |
<select name="term[meta][_orderby]" class="form-control input-sm">
|
45 |
+
<option value="ID"<?php selected( $_orderby, 'ID' ); ?>><?php esc_html_e( 'by ID', 'grand-media' ); ?></option>
|
46 |
+
<option value="title"<?php selected( $_orderby, 'title' ); ?>><?php esc_html_e( 'by title', 'grand-media' ); ?></option>
|
47 |
+
<option value="gmuid"<?php selected( $_orderby, 'gmuid' ); ?>><?php esc_html_e( 'by filename', 'grand-media' ); ?></option>
|
48 |
+
<option value="date"<?php selected( $_orderby, 'date' ); ?>><?php esc_html_e( 'by date', 'grand-media' ); ?></option>
|
49 |
+
<option value="modified"<?php selected( $_orderby, 'modified' ); ?>><?php esc_html_e( 'by last modified date', 'grand-media' ); ?></option>
|
50 |
+
<option value="_created_timestamp" <?php selected( $_orderby, '_created_timestamp' ); ?>><?php esc_html_e( 'by created timestamp', 'grand-media' ); ?></option>
|
51 |
+
<option value="comment_count" <?php selected( $_orderby, 'comment_count' ); ?>><?php esc_html_e( 'by comment count', 'grand-media' ); ?></option>
|
52 |
+
<option value="views" <?php selected( $_orderby, 'views' ); ?>><?php esc_html_e( 'by views', 'grand-media' ); ?></option>
|
53 |
+
<option value="likes" <?php selected( $_orderby, 'likes' ); ?>><?php esc_html_e( 'by likes', 'grand-media' ); ?></option>
|
54 |
+
<option value="_size" <?php selected( $_orderby, '_size' ); ?>><?php esc_html_e( 'by file size', 'grand-media' ); ?></option>
|
55 |
+
<option value="rand"<?php selected( $_orderby, 'rand' ); ?>><?php esc_html_e( 'Random', 'grand-media' ); ?></option>
|
56 |
</select>
|
57 |
</div>
|
58 |
+
<div class="col-sm-6">
|
59 |
+
<label><?php esc_html_e( 'Sort order', 'grand-media' ); ?></label>
|
60 |
<select name="term[meta][_order]" class="form-control input-sm">
|
61 |
+
<option value="DESC"<?php selected( $_order, 'DESC' ); ?>><?php esc_html_e( 'DESC', 'grand-media' ); ?></option>
|
62 |
+
<option value="ASC"<?php selected( $_order, 'ASC' ); ?>><?php esc_html_e( 'ASC', 'grand-media' ); ?></option>
|
63 |
</select>
|
64 |
</div>
|
65 |
</div>
|
66 |
<div class="row">
|
67 |
+
<div class="col-sm-6">
|
68 |
<div class="form-group">
|
69 |
+
<label><?php esc_html_e( 'Module/Preset', 'grand-media' ); ?></label>
|
70 |
<select class="form-control input-sm" id="term_module_preset" name="term[meta][_module_preset]">
|
71 |
+
<option value=""
|
72 |
+
<?php
|
73 |
+
if ( empty( $term->meta['_module_preset'][0] ) ) {
|
74 |
echo ' selected="selected"';
|
75 |
+
}
|
76 |
+
?>
|
77 |
+
><?php esc_html_e( 'Default module in Global Settings', 'grand-media' ); ?></option>
|
78 |
+
<?php
|
79 |
+
global $gmDB, $user_ID;
|
80 |
$gmedia_modules = get_gmedia_modules( false );
|
81 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
82 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
83 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $mfold ) );
|
84 |
+
$option = array();
|
85 |
+
$option[] = '<option value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title'] . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
86 |
foreach ( $presets as $preset ) {
|
87 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
88 |
continue;
|
92 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
93 |
}
|
94 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
95 |
+
$option[] = '<option value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
96 |
} else {
|
97 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
98 |
+
$option[] = '<option value="' . intval( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
99 |
}
|
100 |
}
|
101 |
+
echo wp_kses( implode( '', $option ), $gm_allowed_tags );
|
102 |
echo '</optgroup>';
|
103 |
}
|
104 |
?>
|
105 |
</select>
|
106 |
</div>
|
107 |
</div>
|
108 |
+
<div class="col-sm-6">
|
109 |
<div class="form-group">
|
110 |
<label> </label>
|
111 |
<?php
|
113 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
114 |
?>
|
115 |
<input type="hidden" name="term[taxonomy]" value="gmedia_category"/>
|
116 |
+
<button style="display:block" type="submit" class="btn btn-primary btn-sm" name="gmedia_category_save"><?php esc_html_e( 'Add New Category', 'grand-media' ); ?></button>
|
117 |
</div>
|
118 |
</div>
|
119 |
</div>
|
admin/pages/terms/tpl/category-edit-item.php
CHANGED
@@ -1,95 +1,96 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
|
|
6 |
/**
|
7 |
* Edit Category Form
|
|
|
|
|
8 |
*/
|
9 |
$_orderby = ! empty( $term->meta['_orderby'][0] ) ? $term->meta['_orderby'][0] : $gmGallery->options['in_category_orderby'];
|
10 |
$_order = ! empty( $term->meta['_order'][0] ) ? $term->meta['_order'][0] : $gmGallery->options['in_category_order'];
|
11 |
$_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_module_preset'][0] : '';
|
12 |
?>
|
13 |
-
<form method="post" id="gmedia-edit-term" name="gmEditTerm" class="
|
14 |
<h4 style="margin-top:0;">
|
15 |
-
<span class="
|
16 |
-
<?php
|
17 |
</h4>
|
18 |
|
19 |
<div class="row">
|
20 |
-
<div class="col-
|
21 |
<div class="form-group">
|
22 |
-
<label><?php
|
23 |
-
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr( $term->name ); ?>" placeholder="<?php
|
24 |
</div>
|
25 |
<div class="form-group">
|
26 |
-
<label><?php
|
27 |
<?php
|
28 |
-
wp_editor(
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
?>
|
39 |
</div>
|
40 |
-
<div class="text-
|
41 |
<?php
|
42 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
43 |
wp_referer_field();
|
44 |
?>
|
45 |
<input type="hidden" name="term[term_id]" value="<?php echo absint( $term->term_id ); ?>"/>
|
46 |
<input type="hidden" name="term[taxonomy]" value="<?php echo esc_attr( $term->taxonomy ); ?>"/>
|
47 |
-
<button type="submit" class="btn btn-primary btn-sm" name="gmedia_category_save"><?php
|
48 |
</div>
|
49 |
</div>
|
50 |
-
<div class="col-
|
51 |
<div class="row">
|
52 |
-
<div class="col-
|
53 |
<div class="form-group">
|
54 |
-
<label><?php
|
55 |
<select name="term[meta][_orderby]" class="form-control input-sm">
|
56 |
-
<option value="ID"<?php selected( $_orderby, 'ID' ); ?>><?php
|
57 |
-
<option value="title"<?php selected( $_orderby, 'title' ); ?>><?php
|
58 |
-
<option value="gmuid"<?php selected( $_orderby, 'gmuid' ); ?>><?php
|
59 |
-
<option value="date"<?php selected( $_orderby, 'date' ); ?>><?php
|
60 |
-
<option value="modified"<?php selected( $_orderby, 'modified' ); ?>><?php
|
61 |
-
<option value="_created_timestamp" <?php selected( $_orderby, '_created_timestamp' ); ?>><?php
|
62 |
-
<option value="comment_count" <?php selected( $_orderby, 'comment_count' ); ?>><?php
|
63 |
-
<option value="views" <?php selected( $_orderby, 'views' ); ?>><?php
|
64 |
-
<option value="likes" <?php selected( $_orderby, 'likes' ); ?>><?php
|
65 |
-
<option value="_size" <?php selected( $_orderby, '_size' ); ?>><?php
|
66 |
-
<option value="rand"<?php selected( $_orderby, 'rand' ); ?>><?php
|
67 |
</select>
|
68 |
</div>
|
69 |
<div class="form-group">
|
70 |
-
<label><?php
|
71 |
<select name="term[meta][_order]" class="form-control input-sm">
|
72 |
-
<option value="DESC"<?php selected( $_order, 'DESC' ); ?>><?php
|
73 |
-
<option value="ASC"<?php selected( $_order, 'ASC' ); ?>><?php
|
74 |
</select>
|
75 |
</div>
|
76 |
-
<?php
|
77 |
-
|
78 |
-
?>
|
79 |
<div class="form-group">
|
80 |
-
<label><?php
|
81 |
<select class="form-control input-sm" id="term_module_preset" name="term[meta][_module_preset]">
|
82 |
-
<option value=""<?php
|
83 |
-
|
84 |
-
|
85 |
-
<?php global $gmDB, $user_ID, $gmGallery;
|
86 |
$gmedia_modules = get_gmedia_modules( false );
|
87 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
88 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
89 |
-
$presets = $gmDB->get_terms( 'gmedia_module',
|
90 |
$selected = selected( $_module_preset, esc_attr( $mfold ), false );
|
91 |
-
$option =
|
92 |
-
$option[] = '<option ' . $selected . ' value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title']
|
93 |
foreach ( $presets as $preset ) {
|
94 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
95 |
continue;
|
@@ -100,38 +101,57 @@ $_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_mo
|
|
100 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
101 |
}
|
102 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
103 |
-
$option[] = '<option ' . $selected . ' value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author
|
104 |
} else {
|
105 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
106 |
-
$option[] = '<option ' . $selected . ' value="' . $preset->term_id . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
107 |
}
|
108 |
}
|
109 |
-
echo implode( '', $option );
|
110 |
echo '</optgroup>';
|
111 |
}
|
112 |
?>
|
113 |
</select>
|
114 |
</div>
|
115 |
-
<p><a href="<?php echo esc_url( $term->cloud_link ); ?>" target="_blank"><?php
|
116 |
</div>
|
117 |
-
<div class="col-
|
118 |
<?php $cover_id = isset( $term->meta['_cover'][0] ) ? $term->meta['_cover'][0] : ''; ?>
|
119 |
<div class="form-group">
|
120 |
-
<label><?php
|
121 |
<div class="input-group">
|
122 |
-
<input type="text" class="form-control input-sm gmedia-cover-id" name="term[meta][_cover]" value="<?php echo esc_attr( $cover_id ); ?>" placeholder="<?php
|
123 |
-
<span class="input-group-btn"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
</div>
|
125 |
</div>
|
126 |
-
<div class="gm-img-thumbnail gmedia-cover-image"
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
130 |
} else {
|
131 |
-
echo '<strong class="text-danger">' .
|
132 |
}
|
133 |
}
|
134 |
-
|
|
|
135 |
</div>
|
136 |
</div>
|
137 |
</div>
|
@@ -153,12 +173,12 @@ $_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_mo
|
|
153 |
<div class="modal-dialog">
|
154 |
<div class="modal-content">
|
155 |
<div class="modal-header">
|
156 |
-
<
|
157 |
-
<
|
158 |
</div>
|
159 |
<form class="modal-body" method="post" id="newCustomFieldForm">
|
160 |
<?php
|
161 |
-
echo $gmCore->meta_form(
|
162 |
wp_nonce_field( 'gmedia_custom_field', '_wpnonce_custom_field' );
|
163 |
wp_referer_field();
|
164 |
?>
|
@@ -166,8 +186,8 @@ $_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_mo
|
|
166 |
<input type="hidden" class="newcustomfield-for-id" name="ID" value=""/>
|
167 |
</form>
|
168 |
<div class="modal-footer">
|
169 |
-
<button type="button" class="btn btn-primary customfieldsubmit"><?php
|
170 |
-
<button type="button" class="btn btn-
|
171 |
</div>
|
172 |
</div>
|
173 |
</div>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
+
global $gmGallery, $gmCore, $gm_allowed_tags;
|
5 |
/**
|
6 |
* Edit Category Form
|
7 |
+
*
|
8 |
+
* @var $term
|
9 |
*/
|
10 |
$_orderby = ! empty( $term->meta['_orderby'][0] ) ? $term->meta['_orderby'][0] : $gmGallery->options['in_category_orderby'];
|
11 |
$_order = ! empty( $term->meta['_order'][0] ) ? $term->meta['_order'][0] : $gmGallery->options['in_category_order'];
|
12 |
$_module_preset = ! empty( $term->meta['_module_preset'][0] ) ? $term->meta['_module_preset'][0] : '';
|
13 |
?>
|
14 |
+
<form method="post" id="gmedia-edit-term" name="gmEditTerm" class="card-body" data-id="<?php echo absint( $term->term_id ); ?>" action="<?php echo esc_url( gm_get_admin_url() ); ?>">
|
15 |
<h4 style="margin-top:0;">
|
16 |
+
<span class="float-end"><?php echo esc_html( __( 'ID', 'grand-media' ) . ": {$term->term_id}" ); ?></span>
|
17 |
+
<?php esc_html_e( 'Edit Category' ); ?>: <em><?php echo esc_html( $term->name ); ?></em>
|
18 |
</h4>
|
19 |
|
20 |
<div class="row">
|
21 |
+
<div class="col-sm-6">
|
22 |
<div class="form-group">
|
23 |
+
<label><?php esc_html_e( 'Name', 'grand-media' ); ?></label>
|
24 |
+
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr( $term->name ); ?>" placeholder="<?php esc_attr_e( 'Category Name', 'grand-media' ); ?>" required/>
|
25 |
</div>
|
26 |
<div class="form-group">
|
27 |
+
<label><?php esc_html_e( 'Description', 'grand-media' ); ?></label>
|
28 |
<?php
|
29 |
+
wp_editor(
|
30 |
+
$term->description,
|
31 |
+
"category{$term->term_id}_description",
|
32 |
+
array(
|
33 |
+
'editor_class' => 'form-control input-sm',
|
34 |
+
'editor_height' => 120,
|
35 |
+
'wpautop' => false,
|
36 |
+
'media_buttons' => false,
|
37 |
+
'textarea_name' => 'term[description]',
|
38 |
+
'textarea_rows' => '4',
|
39 |
+
'tinymce' => false,
|
40 |
+
'quicktags' => array( 'buttons' => apply_filters( 'gmedia_editor_quicktags', 'strong,em,link,ul,li,close' ) ),
|
41 |
+
)
|
42 |
+
);
|
43 |
?>
|
44 |
</div>
|
45 |
+
<div class="text-end">
|
46 |
<?php
|
47 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
48 |
wp_referer_field();
|
49 |
?>
|
50 |
<input type="hidden" name="term[term_id]" value="<?php echo absint( $term->term_id ); ?>"/>
|
51 |
<input type="hidden" name="term[taxonomy]" value="<?php echo esc_attr( $term->taxonomy ); ?>"/>
|
52 |
+
<button type="submit" class="btn btn-primary btn-sm" name="gmedia_category_save"><?php esc_html_e( 'Update', 'grand-media' ); ?></button>
|
53 |
</div>
|
54 |
</div>
|
55 |
+
<div class="col-sm-6">
|
56 |
<div class="row">
|
57 |
+
<div class="col-sm-6">
|
58 |
<div class="form-group">
|
59 |
+
<label><?php esc_html_e( 'Order gmedia', 'grand-media' ); ?></label>
|
60 |
<select name="term[meta][_orderby]" class="form-control input-sm">
|
61 |
+
<option value="ID"<?php selected( $_orderby, 'ID' ); ?>><?php esc_html_e( 'by ID', 'grand-media' ); ?></option>
|
62 |
+
<option value="title"<?php selected( $_orderby, 'title' ); ?>><?php esc_html_e( 'by title', 'grand-media' ); ?></option>
|
63 |
+
<option value="gmuid"<?php selected( $_orderby, 'gmuid' ); ?>><?php esc_html_e( 'by filename', 'grand-media' ); ?></option>
|
64 |
+
<option value="date"<?php selected( $_orderby, 'date' ); ?>><?php esc_html_e( 'by date', 'grand-media' ); ?></option>
|
65 |
+
<option value="modified"<?php selected( $_orderby, 'modified' ); ?>><?php esc_html_e( 'by last modified date', 'grand-media' ); ?></option>
|
66 |
+
<option value="_created_timestamp" <?php selected( $_orderby, '_created_timestamp' ); ?>><?php esc_html_e( 'by created timestamp', 'grand-media' ); ?></option>
|
67 |
+
<option value="comment_count" <?php selected( $_orderby, 'comment_count' ); ?>><?php esc_html_e( 'by comment count', 'grand-media' ); ?></option>
|
68 |
+
<option value="views" <?php selected( $_orderby, 'views' ); ?>><?php esc_html_e( 'by views', 'grand-media' ); ?></option>
|
69 |
+
<option value="likes" <?php selected( $_orderby, 'likes' ); ?>><?php esc_html_e( 'by likes', 'grand-media' ); ?></option>
|
70 |
+
<option value="_size" <?php selected( $_orderby, '_size' ); ?>><?php esc_html_e( 'by file size', 'grand-media' ); ?></option>
|
71 |
+
<option value="rand"<?php selected( $_orderby, 'rand' ); ?>><?php esc_html_e( 'Random', 'grand-media' ); ?></option>
|
72 |
</select>
|
73 |
</div>
|
74 |
<div class="form-group">
|
75 |
+
<label><?php esc_html_e( 'Sort order', 'grand-media' ); ?></label>
|
76 |
<select name="term[meta][_order]" class="form-control input-sm">
|
77 |
+
<option value="DESC"<?php selected( $_order, 'DESC' ); ?>><?php esc_html_e( 'DESC', 'grand-media' ); ?></option>
|
78 |
+
<option value="ASC"<?php selected( $_order, 'ASC' ); ?>><?php esc_html_e( 'ASC', 'grand-media' ); ?></option>
|
79 |
</select>
|
80 |
</div>
|
|
|
|
|
|
|
81 |
<div class="form-group">
|
82 |
+
<label><?php esc_html_e( 'Module/Preset', 'grand-media' ); ?></label>
|
83 |
<select class="form-control input-sm" id="term_module_preset" name="term[meta][_module_preset]">
|
84 |
+
<option value="" <?php echo empty( $term->meta['_module_preset'][0] ) ? 'selected="selected"' : ''; ?>><?php esc_html_e( 'Default module in Global Settings', 'grand-media' ); ?></option>
|
85 |
+
<?php
|
86 |
+
global $gmDB, $user_ID, $gmGallery;
|
|
|
87 |
$gmedia_modules = get_gmedia_modules( false );
|
88 |
foreach ( $gmedia_modules['in'] as $mfold => $module ) {
|
89 |
echo '<optgroup label="' . esc_attr( $module['title'] ) . '">';
|
90 |
+
$presets = $gmDB->get_terms( 'gmedia_module', array( 'status' => $mfold ) );
|
91 |
$selected = selected( $_module_preset, esc_attr( $mfold ), false );
|
92 |
+
$option = array();
|
93 |
+
$option[] = '<option ' . $selected . ' value="' . esc_attr( $mfold ) . '">' . esc_html( $module['title'] . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
94 |
foreach ( $presets as $preset ) {
|
95 |
if ( ! (int) $preset->global && '[' . $mfold . ']' === $preset->name ) {
|
96 |
continue;
|
101 |
$by_author = ' [' . get_the_author_meta( 'display_name', $preset->global ) . ']';
|
102 |
}
|
103 |
if ( '[' . $mfold . ']' === $preset->name ) {
|
104 |
+
$option[] = '<option ' . $selected . ' value="' . esc_attr( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . __( 'Default Settings' ) ) . '</option>';
|
105 |
} else {
|
106 |
$preset_name = str_replace( '[' . $mfold . '] ', '', $preset->name );
|
107 |
+
$option[] = '<option ' . $selected . ' value="' . esc_attr( $preset->term_id ) . '">' . esc_html( $module['title'] . $by_author . ' - ' . $preset_name ) . '</option>';
|
108 |
}
|
109 |
}
|
110 |
+
echo wp_kses( implode( '', $option ), $gm_allowed_tags );
|
111 |
echo '</optgroup>';
|
112 |
}
|
113 |
?>
|
114 |
</select>
|
115 |
</div>
|
116 |
+
<p><a href="<?php echo esc_url( $term->cloud_link ); ?>" target="_blank"><?php esc_html_e( 'View GmediaCloud Page', 'grand-media' ); ?></a></p>
|
117 |
</div>
|
118 |
+
<div class="col-sm-6">
|
119 |
<?php $cover_id = isset( $term->meta['_cover'][0] ) ? $term->meta['_cover'][0] : ''; ?>
|
120 |
<div class="form-group">
|
121 |
+
<label><?php esc_html_e( 'Category Cover', 'grand-media' ); ?></label>
|
122 |
<div class="input-group">
|
123 |
+
<input type="text" class="form-control input-sm gmedia-cover-id" name="term[meta][_cover]" value="<?php echo esc_attr( $cover_id ); ?>" placeholder="<?php esc_attr_e( 'Gmedia Image ID', 'grand-media' ); ?>"/>
|
124 |
+
<span class="input-group-btn">
|
125 |
+
<a
|
126 |
+
href="<?php echo esc_url( $gmCore->get_admin_url( array( 'page' => 'GrandMedia', 'mode' => 'select_single', 'gmediablank' => 'library', 'filter' => 'image' ), array(), true ) ); ?>"
|
127 |
+
class="btn btn-primary preview-modal"
|
128 |
+
data-bs-toggle="modal"
|
129 |
+
data-bs-target="#previewModal"
|
130 |
+
data-width="1200"
|
131 |
+
data-height="500"
|
132 |
+
data-cls="select_gmedia_image"
|
133 |
+
title="<?php esc_attr_e( 'Choose Cover Image', 'grand-media' ); ?>"
|
134 |
+
>
|
135 |
+
<i class='fa-solid fa-image'></i>
|
136 |
+
</a>
|
137 |
+
</span>
|
138 |
</div>
|
139 |
</div>
|
140 |
+
<div class="gm-img-thumbnail gmedia-cover-image">
|
141 |
+
<?php
|
142 |
+
$cover_id = intval( $cover_id );
|
143 |
+
if ( $cover_id ) {
|
144 |
+
$cover = $gmDB->get_gmedia( $cover_id );
|
145 |
+
if ( $cover ) {
|
146 |
+
?>
|
147 |
+
<img src="<?php echo esc_url( $gmCore->gm_get_media_image( $cover, 'thumb' ) ); ?>" alt=""/>
|
148 |
+
<?php
|
149 |
} else {
|
150 |
+
echo '<strong class="text-danger">' . esc_html__( 'No image with such ID', 'grand-media' ) . '</strong>';
|
151 |
}
|
152 |
}
|
153 |
+
?>
|
154 |
+
</div>
|
155 |
</div>
|
156 |
</div>
|
157 |
</div>
|
173 |
<div class="modal-dialog">
|
174 |
<div class="modal-content">
|
175 |
<div class="modal-header">
|
176 |
+
<h4 class="modal-title"><?php esc_html_e( 'Add New Custom Field' ); ?></h4>
|
177 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
178 |
</div>
|
179 |
<form class="modal-body" method="post" id="newCustomFieldForm">
|
180 |
<?php
|
181 |
+
echo wp_kses( $gmCore->meta_form( 'gmedia_term' ), $gm_allowed_tags );
|
182 |
wp_nonce_field( 'gmedia_custom_field', '_wpnonce_custom_field' );
|
183 |
wp_referer_field();
|
184 |
?>
|
186 |
<input type="hidden" class="newcustomfield-for-id" name="ID" value=""/>
|
187 |
</form>
|
188 |
<div class="modal-footer">
|
189 |
+
<button type="button" class="btn btn-primary customfieldsubmit"><?php esc_html_e( 'Add', 'grand-media' ); ?></button>
|
190 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
191 |
</div>
|
192 |
</div>
|
193 |
</div>
|
admin/pages/terms/tpl/category-list-item.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* Category list item
|
8 |
*
|
9 |
* @var $item
|
|
|
10 |
*/
|
11 |
?>
|
12 |
-
<div class="cb_list-item list-group-item term-list-item <?php echo implode( ' ', $item->classes ); ?>">
|
13 |
<div class="row cb_object">
|
14 |
-
<div class="col-
|
15 |
-
<div class="checkbox">
|
16 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> value="<?php echo absint( $item->term_id ); ?>"/>
|
17 |
<?php if ( $item->allow_edit ) { ?>
|
18 |
-
<a class="term_name" href="<?php echo esc_url( add_query_arg(
|
19 |
<?php } else { ?>
|
20 |
<span class="term_name"><?php echo esc_html( $item->name ); ?></span>
|
21 |
<?php } ?>
|
22 |
<br/><span class="term_id">ID: <?php echo absint( $item->term_id ); ?></span>
|
23 |
|
24 |
<div class="object-actions">
|
25 |
-
<?php
|
26 |
-
|
27 |
-
echo
|
|
|
28 |
?>
|
29 |
</div>
|
30 |
</div>
|
31 |
</div>
|
32 |
-
<div class="col-
|
33 |
<?php gmedia_term_item_thumbnails( $item ); ?>
|
34 |
</div>
|
35 |
</div>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Category list item
|
6 |
*
|
7 |
* @var $item
|
8 |
+
* @var $gmedia_url
|
9 |
*/
|
10 |
?>
|
11 |
+
<div class="cb_list-item list-group-item term-list-item <?php echo esc_attr( implode( ' ', $item->classes ) ); ?>">
|
12 |
<div class="row cb_object">
|
13 |
+
<div class="col-sm-6 term-label">
|
14 |
+
<div class="checkbox position-relative">
|
15 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> value="<?php echo absint( $item->term_id ); ?>"/>
|
16 |
<?php if ( $item->allow_edit ) { ?>
|
17 |
+
<a class="term_name" href="<?php echo esc_url( add_query_arg( array( 'edit_term' => $item->term_id ), $gmedia_url ) ); ?>"><?php echo esc_html( $item->name ); ?></a>
|
18 |
<?php } else { ?>
|
19 |
<span class="term_name"><?php echo esc_html( $item->name ); ?></span>
|
20 |
<?php } ?>
|
21 |
<br/><span class="term_id">ID: <?php echo absint( $item->term_id ); ?></span>
|
22 |
|
23 |
<div class="object-actions">
|
24 |
+
<?php
|
25 |
+
$action_links = gmedia_term_item_actions( $item );
|
26 |
+
echo wp_kses_post( $action_links['share'] );
|
27 |
+
echo '<br/>' . wp_kses_post( $action_links['filter'] . $action_links['delete'] );
|
28 |
?>
|
29 |
</div>
|
30 |
</div>
|
31 |
</div>
|
32 |
+
<div class="col-sm-6">
|
33 |
<?php gmedia_term_item_thumbnails( $item ); ?>
|
34 |
</div>
|
35 |
</div>
|
admin/pages/terms/tpl/no-items.php
CHANGED
@@ -1,15 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* No term items
|
8 |
*/
|
9 |
?>
|
10 |
<div class="list-group-item">
|
11 |
-
<div class="
|
12 |
-
<h4><?php
|
13 |
</div>
|
14 |
</div>
|
15 |
-
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* No term items
|
6 |
*/
|
7 |
?>
|
8 |
<div class="list-group-item">
|
9 |
+
<div class="alert alert-secondary pt-5 pb-5 m-0 text-center">
|
10 |
+
<h4><?php esc_html_e( 'No items to show.', 'grand-media' ); ?></h4>
|
11 |
</div>
|
12 |
</div>
|
|
admin/pages/terms/tpl/tag-create-item.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* Create tags form
|
@@ -10,21 +8,23 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
10 |
global $gmProcessor;
|
11 |
$gmedia_url = $gmProcessor->url;
|
12 |
?>
|
13 |
-
<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="
|
14 |
<div class="row">
|
15 |
-
<div class="form-group col-
|
16 |
-
<label><?php
|
17 |
-
<small class="text-muted">(<?php
|
18 |
</label>
|
19 |
-
<input type="text" class="form-control input-sm" name="term[name]" placeholder="<?php
|
20 |
</div>
|
21 |
-
<div class="col-
|
22 |
<?php
|
23 |
wp_original_referer_field( true, 'previous' );
|
24 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
25 |
?>
|
26 |
<input type="hidden" name="term[taxonomy]" value="gmedia_tag"/>
|
27 |
-
|
|
|
|
|
28 |
</div>
|
29 |
</div>
|
30 |
</form>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Create tags form
|
8 |
global $gmProcessor;
|
9 |
$gmedia_url = $gmProcessor->url;
|
10 |
?>
|
11 |
+
<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="card-body" action="<?php echo esc_url( add_query_arg( array( 'term' => 'gmedia_tag' ), $gmedia_url ) ); ?>" style="padding-bottom:0; border-bottom:1px solid #ddd;">
|
12 |
<div class="row">
|
13 |
+
<div class="form-group col-sm-9">
|
14 |
+
<label><?php esc_html_e( 'Tags', 'grand-media' ); ?>
|
15 |
+
<small class="text-muted">(<?php esc_html_e( 'you can type multiple tags separated by comma' ); ?>)</small>
|
16 |
</label>
|
17 |
+
<input type="text" class="form-control input-sm" name="term[name]" placeholder="<?php esc_attr_e( 'Tag Names', 'grand-media' ); ?>" required/>
|
18 |
</div>
|
19 |
+
<div class="form-group col-sm-3">
|
20 |
<?php
|
21 |
wp_original_referer_field( true, 'previous' );
|
22 |
wp_nonce_field( 'gmedia_terms', '_wpnonce_terms' );
|
23 |
?>
|
24 |
<input type="hidden" name="term[taxonomy]" value="gmedia_tag"/>
|
25 |
+
|
26 |
+
<label class="w-100"> </label>
|
27 |
+
<button type="submit" class="btn btn-primary btn-sm" name="gmedia_tag_add"><?php esc_html_e( 'Add New Tags', 'grand-media' ); ?></button>
|
28 |
</div>
|
29 |
</div>
|
30 |
</form>
|
admin/pages/terms/tpl/tag-list-item.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* Tag list item
|
@@ -9,28 +7,29 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
9 |
* @var $item
|
10 |
*/
|
11 |
?>
|
12 |
-
<div class="cb_list-item list-group-item term-list-item <?php echo implode( ' ', $item->classes ); ?>">
|
13 |
<div class="row cb_object" id="tag_<?php echo absint( $item->term_id ); ?>">
|
14 |
-
<div class="col-
|
15 |
-
<div class="checkbox">
|
16 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> value="<?php echo absint( $item->term_id ); ?>"/>
|
17 |
<?php if ( $item->allow_edit ) { ?>
|
18 |
<a class="edit_tag_link" href="#tag_<?php echo absint( $item->term_id ); ?>"><?php echo esc_html( $item->name ); ?></a>
|
19 |
-
<span class="edit_tag_form" style="display:none;"><input class="edit_tag_input" type="text" data-tag_id="<?php echo absint( $item->term_id ); ?>" name="gmedia_tag_name[<?php echo absint( $item->term_id ); ?>]" value="<?php echo esc_attr( $item->name ); ?>" placeholder="<?php echo esc_attr( $item->name ); ?>"/><a href="#tag_<?php echo absint( $item->term_id ); ?>" class="edit_tag_save btn btn-link
|
20 |
<?php } else { ?>
|
21 |
<span><?php echo esc_html( $item->name ); ?></span>
|
22 |
<?php } ?>
|
23 |
<br/><span class="term_id">ID: <?php echo absint( $item->term_id ); ?></span>
|
24 |
|
25 |
<div class="object-actions">
|
26 |
-
<?php
|
27 |
-
|
28 |
-
echo
|
|
|
29 |
?>
|
30 |
</div>
|
31 |
</div>
|
32 |
</div>
|
33 |
-
<div class="col-
|
34 |
<?php gmedia_term_item_thumbnails( $item ); ?>
|
35 |
</div>
|
36 |
</div>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Tag list item
|
7 |
* @var $item
|
8 |
*/
|
9 |
?>
|
10 |
+
<div class="cb_list-item list-group-item term-list-item <?php echo esc_attr( implode( ' ', $item->classes ) ); ?>">
|
11 |
<div class="row cb_object" id="tag_<?php echo absint( $item->term_id ); ?>">
|
12 |
+
<div class="col-sm-6 term-label">
|
13 |
+
<div class="checkbox position-relative">
|
14 |
<input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> value="<?php echo absint( $item->term_id ); ?>"/>
|
15 |
<?php if ( $item->allow_edit ) { ?>
|
16 |
<a class="edit_tag_link" href="#tag_<?php echo absint( $item->term_id ); ?>"><?php echo esc_html( $item->name ); ?></a>
|
17 |
+
<span class="edit_tag_form" style="display:none;"><input class="edit_tag_input" type="text" data-tag_id="<?php echo absint( $item->term_id ); ?>" name="gmedia_tag_name[<?php echo absint( $item->term_id ); ?>]" value="<?php echo esc_attr( $item->name ); ?>" placeholder="<?php echo esc_attr( $item->name ); ?>"/><a href="#tag_<?php echo absint( $item->term_id ); ?>" class="edit_tag_save btn btn-link fa-solid fa-pencil"></a></span>
|
18 |
<?php } else { ?>
|
19 |
<span><?php echo esc_html( $item->name ); ?></span>
|
20 |
<?php } ?>
|
21 |
<br/><span class="term_id">ID: <?php echo absint( $item->term_id ); ?></span>
|
22 |
|
23 |
<div class="object-actions">
|
24 |
+
<?php
|
25 |
+
$action_links = gmedia_term_item_actions( $item );
|
26 |
+
echo wp_kses_post( $action_links['share'] );
|
27 |
+
echo '<br/>' . wp_kses_post( $action_links['filter'] . $action_links['delete'] );
|
28 |
?>
|
29 |
</div>
|
30 |
</div>
|
31 |
</div>
|
32 |
+
<div class="col-sm-6">
|
33 |
<?php gmedia_term_item_thumbnails( $item ); ?>
|
34 |
</div>
|
35 |
</div>
|
admin/pages/terms/tpl/term-panel-heading.php
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* Panel heading for term
|
8 |
*
|
|
|
9 |
* @var $term_id
|
10 |
* @var $gmedia_term_taxonomy
|
11 |
* @var $gmedia_terms_pager
|
@@ -15,68 +14,78 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
15 |
$taxterm = $gmProcessor->taxterm;
|
16 |
$curpage = $gmCore->_get( 'page', 'GrandMedia' );
|
17 |
$refurl = strpos( wp_get_referer(), "page={$curpage}" ) ? wp_get_referer() : $gmProcessor->url;
|
18 |
-
$referer = remove_query_arg(
|
19 |
?>
|
20 |
-
<div class="
|
21 |
-
<div class="
|
22 |
-
<div class="btn-toolbar
|
23 |
-
<a class="btn btn-
|
24 |
|
25 |
<?php if ( $term_id ) { ?>
|
26 |
<div class="btn-group">
|
27 |
-
<a class="btn btn-
|
28 |
-
<button type="button" class="btn btn-
|
29 |
-
<span class="
|
30 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
31 |
</button>
|
32 |
<ul class="dropdown-menu" role="menu">
|
33 |
<?php $taxkey = $taxterm . '__in'; ?>
|
34 |
-
<li><a href="<?php echo esc_url( add_query_arg(
|
35 |
<?php
|
36 |
-
echo '<li' . ( ( 'draft' !== $term->status ) ? '' : ' class="disabled"' ) . '><a target="_blank" class="share-modal" data-target="#shareModal" data-share="' . $term->term_id . '" data-gmediacloud="' . $term->cloud_link . '" href="' . $term->post_link . '">' .
|
37 |
|
38 |
-
echo '<li' . ( $term->allow_delete ? '' : ' class="disabled"' ) . '><a href="' .
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
?>
|
43 |
</ul>
|
44 |
</div>
|
45 |
|
46 |
-
<div class="btn-group"
|
47 |
<?php
|
48 |
-
$add_args =
|
49 |
'page' => 'GrandMedia',
|
50 |
'mode' => 'select_multiple',
|
51 |
'gmediablank' => 'library',
|
52 |
-
|
53 |
$taxterm = $term->taxterm;
|
54 |
if ( 'album' === $taxterm ) {
|
55 |
$add_args['album__in'] = 0;
|
56 |
} elseif ( 'category' === $taxterm ) {
|
57 |
$add_args['category__not_in'] = $gmProcessor->edit_term;
|
58 |
}
|
59 |
-
echo '<a href="' . $gmCore->get_admin_url( $add_args,
|
60 |
|
61 |
if ( gm_user_can( 'upload' ) && ! $gmProcessor->gmediablank ) {
|
62 |
-
$args =
|
63 |
if ( $gmProcessor->edit_term ) {
|
64 |
-
$taxterm = $term->taxterm;
|
65 |
$args[ $taxterm ] = $gmProcessor->edit_term;
|
66 |
}
|
67 |
?>
|
68 |
-
<a href="<?php echo esc_url( gm_get_admin_url( $args,
|
69 |
-
<span class="
|
70 |
</a>
|
71 |
<?php
|
72 |
}
|
73 |
?>
|
74 |
</div>
|
75 |
|
76 |
-
<div class="term-shortcode
|
|
|
77 |
<div class="input-buffer"></div>
|
78 |
</div>
|
79 |
-
|
|
|
80 |
do_action( 'gmedia_term_btn_toolbar' );
|
81 |
?>
|
82 |
</div>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Panel heading for term
|
6 |
*
|
7 |
+
* @var $term
|
8 |
* @var $term_id
|
9 |
* @var $gmedia_term_taxonomy
|
10 |
* @var $gmedia_terms_pager
|
14 |
$taxterm = $gmProcessor->taxterm;
|
15 |
$curpage = $gmCore->_get( 'page', 'GrandMedia' );
|
16 |
$refurl = strpos( wp_get_referer(), "page={$curpage}" ) ? wp_get_referer() : $gmProcessor->url;
|
17 |
+
$referer = remove_query_arg( array( 'edit_term' ), $refurl );
|
18 |
?>
|
19 |
+
<div class="card-header-fake"></div>
|
20 |
+
<div class="card-header bg-light clearfix">
|
21 |
+
<div class="btn-toolbar gap-4 float-start">
|
22 |
+
<a class="btn btn-secondary float-start" href="<?php echo esc_url( $referer ); ?>"><?php esc_html_e( 'Go Back', 'grand-media' ); ?></a>
|
23 |
|
24 |
<?php if ( $term_id ) { ?>
|
25 |
<div class="btn-group">
|
26 |
+
<a class="btn btn-secondary" href="#"><?php esc_html_e( 'Action', 'grand-media' ); ?></a>
|
27 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
28 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
29 |
</button>
|
30 |
<ul class="dropdown-menu" role="menu">
|
31 |
<?php $taxkey = $taxterm . '__in'; ?>
|
32 |
+
<li><a class="dropdown-item" href="<?php echo esc_url( add_query_arg( array( 'page' => 'GrandMedia', $taxkey => $term->term_id ), $gmProcessor->url ) ); ?>"><?php esc_html_e( 'Show in Gmedia Library', 'grand-media' ); ?></a></li>
|
33 |
<?php
|
34 |
+
echo '<li' . ( ( 'draft' !== $term->status ) ? '' : ' class="disabled"' ) . '><a target="_blank" class="dropdown-item share-modal" data-bs-toggle="modal" data-bs-target="#shareModal" data-share="' . esc_attr( $term->term_id ) . '" data-gmediacloud="' . esc_url( $term->cloud_link ) . '" href="' . esc_url( $term->post_link ) . '">' . esc_html__( 'Share', 'grand-media' ) . '</a></li>';
|
35 |
|
36 |
+
echo '<li' . ( $term->allow_delete ? '' : ' class="disabled"' ) . '><a class="dropdown-item" href="' . esc_url(
|
37 |
+
wp_nonce_url(
|
38 |
+
gm_get_admin_url(
|
39 |
+
array(
|
40 |
+
'do_gmedia_terms' => 'delete',
|
41 |
+
'ids' => $term->term_id,
|
42 |
+
),
|
43 |
+
array( 'edit_term' ),
|
44 |
+
$gmProcessor->url
|
45 |
+
),
|
46 |
+
'gmedia_delete',
|
47 |
+
'_wpnonce_delete'
|
48 |
+
)
|
49 |
+
) . '" data-confirm="' . esc_html__( "You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ) . '">' . esc_html__( 'Delete', 'grand-media' ) . '</a></li>';
|
50 |
?>
|
51 |
</ul>
|
52 |
</div>
|
53 |
|
54 |
+
<div class="btn-group">
|
55 |
<?php
|
56 |
+
$add_args = array(
|
57 |
'page' => 'GrandMedia',
|
58 |
'mode' => 'select_multiple',
|
59 |
'gmediablank' => 'library',
|
60 |
+
);
|
61 |
$taxterm = $term->taxterm;
|
62 |
if ( 'album' === $taxterm ) {
|
63 |
$add_args['album__in'] = 0;
|
64 |
} elseif ( 'category' === $taxterm ) {
|
65 |
$add_args['category__not_in'] = $gmProcessor->edit_term;
|
66 |
}
|
67 |
+
echo '<a href="' . esc_url( $gmCore->get_admin_url( $add_args, array(), true ) ) . '" class="btn btn-success preview-modal float-start" data-bs-toggle="modal" data-bs-target="#previewModal" data-width="1200" data-height="500" data-cls="select_gmedia assign_gmedia_term" data-title="' . esc_attr__( 'Add from Library', 'grand-media' ) . '"><span class="fa-solid fa-plus"></span> ' . esc_html__( 'Add from Library', 'grand-media' ) . '</a>';
|
68 |
|
69 |
if ( gm_user_can( 'upload' ) && ! $gmProcessor->gmediablank ) {
|
70 |
+
$args = array( 'page' => 'GrandMedia_AddMedia' );
|
71 |
if ( $gmProcessor->edit_term ) {
|
|
|
72 |
$args[ $taxterm ] = $gmProcessor->edit_term;
|
73 |
}
|
74 |
?>
|
75 |
+
<a href="<?php echo esc_url( gm_get_admin_url( $args, array(), true ) ); ?>" class="btn btn-success float-start">
|
76 |
+
<span class="fa-solid fa-upload" style="font-size: 130%;line-height: 0;vertical-align: sub;"></span> <?php esc_html_e( 'Upload', 'grand-media' ); ?>
|
77 |
</a>
|
78 |
<?php
|
79 |
}
|
80 |
?>
|
81 |
</div>
|
82 |
|
83 |
+
<div class="term-shortcode float-start">
|
84 |
+
<input type="text" title="<?php esc_attr_e( 'Shortcode' ); ?>" class="form-control float-start h-100" value="<?php echo esc_attr( "[gm {$taxterm}={$term_id}]" ); ?>" readonly/>
|
85 |
<div class="input-buffer"></div>
|
86 |
</div>
|
87 |
+
<?php
|
88 |
+
}
|
89 |
do_action( 'gmedia_term_btn_toolbar' );
|
90 |
?>
|
91 |
</div>
|
admin/pages/terms/tpl/terms-create-alert.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* Alert capability
|
8 |
*/
|
9 |
?>
|
10 |
<div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
|
11 |
-
<button type="button" class="close" data-dismiss="alert"
|
12 |
-
<strong><?php
|
13 |
</div>
|
14 |
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Alert capability
|
6 |
*/
|
7 |
?>
|
8 |
<div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
|
9 |
+
<button type="button" class="btn-close float-end m-0" data-bs-dismiss="alert" aria-label="Close"></button>
|
10 |
+
<strong><?php esc_html_e( 'Info:', 'grand-media' ); ?></strong> <?php esc_html_e( 'You are not allowed to add new terms', 'grand-media' ); ?>
|
11 |
</div>
|
12 |
|
admin/pages/terms/tpl/terms-panel-heading.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
|
6 |
/**
|
7 |
* Panel heading for terms
|
@@ -9,57 +9,59 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
9 |
* @var $gmedia_term_taxonomy
|
10 |
* @var $gmedia_terms_pager
|
11 |
* @var $gmProcessor
|
|
|
12 |
*/
|
13 |
?>
|
14 |
-
<div class="
|
15 |
-
<div class="
|
16 |
-
<div class="
|
17 |
<div class="clearfix">
|
18 |
-
<?php
|
19 |
|
20 |
-
<div class="btn-toolbar
|
21 |
-
<a title="<?php
|
22 |
</div>
|
23 |
</div>
|
24 |
|
25 |
-
<?php echo $gmedia_terms_pager; ?>
|
26 |
|
27 |
<div class="spinner"></div>
|
28 |
</div>
|
29 |
|
30 |
-
<div class="btn-toolbar
|
31 |
<div class="btn-group gm-checkgroup" id="cb_global-btn">
|
32 |
-
<span class="btn btn-
|
33 |
-
<button type="button" class="btn btn-
|
34 |
-
<span class="
|
35 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
36 |
</button>
|
37 |
<ul class="dropdown-menu" role="menu">
|
38 |
-
<li><a data-select="total" href="#"><?php
|
39 |
-
<li><a data-select="none" href="#"><?php
|
40 |
-
<li
|
41 |
-
|
|
|
|
|
42 |
</ul>
|
43 |
</div>
|
44 |
|
45 |
<?php if ( ! empty( $gmedia_terms ) ) { ?>
|
46 |
<div class="btn-group">
|
47 |
-
<a class="btn btn-
|
48 |
-
<button type="button" class="btn btn-
|
49 |
-
<span class="
|
50 |
-
<span class="sr-only"><?php _e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
51 |
</button>
|
52 |
<?php
|
53 |
$rel_selected_show = 'rel-selected-show';
|
54 |
$rel_selected_hide = 'rel-selected-hide';
|
55 |
?>
|
56 |
<ul class="dropdown-menu" role="menu">
|
57 |
-
<li class="dropdown-header <?php echo $rel_selected_hide; ?>"><span><?php
|
58 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms_delete' ) ? '' : ' disabled' ) ); ?>">
|
59 |
-
<a
|
60 |
-
'do_gmedia_terms' => 'delete',
|
61 |
-
'
|
62 |
-
|
|
|
63 |
</li>
|
64 |
<?php do_action( 'gmedia_terms_action_list' ); ?>
|
65 |
</ul>
|
@@ -71,25 +73,31 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
71 |
$filter_selected = $gmCore->_req( 'filter' );
|
72 |
$filter_selected_arg = $filter_selected ? false : 'selected';
|
73 |
?>
|
74 |
-
<form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo esc_url( add_query_arg(
|
75 |
-
|
76 |
-
<button type="
|
77 |
-
|
|
|
78 |
<input type="hidden" id="gm-selected" data-userid="<?php echo absint( $user_ID ); ?>" data-key="<?php echo esc_attr( GmediaProcessor_Terms::$cookie_key ); ?>" name="selected_items" value="<?php echo esc_attr( implode( ',', $gmProcessor->selected_items ) ); ?>"/>
|
79 |
<ul class="dropdown-menu" role="menu">
|
80 |
-
<li><a id="gm-selected-show" href="#show"
|
|
|
81 |
if ( ! $filter_selected ) {
|
82 |
-
|
83 |
} else {
|
84 |
-
|
85 |
}
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
93 |
</ul>
|
94 |
</form>
|
95 |
<?php } ?>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
3 |
+
|
4 |
+
global $gmCore, $user_ID, $gm_allowed_tags;
|
5 |
|
6 |
/**
|
7 |
* Panel heading for terms
|
9 |
* @var $gmedia_term_taxonomy
|
10 |
* @var $gmedia_terms_pager
|
11 |
* @var $gmProcessor
|
12 |
+
* @var $gmedia_url
|
13 |
*/
|
14 |
?>
|
15 |
+
<div class="card-header-fake"></div>
|
16 |
+
<div class="card-header bg-light clearfix" style="padding-bottom:2px;">
|
17 |
+
<div class="float-end" style="margin-bottom:3px;">
|
18 |
<div class="clearfix">
|
19 |
+
<?php require GMEDIA_ABSPATH . 'admin/tpl/search-form.php'; ?>
|
20 |
|
21 |
+
<div class="btn-toolbar gap-4 float-end" style="margin-bottom:4px; margin-left:4px;">
|
22 |
+
<a title="<?php esc_html_e( 'More Screen Settings', 'grand-media' ); ?>" class="show-settings-link float-end btn btn-secondary btn-xs"><i class="fa-solid fa-gear"></i></a>
|
23 |
</div>
|
24 |
</div>
|
25 |
|
26 |
+
<?php echo wp_kses( $gmedia_terms_pager, $gm_allowed_tags ); ?>
|
27 |
|
28 |
<div class="spinner"></div>
|
29 |
</div>
|
30 |
|
31 |
+
<div class="btn-toolbar gap-4 float-start" style="margin-bottom:7px;">
|
32 |
<div class="btn-group gm-checkgroup" id="cb_global-btn">
|
33 |
+
<span class="btn btn-secondary active"><input class="doaction" id="cb_global" data-group="cb_object" type="checkbox"/></span>
|
34 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
35 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
36 |
</button>
|
37 |
<ul class="dropdown-menu" role="menu">
|
38 |
+
<li><a class="dropdown-item" data-select="total" href="#"><?php esc_html_e( 'All', 'grand-media' ); ?></a></li>
|
39 |
+
<li><a class="dropdown-item" data-select="none" href="#"><?php esc_html_e( 'None', 'grand-media' ); ?></a></li>
|
40 |
+
<li>
|
41 |
+
<hr class="dropdown-divider">
|
42 |
+
</li>
|
43 |
+
<li><a class="dropdown-item" data-select="reverse" href="#" title="<?php esc_attr_e( 'Reverse only visible items', 'grand-media' ); ?>"><?php esc_html_e( 'Reverse', 'grand-media' ); ?></a></li>
|
44 |
</ul>
|
45 |
</div>
|
46 |
|
47 |
<?php if ( ! empty( $gmedia_terms ) ) { ?>
|
48 |
<div class="btn-group">
|
49 |
+
<a class="btn btn-secondary" href="#"><?php esc_html_e( 'Action', 'grand-media' ); ?></a>
|
50 |
+
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
51 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span>
|
|
|
52 |
</button>
|
53 |
<?php
|
54 |
$rel_selected_show = 'rel-selected-show';
|
55 |
$rel_selected_hide = 'rel-selected-hide';
|
56 |
?>
|
57 |
<ul class="dropdown-menu" role="menu">
|
58 |
+
<li class="dropdown-header <?php echo esc_attr( $rel_selected_hide ); ?>"><span><?php esc_html_e( 'Select items to see more actions', 'grand-media' ); ?></span></li>
|
59 |
<li class="<?php echo esc_attr( $rel_selected_show . ( gm_user_can( 'terms_delete' ) ? '' : ' disabled' ) ); ?>">
|
60 |
+
<a class="dropdown-item gmedia-delete"
|
61 |
+
href="<?php echo esc_url( wp_nonce_url( $gmCore->get_admin_url( array( 'do_gmedia_terms' => 'delete', 'ids' => 'selected' ), array( 'filter' ) ), 'gmedia_delete', '_wpnonce_delete' ) ); ?>"
|
62 |
+
data-confirm="<?php esc_attr_e( "You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", 'grand-media' ); ?>">
|
63 |
+
<?php esc_html_e( 'Delete Selected Items', 'grand-media' ); ?>
|
64 |
+
</a>
|
65 |
</li>
|
66 |
<?php do_action( 'gmedia_terms_action_list' ); ?>
|
67 |
</ul>
|
73 |
$filter_selected = $gmCore->_req( 'filter' );
|
74 |
$filter_selected_arg = $filter_selected ? false : 'selected';
|
75 |
?>
|
76 |
+
<form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo esc_url( add_query_arg( array( 'term' => $gmedia_term_taxonomy, 'filter' => $filter_selected_arg ), $gmedia_url ) ); ?>" method="post">
|
77 |
+
<?php // translators: number. ?>
|
78 |
+
<button type="submit" class="btn btn<?php echo ( 'selected' === $filter_selected ) ? '-success' : '-info'; ?>"><?php printf( esc_html__( '%s selected', 'grand-media' ), '<span id="gm-selected-qty">' . count( $gmProcessor->selected_items ) . '</span>' ); ?></button>
|
79 |
+
<button type="button" class="btn btn-info dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
|
80 |
+
<span class="visually-hidden"><?php esc_html_e( 'Toggle Dropdown', 'grand-media' ); ?></span></button>
|
81 |
<input type="hidden" id="gm-selected" data-userid="<?php echo absint( $user_ID ); ?>" data-key="<?php echo esc_attr( GmediaProcessor_Terms::$cookie_key ); ?>" name="selected_items" value="<?php echo esc_attr( implode( ',', $gmProcessor->selected_items ) ); ?>"/>
|
82 |
<ul class="dropdown-menu" role="menu">
|
83 |
+
<li><a class="dropdown-item" id="gm-selected-show" href="#show">
|
84 |
+
<?php
|
85 |
if ( ! $filter_selected ) {
|
86 |
+
esc_html_e( 'Show only selected items', 'grand-media' );
|
87 |
} else {
|
88 |
+
esc_html_e( 'Show all gmedia items', 'grand-media' );
|
89 |
}
|
90 |
+
?>
|
91 |
+
</a></li>
|
92 |
+
<li><a class="dropdown-item" id="gm-selected-clear" href="#clear"><?php esc_html_e( 'Clear selected items', 'grand-media' ); ?></a></li>
|
93 |
+
<?php
|
94 |
+
/*
|
95 |
+
<li class="<?php echo gm_user_can('gallery_manage')? '' : 'disabled'; ?>">
|
96 |
+
<a href="#libModal" data-bs-toggle="modal" data-modal="quick_gallery" data-action="gmedia_get_modal" data-ckey="<?php echo esc_attr( GmediaProcessor_Terms::$cookie_key ); ?>" class="dropdown-item gmedia-modal"><?php esc_html_e('Quick Gallery from Selected', 'grand-media'); ?></a>
|
97 |
+
</li>
|
98 |
+
<?php
|
99 |
+
*/
|
100 |
+
?>
|
101 |
</ul>
|
102 |
</form>
|
103 |
<?php } ?>
|
admin/processor/class.processor.addmedia.php
CHANGED
@@ -6,8 +6,9 @@
|
|
6 |
class GmediaProcessor_AddMedia extends GmediaProcessor {
|
7 |
|
8 |
private static $me = null;
|
9 |
-
|
10 |
public $import = false;
|
|
|
11 |
|
12 |
/**
|
13 |
* GmediaProcessor_Library constructor.
|
@@ -18,12 +19,12 @@ class GmediaProcessor_AddMedia extends GmediaProcessor {
|
|
18 |
global $gmCore;
|
19 |
|
20 |
$this->import = $gmCore->_get( 'import', false, true );
|
21 |
-
$this->url = add_query_arg(
|
22 |
|
23 |
}
|
24 |
|
25 |
public static function getMe() {
|
26 |
-
if ( self::$me
|
27 |
self::$me = new GmediaProcessor_AddMedia();
|
28 |
}
|
29 |
|
@@ -34,7 +35,7 @@ class GmediaProcessor_AddMedia extends GmediaProcessor {
|
|
34 |
global $gmCore;
|
35 |
|
36 |
if ( ! $gmCore->caps['gmedia_upload'] ) {
|
37 |
-
wp_die(
|
38 |
}
|
39 |
|
40 |
}
|
6 |
class GmediaProcessor_AddMedia extends GmediaProcessor {
|
7 |
|
8 |
private static $me = null;
|
9 |
+
|
10 |
public $import = false;
|
11 |
+
public $url;
|
12 |
|
13 |
/**
|
14 |
* GmediaProcessor_Library constructor.
|
19 |
global $gmCore;
|
20 |
|
21 |
$this->import = $gmCore->_get( 'import', false, true );
|
22 |
+
$this->url = add_query_arg( array( 'import' => $this->import ), $this->url );
|
23 |
|
24 |
}
|
25 |
|
26 |
public static function getMe() {
|
27 |
+
if ( null === self::$me ) {
|
28 |
self::$me = new GmediaProcessor_AddMedia();
|
29 |
}
|
30 |
|
35 |
global $gmCore;
|
36 |
|
37 |
if ( ! $gmCore->caps['gmedia_upload'] ) {
|
38 |
+
wp_die( esc_html__( 'You are not allowed to be here', 'grand-media' ) );
|
39 |
}
|
40 |
|
41 |
}
|
admin/processor/class.processor.galleries.php
CHANGED
@@ -6,10 +6,12 @@
|
|
6 |
class GmediaProcessor_Galleries extends GmediaProcessor {
|
7 |
|
8 |
public static $cookie_key = false;
|
|
|
9 |
private static $me = null;
|
|
|
10 |
public $taxonomy;
|
11 |
-
public $selected_items =
|
12 |
-
public $query_args
|
13 |
|
14 |
/**
|
15 |
* GmediaProcessor_Library constructor.
|
@@ -23,7 +25,7 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
23 |
}
|
24 |
|
25 |
public static function getMe() {
|
26 |
-
if ( self::$me
|
27 |
self::$me = new GmediaProcessor_Galleries();
|
28 |
}
|
29 |
|
@@ -34,11 +36,11 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
34 |
global $user_ID, $gmCore, $gmDB, $gmGallery;
|
35 |
|
36 |
if ( ! $gmCore->caps['gmedia_library'] ) {
|
37 |
-
wp_die(
|
38 |
}
|
39 |
|
40 |
if ( ! $gmCore->caps['gmedia_gallery_manage'] ) {
|
41 |
-
wp_die(
|
42 |
}
|
43 |
|
44 |
include_once GMEDIA_ABSPATH . 'admin/pages/galleries/functions.php';
|
@@ -47,8 +49,8 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
47 |
|
48 |
if ( isset( $_POST['select_author'] ) ) {
|
49 |
$authors = $gmCore->_post( 'author_ids' );
|
50 |
-
$location = $gmCore->get_admin_url(
|
51 |
-
|
52 |
exit;
|
53 |
}
|
54 |
if ( isset( $_POST['gmedia_gallery_module'] ) && '' !== $_POST['gmedia_gallery_module'] ) {
|
@@ -57,32 +59,34 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
57 |
$ids = $gmCore->_get( 'ids', 'selected' );
|
58 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items : wp_parse_id_list( $ids );
|
59 |
if ( ! $gmCore->caps['gmedia_delete_others_media'] ) {
|
60 |
-
$_selected_items = $gmDB->get_terms( $taxonomy,
|
61 |
if ( count( $_selected_items ) < count( $selected_items ) ) {
|
62 |
-
$this->error[] =
|
63 |
}
|
64 |
$selected_items = $_selected_items;
|
65 |
}
|
66 |
-
|
67 |
-
|
68 |
-
$
|
|
|
69 |
'_edited' => gmdate( 'Y-m-d H:i:s' ),
|
70 |
'_module' => $preset['module'],
|
71 |
'_settings' => $preset['settings'],
|
72 |
-
|
73 |
foreach ( $selected_items as $term_id ) {
|
74 |
foreach ( $gallery_meta as $key => $value ) {
|
75 |
$gmDB->update_metadata( 'gmedia_term', $term_id, $key, $value );
|
76 |
}
|
77 |
}
|
78 |
-
|
|
|
79 |
}
|
80 |
}
|
81 |
if ( isset( $_POST['gmedia_gallery_save'] ) ) {
|
82 |
check_admin_referer( 'GmediaGallery' );
|
83 |
|
84 |
if ( isset( $_POST['preview_bgcolor'] ) ) {
|
85 |
-
$gmGallery->options['preview_bgcolor'] = $gmCore->sanitize_hex_color( $
|
86 |
update_option( 'gmediaOptions', $gmGallery->options );
|
87 |
}
|
88 |
|
@@ -90,35 +94,37 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
90 |
do {
|
91 |
$term = $gmCore->_post( 'term' );
|
92 |
if ( ( (int) $term['global'] !== $user_ID ) && ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
93 |
-
$this->error[] =
|
94 |
break;
|
95 |
}
|
96 |
$term['name'] = trim( $term['name'] );
|
97 |
if ( empty( $term['name'] ) ) {
|
98 |
-
$this->error[] =
|
99 |
break;
|
100 |
}
|
101 |
if ( $gmCore->is_digit( $term['name'] ) ) {
|
102 |
-
$this->error[] =
|
103 |
break;
|
104 |
}
|
105 |
if ( empty( $term['module'] ) ) {
|
106 |
-
$this->error[] =
|
107 |
break;
|
108 |
}
|
109 |
$taxonomy = 'gmedia_gallery';
|
110 |
if ( $edit_gallery && ! $gmDB->term_exists( $edit_gallery ) ) {
|
111 |
-
$this->error[] =
|
112 |
$edit_gallery = false;
|
113 |
}
|
114 |
-
|
|
|
115 |
if ( $term_id !== $edit_gallery ) {
|
116 |
-
$this->error[] =
|
117 |
break;
|
118 |
}
|
119 |
}
|
120 |
-
|
121 |
-
|
|
|
122 |
}
|
123 |
if ( $edit_gallery ) {
|
124 |
$term_id = $gmDB->update_term( $edit_gallery, $term );
|
@@ -130,14 +136,15 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
130 |
break;
|
131 |
}
|
132 |
|
133 |
-
$module_settings = $gmCore->_post( 'module',
|
134 |
$module_path = $gmCore->get_module_path( $term['module'] );
|
135 |
-
$default_options =
|
136 |
if ( is_file( $module_path['path'] . '/settings.php' ) ) {
|
137 |
/** @noinspection PhpIncludeInspection */
|
138 |
include $module_path['path'] . '/settings.php';
|
139 |
} else {
|
140 |
-
|
|
|
141 |
break;
|
142 |
}
|
143 |
foreach ( $module_settings as &$setting ) {
|
@@ -147,37 +154,40 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
147 |
}
|
148 |
$module_settings = $gmCore->array_replace_recursive( $default_options, $module_settings );
|
149 |
wp_parse_str( $term['query'], $_query );
|
150 |
-
$gallery_meta =
|
151 |
'_edited' => gmdate( 'Y-m-d H:i:s' ),
|
152 |
'_query' => $_query,
|
153 |
'_module' => $term['module'],
|
154 |
-
'_settings' =>
|
155 |
-
|
156 |
foreach ( $gallery_meta as $key => $value ) {
|
157 |
$gmDB->update_metadata( 'gmedia_term', $term_id, $key, $value );
|
158 |
}
|
159 |
if ( $edit_gallery ) {
|
160 |
-
|
|
|
161 |
} else {
|
162 |
-
$location = add_query_arg(
|
163 |
set_transient( 'gmedia_new_gallery_id', $term_id, 60 );
|
164 |
-
|
165 |
exit;
|
166 |
}
|
167 |
} while ( 0 );
|
168 |
}
|
169 |
-
|
|
|
170 |
$gmedia_new_gallery_id = get_transient( 'gmedia_new_gallery_id' );
|
171 |
if ( false !== $gmedia_new_gallery_id ) {
|
172 |
delete_transient( 'gmedia_new_gallery_id' );
|
173 |
-
|
|
|
174 |
}
|
175 |
}
|
176 |
|
177 |
if ( isset( $_POST['module_preset_restore_original'] ) ) {
|
178 |
$preset_id = intval( $gmCore->_post( 'preset_default', 0 ) );
|
179 |
$gmDB->delete_term( $preset_id );
|
180 |
-
$this->msg[] =
|
181 |
}
|
182 |
|
183 |
if ( isset( $_POST['gmedia_gallery_reset'] ) ) {
|
@@ -185,13 +195,13 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
185 |
$edit_gallery = (int) $gmCore->_get( 'edit_term' );
|
186 |
do {
|
187 |
if ( ! $gmDB->term_exists( $edit_gallery ) ) {
|
188 |
-
$this->error[] =
|
189 |
break;
|
190 |
}
|
191 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
192 |
$term = $gmDB->get_term( $edit_gallery );
|
193 |
if ( $term->global !== $user_ID ) {
|
194 |
-
$this->error[] =
|
195 |
break;
|
196 |
}
|
197 |
}
|
@@ -205,7 +215,7 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
205 |
if ( is_file( $module_path['path'] . '/settings.php' ) ) {
|
206 |
/** @noinspection PhpIncludeInspection */
|
207 |
include $module_path['path'] . '/settings.php';
|
208 |
-
$preset = $gmDB->get_term( '[' . $gallery_module . ']',
|
209 |
if ( $preset ) {
|
210 |
$default_preset = maybe_unserialize( $preset->description );
|
211 |
$default_options = $gmCore->array_replace_recursive( $default_options, $default_preset );
|
@@ -216,18 +226,19 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
216 |
$default_options = $gmCore->array_replace_recursive( $default_options, $default_preset );
|
217 |
}
|
218 |
} else {
|
219 |
-
|
|
|
220 |
break;
|
221 |
}
|
222 |
|
223 |
-
$gallery_meta =
|
224 |
'_edited' => gmdate( 'Y-m-d H:i:s' ),
|
225 |
-
'_settings' =>
|
226 |
-
|
227 |
foreach ( $gallery_meta as $key => $value ) {
|
228 |
$gmDB->update_metadata( 'gmedia_term', $edit_gallery, $key, $value );
|
229 |
}
|
230 |
-
$this->msg[] =
|
231 |
|
232 |
} while ( 0 );
|
233 |
|
@@ -238,17 +249,18 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
238 |
do {
|
239 |
$term = $gmCore->_post( 'term' );
|
240 |
if ( empty( $term['module'] ) ) {
|
241 |
-
$this->error[] =
|
242 |
break;
|
243 |
}
|
244 |
-
$module_settings = $gmCore->_post( 'module',
|
245 |
$module_path = $gmCore->get_module_path( $term['module'] );
|
246 |
-
$default_options =
|
247 |
if ( is_file( $module_path['path'] . '/settings.php' ) ) {
|
248 |
/** @noinspection PhpIncludeInspection */
|
249 |
include $module_path['path'] . '/settings.php';
|
250 |
} else {
|
251 |
-
|
|
|
252 |
break;
|
253 |
}
|
254 |
$module_settings = $gmCore->array_replace_recursive( $default_options, $module_settings );
|
@@ -263,7 +275,7 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
263 |
}
|
264 |
$preset_name = '[' . $term['module'] . '] ' . $preset_name;
|
265 |
}
|
266 |
-
$args =
|
267 |
$args['description'] = $module_settings;
|
268 |
$args['status'] = $term['module'];
|
269 |
$args['global'] = $user_ID;
|
@@ -282,9 +294,9 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
282 |
$this->error[] = $term_id->get_error_message();
|
283 |
break;
|
284 |
} else {
|
285 |
-
|
|
|
286 |
}
|
287 |
-
|
288 |
} while ( 0 );
|
289 |
}
|
290 |
|
@@ -295,17 +307,19 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
295 |
$ids = $gmCore->_get( 'ids', 'selected' );
|
296 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items : wp_parse_id_list( $ids );
|
297 |
if ( ! $gmCore->caps['gmedia_delete_others_media'] ) {
|
298 |
-
$_selected_items = $gmDB->get_terms( $taxonomy,
|
299 |
if ( count( $_selected_items ) < count( $selected_items ) ) {
|
300 |
-
$this->error[] =
|
301 |
}
|
302 |
$selected_items = $_selected_items;
|
303 |
}
|
304 |
-
|
|
|
305 |
foreach ( $selected_items as $item ) {
|
306 |
$delete = $gmDB->delete_term( $item );
|
307 |
if ( ! $delete ) {
|
308 |
-
|
|
|
309 |
$count --;
|
310 |
} elseif ( is_wp_error( $delete ) ) {
|
311 |
$this->error[] = $delete->get_error_message();
|
@@ -313,11 +327,12 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
313 |
}
|
314 |
}
|
315 |
if ( $count ) {
|
316 |
-
|
|
|
317 |
}
|
318 |
setcookie( self::$cookie_key, '', time() - 3600 );
|
319 |
unset( $_COOKIE[ self::$cookie_key ] );
|
320 |
-
$this->selected_items =
|
321 |
}
|
322 |
if ( ! empty( $this->msg ) ) {
|
323 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
@@ -327,16 +342,16 @@ class GmediaProcessor_Galleries extends GmediaProcessor {
|
|
327 |
}
|
328 |
}
|
329 |
if ( $do_gmedia_terms ) {
|
330 |
-
$_wpnonce =
|
331 |
foreach ( $_GET as $key => $value ) {
|
332 |
if ( strpos( $key, '_wpnonce' ) !== false ) {
|
333 |
$_wpnonce[ $key ] = $value;
|
334 |
}
|
335 |
}
|
336 |
-
$remove_args = array_merge(
|
337 |
$location = remove_query_arg( $remove_args );
|
338 |
$location = add_query_arg( 'did_gmedia_terms', $do_gmedia_terms, $location );
|
339 |
-
|
340 |
exit;
|
341 |
}
|
342 |
if ( $gmCore->_get( 'did_gmedia_terms' ) ) {
|
6 |
class GmediaProcessor_Galleries extends GmediaProcessor {
|
7 |
|
8 |
public static $cookie_key = false;
|
9 |
+
|
10 |
private static $me = null;
|
11 |
+
|
12 |
public $taxonomy;
|
13 |
+
public $selected_items = array();
|
14 |
+
public $query_args = array();
|
15 |
|
16 |
/**
|
17 |
* GmediaProcessor_Library constructor.
|
25 |
}
|
26 |
|
27 |
public static function getMe() {
|
28 |
+
if ( null === self::$me ) {
|
29 |
self::$me = new GmediaProcessor_Galleries();
|
30 |
}
|
31 |
|
36 |
global $user_ID, $gmCore, $gmDB, $gmGallery;
|
37 |
|
38 |
if ( ! $gmCore->caps['gmedia_library'] ) {
|
39 |
+
wp_die( esc_html__( 'You are not allowed to be here', 'grand-media' ) );
|
40 |
}
|
41 |
|
42 |
if ( ! $gmCore->caps['gmedia_gallery_manage'] ) {
|
43 |
+
wp_die( esc_html__( 'You are not allowed to manage gmedia galleries', 'grand-media' ) );
|
44 |
}
|
45 |
|
46 |
include_once GMEDIA_ABSPATH . 'admin/pages/galleries/functions.php';
|
49 |
|
50 |
if ( isset( $_POST['select_author'] ) ) {
|
51 |
$authors = $gmCore->_post( 'author_ids' );
|
52 |
+
$location = $gmCore->get_admin_url( array( 'author' => (int) $authors ) );
|
53 |
+
wp_safe_redirect( $location );
|
54 |
exit;
|
55 |
}
|
56 |
if ( isset( $_POST['gmedia_gallery_module'] ) && '' !== $_POST['gmedia_gallery_module'] ) {
|
59 |
$ids = $gmCore->_get( 'ids', 'selected' );
|
60 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items : wp_parse_id_list( $ids );
|
61 |
if ( ! $gmCore->caps['gmedia_delete_others_media'] ) {
|
62 |
+
$_selected_items = $gmDB->get_terms( $taxonomy, array( 'fields' => 'ids', 'global' => $user_ID, 'include' => $selected_items ) );
|
63 |
if ( count( $_selected_items ) < count( $selected_items ) ) {
|
64 |
+
$this->error[] = esc_html__( 'You are not allowed to delete others media', 'grand-media' );
|
65 |
}
|
66 |
$selected_items = $_selected_items;
|
67 |
}
|
68 |
+
$count = count( $selected_items );
|
69 |
+
if ( $count ) {
|
70 |
+
$preset = $gmCore->getModulePreset( $gmCore->_post( 'gmedia_gallery_module' ) );
|
71 |
+
$gallery_meta = array(
|
72 |
'_edited' => gmdate( 'Y-m-d H:i:s' ),
|
73 |
'_module' => $preset['module'],
|
74 |
'_settings' => $preset['settings'],
|
75 |
+
);
|
76 |
foreach ( $selected_items as $term_id ) {
|
77 |
foreach ( $gallery_meta as $key => $value ) {
|
78 |
$gmDB->update_metadata( 'gmedia_term', $term_id, $key, $value );
|
79 |
}
|
80 |
}
|
81 |
+
// translators: 1 - preset name; 2 - module name; 3 - number.
|
82 |
+
$this->msg[] = sprintf( esc_html__( 'Preset "%1$s" of module "%2$s" was applied to %3$d galleries', 'grand-media' ), esc_html( $preset['name'] ), esc_html( $preset['module'] ), (int) $count );
|
83 |
}
|
84 |
}
|
85 |
if ( isset( $_POST['gmedia_gallery_save'] ) ) {
|
86 |
check_admin_referer( 'GmediaGallery' );
|
87 |
|
88 |
if ( isset( $_POST['preview_bgcolor'] ) ) {
|
89 |
+
$gmGallery->options['preview_bgcolor'] = $gmCore->sanitize_hex_color( $gmCore->_post( 'preview_bgcolor' ), 'ffffff' );
|
90 |
update_option( 'gmediaOptions', $gmGallery->options );
|
91 |
}
|
92 |
|
94 |
do {
|
95 |
$term = $gmCore->_post( 'term' );
|
96 |
if ( ( (int) $term['global'] !== $user_ID ) && ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
97 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
98 |
break;
|
99 |
}
|
100 |
$term['name'] = trim( $term['name'] );
|
101 |
if ( empty( $term['name'] ) ) {
|
102 |
+
$this->error[] = esc_html__( 'Gallery Name is not specified', 'grand-media' );
|
103 |
break;
|
104 |
}
|
105 |
if ( $gmCore->is_digit( $term['name'] ) ) {
|
106 |
+
$this->error[] = esc_html__( "Gallery name can't be only digits", 'grand-media' );
|
107 |
break;
|
108 |
}
|
109 |
if ( empty( $term['module'] ) ) {
|
110 |
+
$this->error[] = esc_html__( 'Something goes wrong... Choose module, please', 'grand-media' );
|
111 |
break;
|
112 |
}
|
113 |
$taxonomy = 'gmedia_gallery';
|
114 |
if ( $edit_gallery && ! $gmDB->term_exists( $edit_gallery ) ) {
|
115 |
+
$this->error[] = esc_html__( 'A term with the id provided does not exists', 'grand-media' );
|
116 |
$edit_gallery = false;
|
117 |
}
|
118 |
+
$term_id = $gmDB->term_exists( $term['name'], $taxonomy, $term['global'] );
|
119 |
+
if ( $term_id ) {
|
120 |
if ( $term_id !== $edit_gallery ) {
|
121 |
+
$this->error[] = esc_html__( 'A term with the name provided already exists', 'grand-media' );
|
122 |
break;
|
123 |
}
|
124 |
}
|
125 |
+
$meta = $gmCore->_post( 'meta' );
|
126 |
+
if ( $meta ) {
|
127 |
+
$term = array_merge_recursive( array( 'meta' => $meta ), $term );
|
128 |
}
|
129 |
if ( $edit_gallery ) {
|
130 |
$term_id = $gmDB->update_term( $edit_gallery, $term );
|
136 |
break;
|
137 |
}
|
138 |
|
139 |
+
$module_settings = $gmCore->_post( 'module', array() );
|
140 |
$module_path = $gmCore->get_module_path( $term['module'] );
|
141 |
+
$default_options = array();
|
142 |
if ( is_file( $module_path['path'] . '/settings.php' ) ) {
|
143 |
/** @noinspection PhpIncludeInspection */
|
144 |
include $module_path['path'] . '/settings.php';
|
145 |
} else {
|
146 |
+
// translators: module name.
|
147 |
+
$this->error[] = sprintf( esc_html__( 'Can\'t load data from `%s` module' ), esc_html( $term['module'] ) );
|
148 |
break;
|
149 |
}
|
150 |
foreach ( $module_settings as &$setting ) {
|
154 |
}
|
155 |
$module_settings = $gmCore->array_replace_recursive( $default_options, $module_settings );
|
156 |
wp_parse_str( $term['query'], $_query );
|
157 |
+
$gallery_meta = array(
|
158 |
'_edited' => gmdate( 'Y-m-d H:i:s' ),
|
159 |
'_query' => $_query,
|
160 |
'_module' => $term['module'],
|
161 |
+
'_settings' => array( $term['module'] => $module_settings ),
|
162 |
+
);
|
163 |
foreach ( $gallery_meta as $key => $value ) {
|
164 |
$gmDB->update_metadata( 'gmedia_term', $term_id, $key, $value );
|
165 |
}
|
166 |
if ( $edit_gallery ) {
|
167 |
+
// translators: number.
|
168 |
+
$this->msg[] = sprintf( esc_html__( 'Gallery #%d successfully saved', 'grand-media' ), (int) $term_id );
|
169 |
} else {
|
170 |
+
$location = add_query_arg( array( 'edit_term' => $term_id, 'message' => 'save' ), $this->url );
|
171 |
set_transient( 'gmedia_new_gallery_id', $term_id, 60 );
|
172 |
+
wp_safe_redirect( $location );
|
173 |
exit;
|
174 |
}
|
175 |
} while ( 0 );
|
176 |
}
|
177 |
+
$term_id = $gmCore->_get( 'edit_term' );
|
178 |
+
if ( ( 'save' === $gmCore->_get( 'message' ) ) && $term_id ) {
|
179 |
$gmedia_new_gallery_id = get_transient( 'gmedia_new_gallery_id' );
|
180 |
if ( false !== $gmedia_new_gallery_id ) {
|
181 |
delete_transient( 'gmedia_new_gallery_id' );
|
182 |
+
// translators: number.
|
183 |
+
$this->msg[] = sprintf( esc_html__( 'Gallery #%d successfully saved', 'grand-media' ), (int) $term_id );
|
184 |
}
|
185 |
}
|
186 |
|
187 |
if ( isset( $_POST['module_preset_restore_original'] ) ) {
|
188 |
$preset_id = intval( $gmCore->_post( 'preset_default', 0 ) );
|
189 |
$gmDB->delete_term( $preset_id );
|
190 |
+
$this->msg[] = esc_html__( 'Original module settings restored. Click "Reset to default" button to save original module settings for gallery', 'grand-media' );
|
191 |
}
|
192 |
|
193 |
if ( isset( $_POST['gmedia_gallery_reset'] ) ) {
|
195 |
$edit_gallery = (int) $gmCore->_get( 'edit_term' );
|
196 |
do {
|
197 |
if ( ! $gmDB->term_exists( $edit_gallery ) ) {
|
198 |
+
$this->error[] = esc_html__( 'A term with the id provided does not exists', 'grand-media' );
|
199 |
break;
|
200 |
}
|
201 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
202 |
$term = $gmDB->get_term( $edit_gallery );
|
203 |
if ( $term->global !== $user_ID ) {
|
204 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
205 |
break;
|
206 |
}
|
207 |
}
|
215 |
if ( is_file( $module_path['path'] . '/settings.php' ) ) {
|
216 |
/** @noinspection PhpIncludeInspection */
|
217 |
include $module_path['path'] . '/settings.php';
|
218 |
+
$preset = $gmDB->get_term( '[' . $gallery_module . ']', array( 'taxonomy' => 'gmedia_module', 'global' => '0' ) );
|
219 |
if ( $preset ) {
|
220 |
$default_preset = maybe_unserialize( $preset->description );
|
221 |
$default_options = $gmCore->array_replace_recursive( $default_options, $default_preset );
|
226 |
$default_options = $gmCore->array_replace_recursive( $default_options, $default_preset );
|
227 |
}
|
228 |
} else {
|
229 |
+
// translators: module name.
|
230 |
+
$this->error[] = sprintf( esc_html__( 'Can\'t load data from `%s` module' ), esc_html( $gallery_module ) );
|
231 |
break;
|
232 |
}
|
233 |
|
234 |
+
$gallery_meta = array(
|
235 |
'_edited' => gmdate( 'Y-m-d H:i:s' ),
|
236 |
+
'_settings' => array( $gallery_module => $default_options ),
|
237 |
+
);
|
238 |
foreach ( $gallery_meta as $key => $value ) {
|
239 |
$gmDB->update_metadata( 'gmedia_term', $edit_gallery, $key, $value );
|
240 |
}
|
241 |
+
$this->msg[] = esc_html__( 'Gallery settings are reset', 'grand-media' );
|
242 |
|
243 |
} while ( 0 );
|
244 |
|
249 |
do {
|
250 |
$term = $gmCore->_post( 'term' );
|
251 |
if ( empty( $term['module'] ) ) {
|
252 |
+
$this->error[] = esc_html__( 'Something goes wrong... Choose module, please', 'grand-media' );
|
253 |
break;
|
254 |
}
|
255 |
+
$module_settings = $gmCore->_post( 'module', array() );
|
256 |
$module_path = $gmCore->get_module_path( $term['module'] );
|
257 |
+
$default_options = array();
|
258 |
if ( is_file( $module_path['path'] . '/settings.php' ) ) {
|
259 |
/** @noinspection PhpIncludeInspection */
|
260 |
include $module_path['path'] . '/settings.php';
|
261 |
} else {
|
262 |
+
// translators: module name.
|
263 |
+
$this->error[] = sprintf( esc_html__( 'Can\'t load data from `%s` module' ), esc_html( $term['module'] ) );
|
264 |
break;
|
265 |
}
|
266 |
$module_settings = $gmCore->array_replace_recursive( $default_options, $module_settings );
|
275 |
}
|
276 |
$preset_name = '[' . $term['module'] . '] ' . $preset_name;
|
277 |
}
|
278 |
+
$args = array();
|
279 |
$args['description'] = $module_settings;
|
280 |
$args['status'] = $term['module'];
|
281 |
$args['global'] = $user_ID;
|
294 |
$this->error[] = $term_id->get_error_message();
|
295 |
break;
|
296 |
} else {
|
297 |
+
// translators: preset name.
|
298 |
+
$this->msg[] = sprintf( esc_html__( 'Preset `%s` successfully saved', 'grand-media' ), esc_html( $preset_name ) );
|
299 |
}
|
|
|
300 |
} while ( 0 );
|
301 |
}
|
302 |
|
307 |
$ids = $gmCore->_get( 'ids', 'selected' );
|
308 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items : wp_parse_id_list( $ids );
|
309 |
if ( ! $gmCore->caps['gmedia_delete_others_media'] ) {
|
310 |
+
$_selected_items = $gmDB->get_terms( $taxonomy, array( 'fields' => 'ids', 'global' => $user_ID, 'include' => $selected_items ) );
|
311 |
if ( count( $_selected_items ) < count( $selected_items ) ) {
|
312 |
+
$this->error[] = esc_html__( 'You are not allowed to delete others media', 'grand-media' );
|
313 |
}
|
314 |
$selected_items = $_selected_items;
|
315 |
}
|
316 |
+
$count = count( $selected_items );
|
317 |
+
if ( $count ) {
|
318 |
foreach ( $selected_items as $item ) {
|
319 |
$delete = $gmDB->delete_term( $item );
|
320 |
if ( ! $delete ) {
|
321 |
+
// translators: number.
|
322 |
+
$this->error[] = sprintf( esc_html__( 'Error while delete gallery #%d', 'grand-media' ), (int) $item );
|
323 |
$count --;
|
324 |
} elseif ( is_wp_error( $delete ) ) {
|
325 |
$this->error[] = $delete->get_error_message();
|
327 |
}
|
328 |
}
|
329 |
if ( $count ) {
|
330 |
+
// translators: number.
|
331 |
+
$this->msg[] = sprintf( esc_html__( '%d item(s) deleted successfully', 'grand-media' ), (int) $count );
|
332 |
}
|
333 |
setcookie( self::$cookie_key, '', time() - 3600 );
|
334 |
unset( $_COOKIE[ self::$cookie_key ] );
|
335 |
+
$this->selected_items = array();
|
336 |
}
|
337 |
if ( ! empty( $this->msg ) ) {
|
338 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
342 |
}
|
343 |
}
|
344 |
if ( $do_gmedia_terms ) {
|
345 |
+
$_wpnonce = array();
|
346 |
foreach ( $_GET as $key => $value ) {
|
347 |
if ( strpos( $key, '_wpnonce' ) !== false ) {
|
348 |
$_wpnonce[ $key ] = $value;
|
349 |
}
|
350 |
}
|
351 |
+
$remove_args = array_merge( array( 'do_gmedia_terms', 'ids' ), $_wpnonce );
|
352 |
$location = remove_query_arg( $remove_args );
|
353 |
$location = add_query_arg( 'did_gmedia_terms', $do_gmedia_terms, $location );
|
354 |
+
wp_safe_redirect( $location );
|
355 |
exit;
|
356 |
}
|
357 |
if ( $gmCore->_get( 'did_gmedia_terms' ) ) {
|
admin/processor/class.processor.library.php
CHANGED
@@ -6,12 +6,14 @@
|
|
6 |
class GmediaProcessor_Library extends GmediaProcessor {
|
7 |
|
8 |
public static $cookie_key = false;
|
|
|
9 |
private static $me = null;
|
10 |
-
|
11 |
-
public $
|
12 |
-
public $
|
|
|
|
|
13 |
public $query_args;
|
14 |
-
public $filters = [];
|
15 |
|
16 |
/**
|
17 |
* GmediaProcessor_Library constructor.
|
@@ -22,13 +24,13 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
22 |
global $gmCore;
|
23 |
|
24 |
$user_ID = get_current_user_id();
|
25 |
-
self::$cookie_key =
|
26 |
-
$this->mode = $gmCore->_get( 'mode'
|
27 |
$stack = 'show' === $gmCore->_get( 'stack' ) ? 'show' : false;
|
28 |
$filter = 'selected' === $gmCore->_get( 'filter' ) ? 'selected' : false;
|
29 |
if ( $this->edit_term ) {
|
30 |
self::$cookie_key .= ':term' . $this->edit_term;
|
31 |
-
if (
|
32 |
foreach ( $_COOKIE as $key => $value ) {
|
33 |
if ( 'gmedia_library:' === substr( $key, 0, 15 ) ) {
|
34 |
setcookie( $key, '', time() - 3600 );
|
@@ -39,15 +41,15 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
39 |
} elseif ( $this->gmediablank && 'select_multiple' === $this->mode ) {
|
40 |
self::$cookie_key .= ':frame';
|
41 |
}
|
42 |
-
$this->url = add_query_arg(
|
43 |
$this->selected_items = parent::selected_items( self::$cookie_key );
|
44 |
$this->stack_items = parent::selected_items( "gmedia_{$user_ID}_libstack", 'stack_items' );
|
45 |
|
46 |
-
add_action( 'admin_enqueue_scripts',
|
47 |
}
|
48 |
|
49 |
public static function getMe() {
|
50 |
-
if ( self::$me
|
51 |
self::$me = new GmediaProcessor_Library();
|
52 |
}
|
53 |
|
@@ -60,7 +62,7 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
60 |
wp_enqueue_script( 'wplink' );
|
61 |
wp_enqueue_style( 'editor-buttons' );
|
62 |
|
63 |
-
add_action( 'admin_footer',
|
64 |
}
|
65 |
}
|
66 |
}
|
@@ -76,23 +78,23 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
76 |
global $user_ID, $gmCore, $gmDB, $gmGallery;
|
77 |
|
78 |
if ( ! $gmCore->caps['gmedia_library'] ) {
|
79 |
-
wp_die(
|
80 |
}
|
81 |
|
82 |
include_once GMEDIA_ABSPATH . 'admin/pages/library/functions.php';
|
83 |
|
84 |
-
if ( in_array( $this->mode,
|
85 |
$this->display_mode = 'grid';
|
86 |
}
|
87 |
if ( isset( $_GET['display_mode'] ) ) {
|
88 |
-
$display_mode = $
|
89 |
-
if ( in_array( $display_mode,
|
90 |
$view = $this->gmediablank ? '_frame' : '';
|
91 |
-
$this->user_options = array_merge( $this->user_options,
|
92 |
update_user_meta( $user_ID, 'gm_screen_options', $this->user_options );
|
93 |
}
|
94 |
$location = remove_query_arg( 'display_mode' );
|
95 |
-
|
96 |
exit;
|
97 |
}
|
98 |
|
@@ -103,7 +105,7 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
103 |
exit;
|
104 |
}
|
105 |
$location = remove_query_arg( 'grid_cell_fit' );
|
106 |
-
|
107 |
exit;
|
108 |
}
|
109 |
|
@@ -114,37 +116,37 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
114 |
$gallery_query = $gmDB->get_metadata( 'gmedia_term', $gallery_id, '_query', true );
|
115 |
$location = add_query_arg( $gallery_query, $location );
|
116 |
}
|
117 |
-
|
118 |
exit;
|
119 |
}
|
120 |
|
121 |
$this->query_args = $this->query_args();
|
122 |
|
123 |
-
|
124 |
if ( isset( $_POST['quick_gallery'] ) ) {
|
125 |
check_admin_referer( 'gmedia_action', '_wpnonce_action' );
|
126 |
do {
|
127 |
if ( ! $gmCore->caps['gmedia_gallery_manage'] ) {
|
128 |
-
$this->error[] =
|
129 |
break;
|
130 |
}
|
131 |
$gallery = $gmCore->_post( 'gallery' );
|
132 |
$gallery['name'] = trim( $gallery['name'] );
|
133 |
if ( empty( $gallery['name'] ) ) {
|
134 |
-
$this->error[] =
|
135 |
break;
|
136 |
}
|
137 |
if ( $gmCore->is_digit( $gallery['name'] ) ) {
|
138 |
-
$this->error[] =
|
139 |
break;
|
140 |
}
|
141 |
if ( empty( $gallery['query']['gmedia__in'] ) ) {
|
142 |
-
$this->error[] =
|
143 |
break;
|
144 |
}
|
145 |
$taxonomy = 'gmedia_gallery';
|
146 |
-
|
147 |
-
|
|
|
148 |
break;
|
149 |
}
|
150 |
$term_id = $gmDB->insert_term( $gallery['name'], $taxonomy );
|
@@ -153,46 +155,50 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
153 |
break;
|
154 |
}
|
155 |
$getModulePreset = $gmCore->getModulePreset( $gallery['module'] );
|
156 |
-
$gallery['query'] = array_merge( $gallery['query'],
|
157 |
|
158 |
-
$gallery_meta =
|
159 |
'_edited' => gmdate( 'Y-m-d H:i:s' ),
|
160 |
'_query' => $gallery['query'],
|
161 |
'_module' => $getModulePreset['module'],
|
162 |
'_settings' => $getModulePreset['settings'],
|
163 |
-
|
164 |
foreach ( $gallery_meta as $key => $value ) {
|
165 |
$gmDB->update_metadata( 'gmedia_term', $term_id, $key, $value );
|
166 |
}
|
167 |
-
|
|
|
168 |
} while ( 0 );
|
169 |
}
|
170 |
|
171 |
if ( isset( $_POST['filter_categories'] ) ) {
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
175 |
exit;
|
176 |
}
|
177 |
}
|
178 |
if ( isset( $_POST['filter_albums'] ) ) {
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
182 |
exit;
|
183 |
}
|
184 |
}
|
185 |
if ( isset( $_POST['filter_tags'] ) ) {
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
189 |
exit;
|
190 |
}
|
191 |
}
|
192 |
if ( isset( $_POST['filter_author'] ) ) {
|
193 |
$authors = $gmCore->_post( 'author_ids' );
|
194 |
-
$location = add_query_arg(
|
195 |
-
|
196 |
exit;
|
197 |
}
|
198 |
|
@@ -204,22 +210,24 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
204 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
205 |
$ids = $this->selected_items( $cookie_key );
|
206 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
207 |
-
$selected_items = $gmDB->get_gmedias(
|
208 |
if ( count( $selected_items ) < count( $ids ) ) {
|
209 |
-
$this->error[] =
|
210 |
}
|
211 |
} else {
|
212 |
$selected_items = $ids;
|
213 |
}
|
214 |
-
$term
|
215 |
-
|
|
|
216 |
if ( empty( $term ) ) {
|
217 |
foreach ( $selected_items as $item ) {
|
218 |
$gmDB->delete_gmedia_term_relationships( $item, 'gmedia_album' );
|
219 |
}
|
220 |
-
|
|
|
221 |
} else {
|
222 |
-
$term_ids =
|
223 |
foreach ( $selected_items as $item ) {
|
224 |
$result = $gmDB->set_gmedia_terms( $item, $term, 'gmedia_album', $append = 0 );
|
225 |
if ( is_wp_error( $result ) ) {
|
@@ -236,18 +244,20 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
236 |
foreach ( $term_ids as $term_id => $item_ids ) {
|
237 |
$term = $gmDB->get_term( $term_id );
|
238 |
if ( isset( $_POST['status_global'] ) ) {
|
239 |
-
$values =
|
240 |
foreach ( $selected_items as $item ) {
|
241 |
-
$values[] = $wpdb->prepare(
|
242 |
}
|
243 |
if ( $values ) {
|
244 |
$status = esc_sql( $term->status );
|
245 |
-
|
246 |
-
|
|
|
247 |
}
|
248 |
}
|
249 |
}
|
250 |
-
|
|
|
251 |
}
|
252 |
}
|
253 |
}
|
@@ -256,7 +266,7 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
256 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
257 |
}
|
258 |
} else {
|
259 |
-
$this->error[] =
|
260 |
}
|
261 |
}
|
262 |
if ( isset( $_POST['assign_category'] ) ) {
|
@@ -265,16 +275,17 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
265 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
266 |
$ids = $this->selected_items( $cookie_key );
|
267 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
268 |
-
$selected_items = $gmDB->get_gmedias(
|
269 |
if ( count( $selected_items ) < count( $ids ) ) {
|
270 |
-
$this->error[] =
|
271 |
}
|
272 |
} else {
|
273 |
$selected_items = $ids;
|
274 |
}
|
275 |
-
$term
|
276 |
-
$term
|
277 |
-
|
|
|
278 |
foreach ( $selected_items as $item ) {
|
279 |
$result = $gmDB->set_gmedia_terms( $item, $term, 'gmedia_category', $append = 1 );
|
280 |
if ( is_wp_error( $result ) ) {
|
@@ -285,30 +296,33 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
285 |
}
|
286 |
}
|
287 |
|
288 |
-
|
|
|
289 |
|
290 |
$this->clear_selected_items( $cookie_key );
|
291 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
292 |
}
|
293 |
} else {
|
294 |
-
$this->error[] =
|
295 |
}
|
296 |
}
|
297 |
if ( isset( $_POST['unassign_category'] ) ) {
|
298 |
check_admin_referer( 'gmedia_action', '_wpnonce_action' );
|
299 |
-
|
|
|
300 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
301 |
$ids = $this->selected_items( $cookie_key );
|
302 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
303 |
-
$selected_items = $gmDB->get_gmedias(
|
304 |
if ( count( $selected_items ) < count( $ids ) ) {
|
305 |
-
$this->error[] =
|
306 |
}
|
307 |
} else {
|
308 |
$selected_items = $ids;
|
309 |
}
|
310 |
$term = array_map( 'intval', $term );
|
311 |
-
|
|
|
312 |
foreach ( $selected_items as $item ) {
|
313 |
$result = $gmDB->set_gmedia_terms( $item, $term, 'gmedia_category', $append = - 1 );
|
314 |
if ( is_wp_error( $result ) ) {
|
@@ -318,19 +332,20 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
318 |
$count --;
|
319 |
}
|
320 |
}
|
321 |
-
|
|
|
322 |
|
323 |
$this->clear_selected_items( $cookie_key );
|
324 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
325 |
}
|
326 |
} else {
|
327 |
-
$this->error[] =
|
328 |
}
|
329 |
}
|
330 |
if ( isset( $_POST['add_tags'] ) ) {
|
331 |
check_admin_referer( 'gmedia_action', '_wpnonce_action' );
|
332 |
if ( ! $gmCore->caps['gmedia_terms'] ) {
|
333 |
-
$this->error[] =
|
334 |
} else {
|
335 |
$term = $gmCore->_post( 'tag_names' );
|
336 |
$iptc_tags = $gmCore->_post( 'iptc_tags' );
|
@@ -338,15 +353,16 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
338 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
339 |
$ids = $this->selected_items( $cookie_key );
|
340 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
341 |
-
$selected_items = $gmDB->get_gmedias(
|
342 |
if ( count( $selected_items ) < count( $ids ) ) {
|
343 |
-
$this->error[] =
|
344 |
}
|
345 |
} else {
|
346 |
$selected_items = $ids;
|
347 |
}
|
348 |
$term = explode( ',', $term );
|
349 |
-
|
|
|
350 |
foreach ( $selected_items as $item ) {
|
351 |
$_term = $term;
|
352 |
if ( $iptc_tags ) {
|
@@ -363,31 +379,34 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
363 |
$count --;
|
364 |
}
|
365 |
}
|
366 |
-
|
|
|
367 |
|
368 |
$this->clear_selected_items( $cookie_key );
|
369 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
370 |
}
|
371 |
} else {
|
372 |
-
$this->error[] =
|
373 |
}
|
374 |
}
|
375 |
}
|
376 |
if ( isset( $_POST['delete_tags'] ) ) {
|
377 |
check_admin_referer( 'gmedia_action', '_wpnonce_action' );
|
378 |
-
|
|
|
379 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
380 |
$ids = $this->selected_items( $cookie_key );
|
381 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
382 |
-
$selected_items = $gmDB->get_gmedias(
|
383 |
if ( count( $selected_items ) < count( $ids ) ) {
|
384 |
-
$this->error[] =
|
385 |
}
|
386 |
} else {
|
387 |
$selected_items = $ids;
|
388 |
}
|
389 |
$term = array_map( 'intval', $term );
|
390 |
-
|
|
|
391 |
foreach ( $selected_items as $item ) {
|
392 |
$result = $gmDB->set_gmedia_terms( $item, $term, 'gmedia_tag', $append = - 1 );
|
393 |
if ( is_wp_error( $result ) ) {
|
@@ -397,13 +416,14 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
397 |
$count --;
|
398 |
}
|
399 |
}
|
400 |
-
|
|
|
401 |
|
402 |
$this->clear_selected_items( $cookie_key );
|
403 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
404 |
}
|
405 |
} else {
|
406 |
-
$this->error[] =
|
407 |
}
|
408 |
}
|
409 |
if ( isset( $_POST['batch_edit'] ) ) {
|
@@ -412,15 +432,16 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
412 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
413 |
$ids = $this->selected_items( $cookie_key );
|
414 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
415 |
-
$selected_items = $gmDB->get_gmedias(
|
416 |
if ( count( $selected_items ) < count( $ids ) ) {
|
417 |
-
$this->error[] =
|
418 |
}
|
419 |
} else {
|
420 |
$selected_items = $ids;
|
421 |
}
|
422 |
-
|
423 |
-
|
|
|
424 |
$b_filename = $gmCore->_post( 'batch_filename' );
|
425 |
$b_title = $gmCore->_post( 'batch_title' );
|
426 |
$b_description = $gmCore->_post( 'batch_description' );
|
@@ -452,7 +473,7 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
452 |
|
453 |
$gmuid = pathinfo( $gmedia['gmuid'] );
|
454 |
|
455 |
-
$filename_vars =
|
456 |
if ( preg_match_all( '/{index[:]?(\d+)?}/', $filename_custom, $matches_all ) ) {
|
457 |
foreach ( $matches_all[0] as $key => $matches ) {
|
458 |
$strlen = strlen( $matches_all[1][ $key ] );
|
@@ -555,13 +576,14 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
555 |
|
556 |
$i ++;
|
557 |
}
|
558 |
-
|
|
|
559 |
|
560 |
$this->clear_selected_items( $cookie_key );
|
561 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
562 |
}
|
563 |
} else {
|
564 |
-
$this->error[] =
|
565 |
}
|
566 |
}
|
567 |
|
@@ -572,25 +594,27 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
572 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
573 |
$ids = $this->selected_items( $cookie_key );
|
574 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
575 |
-
$selected_items = $gmDB->get_gmedias(
|
576 |
if ( count( $selected_items ) < count( $ids ) ) {
|
577 |
-
$this->error[] =
|
578 |
}
|
579 |
} else {
|
580 |
$selected_items = $ids;
|
581 |
}
|
582 |
-
|
|
|
583 |
foreach ( $selected_items as $item ) {
|
584 |
$gmDB->delete_gmedia_term_relationships( $item, 'gmedia_album' );
|
585 |
}
|
586 |
-
|
|
|
587 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
588 |
|
589 |
$this->clear_selected_items( $cookie_key );
|
590 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
591 |
}
|
592 |
} else {
|
593 |
-
$this->error[] =
|
594 |
set_transient( 'gmedia_action_error', $this->error, 30 );
|
595 |
}
|
596 |
}
|
@@ -604,21 +628,22 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
604 |
foreach ( $selected_items as $item ) {
|
605 |
$id = (int) $item;
|
606 |
$media_metadata = $gmDB->generate_gmedia_metadata( $id );
|
607 |
-
$gmDB->update_metadata(
|
608 |
if ( ! empty( $media_metadata['image_meta']['created_timestamp'] ) ) {
|
609 |
-
$gmDB->update_metadata(
|
610 |
}
|
611 |
if ( ! empty( $media_metadata['image_meta']['GPS'] ) ) {
|
612 |
-
$gmDB->update_metadata(
|
613 |
}
|
614 |
}
|
615 |
-
|
|
|
616 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
617 |
}
|
618 |
$this->clear_selected_items( $cookie_key );
|
619 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
620 |
} else {
|
621 |
-
$this->error[] =
|
622 |
set_transient( 'gmedia_action_error', $this->error, 30 );
|
623 |
}
|
624 |
}
|
@@ -630,25 +655,27 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
630 |
$count = count( $selected_items );
|
631 |
if ( $count ) {
|
632 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
633 |
-
$edit_items = $gmDB->get_gmedias(
|
634 |
$selected_items = $edit_items;
|
635 |
} else {
|
636 |
-
$selected_items = $gmDB->get_gmedias(
|
637 |
}
|
638 |
-
|
639 |
-
|
|
|
640 |
foreach ( $selected_items as $si ) {
|
641 |
$ajax_operations['gmedia_recreate_images'][ $si ] = $si;
|
642 |
}
|
643 |
update_option( 'gmedia_ajax_long_operations', $ajax_operations );
|
644 |
-
|
|
|
645 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
646 |
}
|
647 |
}
|
648 |
$this->clear_selected_items( $cookie_key );
|
649 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
650 |
} else {
|
651 |
-
$this->error[] =
|
652 |
set_transient( 'gmedia_action_error', $this->error, 30 );
|
653 |
}
|
654 |
}
|
@@ -661,16 +688,18 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
661 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
662 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items( $cookie_key ) : wp_parse_id_list( $ids );
|
663 |
if ( ! empty( $selected_items ) ) {
|
664 |
-
|
|
|
665 |
foreach ( $selected_items as $gmid ) {
|
666 |
$gmCore->duplicate_gmedia( $gmid );
|
667 |
}
|
668 |
-
|
|
|
669 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
670 |
}
|
671 |
}
|
672 |
} else {
|
673 |
-
$this->error[] =
|
674 |
set_transient( 'gmedia_action_error', $this->error, 30 );
|
675 |
}
|
676 |
}
|
@@ -683,25 +712,28 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
683 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items( $cookie_key ) : wp_parse_id_list( $ids );
|
684 |
if ( ! empty( $selected_items ) ) {
|
685 |
if ( ! $gmCore->caps['gmedia_delete_others_media'] ) {
|
686 |
-
$delete_items = $gmDB->get_gmedias(
|
687 |
if ( count( $delete_items ) < count( $selected_items ) ) {
|
688 |
-
$this->error[] =
|
689 |
}
|
690 |
$selected_items = $delete_items;
|
691 |
}
|
692 |
-
|
|
|
693 |
$delete_original_file = ! ( 'delete__save_original' === $do_gmedia );
|
694 |
foreach ( $selected_items as $item ) {
|
695 |
if ( ! $gmDB->delete_gmedia( (int) $item, $delete_original_file ) ) {
|
696 |
-
$this->error[] = "#{$item}: " . __( 'Error in deleting...', 'grand-media' );
|
697 |
$count --;
|
698 |
}
|
699 |
}
|
700 |
if ( $count ) {
|
701 |
if ( $delete_original_file ) {
|
702 |
-
|
|
|
703 |
} else {
|
704 |
-
|
|
|
705 |
}
|
706 |
}
|
707 |
$this->selected_items = array_diff( $this->selected_items, $selected_items );
|
@@ -726,7 +758,8 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
726 |
if ( ! empty( $this->stack_items ) ) {
|
727 |
$this->stack_items = array_diff( $this->stack_items, $selected_items );
|
728 |
if ( empty( $this->stack_items ) ) {
|
729 |
-
$this->clear_selected_items( "gmedia_{$user_ID}_libstack" )
|
|
|
730 |
} else {
|
731 |
setcookie( "gmedia_{$user_ID}_libstack", implode( '.', $this->stack_items ) );
|
732 |
}
|
@@ -734,7 +767,7 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
734 |
}
|
735 |
}
|
736 |
} else {
|
737 |
-
$this->error[] =
|
738 |
}
|
739 |
if ( ! empty( $this->msg ) ) {
|
740 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
@@ -744,16 +777,16 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
744 |
}
|
745 |
}
|
746 |
if ( $do_gmedia ) {
|
747 |
-
$_wpnonce =
|
748 |
foreach ( $_GET as $key => $value ) {
|
749 |
if ( strpos( $key, '_wpnonce' ) !== false ) {
|
750 |
$_wpnonce[ $key ] = $value;
|
751 |
}
|
752 |
}
|
753 |
-
$remove_args = array_merge(
|
754 |
$location = remove_query_arg( $remove_args );
|
755 |
$location = add_query_arg( 'did_gmedia', $do_gmedia, $location );
|
756 |
-
|
757 |
exit;
|
758 |
}
|
759 |
if ( $gmCore->_get( 'did_gmedia' ) ) {
|
@@ -794,7 +827,7 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
794 |
$order = $this->user_options['sortorder_gmedia'];
|
795 |
}
|
796 |
} else {
|
797 |
-
$per_page = $this->user_options[
|
798 |
$orderby = $this->user_options['orderby_gmedia'];
|
799 |
$order = $this->user_options['sortorder_gmedia'];
|
800 |
}
|
@@ -833,7 +866,7 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
833 |
$this->selected_items = $duplicates['duplicate_select'];
|
834 |
} else {
|
835 |
unset( $args['gmedia__in'] );
|
836 |
-
$this->msg[] =
|
837 |
}
|
838 |
}
|
839 |
|
@@ -877,49 +910,49 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
877 |
$authors_names[ $i ] = get_the_author_meta( 'display_name', $id );
|
878 |
}
|
879 |
}
|
880 |
-
$this->filters['filter_author'] =
|
881 |
'title' => __( 'Filter Author', 'grand-media' ),
|
882 |
'filter' => $authors_names,
|
883 |
-
|
884 |
}
|
885 |
|
886 |
$gmDB->gmedias_album_stuff( $query_args );
|
887 |
if ( ! empty( $query_args['album__in'] ) ) {
|
888 |
if ( isset( $query_args['within_album'] ) ) {
|
889 |
$filter_title = __( 'Exclude Album', 'grand-media' );
|
890 |
-
$albums_names =
|
891 |
if ( ! empty( $query_args['with_album__not_in'] ) ) {
|
892 |
-
$albums_names = $gmDB->get_terms( 'gmedia_album',
|
893 |
}
|
894 |
-
|
895 |
} else {
|
896 |
$filter_title = __( 'Filter Album', 'grand-media' );
|
897 |
-
$albums_names = $gmDB->get_terms( 'gmedia_album',
|
898 |
}
|
899 |
if ( ! empty( $albums_names ) ) {
|
900 |
-
$this->filters['filter_albums'] =
|
901 |
'title' => $filter_title,
|
902 |
'filter' => $albums_names,
|
903 |
-
|
904 |
}
|
905 |
}
|
906 |
if ( ! empty( $query_args['album__not_in'] ) ) {
|
907 |
if ( isset( $query_args['without_album'] ) ) {
|
908 |
$filter_title = __( 'Filter Album', 'grand-media' );
|
909 |
-
$albums_names =
|
910 |
if ( ! empty( $query_args['with_album__in'] ) ) {
|
911 |
-
$albums_names = $gmDB->get_terms( 'gmedia_album',
|
912 |
}
|
913 |
-
|
914 |
} else {
|
915 |
$filter_title = __( 'Exclude Album', 'grand-media' );
|
916 |
-
$albums_names = $gmDB->get_terms( 'gmedia_album',
|
917 |
}
|
918 |
if ( ! empty( $albums_names ) ) {
|
919 |
-
$this->filters['exclude_albums'] =
|
920 |
'title' => $filter_title,
|
921 |
'filter' => $albums_names,
|
922 |
-
|
923 |
}
|
924 |
}
|
925 |
|
@@ -927,67 +960,67 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
927 |
if ( ! empty( $query_args['category__in'] ) ) {
|
928 |
if ( isset( $query_args['within_category'] ) ) {
|
929 |
$filter_title = __( 'Exclude Category', 'grand-media' );
|
930 |
-
$category_names =
|
931 |
if ( ! empty( $query_args['with_category__not_in'] ) ) {
|
932 |
-
$category_names = $gmDB->get_terms( 'gmedia_category',
|
933 |
}
|
934 |
-
$category_names =
|
935 |
} else {
|
936 |
$filter_title = __( 'Filter Category', 'grand-media' );
|
937 |
-
$category_names = $gmDB->get_terms( 'gmedia_category',
|
938 |
}
|
939 |
if ( ! empty( $category_names ) ) {
|
940 |
-
$this->filters['filter_categories'] =
|
941 |
'title' => $filter_title,
|
942 |
'filter' => $category_names,
|
943 |
-
|
944 |
}
|
945 |
}
|
946 |
if ( ! empty( $query_args['category__not_in'] ) ) {
|
947 |
if ( isset( $query_args['without_category'] ) ) {
|
948 |
$filter_title = __( 'Filter Category', 'grand-media' );
|
949 |
-
$category_names =
|
950 |
if ( ! empty( $query_args['with_category__in'] ) ) {
|
951 |
-
$category_names = $gmDB->get_terms( 'gmedia_category',
|
952 |
}
|
953 |
-
$category_names =
|
954 |
} else {
|
955 |
$filter_title = __( 'Exclude Category', 'grand-media' );
|
956 |
-
$category_names = $gmDB->get_terms( 'gmedia_category',
|
957 |
}
|
958 |
if ( ! empty( $category_names ) ) {
|
959 |
-
$this->filters['exclude_categories'] =
|
960 |
'title' => $filter_title,
|
961 |
'filter' => $category_names,
|
962 |
-
|
963 |
}
|
964 |
}
|
965 |
|
966 |
$gmDB->gmedias_tag_stuff( $query_args );
|
967 |
if ( ! empty( $query_args['tag__in'] ) ) {
|
968 |
-
$tag_names = $gmDB->get_terms( 'gmedia_tag',
|
969 |
if ( ! empty( $tag_names ) ) {
|
970 |
-
$this->filters['filter_tags'] =
|
971 |
'title' => __( 'Filter Tag', 'grand-media' ),
|
972 |
'filter' => $tag_names,
|
973 |
-
|
974 |
}
|
975 |
}
|
976 |
if ( ! empty( $query_args['tag__not_in'] ) ) {
|
977 |
-
$tag_names = $gmDB->get_terms( 'gmedia_tag',
|
978 |
if ( ! empty( $tag_names ) ) {
|
979 |
-
$this->filters['exclude_tags'] =
|
980 |
'title' => __( 'Exclude Tag', 'grand-media' ),
|
981 |
'filter' => $tag_names,
|
982 |
-
|
983 |
}
|
984 |
}
|
985 |
|
986 |
if ( ! empty( $args['terms_relation'] ) ) {
|
987 |
-
$this->filters['terms_relation'] =
|
988 |
'title' => __( 'Terms Relation', 'grand-media' ),
|
989 |
-
'filter' =>
|
990 |
-
|
991 |
}
|
992 |
|
993 |
return $query_args;
|
6 |
class GmediaProcessor_Library extends GmediaProcessor {
|
7 |
|
8 |
public static $cookie_key = false;
|
9 |
+
|
10 |
private static $me = null;
|
11 |
+
|
12 |
+
public $mode = false;
|
13 |
+
public $selected_items = array();
|
14 |
+
public $stack_items = array();
|
15 |
+
public $filters = array();
|
16 |
public $query_args;
|
|
|
17 |
|
18 |
/**
|
19 |
* GmediaProcessor_Library constructor.
|
24 |
global $gmCore;
|
25 |
|
26 |
$user_ID = get_current_user_id();
|
27 |
+
self::$cookie_key = 'gmedia_library';
|
28 |
+
$this->mode = $gmCore->_get( 'mode' );
|
29 |
$stack = 'show' === $gmCore->_get( 'stack' ) ? 'show' : false;
|
30 |
$filter = 'selected' === $gmCore->_get( 'filter' ) ? 'selected' : false;
|
31 |
if ( $this->edit_term ) {
|
32 |
self::$cookie_key .= ':term' . $this->edit_term;
|
33 |
+
if ( ! isset( $_COOKIE[ self::$cookie_key ] ) ) {
|
34 |
foreach ( $_COOKIE as $key => $value ) {
|
35 |
if ( 'gmedia_library:' === substr( $key, 0, 15 ) ) {
|
36 |
setcookie( $key, '', time() - 3600 );
|
41 |
} elseif ( $this->gmediablank && 'select_multiple' === $this->mode ) {
|
42 |
self::$cookie_key .= ':frame';
|
43 |
}
|
44 |
+
$this->url = add_query_arg( array( 'mode' => $this->mode, 'stack' => $stack, 'filter' => $filter, 'edit_term' => $this->edit_term ), $this->url );
|
45 |
$this->selected_items = parent::selected_items( self::$cookie_key );
|
46 |
$this->stack_items = parent::selected_items( "gmedia_{$user_ID}_libstack", 'stack_items' );
|
47 |
|
48 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
49 |
}
|
50 |
|
51 |
public static function getMe() {
|
52 |
+
if ( null === self::$me ) {
|
53 |
self::$me = new GmediaProcessor_Library();
|
54 |
}
|
55 |
|
62 |
wp_enqueue_script( 'wplink' );
|
63 |
wp_enqueue_style( 'editor-buttons' );
|
64 |
|
65 |
+
add_action( 'admin_footer', array( $this, 'wpLink' ) );
|
66 |
}
|
67 |
}
|
68 |
}
|
78 |
global $user_ID, $gmCore, $gmDB, $gmGallery;
|
79 |
|
80 |
if ( ! $gmCore->caps['gmedia_library'] ) {
|
81 |
+
wp_die( esc_html__( 'You are not allowed to be here', 'grand-media' ) );
|
82 |
}
|
83 |
|
84 |
include_once GMEDIA_ABSPATH . 'admin/pages/library/functions.php';
|
85 |
|
86 |
+
if ( in_array( $this->mode, array( 'select_single', 'select_multiple' ), true ) ) {
|
87 |
$this->display_mode = 'grid';
|
88 |
}
|
89 |
if ( isset( $_GET['display_mode'] ) ) {
|
90 |
+
$display_mode = $gmCore->_get( 'display_mode' );
|
91 |
+
if ( in_array( $display_mode, array( 'grid', 'list' ), true ) ) {
|
92 |
$view = $this->gmediablank ? '_frame' : '';
|
93 |
+
$this->user_options = array_merge( $this->user_options, array( "display_mode_gmedia{$view}" => $display_mode ) );
|
94 |
update_user_meta( $user_ID, 'gm_screen_options', $this->user_options );
|
95 |
}
|
96 |
$location = remove_query_arg( 'display_mode' );
|
97 |
+
wp_safe_redirect( $location );
|
98 |
exit;
|
99 |
}
|
100 |
|
105 |
exit;
|
106 |
}
|
107 |
$location = remove_query_arg( 'grid_cell_fit' );
|
108 |
+
wp_safe_redirect( $location );
|
109 |
exit;
|
110 |
}
|
111 |
|
116 |
$gallery_query = $gmDB->get_metadata( 'gmedia_term', $gallery_id, '_query', true );
|
117 |
$location = add_query_arg( $gallery_query, $location );
|
118 |
}
|
119 |
+
wp_safe_redirect( $location );
|
120 |
exit;
|
121 |
}
|
122 |
|
123 |
$this->query_args = $this->query_args();
|
124 |
|
|
|
125 |
if ( isset( $_POST['quick_gallery'] ) ) {
|
126 |
check_admin_referer( 'gmedia_action', '_wpnonce_action' );
|
127 |
do {
|
128 |
if ( ! $gmCore->caps['gmedia_gallery_manage'] ) {
|
129 |
+
$this->error[] = esc_html__( 'You are not allowed to manage galleries', 'grand-media' );
|
130 |
break;
|
131 |
}
|
132 |
$gallery = $gmCore->_post( 'gallery' );
|
133 |
$gallery['name'] = trim( $gallery['name'] );
|
134 |
if ( empty( $gallery['name'] ) ) {
|
135 |
+
$this->error[] = esc_html__( 'Gallery Name is not specified', 'grand-media' );
|
136 |
break;
|
137 |
}
|
138 |
if ( $gmCore->is_digit( $gallery['name'] ) ) {
|
139 |
+
$this->error[] = esc_html__( "Gallery name can't be only digits", 'grand-media' );
|
140 |
break;
|
141 |
}
|
142 |
if ( empty( $gallery['query']['gmedia__in'] ) ) {
|
143 |
+
$this->error[] = esc_html__( 'Choose gmedia from library for quick gallery', 'grand-media' );
|
144 |
break;
|
145 |
}
|
146 |
$taxonomy = 'gmedia_gallery';
|
147 |
+
$term_id = $gmDB->term_exists( $gallery['name'], $taxonomy );
|
148 |
+
if ( $term_id ) {
|
149 |
+
$this->error[] = esc_html__( 'A term with the name provided already exists', 'grand-media' );
|
150 |
break;
|
151 |
}
|
152 |
$term_id = $gmDB->insert_term( $gallery['name'], $taxonomy );
|
155 |
break;
|
156 |
}
|
157 |
$getModulePreset = $gmCore->getModulePreset( $gallery['module'] );
|
158 |
+
$gallery['query'] = array_merge( $gallery['query'], array( 'order' => 'ASC', 'orderby' => 'gmedia__in' ) );
|
159 |
|
160 |
+
$gallery_meta = array(
|
161 |
'_edited' => gmdate( 'Y-m-d H:i:s' ),
|
162 |
'_query' => $gallery['query'],
|
163 |
'_module' => $getModulePreset['module'],
|
164 |
'_settings' => $getModulePreset['settings'],
|
165 |
+
);
|
166 |
foreach ( $gallery_meta as $key => $value ) {
|
167 |
$gmDB->update_metadata( 'gmedia_term', $term_id, $key, $value );
|
168 |
}
|
169 |
+
// translators: 1 - gallery name; 2 - ID.
|
170 |
+
$this->msg[] = sprintf( esc_html__( 'Gallery "%1$s" successfully saved. Shortcode: [gmedia id=%2$d]', 'grand-media' ), esc_html( $gallery['name'] ), intval( $term_id ) );
|
171 |
} while ( 0 );
|
172 |
}
|
173 |
|
174 |
if ( isset( $_POST['filter_categories'] ) ) {
|
175 |
+
$term = $gmCore->_post( 'cat' );
|
176 |
+
if ( false !== $term ) {
|
177 |
+
$location = add_query_arg( array( 'category__in' => implode( ',', $term ) ), $this->url );
|
178 |
+
wp_safe_redirect( $location );
|
179 |
exit;
|
180 |
}
|
181 |
}
|
182 |
if ( isset( $_POST['filter_albums'] ) ) {
|
183 |
+
$term = $gmCore->_post( 'alb' );
|
184 |
+
if ( false !== $term ) {
|
185 |
+
$location = add_query_arg( array( 'album__in' => implode( ',', $term ) ), $this->url );
|
186 |
+
wp_safe_redirect( $location );
|
187 |
exit;
|
188 |
}
|
189 |
}
|
190 |
if ( isset( $_POST['filter_tags'] ) ) {
|
191 |
+
$term = $gmCore->_post( 'tag_ids' );
|
192 |
+
if ( false !== $term ) {
|
193 |
+
$location = add_query_arg( array( 'tag__in' => $term ), $this->url );
|
194 |
+
wp_safe_redirect( $location );
|
195 |
exit;
|
196 |
}
|
197 |
}
|
198 |
if ( isset( $_POST['filter_author'] ) ) {
|
199 |
$authors = $gmCore->_post( 'author_ids' );
|
200 |
+
$location = add_query_arg( array( 'author' => (int) $authors ), $this->url );
|
201 |
+
wp_safe_redirect( $location );
|
202 |
exit;
|
203 |
}
|
204 |
|
210 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
211 |
$ids = $this->selected_items( $cookie_key );
|
212 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
213 |
+
$selected_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids ) );
|
214 |
if ( count( $selected_items ) < count( $ids ) ) {
|
215 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
216 |
}
|
217 |
} else {
|
218 |
$selected_items = $ids;
|
219 |
}
|
220 |
+
$term = $gmCore->_post( 'alb' );
|
221 |
+
$count = count( $selected_items );
|
222 |
+
if ( ( false !== $term ) && $count ) {
|
223 |
if ( empty( $term ) ) {
|
224 |
foreach ( $selected_items as $item ) {
|
225 |
$gmDB->delete_gmedia_term_relationships( $item, 'gmedia_album' );
|
226 |
}
|
227 |
+
// translators: number.
|
228 |
+
$this->msg[] = sprintf( esc_html__( '%d item(s) updated with "No Album"', 'grand-media' ), intval( $count ) );
|
229 |
} else {
|
230 |
+
$term_ids = array();
|
231 |
foreach ( $selected_items as $item ) {
|
232 |
$result = $gmDB->set_gmedia_terms( $item, $term, 'gmedia_album', $append = 0 );
|
233 |
if ( is_wp_error( $result ) ) {
|
244 |
foreach ( $term_ids as $term_id => $item_ids ) {
|
245 |
$term = $gmDB->get_term( $term_id );
|
246 |
if ( isset( $_POST['status_global'] ) ) {
|
247 |
+
$values = array();
|
248 |
foreach ( $selected_items as $item ) {
|
249 |
+
$values[] = $wpdb->prepare( '%d', $item );
|
250 |
}
|
251 |
if ( $values ) {
|
252 |
$status = esc_sql( $term->status );
|
253 |
+
// phpcs:ignore
|
254 |
+
if ( false === $wpdb->query( "UPDATE {$wpdb->prefix}gmedia SET status = '{$status}' WHERE ID IN (" . join( ',', $values ) . ')' ) ) {
|
255 |
+
$this->error[] = esc_html__( 'Could not update statuses for gmedia items in the database' );
|
256 |
}
|
257 |
}
|
258 |
}
|
259 |
+
// translators: 1 - album name; 2 - number.
|
260 |
+
$this->msg[] = sprintf( esc_html__( 'Album `%1$s` assigned to %2$d item(s)', 'grand-media' ), esc_html( $term->name ), count( $item_ids ) );
|
261 |
}
|
262 |
}
|
263 |
}
|
266 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
267 |
}
|
268 |
} else {
|
269 |
+
$this->error[] = esc_html__( 'You are not allowed to assign terms', 'grand-media' );
|
270 |
}
|
271 |
}
|
272 |
if ( isset( $_POST['assign_category'] ) ) {
|
275 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
276 |
$ids = $this->selected_items( $cookie_key );
|
277 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
278 |
+
$selected_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids ) );
|
279 |
if ( count( $selected_items ) < count( $ids ) ) {
|
280 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
281 |
}
|
282 |
} else {
|
283 |
$selected_items = $ids;
|
284 |
}
|
285 |
+
$term = $gmCore->_post( 'cat_names' );
|
286 |
+
$term = explode( ',', $term );
|
287 |
+
$count = count( $selected_items );
|
288 |
+
if ( ! empty( $term ) && $count ) {
|
289 |
foreach ( $selected_items as $item ) {
|
290 |
$result = $gmDB->set_gmedia_terms( $item, $term, 'gmedia_category', $append = 1 );
|
291 |
if ( is_wp_error( $result ) ) {
|
296 |
}
|
297 |
}
|
298 |
|
299 |
+
// translators: number.
|
300 |
+
$this->msg[] = sprintf( esc_html__( 'Categories assigned to %d image(s).', 'grand-media' ), intval( $count ) );
|
301 |
|
302 |
$this->clear_selected_items( $cookie_key );
|
303 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
304 |
}
|
305 |
} else {
|
306 |
+
$this->error[] = esc_html__( 'You are not allowed to assign terms', 'grand-media' );
|
307 |
}
|
308 |
}
|
309 |
if ( isset( $_POST['unassign_category'] ) ) {
|
310 |
check_admin_referer( 'gmedia_action', '_wpnonce_action' );
|
311 |
+
$term = $gmCore->_post( 'category_id' );
|
312 |
+
if ( $term && $gmCore->caps['gmedia_terms'] ) {
|
313 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
314 |
$ids = $this->selected_items( $cookie_key );
|
315 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
316 |
+
$selected_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids ) );
|
317 |
if ( count( $selected_items ) < count( $ids ) ) {
|
318 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
319 |
}
|
320 |
} else {
|
321 |
$selected_items = $ids;
|
322 |
}
|
323 |
$term = array_map( 'intval', $term );
|
324 |
+
$count = count( $selected_items );
|
325 |
+
if ( $count ) {
|
326 |
foreach ( $selected_items as $item ) {
|
327 |
$result = $gmDB->set_gmedia_terms( $item, $term, 'gmedia_category', $append = - 1 );
|
328 |
if ( is_wp_error( $result ) ) {
|
332 |
$count --;
|
333 |
}
|
334 |
}
|
335 |
+
// translators: 1 - number; 2 - number.
|
336 |
+
$this->msg[] = sprintf( esc_html__( '%1$d category(ies) deleted from %2$d item(s)', 'grand-media' ), count( $term ), (int) $count );
|
337 |
|
338 |
$this->clear_selected_items( $cookie_key );
|
339 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
340 |
}
|
341 |
} else {
|
342 |
+
$this->error[] = esc_html__( 'You are not allowed to assign terms', 'grand-media' );
|
343 |
}
|
344 |
}
|
345 |
if ( isset( $_POST['add_tags'] ) ) {
|
346 |
check_admin_referer( 'gmedia_action', '_wpnonce_action' );
|
347 |
if ( ! $gmCore->caps['gmedia_terms'] ) {
|
348 |
+
$this->error[] = esc_html__( 'You are not allowed to assign terms', 'grand-media' );
|
349 |
} else {
|
350 |
$term = $gmCore->_post( 'tag_names' );
|
351 |
$iptc_tags = $gmCore->_post( 'iptc_tags' );
|
353 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
354 |
$ids = $this->selected_items( $cookie_key );
|
355 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
356 |
+
$selected_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids ) );
|
357 |
if ( count( $selected_items ) < count( $ids ) ) {
|
358 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
359 |
}
|
360 |
} else {
|
361 |
$selected_items = $ids;
|
362 |
}
|
363 |
$term = explode( ',', $term );
|
364 |
+
$count = count( $selected_items );
|
365 |
+
if ( $count ) {
|
366 |
foreach ( $selected_items as $item ) {
|
367 |
$_term = $term;
|
368 |
if ( $iptc_tags ) {
|
379 |
$count --;
|
380 |
}
|
381 |
}
|
382 |
+
// translators: number.
|
383 |
+
$this->msg[] = sprintf( esc_html__( 'Tags added to %d item(s)', 'grand-media' ), (int) $count );
|
384 |
|
385 |
$this->clear_selected_items( $cookie_key );
|
386 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
387 |
}
|
388 |
} else {
|
389 |
+
$this->error[] = esc_html__( 'No tags specified', 'grand-media' );
|
390 |
}
|
391 |
}
|
392 |
}
|
393 |
if ( isset( $_POST['delete_tags'] ) ) {
|
394 |
check_admin_referer( 'gmedia_action', '_wpnonce_action' );
|
395 |
+
$term = $gmCore->_post( 'tag_id' );
|
396 |
+
if ( $term && $gmCore->caps['gmedia_terms'] ) {
|
397 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
398 |
$ids = $this->selected_items( $cookie_key );
|
399 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
400 |
+
$selected_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids ) );
|
401 |
if ( count( $selected_items ) < count( $ids ) ) {
|
402 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
403 |
}
|
404 |
} else {
|
405 |
$selected_items = $ids;
|
406 |
}
|
407 |
$term = array_map( 'intval', $term );
|
408 |
+
$count = count( $selected_items );
|
409 |
+
if ( $count ) {
|
410 |
foreach ( $selected_items as $item ) {
|
411 |
$result = $gmDB->set_gmedia_terms( $item, $term, 'gmedia_tag', $append = - 1 );
|
412 |
if ( is_wp_error( $result ) ) {
|
416 |
$count --;
|
417 |
}
|
418 |
}
|
419 |
+
// translators: 1 - number; 2 - number.
|
420 |
+
$this->msg[] = sprintf( esc_html__( '%1$d tag(s) deleted from %2$d item(s)', 'grand-media' ), count( $term ), (int) $count );
|
421 |
|
422 |
$this->clear_selected_items( $cookie_key );
|
423 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
424 |
}
|
425 |
} else {
|
426 |
+
$this->error[] = esc_html__( 'You are not allowed to assign terms', 'grand-media' );
|
427 |
}
|
428 |
}
|
429 |
if ( isset( $_POST['batch_edit'] ) ) {
|
432 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
433 |
$ids = $this->selected_items( $cookie_key );
|
434 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
435 |
+
$selected_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids ) );
|
436 |
if ( count( $selected_items ) < count( $ids ) ) {
|
437 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
438 |
}
|
439 |
} else {
|
440 |
$selected_items = $ids;
|
441 |
}
|
442 |
+
$count = count( $selected_items );
|
443 |
+
if ( $count ) {
|
444 |
+
$batch_data = array();
|
445 |
$b_filename = $gmCore->_post( 'batch_filename' );
|
446 |
$b_title = $gmCore->_post( 'batch_title' );
|
447 |
$b_description = $gmCore->_post( 'batch_description' );
|
473 |
|
474 |
$gmuid = pathinfo( $gmedia['gmuid'] );
|
475 |
|
476 |
+
$filename_vars = array( '{filename}' => $gmuid['filename'], '{id}' => $gmedia['ID'] );
|
477 |
if ( preg_match_all( '/{index[:]?(\d+)?}/', $filename_custom, $matches_all ) ) {
|
478 |
foreach ( $matches_all[0] as $key => $matches ) {
|
479 |
$strlen = strlen( $matches_all[1][ $key ] );
|
576 |
|
577 |
$i ++;
|
578 |
}
|
579 |
+
// translators: number.
|
580 |
+
$this->msg[] = sprintf( esc_html__( '%d item(s) updated successfully', 'grand-media' ), $count );
|
581 |
|
582 |
$this->clear_selected_items( $cookie_key );
|
583 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
584 |
}
|
585 |
} else {
|
586 |
+
$this->error[] = esc_html__( 'You are not allowed to edit media', 'grand-media' );
|
587 |
}
|
588 |
}
|
589 |
|
594 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
595 |
$ids = $this->selected_items( $cookie_key );
|
596 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
597 |
+
$selected_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids ) );
|
598 |
if ( count( $selected_items ) < count( $ids ) ) {
|
599 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
600 |
}
|
601 |
} else {
|
602 |
$selected_items = $ids;
|
603 |
}
|
604 |
+
$count = count( $selected_items );
|
605 |
+
if ( $count ) {
|
606 |
foreach ( $selected_items as $item ) {
|
607 |
$gmDB->delete_gmedia_term_relationships( $item, 'gmedia_album' );
|
608 |
}
|
609 |
+
// translators: number.
|
610 |
+
$this->msg[] = sprintf( esc_html__( '%d item(s) updated with "No Album"', 'grand-media' ), (int) $count );
|
611 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
612 |
|
613 |
$this->clear_selected_items( $cookie_key );
|
614 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
615 |
}
|
616 |
} else {
|
617 |
+
$this->error[] = esc_html__( 'You are not allowed to assign terms', 'grand-media' );
|
618 |
set_transient( 'gmedia_action_error', $this->error, 30 );
|
619 |
}
|
620 |
}
|
628 |
foreach ( $selected_items as $item ) {
|
629 |
$id = (int) $item;
|
630 |
$media_metadata = $gmDB->generate_gmedia_metadata( $id );
|
631 |
+
$gmDB->update_metadata( 'gmedia', $id, '_metadata', $media_metadata );
|
632 |
if ( ! empty( $media_metadata['image_meta']['created_timestamp'] ) ) {
|
633 |
+
$gmDB->update_metadata( 'gmedia', $id, '_created_timestamp', $media_metadata['image_meta']['created_timestamp'] );
|
634 |
}
|
635 |
if ( ! empty( $media_metadata['image_meta']['GPS'] ) ) {
|
636 |
+
$gmDB->update_metadata( 'gmedia', $id, '_gps', $media_metadata['image_meta']['GPS'] );
|
637 |
}
|
638 |
}
|
639 |
+
// translators: number.
|
640 |
+
$this->msg[] = sprintf( esc_html__( '%d item(s) updated successfully', 'grand-media' ), (int) $count );
|
641 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
642 |
}
|
643 |
$this->clear_selected_items( $cookie_key );
|
644 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
645 |
} else {
|
646 |
+
$this->error[] = esc_html__( 'You are not allowed to edit media', 'grand-media' );
|
647 |
set_transient( 'gmedia_action_error', $this->error, 30 );
|
648 |
}
|
649 |
}
|
655 |
$count = count( $selected_items );
|
656 |
if ( $count ) {
|
657 |
if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
658 |
+
$edit_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'mime_type' => 'image', 'gmedia__in' => $selected_items ) );
|
659 |
$selected_items = $edit_items;
|
660 |
} else {
|
661 |
+
$selected_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'mime_type' => 'image', 'gmedia__in' => $selected_items ) );
|
662 |
}
|
663 |
+
$count = count( $selected_items );
|
664 |
+
if ( $count ) {
|
665 |
+
$ajax_operations = get_option( 'gmedia_ajax_long_operations', array() );
|
666 |
foreach ( $selected_items as $si ) {
|
667 |
$ajax_operations['gmedia_recreate_images'][ $si ] = $si;
|
668 |
}
|
669 |
update_option( 'gmedia_ajax_long_operations', $ajax_operations );
|
670 |
+
// translators: number.
|
671 |
+
$this->msg[] = sprintf( esc_html__( 'You\'ve added %d image(s) to the re-creation queue.', 'grand-media' ), (int) $count );
|
672 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
673 |
}
|
674 |
}
|
675 |
$this->clear_selected_items( $cookie_key );
|
676 |
$this->selected_items = $this->selected_items( self::$cookie_key );
|
677 |
} else {
|
678 |
+
$this->error[] = esc_html__( 'You are not allowed to edit media', 'grand-media' );
|
679 |
set_transient( 'gmedia_action_error', $this->error, 30 );
|
680 |
}
|
681 |
}
|
688 |
$cookie_key = $gmCore->_post( 'cookie_key', self::$cookie_key );
|
689 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items( $cookie_key ) : wp_parse_id_list( $ids );
|
690 |
if ( ! empty( $selected_items ) ) {
|
691 |
+
$count = count( $selected_items );
|
692 |
+
if ( $count ) {
|
693 |
foreach ( $selected_items as $gmid ) {
|
694 |
$gmCore->duplicate_gmedia( $gmid );
|
695 |
}
|
696 |
+
// translators: number.
|
697 |
+
$this->msg[] = sprintf( esc_html__( '%d item was duplicated', 'grand-media' ), (int) $count );
|
698 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
699 |
}
|
700 |
}
|
701 |
} else {
|
702 |
+
$this->error[] = esc_html__( 'You are not allowed to import files', 'grand-media' );
|
703 |
set_transient( 'gmedia_action_error', $this->error, 30 );
|
704 |
}
|
705 |
}
|
712 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items( $cookie_key ) : wp_parse_id_list( $ids );
|
713 |
if ( ! empty( $selected_items ) ) {
|
714 |
if ( ! $gmCore->caps['gmedia_delete_others_media'] ) {
|
715 |
+
$delete_items = $gmDB->get_gmedias( array( 'fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $selected_items ) );
|
716 |
if ( count( $delete_items ) < count( $selected_items ) ) {
|
717 |
+
$this->error[] = esc_html__( 'You are not allowed to delete others media', 'grand-media' );
|
718 |
}
|
719 |
$selected_items = $delete_items;
|
720 |
}
|
721 |
+
$count = count( $selected_items );
|
722 |
+
if ( $count ) {
|
723 |
$delete_original_file = ! ( 'delete__save_original' === $do_gmedia );
|
724 |
foreach ( $selected_items as $item ) {
|
725 |
if ( ! $gmDB->delete_gmedia( (int) $item, $delete_original_file ) ) {
|
726 |
+
$this->error[] = esc_html( "#{$item}: " . __( 'Error in deleting...', 'grand-media' ) );
|
727 |
$count --;
|
728 |
}
|
729 |
}
|
730 |
if ( $count ) {
|
731 |
if ( $delete_original_file ) {
|
732 |
+
// translators: number.
|
733 |
+
$this->msg[] = sprintf( esc_html__( '%d item(s) deleted successfully', 'grand-media' ), (int) $count );
|
734 |
} else {
|
735 |
+
// translators: number.
|
736 |
+
$this->msg[] = sprintf( esc_html__( '%d record(s) deleted from database successfully. Original file(s) safe', 'grand-media' ), (int) $count );
|
737 |
}
|
738 |
}
|
739 |
$this->selected_items = array_diff( $this->selected_items, $selected_items );
|
758 |
if ( ! empty( $this->stack_items ) ) {
|
759 |
$this->stack_items = array_diff( $this->stack_items, $selected_items );
|
760 |
if ( empty( $this->stack_items ) ) {
|
761 |
+
$this->clear_selected_items( "gmedia_{$user_ID}_libstack" );
|
762 |
+
|
763 |
} else {
|
764 |
setcookie( "gmedia_{$user_ID}_libstack", implode( '.', $this->stack_items ) );
|
765 |
}
|
767 |
}
|
768 |
}
|
769 |
} else {
|
770 |
+
$this->error[] = esc_html__( 'You are not allowed to delete files', 'grand-media' );
|
771 |
}
|
772 |
if ( ! empty( $this->msg ) ) {
|
773 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
777 |
}
|
778 |
}
|
779 |
if ( $do_gmedia ) {
|
780 |
+
$_wpnonce = array();
|
781 |
foreach ( $_GET as $key => $value ) {
|
782 |
if ( strpos( $key, '_wpnonce' ) !== false ) {
|
783 |
$_wpnonce[ $key ] = $value;
|
784 |
}
|
785 |
}
|
786 |
+
$remove_args = array_merge( array( 'do_gmedia', 'ids' ), $_wpnonce );
|
787 |
$location = remove_query_arg( $remove_args );
|
788 |
$location = add_query_arg( 'did_gmedia', $do_gmedia, $location );
|
789 |
+
wp_safe_redirect( $location );
|
790 |
exit;
|
791 |
}
|
792 |
if ( $gmCore->_get( 'did_gmedia' ) ) {
|
827 |
$order = $this->user_options['sortorder_gmedia'];
|
828 |
}
|
829 |
} else {
|
830 |
+
$per_page = $this->user_options['per_page_gmedia'];
|
831 |
$orderby = $this->user_options['orderby_gmedia'];
|
832 |
$order = $this->user_options['sortorder_gmedia'];
|
833 |
}
|
866 |
$this->selected_items = $duplicates['duplicate_select'];
|
867 |
} else {
|
868 |
unset( $args['gmedia__in'] );
|
869 |
+
$this->msg[] = esc_html__( 'No duplicates in Gmedia Library', 'grand-media' );
|
870 |
}
|
871 |
}
|
872 |
|
910 |
$authors_names[ $i ] = get_the_author_meta( 'display_name', $id );
|
911 |
}
|
912 |
}
|
913 |
+
$this->filters['filter_author'] = array(
|
914 |
'title' => __( 'Filter Author', 'grand-media' ),
|
915 |
'filter' => $authors_names,
|
916 |
+
);
|
917 |
}
|
918 |
|
919 |
$gmDB->gmedias_album_stuff( $query_args );
|
920 |
if ( ! empty( $query_args['album__in'] ) ) {
|
921 |
if ( isset( $query_args['within_album'] ) ) {
|
922 |
$filter_title = __( 'Exclude Album', 'grand-media' );
|
923 |
+
$albums_names = array();
|
924 |
if ( ! empty( $query_args['with_album__not_in'] ) ) {
|
925 |
+
$albums_names = $gmDB->get_terms( 'gmedia_album', array( 'fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['with_album__not_in'] ) );
|
926 |
}
|
927 |
+
$albums_names[] = __( 'Hide items without album', 'grand-media' );
|
928 |
} else {
|
929 |
$filter_title = __( 'Filter Album', 'grand-media' );
|
930 |
+
$albums_names = $gmDB->get_terms( 'gmedia_album', array( 'fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['album__in'] ) );
|
931 |
}
|
932 |
if ( ! empty( $albums_names ) ) {
|
933 |
+
$this->filters['filter_albums'] = array(
|
934 |
'title' => $filter_title,
|
935 |
'filter' => $albums_names,
|
936 |
+
);
|
937 |
}
|
938 |
}
|
939 |
if ( ! empty( $query_args['album__not_in'] ) ) {
|
940 |
if ( isset( $query_args['without_album'] ) ) {
|
941 |
$filter_title = __( 'Filter Album', 'grand-media' );
|
942 |
+
$albums_names = array();
|
943 |
if ( ! empty( $query_args['with_album__in'] ) ) {
|
944 |
+
$albums_names = $gmDB->get_terms( 'gmedia_album', array( 'fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['with_album__in'] ) );
|
945 |
}
|
946 |
+
$albums_names[] = __( 'Show items without album', 'grand-media' );
|
947 |
} else {
|
948 |
$filter_title = __( 'Exclude Album', 'grand-media' );
|
949 |
+
$albums_names = $gmDB->get_terms( 'gmedia_album', array( 'fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['album__not_in'] ) );
|
950 |
}
|
951 |
if ( ! empty( $albums_names ) ) {
|
952 |
+
$this->filters['exclude_albums'] = array(
|
953 |
'title' => $filter_title,
|
954 |
'filter' => $albums_names,
|
955 |
+
);
|
956 |
}
|
957 |
}
|
958 |
|
960 |
if ( ! empty( $query_args['category__in'] ) ) {
|
961 |
if ( isset( $query_args['within_category'] ) ) {
|
962 |
$filter_title = __( 'Exclude Category', 'grand-media' );
|
963 |
+
$category_names = array();
|
964 |
if ( ! empty( $query_args['with_category__not_in'] ) ) {
|
965 |
+
$category_names = $gmDB->get_terms( 'gmedia_category', array( 'fields' => 'names', 'include' => $query_args['with_category__not_in'] ) );
|
966 |
}
|
967 |
+
$category_names[] = __( 'Hide items without categories', 'grand-media' );
|
968 |
} else {
|
969 |
$filter_title = __( 'Filter Category', 'grand-media' );
|
970 |
+
$category_names = $gmDB->get_terms( 'gmedia_category', array( 'fields' => 'names', 'include' => $query_args['category__in'] ) );
|
971 |
}
|
972 |
if ( ! empty( $category_names ) ) {
|
973 |
+
$this->filters['filter_categories'] = array(
|
974 |
'title' => $filter_title,
|
975 |
'filter' => $category_names,
|
976 |
+
);
|
977 |
}
|
978 |
}
|
979 |
if ( ! empty( $query_args['category__not_in'] ) ) {
|
980 |
if ( isset( $query_args['without_category'] ) ) {
|
981 |
$filter_title = __( 'Filter Category', 'grand-media' );
|
982 |
+
$category_names = array();
|
983 |
if ( ! empty( $query_args['with_category__in'] ) ) {
|
984 |
+
$category_names = $gmDB->get_terms( 'gmedia_category', array( 'fields' => 'names', 'include' => $query_args['with_category__in'] ) );
|
985 |
}
|
986 |
+
$category_names[] = __( 'Show items without categories', 'grand-media' );
|
987 |
} else {
|
988 |
$filter_title = __( 'Exclude Category', 'grand-media' );
|
989 |
+
$category_names = $gmDB->get_terms( 'gmedia_category', array( 'fields' => 'names', 'include' => $query_args['category__not_in'] ) );
|
990 |
}
|
991 |
if ( ! empty( $category_names ) ) {
|
992 |
+
$this->filters['exclude_categories'] = array(
|
993 |
'title' => $filter_title,
|
994 |
'filter' => $category_names,
|
995 |
+
);
|
996 |
}
|
997 |
}
|
998 |
|
999 |
$gmDB->gmedias_tag_stuff( $query_args );
|
1000 |
if ( ! empty( $query_args['tag__in'] ) ) {
|
1001 |
+
$tag_names = $gmDB->get_terms( 'gmedia_tag', array( 'fields' => 'names', 'include' => $query_args['tag__in'] ) );
|
1002 |
if ( ! empty( $tag_names ) ) {
|
1003 |
+
$this->filters['filter_tags'] = array(
|
1004 |
'title' => __( 'Filter Tag', 'grand-media' ),
|
1005 |
'filter' => $tag_names,
|
1006 |
+
);
|
1007 |
}
|
1008 |
}
|
1009 |
if ( ! empty( $query_args['tag__not_in'] ) ) {
|
1010 |
+
$tag_names = $gmDB->get_terms( 'gmedia_tag', array( 'fields' => 'names', 'include' => $query_args['tag__not_in'] ) );
|
1011 |
if ( ! empty( $tag_names ) ) {
|
1012 |
+
$this->filters['exclude_tags'] = array(
|
1013 |
'title' => __( 'Exclude Tag', 'grand-media' ),
|
1014 |
'filter' => $tag_names,
|
1015 |
+
);
|
1016 |
}
|
1017 |
}
|
1018 |
|
1019 |
if ( ! empty( $args['terms_relation'] ) ) {
|
1020 |
+
$this->filters['terms_relation'] = array(
|
1021 |
'title' => __( 'Terms Relation', 'grand-media' ),
|
1022 |
+
'filter' => array( wp_strip_all_tags( $args['terms_relation'] ) ),
|
1023 |
+
);
|
1024 |
}
|
1025 |
|
1026 |
return $query_args;
|
admin/processor/class.processor.modules.php
CHANGED
@@ -5,10 +5,11 @@
|
|
5 |
*/
|
6 |
class GmediaProcessor_Modules extends GmediaProcessor {
|
7 |
private static $me = null;
|
8 |
-
|
|
|
9 |
|
10 |
public static function getMe() {
|
11 |
-
if ( self::$me
|
12 |
self::$me = new GmediaProcessor_Modules();
|
13 |
}
|
14 |
|
@@ -19,10 +20,10 @@ class GmediaProcessor_Modules extends GmediaProcessor {
|
|
19 |
global $gmDB, $gmCore, $gmGallery, $user_ID;
|
20 |
|
21 |
if ( ! $gmCore->caps['gmedia_gallery_manage'] ) {
|
22 |
-
wp_die(
|
23 |
}
|
24 |
if ( ! $gmCore->caps['gmedia_module_manage'] ) {
|
25 |
-
wp_die(
|
26 |
}
|
27 |
|
28 |
include_once GMEDIA_ABSPATH . 'admin/pages/modules/functions.php';
|
@@ -31,7 +32,7 @@ class GmediaProcessor_Modules extends GmediaProcessor {
|
|
31 |
check_admin_referer( 'GmediaGallery' );
|
32 |
|
33 |
if ( isset( $_POST['preview_bgcolor'] ) ) {
|
34 |
-
$gmGallery->options['preview_bgcolor'] = $gmCore->sanitize_hex_color( $
|
35 |
update_option( 'gmediaOptions', $gmGallery->options );
|
36 |
}
|
37 |
|
@@ -45,12 +46,12 @@ class GmediaProcessor_Modules extends GmediaProcessor {
|
|
45 |
}
|
46 |
|
47 |
if ( ( (int) $term['global'] !== $user_ID ) && ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
48 |
-
$this->error[] =
|
49 |
break;
|
50 |
}
|
51 |
|
52 |
if ( empty( $term['module'] ) ) {
|
53 |
-
$this->error[] =
|
54 |
break;
|
55 |
}
|
56 |
|
@@ -60,44 +61,46 @@ class GmediaProcessor_Modules extends GmediaProcessor {
|
|
60 |
if ( current_user_can( 'manage_options' ) && isset( $_POST['module_preset_save_global'] ) ) {
|
61 |
$term['global'] = '0';
|
62 |
}
|
63 |
-
$edit_preset
|
|
|
64 |
} else {
|
65 |
$term['name'] = trim( $term['name'] );
|
66 |
if ( empty( $term['name'] ) ) {
|
67 |
$term['name'] = current_time( 'mysql' );
|
68 |
}
|
69 |
if ( $gmCore->is_digit( $term['name'] ) ) {
|
70 |
-
$this->error[] =
|
71 |
break;
|
72 |
}
|
73 |
$term['name'] = '[' . $term['module'] . '] ' . $term['name'];
|
74 |
|
75 |
if ( $edit_preset && ! $gmDB->term_exists( $edit_preset ) ) {
|
76 |
-
$this->error[] =
|
77 |
$edit_preset = false;
|
78 |
}
|
79 |
-
|
|
|
80 |
if ( $term_id !== $edit_preset ) {
|
81 |
-
$this->error[] =
|
82 |
break;
|
83 |
}
|
84 |
}
|
85 |
}
|
86 |
|
87 |
-
|
88 |
-
$module_settings = $gmCore->_post( 'module', [] );
|
89 |
foreach ( $module_settings as &$setting ) {
|
90 |
if ( is_string( $setting ) && 7 === strlen( $setting ) && '#' === $setting[0] ) {
|
91 |
$setting = ltrim( $setting, '#' );
|
92 |
}
|
93 |
}
|
94 |
$module_path = $gmCore->get_module_path( $term['module'] );
|
95 |
-
$default_options =
|
96 |
if ( is_file( $module_path['path'] . '/settings.php' ) ) {
|
97 |
/** @noinspection PhpIncludeInspection */
|
98 |
include $module_path['path'] . '/settings.php';
|
99 |
} else {
|
100 |
-
|
|
|
101 |
break;
|
102 |
}
|
103 |
$term['description'] = $gmCore->array_replace_recursive( $default_options, $module_settings );
|
@@ -114,33 +117,37 @@ class GmediaProcessor_Modules extends GmediaProcessor {
|
|
114 |
}
|
115 |
|
116 |
if ( $edit_preset ) {
|
117 |
-
|
|
|
118 |
} else {
|
119 |
-
$location = add_query_arg(
|
120 |
set_transient( 'gmedia_new_preset_id', $term_id, 60 );
|
121 |
-
|
122 |
exit;
|
123 |
}
|
124 |
} while ( 0 );
|
125 |
}
|
126 |
-
|
|
|
127 |
$gmedia_new_preset_id = get_transient( 'gmedia_new_preset_id' );
|
128 |
if ( false !== $gmedia_new_preset_id ) {
|
129 |
gmedia_delete_transients( 'gm_cache' );
|
130 |
delete_transient( 'gmedia_new_preset_id' );
|
131 |
-
|
|
|
132 |
}
|
133 |
}
|
134 |
|
135 |
if ( isset( $_FILES['modulezip']['tmp_name'] ) ) {
|
136 |
-
if ( ! empty( $_FILES['modulezip']['tmp_name'] ) ) {
|
137 |
check_admin_referer( 'gmedia_module', '_wpnonce_module' );
|
138 |
if ( ! current_user_can( 'manage_options' ) ) {
|
139 |
-
wp_die(
|
140 |
}
|
141 |
$to_folder = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/';
|
142 |
if ( ! wp_mkdir_p( $to_folder ) ) {
|
143 |
-
|
|
|
144 |
|
145 |
return;
|
146 |
}
|
@@ -148,59 +155,65 @@ class GmediaProcessor_Modules extends GmediaProcessor {
|
|
148 |
@chmod( $to_folder, 0755 );
|
149 |
if ( ! is_writable( $to_folder ) ) {
|
150 |
//@unlink( $_FILES['modulezip']['tmp_name'] );
|
151 |
-
|
|
|
152 |
|
153 |
return;
|
154 |
}
|
155 |
}
|
156 |
-
$
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
161 |
} else {
|
162 |
global $wp_filesystem;
|
163 |
// Is a filesystem accessor setup?
|
164 |
if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) {
|
165 |
-
require_once
|
166 |
WP_Filesystem();
|
167 |
}
|
168 |
if ( ! is_object( $wp_filesystem ) ) {
|
169 |
-
$result = new WP_Error( 'fs_unavailable',
|
170 |
} elseif ( $wp_filesystem->errors->get_error_code() ) {
|
171 |
-
$result = new WP_Error( 'fs_error',
|
172 |
} else {
|
173 |
-
$maybe_folder_dir = basename( $
|
174 |
$maybe_folder_dir = sanitize_file_name( $maybe_folder_dir );
|
175 |
if ( $maybe_folder_dir && is_dir( $to_folder . $maybe_folder_dir ) ) {
|
176 |
$gmCore->delete_folder( $to_folder . $maybe_folder_dir );
|
177 |
}
|
178 |
$result = unzip_file( $to_folder . $filename, $to_folder );
|
179 |
}
|
180 |
-
// Once extracted, delete the package
|
181 |
unlink( $to_folder . $filename );
|
182 |
if ( is_wp_error( $result ) ) {
|
183 |
$this->error[] = $result->get_error_message();
|
184 |
} else {
|
185 |
-
|
|
|
186 |
}
|
187 |
}
|
188 |
gmedia_delete_transients( 'gm_cache' );
|
189 |
} else {
|
190 |
-
$this->error[] =
|
191 |
}
|
192 |
}
|
193 |
|
194 |
if ( isset( $_GET['delete_module'] ) ) {
|
195 |
if ( $gmCore->_get( '_wpnonce_module_delete' ) ) {
|
196 |
-
$mfold = preg_replace( '/[^a-z0-9_-]+/i', '_', $
|
197 |
$mpath = "{$gmCore->upload['path']}/{$gmGallery->options['folder']['module']}/{$mfold}";
|
198 |
if ( $mfold && file_exists( $mpath ) ) {
|
199 |
check_admin_referer( 'gmedia_module_delete', '_wpnonce_module_delete' );
|
200 |
$gmCore->delete_folder( $mpath );
|
201 |
-
$location = remove_query_arg(
|
202 |
-
|
203 |
-
|
|
|
204 |
}
|
205 |
} elseif ( false !== ( $message = get_transient( 'gmedia_module_deleted' ) ) ) {
|
206 |
gmedia_delete_transients( 'gm_cache' );
|
5 |
*/
|
6 |
class GmediaProcessor_Modules extends GmediaProcessor {
|
7 |
private static $me = null;
|
8 |
+
|
9 |
+
public $modules = array();
|
10 |
|
11 |
public static function getMe() {
|
12 |
+
if ( null === self::$me ) {
|
13 |
self::$me = new GmediaProcessor_Modules();
|
14 |
}
|
15 |
|
20 |
global $gmDB, $gmCore, $gmGallery, $user_ID;
|
21 |
|
22 |
if ( ! $gmCore->caps['gmedia_gallery_manage'] ) {
|
23 |
+
wp_die( esc_html__( 'You are not allowed to manage gmedia galleries', 'grand-media' ) );
|
24 |
}
|
25 |
if ( ! $gmCore->caps['gmedia_module_manage'] ) {
|
26 |
+
wp_die( esc_html__( 'You are not allowed to manage gmedia modules', 'grand-media' ) );
|
27 |
}
|
28 |
|
29 |
include_once GMEDIA_ABSPATH . 'admin/pages/modules/functions.php';
|
32 |
check_admin_referer( 'GmediaGallery' );
|
33 |
|
34 |
if ( isset( $_POST['preview_bgcolor'] ) ) {
|
35 |
+
$gmGallery->options['preview_bgcolor'] = $gmCore->sanitize_hex_color( $gmCore->_post( 'preview_bgcolor' ), 'ffffff' );
|
36 |
update_option( 'gmediaOptions', $gmGallery->options );
|
37 |
}
|
38 |
|
46 |
}
|
47 |
|
48 |
if ( ( (int) $term['global'] !== $user_ID ) && ! $gmCore->caps['gmedia_edit_others_media'] ) {
|
49 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
50 |
break;
|
51 |
}
|
52 |
|
53 |
if ( empty( $term['module'] ) ) {
|
54 |
+
$this->error[] = esc_html__( 'Something goes wrong... Choose module, please', 'grand-media' );
|
55 |
break;
|
56 |
}
|
57 |
|
61 |
if ( current_user_can( 'manage_options' ) && isset( $_POST['module_preset_save_global'] ) ) {
|
62 |
$term['global'] = '0';
|
63 |
}
|
64 |
+
$edit_preset = $gmDB->term_exists( $term['name'], $taxonomy, $term['global'] );
|
65 |
+
$term['term_id'] = $edit_preset;
|
66 |
} else {
|
67 |
$term['name'] = trim( $term['name'] );
|
68 |
if ( empty( $term['name'] ) ) {
|
69 |
$term['name'] = current_time( 'mysql' );
|
70 |
}
|
71 |
if ( $gmCore->is_digit( $term['name'] ) ) {
|
72 |
+
$this->error[] = esc_html__( "Preset name can't be only digits", 'grand-media' );
|
73 |
break;
|
74 |
}
|
75 |
$term['name'] = '[' . $term['module'] . '] ' . $term['name'];
|
76 |
|
77 |
if ( $edit_preset && ! $gmDB->term_exists( $edit_preset ) ) {
|
78 |
+
$this->error[] = esc_html__( 'A term with the id provided does not exists', 'grand-media' );
|
79 |
$edit_preset = false;
|
80 |
}
|
81 |
+
$term_id = $gmDB->term_exists( $term['name'], $taxonomy, $term['global'] );
|
82 |
+
if ( $term_id ) {
|
83 |
if ( $term_id !== $edit_preset ) {
|
84 |
+
$this->error[] = esc_html__( 'A term with the name provided already exists', 'grand-media' );
|
85 |
break;
|
86 |
}
|
87 |
}
|
88 |
}
|
89 |
|
90 |
+
$module_settings = $gmCore->_post( 'module', array() );
|
|
|
91 |
foreach ( $module_settings as &$setting ) {
|
92 |
if ( is_string( $setting ) && 7 === strlen( $setting ) && '#' === $setting[0] ) {
|
93 |
$setting = ltrim( $setting, '#' );
|
94 |
}
|
95 |
}
|
96 |
$module_path = $gmCore->get_module_path( $term['module'] );
|
97 |
+
$default_options = array();
|
98 |
if ( is_file( $module_path['path'] . '/settings.php' ) ) {
|
99 |
/** @noinspection PhpIncludeInspection */
|
100 |
include $module_path['path'] . '/settings.php';
|
101 |
} else {
|
102 |
+
// translators: module name.
|
103 |
+
$this->error[] = sprintf( esc_html__( 'Can\'t load data from `%s` module' ), esc_html( $term['module'] ) );
|
104 |
break;
|
105 |
}
|
106 |
$term['description'] = $gmCore->array_replace_recursive( $default_options, $module_settings );
|
117 |
}
|
118 |
|
119 |
if ( $edit_preset ) {
|
120 |
+
// translators: ID.
|
121 |
+
$this->msg[] = sprintf( esc_html__( 'Preset #%d successfully saved', 'grand-media' ), $term_id );
|
122 |
} else {
|
123 |
+
$location = add_query_arg( array( 'preset' => $term_id, 'message' => 'save' ), $this->url );
|
124 |
set_transient( 'gmedia_new_preset_id', $term_id, 60 );
|
125 |
+
wp_safe_redirect( $location );
|
126 |
exit;
|
127 |
}
|
128 |
} while ( 0 );
|
129 |
}
|
130 |
+
$term_id = $gmCore->_get( 'preset' );
|
131 |
+
if ( ( 'save' === $gmCore->_get( 'message' ) ) && $term_id ) {
|
132 |
$gmedia_new_preset_id = get_transient( 'gmedia_new_preset_id' );
|
133 |
if ( false !== $gmedia_new_preset_id ) {
|
134 |
gmedia_delete_transients( 'gm_cache' );
|
135 |
delete_transient( 'gmedia_new_preset_id' );
|
136 |
+
// translators: ID.
|
137 |
+
$this->msg[] = sprintf( esc_html__( 'Preset #%d successfully saved', 'grand-media' ), $term_id );
|
138 |
}
|
139 |
}
|
140 |
|
141 |
if ( isset( $_FILES['modulezip']['tmp_name'] ) ) {
|
142 |
+
if ( ! empty( $_FILES['modulezip']['tmp_name'] ) && isset( $_FILES['modulezip']['name'] ) ) {
|
143 |
check_admin_referer( 'gmedia_module', '_wpnonce_module' );
|
144 |
if ( ! current_user_can( 'manage_options' ) ) {
|
145 |
+
wp_die( esc_html__( 'You are not allowed to install module ZIP', 'grand-media' ) );
|
146 |
}
|
147 |
$to_folder = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/';
|
148 |
if ( ! wp_mkdir_p( $to_folder ) ) {
|
149 |
+
// translators: dirname.
|
150 |
+
$this->error[] = sprintf( esc_html__( 'Unable to create directory %s. Is its parent directory writable by the server?', 'grand-media' ), esc_html( $to_folder ) );
|
151 |
|
152 |
return;
|
153 |
}
|
155 |
@chmod( $to_folder, 0755 );
|
156 |
if ( ! is_writable( $to_folder ) ) {
|
157 |
//@unlink( $_FILES['modulezip']['tmp_name'] );
|
158 |
+
// translators: dirname.
|
159 |
+
$this->error[] = sprintf( esc_html__( 'Directory %s is not writable by the server.', 'grand-media' ), esc_html( $to_folder ) );
|
160 |
|
161 |
return;
|
162 |
}
|
163 |
}
|
164 |
+
$modulezip_name = sanitize_text_field( wp_unslash( $_FILES['modulezip']['name'] ) );
|
165 |
+
$modulezip_tmp_name = sanitize_text_field( wp_unslash( $_FILES['modulezip']['tmp_name'] ) );
|
166 |
+
$filename = wp_unique_filename( $to_folder, $modulezip_name );
|
167 |
+
|
168 |
+
// Move the file to the modules dir.
|
169 |
+
if ( false === @move_uploaded_file( $modulezip_tmp_name, $to_folder . $filename ) ) {
|
170 |
+
// translators: path.
|
171 |
+
$this->error[] = sprintf( esc_html__( 'The uploaded file could not be moved to %s', 'grand-media' ), esc_html( $to_folder . $filename ) );
|
172 |
} else {
|
173 |
global $wp_filesystem;
|
174 |
// Is a filesystem accessor setup?
|
175 |
if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) {
|
176 |
+
require_once ABSPATH . 'wp-admin/includes/file.php';
|
177 |
WP_Filesystem();
|
178 |
}
|
179 |
if ( ! is_object( $wp_filesystem ) ) {
|
180 |
+
$result = new WP_Error( 'fs_unavailable', esc_html__( 'Could not access filesystem.', 'grand-media' ) );
|
181 |
} elseif ( $wp_filesystem->errors->get_error_code() ) {
|
182 |
+
$result = new WP_Error( 'fs_error', esc_html__( 'Filesystem error', 'grand-media' ), $wp_filesystem->errors );
|
183 |
} else {
|
184 |
+
$maybe_folder_dir = basename( $modulezip_name, '.zip' );
|
185 |
$maybe_folder_dir = sanitize_file_name( $maybe_folder_dir );
|
186 |
if ( $maybe_folder_dir && is_dir( $to_folder . $maybe_folder_dir ) ) {
|
187 |
$gmCore->delete_folder( $to_folder . $maybe_folder_dir );
|
188 |
}
|
189 |
$result = unzip_file( $to_folder . $filename, $to_folder );
|
190 |
}
|
191 |
+
// Once extracted, delete the package.
|
192 |
unlink( $to_folder . $filename );
|
193 |
if ( is_wp_error( $result ) ) {
|
194 |
$this->error[] = $result->get_error_message();
|
195 |
} else {
|
196 |
+
// translators: filename.
|
197 |
+
$this->msg[] = sprintf( esc_html__( "The `%s` file unzipped to module's directory", 'grand-media' ), esc_html( $filename ) );
|
198 |
}
|
199 |
}
|
200 |
gmedia_delete_transients( 'gm_cache' );
|
201 |
} else {
|
202 |
+
$this->error[] = esc_html__( 'No file specified', 'grand-media' );
|
203 |
}
|
204 |
}
|
205 |
|
206 |
if ( isset( $_GET['delete_module'] ) ) {
|
207 |
if ( $gmCore->_get( '_wpnonce_module_delete' ) ) {
|
208 |
+
$mfold = preg_replace( '/[^a-z0-9_-]+/i', '_', $gmCore->_get( 'delete_module', '' ) );
|
209 |
$mpath = "{$gmCore->upload['path']}/{$gmGallery->options['folder']['module']}/{$mfold}";
|
210 |
if ( $mfold && file_exists( $mpath ) ) {
|
211 |
check_admin_referer( 'gmedia_module_delete', '_wpnonce_module_delete' );
|
212 |
$gmCore->delete_folder( $mpath );
|
213 |
+
$location = remove_query_arg( array( '_wpnonce_module_delete' ) );
|
214 |
+
// translators: path.
|
215 |
+
set_transient( 'gmedia_module_deleted', sprintf( esc_html__( 'The `%s` module folder was deleted', 'grand-media' ), esc_html( $mpath ) ), 60 );
|
216 |
+
wp_safe_redirect( $location );
|
217 |
}
|
218 |
} elseif ( false !== ( $message = get_transient( 'gmedia_module_deleted' ) ) ) {
|
219 |
gmedia_delete_transients( 'gm_cache' );
|
admin/processor/class.processor.settings.php
CHANGED
@@ -7,7 +7,7 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
7 |
private static $me = null;
|
8 |
|
9 |
public static function getMe() {
|
10 |
-
if ( self::$me
|
11 |
self::$me = new GmediaProcessor_Settings();
|
12 |
}
|
13 |
|
@@ -18,13 +18,13 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
18 |
global $gmCore, $gmGallery, $gmDB;
|
19 |
|
20 |
if ( ! $gmCore->caps['gmedia_settings'] ) {
|
21 |
-
wp_die(
|
22 |
}
|
23 |
$lk_check = isset( $_POST['license-key-activate'] );
|
24 |
if ( isset( $_POST['gmedia_settings_save'] ) ) {
|
25 |
check_admin_referer( 'gmedia_settings', '_wpnonce_settings' );
|
26 |
|
27 |
-
$set = $gmCore->_post( 'set',
|
28 |
|
29 |
if ( ! empty( $set['purchase_key'] ) && ( empty( $set['license_key'] ) || empty( $set['license_key2'] ) ) ) {
|
30 |
$lk_check = true;
|
@@ -34,7 +34,7 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
34 |
$set['purchase_key'] = '';
|
35 |
$set['license_key'] = '';
|
36 |
$set['license_key2'] = '';
|
37 |
-
$this->error[] =
|
38 |
}
|
39 |
|
40 |
$set['google_api_key'] = trim( $set['google_api_key'] );
|
@@ -60,7 +60,7 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
60 |
$gmGallery->options[ $key ] = $val;
|
61 |
}
|
62 |
|
63 |
-
$capabilities = $gmCore->_post( 'capability',
|
64 |
if ( ! empty( $capabilities ) && current_user_can( 'manage_options' ) ) {
|
65 |
global $wp_roles;
|
66 |
$_roles = $wp_roles->roles;
|
@@ -116,32 +116,31 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
116 |
}
|
117 |
|
118 |
if ( isset( $set['delete_originals'] ) && (int) $set['delete_originals'] ) {
|
119 |
-
//
|
120 |
-
//
|
121 |
-
//
|
122 |
-
//
|
123 |
-
//
|
124 |
-
//
|
125 |
-
//
|
126 |
-
//
|
127 |
$files = glob( $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_original'] . '/*', GLOB_NOSORT );
|
128 |
if ( ! empty( $files ) ) {
|
129 |
foreach ( $files as $file ) {
|
130 |
@unlink( $file );
|
131 |
}
|
132 |
}
|
133 |
-
|
134 |
}
|
135 |
|
136 |
update_option( 'gmediaOptions', $gmGallery->options );
|
137 |
if ( isset( $_POST['GmediaHashID_salt'] ) ) {
|
138 |
-
update_option( 'GmediaHashID_salt', (string) $
|
139 |
}
|
140 |
gmedia_delete_transients( 'gm_cache' );
|
141 |
if ( $flush_rewrite_rules ) {
|
142 |
flush_rewrite_rules( false );
|
143 |
}
|
144 |
-
$this->msg[] .=
|
145 |
}
|
146 |
|
147 |
if ( $lk_check ) {
|
@@ -152,43 +151,47 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
152 |
$gmedia_ua = "WordPress/{$wp_version} | ";
|
153 |
$gmedia_ua .= 'Gmedia/' . constant( 'GMEDIA_VERSION' );
|
154 |
|
155 |
-
$response = wp_remote_post(
|
156 |
-
'
|
157 |
-
|
158 |
-
'
|
159 |
-
'
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
|
|
|
|
|
|
165 |
|
166 |
if ( is_wp_error( $response ) ) {
|
167 |
$this->error[] = $response->get_error_message();
|
168 |
-
$this->error[] =
|
169 |
} else {
|
170 |
$result = json_decode( $response['body'] );
|
171 |
if ( isset( $result->error ) ) {
|
172 |
-
if ( $result && $result->error->code
|
173 |
$gmGallery->options['license_name'] = $result->content;
|
174 |
$gmGallery->options['purchase_key'] = $result->dkey;
|
175 |
$gmGallery->options['license_key'] = $result->key;
|
176 |
$gmGallery->options['license_key2'] = $result->key2;
|
177 |
-
|
|
|
178 |
} else {
|
179 |
$gmGallery->options['license_name'] = '';
|
180 |
$gmGallery->options['purchase_key'] = '';
|
181 |
$gmGallery->options['license_key'] = '';
|
182 |
$gmGallery->options['license_key2'] = '';
|
183 |
-
$this->error[] = __( 'Error', 'grand-media' ) . ': ' . $result->error->message;
|
184 |
}
|
185 |
update_option( 'gmediaOptions', $gmGallery->options );
|
186 |
} else {
|
187 |
-
$this->error[] =
|
188 |
}
|
189 |
}
|
190 |
} else {
|
191 |
-
$this->error[] =
|
192 |
}
|
193 |
}
|
194 |
|
@@ -197,12 +200,12 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
197 |
include_once GMEDIA_ABSPATH . 'config/setup.php';
|
198 |
$_temp_options = $gmGallery->options;
|
199 |
$gmGallery->options = gmedia_default_options();
|
200 |
-
// don't reset license
|
201 |
$gmGallery->options['license_name'] = $_temp_options['license_name'];
|
202 |
$gmGallery->options['purchase_key'] = $_temp_options['purchase_key'];
|
203 |
$gmGallery->options['license_key'] = $_temp_options['license_key'];
|
204 |
$gmGallery->options['license_key2'] = $_temp_options['license_key2'];
|
205 |
-
// don't reset mobile app
|
206 |
$gmGallery->options['site_ID'] = $_temp_options['site_ID'];
|
207 |
$gmGallery->options['mobile_app'] = (int) $_temp_options['mobile_app'];
|
208 |
if ( $gmGallery->options['mobile_app'] && isset( $_temp_options['gmedia_service'] ) ) {
|
@@ -220,7 +223,7 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
220 |
}
|
221 |
}
|
222 |
gmedia_delete_transients( 'gm_cache' );
|
223 |
-
$this->msg[] .=
|
224 |
}
|
225 |
|
226 |
}
|
7 |
private static $me = null;
|
8 |
|
9 |
public static function getMe() {
|
10 |
+
if ( null === self::$me ) {
|
11 |
self::$me = new GmediaProcessor_Settings();
|
12 |
}
|
13 |
|
18 |
global $gmCore, $gmGallery, $gmDB;
|
19 |
|
20 |
if ( ! $gmCore->caps['gmedia_settings'] ) {
|
21 |
+
wp_die( esc_html__( 'You are not allowed to change gmedia settings', 'grand-media' ) );
|
22 |
}
|
23 |
$lk_check = isset( $_POST['license-key-activate'] );
|
24 |
if ( isset( $_POST['gmedia_settings_save'] ) ) {
|
25 |
check_admin_referer( 'gmedia_settings', '_wpnonce_settings' );
|
26 |
|
27 |
+
$set = $gmCore->_post( 'set', array() );
|
28 |
|
29 |
if ( ! empty( $set['purchase_key'] ) && ( empty( $set['license_key'] ) || empty( $set['license_key2'] ) ) ) {
|
30 |
$lk_check = true;
|
34 |
$set['purchase_key'] = '';
|
35 |
$set['license_key'] = '';
|
36 |
$set['license_key2'] = '';
|
37 |
+
$this->error[] = esc_html__( 'License Key empty...', 'grand-media' );
|
38 |
}
|
39 |
|
40 |
$set['google_api_key'] = trim( $set['google_api_key'] );
|
60 |
$gmGallery->options[ $key ] = $val;
|
61 |
}
|
62 |
|
63 |
+
$capabilities = $gmCore->_post( 'capability', array() );
|
64 |
if ( ! empty( $capabilities ) && current_user_can( 'manage_options' ) ) {
|
65 |
global $wp_roles;
|
66 |
$_roles = $wp_roles->roles;
|
116 |
}
|
117 |
|
118 |
if ( isset( $set['delete_originals'] ) && (int) $set['delete_originals'] ) {
|
119 |
+
//if (($handle = opendir($gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_original']))) {
|
120 |
+
// while (false !== ($file = readdir($handle))) {
|
121 |
+
// // do something with the file
|
122 |
+
// // note that '.' and '..' is returned even
|
123 |
+
// @unlink($file);
|
124 |
+
// }
|
125 |
+
// closedir($handle);
|
126 |
+
//}
|
127 |
$files = glob( $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_original'] . '/*', GLOB_NOSORT );
|
128 |
if ( ! empty( $files ) ) {
|
129 |
foreach ( $files as $file ) {
|
130 |
@unlink( $file );
|
131 |
}
|
132 |
}
|
|
|
133 |
}
|
134 |
|
135 |
update_option( 'gmediaOptions', $gmGallery->options );
|
136 |
if ( isset( $_POST['GmediaHashID_salt'] ) ) {
|
137 |
+
update_option( 'GmediaHashID_salt', (string) $gmCore->_post( 'GmediaHashID_salt', '' ) );
|
138 |
}
|
139 |
gmedia_delete_transients( 'gm_cache' );
|
140 |
if ( $flush_rewrite_rules ) {
|
141 |
flush_rewrite_rules( false );
|
142 |
}
|
143 |
+
$this->msg[] .= esc_html__( 'Settings saved', 'grand-media' );
|
144 |
}
|
145 |
|
146 |
if ( $lk_check ) {
|
151 |
$gmedia_ua = "WordPress/{$wp_version} | ";
|
152 |
$gmedia_ua .= 'Gmedia/' . constant( 'GMEDIA_VERSION' );
|
153 |
|
154 |
+
$response = wp_remote_post(
|
155 |
+
'https://codeasily.com/rest/gmedia-key.php',
|
156 |
+
array(
|
157 |
+
'body' => array( 'key' => $license_key['purchase_key'], 'site' => site_url() ),
|
158 |
+
'headers' => array(
|
159 |
+
'Content-Type' => 'application/x-www-form-urlencoded; ' . 'charset=' . get_option( 'blog_charset' ),
|
160 |
+
'Host' => 'codeasily.com',
|
161 |
+
'User-Agent' => $gmedia_ua,
|
162 |
+
),
|
163 |
+
'httpversion' => '1.0',
|
164 |
+
'timeout' => 45,
|
165 |
+
)
|
166 |
+
);
|
167 |
|
168 |
if ( is_wp_error( $response ) ) {
|
169 |
$this->error[] = $response->get_error_message();
|
170 |
+
$this->error[] = esc_html__( 'Use Help Screen (top right button) for more info', 'grand-media' );
|
171 |
} else {
|
172 |
$result = json_decode( $response['body'] );
|
173 |
if ( isset( $result->error ) ) {
|
174 |
+
if ( $result && 200 === $result->error->code ) {
|
175 |
$gmGallery->options['license_name'] = $result->content;
|
176 |
$gmGallery->options['purchase_key'] = $result->dkey;
|
177 |
$gmGallery->options['license_key'] = $result->key;
|
178 |
$gmGallery->options['license_key2'] = $result->key2;
|
179 |
+
// translators: link tag.
|
180 |
+
$this->msg[] = sprintf( esc_html__( 'License Key activated successfully. You can see all activated websites with this key on your account page %s', 'grand-media' ), '<a href="https://codeasily.com/my-account/" target="_blank">https://codeasily.com/my-account/</a>' );
|
181 |
} else {
|
182 |
$gmGallery->options['license_name'] = '';
|
183 |
$gmGallery->options['purchase_key'] = '';
|
184 |
$gmGallery->options['license_key'] = '';
|
185 |
$gmGallery->options['license_key2'] = '';
|
186 |
+
$this->error[] = esc_html( __( 'Error', 'grand-media' ) . ': ' . $result->error->message );
|
187 |
}
|
188 |
update_option( 'gmediaOptions', $gmGallery->options );
|
189 |
} else {
|
190 |
+
$this->error[] = esc_html__( 'Something went wrong.. Try again later or use Help Screen (top right button) for more info', 'grand-media' );
|
191 |
}
|
192 |
}
|
193 |
} else {
|
194 |
+
$this->error[] = esc_html__( 'Empty License Key', 'grand-media' );
|
195 |
}
|
196 |
}
|
197 |
|
200 |
include_once GMEDIA_ABSPATH . 'config/setup.php';
|
201 |
$_temp_options = $gmGallery->options;
|
202 |
$gmGallery->options = gmedia_default_options();
|
203 |
+
// don't reset license.
|
204 |
$gmGallery->options['license_name'] = $_temp_options['license_name'];
|
205 |
$gmGallery->options['purchase_key'] = $_temp_options['purchase_key'];
|
206 |
$gmGallery->options['license_key'] = $_temp_options['license_key'];
|
207 |
$gmGallery->options['license_key2'] = $_temp_options['license_key2'];
|
208 |
+
// don't reset mobile app.
|
209 |
$gmGallery->options['site_ID'] = $_temp_options['site_ID'];
|
210 |
$gmGallery->options['mobile_app'] = (int) $_temp_options['mobile_app'];
|
211 |
if ( $gmGallery->options['mobile_app'] && isset( $_temp_options['gmedia_service'] ) ) {
|
223 |
}
|
224 |
}
|
225 |
gmedia_delete_transients( 'gm_cache' );
|
226 |
+
$this->msg[] .= esc_html__( 'All settings set to default', 'grand-media' );
|
227 |
}
|
228 |
|
229 |
}
|
admin/processor/class.processor.terms.php
CHANGED
@@ -6,9 +6,11 @@
|
|
6 |
class GmediaProcessor_Terms extends GmediaProcessor {
|
7 |
|
8 |
public static $cookie_key = false;
|
|
|
9 |
private static $me = null;
|
10 |
-
|
11 |
-
public $
|
|
|
12 |
|
13 |
/**
|
14 |
* GmediaProcessor_Library constructor.
|
@@ -29,7 +31,7 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
29 |
}
|
30 |
|
31 |
public static function getMe() {
|
32 |
-
if ( self::$me
|
33 |
self::$me = new GmediaProcessor_Terms();
|
34 |
}
|
35 |
|
@@ -40,10 +42,10 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
40 |
global $user_ID, $gmCore, $gmDB;
|
41 |
|
42 |
if ( ! $gmCore->caps['gmedia_library'] ) {
|
43 |
-
wp_die(
|
44 |
}
|
45 |
|
46 |
-
include_once
|
47 |
|
48 |
$this->query_args = $this->query_args();
|
49 |
|
@@ -81,33 +83,33 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
81 |
break;
|
82 |
}
|
83 |
$term = $gmCore->_post( 'term' );
|
84 |
-
|
85 |
-
|
|
|
86 |
}
|
87 |
$term['name'] = trim( $term['name'] );
|
88 |
if ( empty( $term['name'] ) ) {
|
89 |
-
$this->error[] =
|
90 |
break;
|
91 |
}
|
92 |
if ( $gmCore->is_digit( $term['name'] ) ) {
|
93 |
-
$this->error[] =
|
94 |
break;
|
95 |
}
|
96 |
$taxonomy = 'gmedia_album';
|
97 |
if ( $edit_term && ! $gmDB->term_exists( $edit_term ) ) {
|
98 |
-
$this->error[] =
|
99 |
$edit_term = false;
|
100 |
}
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
}
|
106 |
}
|
107 |
if ( $edit_term ) {
|
108 |
$_term = $gmDB->get_term( $edit_term );
|
109 |
if ( ( (int) $_term->global !== (int) $user_ID ) && ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
110 |
-
$this->error[] =
|
111 |
break;
|
112 |
}
|
113 |
$term_id = $gmDB->update_term( $edit_term, $term );
|
@@ -122,7 +124,8 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
122 |
$gmDB->update_term_sortorder( $term_id );
|
123 |
}
|
124 |
|
125 |
-
|
|
|
126 |
|
127 |
} while ( 0 );
|
128 |
} elseif ( isset( $_POST['gmedia_category_save'] ) ) {
|
@@ -134,32 +137,32 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
134 |
break;
|
135 |
}
|
136 |
$term = $gmCore->_post( 'term' );
|
137 |
-
|
138 |
-
|
|
|
139 |
}
|
140 |
$term['name'] = trim( $term['name'] );
|
141 |
if ( empty( $term['name'] ) ) {
|
142 |
-
$this->error[] =
|
143 |
break;
|
144 |
}
|
145 |
if ( $gmCore->is_digit( $term['name'] ) ) {
|
146 |
-
$this->error[] =
|
147 |
break;
|
148 |
}
|
149 |
$taxonomy = 'gmedia_category';
|
150 |
if ( $edit_term && ! $gmDB->term_exists( $edit_term ) ) {
|
151 |
-
$this->error[] =
|
152 |
$edit_term = false;
|
153 |
}
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
}
|
159 |
}
|
160 |
if ( $edit_term ) {
|
161 |
if ( ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
162 |
-
$this->error[] =
|
163 |
break;
|
164 |
}
|
165 |
$term_id = $gmDB->update_term( $edit_term, $term );
|
@@ -171,7 +174,8 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
171 |
break;
|
172 |
}
|
173 |
|
174 |
-
|
|
|
175 |
|
176 |
} while ( 0 );
|
177 |
} elseif ( isset( $_POST['gmedia_tag_add'] ) ) {
|
@@ -183,7 +187,7 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
183 |
$terms_qty = count( $terms );
|
184 |
foreach ( $terms as $term_name ) {
|
185 |
if ( $gmCore->is_digit( $term_name ) ) {
|
186 |
-
$this->error['tag_name_digit'] =
|
187 |
continue;
|
188 |
}
|
189 |
|
@@ -192,14 +196,15 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
192 |
if ( is_wp_error( $term_id ) ) {
|
193 |
$this->error[] = $term_id->get_error_message();
|
194 |
} else {
|
195 |
-
|
|
|
196 |
}
|
197 |
} else {
|
198 |
-
$this->error['tag_add'] =
|
199 |
}
|
200 |
}
|
201 |
} else {
|
202 |
-
$this->error[] =
|
203 |
}
|
204 |
}
|
205 |
|
@@ -210,16 +215,17 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
210 |
$ids = $gmCore->_get( 'ids', 'selected' );
|
211 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items : wp_parse_id_list( $ids );
|
212 |
if ( ! $gmCore->caps['gmedia_delete_others_media'] ) {
|
213 |
-
$_selected_items =
|
214 |
if ( 'gmedia_album' === $taxonomy ) {
|
215 |
-
$_selected_items = $gmDB->get_terms( $taxonomy,
|
216 |
}
|
217 |
if ( count( $_selected_items ) < count( $selected_items ) ) {
|
218 |
$this->error[] = __( 'You are not allowed to delete others media', 'grand-media' );
|
219 |
}
|
220 |
$selected_items = $_selected_items;
|
221 |
}
|
222 |
-
|
|
|
223 |
foreach ( $selected_items as $item ) {
|
224 |
$delete = $gmDB->delete_term( $item );
|
225 |
if ( ! $delete ) {
|
@@ -230,14 +236,15 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
230 |
}
|
231 |
}
|
232 |
if ( $count ) {
|
233 |
-
|
|
|
234 |
}
|
235 |
setcookie( self::$cookie_key, '', time() - 3600 );
|
236 |
unset( $_COOKIE[ self::$cookie_key ] );
|
237 |
-
$this->selected_items =
|
238 |
}
|
239 |
} else {
|
240 |
-
$this->error[] =
|
241 |
}
|
242 |
if ( ! empty( $this->msg ) ) {
|
243 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
@@ -247,16 +254,16 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
247 |
}
|
248 |
}
|
249 |
if ( $do_gmedia_terms ) {
|
250 |
-
$_wpnonce =
|
251 |
foreach ( $_GET as $key => $value ) {
|
252 |
if ( strpos( $key, '_wpnonce' ) !== false ) {
|
253 |
$_wpnonce[ $key ] = $value;
|
254 |
}
|
255 |
}
|
256 |
-
$remove_args = array_merge(
|
257 |
$location = remove_query_arg( $remove_args );
|
258 |
$location = add_query_arg( 'did_gmedia_terms', $do_gmedia_terms, $location );
|
259 |
-
|
260 |
exit;
|
261 |
}
|
262 |
if ( $gmCore->_get( 'did_gmedia_terms' ) ) {
|
6 |
class GmediaProcessor_Terms extends GmediaProcessor {
|
7 |
|
8 |
public static $cookie_key = false;
|
9 |
+
|
10 |
private static $me = null;
|
11 |
+
|
12 |
+
public $selected_items = array();
|
13 |
+
public $query_args = array();
|
14 |
|
15 |
/**
|
16 |
* GmediaProcessor_Library constructor.
|
31 |
}
|
32 |
|
33 |
public static function getMe() {
|
34 |
+
if ( null === self::$me ) {
|
35 |
self::$me = new GmediaProcessor_Terms();
|
36 |
}
|
37 |
|
42 |
global $user_ID, $gmCore, $gmDB;
|
43 |
|
44 |
if ( ! $gmCore->caps['gmedia_library'] ) {
|
45 |
+
wp_die( esc_html__( 'You are not allowed to be here', 'grand-media' ) );
|
46 |
}
|
47 |
|
48 |
+
include_once GMEDIA_ABSPATH . 'admin/pages/terms/functions.php';
|
49 |
|
50 |
$this->query_args = $this->query_args();
|
51 |
|
83 |
break;
|
84 |
}
|
85 |
$term = $gmCore->_post( 'term' );
|
86 |
+
$meta = $gmCore->_post( 'meta' );
|
87 |
+
if ( $meta ) {
|
88 |
+
$term = array_merge_recursive( array( 'meta' => $meta ), $term );
|
89 |
}
|
90 |
$term['name'] = trim( $term['name'] );
|
91 |
if ( empty( $term['name'] ) ) {
|
92 |
+
$this->error[] = esc_html__( 'Term Name is not specified', 'grand-media' );
|
93 |
break;
|
94 |
}
|
95 |
if ( $gmCore->is_digit( $term['name'] ) ) {
|
96 |
+
$this->error[] = esc_html__( "Term Name can't be only digits", 'grand-media' );
|
97 |
break;
|
98 |
}
|
99 |
$taxonomy = 'gmedia_album';
|
100 |
if ( $edit_term && ! $gmDB->term_exists( $edit_term ) ) {
|
101 |
+
$this->error[] = esc_html__( 'A term with the id provided does not exists', 'grand-media' );
|
102 |
$edit_term = false;
|
103 |
}
|
104 |
+
$term_id = $gmDB->term_exists( $term['name'], $taxonomy, $term['global'] );
|
105 |
+
if ( $term_id && $term_id !== $edit_term ) {
|
106 |
+
$this->error[] = esc_html__( 'A term with the name provided already exists', 'grand-media' );
|
107 |
+
break;
|
|
|
108 |
}
|
109 |
if ( $edit_term ) {
|
110 |
$_term = $gmDB->get_term( $edit_term );
|
111 |
if ( ( (int) $_term->global !== (int) $user_ID ) && ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
112 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
113 |
break;
|
114 |
}
|
115 |
$term_id = $gmDB->update_term( $edit_term, $term );
|
124 |
$gmDB->update_term_sortorder( $term_id );
|
125 |
}
|
126 |
|
127 |
+
// translators: album name.
|
128 |
+
$this->msg[] = sprintf( esc_html__( 'Album `%s` successfully saved', 'grand-media' ), esc_html( $term['name'] ) );
|
129 |
|
130 |
} while ( 0 );
|
131 |
} elseif ( isset( $_POST['gmedia_category_save'] ) ) {
|
137 |
break;
|
138 |
}
|
139 |
$term = $gmCore->_post( 'term' );
|
140 |
+
$meta = $gmCore->_post( 'meta' );
|
141 |
+
if ( $meta ) {
|
142 |
+
$term = array_merge_recursive( array( 'meta' => $meta ), $term );
|
143 |
}
|
144 |
$term['name'] = trim( $term['name'] );
|
145 |
if ( empty( $term['name'] ) ) {
|
146 |
+
$this->error[] = esc_html__( 'Term Name is not specified', 'grand-media' );
|
147 |
break;
|
148 |
}
|
149 |
if ( $gmCore->is_digit( $term['name'] ) ) {
|
150 |
+
$this->error[] = esc_html__( "Term Name can't be only digits", 'grand-media' );
|
151 |
break;
|
152 |
}
|
153 |
$taxonomy = 'gmedia_category';
|
154 |
if ( $edit_term && ! $gmDB->term_exists( $edit_term ) ) {
|
155 |
+
$this->error[] = esc_html__( 'A term with the id provided does not exists', 'grand-media' );
|
156 |
$edit_term = false;
|
157 |
}
|
158 |
+
$term_id = $gmDB->term_exists( $term['name'], $taxonomy );
|
159 |
+
if ( $term_id && $term_id !== $edit_term ) {
|
160 |
+
$this->error[] = esc_html__( 'A term with the name provided already exists', 'grand-media' );
|
161 |
+
break;
|
|
|
162 |
}
|
163 |
if ( $edit_term ) {
|
164 |
if ( ! current_user_can( 'gmedia_edit_others_media' ) ) {
|
165 |
+
$this->error[] = esc_html__( 'You are not allowed to edit others media', 'grand-media' );
|
166 |
break;
|
167 |
}
|
168 |
$term_id = $gmDB->update_term( $edit_term, $term );
|
174 |
break;
|
175 |
}
|
176 |
|
177 |
+
// translators: category name.
|
178 |
+
$this->msg[] = sprintf( esc_html__( 'Category `%s` successfully saved', 'grand-media' ), esc_html( $term['name'] ) );
|
179 |
|
180 |
} while ( 0 );
|
181 |
} elseif ( isset( $_POST['gmedia_tag_add'] ) ) {
|
187 |
$terms_qty = count( $terms );
|
188 |
foreach ( $terms as $term_name ) {
|
189 |
if ( $gmCore->is_digit( $term_name ) ) {
|
190 |
+
$this->error['tag_name_digit'] = esc_html__( "Term Name can't be only digits", 'grand-media' );
|
191 |
continue;
|
192 |
}
|
193 |
|
196 |
if ( is_wp_error( $term_id ) ) {
|
197 |
$this->error[] = $term_id->get_error_message();
|
198 |
} else {
|
199 |
+
// translators: 1 - number, 2 - number.
|
200 |
+
$this->msg['tag_add'] = sprintf( esc_html__( '%1$d of %2$d tags successfully added', 'grand-media' ), ++ $terms_added, $terms_qty );
|
201 |
}
|
202 |
} else {
|
203 |
+
$this->error['tag_add'] = esc_html__( 'Some of provided tags are already exists', 'grand-media' );
|
204 |
}
|
205 |
}
|
206 |
} else {
|
207 |
+
$this->error[] = esc_html__( 'You are not allowed to manage tags', 'grand-media' );
|
208 |
}
|
209 |
}
|
210 |
|
215 |
$ids = $gmCore->_get( 'ids', 'selected' );
|
216 |
$selected_items = ( 'selected' === $ids ) ? $this->selected_items : wp_parse_id_list( $ids );
|
217 |
if ( ! $gmCore->caps['gmedia_delete_others_media'] ) {
|
218 |
+
$_selected_items = array();
|
219 |
if ( 'gmedia_album' === $taxonomy ) {
|
220 |
+
$_selected_items = $gmDB->get_terms( $taxonomy, array( 'fields' => 'ids', 'global' => $user_ID, 'include' => $selected_items ) );
|
221 |
}
|
222 |
if ( count( $_selected_items ) < count( $selected_items ) ) {
|
223 |
$this->error[] = __( 'You are not allowed to delete others media', 'grand-media' );
|
224 |
}
|
225 |
$selected_items = $_selected_items;
|
226 |
}
|
227 |
+
$count = count( $selected_items );
|
228 |
+
if ( $count ) {
|
229 |
foreach ( $selected_items as $item ) {
|
230 |
$delete = $gmDB->delete_term( $item );
|
231 |
if ( ! $delete ) {
|
236 |
}
|
237 |
}
|
238 |
if ( $count ) {
|
239 |
+
// translators: number.
|
240 |
+
$this->msg[] = sprintf( esc_html__( '%d item(s) deleted successfully', 'grand-media' ), $count );
|
241 |
}
|
242 |
setcookie( self::$cookie_key, '', time() - 3600 );
|
243 |
unset( $_COOKIE[ self::$cookie_key ] );
|
244 |
+
$this->selected_items = array();
|
245 |
}
|
246 |
} else {
|
247 |
+
$this->error[] = esc_html__( 'You are not allowed to delete terms', 'grand-media' );
|
248 |
}
|
249 |
if ( ! empty( $this->msg ) ) {
|
250 |
set_transient( 'gmedia_action_msg', $this->msg, 30 );
|
254 |
}
|
255 |
}
|
256 |
if ( $do_gmedia_terms ) {
|
257 |
+
$_wpnonce = array();
|
258 |
foreach ( $_GET as $key => $value ) {
|
259 |
if ( strpos( $key, '_wpnonce' ) !== false ) {
|
260 |
$_wpnonce[ $key ] = $value;
|
261 |
}
|
262 |
}
|
263 |
+
$remove_args = array_merge( array( 'do_gmedia_terms', 'ids' ), $_wpnonce );
|
264 |
$location = remove_query_arg( $remove_args );
|
265 |
$location = add_query_arg( 'did_gmedia_terms', $do_gmedia_terms, $location );
|
266 |
+
wp_safe_redirect( $location );
|
267 |
exit;
|
268 |
}
|
269 |
if ( $gmCore->_get( 'did_gmedia_terms' ) ) {
|
admin/processor/class.processor.wpmedia.php
CHANGED
@@ -6,8 +6,10 @@
|
|
6 |
class GmediaProcessor_WordpressLibrary extends GmediaProcessor {
|
7 |
|
8 |
public static $cookie_key = false;
|
|
|
|
|
|
|
9 |
private static $me = null;
|
10 |
-
public $selected_items = [];
|
11 |
|
12 |
/**
|
13 |
* GmediaProcessor_Library constructor.
|
@@ -15,13 +17,13 @@ class GmediaProcessor_WordpressLibrary extends GmediaProcessor {
|
|
15 |
public function __construct() {
|
16 |
parent::__construct();
|
17 |
|
18 |
-
self::$cookie_key =
|
19 |
$this->selected_items = parent::selected_items( self::$cookie_key );
|
20 |
|
21 |
}
|
22 |
|
23 |
public static function getMe() {
|
24 |
-
if ( self::$me
|
25 |
self::$me = new GmediaProcessor_WordpressLibrary();
|
26 |
}
|
27 |
|
@@ -32,7 +34,7 @@ class GmediaProcessor_WordpressLibrary extends GmediaProcessor {
|
|
32 |
global $gmCore;
|
33 |
|
34 |
if ( ! $gmCore->caps['gmedia_import'] ) {
|
35 |
-
wp_die(
|
36 |
}
|
37 |
|
38 |
}
|
6 |
class GmediaProcessor_WordpressLibrary extends GmediaProcessor {
|
7 |
|
8 |
public static $cookie_key = false;
|
9 |
+
|
10 |
+
public $selected_items = array();
|
11 |
+
|
12 |
private static $me = null;
|
|
|
13 |
|
14 |
/**
|
15 |
* GmediaProcessor_Library constructor.
|
17 |
public function __construct() {
|
18 |
parent::__construct();
|
19 |
|
20 |
+
self::$cookie_key = 'gmedia_library:wpmedia';
|
21 |
$this->selected_items = parent::selected_items( self::$cookie_key );
|
22 |
|
23 |
}
|
24 |
|
25 |
public static function getMe() {
|
26 |
+
if ( null === self::$me ) {
|
27 |
self::$me = new GmediaProcessor_WordpressLibrary();
|
28 |
}
|
29 |
|
34 |
global $gmCore;
|
35 |
|
36 |
if ( ! $gmCore->caps['gmedia_import'] ) {
|
37 |
+
wp_die( esc_html__( 'You are not allowed to import media in Gmedia Library', 'grand-media' ) );
|
38 |
}
|
39 |
|
40 |
}
|
admin/support.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'You are not allowed to call this page directly.' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* gmediaSupport()
|
@@ -28,13 +26,13 @@ function gmediaSupport() {
|
|
28 |
$ftp_password = trim( $gmCore->_post( 'ftp_password', '' ) );
|
29 |
|
30 |
if ( $subject && $name && $email && is_email( $email ) && $summary && $message ) {
|
31 |
-
$subjects =
|
32 |
'billing_issue' => 'Billing Issue',
|
33 |
'feature_request' => 'Feature Request',
|
34 |
'customization' => 'Customization',
|
35 |
'pre_sale_question' => 'Pre-Sale Question',
|
36 |
'bug' => 'Bug',
|
37 |
-
|
38 |
$title = $subjects[ $subject ];
|
39 |
$content = "{$summary}\r\n\r\n";
|
40 |
$content .= "Email: {$name} <{$email}>\r\n\r\n";
|
@@ -51,7 +49,7 @@ function gmediaSupport() {
|
|
51 |
$section = '';
|
52 |
}
|
53 |
if ( $wp_admin_user && $wp_admin_password ) {
|
54 |
-
$section .=
|
55 |
$section .= "WP User: {$wp_admin_user}\r\n";
|
56 |
$section .= "WP Pass: {$wp_admin_password}\r\n";
|
57 |
}
|
@@ -73,29 +71,29 @@ function gmediaSupport() {
|
|
73 |
$content .= "License: {$license}\r\n";
|
74 |
|
75 |
$content .= "Message: \r\n{$message}\r\n\r\n";
|
76 |
-
$headers =
|
77 |
-
|
78 |
"Reply-To: {$name} <{$email}>",
|
79 |
-
|
80 |
if ( wp_mail( 'gmediafolder@gmail.com', $title, $content, $headers ) ) {
|
81 |
-
$alert = $gmCore->alert( 'success',
|
82 |
$subject = $name = $email = $summary = $message = $domain = $link = $wp_admin_user = $wp_admin_password = $ftp_host = $ftp_user = $ftp_password = '';
|
83 |
} else {
|
84 |
-
$alert = $gmCore->alert( 'danger',
|
85 |
}
|
86 |
} elseif ( ! empty( $_POST ) ) {
|
87 |
-
$alert = $gmCore->alert( 'danger',
|
88 |
}
|
89 |
|
90 |
?>
|
91 |
-
<div class="
|
92 |
-
<div class="
|
93 |
-
<form method="post" class="
|
94 |
-
<?php if ( current_user_can( 'manage_options' ) ){ ?>
|
95 |
<div class="container-fluid">
|
96 |
<div class="form-header clearfix">
|
97 |
<div class="alignleft">
|
98 |
-
<img src="<?php echo esc_url( plugins_url( '
|
99 |
</div>
|
100 |
<div class="form-header-body">
|
101 |
<h1 class="form-title">Have questions? We're happy to help!</h1>
|
@@ -109,102 +107,113 @@ function gmediaSupport() {
|
|
109 |
<div>
|
110 |
<fieldset>
|
111 |
<div class="form-group has-feedback">
|
112 |
-
<label class="control-label"><?php
|
113 |
<input type="text" name="name" class="form-control" value="<?php echo esc_attr( $name ? $name : $current_user->display_name ); ?>" required>
|
114 |
-
<span class="
|
115 |
</div>
|
116 |
<div class="form-group has-feedback">
|
117 |
-
<label class="control-label"><?php
|
118 |
<input type="email" name="email" class="form-control" value="<?php echo esc_attr( $email ? $email : $current_user->user_email ); ?>" required>
|
119 |
-
<span class="
|
120 |
</div>
|
121 |
<div class="form-group hidden">
|
122 |
-
<label class="control-label"><?php
|
123 |
<select id="context_plugin" class="form-control">
|
124 |
<option>GmediaGallery</option>
|
125 |
</select>
|
126 |
</div>
|
127 |
<div class="form-group form-subjects">
|
128 |
-
<label class="control-label"><?php
|
129 |
<div class="well well-sm" style="background-color: #fff;">
|
130 |
-
<div class="radio"
|
131 |
-
|
132 |
-
|
133 |
-
<div class="radio"
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
</div>
|
136 |
</div>
|
137 |
</fieldset>
|
138 |
<div class="dynamic">
|
139 |
<fieldset class="message">
|
140 |
<div class="form-group has-feedback">
|
141 |
-
<label class="control-label"><?php
|
142 |
<input type="text" name="summary" class="form-control" value="<?php echo esc_attr( $summary ); ?>" required>
|
143 |
-
<span class="
|
144 |
</div>
|
145 |
<div class="form-group has-feedback">
|
146 |
-
<label class="control-label"><span id="msglabel"><?php
|
147 |
-
<textarea name="message" cols="44" rows="10" class="form-control" required><?php echo $message ?></textarea>
|
148 |
-
<span class="
|
149 |
</div>
|
150 |
</fieldset>
|
151 |
<fieldset class="site">
|
152 |
<div class="form-group has-feedback">
|
153 |
-
<label class="control-label"><?php
|
154 |
<input type="text" name="domain" class="form-control" value="<?php echo esc_attr( $domain ? $domain : home_url() ); ?>">
|
155 |
-
<span class="
|
156 |
</div>
|
157 |
<div class="form-group has-feedback">
|
158 |
-
<label class="control-label"><?php
|
159 |
-
|
160 |
-
<
|
|
|
161 |
</div>
|
162 |
</fieldset>
|
163 |
<fieldset class="credentials">
|
164 |
-
<h4 class="title" data-toggle="collapse" href="#wpLogin"><span><?php
|
165 |
-
<small class="
|
166 |
</h4>
|
167 |
<div id="wpLogin" class="collapse">
|
168 |
<div class="form-group has-feedback">
|
169 |
-
<label class="control-label"><?php
|
170 |
<input type="text" name="wp_admin_user" class="form-control" value="<?php echo esc_attr( $wp_admin_user ); ?>">
|
171 |
-
<span class="
|
172 |
</div>
|
173 |
<div class="form-group has-feedback">
|
174 |
-
<label class="control-label"><?php
|
175 |
<input type="password" name="wp_admin_password" class="form-control" value="<?php echo esc_attr( $wp_admin_password ); ?>">
|
176 |
-
<span class="
|
177 |
</div>
|
178 |
-
<p><?php
|
179 |
</div>
|
180 |
</fieldset>
|
181 |
<fieldset class="credentials">
|
182 |
-
<h4 class="title" data-toggle="collapse" href="#ftpAccess"><span><?php
|
183 |
-
<small class="
|
184 |
</h4>
|
185 |
<div id="ftpAccess" class="collapse">
|
186 |
<div class="form-group has-feedback">
|
187 |
-
<label class="control-label"><?php
|
188 |
<input type="text" name="ftp_host" class="form-control" value="<?php echo esc_attr( $ftp_host ); ?>">
|
189 |
-
<span class="
|
190 |
</div>
|
191 |
<div class="form-group has-feedback">
|
192 |
-
<label class="control-label"><?php
|
193 |
<input type="text" name="ftp_user" class="form-control" value="<?php echo esc_attr( $ftp_user ); ?>">
|
194 |
-
<span class="
|
195 |
</div>
|
196 |
<div class="form-group has-feedback">
|
197 |
-
<label class="control-label"><?php
|
198 |
<input type="password" name="ftp_password" class="form-control" value="<?php echo esc_attr( $ftp_password ); ?>">
|
199 |
-
<span class="
|
200 |
</div>
|
201 |
-
<p><?php
|
202 |
</div>
|
203 |
</fieldset>
|
204 |
</div>
|
205 |
</div>
|
206 |
<footer style="margin-top: 20px;">
|
207 |
-
<button class="btn btn-lg btn-primary"><?php
|
208 |
</footer>
|
209 |
</section>
|
210 |
</div>
|
@@ -221,26 +230,63 @@ function gmediaSupport() {
|
|
221 |
</div>
|
222 |
</div>
|
223 |
<style>
|
224 |
-
#gm_support .form-header {
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
#gm_support
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
</style>
|
234 |
<script>
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
</script>
|
245 |
|
246 |
</div>
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* gmediaSupport()
|
26 |
$ftp_password = trim( $gmCore->_post( 'ftp_password', '' ) );
|
27 |
|
28 |
if ( $subject && $name && $email && is_email( $email ) && $summary && $message ) {
|
29 |
+
$subjects = array(
|
30 |
'billing_issue' => 'Billing Issue',
|
31 |
'feature_request' => 'Feature Request',
|
32 |
'customization' => 'Customization',
|
33 |
'pre_sale_question' => 'Pre-Sale Question',
|
34 |
'bug' => 'Bug',
|
35 |
+
);
|
36 |
$title = $subjects[ $subject ];
|
37 |
$content = "{$summary}\r\n\r\n";
|
38 |
$content .= "Email: {$name} <{$email}>\r\n\r\n";
|
49 |
$section = '';
|
50 |
}
|
51 |
if ( $wp_admin_user && $wp_admin_password ) {
|
52 |
+
$section .= 'WP URI: ' . wp_login_url() . "\r\n";
|
53 |
$section .= "WP User: {$wp_admin_user}\r\n";
|
54 |
$section .= "WP Pass: {$wp_admin_password}\r\n";
|
55 |
}
|
71 |
$content .= "License: {$license}\r\n";
|
72 |
|
73 |
$content .= "Message: \r\n{$message}\r\n\r\n";
|
74 |
+
$headers = array(
|
75 |
+
'From: Gmedia Support <support@gmedia.gallery>',
|
76 |
"Reply-To: {$name} <{$email}>",
|
77 |
+
);
|
78 |
if ( wp_mail( 'gmediafolder@gmail.com', $title, $content, $headers ) ) {
|
79 |
+
$alert = $gmCore->alert( 'success', esc_html__( 'Your message has been sent! We\'ll get back to you as soon as we can.', 'grand-media' ) );
|
80 |
$subject = $name = $email = $summary = $message = $domain = $link = $wp_admin_user = $wp_admin_password = $ftp_host = $ftp_user = $ftp_password = '';
|
81 |
} else {
|
82 |
+
$alert = $gmCore->alert( 'danger', esc_html__( 'Can\'t send message. Something is wrong.', 'grand-media' ) );
|
83 |
}
|
84 |
} elseif ( ! empty( $_POST ) ) {
|
85 |
+
$alert = $gmCore->alert( 'danger', esc_html__( 'Fill all required (*) fields, please.', 'grand-media' ) );
|
86 |
}
|
87 |
|
88 |
?>
|
89 |
+
<div class="card m-0 mw-100 p-0" id="gm_support">
|
90 |
+
<div class="card-body" id="gmedia-msg-panel"><?php echo wp_kses_post( $alert ); ?></div>
|
91 |
+
<form method="post" class="card-body" id="gm_support_form">
|
92 |
+
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
93 |
<div class="container-fluid">
|
94 |
<div class="form-header clearfix">
|
95 |
<div class="alignleft">
|
96 |
+
<img src="<?php echo esc_url( plugins_url( 'assets/img/icon-128x128.png', __FILE__ ) ); ?>" alt="" style="width:94px; height:94px;">
|
97 |
</div>
|
98 |
<div class="form-header-body">
|
99 |
<h1 class="form-title">Have questions? We're happy to help!</h1>
|
107 |
<div>
|
108 |
<fieldset>
|
109 |
<div class="form-group has-feedback">
|
110 |
+
<label class="control-label"><?php esc_html_e( 'First and Last Name', 'grand-media' ); ?> *</label>
|
111 |
<input type="text" name="name" class="form-control" value="<?php echo esc_attr( $name ? $name : $current_user->display_name ); ?>" required>
|
112 |
+
<span class="fa-solid fa-user form-control-feedback"></span>
|
113 |
</div>
|
114 |
<div class="form-group has-feedback">
|
115 |
+
<label class="control-label"><?php esc_html_e( 'Your Email Address', 'grand-media' ); ?> *</label>
|
116 |
<input type="email" name="email" class="form-control" value="<?php echo esc_attr( $email ? $email : $current_user->user_email ); ?>" required>
|
117 |
+
<span class="fa-solid fa-envelope form-control-feedback"></span>
|
118 |
</div>
|
119 |
<div class="form-group hidden">
|
120 |
+
<label class="control-label"><?php esc_html_e( 'Context', 'grand-media' ); ?></label>
|
121 |
<select id="context_plugin" class="form-control">
|
122 |
<option>GmediaGallery</option>
|
123 |
</select>
|
124 |
</div>
|
125 |
<div class="form-group form-subjects">
|
126 |
+
<label class="control-label"><?php esc_html_e( 'Subject', 'grand-media' ); ?> *</label>
|
127 |
<div class="well well-sm" style="background-color: #fff;">
|
128 |
+
<div class="radio">
|
129 |
+
<label><input type="radio" name="subject" <?php /* checked($subject, 'billing_issue', true); */ ?> value="billing_issue" required data-sections=".message" data-msglabel="<?php esc_attr_e( 'Please describe the issue you are having. Be detailed but brief.', 'grand-media' ); ?>"> <?php esc_html_e( 'Billing Issue', 'grand-media' ); ?>
|
130 |
+
</label></div>
|
131 |
+
<div class="radio">
|
132 |
+
<label><input type="radio" name="subject" <?php /* checked($subject, 'feature_request', true); */ ?> value="feature_request" required data-sections=".message" data-msglabel="<?php esc_attr_e( 'Describe the feature you would like to see added.', 'grand-media' ); ?>"> <?php esc_html_e( 'Feature Request', 'grand-media' ); ?>
|
133 |
+
</label></div>
|
134 |
+
<div class="radio">
|
135 |
+
<label><input type="radio" name="subject" <?php /* checked($subject, 'customization', true); */ ?> value="customization" required data-sections=".site,.message" data-msglabel="<?php esc_attr_e( 'Please describe the use-case and the different features you would like to be custom developed for you.', 'grand-media' ); ?>"> <?php esc_html_e( 'Customization', 'grand-media' ); ?>
|
136 |
+
</label></div>
|
137 |
+
<div class="radio">
|
138 |
+
<label><input type="radio" name="subject" <?php /* checked($subject, 'pre_sale_question', true); */ ?> value="pre_sale_question" required data-sections=".message" data-msglabel="<?php esc_attr_e( 'What would you like to know before purchasing?', 'grand-media' ); ?>"> <?php esc_html_e( 'Pre-Sale Question', 'grand-media' ); ?>
|
139 |
+
</label></div>
|
140 |
+
<div class="radio">
|
141 |
+
<label><input type="radio" name="subject" <?php /* checked($subject, 'bug', true); */ ?> value="bug" required data-sections=".site,.message,.credentials" data-msglabel="<?php esc_attr_e( 'Please describe the bug and how to reproduce it.', 'grand-media' ); ?>"> <?php esc_html_e( 'Bug', 'grand-media' ); ?>
|
142 |
+
</label></div>
|
143 |
</div>
|
144 |
</div>
|
145 |
</fieldset>
|
146 |
<div class="dynamic">
|
147 |
<fieldset class="message">
|
148 |
<div class="form-group has-feedback">
|
149 |
+
<label class="control-label"><?php esc_html_e( 'Summary (In 10 words or less, summarize your issue or question)', 'grand-media' ); ?> *</label>
|
150 |
<input type="text" name="summary" class="form-control" value="<?php echo esc_attr( $summary ); ?>" required>
|
151 |
+
<span class="fa-solid fa-table-cells-large form-control-feedback"></span>
|
152 |
</div>
|
153 |
<div class="form-group has-feedback">
|
154 |
+
<label class="control-label"><span id="msglabel"><?php esc_html_e( 'Please describe the issue you are having. Be detailed but brief', 'grand-media' ); ?></span> *</label>
|
155 |
+
<textarea name="message" cols="44" rows="10" class="form-control" required><?php echo esc_textarea( $message ); ?></textarea>
|
156 |
+
<span class="fa-solid fa-pen-to-square form-control-feedback"></span>
|
157 |
</div>
|
158 |
</fieldset>
|
159 |
<fieldset class="site">
|
160 |
<div class="form-group has-feedback">
|
161 |
+
<label class="control-label"><?php esc_html_e( 'Your Site Address', 'grand-media' ); ?></label>
|
162 |
<input type="text" name="domain" class="form-control" value="<?php echo esc_attr( $domain ? $domain : home_url() ); ?>">
|
163 |
+
<span class="fa-solid fa-globe form-control-feedback"></span>
|
164 |
</div>
|
165 |
<div class="form-group has-feedback">
|
166 |
+
<label class="control-label"><?php esc_html_e( 'If it\'s about a specific page on your site, please add the relevant link', 'grand-media' ); ?></label>
|
167 |
+
<?php // translators: url. ?>
|
168 |
+
<input type="text" name="link" class="form-control" value="<?php echo esc_attr( $link ); ?>" placeholder="<?php echo esc_attr( sprintf( __( 'Relevant Page on Your Site (E.g. %s)', 'grand-media' ), home_url( '/relevant-page/' ) ) ); ?>">
|
169 |
+
<span class="fa-solid fa-globe form-control-feedback"></span>
|
170 |
</div>
|
171 |
</fieldset>
|
172 |
<fieldset class="credentials">
|
173 |
+
<h4 class="title" data-bs-toggle="collapse" href="#wpLogin"><span><?php esc_html_e( 'WordPress Login', 'grand-media' ); ?></span>
|
174 |
+
<small class="fa-solid fa-plus"></small>
|
175 |
</h4>
|
176 |
<div id="wpLogin" class="collapse">
|
177 |
<div class="form-group has-feedback">
|
178 |
+
<label class="control-label"><?php esc_html_e( 'Username', 'grand-media' ); ?></label>
|
179 |
<input type="text" name="wp_admin_user" class="form-control" value="<?php echo esc_attr( $wp_admin_user ); ?>">
|
180 |
+
<span class="fa-solid fa-user form-control-feedback"></span>
|
181 |
</div>
|
182 |
<div class="form-group has-feedback">
|
183 |
+
<label class="control-label"><?php esc_html_e( 'Password', 'grand-media' ); ?></label>
|
184 |
<input type="password" name="wp_admin_password" class="form-control" value="<?php echo esc_attr( $wp_admin_password ); ?>">
|
185 |
+
<span class="fa-solid fa-lock form-control-feedback"></span>
|
186 |
</div>
|
187 |
+
<p><?php esc_html_e( 'Instead of providing your primary admin account, create a new admin that can be disabled when the support case is closed.', 'grand-media' ); ?></p>
|
188 |
</div>
|
189 |
</fieldset>
|
190 |
<fieldset class="credentials">
|
191 |
+
<h4 class="title" data-bs-toggle="collapse" href="#ftpAccess"><span><?php esc_html_e( 'FTP Access', 'grand-media' ); ?></span>
|
192 |
+
<small class="fa-solid fa-plus"></small>
|
193 |
</h4>
|
194 |
<div id="ftpAccess" class="collapse">
|
195 |
<div class="form-group has-feedback">
|
196 |
+
<label class="control-label"><?php esc_html_e( 'FTP Host', 'grand-media' ); ?></label>
|
197 |
<input type="text" name="ftp_host" class="form-control" value="<?php echo esc_attr( $ftp_host ); ?>">
|
198 |
+
<span class="fa-solid fa-globe form-control-feedback"></span>
|
199 |
</div>
|
200 |
<div class="form-group has-feedback">
|
201 |
+
<label class="control-label"><?php esc_html_e( 'FTP User', 'grand-media' ); ?></label>
|
202 |
<input type="text" name="ftp_user" class="form-control" value="<?php echo esc_attr( $ftp_user ); ?>">
|
203 |
+
<span class="fa-solid fa-user form-control-feedback"></span>
|
204 |
</div>
|
205 |
<div class="form-group has-feedback">
|
206 |
+
<label class="control-label"><?php esc_html_e( 'FTP Password', 'grand-media' ); ?></label>
|
207 |
<input type="password" name="ftp_password" class="form-control" value="<?php echo esc_attr( $ftp_password ); ?>">
|
208 |
+
<span class="fa-solid fa-lock form-control-feedback"></span>
|
209 |
</div>
|
210 |
+
<p><?php esc_html_e( 'Instead of providing your primary FTP account, create a new FTP user that can be disabled when the support case is closed.', 'grand-media' ); ?></p>
|
211 |
</div>
|
212 |
</fieldset>
|
213 |
</div>
|
214 |
</div>
|
215 |
<footer style="margin-top: 20px;">
|
216 |
+
<button class="btn btn-lg btn-primary"><?php esc_html_e( 'Submit', 'grand-media' ); ?></button>
|
217 |
</footer>
|
218 |
</section>
|
219 |
</div>
|
230 |
</div>
|
231 |
</div>
|
232 |
<style>
|
233 |
+
#gm_support .form-header {
|
234 |
+
margin-bottom: 20px;
|
235 |
+
}
|
236 |
+
|
237 |
+
#gm_support .form-header-body {
|
238 |
+
margin-left: 110px;
|
239 |
+
padding-top: 15px;
|
240 |
+
padding-bottom: 0;
|
241 |
+
}
|
242 |
+
|
243 |
+
#gm_support h1.form-title {
|
244 |
+
font-size: 20px;
|
245 |
+
font-weight: bold;
|
246 |
+
line-height: 1.2em;
|
247 |
+
margin: 0;
|
248 |
+
}
|
249 |
+
|
250 |
+
#gm_support h2.plugin-title {
|
251 |
+
font-size: 18px;
|
252 |
+
line-height: 1.2em;
|
253 |
+
margin: 0;
|
254 |
+
}
|
255 |
+
|
256 |
+
#gm_support h3 {
|
257 |
+
font-size: 14px;
|
258 |
+
line-height: 1.8em;
|
259 |
+
margin: 0;
|
260 |
+
}
|
261 |
+
|
262 |
+
#gm_support .form-subjects .radio {
|
263 |
+
margin: 7px 0;
|
264 |
+
}
|
265 |
+
|
266 |
+
#gm_support .credentials h4 {
|
267 |
+
cursor: pointer;
|
268 |
+
color: #2e6286;
|
269 |
+
}
|
270 |
+
|
271 |
+
#gm_support .credentials h4:hover {
|
272 |
+
cursor: pointer;
|
273 |
+
color: #2e6da4;
|
274 |
+
}
|
275 |
+
|
276 |
+
#gm_support .dynamic fieldset {
|
277 |
+
display: none;
|
278 |
+
}
|
279 |
</style>
|
280 |
<script>
|
281 |
+
jQuery(function($) {
|
282 |
+
$('.form-subjects input').on('change', function() {
|
283 |
+
console.log(this);
|
284 |
+
var label = $(this).attr('data-msglabel'),
|
285 |
+
sections = $(this).attr('data-sections');
|
286 |
+
$('.dynamic fieldset').hide().filter(sections).show();
|
287 |
+
$('#msglabel').text(label);
|
288 |
+
});
|
289 |
+
});
|
290 |
</script>
|
291 |
|
292 |
</div>
|
admin/tpl/comments.php
CHANGED
@@ -2,9 +2,8 @@
|
|
2 |
/**
|
3 |
* Gmedia Comments
|
4 |
*/
|
5 |
-
|
6 |
-
|
7 |
-
} // Exit if accessed directly
|
8 |
|
9 |
require_once ABSPATH . 'wp-admin/includes/meta-boxes.php';
|
10 |
|
@@ -30,24 +29,43 @@ if ( $gmedia_id ) {
|
|
30 |
$post = get_post( $post_id );
|
31 |
?>
|
32 |
<div id="commentsdiv" style="padding:1px 0;">
|
33 |
-
<style
|
34 |
-
#commentsdiv {
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
#commentsdiv
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
</style>
|
41 |
<?php
|
42 |
if ( current_user_can( 'edit_posts' ) ) {
|
43 |
-
printf( '<a target="_blank" href="%s" class="
|
44 |
}
|
45 |
-
if ( $gmedia_id ) {
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
49 |
<?php } ?>
|
50 |
-
<h4><?php echo $post->post_title; ?></h4>
|
51 |
<?php
|
52 |
post_comment_meta_box( $post );
|
53 |
wp_comment_reply();
|
2 |
/**
|
3 |
* Gmedia Comments
|
4 |
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
7 |
|
8 |
require_once ABSPATH . 'wp-admin/includes/meta-boxes.php';
|
9 |
|
29 |
$post = get_post( $post_id );
|
30 |
?>
|
31 |
<div id="commentsdiv" style="padding:1px 0;">
|
32 |
+
<style scoped>
|
33 |
+
#commentsdiv {
|
34 |
+
padding-top: 1px;
|
35 |
+
}
|
36 |
+
|
37 |
+
#commentsdiv > .img-thumbnail {
|
38 |
+
float: left;
|
39 |
+
margin: 0 10px 10px;
|
40 |
+
}
|
41 |
+
|
42 |
+
#commentsdiv > .img-thumbnail img.gmedia-thumb {
|
43 |
+
max-height: 72px;
|
44 |
+
}
|
45 |
+
|
46 |
+
#commentsdiv > h4 {
|
47 |
+
margin-left: 10px;
|
48 |
+
}
|
49 |
+
|
50 |
+
#commentsdiv .fixed .column-author {
|
51 |
+
width: 20%;
|
52 |
+
}
|
53 |
+
|
54 |
+
#commentsdiv .row-actions .edit {
|
55 |
+
display: none;
|
56 |
+
}
|
57 |
</style>
|
58 |
<?php
|
59 |
if ( current_user_can( 'edit_posts' ) ) {
|
60 |
+
printf( '<a target="_blank" href="%s" class="float-end">%s</a>', esc_url( add_query_arg( array( 'p' => $post_id ), admin_url( 'edit-comments.php' ) ) ), esc_html__( 'Open in new tab', 'grand-media' ) );
|
61 |
}
|
62 |
+
if ( $gmedia_id ) {
|
63 |
+
?>
|
64 |
+
<span class="img-thumbnail">
|
65 |
+
<?php echo wp_kses_post( gmedia_item_thumbnail( $gmedia ) ); ?>
|
66 |
+
</span>
|
67 |
<?php } ?>
|
68 |
+
<h4><?php echo esc_html( $post->post_title ); ?></h4>
|
69 |
<?php
|
70 |
post_comment_meta_box( $post );
|
71 |
wp_comment_reply();
|
admin/tpl/modal-customfield.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
|
6 |
if ( isset( $customfield_meta_type ) && $customfield_meta_type ) { ?>
|
7 |
<div class="modal fade gmedia-modal" id="newCustomFieldModal" tabindex="-1" role="dialog" aria-hidden="true">
|
8 |
<div class="modal-dialog">
|
9 |
<div class="modal-content">
|
10 |
<div class="modal-header">
|
11 |
-
<
|
12 |
-
<
|
13 |
</div>
|
14 |
<form class="modal-body" method="post" id="newCustomFieldForm">
|
15 |
<?php
|
16 |
-
echo $gmCore->meta_form( $customfield_meta_type );
|
17 |
wp_nonce_field( 'gmedia_custom_field', '_wpnonce_custom_field' );
|
18 |
wp_referer_field();
|
19 |
?>
|
@@ -21,8 +21,8 @@ if ( isset( $customfield_meta_type ) && $customfield_meta_type ) { ?>
|
|
21 |
<input type="hidden" class="newcustomfield-for-id" name="ID" value=""/>
|
22 |
</form>
|
23 |
<div class="modal-footer">
|
24 |
-
<button type="button" class="btn btn-primary customfieldsubmit"><?php
|
25 |
-
<button type="button" class="btn btn-
|
26 |
</div>
|
27 |
</div>
|
28 |
</div>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
3 |
+
|
4 |
+
global $gmCore, $gm_allowed_tags;
|
5 |
|
6 |
if ( isset( $customfield_meta_type ) && $customfield_meta_type ) { ?>
|
7 |
<div class="modal fade gmedia-modal" id="newCustomFieldModal" tabindex="-1" role="dialog" aria-hidden="true">
|
8 |
<div class="modal-dialog">
|
9 |
<div class="modal-content">
|
10 |
<div class="modal-header">
|
11 |
+
<h4 class="modal-title"><?php esc_html_e( 'Add New Custom Field' ); ?></h4>
|
12 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
13 |
</div>
|
14 |
<form class="modal-body" method="post" id="newCustomFieldForm">
|
15 |
<?php
|
16 |
+
echo wp_kses( $gmCore->meta_form( $customfield_meta_type ), $gm_allowed_tags );
|
17 |
wp_nonce_field( 'gmedia_custom_field', '_wpnonce_custom_field' );
|
18 |
wp_referer_field();
|
19 |
?>
|
21 |
<input type="hidden" class="newcustomfield-for-id" name="ID" value=""/>
|
22 |
</form>
|
23 |
<div class="modal-footer">
|
24 |
+
<button type="button" class="btn btn-primary customfieldsubmit"><?php esc_html_e( 'Add', 'grand-media' ); ?></button>
|
25 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
26 |
</div>
|
27 |
</div>
|
28 |
</div>
|
admin/tpl/modal-share.php
CHANGED
@@ -1,51 +1,49 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
?>
|
6 |
<div class="modal fade gmedia-modal" id="shareModal" tabindex="-1" role="dialog" aria-hidden="true">
|
7 |
<div class="modal-dialog">
|
8 |
<div class="modal-content">
|
9 |
<div class="modal-header">
|
10 |
-
<
|
11 |
-
<
|
12 |
</div>
|
13 |
<form class="modal-body" method="post" id="shareForm">
|
14 |
<div class="form-group sharelink_post">
|
15 |
-
<label><?php
|
16 |
<div class="input-group input-group-sm">
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
<input type="text" class="form-control" readonly="readonly" value=""/>
|
21 |
<span class="input-group-btn">
|
22 |
-
|
23 |
-
|
24 |
</div>
|
25 |
</div>
|
26 |
<div class="form-group sharelink_page">
|
27 |
-
<label><?php
|
28 |
<div class="input-group input-group-sm">
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
<input type="text" class="form-control" readonly="readonly" value=""/>
|
33 |
<span class="input-group-btn">
|
34 |
-
|
35 |
-
|
36 |
</div>
|
37 |
</div>
|
38 |
<div class="form-group">
|
39 |
-
<label><?php
|
40 |
-
<input name="email" type="email" class="form-control sharetoemail" value="" placeholder="<?php
|
41 |
-
<textarea style="margin-top:4px;" name="message" cols="20" rows="3" class="form-control" placeholder="<?php
|
42 |
</div>
|
43 |
<input type="hidden" name="action" value="gmedia_share_page"/>
|
44 |
<?php wp_nonce_field( 'gmedia_share', '_wpnonce_share' ); ?>
|
45 |
</form>
|
46 |
<div class="modal-footer">
|
47 |
-
<button type="button" class="btn btn-primary sharebutton" disabled="disabled"><?php
|
48 |
-
<button type="button" class="btn btn-
|
49 |
</div>
|
50 |
</div>
|
51 |
</div>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
?>
|
4 |
<div class="modal fade gmedia-modal" id="shareModal" tabindex="-1" role="dialog" aria-hidden="true">
|
5 |
<div class="modal-dialog">
|
6 |
<div class="modal-content">
|
7 |
<div class="modal-header">
|
8 |
+
<h4 class="modal-title"><?php esc_html_e( 'Gmedia Share' ); ?></h4>
|
9 |
+
<button type="button" class="btn-close m-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
10 |
</div>
|
11 |
<form class="modal-body" method="post" id="shareForm">
|
12 |
<div class="form-group sharelink_post">
|
13 |
+
<label><?php esc_html_e( 'Link to WordPress Post', 'grand-media' ); ?></label>
|
14 |
<div class="input-group input-group-sm">
|
15 |
+
<span class="input-group-text">
|
16 |
+
<input class="form-check-input mt-0" type="radio" name="sharelink" value="" checked/>
|
17 |
+
</span>
|
18 |
<input type="text" class="form-control" readonly="readonly" value=""/>
|
19 |
<span class="input-group-btn">
|
20 |
+
<a target="_blank" class="btn btn-secondary" href="" title="<?php esc_attr_e( 'Open in new Tab', 'grand-media' ); ?>"><i class='fa-solid fa-arrow-up-right-from-square'></i></a>
|
21 |
+
</span>
|
22 |
</div>
|
23 |
</div>
|
24 |
<div class="form-group sharelink_page">
|
25 |
+
<label><?php esc_html_e( 'Link to GmediaCloud Page', 'grand-media' ); ?></label>
|
26 |
<div class="input-group input-group-sm">
|
27 |
+
<span class="input-group-text">
|
28 |
+
<input class="form-check-input mt-0" type="radio" name="sharelink" value=""/>
|
29 |
+
</span>
|
30 |
<input type="text" class="form-control" readonly="readonly" value=""/>
|
31 |
<span class="input-group-btn">
|
32 |
+
<a target="_blank" class="btn btn-secondary" href="" title="<?php esc_attr_e( 'Open in new Tab', 'grand-media' ); ?>"><i class='fa-solid fa-arrow-up-right-from-square'></i></a>
|
33 |
+
</span>
|
34 |
</div>
|
35 |
</div>
|
36 |
<div class="form-group">
|
37 |
+
<label><?php esc_html_e( 'Send link to', 'grand-media' ); ?></label>
|
38 |
+
<input name="email" type="email" class="form-control sharetoemail" value="" placeholder="<?php esc_attr_e( 'Email', 'grand-media' ); ?>"/>
|
39 |
+
<textarea style="margin-top:4px;" name="message" cols="20" rows="3" class="form-control" placeholder="<?php esc_attr_e( 'Message (optional)', 'grand-media' ); ?>"></textarea>
|
40 |
</div>
|
41 |
<input type="hidden" name="action" value="gmedia_share_page"/>
|
42 |
<?php wp_nonce_field( 'gmedia_share', '_wpnonce_share' ); ?>
|
43 |
</form>
|
44 |
<div class="modal-footer">
|
45 |
+
<button type="button" class="btn btn-primary sharebutton" disabled="disabled"><?php esc_html_e( 'Send', 'grand-media' ); ?></button>
|
46 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e( 'Close', 'grand-media' ); ?></button>
|
47 |
</div>
|
48 |
</div>
|
49 |
</div>
|
admin/tpl/module-preview.php
CHANGED
@@ -2,27 +2,26 @@
|
|
2 |
/**
|
3 |
* Module Preset Preview
|
4 |
*/
|
5 |
-
|
6 |
-
|
7 |
-
} // Exit if accessed directly.
|
8 |
|
9 |
if ( ! is_user_logged_in() || ! current_user_can( 'gmedia_module_manage' ) ) {
|
10 |
die( '-1' );
|
11 |
}
|
12 |
|
13 |
-
global $wp_styles, $wp_scripts, $gmCore;
|
14 |
$query = $gmCore->_req( 'query', 'limit=20' );
|
15 |
$module = $gmCore->_req( 'module' );
|
16 |
$preset = $gmCore->_req( 'preset' );
|
17 |
$atts = compact( 'query', 'module', 'preset' );
|
18 |
|
19 |
do_action( 'wp_enqueue_scripts' );
|
20 |
-
$wp_styles->queue =
|
21 |
-
$wp_scripts->queue =
|
22 |
|
23 |
do_action( 'gmedia_head' );
|
24 |
|
25 |
-
echo gmedia_shortcode( $atts );
|
26 |
|
27 |
do_action( 'gmedia_enqueue_scripts' );
|
28 |
do_action( 'gmedia_footer' );
|
2 |
/**
|
3 |
* Module Preset Preview
|
4 |
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
7 |
|
8 |
if ( ! is_user_logged_in() || ! current_user_can( 'gmedia_module_manage' ) ) {
|
9 |
die( '-1' );
|
10 |
}
|
11 |
|
12 |
+
global $wp_styles, $wp_scripts, $gmCore, $gm_allowed_tags;
|
13 |
$query = $gmCore->_req( 'query', 'limit=20' );
|
14 |
$module = $gmCore->_req( 'module' );
|
15 |
$preset = $gmCore->_req( 'preset' );
|
16 |
$atts = compact( 'query', 'module', 'preset' );
|
17 |
|
18 |
do_action( 'wp_enqueue_scripts' );
|
19 |
+
$wp_styles->queue = array();
|
20 |
+
$wp_scripts->queue = array();
|
21 |
|
22 |
do_action( 'gmedia_head' );
|
23 |
|
24 |
+
echo wp_kses( gmedia_shortcode( $atts ), $gm_allowed_tags );
|
25 |
|
26 |
do_action( 'gmedia_enqueue_scripts' );
|
27 |
do_action( 'gmedia_footer' );
|
admin/tpl/search-form.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
die( '-1' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* Search form template
|
@@ -10,8 +8,9 @@ global $gmCore;
|
|
10 |
?>
|
11 |
<form class="form-inline gmedia-search-form" role="search" method="get">
|
12 |
<div class="form-group">
|
13 |
-
<?php
|
14 |
-
if ( ! in_array( $key, [ 'doing_wp_cron', 'do_gmedia', 'did_gmedia', 'do_gmedia_terms', 'did_gmedia_terms', 'ids', 's' ], true ) ) {
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Search form template
|
8 |
?>
|
9 |
<form class="form-inline gmedia-search-form" role="search" method="get">
|
10 |
<div class="form-group">
|
11 |
+
<?php
|
|