PluginProbe
Embed Privacy / 1.10.2
Embed Privacy v1.10.2
1.14.0 1.13.0 trunk 0.1 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.10.0 1.10.1 1.10.10 1.10.2 1.10.3 1.10.4 1.10.5 1.10.6 1.10.7 1.10.8 1.10.9 1.11.0 1.11.1 1.11.2 All 68 releases
embed-privacy / inc / class-fields.php

class-fields.php in Embed Privacy 1.10.2, at inc/class-fields.php

262 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace epiphyt\Embed_Privacy;
3
4 use epiphyt\Embed_Privacy\admin\Field;
5 use epiphyt\Embed_Privacy\admin\User_Interface;
6
7 /**
8 * Custom fields for Embed Privacy.
9 *
10 * @deprecated 1.10.0
11 * @since 1.2.0
12 *
13 * @author Epiphyt
14 * @license GPL2
15 * @package epiphyt\Embed_Privacy
16 */
17 class Fields {
18 /**
19 * @var array Fields to output
20 */
21 public $fields = [];
22
23 /**
24 * @var \epiphyt\Embed_Privacy\Fields
25 */
26 private static $instance;
27
28 /**
29 * Fields constructor.
30 */
31 public function __construct() {
32 self::$instance = $this;
33 }
34
35 /**
36 * Initialize functions.
37 *
38 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::init() instead
39 */
40 public function init() {
41 \_doing_it_wrong(
42 __METHOD__,
43 \sprintf(
44 /* translators: alternative method */
45 \esc_html__( 'Use %s instead', 'embed-privacy' ),
46 'epiphyt\Embed_Privacy\admin\Fields::init()'
47 ),
48 '1.10.0'
49 );
50 }
51
52 /**
53 * Add meta boxes.
54 *
55 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::add_meta_boxes() instead
56 */
57 public function add_meta_boxes() {
58 \_doing_it_wrong(
59 __METHOD__,
60 \sprintf(
61 /* translators: alternative method */
62 \esc_html__( 'Use %s instead', 'embed-privacy' ),
63 'epiphyt\Embed_Privacy\admin\Fields::add_meta_boxes()'
64 ),
65 '1.10.0'
66 );
67 Embed_Privacy::get_instance()->fields->add_meta_boxes();
68 }
69
70 /**
71 * Enqueue admin assets.
72 *
73 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\User_Interface::enqueue_assets() instead
74 *
75 * @param string $hook The current hook
76 */
77 public function enqueue_admin_assets( $hook ) {
78 \_doing_it_wrong(
79 __METHOD__,
80 \sprintf(
81 /* translators: alternative method */
82 \esc_html__( 'Use %s instead', 'embed-privacy' ),
83 'epiphyt\Embed_Privacy\admin\User_Interface::enqueue_assets()'
84 ),
85 '1.10.0'
86 );
87 User_Interface::enqueue_assets( $hook );
88 }
89
90 /**
91 * Get a unique instance of the class.
92 *
93 * @return \epiphyt\Embed_Privacy\Fields The single instance of this class
94 */
95 public static function get_instance() {
96 if ( self::$instance === null ) {
97 self::$instance = new self();
98 }
99
100 return self::$instance;
101 }
102
103 /**
104 * Get the post meta fields HTML.
105 *
106 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::get() instead
107 */
108 public function get_the_fields_html() {
109 \_doing_it_wrong(
110 __METHOD__,
111 \sprintf(
112 /* translators: alternative method */
113 \esc_html__( 'Use %s instead', 'embed-privacy' ),
114 'epiphyt\Embed_Privacy\admin\Fields::get()'
115 ),
116 '1.10.0'
117 );
118 Embed_Privacy::get_instance()->fields->get();
119 }
120
121 /**
122 * Output an image field.
123 *
124 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Field::get_image() instead
125 *
126 * @param int $post_id The current post ID
127 * @param array $attributes An array with attributes
128 */
129 public function get_the_image_field_html( $post_id, array $attributes ) {
130 \_doing_it_wrong(
131 __METHOD__,
132 \sprintf(
133 /* translators: alternative method */
134 \esc_html__( 'Use %s instead', 'embed-privacy' ),
135 'epiphyt\Embed_Privacy\admin\Field::get_image()'
136 ),
137 '1.10.0'
138 );
139 Field::get_image( $post_id, $attributes );
140 }
141
142 /**
143 * Output a single input field depending on given attributes.
144 *
145 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Field::get() instead
146 *
147 * @param int $post_id The current post ID
148 * @param array $attributes An array with attributes
149 */
150 public function get_the_input_field_html( $post_id, array $attributes ) {
151 \_doing_it_wrong(
152 __METHOD__,
153 \sprintf(
154 /* translators: alternative method */
155 \esc_html__( 'Use %s instead', 'embed-privacy' ),
156 'epiphyt\Embed_Privacy\admin\Field::get()'
157 ),
158 '1.10.0'
159 );
160 Field::get( $attributes, $post_id );
161 }
162
163 /**
164 * Register fields.
165 *
166 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::register() instead
167 *
168 * @param array $fields Fields to register
169 */
170 public function register( array $fields = [] ) {
171 \_doing_it_wrong(
172 __METHOD__,
173 \sprintf(
174 /* translators: alternative method */
175 \esc_html__( 'Use %s instead', 'embed-privacy' ),
176 'epiphyt\Embed_Privacy\admin\Fields::register()'
177 ),
178 '1.10.0'
179 );
180 Embed_Privacy::get_instance()->fields->register( $fields );
181 }
182
183 /**
184 * Register default fields.
185 *
186 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::register_default() instead
187 */
188 public function register_default_fields() {
189 \_doing_it_wrong(
190 __METHOD__,
191 \sprintf(
192 /* translators: alternative method */
193 \esc_html__( 'Use %s instead', 'embed-privacy' ),
194 'epiphyt\Embed_Privacy\admin\Fields::register_default()'
195 ),
196 '1.10.0'
197 );
198 Embed_Privacy::get_instance()->fields->register_default();
199 }
200
201 /**
202 * Remove default meta box "Custom Fields”.
203 *
204 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::remove_default() instead
205 */
206 public function remove_default_fields() {
207 \_doing_it_wrong(
208 __METHOD__,
209 \sprintf(
210 /* translators: alternative method */
211 \esc_html__( 'Use %s instead', 'embed-privacy' ),
212 'epiphyt\Embed_Privacy\admin\Fields::remove_default()'
213 ),
214 '1.10.0'
215 );
216 Embed_Privacy::get_instance()->fields->remove_default();
217 }
218
219 /**
220 * Save the fields as post meta.
221 *
222 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::save() instead
223 *
224 * @param int $post_id The ID of the post
225 * @param \WP_Post $post The post object
226 */
227 public function save_fields( $post_id, $post ) {
228 \_doing_it_wrong(
229 __METHOD__,
230 \sprintf(
231 /* translators: alternative method */
232 \esc_html__( 'Use %s instead', 'embed-privacy' ),
233 'epiphyt\Embed_Privacy\admin\Fields::save()'
234 ),
235 '1.10.0'
236 );
237 Embed_Privacy::get_instance()->fields->save( $post_id, $post );
238 }
239
240 /**
241 * Upload a file as attachment.
242 *
243 * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::upload_file() instead
244 *
245 * @param array $file The file to upload
246 * @return int The attachment ID
247 */
248 public function upload_file( array $file ) {
249 \_doing_it_wrong(
250 __METHOD__,
251 \sprintf(
252 /* translators: alternative method */
253 \esc_html__( 'Use %s instead', 'embed-privacy' ),
254 'epiphyt\Embed_Privacy\admin\Fields::upload_file()'
255 ),
256 '1.10.0'
257 );
258
259 return Embed_Privacy::get_instance()->fields->upload_file( $file );
260 }
261 }
262