Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ACF usage in repeater/flexible content + bug fix #67

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
deal with false return when using parse_url
  • Loading branch information
juz501 committed Dec 4, 2019
commit 0b07621c62525880a6aad8f15283cecf246ddb93
15 changes: 15 additions & 0 deletions network-media-library.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ function switch_on_attachment() {
}

$referer_array = parse_url( $_SERVER[ 'HTTP_REFERER' ] );
if ( $referer_array === false ) {
if ( ! wp_doing_ajax() ) {
echo '<pre>Referer doesn\'t exist when deleting post. Preventing post deletion.</pre>';
}
exit;
}

$referer_path = $referer_array['path'];

if ( endsWith( $referer_path, 'upload.php' ) ) {
Expand Down Expand Up @@ -319,6 +326,14 @@ function filter_post_gallery( string $output, array $attr, int $instance ) : str
// Chromatix: allow deletion from local site media used in conjunction with wp_ajax_delete-post action so you can
// delete, but only on the upload.php page
$referer_array = parse_url( $_SERVER[ 'HTTP_REFERER' ] );
if ( $referer_array === false ) {
if ( ! wp_doing_ajax() ) {
echo '<pre>Referer doesn\'t exist when preparing attachment for JS. Preventing deletion.</pre>';
}
unset( $response['nonces']['delete'] );
return $response;
}

$referer_path = $referer_array['path'];

if ( ! endsWith( $referer_path, 'upload.php' ) ) {
Expand Down