Skip to content

Commit 2ad6939

Browse files
committed
feat: add file for admin-notice (if the plugin is not active).
1 parent 57f0e79 commit 2ad6939

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

readme.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ The basic idea is to give every user a key (via. cookies) for a specific folder
66

77

88
ℹ WordPress handles uploads for the main_site( blog_id = 1) differently than every other blog.
9-
Instead of putting uploads in `uploads/sites/1/year/...` it puts them direcly in the uploads folder like `uploads/year/...`
10-
11-
🚨 This plugin changes the upload path of newly uploaded files in the main_site. You might want to move them to a single place.
9+
Instead of putting uploads in `uploads/sites/1/year/...` it puts them directly in the uploads folder like `uploads/year/...`
1210

11+
🚨 This plugin changes the upload path of newly uploaded files in the main_site (to a subdirectory). You might want to move your old files to the new place.
1312

1413
## Prerequisites
1514

secure-file-notice-plugin-active.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* This is not your standard WordPress pulign file (readme.md for more).
4+
* It is loaded in wp-config.php and notices an admin, if the plugin is not active.
5+
*/
6+
7+
add_action(
8+
'admin_notices',
9+
function() {
10+
if ( is_plugin_active( 'secure-file/secure-file.php' ) ) {
11+
return;
12+
}
13+
14+
$message = __(
15+
'This installation includes the secure-file plugin (probably via. wp-config). ' .
16+
'Make sure the plugin network-activated, odd things may happen otherwise ;)',
17+
'sfile'
18+
);
19+
$class = 'notice notice-warning';
20+
21+
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
22+
}
23+
);

secure-file.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@
77
* @wordpress-plugin
88
* Plugin Name: Secure File
99
* Plugin URI: https://github.com/dol-lab/secure-file
10-
* Version: 0.2
10+
* Version: 0.2.2
1111
* Author: Vitus Schuhwerk
12-
* Description: This plugin is not plug and play. Specify File security. This Plugin exposes a filter "secure_file_cookie". It's designed for a post-mu network.
12+
* Description: This plugin is not plug and play. Specify File security. This Plugin exposes a filter "secure_file_cookie".
13+
* It's designed for a post-mu network.
1314
* Text Domain: sfile
1415
* License: GPLv3
1516
*
1617
* For todos and prerequisites check readme.md.
1718
*
1819
* To better understand the code here check file naming conventions:
1920
* @see https://stackoverflow.com/questions/2235173/file-name-path-name-base-name-naming-standard-for-pieces-of-a-path
20-
* @todo
21-
* @todo: add filter sanitize_file_name to not allow filenames with multiple dots: preg_replace( '/\.+/', '.', $new_filename );
2221
*/
2322

2423
require_once 'includes/sfile-filters-actions.php';

0 commit comments

Comments
 (0)