@@ 265-275 (lines=11) @@ | ||
262 | * |
|
263 | * @return string |
|
264 | */ |
|
265 | private function get_time_string_from_guid( $media_id ) { |
|
266 | $time = date( "Y/m", strtotime( current_time( 'mysql' ) ) ); |
|
267 | if ( $media = get_post( $media_id ) ) { |
|
268 | $pattern = '/\/(\d{4}\/\d{2})\//'; |
|
269 | preg_match( $pattern, $media->guid, $matches ); |
|
270 | if ( count( $matches ) > 1 ) { |
|
271 | $time = $matches[1]; |
|
272 | } |
|
273 | } |
|
274 | return $time; |
|
275 | } |
|
276 | ||
277 | /** |
|
278 | * Get the image from a remote url and then save it locally. |
@@ 71-82 (lines=12) @@ | ||
68 | * @param number $media_id |
|
69 | * @return string |
|
70 | */ |
|
71 | private function get_time_string_from_guid( $media_id ) { |
|
72 | $time = date( "Y/m", strtotime( current_time( 'mysql' ) ) ); |
|
73 | ||
74 | if ( $media = get_post( $media_id ) ) { |
|
75 | $pattern = '/\/(\d{4}\/\d{2})\//'; |
|
76 | preg_match( $pattern, $media->guid, $matches ); |
|
77 | if ( count( $matches ) > 1 ) { |
|
78 | $time = $matches[1]; |
|
79 | } |
|
80 | } |
|
81 | return $time; |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * Return an array of allowed mime_type items used to upload a media file. |