Changeset 3745452 for image-hub/trunk/inc/src/MediaModal.php
- Timestamp:
- 10/14/2026 06:21:08 AM (3 days ago)
- File:
-
- 1 edited
-
image-hub/trunk/inc/src/MediaModal.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
image-hub/trunk/inc/src/MediaModal.php
r3308961 r3745452 33 33 public function image_hub_enqueue_media_library_scripts($id = '') 34 34 { 35 if (is_admin() ) {35 if (is_admin() && current_user_can('upload_files')) { 36 36 Utils::enque_image_hub_script('media-modal', false); 37 37 … … 63 63 } 64 64 65 if (!current_user_can('upload_files')) { 66 wp_send_json_error('You are not allowed to upload files.', 403); 67 } 68 65 69 // call the callback url to notify provider that image is downloaded (unsplash terms) 66 70 //https://help.unsplash.com/en/articles/2511258-guideline-triggering-a-download … … 68 72 $callback_url = esc_url_raw(wp_unslash($_POST['downloadImageCallbackUrl'])); 69 73 70 if (filter_var($callback_url, FILTER_VALIDATE_URL)) { 71 $response = wp_remote_get($callback_url); 74 // The callback always goes through the image service, so any other host is ignored. 75 $service_host = wp_parse_url(Utils::get_service_url(), PHP_URL_HOST); 76 77 if (filter_var($callback_url, FILTER_VALIDATE_URL) && $service_host && wp_parse_url($callback_url, PHP_URL_HOST) === $service_host) { 78 // A dev service can run on localhost, which wp_safe_remote_get() refuses. 79 $response = defined('IMAGE_HUB_DEV_SERVICE_URL') ? wp_remote_get($callback_url) : wp_safe_remote_get($callback_url); 72 80 if (is_wp_error($response)) { 73 81 wp_send_json_error('Failed to fetch data from callback URL. ' . $callback_url);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)