Version Description
Download this release
Release Info
Developer | pasyuk |
Plugin | Gallery – Flagallery Photo Portfolio |
Version | 4.33 |
Comparing to | |
See all releases |
Code changes from version 4.31 to 4.33
- admin/addgallery.php +75 -75
- admin/admin.php +141 -141
- admin/ajax.php +171 -155
- admin/banner-box.php +200 -200
- admin/banner.functions.php +118 -106
- flag.php +2 -2
- lib/image.php +1 -0
- readme.txt +7 -1
- widgets/widgets.php +62 -11
admin/addgallery.php
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
<?php
|
2 |
-
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
|
3 |
-
die('You are not allowed to call this page directly.');
|
4 |
}
|
5 |
|
6 |
// sometimes a error feedback is better than a white screen
|
7 |
-
@ini_set('error_reporting', E_ALL ^ E_NOTICE);
|
8 |
|
9 |
-
function flag_admin_add_gallery(){
|
10 |
|
11 |
global $wpdb, $flagdb, $flag;
|
12 |
|
13 |
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
|
14 |
-
$filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
|
15 |
|
16 |
// check for the max image size
|
17 |
$maxsize = flagGallery::check_memory_limit();
|
18 |
|
19 |
$defaultpath = $flag->options['galleryPath'];
|
20 |
|
21 |
-
if($_POST['addgallery']){
|
22 |
-
check_admin_referer('flag_addgallery');
|
23 |
-
$newgallery = trim($_POST['galleryname']);
|
24 |
-
if(!empty($newgallery)){
|
25 |
-
flagAdmin::create_gallery($newgallery, $defaultpath);
|
26 |
}
|
27 |
}
|
28 |
-
if($_POST['uploadimage']){
|
29 |
-
check_admin_referer('flag_upload');
|
30 |
|
31 |
-
$flag->options['thumbWidth']
|
32 |
-
$flag->options['thumbHeight'] = intval($_POST['thumbHeight'])? intval($_POST['thumbHeight']) : 100;
|
33 |
-
$flag->options['thumbFix']
|
34 |
-
update_option('flag_options', $flag->options);
|
35 |
|
36 |
-
if($_FILES['MF__F_0_0']['error'] == 0){
|
37 |
flagAdmin::upload_images();
|
38 |
-
} else{
|
39 |
-
flagGallery::show_error(__('Upload failed!', 'flag'));
|
40 |
}
|
41 |
}
|
42 |
-
if($_POST['importfolder']){
|
43 |
-
check_admin_referer('flag_addgallery');
|
44 |
$galleryfolder = $_POST['galleryfolder'];
|
45 |
-
if((!empty($galleryfolder)) AND ($defaultpath != $galleryfolder) AND false === strpos($galleryfolder, '..')){
|
46 |
-
flagAdmin::import_gallery($galleryfolder);
|
47 |
}
|
48 |
}
|
49 |
|
50 |
|
51 |
-
if(isset($_POST['disable_flash'])){
|
52 |
-
check_admin_referer('flag_upload');
|
53 |
$flag->options['swfUpload'] = false;
|
54 |
-
update_option('flag_options', $flag->options);
|
55 |
}
|
56 |
|
57 |
-
if(isset($_POST['enable_flash'])){
|
58 |
-
check_admin_referer('flag_upload');
|
59 |
$flag->options['swfUpload'] = true;
|
60 |
-
update_option('flag_options', $flag->options);
|
61 |
}
|
62 |
|
63 |
//get all galleries (after we added new ones)
|
64 |
-
$gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir'], false, 0, 0, 0, true);
|
65 |
|
66 |
?>
|
67 |
|
68 |
-
<?php if(!IS_WPMU || current_user_can('FlAG Import folder')){ ?>
|
69 |
<link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
|
70 |
<script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
|
71 |
<script type="text/javascript">
|
@@ -89,36 +89,36 @@ function flag_admin_add_gallery(){
|
|
89 |
<div id="slider" class="flag-wrap">
|
90 |
|
91 |
<ul id="tabs" class="tabs">
|
92 |
-
<li class="selected"><a href="#" rel="addgallery"><?php _e('Add new gallery', 'flag'); ?></a></li>
|
93 |
-
<li><a href="#" rel="uploadimage"><?php _e('Upload Images', 'flag'); ?></a></li>
|
94 |
-
<?php if(!IS_WPMU || current_user_can('FlAG Import folder')){ ?>
|
95 |
-
<li><a href="#" rel="importfolder"><?php _e('Import image folder', 'flag'); ?></a></li>
|
96 |
<?php } ?>
|
97 |
</ul>
|
98 |
|
99 |
<!-- create gallery -->
|
100 |
<div id="addgallery" class="cptab">
|
101 |
-
<h2><?php _e('Create a new gallery', 'flag'); ?></h2>
|
102 |
|
103 |
<form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
104 |
-
<?php wp_nonce_field('flag_addgallery'); ?>
|
105 |
<table class="form-table" style="width: auto;">
|
106 |
<tr>
|
107 |
<th scope="col" colspan="2" style="padding-bottom: 0;">
|
108 |
-
<strong><?php _e('New Gallery', 'flag'); ?></strong></th>
|
109 |
</tr>
|
110 |
<tr valign="top">
|
111 |
<td><input type="text" size="65" name="galleryname" value=""/><br/>
|
112 |
-
<?php if(!IS_WPMU){ ?>
|
113 |
-
<?php _e('Create a new , empty gallery below the folder', 'flag'); ?>
|
114 |
<strong><?php echo $defaultpath; ?></strong><br/>
|
115 |
<?php } ?>
|
116 |
-
<i>( <?php _e('Allowed characters for file and folder names are', 'flag'); ?>: a-z, A-Z, 0-9, -, _ )</i>
|
117 |
</td>
|
118 |
-
<?php do_action('flag_add_new_gallery_form'); ?>
|
119 |
<td>
|
120 |
<div class="submit" style="margin: 0; padding: 0;">
|
121 |
-
<input class="button-primary" type="submit" name="addgallery" value="<?php _e('Add gallery', 'flag'); ?>"/>
|
122 |
</div>
|
123 |
</td>
|
124 |
</tr>
|
@@ -128,54 +128,54 @@ function flag_admin_add_gallery(){
|
|
128 |
</div>
|
129 |
<!-- upload images -->
|
130 |
<div id="uploadimage" class="cptab">
|
131 |
-
<h2><?php _e('Upload images', 'flag'); ?></h2>
|
132 |
|
133 |
<form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
134 |
-
<?php wp_nonce_field('flag_upload'); ?>
|
135 |
<table class="flag-form-table">
|
136 |
<tr valign="top">
|
137 |
<td style="width: 216px;">
|
138 |
-
<label for="galleryselect"><?php _e('Upload images in', 'flag'); ?> *</label>
|
139 |
<select name="galleryselect" id="galleryselect" style="width: 200px">
|
140 |
-
<option value="0"><?php _e('Choose gallery', 'flag'); ?></option>
|
141 |
-
<?php $ingallery = isset($_GET['gid'])? (int) $_GET['gid'] : '';
|
142 |
-
foreach($gallerylist as $gallery){
|
143 |
-
if(!flagAdmin::can_manage_this_gallery($gallery->author)){
|
144 |
continue;
|
145 |
}
|
146 |
-
$name = (empty($gallery->title))? $gallery->name : esc_html(stripslashes($gallery->title));
|
147 |
-
if($flag->options['albSort'] == 'gid'){
|
148 |
$name = '#' . $gallery->gid . ' - ' . $name;
|
149 |
}
|
150 |
-
if($flag->options['albSort'] == 'title'){
|
151 |
$name = $name . ' (#' . $gallery->gid . ')';
|
152 |
}
|
153 |
-
$sel = ($ingallery == $gallery->gid)? 'selected="selected" ' : '';
|
154 |
echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $name . '</option>' . "\n";
|
155 |
} ?>
|
156 |
</select>
|
157 |
<?php echo $maxsize; ?>
|
158 |
-
<br/><?php if((IS_WPMU) && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck')){
|
159 |
display_space_usage();
|
160 |
} ?>
|
161 |
<br/>
|
162 |
|
163 |
-
<p><?php _e('Thumbnail WIDTH x HEIGHT (in pixel)', 'flag'); ?> *
|
164 |
<br/><input type="text" size="5" maxlength="5" name="thumbWidth" id="thumbWidth" value="<?php echo $flag->options['thumbWidth']; ?>"/> x
|
165 |
<input type="text" size="5" maxlength="5" name="thumbHeight" id="thumbHeight" value="<?php echo $flag->options['thumbHeight']; ?>"/>
|
166 |
<br/>
|
167 |
-
<small><?php _e('These values are maximum values ', 'flag'); ?></small>
|
168 |
</p>
|
169 |
<p>
|
170 |
-
<label><input type="checkbox" name="thumbFix" id="thumbFix" value="1" <?php checked('1', $flag->options['thumbFix']); ?> /> <?php _e('Ignore the aspect ratio, no portrait thumbnails', 'flag'); ?>
|
171 |
</label></p>
|
172 |
|
173 |
<div class="submit">
|
174 |
<span class="useflashupload">
|
175 |
-
<?php if($flag->options['swfUpload']){ ?>
|
176 |
-
<input type="submit" class="button-secondary" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload via Plupload, disable it if you have problems', 'flag'); ?>" value="<?php _e('Switch to Browser Upload', 'flag'); ?>"/>
|
177 |
-
<?php } else{ ?>
|
178 |
-
<input type="submit" class="button-secondary" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'flag'); ?>" value="<?php _e('Switch to Plupload based Upload', 'flag'); ?>"/>
|
179 |
<?php } ?>
|
180 |
</span>
|
181 |
|
@@ -186,12 +186,12 @@ function flag_admin_add_gallery(){
|
|
186 |
|
187 |
<td>
|
188 |
<div id="pluploadUploader">
|
189 |
-
<?php if (
|
190 |
-
<strong><?php _e('Upload image(s):', 'flag'); ?></strong><br>
|
191 |
<input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/>
|
192 |
</div>
|
193 |
<span id="choosegalfirst">
|
194 |
-
<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e('Upload images', 'flag'); ?>"/>
|
195 |
<span class="disabledbut" style="display: none;"></span>
|
196 |
</span>
|
197 |
<?php } ?>
|
@@ -200,8 +200,8 @@ function flag_admin_add_gallery(){
|
|
200 |
</table>
|
201 |
<div id="pl-message"></div>
|
202 |
</form>
|
203 |
-
<?php if($flag->options['swfUpload']){
|
204 |
-
$nonce = wp_create_nonce('flag_upload');
|
205 |
?>
|
206 |
<script type="text/javascript">
|
207 |
// Convert divs to queue widgets when the DOM is ready
|
@@ -333,29 +333,29 @@ function flag_admin_add_gallery(){
|
|
333 |
|
334 |
<?php } ?>
|
335 |
</div>
|
336 |
-
<?php if(!IS_WPMU || current_user_can('FlAG Import folder')){ ?>
|
337 |
<!-- import folder -->
|
338 |
<div id="importfolder" class="cptab">
|
339 |
-
<h2><?php _e('Import image folder', 'flag'); ?></h2>
|
340 |
|
341 |
<form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
342 |
-
<?php wp_nonce_field('flag_addgallery'); ?>
|
343 |
<table class="form-table">
|
344 |
<tr valign="top">
|
345 |
-
<th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
|
346 |
<td>
|
347 |
-
<input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php echo $defaultpath; ?>"/><span class="browsefiles button" style="display:none"><?php _e('Browse...', "flag"); ?></span>
|
348 |
|
349 |
<div id="file_browser"></div>
|
350 |
<div><?php echo $maxsize; ?>
|
351 |
-
<?php if(SAFE_MODE){ ?>
|
352 |
-
<br/><?php _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'flag'); ?><?php }; ?>
|
353 |
</div>
|
354 |
</td>
|
355 |
</tr>
|
356 |
</table>
|
357 |
<div class="submit">
|
358 |
-
<input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/>
|
359 |
</div>
|
360 |
</form>
|
361 |
</div>
|
1 |
<?php
|
2 |
+
if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
|
3 |
+
die( 'You are not allowed to call this page directly.' );
|
4 |
}
|
5 |
|
6 |
// sometimes a error feedback is better than a white screen
|
7 |
+
@ini_set( 'error_reporting', E_ALL ^ E_NOTICE );
|
8 |
|
9 |
+
function flag_admin_add_gallery() {
|
10 |
|
11 |
global $wpdb, $flagdb, $flag;
|
12 |
|
13 |
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
|
14 |
+
$filepath = admin_url() . 'admin.php?page=' . urlencode( $_GET['page'] );
|
15 |
|
16 |
// check for the max image size
|
17 |
$maxsize = flagGallery::check_memory_limit();
|
18 |
|
19 |
$defaultpath = $flag->options['galleryPath'];
|
20 |
|
21 |
+
if ( $_POST['addgallery'] ) {
|
22 |
+
check_admin_referer( 'flag_addgallery' );
|
23 |
+
$newgallery = trim( $_POST['galleryname'] );
|
24 |
+
if ( ! empty( $newgallery ) ) {
|
25 |
+
flagAdmin::create_gallery( $newgallery, $defaultpath );
|
26 |
}
|
27 |
}
|
28 |
+
if ( $_POST['uploadimage'] ) {
|
29 |
+
check_admin_referer( 'flag_upload' );
|
30 |
|
31 |
+
$flag->options['thumbWidth'] = intval( $_POST['thumbWidth'] ) ? intval( $_POST['thumbWidth'] ) : 100;
|
32 |
+
$flag->options['thumbHeight'] = intval( $_POST['thumbHeight'] ) ? intval( $_POST['thumbHeight'] ) : 100;
|
33 |
+
$flag->options['thumbFix'] = isset( $_POST['thumbFix'] ) ? 1 : 0;
|
34 |
+
update_option( 'flag_options', $flag->options );
|
35 |
|
36 |
+
if ( $_FILES['MF__F_0_0']['error'] == 0 ) {
|
37 |
flagAdmin::upload_images();
|
38 |
+
} else {
|
39 |
+
flagGallery::show_error( __( 'Upload failed!', 'flag' ) );
|
40 |
}
|
41 |
}
|
42 |
+
if ( $_POST['importfolder'] ) {
|
43 |
+
check_admin_referer( 'flag_addgallery' );
|
44 |
$galleryfolder = $_POST['galleryfolder'];
|
45 |
+
if ( ( ! empty( $galleryfolder ) ) AND ( $defaultpath != $galleryfolder ) AND false === strpos( $galleryfolder, '..' ) ) {
|
46 |
+
flagAdmin::import_gallery( $galleryfolder );
|
47 |
}
|
48 |
}
|
49 |
|
50 |
|
51 |
+
if ( isset( $_POST['disable_flash'] ) ) {
|
52 |
+
check_admin_referer( 'flag_upload' );
|
53 |
$flag->options['swfUpload'] = false;
|
54 |
+
update_option( 'flag_options', $flag->options );
|
55 |
}
|
56 |
|
57 |
+
if ( isset( $_POST['enable_flash'] ) ) {
|
58 |
+
check_admin_referer( 'flag_upload' );
|
59 |
$flag->options['swfUpload'] = true;
|
60 |
+
update_option( 'flag_options', $flag->options );
|
61 |
}
|
62 |
|
63 |
//get all galleries (after we added new ones)
|
64 |
+
$gallerylist = $flagdb->find_all_galleries( $flag->options['albSort'], $flag->options['albSortDir'], false, 0, 0, 0, true );
|
65 |
|
66 |
?>
|
67 |
|
68 |
+
<?php if ( ! IS_WPMU || current_user_can( 'FlAG Import folder' ) ) { ?>
|
69 |
<link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
|
70 |
<script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
|
71 |
<script type="text/javascript">
|
89 |
<div id="slider" class="flag-wrap">
|
90 |
|
91 |
<ul id="tabs" class="tabs">
|
92 |
+
<li class="selected"><a href="#" rel="addgallery"><?php _e( 'Add new gallery', 'flag' ); ?></a></li>
|
93 |
+
<li><a href="#" rel="uploadimage"><?php _e( 'Upload Images', 'flag' ); ?></a></li>
|
94 |
+
<?php if ( ! IS_WPMU || current_user_can( 'FlAG Import folder' ) ) { ?>
|
95 |
+
<li><a href="#" rel="importfolder"><?php _e( 'Import image folder', 'flag' ); ?></a></li>
|
96 |
<?php } ?>
|
97 |
</ul>
|
98 |
|
99 |
<!-- create gallery -->
|
100 |
<div id="addgallery" class="cptab">
|
101 |
+
<h2><?php _e( 'Create a new gallery', 'flag' ); ?></h2>
|
102 |
|
103 |
<form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
104 |
+
<?php wp_nonce_field( 'flag_addgallery' ); ?>
|
105 |
<table class="form-table" style="width: auto;">
|
106 |
<tr>
|
107 |
<th scope="col" colspan="2" style="padding-bottom: 0;">
|
108 |
+
<strong><?php _e( 'New Gallery', 'flag' ); ?></strong></th>
|
109 |
</tr>
|
110 |
<tr valign="top">
|
111 |
<td><input type="text" size="65" name="galleryname" value=""/><br/>
|
112 |
+
<?php if ( ! IS_WPMU ) { ?>
|
113 |
+
<?php _e( 'Create a new , empty gallery below the folder', 'flag' ); ?>
|
114 |
<strong><?php echo $defaultpath; ?></strong><br/>
|
115 |
<?php } ?>
|
116 |
+
<i>( <?php _e( 'Allowed characters for file and folder names are', 'flag' ); ?>: a-z, A-Z, 0-9, -, _ )</i>
|
117 |
</td>
|
118 |
+
<?php do_action( 'flag_add_new_gallery_form' ); ?>
|
119 |
<td>
|
120 |
<div class="submit" style="margin: 0; padding: 0;">
|
121 |
+
<input class="button-primary" type="submit" name="addgallery" value="<?php _e( 'Add gallery', 'flag' ); ?>"/>
|
122 |
</div>
|
123 |
</td>
|
124 |
</tr>
|
128 |
</div>
|
129 |
<!-- upload images -->
|
130 |
<div id="uploadimage" class="cptab">
|
131 |
+
<h2><?php _e( 'Upload images', 'flag' ); ?></h2>
|
132 |
|
133 |
<form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
134 |
+
<?php wp_nonce_field( 'flag_upload' ); ?>
|
135 |
<table class="flag-form-table">
|
136 |
<tr valign="top">
|
137 |
<td style="width: 216px;">
|
138 |
+
<label for="galleryselect"><?php _e( 'Upload images in', 'flag' ); ?> *</label>
|
139 |
<select name="galleryselect" id="galleryselect" style="width: 200px">
|
140 |
+
<option value="0"><?php _e( 'Choose gallery', 'flag' ); ?></option>
|
141 |
+
<?php $ingallery = isset( $_GET['gid'] ) ? (int) $_GET['gid'] : '';
|
142 |
+
foreach ( $gallerylist as $gallery ) {
|
143 |
+
if ( ! flagAdmin::can_manage_this_gallery( $gallery->author ) ) {
|
144 |
continue;
|
145 |
}
|
146 |
+
$name = ( empty( $gallery->title ) ) ? $gallery->name : esc_html( stripslashes( $gallery->title ) );
|
147 |
+
if ( $flag->options['albSort'] == 'gid' ) {
|
148 |
$name = '#' . $gallery->gid . ' - ' . $name;
|
149 |
}
|
150 |
+
if ( $flag->options['albSort'] == 'title' ) {
|
151 |
$name = $name . ' (#' . $gallery->gid . ')';
|
152 |
}
|
153 |
+
$sel = ( $ingallery == $gallery->gid ) ? 'selected="selected" ' : '';
|
154 |
echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $name . '</option>' . "\n";
|
155 |
} ?>
|
156 |
</select>
|
157 |
<?php echo $maxsize; ?>
|
158 |
+
<br/><?php if ( ( IS_WPMU ) && flagGallery::flag_wpmu_enable_function( 'wpmuQuotaCheck' ) ) {
|
159 |
display_space_usage();
|
160 |
} ?>
|
161 |
<br/>
|
162 |
|
163 |
+
<p><?php _e( 'Thumbnail WIDTH x HEIGHT (in pixel)', 'flag' ); ?> *
|
164 |
<br/><input type="text" size="5" maxlength="5" name="thumbWidth" id="thumbWidth" value="<?php echo $flag->options['thumbWidth']; ?>"/> x
|
165 |
<input type="text" size="5" maxlength="5" name="thumbHeight" id="thumbHeight" value="<?php echo $flag->options['thumbHeight']; ?>"/>
|
166 |
<br/>
|
167 |
+
<small><?php _e( 'These values are maximum values ', 'flag' ); ?></small>
|
168 |
</p>
|
169 |
<p>
|
170 |
+
<label><input type="checkbox" name="thumbFix" id="thumbFix" value="1" <?php checked( '1', $flag->options['thumbFix'] ); ?> /> <?php _e( 'Ignore the aspect ratio, no portrait thumbnails', 'flag' ); ?>
|
171 |
</label></p>
|
172 |
|
173 |
<div class="submit">
|
174 |
<span class="useflashupload">
|
175 |
+
<?php if ( $flag->options['swfUpload'] ) { ?>
|
176 |
+
<input type="submit" class="button-secondary" name="disable_flash" id="disable_flash" title="<?php _e( 'The batch upload via Plupload, disable it if you have problems', 'flag' ); ?>" value="<?php _e( 'Switch to Browser Upload', 'flag' ); ?>"/>
|
177 |
+
<?php } else { ?>
|
178 |
+
<input type="submit" class="button-secondary" name="enable_flash" id="enable_flash" title="<?php _e( 'Upload multiple files at once by ctrl/shift-selecting in dialog', 'flag' ); ?>" value="<?php _e( 'Switch to Plupload based Upload', 'flag' ); ?>"/>
|
179 |
<?php } ?>
|
180 |
</span>
|
181 |
|
186 |
|
187 |
<td>
|
188 |
<div id="pluploadUploader">
|
189 |
+
<?php if ( ! $flag->options['swfUpload']) { ?>
|
190 |
+
<strong><?php _e( 'Upload image(s):', 'flag' ); ?></strong><br>
|
191 |
<input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/>
|
192 |
</div>
|
193 |
<span id="choosegalfirst">
|
194 |
+
<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e( 'Upload images', 'flag' ); ?>"/>
|
195 |
<span class="disabledbut" style="display: none;"></span>
|
196 |
</span>
|
197 |
<?php } ?>
|
200 |
</table>
|
201 |
<div id="pl-message"></div>
|
202 |
</form>
|
203 |
+
<?php if ( $flag->options['swfUpload'] ) {
|
204 |
+
$nonce = wp_create_nonce( 'flag_upload' );
|
205 |
?>
|
206 |
<script type="text/javascript">
|
207 |
// Convert divs to queue widgets when the DOM is ready
|
333 |
|
334 |
<?php } ?>
|
335 |
</div>
|
336 |
+
<?php if ( ! IS_WPMU || current_user_can( 'FlAG Import folder' ) ) { ?>
|
337 |
<!-- import folder -->
|
338 |
<div id="importfolder" class="cptab">
|
339 |
+
<h2><?php _e( 'Import image folder', 'flag' ); ?></h2>
|
340 |
|
341 |
<form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
342 |
+
<?php wp_nonce_field( 'flag_addgallery' ); ?>
|
343 |
<table class="form-table">
|
344 |
<tr valign="top">
|
345 |
+
<th scope="row"><?php _e( 'Import from Server path:', 'flag' ); ?></th>
|
346 |
<td>
|
347 |
+
<input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php echo $defaultpath; ?>"/><span class="browsefiles button" style="display:none"><?php _e( 'Browse...', "flag" ); ?></span>
|
348 |
|
349 |
<div id="file_browser"></div>
|
350 |
<div><?php echo $maxsize; ?>
|
351 |
+
<?php if ( SAFE_MODE ) { ?>
|
352 |
+
<br/><?php _e( ' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'flag' ); ?><?php }; ?>
|
353 |
</div>
|
354 |
</td>
|
355 |
</tr>
|
356 |
</table>
|
357 |
<div class="submit">
|
358 |
+
<input class="button-primary" type="submit" name="importfolder" value="<?php _e( 'Import folder', 'flag' ); ?>"/>
|
359 |
</div>
|
360 |
</form>
|
361 |
</div>
|
admin/admin.php
CHANGED
@@ -7,45 +7,45 @@
|
|
7 |
class flagAdminPanel {
|
8 |
|
9 |
// constructor
|
10 |
-
function flagAdminPanel(){
|
11 |
|
12 |
// Add the admin menu
|
13 |
-
add_action('admin_menu', array(&$this, 'add_menu'));
|
14 |
-
add_action('init', array(&$this, 'wp_flag_check_options'), 2);
|
15 |
|
16 |
// Add the script and style files
|
17 |
-
add_action('admin_print_scripts', array(&$this, 'load_scripts'));
|
18 |
-
add_action('admin_print_styles', array(&$this, 'load_styles'));
|
19 |
|
20 |
-
add_filter('contextual_help', array(&$this, 'show_help'), 10, 2);
|
21 |
-
add_filter('screen_meta_screen', array(&$this, 'edit_screen_meta'));
|
22 |
}
|
23 |
|
24 |
-
function wp_flag_check_options(){
|
25 |
global $flag;
|
26 |
-
require_once(dirname(__FILE__) . '/flag_install.php');
|
27 |
$default_options = flag_list_options();
|
28 |
-
$flag_db_options = get_option('flag_options');
|
29 |
-
if($flag_db_options){
|
30 |
-
if(function_exists('array_diff_key')){
|
31 |
-
$flag_new_options = array_diff_key($default_options, $flag_db_options);
|
32 |
-
} else{
|
33 |
-
$flag_new_options = $this->PHP4_array_diff_key($default_options, $flag_db_options);
|
34 |
}
|
35 |
-
$flag_options = array_merge($flag_db_options, $flag_new_options);
|
36 |
-
update_option('flag_options', $flag_options);
|
37 |
-
} else{
|
38 |
-
update_option('flag_options', $default_options);
|
39 |
}
|
40 |
}
|
41 |
|
42 |
-
function PHP4_array_diff_key(){
|
43 |
-
$arrs
|
44 |
-
$result = array_shift($arrs);
|
45 |
-
foreach($arrs as $array){
|
46 |
-
foreach($result as $key => $v){
|
47 |
-
if(array_key_exists($key, $array)){
|
48 |
-
unset($result[$key]);
|
49 |
}
|
50 |
}
|
51 |
}
|
@@ -54,49 +54,49 @@ class flagAdminPanel {
|
|
54 |
}
|
55 |
|
56 |
// integrate the menu
|
57 |
-
function add_menu(){
|
58 |
|
59 |
-
add_menu_page(__('GRAND Flash Album Gallery overview', 'flag'), __('FlAGallery'), 'FlAG overview', 'flag-overview', array(
|
60 |
&$this,
|
61 |
'show_menu'
|
62 |
-
), FLAG_URLPATH . 'admin/images/flag.png');
|
63 |
-
add_submenu_page('flag-overview', __('GRAND Flash Album Gallery overview', 'flag'), __('Overview', 'flag'), 'FlAG overview', 'flag-overview', array(
|
64 |
&$this,
|
65 |
'show_menu'
|
66 |
-
));
|
67 |
-
add_submenu_page('flag-overview', __('FlAG Manage gallery', 'flag'), __('Manage Galleries', 'flag'), 'FlAG Manage gallery', 'flag-manage-gallery', array(
|
68 |
&$this,
|
69 |
'show_menu'
|
70 |
-
));
|
71 |
-
add_submenu_page('flag-overview', __('FlAG Music Box', 'flag'), __('Music Box', 'flag'), 'FlAG Manage music', 'flag-music-box', array(
|
72 |
&$this,
|
73 |
'show_menu'
|
74 |
-
));
|
75 |
-
add_submenu_page('flag-overview', __('FlAG Video Box', 'flag'), __('Video Box', 'flag'), 'FlAG Manage video', 'flag-video-box', array(
|
76 |
&$this,
|
77 |
'show_menu'
|
78 |
-
));
|
79 |
-
add_submenu_page('flag-overview', __('FlAG Banner Box', 'flag'), __('Banner Box', 'flag'), 'FlAG Manage banners', 'flag-banner-box', array(
|
80 |
&$this,
|
81 |
'show_menu'
|
82 |
-
));
|
83 |
-
add_submenu_page('flag-overview', __('FlAG Manage skins', 'flag'), __('Skins', 'flag'), 'FlAG Change skin', 'flag-skins', array(
|
84 |
&$this,
|
85 |
'show_menu'
|
86 |
-
));
|
87 |
-
add_submenu_page('flag-overview', __('FlAG Change options', 'flag'), __('Options', 'flag'), 'FlAG Change options', 'flag-options', array(
|
88 |
&$this,
|
89 |
'show_menu'
|
90 |
-
));
|
91 |
-
add_submenu_page('flag-overview', __('Flagallery in iframe', 'flag'), __('Iframe', 'flag'), 'FlAG iFrame page', 'flag-iframe', array(
|
92 |
&$this,
|
93 |
'show_menu'
|
94 |
-
));
|
95 |
-
if(flag_wpmu_site_admin()){
|
96 |
-
add_submenu_page('wpmu-admin.php', __('GRAND Flash Album Gallery', 'flag'), __('Grand Flagallery', 'flag'), 'activate_plugins', 'flag-wpmu', array(
|
97 |
&$this,
|
98 |
'show_menu'
|
99 |
-
));
|
100 |
}
|
101 |
|
102 |
//register the column fields
|
@@ -105,20 +105,20 @@ class flagAdminPanel {
|
|
105 |
}
|
106 |
|
107 |
// load the script for the defined page and load only this code
|
108 |
-
function show_menu(){
|
109 |
|
110 |
global $flag;
|
111 |
|
112 |
// Set installation date
|
113 |
-
if(empty($flag->options['installDate'])){
|
114 |
$flag->options['installDate'] = time();
|
115 |
-
update_option('flag_options', $flag->options);
|
116 |
}
|
117 |
|
118 |
-
switch($_GET['page']){
|
119 |
case "flag-manage-gallery" :
|
120 |
-
include_once(dirname(__FILE__) . '/functions.php'); // admin functions
|
121 |
-
include_once(dirname(__FILE__) . '/manage.php'); // flag_admin_manage_gallery
|
122 |
// Initate the Manage Gallery page
|
123 |
$flag->manage_page = new flagManageGallery();
|
124 |
// Render the output now, because you cannot access a object during the constructor is not finished
|
@@ -126,103 +126,103 @@ class flagAdminPanel {
|
|
126 |
|
127 |
break;
|
128 |
case "flag-music-box" :
|
129 |
-
include_once(dirname(__FILE__) . '/music-box.php'); // flag_music_box
|
130 |
flag_music_controler();
|
131 |
break;
|
132 |
case "flag-video-box" :
|
133 |
-
include_once(dirname(__FILE__) . '/video-box.php'); // flag_video_box
|
134 |
flag_video_controler();
|
135 |
break;
|
136 |
case "flag-banner-box" :
|
137 |
-
include_once(dirname(__FILE__) . '/banner-box.php'); // flag_banner_box
|
138 |
flag_banner_controler();
|
139 |
break;
|
140 |
case "flag-options" :
|
141 |
-
include_once(dirname(__FILE__) . '/settings.php'); // flag_admin_options
|
142 |
flag_admin_options();
|
143 |
break;
|
144 |
case "flag-skins" :
|
145 |
-
include_once(dirname(__FILE__) . '/skins.php'); // flag_manage_skins
|
146 |
break;
|
147 |
case "flag-iframe" :
|
148 |
-
include_once(dirname(__FILE__) . '/flagframe-tool.php'); // flagframe-tool
|
149 |
break;
|
150 |
case "flag-wpmu" :
|
151 |
-
include_once(dirname(__FILE__) . '/wpmu.php'); // flag_wpmu_admin
|
152 |
flag_wpmu_setup();
|
153 |
break;
|
154 |
default :
|
155 |
-
include_once(dirname(__FILE__) . '/overview.php'); // flag_admin_overview
|
156 |
flag_admin_overview();
|
157 |
break;
|
158 |
}
|
159 |
}
|
160 |
|
161 |
-
function load_scripts(){
|
162 |
-
|
163 |
-
wp_register_script('flag-ajax', FLAG_URLPATH . 'admin/js/flag.ajax.js', array('jquery'), '1.4.0');
|
164 |
-
wp_localize_script('flag-ajax', 'flagAjaxSetup', array(
|
165 |
-
'url'
|
166 |
-
'action'
|
167 |
-
'operation'
|
168 |
-
'nonce'
|
169 |
-
'ids'
|
170 |
-
'permission' => __('You do not have the correct permission', 'flag'),
|
171 |
-
'error'
|
172 |
-
'failure'
|
173 |
-
));
|
174 |
-
wp_register_script('flag-progressbar', FLAG_URLPATH . 'admin/js/flag.progressbar.js', array('jquery'), '1.0.0');
|
175 |
-
|
176 |
-
if(isset($_GET['page'])){
|
177 |
-
switch($_GET['page']){
|
178 |
case 'flag-overview' :
|
179 |
-
wp_enqueue_script('postbox');
|
180 |
case "flag-manage-gallery" :
|
181 |
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
182 |
|
183 |
-
wp_enqueue_style('jquery-ui-smoothness', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.min.css', array(), '1.10.4', 'screen');
|
184 |
-
wp_enqueue_script('jquery-ui-full', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js', array('jquery'), '1.10.4');
|
185 |
|
186 |
-
wp_enqueue_script('jquery-ui-droppable');
|
187 |
|
188 |
-
wp_enqueue_script('multifile', FLAG_URLPATH . 'admin/js/jquery.MultiFile.js', array('jquery'), '1.4.6');
|
189 |
|
190 |
-
wp_enqueue_script('flag-plupload', FLAG_URLPATH . 'admin/js/plupload/plupload.full.min.js', array(
|
191 |
'jquery',
|
192 |
'jquery-ui-full'
|
193 |
-
), '2.1.1');
|
194 |
|
195 |
-
wp_enqueue_style('jquery.ui.plupload', FLAG_URLPATH . 'admin/js/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css', array('jquery-ui-smoothness'), '2.1.1', 'screen');
|
196 |
-
wp_enqueue_script('jquery.ui.plupload', FLAG_URLPATH . 'admin/js/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js', array(
|
197 |
'flag-plupload',
|
198 |
'jquery-ui-full'
|
199 |
-
), '2.1.1');
|
200 |
|
201 |
|
202 |
-
wp_enqueue_script('dataset', FLAG_URLPATH . 'admin/js/jquery.dataset.js', array('jquery'), '0.1.0');
|
203 |
-
wp_enqueue_script('postbox');
|
204 |
-
wp_enqueue_script('flag-ajax');
|
205 |
-
wp_enqueue_script('flag-progressbar');
|
206 |
add_thickbox();
|
207 |
break;
|
208 |
case "flag-music-box" :
|
209 |
-
wp_enqueue_script('swfobject');
|
210 |
-
wp_enqueue_script('thickbox');
|
211 |
break;
|
212 |
case "flag-video-box" :
|
213 |
-
wp_enqueue_script('swfobject');
|
214 |
-
wp_enqueue_script('thickbox');
|
215 |
break;
|
216 |
case "flag-banner-box" :
|
217 |
-
wp_enqueue_script('thickbox');
|
218 |
break;
|
219 |
case "flag-options" :
|
220 |
-
wp_enqueue_script('farbtastic-nosharp', FLAG_URLPATH . 'admin/js/farbtastic-nosharp.js', array('jquery'), '1.2');
|
221 |
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
222 |
break;
|
223 |
case "flag-skins" :
|
224 |
-
wp_enqueue_script('thickbox');
|
225 |
-
wp_enqueue_script('farbtastic-nosharp', FLAG_URLPATH . 'admin/js/farbtastic-nosharp.js', array('jquery'), '1.2');
|
226 |
//wp_enqueue_script( 'farbtastic' );
|
227 |
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
228 |
break;
|
@@ -230,42 +230,42 @@ class flagAdminPanel {
|
|
230 |
}
|
231 |
}
|
232 |
|
233 |
-
function load_styles(){
|
234 |
|
235 |
-
if(isset($_GET['page'])){
|
236 |
-
switch($_GET['page']){
|
237 |
case 'flag-overview' :
|
238 |
-
wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen');
|
239 |
-
wp_admin_css('css/dashboard');
|
240 |
break;
|
241 |
case "flag-options" :
|
242 |
-
wp_enqueue_style('farbtastic');
|
243 |
case "flag-manage-gallery" :
|
244 |
-
wp_enqueue_style('flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '4.3.0', 'screen');
|
245 |
case "flag-music-box" :
|
246 |
case "flag-video-box" :
|
247 |
case "flag-banner-box" :
|
248 |
-
wp_enqueue_style('thickbox');
|
249 |
-
wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen');
|
250 |
break;
|
251 |
case "flag-skins" :
|
252 |
-
wp_enqueue_style('thickbox');
|
253 |
-
wp_enqueue_style('farbtastic');
|
254 |
-
wp_enqueue_style('flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '4.3.0', 'screen');
|
255 |
-
wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen');
|
256 |
-
wp_admin_css('css/dashboard');
|
257 |
break;
|
258 |
}
|
259 |
}
|
260 |
}
|
261 |
|
262 |
-
function show_help($help, $screen){
|
263 |
|
264 |
$link = '';
|
265 |
// menu title is localized...
|
266 |
-
$i18n = strtolower(_n('Gallery', 'Galleries', 1, 'flag'));
|
267 |
|
268 |
-
switch($screen){
|
269 |
case 'toplevel_page_' . 'flag-overview' :
|
270 |
case "{$i18n}_page_flag-manage-gallery" :
|
271 |
case "flag-manage-gallery":
|
@@ -276,38 +276,38 @@ class flagAdminPanel {
|
|
276 |
break;
|
277 |
}
|
278 |
|
279 |
-
if(!empty($link)){
|
280 |
-
$help = '<h5>' . __('Get help with Grand Flagallery', 'flag') . '</h5>';
|
281 |
$help .= '<div class="metabox-prefs">';
|
282 |
$help .= $link;
|
283 |
$help .= "</div>\n";
|
284 |
-
$help .= '<h5>' . __('More Help & Info', 'flag') . '</h5>';
|
285 |
$help .= '<div class="metabox-prefs">';
|
286 |
-
$help .= '<a href="http://codeasily.com/community/topic/video-tutorials/" target="_blank">' . __('Grand Flagallery Video Tutorial', 'flag') . '</a>';
|
287 |
-
$help .= ' | <a href="http://codeasily.com/community/forum/flagallery-wordpress-plugin/" target="_blank">' . __('Forum', 'flag') . '</a>';
|
288 |
-
$help .= ' | <a href="http://codeasily.com/community/topic/language-files/" target="_blank">' . __('Get your language pack', 'flag') . '</a>';
|
289 |
-
$help .= ' | <a href="http://codeasily.com/portfolio/grand-flagallery-skins/" target="_blank">' . __('Skins for Grand Flagallery', 'flag') . '</a>';
|
290 |
$help .= "</div>\n";
|
291 |
}
|
292 |
|
293 |
return $help;
|
294 |
}
|
295 |
|
296 |
-
function edit_screen_meta($screen){
|
297 |
|
298 |
// menu title is localized, so we need to change the toplevel name
|
299 |
-
$i18n = strtolower(_n('Gallery', 'Galleries', 1, 'flag'));
|
300 |
|
301 |
-
switch($screen){
|
302 |
case "{$i18n}_page_flag-manage-gallery" :
|
303 |
// we would like to have screen option only at the manage images / gallery page
|
304 |
-
if(isset ($_POST['sortGallery'])){
|
305 |
$screen = $screen;
|
306 |
-
} else if(($_GET['mode'] == 'edit') || isset ($_POST['backToGallery'])){
|
307 |
$screen = 'flag-manage-images';
|
308 |
-
} else if(($_GET['mode'] == 'sort')){
|
309 |
$screen = $screen;
|
310 |
-
} else{
|
311 |
$screen = 'flag-manage-gallery';
|
312 |
}
|
313 |
break;
|
@@ -316,27 +316,27 @@ class flagAdminPanel {
|
|
316 |
return $screen;
|
317 |
}
|
318 |
|
319 |
-
function register_column_headers($screen, $columns){
|
320 |
global $_wp_column_headers;
|
321 |
|
322 |
-
if(!isset($_wp_column_headers)){
|
323 |
$_wp_column_headers = array();
|
324 |
}
|
325 |
|
326 |
-
$_wp_column_headers[$screen] = $columns;
|
327 |
}
|
328 |
|
329 |
-
function register_columns(){
|
330 |
-
include_once(dirname(__FILE__) . '/manage-images.php');
|
331 |
-
$this->register_column_headers('flag-manage-images', flag_manage_gallery_columns());
|
332 |
}
|
333 |
|
334 |
}
|
335 |
|
336 |
-
function flag_wpmu_site_admin(){
|
337 |
// Check for site admin
|
338 |
-
if(function_exists('is_site_admin')){
|
339 |
-
if(is_super_admin()){
|
340 |
return true;
|
341 |
}
|
342 |
}
|
7 |
class flagAdminPanel {
|
8 |
|
9 |
// constructor
|
10 |
+
function flagAdminPanel() {
|
11 |
|
12 |
// Add the admin menu
|
13 |
+
add_action( 'admin_menu', array( &$this, 'add_menu' ) );
|
14 |
+
add_action( 'init', array( &$this, 'wp_flag_check_options' ), 2 );
|
15 |
|
16 |
// Add the script and style files
|
17 |
+
add_action( 'admin_print_scripts', array( &$this, 'load_scripts' ) );
|
18 |
+
add_action( 'admin_print_styles', array( &$this, 'load_styles' ) );
|
19 |
|
20 |
+
add_filter( 'contextual_help', array( &$this, 'show_help' ), 10, 2 );
|
21 |
+
add_filter( 'screen_meta_screen', array( &$this, 'edit_screen_meta' ) );
|
22 |
}
|
23 |
|
24 |
+
function wp_flag_check_options() {
|
25 |
global $flag;
|
26 |
+
require_once( dirname( __FILE__ ) . '/flag_install.php' );
|
27 |
$default_options = flag_list_options();
|
28 |
+
$flag_db_options = get_option( 'flag_options' );
|
29 |
+
if ( $flag_db_options ) {
|
30 |
+
if ( function_exists( 'array_diff_key' ) ) {
|
31 |
+
$flag_new_options = array_diff_key( $default_options, $flag_db_options );
|
32 |
+
} else {
|
33 |
+
$flag_new_options = $this->PHP4_array_diff_key( $default_options, $flag_db_options );
|
34 |
}
|
35 |
+
$flag_options = array_merge( $flag_db_options, $flag_new_options );
|
36 |
+
update_option( 'flag_options', $flag_options );
|
37 |
+
} else {
|
38 |
+
update_option( 'flag_options', $default_options );
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
function PHP4_array_diff_key() {
|
43 |
+
$arrs = func_get_args();
|
44 |
+
$result = array_shift( $arrs );
|
45 |
+
foreach ( $arrs as $array ) {
|
46 |
+
foreach ( $result as $key => $v ) {
|
47 |
+
if ( array_key_exists( $key, $array ) ) {
|
48 |
+
unset( $result[ $key ] );
|
49 |
}
|
50 |
}
|
51 |
}
|
54 |
}
|
55 |
|
56 |
// integrate the menu
|
57 |
+
function add_menu() {
|
58 |
|
59 |
+
add_menu_page( __( 'GRAND Flash Album Gallery overview', 'flag' ), __( 'FlAGallery' ), 'FlAG overview', 'flag-overview', array(
|
60 |
&$this,
|
61 |
'show_menu'
|
62 |
+
), FLAG_URLPATH . 'admin/images/flag.png' );
|
63 |
+
add_submenu_page( 'flag-overview', __( 'GRAND Flash Album Gallery overview', 'flag' ), __( 'Overview', 'flag' ), 'FlAG overview', 'flag-overview', array(
|
64 |
&$this,
|
65 |
'show_menu'
|
66 |
+
) );
|
67 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Manage gallery', 'flag' ), __( 'Manage Galleries', 'flag' ), 'FlAG Manage gallery', 'flag-manage-gallery', array(
|
68 |
&$this,
|
69 |
'show_menu'
|
70 |
+
) );
|
71 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Music Box', 'flag' ), __( 'Music Box', 'flag' ), 'FlAG Manage music', 'flag-music-box', array(
|
72 |
&$this,
|
73 |
'show_menu'
|
74 |
+
) );
|
75 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Video Box', 'flag' ), __( 'Video Box', 'flag' ), 'FlAG Manage video', 'flag-video-box', array(
|
76 |
&$this,
|
77 |
'show_menu'
|
78 |
+
) );
|
79 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Banner Box', 'flag' ), __( 'Banner Box', 'flag' ), 'FlAG Manage banners', 'flag-banner-box', array(
|
80 |
&$this,
|
81 |
'show_menu'
|
82 |
+
) );
|
83 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Manage skins', 'flag' ), __( 'Skins', 'flag' ), 'FlAG Change skin', 'flag-skins', array(
|
84 |
&$this,
|
85 |
'show_menu'
|
86 |
+
) );
|
87 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Change options', 'flag' ), __( 'Options', 'flag' ), 'FlAG Change options', 'flag-options', array(
|
88 |
&$this,
|
89 |
'show_menu'
|
90 |
+
) );
|
91 |
+
add_submenu_page( 'flag-overview', __( 'Flagallery in iframe', 'flag' ), __( 'Iframe', 'flag' ), 'FlAG iFrame page', 'flag-iframe', array(
|
92 |
&$this,
|
93 |
'show_menu'
|
94 |
+
) );
|
95 |
+
if ( flag_wpmu_site_admin() ) {
|
96 |
+
add_submenu_page( 'wpmu-admin.php', __( 'GRAND Flash Album Gallery', 'flag' ), __( 'Grand Flagallery', 'flag' ), 'activate_plugins', 'flag-wpmu', array(
|
97 |
&$this,
|
98 |
'show_menu'
|
99 |
+
) );
|
100 |
}
|
101 |
|
102 |
//register the column fields
|
105 |
}
|
106 |
|
107 |
// load the script for the defined page and load only this code
|
108 |
+
function show_menu() {
|
109 |
|
110 |
global $flag;
|
111 |
|
112 |
// Set installation date
|
113 |
+
if ( empty( $flag->options['installDate'] ) ) {
|
114 |
$flag->options['installDate'] = time();
|
115 |
+
update_option( 'flag_options', $flag->options );
|
116 |
}
|
117 |
|
118 |
+
switch ( $_GET['page'] ) {
|
119 |
case "flag-manage-gallery" :
|
120 |
+
include_once( dirname( __FILE__ ) . '/functions.php' ); // admin functions
|
121 |
+
include_once( dirname( __FILE__ ) . '/manage.php' ); // flag_admin_manage_gallery
|
122 |
// Initate the Manage Gallery page
|
123 |
$flag->manage_page = new flagManageGallery();
|
124 |
// Render the output now, because you cannot access a object during the constructor is not finished
|
126 |
|
127 |
break;
|
128 |
case "flag-music-box" :
|
129 |
+
include_once( dirname( __FILE__ ) . '/music-box.php' ); // flag_music_box
|
130 |
flag_music_controler();
|
131 |
break;
|
132 |
case "flag-video-box" :
|
133 |
+
include_once( dirname( __FILE__ ) . '/video-box.php' ); // flag_video_box
|
134 |
flag_video_controler();
|
135 |
break;
|
136 |
case "flag-banner-box" :
|
137 |
+
include_once( dirname( __FILE__ ) . '/banner-box.php' ); // flag_banner_box
|
138 |
flag_banner_controler();
|
139 |
break;
|
140 |
case "flag-options" :
|
141 |
+
include_once( dirname( __FILE__ ) . '/settings.php' ); // flag_admin_options
|
142 |
flag_admin_options();
|
143 |
break;
|
144 |
case "flag-skins" :
|
145 |
+
include_once( dirname( __FILE__ ) . '/skins.php' ); // flag_manage_skins
|
146 |
break;
|
147 |
case "flag-iframe" :
|
148 |
+
include_once( dirname( __FILE__ ) . '/flagframe-tool.php' ); // flagframe-tool
|
149 |
break;
|
150 |
case "flag-wpmu" :
|
151 |
+
include_once( dirname( __FILE__ ) . '/wpmu.php' ); // flag_wpmu_admin
|
152 |
flag_wpmu_setup();
|
153 |
break;
|
154 |
default :
|
155 |
+
include_once( dirname( __FILE__ ) . '/overview.php' ); // flag_admin_overview
|
156 |
flag_admin_overview();
|
157 |
break;
|
158 |
}
|
159 |
}
|
160 |
|
161 |
+
function load_scripts() {
|
162 |
+
|
163 |
+
wp_register_script( 'flag-ajax', FLAG_URLPATH . 'admin/js/flag.ajax.js', array( 'jquery' ), '1.4.0' );
|
164 |
+
wp_localize_script( 'flag-ajax', 'flagAjaxSetup', array(
|
165 |
+
'url' => admin_url( 'admin-ajax.php' ),
|
166 |
+
'action' => 'flag_ajax_operation',
|
167 |
+
'operation' => '',
|
168 |
+
'nonce' => wp_create_nonce( 'flag-ajax' ),
|
169 |
+
'ids' => '',
|
170 |
+
'permission' => __( 'You do not have the correct permission', 'flag' ),
|
171 |
+
'error' => __( 'Unexpected Error', 'flag' ),
|
172 |
+
'failure' => __( 'A failure occurred', 'flag' )
|
173 |
+
) );
|
174 |
+
wp_register_script( 'flag-progressbar', FLAG_URLPATH . 'admin/js/flag.progressbar.js', array( 'jquery' ), '1.0.0' );
|
175 |
+
|
176 |
+
if ( isset( $_GET['page'] ) ) {
|
177 |
+
switch ( $_GET['page'] ) {
|
178 |
case 'flag-overview' :
|
179 |
+
wp_enqueue_script( 'postbox' );
|
180 |
case "flag-manage-gallery" :
|
181 |
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
182 |
|
183 |
+
wp_enqueue_style( 'jquery-ui-smoothness', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.min.css', array(), '1.10.4', 'screen' );
|
184 |
+
wp_enqueue_script( 'jquery-ui-full', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js', array( 'jquery' ), '1.10.4' );
|
185 |
|
186 |
+
wp_enqueue_script( 'jquery-ui-droppable' );
|
187 |
|
188 |
+
wp_enqueue_script( 'multifile', FLAG_URLPATH . 'admin/js/jquery.MultiFile.js', array( 'jquery' ), '1.4.6' );
|
189 |
|
190 |
+
wp_enqueue_script( 'flag-plupload', FLAG_URLPATH . 'admin/js/plupload/plupload.full.min.js', array(
|
191 |
'jquery',
|
192 |
'jquery-ui-full'
|
193 |
+
), '2.1.1' );
|
194 |
|
195 |
+
wp_enqueue_style( 'jquery.ui.plupload', FLAG_URLPATH . 'admin/js/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css', array( 'jquery-ui-smoothness' ), '2.1.1', 'screen' );
|
196 |
+
wp_enqueue_script( 'jquery.ui.plupload', FLAG_URLPATH . 'admin/js/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js', array(
|
197 |
'flag-plupload',
|
198 |
'jquery-ui-full'
|
199 |
+
), '2.1.1' );
|
200 |
|
201 |
|
202 |
+
wp_enqueue_script( 'dataset', FLAG_URLPATH . 'admin/js/jquery.dataset.js', array( 'jquery' ), '0.1.0' );
|
203 |
+
wp_enqueue_script( 'postbox' );
|
204 |
+
wp_enqueue_script( 'flag-ajax' );
|
205 |
+
wp_enqueue_script( 'flag-progressbar' );
|
206 |
add_thickbox();
|
207 |
break;
|
208 |
case "flag-music-box" :
|
209 |
+
wp_enqueue_script( 'swfobject' );
|
210 |
+
wp_enqueue_script( 'thickbox' );
|
211 |
break;
|
212 |
case "flag-video-box" :
|
213 |
+
wp_enqueue_script( 'swfobject' );
|
214 |
+
wp_enqueue_script( 'thickbox' );
|
215 |
break;
|
216 |
case "flag-banner-box" :
|
217 |
+
wp_enqueue_script( 'thickbox' );
|
218 |
break;
|
219 |
case "flag-options" :
|
220 |
+
wp_enqueue_script( 'farbtastic-nosharp', FLAG_URLPATH . 'admin/js/farbtastic-nosharp.js', array( 'jquery' ), '1.2' );
|
221 |
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
222 |
break;
|
223 |
case "flag-skins" :
|
224 |
+
wp_enqueue_script( 'thickbox' );
|
225 |
+
wp_enqueue_script( 'farbtastic-nosharp', FLAG_URLPATH . 'admin/js/farbtastic-nosharp.js', array( 'jquery' ), '1.2' );
|
226 |
//wp_enqueue_script( 'farbtastic' );
|
227 |
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
228 |
break;
|
230 |
}
|
231 |
}
|
232 |
|
233 |
+
function load_styles() {
|
234 |
|
235 |
+
if ( isset( $_GET['page'] ) ) {
|
236 |
+
switch ( $_GET['page'] ) {
|
237 |
case 'flag-overview' :
|
238 |
+
wp_enqueue_style( 'flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen' );
|
239 |
+
wp_admin_css( 'css/dashboard' );
|
240 |
break;
|
241 |
case "flag-options" :
|
242 |
+
wp_enqueue_style( 'farbtastic' );
|
243 |
case "flag-manage-gallery" :
|
244 |
+
wp_enqueue_style( 'flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '4.3.0', 'screen' );
|
245 |
case "flag-music-box" :
|
246 |
case "flag-video-box" :
|
247 |
case "flag-banner-box" :
|
248 |
+
wp_enqueue_style( 'thickbox' );
|
249 |
+
wp_enqueue_style( 'flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen' );
|
250 |
break;
|
251 |
case "flag-skins" :
|
252 |
+
wp_enqueue_style( 'thickbox' );
|
253 |
+
wp_enqueue_style( 'farbtastic' );
|
254 |
+
wp_enqueue_style( 'flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '4.3.0', 'screen' );
|
255 |
+
wp_enqueue_style( 'flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen' );
|
256 |
+
wp_admin_css( 'css/dashboard' );
|
257 |
break;
|
258 |
}
|
259 |
}
|
260 |
}
|
261 |
|
262 |
+
function show_help( $help, $screen ) {
|
263 |
|
264 |
$link = '';
|
265 |
// menu title is localized...
|
266 |
+
$i18n = strtolower( _n( 'Gallery', 'Galleries', 1, 'flag' ) );
|
267 |
|
268 |
+
switch ( $screen ) {
|
269 |
case 'toplevel_page_' . 'flag-overview' :
|
270 |
case "{$i18n}_page_flag-manage-gallery" :
|
271 |
case "flag-manage-gallery":
|
276 |
break;
|
277 |
}
|
278 |
|
279 |
+
if ( ! empty( $link ) ) {
|
280 |
+
$help = '<h5>' . __( 'Get help with Grand Flagallery', 'flag' ) . '</h5>';
|
281 |
$help .= '<div class="metabox-prefs">';
|
282 |
$help .= $link;
|
283 |
$help .= "</div>\n";
|
284 |
+
$help .= '<h5>' . __( 'More Help & Info', 'flag' ) . '</h5>';
|
285 |
$help .= '<div class="metabox-prefs">';
|
286 |
+
$help .= '<a href="http://codeasily.com/community/topic/video-tutorials/" target="_blank">' . __( 'Grand Flagallery Video Tutorial', 'flag' ) . '</a>';
|
287 |
+
$help .= ' | <a href="http://codeasily.com/community/forum/flagallery-wordpress-plugin/" target="_blank">' . __( 'Forum', 'flag' ) . '</a>';
|
288 |
+
$help .= ' | <a href="http://codeasily.com/community/topic/language-files/" target="_blank">' . __( 'Get your language pack', 'flag' ) . '</a>';
|
289 |
+
$help .= ' | <a href="http://codeasily.com/portfolio/grand-flagallery-skins/" target="_blank">' . __( 'Skins for Grand Flagallery', 'flag' ) . '</a>';
|
290 |
$help .= "</div>\n";
|
291 |
}
|
292 |
|
293 |
return $help;
|
294 |
}
|
295 |
|
296 |
+
function edit_screen_meta( $screen ) {
|
297 |
|
298 |
// menu title is localized, so we need to change the toplevel name
|
299 |
+
$i18n = strtolower( _n( 'Gallery', 'Galleries', 1, 'flag' ) );
|
300 |
|
301 |
+
switch ( $screen ) {
|
302 |
case "{$i18n}_page_flag-manage-gallery" :
|
303 |
// we would like to have screen option only at the manage images / gallery page
|
304 |
+
if ( isset ( $_POST['sortGallery'] ) ) {
|
305 |
$screen = $screen;
|
306 |
+
} else if ( ( $_GET['mode'] == 'edit' ) || isset ( $_POST['backToGallery'] ) ) {
|
307 |
$screen = 'flag-manage-images';
|
308 |
+
} else if ( ( $_GET['mode'] == 'sort' ) ) {
|
309 |
$screen = $screen;
|
310 |
+
} else {
|
311 |
$screen = 'flag-manage-gallery';
|
312 |
}
|
313 |
break;
|
316 |
return $screen;
|
317 |
}
|
318 |
|
319 |
+
function register_column_headers( $screen, $columns ) {
|
320 |
global $_wp_column_headers;
|
321 |
|
322 |
+
if ( ! isset( $_wp_column_headers ) ) {
|
323 |
$_wp_column_headers = array();
|
324 |
}
|
325 |
|
326 |
+
$_wp_column_headers[ $screen ] = $columns;
|
327 |
}
|
328 |
|
329 |
+
function register_columns() {
|
330 |
+
include_once( dirname( __FILE__ ) . '/manage-images.php' );
|
331 |
+
$this->register_column_headers( 'flag-manage-images', flag_manage_gallery_columns() );
|
332 |
}
|
333 |
|
334 |
}
|
335 |
|
336 |
+
function flag_wpmu_site_admin() {
|
337 |
// Check for site admin
|
338 |
+
if ( function_exists( 'is_site_admin' ) ) {
|
339 |
+
if ( is_super_admin() ) {
|
340 |
return true;
|
341 |
}
|
342 |
}
|
admin/ajax.php
CHANGED
@@ -1,206 +1,216 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
add_action('wp_ajax_flag_ajax_operation', 'flag_ajax_operation' );
|
4 |
|
5 |
function flag_ajax_operation() {
|
6 |
global $wpdb;
|
7 |
// if nonce is not correct it returns -1
|
8 |
check_ajax_referer( "flag-ajax" );
|
9 |
// check for correct capability
|
10 |
-
if ( !is_user_logged_in() )
|
11 |
-
die('-1');
|
|
|
12 |
// check for correct FlAG capability
|
13 |
-
if ( !current_user_can('FlAG Upload images') || !current_user_can('FlAG Manage gallery') )
|
14 |
-
die('-1');
|
|
|
15 |
// include the flag function
|
16 |
-
include_once (
|
17 |
// Get the image id
|
18 |
-
if ( isset($_POST['image'])) {
|
19 |
$id = (int) $_POST['image'];
|
20 |
// let's get the image data
|
21 |
-
$picture = flagdb::find_image($id);
|
22 |
// what do you want to do ?
|
23 |
switch ( $_POST['operation'] ) {
|
24 |
case 'create_thumbnail' :
|
25 |
-
$result = flagAdmin::create_thumbnail($picture);
|
26 |
-
|
27 |
case 'resize_image' :
|
28 |
-
$result = flagAdmin::resize_image($picture);
|
29 |
-
|
30 |
case 'webview_image' :
|
31 |
-
$result = flagAdmin::webview_image($picture);
|
32 |
-
|
33 |
case 'import_metadata' :
|
34 |
$result = flagAdmin::import_MetaData( $id );
|
35 |
-
|
36 |
case 'copy_metadata' :
|
37 |
$result = flagAdmin::copy_MetaData( $id );
|
38 |
-
|
39 |
case 'get_image_ids' :
|
40 |
$result = flagAdmin::get_image_ids( $id );
|
41 |
-
|
42 |
default :
|
43 |
-
do_action( 'flag_ajax_' . sanitize_key($_POST['operation']) );
|
44 |
-
die('-1');
|
45 |
-
|
46 |
}
|
47 |
// A success should return a '1'
|
48 |
-
die ($result);
|
49 |
}
|
50 |
// The script should never stop here
|
51 |
-
die('0');
|
52 |
}
|
53 |
|
54 |
-
add_action('wp_ajax_flagCreateNewThumb', 'flagCreateNewThumb');
|
55 |
-
|
56 |
function flagCreateNewThumb() {
|
57 |
-
|
58 |
global $wpdb;
|
59 |
-
|
60 |
// check for correct capability
|
61 |
-
if ( !is_user_logged_in() )
|
62 |
-
die('-1');
|
|
|
63 |
// check for correct FlAG capability
|
64 |
-
if ( !current_user_can('FlAG Manage gallery') )
|
65 |
-
die('-1');
|
66 |
-
|
67 |
-
|
|
|
68 |
include_once( flagGallery::graphic_library() );
|
69 |
-
|
70 |
-
$flag_options=get_option('flag_options');
|
71 |
-
|
72 |
-
$id
|
73 |
-
$picture = flagdb::find_image($id);
|
74 |
-
|
75 |
-
$x = round( $_POST['x'] * $_POST['rr'], 0);
|
76 |
-
$y = round( $_POST['y'] * $_POST['rr'], 0);
|
77 |
-
$w = round( $_POST['w'] * $_POST['rr'], 0);
|
78 |
-
$h = round( $_POST['h'] * $_POST['rr'], 0);
|
79 |
-
|
80 |
-
$thumb = new flag_Thumbnail($picture->imagePath,
|
81 |
-
|
82 |
-
$thumb->crop($x, $y, $w, $h);
|
83 |
-
|
84 |
-
if ($flag_options['thumbFix'])
|
85 |
-
if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
|
86 |
-
$thumb->resize($flag_options['thumbWidth'], 0);
|
87 |
} else {
|
88 |
-
$thumb->resize(0
|
89 |
}
|
90 |
} else {
|
91 |
-
$thumb->resize($flag_options['thumbWidth']
|
92 |
}
|
93 |
|
94 |
-
if ( $thumb->save($picture->thumbPath, 100)) {
|
95 |
//read the new sizes
|
96 |
-
$new_size
|
97 |
-
$size['width']
|
98 |
-
$size['height'] = $new_size[1];
|
99 |
-
|
100 |
// add them to the database
|
101 |
-
flagdb::update_image_meta($picture->pid, array( 'thumbnail' => $size) );
|
102 |
|
103 |
echo "OK";
|
104 |
} else {
|
105 |
-
header('HTTP/1.1 500 Internal Server Error');
|
106 |
echo "KO";
|
107 |
}
|
108 |
-
|
109 |
exit();
|
110 |
-
|
111 |
}
|
112 |
|
113 |
-
add_action('wp_ajax_flag_save_album', 'flag_save_album');
|
114 |
-
|
115 |
function flag_save_album() {
|
116 |
-
|
117 |
global $wpdb;
|
118 |
-
|
119 |
// check for correct capability
|
120 |
-
if ( !is_user_logged_in() )
|
121 |
-
die('-1');
|
|
|
122 |
// check for correct FlAG capability
|
123 |
-
if ( !current_user_can('FlAG Manage others gallery') )
|
124 |
-
die('-1');
|
125 |
-
|
126 |
-
|
127 |
-
$
|
|
|
128 |
$album_name = '';
|
129 |
-
if(isset($_POST['form']))
|
130 |
-
parse_str($_POST['form']);
|
131 |
-
|
132 |
-
$
|
133 |
-
$
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
138 |
$galstring = '';
|
139 |
-
|
|
|
140 |
}
|
141 |
|
142 |
-
if($result) {
|
143 |
-
_e('Success','flag');
|
144 |
}
|
145 |
-
|
146 |
exit();
|
147 |
-
|
148 |
}
|
149 |
-
|
150 |
-
add_action('wp_ajax_flag_delete_album', 'flag_delete_album');
|
151 |
-
|
152 |
function flag_delete_album() {
|
153 |
-
|
154 |
global $wpdb;
|
155 |
-
|
156 |
// check for correct capability
|
157 |
-
if ( !is_user_logged_in() )
|
158 |
-
die('-1');
|
|
|
159 |
// check for correct FlAG capability
|
160 |
-
if ( !current_user_can('FlAG Manage gallery') )
|
161 |
-
die('-1');
|
|
|
162 |
|
163 |
$result = false;
|
164 |
-
if(isset($_POST['post'])) {
|
165 |
-
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->flagalbum} WHERE id = %d", $_POST['post']) );
|
166 |
}
|
167 |
|
168 |
-
if($result) {
|
169 |
-
_e('Success','flag');
|
170 |
}
|
171 |
|
172 |
exit();
|
173 |
-
|
174 |
}
|
175 |
-
|
176 |
-
add_action('wp_ajax_flag_banner_crunch', 'flag_banner_crunch');
|
177 |
-
|
178 |
function flag_banner_crunch() {
|
179 |
-
|
180 |
-
global $wpdb;
|
181 |
-
|
182 |
// check for correct capability
|
183 |
-
if ( !is_user_logged_in() )
|
184 |
-
die('-1');
|
|
|
185 |
// check for correct FlAG capability
|
186 |
-
if ( !current_user_can('FlAG Manage gallery') )
|
187 |
-
die('-1');
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
$
|
193 |
-
|
194 |
-
|
|
|
195 |
} else {
|
196 |
-
echo '<p class="success">' . sprintf(__('<em>%s</em> has been added to Media library', 'flag'), $file) . '</p>';
|
197 |
}
|
198 |
}
|
199 |
-
|
200 |
exit();
|
201 |
}
|
202 |
|
203 |
-
add_action('wp_ajax_flag_file_browser', 'flag_ajax_file_browser');
|
204 |
|
205 |
/**
|
206 |
* jQuery File Tree PHP Connector
|
@@ -211,57 +221,63 @@ add_action('wp_ajax_flag_file_browser', 'flag_ajax_file_browser');
|
|
211 |
*/
|
212 |
function flag_ajax_file_browser() {
|
213 |
|
214 |
-
global $flag;
|
215 |
-
|
216 |
// check for correct NextGEN capability
|
217 |
-
if ( !current_user_can('FlAG Import folder') )
|
218 |
-
die('No access');
|
|
|
219 |
|
220 |
-
|
221 |
-
|
|
|
222 |
|
223 |
// if nonce is not correct it returns -1
|
224 |
check_ajax_referer( 'flag-ajax', 'nonce' );
|
225 |
|
226 |
-
|
227 |
-
if (!function_exists('scandir')) {
|
228 |
-
function scandir($dir, $listDirectories = false, $skipDots = true ) {
|
229 |
$dirArray = array();
|
230 |
-
if ($handle = opendir($dir) ) {
|
231 |
-
while
|
232 |
-
if (($file != '.' && $file != '..' ) || $skipDots == true) {
|
233 |
-
if($listDirectories == false
|
234 |
-
|
|
|
|
|
|
|
|
|
235 |
}
|
236 |
}
|
237 |
-
closedir($handle);
|
238 |
}
|
|
|
239 |
return $dirArray;
|
240 |
}
|
241 |
}
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
$dir = trailingslashit
|
247 |
|
248 |
-
if( file_exists($root . $dir) && false === strpos($dir, '..') ) {
|
249 |
-
$files = scandir($root . $dir);
|
250 |
-
natcasesort($files);
|
251 |
|
252 |
-
|
253 |
-
if( count($files) > 2 ) {
|
254 |
echo "<ul class=\"jqueryDirTree\" style=\"display: none;\">";
|
255 |
|
256 |
-
|
257 |
-
foreach( $files as $file ) {
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
262 |
|
263 |
-
if ( file_exists($root . $dir . $file) && $file != '.' && $file != '..' && is_dir($root . $dir . $file) ) {
|
264 |
-
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_html($dir . $file) . "/\">" . esc_html($file) . "</a></li>";
|
265 |
}
|
266 |
}
|
267 |
|
@@ -269,12 +285,12 @@ function flag_ajax_file_browser() {
|
|
269 |
}
|
270 |
}
|
271 |
|
272 |
-
|
273 |
}
|
274 |
|
275 |
-
add_action('wp_ajax_flag_plupload_uploader', 'flag_ajax_plupload_uploader');
|
276 |
function flag_ajax_plupload_uploader() {
|
277 |
-
|
278 |
|
279 |
//check for correct capability
|
280 |
if ( ! is_user_logged_in() ) {
|
@@ -287,7 +303,7 @@ function flag_ajax_plupload_uploader() {
|
|
287 |
//check for correct nonce
|
288 |
check_ajax_referer( 'flag_upload' );
|
289 |
|
290 |
-
include_once
|
291 |
// get the gallery
|
292 |
$galleryID = (int) $_POST['galleryselect'];
|
293 |
|
1 |
<?php
|
2 |
|
3 |
+
add_action( 'wp_ajax_flag_ajax_operation', 'flag_ajax_operation' );
|
4 |
|
5 |
function flag_ajax_operation() {
|
6 |
global $wpdb;
|
7 |
// if nonce is not correct it returns -1
|
8 |
check_ajax_referer( "flag-ajax" );
|
9 |
// check for correct capability
|
10 |
+
if ( ! is_user_logged_in() ) {
|
11 |
+
die( '-1' );
|
12 |
+
}
|
13 |
// check for correct FlAG capability
|
14 |
+
if ( ! current_user_can( 'FlAG Upload images' ) || ! current_user_can( 'FlAG Manage gallery' ) ) {
|
15 |
+
die( '-1' );
|
16 |
+
}
|
17 |
// include the flag function
|
18 |
+
include_once( dirname( __FILE__ ) . '/functions.php' );
|
19 |
// Get the image id
|
20 |
+
if ( isset( $_POST['image'] ) ) {
|
21 |
$id = (int) $_POST['image'];
|
22 |
// let's get the image data
|
23 |
+
$picture = flagdb::find_image( $id );
|
24 |
// what do you want to do ?
|
25 |
switch ( $_POST['operation'] ) {
|
26 |
case 'create_thumbnail' :
|
27 |
+
$result = flagAdmin::create_thumbnail( $picture );
|
28 |
+
break;
|
29 |
case 'resize_image' :
|
30 |
+
$result = flagAdmin::resize_image( $picture );
|
31 |
+
break;
|
32 |
case 'webview_image' :
|
33 |
+
$result = flagAdmin::webview_image( $picture );
|
34 |
+
break;
|
35 |
case 'import_metadata' :
|
36 |
$result = flagAdmin::import_MetaData( $id );
|
37 |
+
break;
|
38 |
case 'copy_metadata' :
|
39 |
$result = flagAdmin::copy_MetaData( $id );
|
40 |
+
break;
|
41 |
case 'get_image_ids' :
|
42 |
$result = flagAdmin::get_image_ids( $id );
|
43 |
+
break;
|
44 |
default :
|
45 |
+
do_action( 'flag_ajax_' . sanitize_key( $_POST['operation'] ) );
|
46 |
+
die( '-1' );
|
47 |
+
break;
|
48 |
}
|
49 |
// A success should return a '1'
|
50 |
+
die ( $result );
|
51 |
}
|
52 |
// The script should never stop here
|
53 |
+
die( '0' );
|
54 |
}
|
55 |
|
56 |
+
add_action( 'wp_ajax_flagCreateNewThumb', 'flagCreateNewThumb' );
|
57 |
+
|
58 |
function flagCreateNewThumb() {
|
59 |
+
|
60 |
global $wpdb;
|
61 |
+
|
62 |
// check for correct capability
|
63 |
+
if ( ! is_user_logged_in() ) {
|
64 |
+
die( '-1' );
|
65 |
+
}
|
66 |
// check for correct FlAG capability
|
67 |
+
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
68 |
+
die( '-1' );
|
69 |
+
}
|
70 |
+
|
71 |
+
require_once( dirname( dirname( __FILE__ ) ) . '/flag-config.php' );
|
72 |
include_once( flagGallery::graphic_library() );
|
73 |
+
|
74 |
+
$flag_options = get_option( 'flag_options' );
|
75 |
+
|
76 |
+
$id = (int) $_POST['id'];
|
77 |
+
$picture = flagdb::find_image( $id );
|
78 |
+
|
79 |
+
$x = round( $_POST['x'] * $_POST['rr'], 0 );
|
80 |
+
$y = round( $_POST['y'] * $_POST['rr'], 0 );
|
81 |
+
$w = round( $_POST['w'] * $_POST['rr'], 0 );
|
82 |
+
$h = round( $_POST['h'] * $_POST['rr'], 0 );
|
83 |
+
|
84 |
+
$thumb = new flag_Thumbnail( $picture->imagePath, true );
|
85 |
+
|
86 |
+
$thumb->crop( $x, $y, $w, $h );
|
87 |
+
|
88 |
+
if ( $flag_options['thumbFix'] ) {
|
89 |
+
if ( $thumb->currentDimensions['height'] > $thumb->currentDimensions['width'] ) {
|
90 |
+
$thumb->resize( $flag_options['thumbWidth'], 0 );
|
91 |
} else {
|
92 |
+
$thumb->resize( 0, $flag_options['thumbHeight'] );
|
93 |
}
|
94 |
} else {
|
95 |
+
$thumb->resize( $flag_options['thumbWidth'], $flag_options['thumbHeight'] );
|
96 |
}
|
97 |
|
98 |
+
if ( $thumb->save( $picture->thumbPath, 100 ) ) {
|
99 |
//read the new sizes
|
100 |
+
$new_size = @getimagesize( $picture->thumbPath );
|
101 |
+
$size['width'] = $new_size[0];
|
102 |
+
$size['height'] = $new_size[1];
|
103 |
+
|
104 |
// add them to the database
|
105 |
+
flagdb::update_image_meta( $picture->pid, array( 'thumbnail' => $size ) );
|
106 |
|
107 |
echo "OK";
|
108 |
} else {
|
109 |
+
header( 'HTTP/1.1 500 Internal Server Error' );
|
110 |
echo "KO";
|
111 |
}
|
112 |
+
|
113 |
exit();
|
114 |
+
|
115 |
}
|
116 |
|
117 |
+
add_action( 'wp_ajax_flag_save_album', 'flag_save_album' );
|
118 |
+
|
119 |
function flag_save_album() {
|
120 |
+
|
121 |
global $wpdb;
|
122 |
+
|
123 |
// check for correct capability
|
124 |
+
if ( ! is_user_logged_in() ) {
|
125 |
+
die( '-1' );
|
126 |
+
}
|
127 |
// check for correct FlAG capability
|
128 |
+
if ( ! current_user_can( 'FlAG Manage others gallery' ) ) {
|
129 |
+
die( '-1' );
|
130 |
+
}
|
131 |
+
|
132 |
+
$g = array();
|
133 |
+
$album_id = 0;
|
134 |
$album_name = '';
|
135 |
+
if ( isset( $_POST['form'] ) ) {
|
136 |
+
parse_str( $_POST['form'] );
|
137 |
+
}
|
138 |
+
$result = false;
|
139 |
+
$album_id = intval( $album_id );
|
140 |
+
$album_name = preg_replace( '/[^\w\s\._-]+/', '', $album_name );
|
141 |
+
if ( $album_name && $album_id ) {
|
142 |
+
if ( count( $g ) ) {
|
143 |
+
$galstring = implode( ',', $g );
|
144 |
+
} else {
|
145 |
$galstring = '';
|
146 |
+
}
|
147 |
+
$result = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->flagalbum} SET name = %s, categories = %s WHERE id = %s", $album_name, $galstring, $album_id ) );
|
148 |
}
|
149 |
|
150 |
+
if ( $result ) {
|
151 |
+
_e( 'Success', 'flag' );
|
152 |
}
|
153 |
+
|
154 |
exit();
|
155 |
+
|
156 |
}
|
157 |
+
|
158 |
+
add_action( 'wp_ajax_flag_delete_album', 'flag_delete_album' );
|
159 |
+
|
160 |
function flag_delete_album() {
|
161 |
+
|
162 |
global $wpdb;
|
163 |
+
|
164 |
// check for correct capability
|
165 |
+
if ( ! is_user_logged_in() ) {
|
166 |
+
die( '-1' );
|
167 |
+
}
|
168 |
// check for correct FlAG capability
|
169 |
+
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
170 |
+
die( '-1' );
|
171 |
+
}
|
172 |
|
173 |
$result = false;
|
174 |
+
if ( isset( $_POST['post'] ) ) {
|
175 |
+
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->flagalbum} WHERE id = %d", $_POST['post'] ) );
|
176 |
}
|
177 |
|
178 |
+
if ( $result ) {
|
179 |
+
_e( 'Success', 'flag' );
|
180 |
}
|
181 |
|
182 |
exit();
|
183 |
+
|
184 |
}
|
185 |
+
|
186 |
+
add_action( 'wp_ajax_flag_banner_crunch', 'flag_banner_crunch' );
|
187 |
+
|
188 |
function flag_banner_crunch() {
|
189 |
+
|
|
|
|
|
190 |
// check for correct capability
|
191 |
+
if ( ! is_user_logged_in() ) {
|
192 |
+
die( '-1' );
|
193 |
+
}
|
194 |
// check for correct FlAG capability
|
195 |
+
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
196 |
+
die( '-1' );
|
197 |
+
}
|
198 |
+
|
199 |
+
if ( isset( $_POST['path'] ) ) {
|
200 |
+
include_once( dirname( __FILE__ ) . '/functions.php' );
|
201 |
+
$id = flagAdmin::handle_import_file( $_POST['path'] );
|
202 |
+
$file = basename( $_POST['path'] );
|
203 |
+
if ( is_wp_error( $id ) ) {
|
204 |
+
echo '<p class="error">' . sprintf( __( '<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flag' ), $file, $id->get_error_message() ) . '</p>';
|
205 |
} else {
|
206 |
+
echo '<p class="success">' . sprintf( __( '<em>%s</em> has been added to Media library', 'flag' ), $file ) . '</p>';
|
207 |
}
|
208 |
}
|
209 |
+
|
210 |
exit();
|
211 |
}
|
212 |
|
213 |
+
add_action( 'wp_ajax_flag_file_browser', 'flag_ajax_file_browser' );
|
214 |
|
215 |
/**
|
216 |
* jQuery File Tree PHP Connector
|
221 |
*/
|
222 |
function flag_ajax_file_browser() {
|
223 |
|
|
|
|
|
224 |
// check for correct NextGEN capability
|
225 |
+
if ( ! current_user_can( 'FlAG Import folder' ) ) {
|
226 |
+
die( 'No access' );
|
227 |
+
}
|
228 |
|
229 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
230 |
+
die( 'No access' );
|
231 |
+
}
|
232 |
|
233 |
// if nonce is not correct it returns -1
|
234 |
check_ajax_referer( 'flag-ajax', 'nonce' );
|
235 |
|
236 |
+
//PHP4 compat script
|
237 |
+
if ( ! function_exists( 'scandir' ) ) {
|
238 |
+
function scandir( $dir, $listDirectories = false, $skipDots = true ) {
|
239 |
$dirArray = array();
|
240 |
+
if ( $handle = opendir( $dir ) ) {
|
241 |
+
while( false !== ( $file = readdir( $handle ) ) ){
|
242 |
+
if ( ( $file != '.' && $file != '..' ) || $skipDots == true ) {
|
243 |
+
if ( $listDirectories == false ) {
|
244 |
+
if ( is_dir( $file ) ) {
|
245 |
+
continue;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
array_push( $dirArray, basename( $file ) );
|
249 |
}
|
250 |
}
|
251 |
+
closedir( $handle );
|
252 |
}
|
253 |
+
|
254 |
return $dirArray;
|
255 |
}
|
256 |
}
|
257 |
|
258 |
+
// start from the default path
|
259 |
+
$root = trailingslashit( WINABSPATH );
|
260 |
+
// get the current directory
|
261 |
+
$dir = trailingslashit( urldecode( $_POST['dir'] ) );
|
262 |
|
263 |
+
if ( file_exists( $root . $dir ) && false === strpos( $dir, '..' ) ) {
|
264 |
+
$files = scandir( $root . $dir );
|
265 |
+
natcasesort( $files );
|
266 |
|
267 |
+
// The 2 counts for . and ..
|
268 |
+
if ( count( $files ) > 2 ) {
|
269 |
echo "<ul class=\"jqueryDirTree\" style=\"display: none;\">";
|
270 |
|
271 |
+
// return only directories
|
272 |
+
foreach ( $files as $file ) {
|
273 |
|
274 |
+
//reserved name for the thumnbnails, don't use it as folder name
|
275 |
+
if ( $file == 'thumbs' ) {
|
276 |
+
continue;
|
277 |
+
}
|
278 |
|
279 |
+
if ( file_exists( $root . $dir . $file ) && $file != '.' && $file != '..' && is_dir( $root . $dir . $file ) ) {
|
280 |
+
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_html( $dir . $file ) . "/\">" . esc_html( $file ) . "</a></li>";
|
281 |
}
|
282 |
}
|
283 |
|
285 |
}
|
286 |
}
|
287 |
|
288 |
+
die();
|
289 |
}
|
290 |
|
291 |
+
add_action( 'wp_ajax_flag_plupload_uploader', 'flag_ajax_plupload_uploader' );
|
292 |
function flag_ajax_plupload_uploader() {
|
293 |
+
global $flag;
|
294 |
|
295 |
//check for correct capability
|
296 |
if ( ! is_user_logged_in() ) {
|
303 |
//check for correct nonce
|
304 |
check_ajax_referer( 'flag_upload' );
|
305 |
|
306 |
+
include_once( FLAG_ABSPATH . 'admin/functions.php' );
|
307 |
// get the gallery
|
308 |
$galleryID = (int) $_POST['galleryselect'];
|
309 |
|
admin/banner-box.php
CHANGED
@@ -1,105 +1,105 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
|
4 |
-
die('You are not allowed to call this page directly.');
|
5 |
}
|
6 |
|
7 |
// check for correct capability
|
8 |
-
if(!is_user_logged_in()){
|
9 |
-
die('-1');
|
10 |
}
|
11 |
|
12 |
// check for correct FlAG capability
|
13 |
-
if(!current_user_can('FlAG Manage banners')){
|
14 |
-
die('-1');
|
15 |
}
|
16 |
|
17 |
|
18 |
-
require_once(dirname(__FILE__) . '/functions.php');
|
19 |
-
require_once(dirname(__FILE__) . '/banner.functions.php');
|
20 |
|
21 |
-
function flag_banner_controler(){
|
22 |
-
$mode = isset($_REQUEST['mode'])? $_REQUEST['mode'] : 'main';
|
23 |
-
if(isset($_POST['importfolder']) && $_POST['importfolder']){
|
24 |
-
check_admin_referer('flag_addbanner');
|
25 |
$bannerfolder = $_POST['bannerfolder'];
|
26 |
-
if(!empty($bannerfolder) AND false === strpos($bannerfolder, '..')){
|
27 |
-
$crunch_list = flagAdmin::import_banner($bannerfolder);
|
28 |
-
$mode
|
29 |
}
|
30 |
}
|
31 |
-
$action = isset($_REQUEST['bulkaction'])? $_REQUEST['bulkaction'] : false;
|
32 |
-
if($action == 'no_action'){
|
33 |
$action = false;
|
34 |
}
|
35 |
-
switch($mode){
|
36 |
case 'sort':
|
37 |
-
check_admin_referer('flag_sort');
|
38 |
-
include_once(dirname(__FILE__) . '/banner-sort.php');
|
39 |
flag_b_playlist_order();
|
40 |
break;
|
41 |
case 'edit':
|
42 |
-
$file = sanitize_flagname($_GET['playlist']);
|
43 |
-
if(isset($_POST['updatePlaylist'])){
|
44 |
-
check_admin_referer('flag_update');
|
45 |
-
$title = esc_html($_POST['playlist_title']);
|
46 |
-
$descr = esc_html($_POST['playlist_descr']);
|
47 |
-
$data
|
48 |
-
foreach($_POST['item_a'] as $item_id => $item){
|
49 |
-
if($action == 'delete_items' && in_array($item_id, $_POST['doaction'])){
|
50 |
continue;
|
51 |
}
|
52 |
$data[] = $item_id;
|
53 |
}
|
54 |
flagGallery::flagSaveWpMedia();
|
55 |
-
flagSave_bPlaylist($title, $descr, $data, $file);
|
56 |
}
|
57 |
-
if(isset($_POST['updatePlaylistSkin'])){
|
58 |
-
check_admin_referer('flag_update');
|
59 |
-
flagSave_bPlaylistSkin($file);
|
60 |
}
|
61 |
-
include_once(dirname(__FILE__) . '/manage-banner.php');
|
62 |
-
flag_b_playlist_edit($file);
|
63 |
break;
|
64 |
case 'save':
|
65 |
-
if(isset($_POST['items_array'])){
|
66 |
-
check_admin_referer('flag_update');
|
67 |
-
$title = esc_html($_POST['playlist_title']);
|
68 |
-
$descr = esc_html($_POST['playlist_descr']);
|
69 |
-
$data
|
70 |
-
$file
|
71 |
flagGallery::flagSaveWpMedia();
|
72 |
-
flagSave_bPlaylist($title, $descr, $data, $file);
|
73 |
}
|
74 |
-
if(isset($_GET['playlist'])){
|
75 |
-
include_once(dirname(__FILE__) . '/manage-banner.php');
|
76 |
flag_b_playlist_edit();
|
77 |
-
} else{
|
78 |
flag_created_b_playlists();
|
79 |
flag_banner_wp_media_lib();
|
80 |
}
|
81 |
break;
|
82 |
case 'add':
|
83 |
-
check_admin_referer('flag_add');
|
84 |
-
if(isset($_POST['items']) && isset($_GET['playlist'])){
|
85 |
$added = $_POST['items'];
|
86 |
-
} elseif(isset($_GET['playlist'])){
|
87 |
-
$added = $_COOKIE['bannerboxplaylist_' . sanitize_flagname($_GET['playlist'])];
|
88 |
-
} else{
|
89 |
$added = false;
|
90 |
}
|
91 |
-
flag_banner_wp_media_lib($added);
|
92 |
break;
|
93 |
case 'delete':
|
94 |
-
check_admin_referer('flag_delete');
|
95 |
-
flag_b_playlist_delete(sanitize_flagname($_GET['playlist']));
|
96 |
case 'import':
|
97 |
-
flag_crunch($crunch_list);
|
98 |
case 'main':
|
99 |
-
if(isset($_POST['updateMedia'])){
|
100 |
-
check_admin_referer('flag_update');
|
101 |
flagGallery::flagSaveWpMedia();
|
102 |
-
flagGallery::show_message(__('Media updated', 'flag'));
|
103 |
}
|
104 |
default:
|
105 |
flag_created_b_playlists();
|
@@ -109,14 +109,14 @@ function flag_banner_controler(){
|
|
109 |
|
110 |
}
|
111 |
|
112 |
-
function flag_crunch($crunch_list){
|
113 |
-
if(
|
114 |
return;
|
115 |
}
|
116 |
-
$crunch_string = implode(',', $crunch_list);
|
117 |
-
$folder
|
118 |
-
$folder
|
119 |
-
$path
|
120 |
?>
|
121 |
<script type="text/javascript">
|
122 |
<!--
|
@@ -158,57 +158,57 @@ function flag_crunch($crunch_list){
|
|
158 |
|
159 |
<?php }
|
160 |
|
161 |
-
function flag_created_b_playlists(){
|
162 |
|
163 |
-
$filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
|
164 |
|
165 |
-
$all_playlists
|
166 |
-
$total_all_playlists = count($all_playlists);
|
167 |
-
$flag_options
|
168 |
|
169 |
?>
|
170 |
<div class="flag-wrap">
|
171 |
-
<h2><?php _e('Created playlists', 'flag'); ?></h2>
|
172 |
<table class="widefat flag-table" cellspacing="0">
|
173 |
<thead>
|
174 |
<tr>
|
175 |
-
<th scope="col" width="25%"><?php _e('Title', 'flag'); ?></th>
|
176 |
-
<th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
|
177 |
-
<th scope="col"><?php _e('Quantity', 'flag'); ?></th>
|
178 |
-
<th scope="col"><?php _e('Shortcode', 'flag'); ?></th>
|
179 |
-
<th scope="col"><?php _e('Action', 'flag'); ?></th>
|
180 |
</tr>
|
181 |
</thead>
|
182 |
<tbody>
|
183 |
<?php
|
184 |
-
if($all_playlists){
|
185 |
-
foreach((array) $all_playlists as $playlist_file => $playlist_data){
|
186 |
-
$query_m
|
187 |
-
$class
|
188 |
-
$playlist_name = basename($playlist_file, '.xml');
|
189 |
-
if(count($query_m) != count($playlist_data['items'])){
|
190 |
-
flagSave_bPlaylist($playlist_data['title'], $playlist_data['description'], $playlist_data['items'], $playlist_name);
|
191 |
}
|
192 |
?>
|
193 |
<tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
|
194 |
<td>
|
195 |
-
<a href="<?php echo esc_url($filepath . '&playlist=' . $playlist_name . '&mode=edit'); ?>" class='edit' title="<?php _e('Edit'); ?>">
|
196 |
-
<?php echo esc_html($playlist_data['title']); ?>
|
197 |
</a>
|
198 |
</td>
|
199 |
-
<td><?php echo esc_html($playlist_data['description']);
|
200 |
-
echo ' (' . __("player", "flag") . ': <strong>' . esc_html($playlist_data['skin']) . '</strong>)' ?></td>
|
201 |
-
<td><?php echo count($query_m); ?></td>
|
202 |
<td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandbanner xml=<?php echo $playlist_name; ?>]"/></td>
|
203 |
<td>
|
204 |
-
<a href="<?php echo wp_nonce_url($filepath . '&playlist=' . $playlist_name . "&mode=delete", 'flag_delete'); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this playlist?", 'flag') ?>');if(check==false) {return false;
|
205 |
-
}"><?php _e('Delete', 'flag'); ?></a>
|
206 |
</td>
|
207 |
</tr>
|
208 |
<?php
|
209 |
}
|
210 |
-
} else{
|
211 |
-
echo '<tr><td colspan="5" align="center"><strong>' . __('No playlists found', 'flag') . '</strong></td></tr>';
|
212 |
}
|
213 |
?>
|
214 |
</tbody>
|
@@ -219,29 +219,29 @@ function flag_created_b_playlists(){
|
|
219 |
|
220 |
|
221 |
// *** show media list
|
222 |
-
function flag_banner_wp_media_lib($added = false){
|
223 |
global $wpdb;
|
224 |
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
|
225 |
-
$filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
|
226 |
-
if($added !== false){
|
227 |
-
$added = preg_replace('/[^\d,]+/', '', $added);
|
228 |
-
$filepath .= '&playlist=' . sanitize_flagname($_GET['playlist']) . '&mode=save';
|
229 |
-
$flag_options = get_option('flag_options');
|
230 |
-
$playlistPath = $flag_options['galleryPath'] . 'playlists/banner/' . sanitize_flagname($_GET['playlist']) . '.xml';
|
231 |
-
$playlist
|
232 |
-
$exclude
|
233 |
-
$exclude
|
234 |
-
} else{
|
235 |
-
$items_array_default = isset($_COOKIE['bannerboxplaylist_default'])? preg_replace('/[^\d,]+/', '', $_COOKIE['bannerboxplaylist_default']) : '';
|
236 |
-
$exclude
|
237 |
-
$exclude
|
238 |
}
|
239 |
-
if(isset($_GET['playlist'])){
|
240 |
-
$playlist_cookie = sanitize_flagname($_GET['playlist']);
|
241 |
-
} else{
|
242 |
$playlist_cookie = 'default';
|
243 |
}
|
244 |
-
$filepath = esc_url($filepath);
|
245 |
?>
|
246 |
<script type="text/javascript">
|
247 |
<!--
|
@@ -330,9 +330,9 @@ function flag_banner_wp_media_lib($added = false){
|
|
330 |
//-->
|
331 |
</script>
|
332 |
<div class="flag-wrap">
|
333 |
-
<?php if($added === false){ ?>
|
334 |
-
<?php if(current_user_can('FlAG Import folder')){
|
335 |
-
$defaultpath = basename(WP_CONTENT_DIR) . '/';
|
336 |
?>
|
337 |
<link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
|
338 |
<script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
|
@@ -356,95 +356,95 @@ function flag_banner_wp_media_lib($added = false){
|
|
356 |
|
357 |
<!-- import folder -->
|
358 |
<div id="importfolder">
|
359 |
-
<h2><?php _e('Import banners from folder', 'flag'); ?></h2>
|
360 |
|
361 |
<form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
362 |
-
<?php wp_nonce_field('flag_addbanner'); ?>
|
363 |
<table class="form-table">
|
364 |
<tr valign="top">
|
365 |
-
<th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
|
366 |
-
<td><input type="text" size="35" id="bannerfolder" name="bannerfolder" value="<?php echo $defaultpath; ?>"/><span class="browsefiles button" style="display:none"><?php _e('Browse...', "flag"); ?></span>
|
367 |
|
368 |
<div id="file_browser"></div>
|
369 |
<br/>
|
370 |
<p><label><input type="checkbox" name="delete_files" value="delete"/>
|
371 |
-
<?php _e('delete files after import in WordPress Media Library', 'flag'); ?></label></p>
|
372 |
</td>
|
373 |
</tr>
|
374 |
</table>
|
375 |
-
<div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
|
376 |
</form>
|
377 |
</div>
|
378 |
<?php } ?>
|
379 |
<?php } ?>
|
380 |
|
381 |
-
<h2><?php _e('WordPress Image Library', 'flag'); ?></h2>
|
382 |
|
383 |
<?php
|
384 |
// look for pagination
|
385 |
-
if(!isset($_GET['paged']) || $_GET['paged'] < 1){
|
386 |
$_GET['paged'] = 1;
|
387 |
}
|
388 |
|
389 |
-
$_GET['paged']
|
390 |
$objects_per_page = 25;
|
391 |
-
$start
|
392 |
-
$img_total_count
|
393 |
-
$bannerlist
|
394 |
-
'numberposts'
|
395 |
-
'offset'
|
396 |
-
'orderby'
|
397 |
-
'order'
|
398 |
-
'post_type'
|
399 |
-
'post_mime_type' => array('image')
|
400 |
-
));
|
401 |
|
402 |
// build pagination
|
403 |
-
$page_links = paginate_links(array(
|
404 |
-
'base'
|
405 |
-
'format'
|
406 |
-
'prev_text' => __('«'),
|
407 |
-
'next_text' => __('»'),
|
408 |
-
'total'
|
409 |
-
'current'
|
410 |
-
'add_args'
|
411 |
-
));
|
412 |
?>
|
413 |
<div class="tablenav" style="overflow: hidden; height: auto;">
|
414 |
-
<?php if($added === false){ ?>
|
415 |
-
<div class="alignleft"><b><?php _e('Selected Media', 'flag'); ?>: </b><input style="width:500px;" type="text" readonly="readonly" id="items_array" name="items_array" value="<?php echo $items_array_default; ?>"/>
|
416 |
-
<span class="clear_selected button"><?php _e('Clear Selected', 'flag'); ?></span></div>
|
417 |
<?php } ?>
|
418 |
-
<div class="tablenav-pages"><?php $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $objects_per_page + 1), number_format_i18n(min($_GET['paged'] * $objects_per_page, $img_total_count)), number_format_i18n($img_total_count), $page_links);
|
419 |
echo $page_links_text; ?></div>
|
420 |
</div>
|
421 |
<form id="bannerlib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
422 |
-
<?php wp_nonce_field('flag_update'); ?>
|
423 |
<input type="hidden" name="page" value="banner-box"/>
|
424 |
|
425 |
<div class="tablenav">
|
426 |
|
427 |
<div class="actions">
|
428 |
-
<?php if($added === false){ ?>
|
429 |
-
<input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e('Update Media', 'flag'); ?>"/>
|
430 |
-
<?php if(function_exists('json_encode')){ ?>
|
431 |
<select name="bulkaction" id="bulkaction">
|
432 |
-
<option value="no_action"><?php _e("No action", 'flag'); ?></option>
|
433 |
-
<option value="new_playlist"><?php _e("Create new playlist", 'flag'); ?></option>
|
434 |
</select>
|
435 |
-
<input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply', 'flag'); ?>" onclick="if ( !checkSelected() ) {return false;
|
436 |
}"/>
|
437 |
<?php } ?>
|
438 |
-
<a href="<?php echo admin_url('media-new.php'); ?>" class="button"><?php _e('Upload Banner(s)', 'flag'); ?></a>
|
439 |
<input type="hidden" id="items_array" name="items_array" value=""/>
|
440 |
-
<?php } else{ ?>
|
441 |
<input type="hidden" name="mode" value="save"/>
|
442 |
<input style="width: 80%;" type="text" id="items_array" name="items_array" readonly="readonly" value="<?php echo $added; ?>"/>
|
443 |
-
<input type="hidden" name="playlist_title" value="<?php echo esc_html($playlist['title']); ?>"/>
|
444 |
-
<input type="hidden" name="skinname" value="<?php echo sanitize_flagname($playlist['skin']); ?>"/>
|
445 |
-
<input type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>"/>
|
446 |
-
<textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo esc_html($playlist['description']); ?></textarea>
|
447 |
-
<input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e('Update Playlist', 'flag'); ?>"/>
|
448 |
<?php } ?>
|
449 |
</div>
|
450 |
|
@@ -452,73 +452,73 @@ function flag_banner_wp_media_lib($added = false){
|
|
452 |
<table class="widefat flag-table" cellspacing="0">
|
453 |
<thead>
|
454 |
<tr>
|
455 |
-
<th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
|
456 |
<th class="id" width="64" scope="col">
|
457 |
-
<div><?php _e('ID', 'flag'); ?></div>
|
458 |
</th>
|
459 |
<th class="thumb" width="110" scope="col">
|
460 |
-
<div><?php _e('Thumbnail', 'flag'); ?></div>
|
461 |
</th>
|
462 |
<th class="title_filename" scope="col">
|
463 |
-
<div><?php _e('Filename / Title / Link', 'flag'); ?></div>
|
464 |
</th>
|
465 |
<th class="description" scope="col">
|
466 |
-
<div><?php _e('Description', 'flag'); ?></div>
|
467 |
</th>
|
468 |
</tr>
|
469 |
</thead>
|
470 |
<tfoot>
|
471 |
<tr>
|
472 |
-
<th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
|
473 |
-
<th class="id" scope="col"><?php _e('ID', 'flag'); ?></th>
|
474 |
-
<th class="thumb" scope="col"><?php _e('Thumbnail', 'flag'); ?></th>
|
475 |
-
<th class="title_filename" scope="col"><?php _e('Filename / Title / Link', 'flag'); ?></th>
|
476 |
-
<th class="description" scope="col"><?php _e('Description', 'flag'); ?></th>
|
477 |
</tr>
|
478 |
</tfoot>
|
479 |
<tbody>
|
480 |
<?php
|
481 |
-
$uploads
|
482 |
-
$flag_options = get_option('flag_options');
|
483 |
-
if($bannerlist){
|
484 |
-
foreach($bannerlist as $ban){
|
485 |
$list[] = $ban->ID;
|
486 |
}
|
487 |
$class = 'alternate';
|
488 |
-
foreach($bannerlist as $ban){
|
489 |
-
$class = (empty($class))? 'alternate' : '';
|
490 |
-
$ex
|
491 |
-
if(($added !== false || !empty($items_array_default)) && in_array($ban->ID, $exclude)){
|
492 |
$class .= ' already-added';
|
493 |
-
$ex
|
494 |
$checked = ' checked="checked"';
|
495 |
}
|
496 |
-
$thumb = get_post_meta($ban->ID, 'thumbnail', true);
|
497 |
-
$link
|
498 |
-
if(empty($thumb)){
|
499 |
-
$thumb = wp_get_attachment_thumb_url($ban->ID);
|
500 |
}
|
501 |
-
$url = wp_get_attachment_url($ban->ID);
|
502 |
?>
|
503 |
<tr id="ban-<?php echo $ban->ID; ?>" class="<?php echo $class; ?>"<?php echo $ex; ?>>
|
504 |
<td class="cb"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $ban->ID; ?>"/></td>
|
505 |
<td class="id"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $ban->ID; ?></p></td>
|
506 |
<td class="thumb">
|
507 |
-
<a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo $url; ?>"><img id="thumb-<?php echo $ban->ID; ?>" src="<?php echo $thumb; ?>" width="100" height="100" alt=""/></a>
|
508 |
</td>
|
509 |
<td class="title_filename">
|
510 |
-
<strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br/>
|
511 |
-
<textarea title="Title" name="item_a[<?php echo $ban->ID; ?>][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php echo esc_html(stripslashes($ban->post_title)); ?></textarea><br/>
|
512 |
-
<?php _e('URL', 'flag'); ?>: <input id="banlink-<?php echo $ban->ID; ?>" name="item_a[<?php echo $ban->ID; ?>][link]" style="width:50%;" type="text" value="<?php echo esc_url($link); ?>"/><br/>
|
513 |
</td>
|
514 |
<td class="description">
|
515 |
-
<textarea name="item_a[<?php echo $ban->ID; ?>][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1"><?php echo esc_html(stripslashes($ban->post_content)); ?></textarea>
|
516 |
</td>
|
517 |
</tr>
|
518 |
<?php
|
519 |
}
|
520 |
-
} else{
|
521 |
-
echo '<tr><td colspan="5" align="center"><strong>' . __('No images in WordPress Media Library.', 'flag') . '</strong></td></tr>';
|
522 |
}
|
523 |
?>
|
524 |
</tbody>
|
@@ -529,26 +529,26 @@ function flag_banner_wp_media_lib($added = false){
|
|
529 |
<!-- #new_playlist -->
|
530 |
<div id="new_playlist" style="display: none;">
|
531 |
<form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
532 |
-
<?php wp_nonce_field('flag_update'); ?>
|
533 |
<input type="hidden" id="new_playlist_banid" name="items_array" value=""/>
|
534 |
<input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value=""/>
|
535 |
<input type="hidden" name="mode" value="save"/>
|
536 |
<input type="hidden" name="page" value="banner-box"/>
|
537 |
<table width="100%" border="0" cellspacing="3" cellpadding="3">
|
538 |
<tr valign="top">
|
539 |
-
<th align="left" style="padding-top: 5px;"><?php _e('Playlist Title', 'flag'); ?></th>
|
540 |
<td><input type="text" class="alignleft" name="playlist_title" value=""/>
|
541 |
|
542 |
-
<div class="alignright"><strong><?php _e("Choose skin", 'flag'); ?>:</strong>
|
543 |
<select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
|
544 |
-
<?php require_once(dirname(__FILE__) . '/get_skin.php');
|
545 |
-
$all_skins = get_skins($skin_folder = '', $type = 'b');
|
546 |
-
if(count($all_skins)){
|
547 |
-
foreach((array) $all_skins as $skin_file => $skin_data){
|
548 |
-
echo '<option value="' . dirname($skin_file) . '">' . $skin_data['Name'] . '</option>' . "\n";
|
549 |
}
|
550 |
-
} else{
|
551 |
-
echo '<option value="rotator_default">' . __("No Skins", "flag") . '</option>';
|
552 |
}
|
553 |
?>
|
554 |
</select>
|
@@ -556,14 +556,14 @@ function flag_banner_wp_media_lib($added = false){
|
|
556 |
</td>
|
557 |
</tr>
|
558 |
<tr valign="top">
|
559 |
-
<th align="left" style="padding-top: 5px;"><?php _e('Playlist Description', 'flag'); ?></th>
|
560 |
<td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
|
561 |
</tr>
|
562 |
<tr>
|
563 |
<td> </td>
|
564 |
-
<td align="right"><input class="button-secondary" type="reset" value=" <?php _e('Cancel', 'flag'); ?> " onclick="tb_remove()"/>
|
565 |
|
566 |
-
<input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e('OK', 'flag'); ?>"/>
|
567 |
</td>
|
568 |
</tr>
|
569 |
</table>
|
1 |
<?php
|
2 |
|
3 |
+
if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
|
4 |
+
die( 'You are not allowed to call this page directly.' );
|
5 |
}
|
6 |
|
7 |
// check for correct capability
|
8 |
+
if ( ! is_user_logged_in() ) {
|
9 |
+
die( '-1' );
|
10 |
}
|
11 |
|
12 |
// check for correct FlAG capability
|
13 |
+
if ( ! current_user_can( 'FlAG Manage banners' ) ) {
|
14 |
+
die( '-1' );
|
15 |
}
|
16 |
|
17 |
|
18 |
+
require_once( dirname( __FILE__ ) . '/functions.php' );
|
19 |
+
require_once( dirname( __FILE__ ) . '/banner.functions.php' );
|
20 |
|
21 |
+
function flag_banner_controler() {
|
22 |
+
$mode = isset( $_REQUEST['mode'] ) ? $_REQUEST['mode'] : 'main';
|
23 |
+
if ( isset( $_POST['importfolder'] ) && $_POST['importfolder'] ) {
|
24 |
+
check_admin_referer( 'flag_addbanner' );
|
25 |
$bannerfolder = $_POST['bannerfolder'];
|
26 |
+
if ( ! empty( $bannerfolder ) AND false === strpos( $bannerfolder, '..' ) ) {
|
27 |
+
$crunch_list = flagAdmin::import_banner( $bannerfolder );
|
28 |
+
$mode = 'import';
|
29 |
}
|
30 |
}
|
31 |
+
$action = isset( $_REQUEST['bulkaction'] ) ? $_REQUEST['bulkaction'] : false;
|
32 |
+
if ( $action == 'no_action' ) {
|
33 |
$action = false;
|
34 |
}
|
35 |
+
switch ( $mode ) {
|
36 |
case 'sort':
|
37 |
+
check_admin_referer( 'flag_sort' );
|
38 |
+
include_once( dirname( __FILE__ ) . '/banner-sort.php' );
|
39 |
flag_b_playlist_order();
|
40 |
break;
|
41 |
case 'edit':
|
42 |
+
$file = sanitize_flagname( $_GET['playlist'] );
|
43 |
+
if ( isset( $_POST['updatePlaylist'] ) ) {
|
44 |
+
check_admin_referer( 'flag_update' );
|
45 |
+
$title = esc_html( $_POST['playlist_title'] );
|
46 |
+
$descr = esc_html( $_POST['playlist_descr'] );
|
47 |
+
$data = array();
|
48 |
+
foreach ( $_POST['item_a'] as $item_id => $item ) {
|
49 |
+
if ( $action == 'delete_items' && in_array( $item_id, $_POST['doaction'] ) ) {
|
50 |
continue;
|
51 |
}
|
52 |
$data[] = $item_id;
|
53 |
}
|
54 |
flagGallery::flagSaveWpMedia();
|
55 |
+
flagSave_bPlaylist( $title, $descr, $data, $file );
|
56 |
}
|
57 |
+
if ( isset( $_POST['updatePlaylistSkin'] ) ) {
|
58 |
+
check_admin_referer( 'flag_update' );
|
59 |
+
flagSave_bPlaylistSkin( $file );
|
60 |
}
|
61 |
+
include_once( dirname( __FILE__ ) . '/manage-banner.php' );
|
62 |
+
flag_b_playlist_edit( $file );
|
63 |
break;
|
64 |
case 'save':
|
65 |
+
if ( isset( $_POST['items_array'] ) ) {
|
66 |
+
check_admin_referer( 'flag_update' );
|
67 |
+
$title = esc_html( $_POST['playlist_title'] );
|
68 |
+
$descr = esc_html( $_POST['playlist_descr'] );
|
69 |
+
$data = $_POST['items_array'];
|
70 |
+
$file = isset( $_REQUEST['playlist'] ) ? sanitize_flagname( $_REQUEST['playlist'] ) : false;
|
71 |
flagGallery::flagSaveWpMedia();
|
72 |
+
flagSave_bPlaylist( $title, $descr, $data, $file );
|
73 |
}
|
74 |
+
if ( isset( $_GET['playlist'] ) ) {
|
75 |
+
include_once( dirname( __FILE__ ) . '/manage-banner.php' );
|
76 |
flag_b_playlist_edit();
|
77 |
+
} else {
|
78 |
flag_created_b_playlists();
|
79 |
flag_banner_wp_media_lib();
|
80 |
}
|
81 |
break;
|
82 |
case 'add':
|
83 |
+
check_admin_referer( 'flag_add' );
|
84 |
+
if ( isset( $_POST['items'] ) && isset( $_GET['playlist'] ) ) {
|
85 |
$added = $_POST['items'];
|
86 |
+
} elseif ( isset( $_GET['playlist'] ) ) {
|
87 |
+
$added = $_COOKIE[ 'bannerboxplaylist_' . sanitize_flagname( $_GET['playlist'] ) ];
|
88 |
+
} else {
|
89 |
$added = false;
|
90 |
}
|
91 |
+
flag_banner_wp_media_lib( $added );
|
92 |
break;
|
93 |
case 'delete':
|
94 |
+
check_admin_referer( 'flag_delete' );
|
95 |
+
flag_b_playlist_delete( sanitize_flagname( $_GET['playlist'] ) );
|
96 |
case 'import':
|
97 |
+
flag_crunch( $crunch_list );
|
98 |
case 'main':
|
99 |
+
if ( isset( $_POST['updateMedia'] ) ) {
|
100 |
+
check_admin_referer( 'flag_update' );
|
101 |
flagGallery::flagSaveWpMedia();
|
102 |
+
flagGallery::show_message( __( 'Media updated', 'flag' ) );
|
103 |
}
|
104 |
default:
|
105 |
flag_created_b_playlists();
|
109 |
|
110 |
}
|
111 |
|
112 |
+
function flag_crunch( $crunch_list ) {
|
113 |
+
if ( ! $crunch_list ) {
|
114 |
return;
|
115 |
}
|
116 |
+
$crunch_string = implode( ',', $crunch_list );
|
117 |
+
$folder = str_replace( array( '../', '\'', '"', '<', '>', '$', '%', '=' ), '', $_POST['bannerfolder'] );
|
118 |
+
$folder = rtrim( $folder, '/' );
|
119 |
+
$path = WINABSPATH . $folder . '/';
|
120 |
?>
|
121 |
<script type="text/javascript">
|
122 |
<!--
|
158 |
|
159 |
<?php }
|
160 |
|
161 |
+
function flag_created_b_playlists() {
|
162 |
|
163 |
+
$filepath = admin_url() . 'admin.php?page=' . urlencode( $_GET['page'] );
|
164 |
|
165 |
+
$all_playlists = get_b_playlists();
|
166 |
+
$total_all_playlists = count( $all_playlists );
|
167 |
+
$flag_options = get_option( 'flag_options' );
|
168 |
|
169 |
?>
|
170 |
<div class="flag-wrap">
|
171 |
+
<h2><?php _e( 'Created playlists', 'flag' ); ?></h2>
|
172 |
<table class="widefat flag-table" cellspacing="0">
|
173 |
<thead>
|
174 |
<tr>
|
175 |
+
<th scope="col" width="25%"><?php _e( 'Title', 'flag' ); ?></th>
|
176 |
+
<th scope="col" width="55%"><?php _e( 'Description', 'flag' ); ?></th>
|
177 |
+
<th scope="col"><?php _e( 'Quantity', 'flag' ); ?></th>
|
178 |
+
<th scope="col"><?php _e( 'Shortcode', 'flag' ); ?></th>
|
179 |
+
<th scope="col"><?php _e( 'Action', 'flag' ); ?></th>
|
180 |
</tr>
|
181 |
</thead>
|
182 |
<tbody>
|
183 |
<?php
|
184 |
+
if ( $all_playlists ) {
|
185 |
+
foreach ( (array) $all_playlists as $playlist_file => $playlist_data ) {
|
186 |
+
$query_m = get_posts( array( 'post_type' => 'attachment', 'numberposts' => - 1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items'] ) );
|
187 |
+
$class = ( ! isset( $class ) || $class == 'class="alternate"' ) ? '' : 'class="alternate"';
|
188 |
+
$playlist_name = basename( $playlist_file, '.xml' );
|
189 |
+
if ( count( $query_m ) != count( $playlist_data['items'] ) ) {
|
190 |
+
flagSave_bPlaylist( $playlist_data['title'], $playlist_data['description'], $playlist_data['items'], $playlist_name );
|
191 |
}
|
192 |
?>
|
193 |
<tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
|
194 |
<td>
|
195 |
+
<a href="<?php echo esc_url( $filepath . '&playlist=' . $playlist_name . '&mode=edit' ); ?>" class='edit' title="<?php _e( 'Edit' ); ?>">
|
196 |
+
<?php echo esc_html( $playlist_data['title'] ); ?>
|
197 |
</a>
|
198 |
</td>
|
199 |
+
<td><?php echo esc_html( $playlist_data['description'] );
|
200 |
+
echo ' (' . __( "player", "flag" ) . ': <strong>' . esc_html( $playlist_data['skin'] ) . '</strong>)' ?></td>
|
201 |
+
<td><?php echo count( $query_m ); ?></td>
|
202 |
<td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandbanner xml=<?php echo $playlist_name; ?>]"/></td>
|
203 |
<td>
|
204 |
+
<a href="<?php echo wp_nonce_url( $filepath . '&playlist=' . $playlist_name . "&mode=delete", 'flag_delete' ); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e( "Delete this playlist?", 'flag' ) ?>');if(check==false) {return false;
|
205 |
+
}"><?php _e( 'Delete', 'flag' ); ?></a>
|
206 |
</td>
|
207 |
</tr>
|
208 |
<?php
|
209 |
}
|
210 |
+
} else {
|
211 |
+
echo '<tr><td colspan="5" align="center"><strong>' . __( 'No playlists found', 'flag' ) . '</strong></td></tr>';
|
212 |
}
|
213 |
?>
|
214 |
</tbody>
|
219 |
|
220 |
|
221 |
// *** show media list
|
222 |
+
function flag_banner_wp_media_lib( $added = false ) {
|
223 |
global $wpdb;
|
224 |
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
|
225 |
+
$filepath = admin_url() . 'admin.php?page=' . urlencode( $_GET['page'] );
|
226 |
+
if ( $added !== false ) {
|
227 |
+
$added = preg_replace( '/[^\d,]+/', '', $added );
|
228 |
+
$filepath .= '&playlist=' . sanitize_flagname( $_GET['playlist'] ) . '&mode=save';
|
229 |
+
$flag_options = get_option( 'flag_options' );
|
230 |
+
$playlistPath = $flag_options['galleryPath'] . 'playlists/banner/' . sanitize_flagname( $_GET['playlist'] ) . '.xml';
|
231 |
+
$playlist = get_b_playlist_data( ABSPATH . $playlistPath );
|
232 |
+
$exclude = explode( ',', $added );
|
233 |
+
$exclude = array_filter( $exclude, 'intval' );
|
234 |
+
} else {
|
235 |
+
$items_array_default = isset( $_COOKIE['bannerboxplaylist_default'] ) ? preg_replace( '/[^\d,]+/', '', $_COOKIE['bannerboxplaylist_default'] ) : '';
|
236 |
+
$exclude = explode( ',', $items_array_default );
|
237 |
+
$exclude = array_filter( $exclude, 'intval' );
|
238 |
}
|
239 |
+
if ( isset( $_GET['playlist'] ) ) {
|
240 |
+
$playlist_cookie = sanitize_flagname( $_GET['playlist'] );
|
241 |
+
} else {
|
242 |
$playlist_cookie = 'default';
|
243 |
}
|
244 |
+
$filepath = esc_url( $filepath );
|
245 |
?>
|
246 |
<script type="text/javascript">
|
247 |
<!--
|
330 |
//-->
|
331 |
</script>
|
332 |
<div class="flag-wrap">
|
333 |
+
<?php if ( $added === false ) { ?>
|
334 |
+
<?php if ( current_user_can( 'FlAG Import folder' ) ) {
|
335 |
+
$defaultpath = basename( WP_CONTENT_DIR ) . '/';
|
336 |
?>
|
337 |
<link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
|
338 |
<script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
|
356 |
|
357 |
<!-- import folder -->
|
358 |
<div id="importfolder">
|
359 |
+
<h2><?php _e( 'Import banners from folder', 'flag' ); ?></h2>
|
360 |
|
361 |
<form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
362 |
+
<?php wp_nonce_field( 'flag_addbanner' ); ?>
|
363 |
<table class="form-table">
|
364 |
<tr valign="top">
|
365 |
+
<th scope="row"><?php _e( 'Import from Server path:', 'flag' ); ?></th>
|
366 |
+
<td><input type="text" size="35" id="bannerfolder" name="bannerfolder" value="<?php echo $defaultpath; ?>"/><span class="browsefiles button" style="display:none"><?php _e( 'Browse...', "flag" ); ?></span>
|
367 |
|
368 |
<div id="file_browser"></div>
|
369 |
<br/>
|
370 |
<p><label><input type="checkbox" name="delete_files" value="delete"/>
|
371 |
+
<?php _e( 'delete files after import in WordPress Media Library', 'flag' ); ?></label></p>
|
372 |
</td>
|
373 |
</tr>
|
374 |
</table>
|
375 |
+
<div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e( 'Import folder', 'flag' ); ?>"/></div>
|
376 |
</form>
|
377 |
</div>
|
378 |
<?php } ?>
|
379 |
<?php } ?>
|
380 |
|
381 |
+
<h2><?php _e( 'WordPress Image Library', 'flag' ); ?></h2>
|
382 |
|
383 |
<?php
|
384 |
// look for pagination
|
385 |
+
if ( ! isset( $_GET['paged'] ) || $_GET['paged'] < 1 ) {
|
386 |
$_GET['paged'] = 1;
|
387 |
}
|
388 |
|
389 |
+
$_GET['paged'] = intval( $_GET['paged'] );
|
390 |
$objects_per_page = 25;
|
391 |
+
$start = ( $_GET['paged'] - 1 ) * $objects_per_page;
|
392 |
+
$img_total_count = $wpdb->get_var( "SELECT COUNT(ID) FROM $wpdb->posts WHERE `post_mime_type` LIKE 'image/%' AND `post_type` = 'attachment' AND `post_status` = 'inherit'" );
|
393 |
+
$bannerlist = get_posts( $args = array(
|
394 |
+
'numberposts' => $objects_per_page,
|
395 |
+
'offset' => $start,
|
396 |
+
'orderby' => 'ID',
|
397 |
+
'order' => 'DESC',
|
398 |
+
'post_type' => 'attachment',
|
399 |
+
'post_mime_type' => array( 'image' )
|
400 |
+
) );
|
401 |
|
402 |
// build pagination
|
403 |
+
$page_links = paginate_links( array(
|
404 |
+
'base' => add_query_arg( 'paged', '%#%' ),
|
405 |
+
'format' => '',
|
406 |
+
'prev_text' => __( '«' ),
|
407 |
+
'next_text' => __( '»' ),
|
408 |
+
'total' => ceil( $img_total_count / $objects_per_page ),
|
409 |
+
'current' => intval( $_GET['paged'] ),
|
410 |
+
'add_args' => array( '_wpnonce' => wp_create_nonce( 'flag_add' ) )
|
411 |
+
) );
|
412 |
?>
|
413 |
<div class="tablenav" style="overflow: hidden; height: auto;">
|
414 |
+
<?php if ( $added === false ) { ?>
|
415 |
+
<div class="alignleft"><b><?php _e( 'Selected Media', 'flag' ); ?>: </b><input style="width:500px;" type="text" readonly="readonly" id="items_array" name="items_array" value="<?php echo $items_array_default; ?>"/>
|
416 |
+
<span class="clear_selected button"><?php _e( 'Clear Selected', 'flag' ); ?></span></div>
|
417 |
<?php } ?>
|
418 |
+
<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', number_format_i18n( ( $_GET['paged'] - 1 ) * $objects_per_page + 1 ), number_format_i18n( min( $_GET['paged'] * $objects_per_page, $img_total_count ) ), number_format_i18n( $img_total_count ), $page_links );
|
419 |
echo $page_links_text; ?></div>
|
420 |
</div>
|
421 |
<form id="bannerlib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
422 |
+
<?php wp_nonce_field( 'flag_update' ); ?>
|
423 |
<input type="hidden" name="page" value="banner-box"/>
|
424 |
|
425 |
<div class="tablenav">
|
426 |
|
427 |
<div class="actions">
|
428 |
+
<?php if ( $added === false ) { ?>
|
429 |
+
<input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e( 'Update Media', 'flag' ); ?>"/>
|
430 |
+
<?php if ( function_exists( 'json_encode' ) ) { ?>
|
431 |
<select name="bulkaction" id="bulkaction">
|
432 |
+
<option value="no_action"><?php _e( "No action", 'flag' ); ?></option>
|
433 |
+
<option value="new_playlist"><?php _e( "Create new playlist", 'flag' ); ?></option>
|
434 |
</select>
|
435 |
+
<input name="showThickbox" class="button-secondary" type="submit" value="<?php _e( 'Apply', 'flag' ); ?>" onclick="if ( !checkSelected() ) {return false;
|
436 |
}"/>
|
437 |
<?php } ?>
|
438 |
+
<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="button"><?php _e( 'Upload Banner(s)', 'flag' ); ?></a>
|
439 |
<input type="hidden" id="items_array" name="items_array" value=""/>
|
440 |
+
<?php } else { ?>
|
441 |
<input type="hidden" name="mode" value="save"/>
|
442 |
<input style="width: 80%;" type="text" id="items_array" name="items_array" readonly="readonly" value="<?php echo $added; ?>"/>
|
443 |
+
<input type="hidden" name="playlist_title" value="<?php echo esc_html( $playlist['title'] ); ?>"/>
|
444 |
+
<input type="hidden" name="skinname" value="<?php echo sanitize_flagname( $playlist['skin'] ); ?>"/>
|
445 |
+
<input type="hidden" name="skinaction" value="<?php echo sanitize_flagname( $playlist['skin'] ); ?>"/>
|
446 |
+
<textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo esc_html( $playlist['description'] ); ?></textarea>
|
447 |
+
<input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e( 'Update Playlist', 'flag' ); ?>"/>
|
448 |
<?php } ?>
|
449 |
</div>
|
450 |
|
452 |
<table class="widefat flag-table" cellspacing="0">
|
453 |
<thead>
|
454 |
<tr>
|
455 |
+
<th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e( 'Check', 'flag' ); ?></a></th>
|
456 |
<th class="id" width="64" scope="col">
|
457 |
+
<div><?php _e( 'ID', 'flag' ); ?></div>
|
458 |
</th>
|
459 |
<th class="thumb" width="110" scope="col">
|
460 |
+
<div><?php _e( 'Thumbnail', 'flag' ); ?></div>
|
461 |
</th>
|
462 |
<th class="title_filename" scope="col">
|
463 |
+
<div><?php _e( 'Filename / Title / Link', 'flag' ); ?></div>
|
464 |
</th>
|
465 |
<th class="description" scope="col">
|
466 |
+
<div><?php _e( 'Description', 'flag' ); ?></div>
|
467 |
</th>
|
468 |
</tr>
|
469 |
</thead>
|
470 |
<tfoot>
|
471 |
<tr>
|
472 |
+
<th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e( 'Check', 'flag' ); ?></a></th>
|
473 |
+
<th class="id" scope="col"><?php _e( 'ID', 'flag' ); ?></th>
|
474 |
+
<th class="thumb" scope="col"><?php _e( 'Thumbnail', 'flag' ); ?></th>
|
475 |
+
<th class="title_filename" scope="col"><?php _e( 'Filename / Title / Link', 'flag' ); ?></th>
|
476 |
+
<th class="description" scope="col"><?php _e( 'Description', 'flag' ); ?></th>
|
477 |
</tr>
|
478 |
</tfoot>
|
479 |
<tbody>
|
480 |
<?php
|
481 |
+
$uploads = wp_upload_dir();
|
482 |
+
$flag_options = get_option( 'flag_options' );
|
483 |
+
if ( $bannerlist ) {
|
484 |
+
foreach ( $bannerlist as $ban ) {
|
485 |
$list[] = $ban->ID;
|
486 |
}
|
487 |
$class = 'alternate';
|
488 |
+
foreach ( $bannerlist as $ban ) {
|
489 |
+
$class = ( empty( $class ) ) ? 'alternate' : '';
|
490 |
+
$ex = $checked = '';
|
491 |
+
if ( ( $added !== false || ! empty( $items_array_default ) ) && in_array( $ban->ID, $exclude ) ) {
|
492 |
$class .= ' already-added';
|
493 |
+
$ex = ' title="' . __( "Already Added", "flag" ) . '"';
|
494 |
$checked = ' checked="checked"';
|
495 |
}
|
496 |
+
$thumb = get_post_meta( $ban->ID, 'thumbnail', true );
|
497 |
+
$link = get_post_meta( $ban->ID, 'link', true );
|
498 |
+
if ( empty( $thumb ) ) {
|
499 |
+
$thumb = wp_get_attachment_thumb_url( $ban->ID );
|
500 |
}
|
501 |
+
$url = wp_get_attachment_url( $ban->ID );
|
502 |
?>
|
503 |
<tr id="ban-<?php echo $ban->ID; ?>" class="<?php echo $class; ?>"<?php echo $ex; ?>>
|
504 |
<td class="cb"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $ban->ID; ?>"/></td>
|
505 |
<td class="id"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $ban->ID; ?></p></td>
|
506 |
<td class="thumb">
|
507 |
+
<a class="thickbox" title="<?php echo basename( $url ); ?>" href="<?php echo $url; ?>"><img id="thumb-<?php echo $ban->ID; ?>" src="<?php echo $thumb; ?>" width="100" height="100" alt=""/></a>
|
508 |
</td>
|
509 |
<td class="title_filename">
|
510 |
+
<strong><a href="<?php echo $url; ?>"><?php echo basename( $url ); ?></a></strong><br/>
|
511 |
+
<textarea title="Title" name="item_a[<?php echo $ban->ID; ?>][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php echo esc_html( stripslashes( $ban->post_title ) ); ?></textarea><br/>
|
512 |
+
<?php _e( 'URL', 'flag' ); ?>: <input id="banlink-<?php echo $ban->ID; ?>" name="item_a[<?php echo $ban->ID; ?>][link]" style="width:50%;" type="text" value="<?php echo esc_url( $link ); ?>"/><br/>
|
513 |
</td>
|
514 |
<td class="description">
|
515 |
+
<textarea name="item_a[<?php echo $ban->ID; ?>][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1"><?php echo esc_html( stripslashes( $ban->post_content ) ); ?></textarea>
|
516 |
</td>
|
517 |
</tr>
|
518 |
<?php
|
519 |
}
|
520 |
+
} else {
|
521 |
+
echo '<tr><td colspan="5" align="center"><strong>' . __( 'No images in WordPress Media Library.', 'flag' ) . '</strong></td></tr>';
|
522 |
}
|
523 |
?>
|
524 |
</tbody>
|
529 |
<!-- #new_playlist -->
|
530 |
<div id="new_playlist" style="display: none;">
|
531 |
<form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
532 |
+
<?php wp_nonce_field( 'flag_update' ); ?>
|
533 |
<input type="hidden" id="new_playlist_banid" name="items_array" value=""/>
|
534 |
<input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value=""/>
|
535 |
<input type="hidden" name="mode" value="save"/>
|
536 |
<input type="hidden" name="page" value="banner-box"/>
|
537 |
<table width="100%" border="0" cellspacing="3" cellpadding="3">
|
538 |
<tr valign="top">
|
539 |
+
<th align="left" style="padding-top: 5px;"><?php _e( 'Playlist Title', 'flag' ); ?></th>
|
540 |
<td><input type="text" class="alignleft" name="playlist_title" value=""/>
|
541 |
|
542 |
+
<div class="alignright"><strong><?php _e( "Choose skin", 'flag' ); ?>:</strong>
|
543 |
<select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
|
544 |
+
<?php require_once( dirname( __FILE__ ) . '/get_skin.php' );
|
545 |
+
$all_skins = get_skins( $skin_folder = '', $type = 'b' );
|
546 |
+
if ( count( $all_skins ) ) {
|
547 |
+
foreach ( (array) $all_skins as $skin_file => $skin_data ) {
|
548 |
+
echo '<option value="' . dirname( $skin_file ) . '">' . $skin_data['Name'] . '</option>' . "\n";
|
549 |
}
|
550 |
+
} else {
|
551 |
+
echo '<option value="rotator_default">' . __( "No Skins", "flag" ) . '</option>';
|
552 |
}
|
553 |
?>
|
554 |
</select>
|
556 |
</td>
|
557 |
</tr>
|
558 |
<tr valign="top">
|
559 |
+
<th align="left" style="padding-top: 5px;"><?php _e( 'Playlist Description', 'flag' ); ?></th>
|
560 |
<td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
|
561 |
</tr>
|
562 |
<tr>
|
563 |
<td> </td>
|
564 |
+
<td align="right"><input class="button-secondary" type="reset" value=" <?php _e( 'Cancel', 'flag' ); ?> " onclick="tb_remove()"/>
|
565 |
|
566 |
+
<input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e( 'OK', 'flag' ); ?>"/>
|
567 |
</td>
|
568 |
</tr>
|
569 |
</table>
|
admin/banner.functions.php
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
<?php
|
2 |
-
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
|
|
|
|
|
3 |
|
4 |
function get_b_playlist_data( $playlist_file ) {
|
5 |
|
6 |
-
$playlist_content = file_get_contents($playlist_file);
|
7 |
|
8 |
-
$playlist_data['title']
|
9 |
-
$playlist_data['skin']
|
10 |
-
$playlist_data['width']
|
11 |
-
$playlist_data['height']
|
12 |
-
$playlist_data['description'] = flagGallery::flagGetBetween($playlist_content,'<description><![CDATA[',']]></description>');
|
13 |
preg_match_all( '|<item id="(.*)">|', $playlist_content, $items );
|
14 |
$playlist_data['items'] = $items[1];
|
|
|
15 |
return $playlist_data;
|
16 |
}
|
17 |
|
@@ -19,139 +22,148 @@ function get_b_playlist_data( $playlist_file ) {
|
|
19 |
* Check the playlists directory and retrieve all playlist files with playlist data.
|
20 |
*
|
21 |
*/
|
22 |
-
function get_b_playlists($playlist_folder = '') {
|
23 |
|
24 |
-
$flag_options
|
25 |
-
$flag_playlists = array
|
26 |
-
$playlist_root
|
27 |
-
if( !empty($playlist_folder) )
|
28 |
$playlist_root = $playlist_folder;
|
|
|
29 |
|
30 |
// Files in flagallery/playlists directory
|
31 |
-
$playlists_dir
|
32 |
$playlist_files = array();
|
33 |
if ( $playlists_dir ) {
|
34 |
-
while (
|
35 |
-
if ( substr($file, 0, 1) == '.' )
|
36 |
continue;
|
37 |
-
|
|
|
38 |
$playlist_files[] = $file;
|
|
|
39 |
}
|
40 |
}
|
41 |
@closedir( $playlists_dir );
|
42 |
|
43 |
-
if (
|
44 |
return $flag_playlists;
|
|
|
45 |
|
46 |
foreach ( $playlist_files as $playlist_file ) {
|
47 |
-
if ( !is_readable( "$playlist_root/$playlist_file" ) )
|
48 |
continue;
|
|
|
49 |
|
50 |
$playlist_data = get_b_playlist_data( "$playlist_root/$playlist_file" );
|
51 |
|
52 |
-
if ( empty ( $playlist_data['title'] ) )
|
53 |
continue;
|
|
|
54 |
|
55 |
-
$flag_playlists[basename( $playlist_file, ".xml" )] = $playlist_data;
|
56 |
}
|
57 |
-
uasort( $flag_playlists, create_function( '$a, $b', 'return strnatcasecmp( $a["title"], $b["title"] );' ));
|
58 |
|
59 |
return $flag_playlists;
|
60 |
}
|
61 |
|
62 |
-
function flagSave_bPlaylist($title
|
63 |
|
64 |
-
require_once(ABSPATH . '/wp-admin/includes/image.php');
|
65 |
-
if(!trim($title)) {
|
66 |
$title = 'default';
|
67 |
}
|
68 |
-
$title = htmlspecialchars_decode(stripslashes($title), ENT_QUOTES);
|
69 |
-
$descr = htmlspecialchars_decode(stripslashes($descr), ENT_QUOTES);
|
70 |
-
if (
|
71 |
-
$file = sanitize_flagname($title);
|
|
|
|
|
|
|
72 |
}
|
73 |
-
if(!is_array($data))
|
74 |
-
$data = explode(',', $data);
|
75 |
|
76 |
-
$flag_options = get_option('flag_options');
|
77 |
-
|
78 |
-
if(
|
79 |
-
|
80 |
}
|
81 |
-
$skinpath
|
82 |
-
$playlistPath = ABSPATH
|
83 |
-
$settings
|
84 |
-
if( file_exists($playlistPath) && ($skin == $skinaction) ) {
|
85 |
-
$settings = file_get_contents($playlistPath);
|
86 |
-
} elseif( file_exists($skinpath . "/settings/settings.xml") ) {
|
87 |
-
$settings = file_get_contents($skinpath . "/settings/settings.xml");
|
88 |
} else {
|
89 |
-
flagGallery::show_message(__("Can't find skin settings", 'flag'));
|
|
|
90 |
return;
|
91 |
}
|
92 |
-
$properties = flagGallery::flagGetBetween($settings,'<properties>','</properties>');
|
93 |
-
if(empty($properties)) {
|
94 |
-
flagGallery::show_message(__("Can't find skin settings", 'flag'));
|
|
|
95 |
return;
|
96 |
}
|
97 |
-
$w
|
98 |
-
$h
|
99 |
-
$suffix = $w.'x'
|
100 |
-
if(count($data)) {
|
101 |
$content = '<gallery>
|
102 |
-
<properties>'
|
103 |
-
<category id="'
|
104 |
<properties>
|
105 |
-
<title><![CDATA['
|
106 |
-
<description><![CDATA['
|
107 |
-
<skin><![CDATA['
|
108 |
</properties>
|
109 |
<items>';
|
110 |
|
111 |
-
foreach( (array) $data as $id) {
|
112 |
-
$ban = get_post($id);
|
113 |
-
if($ban->ID) {
|
114 |
-
$url = wp_get_attachment_url($ban->ID);
|
115 |
-
if($skin == 'rotator_default') {
|
116 |
-
$path
|
117 |
-
$info
|
118 |
-
$dir
|
119 |
-
$ext
|
120 |
-
$name
|
121 |
$img_file = "{$dir}/{$name}-{$suffix}.{$ext}";
|
122 |
-
if(!file_exists($img_file)){
|
123 |
-
if( function_exists('wp_get_image_editor') ) {
|
124 |
$editor = wp_get_image_editor( $path );
|
125 |
-
$editor->resize( $w, $h, $cut=true );
|
126 |
-
$dest_file = $editor->generate_filename($suffix);
|
127 |
-
$thumb
|
128 |
} else {
|
129 |
-
|
130 |
}
|
131 |
-
if(is_string($thumb)) {
|
132 |
-
|
133 |
-
$track = get_bloginfo('wpurl') . '/' .
|
134 |
} else {
|
135 |
$track = $url;
|
136 |
}
|
137 |
-
|
138 |
} else {
|
139 |
-
$track = dirname($url)."/{$name}-{$suffix}.{$ext}";
|
140 |
}
|
141 |
} else {
|
142 |
$track = $url;
|
143 |
}
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
$content .= '
|
148 |
-
<item id="'
|
149 |
-
<track>'
|
150 |
-
<title><![CDATA['
|
151 |
-
<link>'
|
152 |
-
<preview>'
|
153 |
-
<description><![CDATA['
|
154 |
-
<thumbnail>'
|
155 |
</item>';
|
156 |
}
|
157 |
}
|
@@ -161,36 +173,36 @@ function flagSave_bPlaylist($title,$descr,$data,$file='',$skinaction='') {
|
|
161 |
</gallery>';
|
162 |
//$content = str_replace(array('\\\'','\"'), array('\'','"'), $content);
|
163 |
// Save options
|
164 |
-
$flag_options = get_option('flag_options');
|
165 |
-
if(wp_mkdir_p(ABSPATH
|
166 |
-
if( flagGallery::saveFile($playlistPath
|
167 |
-
flagGallery::show_message(__('Playlist Saved Successfully','flag'));
|
168 |
}
|
169 |
} else {
|
170 |
-
flagGallery::show_message(__('Create directory please:','flag').'"/'
|
171 |
}
|
172 |
}
|
173 |
}
|
174 |
|
175 |
-
function flagSave_bPlaylistSkin($file) {
|
176 |
-
$file
|
177 |
-
$flag_options = get_option('flag_options');
|
178 |
-
$playlistPath = ABSPATH
|
179 |
// Save options
|
180 |
-
$title = esc_html($_POST['playlist_title']);
|
181 |
-
$descr = esc_html($_POST['playlist_descr']);
|
182 |
-
$items = get_b_playlist_data($playlistPath);
|
183 |
-
$data
|
184 |
-
flagSave_bPlaylist($title
|
185 |
}
|
186 |
|
187 |
-
function flag_b_playlist_delete($playlist) {
|
188 |
-
$playlist
|
189 |
-
$flag_options = get_option('flag_options');
|
190 |
-
$playlistXML
|
191 |
-
if(file_exists($playlistXML)){
|
192 |
-
if(unlink($playlistXML)) {
|
193 |
-
flagGallery::show_message("'"
|
194 |
}
|
195 |
}
|
196 |
}
|
1 |
<?php
|
2 |
+
if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
|
3 |
+
die( 'You are not allowed to call this page directly.' );
|
4 |
+
}
|
5 |
|
6 |
function get_b_playlist_data( $playlist_file ) {
|
7 |
|
8 |
+
$playlist_content = file_get_contents( $playlist_file );
|
9 |
|
10 |
+
$playlist_data['title'] = flagGallery::flagGetBetween( $playlist_content, '<title><![CDATA[', ']]></title>' );
|
11 |
+
$playlist_data['skin'] = flagGallery::flagGetBetween( $playlist_content, '<skin><![CDATA[', ']]></skin>' );
|
12 |
+
$playlist_data['width'] = flagGallery::flagGetBetween( $playlist_content, '<width><![CDATA[', ']]></width>' );
|
13 |
+
$playlist_data['height'] = flagGallery::flagGetBetween( $playlist_content, '<height><![CDATA[', ']]></height>' );
|
14 |
+
$playlist_data['description'] = flagGallery::flagGetBetween( $playlist_content, '<description><![CDATA[', ']]></description>' );
|
15 |
preg_match_all( '|<item id="(.*)">|', $playlist_content, $items );
|
16 |
$playlist_data['items'] = $items[1];
|
17 |
+
|
18 |
return $playlist_data;
|
19 |
}
|
20 |
|
22 |
* Check the playlists directory and retrieve all playlist files with playlist data.
|
23 |
*
|
24 |
*/
|
25 |
+
function get_b_playlists( $playlist_folder = '' ) {
|
26 |
|
27 |
+
$flag_options = get_option( 'flag_options' );
|
28 |
+
$flag_playlists = array();
|
29 |
+
$playlist_root = ABSPATH . $flag_options['galleryPath'] . 'playlists/banner';
|
30 |
+
if ( ! empty( $playlist_folder ) ) {
|
31 |
$playlist_root = $playlist_folder;
|
32 |
+
}
|
33 |
|
34 |
// Files in flagallery/playlists directory
|
35 |
+
$playlists_dir = @ opendir( $playlist_root );
|
36 |
$playlist_files = array();
|
37 |
if ( $playlists_dir ) {
|
38 |
+
while( ( $file = readdir( $playlists_dir ) ) !== false ){
|
39 |
+
if ( substr( $file, 0, 1 ) == '.' ) {
|
40 |
continue;
|
41 |
+
}
|
42 |
+
if ( substr( $file, - 4 ) == '.xml' ) {
|
43 |
$playlist_files[] = $file;
|
44 |
+
}
|
45 |
}
|
46 |
}
|
47 |
@closedir( $playlists_dir );
|
48 |
|
49 |
+
if ( ! $playlists_dir || empty( $playlist_files ) ) {
|
50 |
return $flag_playlists;
|
51 |
+
}
|
52 |
|
53 |
foreach ( $playlist_files as $playlist_file ) {
|
54 |
+
if ( ! is_readable( "$playlist_root/$playlist_file" ) ) {
|
55 |
continue;
|
56 |
+
}
|
57 |
|
58 |
$playlist_data = get_b_playlist_data( "$playlist_root/$playlist_file" );
|
59 |
|
60 |
+
if ( empty ( $playlist_data['title'] ) ) {
|
61 |
continue;
|
62 |
+
}
|
63 |
|
64 |
+
$flag_playlists[ basename( $playlist_file, ".xml" ) ] = $playlist_data;
|
65 |
}
|
66 |
+
uasort( $flag_playlists, create_function( '$a, $b', 'return strnatcasecmp( $a["title"], $b["title"] );' ) );
|
67 |
|
68 |
return $flag_playlists;
|
69 |
}
|
70 |
|
71 |
+
function flagSave_bPlaylist( $title, $descr, $data, $file = '', $skinaction = '' ) {
|
72 |
|
73 |
+
require_once( ABSPATH . '/wp-admin/includes/image.php' );
|
74 |
+
if ( ! trim( $title ) ) {
|
75 |
$title = 'default';
|
76 |
}
|
77 |
+
$title = htmlspecialchars_decode( stripslashes( $title ), ENT_QUOTES );
|
78 |
+
$descr = htmlspecialchars_decode( stripslashes( $descr ), ENT_QUOTES );
|
79 |
+
if ( ! $file ) {
|
80 |
+
$file = sanitize_flagname( $title );
|
81 |
+
}
|
82 |
+
if ( ! is_array( $data ) ) {
|
83 |
+
$data = explode( ',', $data );
|
84 |
}
|
|
|
|
|
85 |
|
86 |
+
$flag_options = get_option( 'flag_options' );
|
87 |
+
$skin = isset( $_POST['skinname'] ) ? sanitize_flagname( $_POST['skinname'] ) : 'rotator_default';
|
88 |
+
if ( ! $skinaction ) {
|
89 |
+
$skinaction = isset( $_POST['skinaction'] ) ? sanitize_key( $_POST['skinaction'] ) : 'update';
|
90 |
}
|
91 |
+
$skinpath = trailingslashit( $flag_options['skinsDirABS'] ) . $skin;
|
92 |
+
$playlistPath = ABSPATH . $flag_options['galleryPath'] . 'playlists/banner/' . $file . '.xml';
|
93 |
+
$settings = '';
|
94 |
+
if ( file_exists( $playlistPath ) && ( $skin == $skinaction ) ) {
|
95 |
+
$settings = file_get_contents( $playlistPath );
|
96 |
+
} elseif ( file_exists( $skinpath . "/settings/settings.xml" ) ) {
|
97 |
+
$settings = file_get_contents( $skinpath . "/settings/settings.xml" );
|
98 |
} else {
|
99 |
+
flagGallery::show_message( __( "Can't find skin settings", 'flag' ) );
|
100 |
+
|
101 |
return;
|
102 |
}
|
103 |
+
$properties = flagGallery::flagGetBetween( $settings, '<properties>', '</properties>' );
|
104 |
+
if ( empty( $properties ) ) {
|
105 |
+
flagGallery::show_message( __( "Can't find skin settings", 'flag' ) );
|
106 |
+
|
107 |
return;
|
108 |
}
|
109 |
+
$w = flagGallery::flagGetBetween( $properties, '<width><![CDATA[', ']]></width>' );
|
110 |
+
$h = flagGallery::flagGetBetween( $properties, '<height><![CDATA[', ']]></height>' );
|
111 |
+
$suffix = $w . 'x' . $h;
|
112 |
+
if ( count( $data ) ) {
|
113 |
$content = '<gallery>
|
114 |
+
<properties>' . $properties . '</properties>
|
115 |
+
<category id="' . $file . '">
|
116 |
<properties>
|
117 |
+
<title><![CDATA[' . $title . ']]></title>
|
118 |
+
<description><![CDATA[' . $descr . ']]></description>
|
119 |
+
<skin><![CDATA[' . $skin . ']]></skin>
|
120 |
</properties>
|
121 |
<items>';
|
122 |
|
123 |
+
foreach ( (array) $data as $id ) {
|
124 |
+
$ban = get_post( $id );
|
125 |
+
if ( $ban->ID ) {
|
126 |
+
$url = wp_get_attachment_url( $ban->ID );
|
127 |
+
if ( $skin == 'rotator_default' ) {
|
128 |
+
$path = get_attached_file( $ban->ID );
|
129 |
+
$info = pathinfo( $path );
|
130 |
+
$dir = $info['dirname'];
|
131 |
+
$ext = $info['extension'];
|
132 |
+
$name = urldecode( basename( str_replace( '%2F', '/', urlencode( $path ) ), ".$ext" ) );
|
133 |
$img_file = "{$dir}/{$name}-{$suffix}.{$ext}";
|
134 |
+
if ( ! file_exists( $img_file ) ) {
|
135 |
+
if ( function_exists( 'wp_get_image_editor' ) ) {
|
136 |
$editor = wp_get_image_editor( $path );
|
137 |
+
$editor->resize( $w, $h, $cut = true );
|
138 |
+
$dest_file = $editor->generate_filename( $suffix );
|
139 |
+
$thumb = $editor->save( $dest_file );
|
140 |
} else {
|
141 |
+
$thumb = image_resize( $path, $w, $h, $cut = true, $suffix );
|
142 |
}
|
143 |
+
if ( is_string( $thumb ) ) {
|
144 |
+
$img = substr( $thumb, strpos( $thumb, basename( WP_CONTENT_DIR ) ) );
|
145 |
+
$track = get_bloginfo( 'wpurl' ) . '/' . $img;
|
146 |
} else {
|
147 |
$track = $url;
|
148 |
}
|
149 |
+
|
150 |
} else {
|
151 |
+
$track = dirname( $url ) . "/{$name}-{$suffix}.{$ext}";
|
152 |
}
|
153 |
} else {
|
154 |
$track = $url;
|
155 |
}
|
156 |
+
$thumbnail = get_post_meta( $id, 'thumbnail', true );
|
157 |
+
$link = get_post_meta( $id, 'link', true );
|
158 |
+
$preview = get_post_meta( $id, 'preview', true );
|
159 |
$content .= '
|
160 |
+
<item id="' . $ban->ID . '">
|
161 |
+
<track>' . $track . '</track>
|
162 |
+
<title><![CDATA[' . $ban->post_title . ']]></title>
|
163 |
+
<link>' . $link . '</link>
|
164 |
+
<preview>' . $preview . '</preview>
|
165 |
+
<description><![CDATA[' . $ban->post_content . ']]></description>
|
166 |
+
<thumbnail>' . $thumbnail . '</thumbnail>
|
167 |
</item>';
|
168 |
}
|
169 |
}
|
173 |
</gallery>';
|
174 |
//$content = str_replace(array('\\\'','\"'), array('\'','"'), $content);
|
175 |
// Save options
|
176 |
+
$flag_options = get_option( 'flag_options' );
|
177 |
+
if ( wp_mkdir_p( ABSPATH . $flag_options['galleryPath'] . 'playlists/banner/' ) ) {
|
178 |
+
if ( flagGallery::saveFile( $playlistPath, $content, 'w' ) ) {
|
179 |
+
flagGallery::show_message( __( 'Playlist Saved Successfully', 'flag' ) );
|
180 |
}
|
181 |
} else {
|
182 |
+
flagGallery::show_message( __( 'Create directory please:', 'flag' ) . '"/' . $flag_options['galleryPath'] . 'playlists/banner/"' );
|
183 |
}
|
184 |
}
|
185 |
}
|
186 |
|
187 |
+
function flagSave_bPlaylistSkin( $file ) {
|
188 |
+
$file = sanitize_flagname( $file );
|
189 |
+
$flag_options = get_option( 'flag_options' );
|
190 |
+
$playlistPath = ABSPATH . $flag_options['galleryPath'] . 'playlists/banner/' . $file . '.xml';
|
191 |
// Save options
|
192 |
+
$title = esc_html( $_POST['playlist_title'] );
|
193 |
+
$descr = esc_html( $_POST['playlist_descr'] );
|
194 |
+
$items = get_b_playlist_data( $playlistPath );
|
195 |
+
$data = $items['items'];
|
196 |
+
flagSave_bPlaylist( $title, $descr, $data, $file, $skinaction = 'update' );
|
197 |
}
|
198 |
|
199 |
+
function flag_b_playlist_delete( $playlist ) {
|
200 |
+
$playlist = sanitize_file_name( $playlist );
|
201 |
+
$flag_options = get_option( 'flag_options' );
|
202 |
+
$playlistXML = ABSPATH . $flag_options['galleryPath'] . 'playlists/banner/' . $playlist . '.xml';
|
203 |
+
if ( file_exists( $playlistXML ) ) {
|
204 |
+
if ( unlink( $playlistXML ) ) {
|
205 |
+
flagGallery::show_message( "'" . $playlist . ".xml' " . __( 'deleted', 'flag' ) );
|
206 |
}
|
207 |
}
|
208 |
}
|
flag.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: GRAND Flash Album Gallery
|
4 |
Plugin URI: http://codeasily.com/wordpress-plugins/flag/
|
5 |
Description: The Grand Flagallery plugin - provides a comprehensive interface for managing photos and images through a set of admin pages, and it displays photos in a way that makes your web site look very professional.
|
6 |
-
Version: 4.
|
7 |
Author: Rattus
|
8 |
Author URI: http://codeasily.com/
|
9 |
|
@@ -23,7 +23,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
|
|
23 |
if (!class_exists('flagLoad')) {
|
24 |
class flagLoad {
|
25 |
|
26 |
-
var $version = '4.
|
27 |
var $dbversion = '2.75';
|
28 |
var $minium_WP = '3.0';
|
29 |
var $minium_WPMU = '3.0';
|
3 |
Plugin Name: GRAND Flash Album Gallery
|
4 |
Plugin URI: http://codeasily.com/wordpress-plugins/flag/
|
5 |
Description: The Grand Flagallery plugin - provides a comprehensive interface for managing photos and images through a set of admin pages, and it displays photos in a way that makes your web site look very professional.
|
6 |
+
Version: 4.33
|
7 |
Author: Rattus
|
8 |
Author URI: http://codeasily.com/
|
9 |
|
23 |
if (!class_exists('flagLoad')) {
|
24 |
class flagLoad {
|
25 |
|
26 |
+
var $version = '4.33';
|
27 |
var $dbversion = '2.75';
|
28 |
var $minium_WP = '3.0';
|
29 |
var $minium_WPMU = '3.0';
|
lib/image.php
CHANGED
@@ -60,6 +60,7 @@ class flagImage{
|
|
60 |
|
61 |
// set urls and paths
|
62 |
$this->imageURL = get_option ('siteurl') . '/' . $this->path . '/' . $this->filename;
|
|
|
63 |
$this->thumbURL = get_option ('siteurl') . '/' . $this->path . '/thumbs/thumbs_' . $this->filename;
|
64 |
$this->imagePath = WINABSPATH.$this->path . '/' . $this->filename;
|
65 |
$this->webimagePath = WINABSPATH.$this->path . '/webview/' . $this->filename;
|
60 |
|
61 |
// set urls and paths
|
62 |
$this->imageURL = get_option ('siteurl') . '/' . $this->path . '/' . $this->filename;
|
63 |
+
$this->webimageURL = get_option ('siteurl') . '/' . $this->path . '/webview/' . $this->filename;
|
64 |
$this->thumbURL = get_option ('siteurl') . '/' . $this->path . '/thumbs/thumbs_' . $this->filename;
|
65 |
$this->imagePath = WINABSPATH.$this->path . '/' . $this->filename;
|
66 |
$this->webimagePath = WINABSPATH.$this->path . '/webview/' . $this->filename;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Rattus
|
|
3 |
Donate link: http://photogallerycreator.com/grand-flagallery/
|
4 |
Tags: admin, flash gallery, fullscreen gallery, gallery, image, images, image gallery, mp3, music, page, photo, photo gallery, slider, plugin, slideshow, video, widget, iphone gallery, best gallery, portfolio, image rotator
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Photo Gallery, Video Gallery, Music Album & Banner Rotator plugin with powerfull admin to manage your image galleries and media content
|
@@ -52,6 +52,12 @@ Also available mp3 players and widgets.
|
|
52 |
|
53 |
== Changelog ==
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
= v4.31 - 13.03.2015 =
|
56 |
* Fixed Alternative gallery for some themes
|
57 |
|
3 |
Donate link: http://photogallerycreator.com/grand-flagallery/
|
4 |
Tags: admin, flash gallery, fullscreen gallery, gallery, image, images, image gallery, mp3, music, page, photo, photo gallery, slider, plugin, slideshow, video, widget, iphone gallery, best gallery, portfolio, image rotator
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.2.2
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Photo Gallery, Video Gallery, Music Album & Banner Rotator plugin with powerfull admin to manage your image galleries and media content
|
52 |
|
53 |
== Changelog ==
|
54 |
|
55 |
+
= v4.33 - 24.04.2015 =
|
56 |
+
* Compatibility with WP 4.2
|
57 |
+
|
58 |
+
= v4.32 - 30.03.2015 =
|
59 |
+
* Fixed Widget slow loading images
|
60 |
+
|
61 |
= v4.31 - 13.03.2015 =
|
62 |
* Fixed Alternative gallery for some themes
|
63 |
|
widgets/widgets.php
CHANGED
@@ -26,11 +26,19 @@ class flagSlideshowWidget extends WP_Widget {
|
|
26 |
$pages = array_filter( array_map ( 'intval', explode( ',', $instance['pages'] ) ) );
|
27 |
$args = array( 'post_type' => 'flagallery', 'post__in' => $pages, 'orderby' => 'post__in' );
|
28 |
$loop = new WP_Query( $args );
|
|
|
29 |
while ( $loop->have_posts() ) : $loop->the_post();
|
30 |
$gp_ID = get_the_ID();
|
31 |
$flag_custom = get_post_custom($gp_ID);
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
if($gid){
|
35 |
$galID = (int) $gid;
|
36 |
$status = $wpdb->get_var("SELECT status FROM $wpdb->flaggallery WHERE gid={$galID}");
|
@@ -50,7 +58,8 @@ class flagSlideshowWidget extends WP_Widget {
|
|
50 |
echo $before_widget . $before_title . $title . $after_title;
|
51 |
echo "\n" . '<div class="flag-widget">'. "\n";
|
52 |
|
53 |
-
if (
|
|
|
54 |
foreach($imageList as $key => $image) {
|
55 |
// get the URL constructor
|
56 |
$image = new flagImage($image[0]);
|
@@ -62,15 +71,35 @@ class flagSlideshowWidget extends WP_Widget {
|
|
62 |
$alttext = $imageList[$key]['title'];
|
63 |
$description = strip_tags( htmlspecialchars( stripslashes( flagGallery::i18n($image->description, 'pic_' . $image->pid . '_description') )) );
|
64 |
|
65 |
-
$
|
66 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
echo $out . '</a>'."\n";
|
68 |
|
69 |
}
|
70 |
}
|
71 |
|
72 |
echo '</div>'."\n";
|
73 |
-
echo '<style type="text/css">.flag_grandpages
|
74 |
echo $after_widget;
|
75 |
|
76 |
}
|
@@ -384,6 +413,7 @@ class flagWidget extends WP_Widget {
|
|
384 |
|
385 |
$gallerylist = $flagdb->get_album($album);
|
386 |
$ids = explode( ',', $gallerylist );
|
|
|
387 |
foreach ($ids as $id) {
|
388 |
$galID = (int) $id;
|
389 |
$status = $wpdb->get_var("SELECT status FROM $wpdb->flaggallery WHERE gid={$galID}");
|
@@ -408,7 +438,7 @@ class flagWidget extends WP_Widget {
|
|
408 |
echo $before_widget . $before_title . $title . $after_title;
|
409 |
echo "\n" . '<div class="flag-widget">'. "\n";
|
410 |
|
411 |
-
if (
|
412 |
|
413 |
$isMobile = (bool)preg_match('#\b(ip(hone|od|ad)|android|opera m(ob|in)i|windows (phone|ce)|blackberry|tablet'.
|
414 |
'|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp|laystation portable)|nokia|fennec|htc[\-_]'.
|
@@ -418,6 +448,7 @@ class flagWidget extends WP_Widget {
|
|
418 |
else
|
419 |
$thumbcode = 'class="flag_newbox"';
|
420 |
|
|
|
421 |
foreach($imageList as $gallery_) {
|
422 |
foreach($gallery_ as $_image) {
|
423 |
// get the URL constructor
|
@@ -426,16 +457,36 @@ class flagWidget extends WP_Widget {
|
|
426 |
// enable i18n support for alttext and description
|
427 |
$alttext = strip_tags( htmlspecialchars( stripslashes( flagGallery::i18n($image->alttext, 'pic_' . $image->pid . '_alttext') )) );
|
428 |
$description = strip_tags( htmlspecialchars( stripslashes( flagGallery::i18n($image->description, 'pic_' . $image->pid . '_description') )) );
|
429 |
-
|
430 |
-
$
|
431 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
echo $out . '</a>'."\n";
|
433 |
}
|
434 |
}
|
435 |
}
|
436 |
|
437 |
echo '</div>'."\n";
|
438 |
-
echo '<style type="text/css">.flag_fancybox
|
439 |
echo '<script type="text/javascript" defer="defer">jQuery(function(){ var fbVar = "'.plugins_url('/', dirname(__FILE__)).'"; var fbW = '.$instance['fwidth'].', fbH = '.$instance['fheight'].'; waitJQ(fbVar,fbW,fbH); });</script>'."\n";
|
440 |
echo $after_widget;
|
441 |
|
26 |
$pages = array_filter( array_map ( 'intval', explode( ',', $instance['pages'] ) ) );
|
27 |
$args = array( 'post_type' => 'flagallery', 'post__in' => $pages, 'orderby' => 'post__in' );
|
28 |
$loop = new WP_Query( $args );
|
29 |
+
$imageList = array();
|
30 |
while ( $loop->have_posts() ) : $loop->the_post();
|
31 |
$gp_ID = get_the_ID();
|
32 |
$flag_custom = get_post_custom($gp_ID);
|
33 |
+
if('all' == $flag_custom["mb_items_array"][0]){
|
34 |
+
$gid = 0;
|
35 |
+
}else {
|
36 |
+
$gal_array = array_filter( array_map( 'intval', explode( ',', $flag_custom["mb_items_array"][0] ) ) );
|
37 |
+
if ( empty( $gal_array ) ) {
|
38 |
+
continue;
|
39 |
+
}
|
40 |
+
$gid = $gal_array[0];
|
41 |
+
}
|
42 |
if($gid){
|
43 |
$galID = (int) $gid;
|
44 |
$status = $wpdb->get_var("SELECT status FROM $wpdb->flaggallery WHERE gid={$galID}");
|
58 |
echo $before_widget . $before_title . $title . $after_title;
|
59 |
echo "\n" . '<div class="flag-widget">'. "\n";
|
60 |
|
61 |
+
if (!empty($imageList)){
|
62 |
+
$wrapper_r = $instance['width']/$instance['height'];
|
63 |
foreach($imageList as $key => $image) {
|
64 |
// get the URL constructor
|
65 |
$image = new flagImage($image[0]);
|
71 |
$alttext = $imageList[$key]['title'];
|
72 |
$description = strip_tags( htmlspecialchars( stripslashes( flagGallery::i18n($image->description, 'pic_' . $image->pid . '_description') )) );
|
73 |
|
74 |
+
$thumburl = $image->thumbURL;
|
75 |
+
$thumbinfo = @getimagesize($image->thumbPath);
|
76 |
+
if(($thumbinfo[0] - $instance['width']) < -20){
|
77 |
+
$thumburl = $image->webimageURL;
|
78 |
+
$thumbpath = $image->webimagePath;
|
79 |
+
if(!file_exists($image->webimagePath)){
|
80 |
+
$thumburl = $image->imageURL;
|
81 |
+
$thumbpath = $image->imagePath;
|
82 |
+
}
|
83 |
+
$thumbinfo = @getimagesize($thumbpath);
|
84 |
+
}
|
85 |
+
$thumb_r = $thumbinfo[0]/$thumbinfo[1];
|
86 |
+
if($wrapper_r < $thumb_r){
|
87 |
+
$orientation = 'flag_thumb_landscape';
|
88 |
+
$style = 'width:auto;height:100%;margin:0 0 0 -'.floor(($instance['height']*$thumb_r - $instance['width'])/$instance['width']*50).'%;';
|
89 |
+
} else{
|
90 |
+
$orientation = 'flag_thumb_portrait';
|
91 |
+
$style = 'width:100%;height:auto;margin:-'.floor(($instance['width']/$thumb_r - $instance['height'])/$instance['height']*25).'% 0 0 0;';
|
92 |
+
}
|
93 |
+
|
94 |
+
$out = '<a href="'.$imageList[$key]['link'].'" title="' . $image->title . '" ' . $thumbcode .' style="overflow:hidden;display:inline-block;text-align:center;width:'.$instance['width'].'px;height:'.$instance['height'].'px;">';
|
95 |
+
$out .= '<img src="'.$thumburl.'" style="'.$style.'" class="'.$orientation.'" title="'.$alttext.'" alt="'.$description.'" />';
|
96 |
echo $out . '</a>'."\n";
|
97 |
|
98 |
}
|
99 |
}
|
100 |
|
101 |
echo '</div>'."\n";
|
102 |
+
echo '<style type="text/css">.flag_grandpages { box-sizing:border-box; border: 1px solid #A9A9A9; margin: 0 2px 2px 0; padding: 0; } .flag_grandpages img {max-width:none;max-height:none;}</style>'."\n";
|
103 |
echo $after_widget;
|
104 |
|
105 |
}
|
413 |
|
414 |
$gallerylist = $flagdb->get_album($album);
|
415 |
$ids = explode( ',', $gallerylist );
|
416 |
+
$imageList = array();
|
417 |
foreach ($ids as $id) {
|
418 |
$galID = (int) $id;
|
419 |
$status = $wpdb->get_var("SELECT status FROM $wpdb->flaggallery WHERE gid={$galID}");
|
438 |
echo $before_widget . $before_title . $title . $after_title;
|
439 |
echo "\n" . '<div class="flag-widget">'. "\n";
|
440 |
|
441 |
+
if (!empty($imageList)){
|
442 |
|
443 |
$isMobile = (bool)preg_match('#\b(ip(hone|od|ad)|android|opera m(ob|in)i|windows (phone|ce)|blackberry|tablet'.
|
444 |
'|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp|laystation portable)|nokia|fennec|htc[\-_]'.
|
448 |
else
|
449 |
$thumbcode = 'class="flag_newbox"';
|
450 |
|
451 |
+
$wrapper_r = $instance['width']/$instance['height'];
|
452 |
foreach($imageList as $gallery_) {
|
453 |
foreach($gallery_ as $_image) {
|
454 |
// get the URL constructor
|
457 |
// enable i18n support for alttext and description
|
458 |
$alttext = strip_tags( htmlspecialchars( stripslashes( flagGallery::i18n($image->alttext, 'pic_' . $image->pid . '_alttext') )) );
|
459 |
$description = strip_tags( htmlspecialchars( stripslashes( flagGallery::i18n($image->description, 'pic_' . $image->pid . '_description') )) );
|
460 |
+
|
461 |
+
$thumburl = $image->thumbURL;
|
462 |
+
$thumbinfo = @getimagesize($image->thumbPath);
|
463 |
+
if(($thumbinfo[0] - $instance['width']) < -20){
|
464 |
+
$thumburl = $image->webimageURL;
|
465 |
+
$thumbpath = $image->webimagePath;
|
466 |
+
if(!file_exists($image->webimagePath)){
|
467 |
+
$thumburl = $image->imageURL;
|
468 |
+
$thumbpath = $image->imagePath;
|
469 |
+
}
|
470 |
+
$thumbinfo = @getimagesize($thumbpath);
|
471 |
+
}
|
472 |
+
$thumb_r = $thumbinfo[0]/$thumbinfo[1];
|
473 |
+
if($wrapper_r < $thumb_r){
|
474 |
+
$orientation = 'flag_thumb_landscape';
|
475 |
+
$style = 'width:auto;height:100%;margin:0 0 0 -'.floor(($instance['height']*$thumb_r - $instance['width'])/$instance['width']*50).'%;';
|
476 |
+
} else{
|
477 |
+
$orientation = 'flag_thumb_portrait';
|
478 |
+
$style = 'width:100%;height:auto;margin:-'.floor(($instance['width']/$thumb_r - $instance['height'])/$instance['height']*25).'% 0 0 0;';
|
479 |
+
}
|
480 |
+
|
481 |
+
$out = '<a href="'.plugins_url().'/flash-album-gallery/flagframe.php?i='.$image->galleryid.'&f='.$instance['skin'].'&h='.$instance['fheight'].'" title="' . $image->title . '" ' . $thumbcode .' style="overflow:hidden;display:inline-block;text-align:center;width:'.$instance['width'].'px;height:'.$instance['height'].'px;">';
|
482 |
+
$out .= '<img src="'.$thumburl.'" style="'.$style.'" class="'.$orientation.'" title="'.$alttext.'" alt="'.$description.'" />';
|
483 |
echo $out . '</a>'."\n";
|
484 |
}
|
485 |
}
|
486 |
}
|
487 |
|
488 |
echo '</div>'."\n";
|
489 |
+
echo '<style type="text/css">.flag_fancybox, .flag_newbox {box-sizing:border-box; border: 1px solid #A9A9A9; margin: 0 2px 2px 0; padding: 0; } .flag_fancybox img, .flag_newbox img {max-width:none;max-height:none;} </style>'."\n";
|
490 |
echo '<script type="text/javascript" defer="defer">jQuery(function(){ var fbVar = "'.plugins_url('/', dirname(__FILE__)).'"; var fbW = '.$instance['fwidth'].', fbH = '.$instance['fheight'].'; waitJQ(fbVar,fbW,fbH); });</script>'."\n";
|
491 |
echo $after_widget;
|
492 |
|