Changeset 46382 for trunk/src/wp-admin/includes/file.php
- Timestamp:
- 10/03/2019 09:00:10 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/file.php
r46290 r46382 983 983 984 984 /** 985 * Temporarily stores the client upload reference in a transient.986 *987 * @since 5.3.0988 * @access private989 *990 * @param string $upload_ref The upload reference sent by the client.991 * @param int $attachment_id Attachment post ID.992 * @return bool Whether the transient was set.993 */994 function _wp_set_upload_ref( $upload_ref, $attachment_id ) {995 $upload_ref = preg_replace( '/[^a-zA-Z0-9_]/', '', $upload_ref );996 997 if ( ! empty( $upload_ref ) ) {998 return set_transient( '_wp_temp_image_ref:' . $upload_ref, $attachment_id, HOUR_IN_SECONDS );999 }1000 1001 return false;1002 }1003 1004 /**1005 * Get attachment post ID from an upload reference.1006 *1007 * @since 5.3.01008 * @access private1009 *1010 * @param string $upload_ref The upload reference sent by the client.1011 * @return int The attachemtn post ID. Zero if the upload reference has expired or doesn't exist.1012 */1013 function _wp_get_upload_ref_attachment_id( $upload_ref ) {1014 $upload_ref = preg_replace( '/[^a-zA-Z0-9_]/', '', $upload_ref );1015 1016 if ( ! empty( $upload_ref ) ) {1017 return (int) get_transient( '_wp_temp_image_ref:' . $upload_ref );1018 }1019 1020 return 0;1021 }1022 1023 /**1024 * Remove the transient that stores a temporary upload reference.1025 *1026 * @since 5.3.01027 * @access private1028 *1029 * @param string $upload_ref The upload reference sent by the client.1030 * @return bool Whether the transient was removed.1031 */1032 function _wp_clear_upload_ref( $upload_ref ) {1033 $upload_ref = preg_replace( '/[^a-zA-Z0-9_]/', '', $upload_ref );1034 1035 if ( ! empty( $upload_ref ) ) {1036 return delete_transient( '_wp_temp_image_ref:' . $upload_ref );1037 }1038 1039 return false;1040 }1041 1042 /**1043 985 * Downloads a URL to a local temporary file using the WordPress HTTP API. 1044 986 *
Note: See TracChangeset
for help on using the changeset viewer.