Version Description
- bug corrected that was breaking plugin operation for php versions prior to 5.3
- added a "Maintenance Actions" section in plugin's Dashboard page
- added option in plugin's "Maintenance Actions" to completely clean the database log
Download this release
Release Info
Developer | nickboss |
Plugin | WordPress File Upload |
Version | 3.3.1 |
Comparing to | |
See all releases |
Code changes from version 3.3.0 to 3.3.1
- lib/wfu_admin.php +83 -2
- lib/wfu_functions.php +5 -1
- readme.txt +8 -0
- release_notes.txt +1 -1
- wordpress_file_upload.php +1 -1
lib/wfu_admin.php
CHANGED
@@ -159,9 +159,20 @@ function wordpress_file_upload_manage_dashboard() {
|
|
159 |
wfu_edit_filedetails($file);
|
160 |
$echo_str = wfu_file_details($file, false);
|
161 |
}
|
|
|
|
|
|
|
162 |
elseif ( $action == 'sync_db' ) {
|
163 |
$affected_items = wfu_sync_database();
|
164 |
-
$echo_str =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
elseif ( $action == 'plugin_settings' ) {
|
167 |
$echo_str = wfu_manage_settings();
|
@@ -218,7 +229,8 @@ function wfu_manage_mainmenu($message = '') {
|
|
218 |
if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser" class="button" title="File browser">File Browser</a>';
|
219 |
// if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=shortcode_composer" class="button" title="Shortcode composer">Shortcode Composer</a>';
|
220 |
if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=view_log" class="button" title="View log">View Log</a>';
|
221 |
-
if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=
|
|
|
222 |
$echo_str .= "\n\t\t".'<h3 style="margin-bottom: 10px; margin-top: 40px;">Status</h3>';
|
223 |
$echo_str .= "\n\t\t".'<table class="form-table">';
|
224 |
$echo_str .= "\n\t\t\t".'<tbody>';
|
@@ -312,6 +324,75 @@ function wfu_manage_mainmenu($message = '') {
|
|
312 |
echo $echo_str;
|
313 |
}
|
314 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
function wfu_construct_post_list($posts) {
|
316 |
$ids = array();
|
317 |
$list = array();
|
159 |
wfu_edit_filedetails($file);
|
160 |
$echo_str = wfu_file_details($file, false);
|
161 |
}
|
162 |
+
elseif ( $action == 'maintenance_actions' ) {
|
163 |
+
$echo_str = wfu_maintenance_actions();
|
164 |
+
}
|
165 |
elseif ( $action == 'sync_db' ) {
|
166 |
$affected_items = wfu_sync_database();
|
167 |
+
$echo_str = wfu_maintenance_actions('Database updated. '.$affected_items.' items where affected.');
|
168 |
+
}
|
169 |
+
elseif ( $action == 'clean_log_ask' ) {
|
170 |
+
$echo_str = wfu_clean_log_prompt();
|
171 |
+
}
|
172 |
+
elseif ( $action == 'clean_log' ) {
|
173 |
+
$ret = wfu_clean_log();
|
174 |
+
if ( $ret <= -1 ) $echo_str = wfu_maintenance_actions();
|
175 |
+
else $echo_str = wfu_maintenance_actions('Database cleaned. '.$ret.' items where affected.');
|
176 |
}
|
177 |
elseif ( $action == 'plugin_settings' ) {
|
178 |
$echo_str = wfu_manage_settings();
|
229 |
if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser" class="button" title="File browser">File Browser</a>';
|
230 |
// if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=shortcode_composer" class="button" title="Shortcode composer">Shortcode Composer</a>';
|
231 |
if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=view_log" class="button" title="View log">View Log</a>';
|
232 |
+
if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=maintenance_actions" class="button" title="Maintenance Actions">Maintenance Actions</a>';
|
233 |
+
// if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=sync_db" class="button" title="Update database to reflect current status of files">Sync Database</a>';
|
234 |
$echo_str .= "\n\t\t".'<h3 style="margin-bottom: 10px; margin-top: 40px;">Status</h3>';
|
235 |
$echo_str .= "\n\t\t".'<table class="form-table">';
|
236 |
$echo_str .= "\n\t\t\t".'<tbody>';
|
324 |
echo $echo_str;
|
325 |
}
|
326 |
|
327 |
+
function wfu_maintenance_actions($message = '') {
|
328 |
+
if ( !current_user_can( 'manage_options' ) ) return wfu_manage_mainmenu();
|
329 |
+
|
330 |
+
$siteurl = site_url();
|
331 |
+
|
332 |
+
$echo_str = '<div class="wrap">';
|
333 |
+
$echo_str .= "\n\t".'<h2>Wordpress File Upload Control Panel</h2>';
|
334 |
+
if ( $message != '' ) {
|
335 |
+
$echo_str .= "\n\t".'<div class="updated">';
|
336 |
+
$echo_str .= "\n\t\t".'<p>'.$message.'</p>';
|
337 |
+
$echo_str .= "\n\t".'</div>';
|
338 |
+
}
|
339 |
+
$echo_str .= "\n\t".'<div style="margin-top:20px;">';
|
340 |
+
$echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
|
341 |
+
$echo_str .= "\n\t\t".'<h2 style="margin-bottom: 10px; margin-top: 20px;">Maintenance Actions</h2>';
|
342 |
+
$echo_str .= "\n\t\t".'<div style="margin-left:20px;">';
|
343 |
+
$echo_str .= "\n\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=sync_db" class="button" style="margin-top:10px;" title="Update database to reflect current status of files">Sync Database</a><label style="margin-left:10px;">Update database to reflect current status of files.</label>';
|
344 |
+
$echo_str .= "\n\t\t\t".'<br /><a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=clean_log_ask" class="button" style="margin-top:10px;" title="Clean all database log">Clean Log</a><label style="margin-left:10px;">Clean-up all database log, including file information and user data (files will not be affected).</label>';
|
345 |
+
$echo_str .= "\n\t\t".'</div>';
|
346 |
+
$echo_str .= "\n\t".'</div>';
|
347 |
+
$echo_str .= "\n".'</div>';
|
348 |
+
|
349 |
+
echo $echo_str;
|
350 |
+
}
|
351 |
+
|
352 |
+
function wfu_clean_log_prompt() {
|
353 |
+
$siteurl = site_url();
|
354 |
+
|
355 |
+
if ( !current_user_can( 'manage_options' ) ) return wfu_manage_mainmenu();
|
356 |
+
|
357 |
+
$echo_str = "\n".'<div class="wrap">';
|
358 |
+
$echo_str .= "\n\t".'<div style="margin-top:20px;">';
|
359 |
+
$echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=maintenance_actions" class="button" title="go back">Go back</a>';
|
360 |
+
$echo_str .= "\n\t".'</div>';
|
361 |
+
$echo_str .= "\n\t".'<h2 style="margin-bottom: 10px;">Clean Database Log</h2>';
|
362 |
+
$echo_str .= "\n\t".'<form enctype="multipart/form-data" name="clean_log" id="clean_log" method="post" action="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload" class="validate">';
|
363 |
+
$nonce = wp_nonce_field('wfu_clean_log', '_wpnonce', false, false);
|
364 |
+
$nonce_ref = wp_referer_field(false);
|
365 |
+
$echo_str .= "\n\t\t".$nonce;
|
366 |
+
$echo_str .= "\n\t\t".$nonce_ref;
|
367 |
+
$echo_str .= "\n\t\t".'<input type="hidden" name="action" value="clean_log">';
|
368 |
+
$echo_str .= "\n\t\t".'<label>Are you sure that you want to clean the database log? This will erase all file data kept by the plugin in the database. Files uploaded by the plugin will be maintained, however all relevant information, such as user data, will be erased.</label><br/>';
|
369 |
+
$echo_str .= "\n\t\t".'<p class="submit">';
|
370 |
+
$echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Yes">';
|
371 |
+
$echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Cancel">';
|
372 |
+
$echo_str .= "\n\t\t".'</p>';
|
373 |
+
$echo_str .= "\n\t".'</form>';
|
374 |
+
$echo_str .= "\n".'</div>';
|
375 |
+
return $echo_str;
|
376 |
+
}
|
377 |
+
|
378 |
+
function wfu_clean_log() {
|
379 |
+
global $wpdb;
|
380 |
+
|
381 |
+
if ( !current_user_can( 'manage_options' ) ) return -1;
|
382 |
+
if ( !check_admin_referer('wfu_clean_log') ) return -1;
|
383 |
+
|
384 |
+
$count = -1;
|
385 |
+
if ( isset($_POST['submit']) && $_POST['submit'] == "Yes" ) {
|
386 |
+
$table_name1 = $wpdb->prefix . "wfu_log";
|
387 |
+
$table_name2 = $wpdb->prefix . "wfu_userdata";
|
388 |
+
|
389 |
+
$count = $wpdb->query($wpdb->prepare("DELETE FROM ".$table_name1));
|
390 |
+
$count += $wpdb->query($wpdb->prepare("DELETE FROM ".$table_name2));
|
391 |
+
}
|
392 |
+
|
393 |
+
return $count;
|
394 |
+
}
|
395 |
+
|
396 |
function wfu_construct_post_list($posts) {
|
397 |
$ids = array();
|
398 |
$list = array();
|
lib/wfu_functions.php
CHANGED
@@ -1521,6 +1521,10 @@ function wfu_process_media_insert($file_path, $page_id){
|
|
1521 |
|
1522 |
//********************* Form Fields Functions ****************************************************************************************************
|
1523 |
|
|
|
|
|
|
|
|
|
1524 |
// function wfu_parse_userdata_attribute parses the shortcode attribute to a form field array
|
1525 |
function wfu_parse_userdata_attribute($value){
|
1526 |
$fields = array();
|
@@ -1545,7 +1549,7 @@ function wfu_parse_userdata_attribute($value){
|
|
1545 |
}
|
1546 |
// $fields_arr = explode("/", $value);
|
1547 |
$value = str_replace("/", "[/]", $value);
|
1548 |
-
$value = preg_replace_callback("/\(.*\)/",
|
1549 |
$fields_arr = explode("[/]", $value);
|
1550 |
//parse shortcode attribute to $fields
|
1551 |
foreach ( $fields_arr as $field_raw ) {
|
1521 |
|
1522 |
//********************* Form Fields Functions ****************************************************************************************************
|
1523 |
|
1524 |
+
function wfu_preg_replace_callback_func($matches) {
|
1525 |
+
return str_replace("[/]", "/", $matches[0]);
|
1526 |
+
}
|
1527 |
+
|
1528 |
// function wfu_parse_userdata_attribute parses the shortcode attribute to a form field array
|
1529 |
function wfu_parse_userdata_attribute($value){
|
1530 |
$fields = array();
|
1549 |
}
|
1550 |
// $fields_arr = explode("/", $value);
|
1551 |
$value = str_replace("/", "[/]", $value);
|
1552 |
+
$value = preg_replace_callback("/\(.*\)/", "wfu_preg_replace_callback_func", $value);
|
1553 |
$fields_arr = explode("[/]", $value);
|
1554 |
//parse shortcode attribute to $fields
|
1555 |
foreach ( $fields_arr as $field_raw ) {
|
readme.txt
CHANGED
@@ -129,6 +129,11 @@ There is an option in plugin's settings in Dashboard to relax the CSS rules, so
|
|
129 |
|
130 |
== Changelog ==
|
131 |
|
|
|
|
|
|
|
|
|
|
|
132 |
= 3.3.0 =
|
133 |
* userdatalabel attribute changed to allow many field types
|
134 |
* added the following user data field types: simple text, multiline text, number, email, confirmation email, password, confirmation password, checkbox, radiobutton, date, time, datetime, listbox and dropdown list
|
@@ -488,6 +493,9 @@ Initial version.
|
|
488 |
|
489 |
== Upgrade Notice ==
|
490 |
|
|
|
|
|
|
|
491 |
= 3.3.0 =
|
492 |
Major upgrade to add some new featuresand fix some minor bugs.
|
493 |
|
129 |
|
130 |
== Changelog ==
|
131 |
|
132 |
+
= 3.3.1 =
|
133 |
+
* bug corrected that was breaking plugin operation for php versions prior to 5.3
|
134 |
+
* added a "Maintenance Actions" section in plugin's Dashboard page
|
135 |
+
* added option in plugin's "Maintenance Actions" to completely clean the database log
|
136 |
+
|
137 |
= 3.3.0 =
|
138 |
* userdatalabel attribute changed to allow many field types
|
139 |
* added the following user data field types: simple text, multiline text, number, email, confirmation email, password, confirmation password, checkbox, radiobutton, date, time, datetime, listbox and dropdown list
|
493 |
|
494 |
== Upgrade Notice ==
|
495 |
|
496 |
+
= 3.3.1 =
|
497 |
+
Important upgrade to correct a bug of the previous version and introduce a new feature.
|
498 |
+
|
499 |
= 3.3.0 =
|
500 |
Major upgrade to add some new featuresand fix some minor bugs.
|
501 |
|
release_notes.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<span><strong>Latest release notes: </strong>This is a major feature upgrade. Now you can submit additional data together with the uploaded files </span><span style="text-decoration:underline;">using various form fields</span><span>. The new field types supported are: <strong>text, multi-text, number, email, confirmation-email, password, confirmation-password, check-box, radio-buttons, date, time, date/time, list-box and drop-down list</strong>. Several options are provided to configure the fields, such as define if they are required or not, set a default value, set a comma-separated list of contained items (e.g. for listboxes), define if they need to be validated, set the location of the label etc. All these options can be set using the <strong>userdatalabel</strong> attribute as before. Its syntax has been extended to accept the additional options, however </span><span style="text-decoration:underline;">backward compatibility is maintained</span><span> to read the old format. A description of the new format is included in the plugin's instructions, however </span><span style="text-decoration:underline;">it is much easier to configure the attribute using the Shortcode Composer</span><span> which has also been updated. Furthermore, a detailed description of the new fields feature is described in a separate article </span><a href="http://www.iptanus.com/the-new-form-fields-of-wordpress-file-upload-plugin">here</a><span>.<br /><br />In order to make the form fields even more flexible, <strong>placements</strong> attributes, which defines the locations of the building blocks of the plugin, allows to use </span><span style="text-decoration:underline;">more than one instances of <em>userdata</em> block</span><span> (the block that contains the form fields). This means that you can have form fields existing in many locations, e.g. you can have form fields before the select button and form fields after the select button at the same time. The fields of the first instance of <em>userdata</em> block are set using <strong>userdatalabel</strong> attribute, the fields of the second instance using the <strong>userdatalabel2</strong> attribute and show on.</span>
|
1 |
+
<span><strong>Latest release notes: </strong>This version corrects a bug that was breaking the plugin for PHP versions prior to 5.3, after introduction of major version 3.3.0. Furthermore, a new page is added in the plugin's area in Dashboard called "Maintenance Actions", which contains the "Sync Database" action also a new one, "Clean Log" that cleans entirely the plugin's database log.<br /><br /><strong>Version 3.3.0 notes: </strong>This is a major feature upgrade. Now you can submit additional data together with the uploaded files </span><span style="text-decoration:underline;">using various form fields</span><span>. The new field types supported are: <strong>text, multi-text, number, email, confirmation-email, password, confirmation-password, check-box, radio-buttons, date, time, date/time, list-box and drop-down list</strong>. Several options are provided to configure the fields, such as define if they are required or not, set a default value, set a comma-separated list of contained items (e.g. for listboxes), define if they need to be validated, set the location of the label etc. All these options can be set using the <strong>userdatalabel</strong> attribute as before. Its syntax has been extended to accept the additional options, however </span><span style="text-decoration:underline;">backward compatibility is maintained</span><span> to read the old format. A description of the new format is included in the plugin's instructions, however </span><span style="text-decoration:underline;">it is much easier to configure the attribute using the Shortcode Composer</span><span> which has also been updated. Furthermore, a detailed description of the new fields feature is described in a separate article </span><a href="http://www.iptanus.com/the-new-form-fields-of-wordpress-file-upload-plugin">here</a><span>.<br /><br />In order to make the form fields even more flexible, <strong>placements</strong> attributes, which defines the locations of the building blocks of the plugin, allows to use </span><span style="text-decoration:underline;">more than one instances of <em>userdata</em> block</span><span> (the block that contains the form fields). This means that you can have form fields existing in many locations, e.g. you can have form fields before the select button and form fields after the select button at the same time. The fields of the first instance of <em>userdata</em> block are set using <strong>userdatalabel</strong> attribute, the fields of the second instance using the <strong>userdatalabel2</strong> attribute and show on.</span>
|
wordpress_file_upload.php
CHANGED
@@ -4,7 +4,7 @@ if( !session_id() ) { session_start(); }
|
|
4 |
/*
|
5 |
Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
|
6 |
Description: Simple interface to upload files from a page.
|
7 |
-
Version: 3.3.
|
8 |
Author: Nickolas Bossinas
|
9 |
Author URI: http://www.iptanus.com
|
10 |
*/
|
4 |
/*
|
5 |
Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
|
6 |
Description: Simple interface to upload files from a page.
|
7 |
+
Version: 3.3.1
|
8 |
Author: Nickolas Bossinas
|
9 |
Author URI: http://www.iptanus.com
|
10 |
*/
|