Skip to content

Commit 7f93910

Browse files
committed
frame+review: no longer use SCRIPT_NAME to load wp-load.php
Signed-off-by: Hubert Figuière <hub@collabora.com>
1 parent 02e1a07 commit 7f93910

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

cool.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@
1414
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
1515
*/
1616

17-
if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) ) {
18-
$my_path = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
19-
if ( empty( $my_path[0] ) ) {
20-
die( 'URL error' );
21-
}
22-
require_once $my_path[0] . 'wp-load.php';
23-
} else {
24-
die( 'Can\'t load WordPress.' );
25-
}
17+
// This is assume the standard plugin installation on WordPress.
18+
// This file is in `wp-content/plugins/collabora-online-wp`.
19+
require_once __DIR__ . '/../../../wp-load.php';
2620

2721
if ( ! isset( $_GET['id'] ) ) {
2822
die( 'No id passed' );

0 commit comments

Comments
 (0)