Skip to content

Commit

Permalink
v 7.1.0
Browse files Browse the repository at this point in the history
- Update dependencies.
- Ensure Media Uploads are correctly working in network admin.
  • Loading branch information
Darklg committed Mar 25, 2024
1 parent 8c29bcc commit 9164dcd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: PHP Lint
uses: michaelw90/[email protected]
1 change: 1 addition & 0 deletions inc/WPUBaseUpdate/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deny from all
1 change: 1 addition & 0 deletions inc/WPUBaseUpdate/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php /* Silence */
28 changes: 26 additions & 2 deletions wpuoptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: WPU Options
Plugin URI: https://github.com/WordPressUtilities/wpuoptions
Update URI: https://github.com/WordPressUtilities/wpuoptions
Version: 7.0.0
Version: 7.1.0
Description: Friendly interface for website options
Author: Darklg
Author URI: https://darklg.me/
Expand All @@ -28,7 +28,7 @@ class WPUOptions {
private $main_url;
private $options = array(
'plugin_name' => 'WPU Options',
'plugin_version' => '7.0.0',
'plugin_version' => '7.1.0',
'plugin_userlevel' => 'manage_categories',
'plugin_menutype' => 'admin.php',
'plugin_pageslug' => 'wpuoptions-settings'
Expand Down Expand Up @@ -194,6 +194,9 @@ private function admin_hooks() {
add_action('admin_bar_menu', array(&$this,
'add_toolbar_menu_items'
), 100);
add_filter('ajax_query_attachments_args', array(&$this,
'ajax_query_attachments_args'
));
add_filter("plugin_action_links_" . plugin_basename(__FILE__), array(&$this,
'settings_link'
));
Expand Down Expand Up @@ -1309,6 +1312,27 @@ function is_item_visible($item) {

}

/* Handle attachments in multisite */
function ajax_query_attachments_args($args) {
/* Check if ajax query origin is in a network admin page */
$referer_url = wp_get_referer();
if (!$referer_url || strpos($referer_url, network_site_url()) === false) {
return $args;
}
$referer = parse_url($referer_url);
if (!is_array($referer) || !isset($referer['query'])) {
return $args;
}
parse_str($referer['query'], $params);
if (!isset($params['page'], $params['id']) || $params['page'] != 'wpuoptions-settings' || !ctype_digit($params['id'])) {
return $args;
}

/* Ensure correct blog is available */
switch_to_blog($this->get_current_site_id($params['id']));
return $args;
}

}

$WPUOptions = new WPUOptions();
Expand Down

0 comments on commit 9164dcd

Please sign in to comment.