PluginProbe
Depicter — Popup & Slider Builder / trunk
Depicter — Popup & Slider Builder vtrunk
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / averta / wordpress / src / File / UploadsDirectory.php

UploadsDirectory.php in Depicter — Popup & Slider Builder trunk, at vendor/averta/wordpress/src/File/UploadsDirectory.php

77 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Averta\WordPress\File;
3
4
5 class UploadsDirectory
6 {
7 /**
8 * Array of information about the upload directory.
9 *
10 * @var array
11 */
12 private $uploads_directory;
13
14 /**
15 * UploadsDirectory constructor.
16 *
17 * @param string|null $time (Optional) Time formatted in 'yyyy/mm'. Default value: null
18 * @param bool $create_dir (Optional) Whether to check and create the uploads directory. Default true for backward compatibility.Default value: true
19 * @param bool $refresh_cache (Optional) Whether to refresh the cache. Default value: false
20 */
21 public function __construct( $time = null, $create_dir = true, $refresh_cache = false )
22 {
23 $this->uploads_directory = wp_upload_dir( $time, $create_dir, $refresh_cache );
24 }
25
26 /**
27 * Base directory and sub directory or full path to upload directory.
28 * @example C:\path\to\wordpress\wp-content\uploads\2010\05
29 *
30 * @return mixed
31 */
32 public function getPath(){
33 return $this->uploads_directory['path'];
34 }
35
36 /**
37 * Base url and sub directory or absolute URL to upload directory.
38 * @example http://example.com/wp-content/uploads/2010/05
39 *
40 * @return mixed
41 */
42 public function getUrl(){
43 return $this->uploads_directory['url'];
44 }
45
46 /**
47 * Path without subdir.
48 * @example C:\path\to\wordpress\wp-content\uploads
49 *
50 * @return mixed
51 */
52 public function getBaseDirectory(){
53 return $this->uploads_directory['basedir'];
54 }
55
56 /**
57 * URL path without subdir.
58 * @example http://example.com/wp-content/uploads
59 *
60 * @return mixed
61 */
62 public function getBaseUrl(){
63 return $this->uploads_directory['baseurl'];
64 }
65
66 /**
67 * Sub directory if uploads use year/month folders option is on.
68 * @example /2010/05
69 *
70 * @return mixed
71 */
72 public function getSubDirectory(){
73 return $this->uploads_directory['subdir'];
74 }
75
76 }
77