PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.2
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / classes / resources / uploaded-collection.php
jetformbuilder / includes / classes / resources Last commit date
file-collection.php 1 year ago file-tools.php 3 months ago file.php 1 year ago has-error-file.php 2 years ago media-block-value.php 1 year ago sanitize-file-exception.php 2 years ago upload-dir.php 1 year ago upload-exception.php 2 years ago upload-permission-exception.php 2 years ago uploaded-collection.php 1 year ago uploaded-file-path.php 2 years ago uploaded-file.php 2 months ago
uploaded-collection.php
103 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Classes\Resources;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 class Uploaded_Collection implements Media_Block_Value, Uploaded_File_Path {
12
13 /** @var Uploaded_File[] */
14 protected $uploads = array();
15
16 public function __construct( array $uploads = array() ) {
17 $this->set_uploads( $uploads );
18 }
19
20 /*
21 * Realisation of
22 * \Jet_Form_Builder\Classes\Resources\Media_Block_Value
23 */
24
25 /**
26 * @return string
27 */
28 public function get_attachment_id(): string {
29 $ids = array();
30
31 foreach ( $this->uploads as $upload ) {
32 $ids[] = $upload->get_attachment_id();
33 }
34
35 return implode( ',', $ids );
36 }
37
38 public function get_attachment_ids(): array {
39 $ids = array();
40
41 foreach ( $this->uploads as $upload ) {
42 $ids[] = $upload->get_attachment_id();
43 }
44
45 return $ids;
46 }
47
48 /**
49 * @return string
50 */
51 public function get_attachment_url(): string {
52 $urls = array();
53
54 foreach ( $this->uploads as $upload ) {
55 $urls[] = $upload->get_attachment_url();
56 }
57
58 return implode( ',', $urls );
59 }
60
61 /**
62 * @return array
63 */
64 public function get_attachment_both(): array {
65 $both = array();
66
67 foreach ( $this->uploads as $upload ) {
68 $both[] = $upload->get_attachment_both();
69 }
70
71 return $both;
72 }
73
74 /*
75 * Realisation of
76 * \Jet_Form_Builder\Classes\Resources\Uploaded_File_Path
77 */
78
79 /**
80 * @return string
81 */
82 public function get_attachment_file(): string {
83 $files = array();
84
85 foreach ( $this->uploads as $upload ) {
86 $files[] = $upload->get_attachment_file();
87 }
88
89 return implode( ',', $files );
90 }
91
92 /**
93 * @param Uploaded_File[] $uploads
94 */
95 public function set_uploads( array $uploads ) {
96 foreach ( $uploads as $uploaded_file ) {
97 if ( $uploaded_file instanceof Uploaded_File ) {
98 $this->uploads[] = $uploaded_file;
99 }
100 }
101 }
102 }
103