PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.7.31.4
Pods – Custom Content Types and Fields v2.7.31.4
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / includes / classes.php
pods / includes Last commit date
compatibility 3 days ago access.php 3 days ago classes.php 3 days ago data.php 3 days ago general.php 3 days ago media.php 3 days ago
classes.php
297 lines
1 <?php
2 /**
3 * @package Pods\Global\Functions\Classes
4 */
5 /**
6 * Include and Init the Pods class
7 *
8 * @see Pods
9 *
10 * @param string $type The pod name
11 * @param mixed $id (optional) The ID or slug, to load a single record; Provide array of $params to run 'find'
12 * @param bool $strict (optional) If set to true, return false instead of an object if the Pod doesn't exist
13 *
14 * @return bool|\Pods returns false if $strict, WP_DEBUG, PODS_STRICT or (PODS_DEPRECATED && PODS_STRICT_MODE) are true
15 * @since 2.0.0
16 * @link https://pods.io/docs/pods/
17 */
18 function pods( $type = null, $id = null, $strict = null ) {
19
20 require_once PODS_DIR . 'classes/Pods.php';
21
22 $pod = new Pods( $type, $id );
23
24 if ( null === $strict ) {
25 $strict = pods_strict();
26 }
27
28 if ( true === $strict && null !== $type && ! $pod->valid() ) {
29 return false;
30 }
31
32 return $pod;
33 }
34
35 /**
36 * Easily create content admin screens with in-depth customization. This is the primary interface function that Pods
37 * runs off of. It's also the only function required to be run in order to have a fully functional Manage interface.
38 *
39 * @see PodsUI
40 *
41 * @param array|string|Pods $obj (optional) Configuration options for the UI
42 * @param boolean $deprecated (optional) Whether to enable deprecated options (used by pods_ui_manage)
43 *
44 * @return PodsUI
45 *
46 * @since 2.0.0
47 * @link https://pods.io/docs/pods-ui/
48 */
49 function pods_ui( $obj, $deprecated = false ) {
50
51 require_once PODS_DIR . 'classes/PodsUI.php';
52
53 return new PodsUI( $obj, $deprecated );
54 }
55
56 /**
57 * Include and get the PodsAPI object, for use with all calls that Pods makes for add, save, delete, and more.
58 *
59 * @see PodsAPI
60 *
61 * @param string $pod (optional) (deprecated) The Pod name
62 * @param string $format (optional) (deprecated) Format used in import() and export()
63 *
64 * @return PodsAPI
65 *
66 * @since 2.0.0
67 * @link https://pods.io/docs/pods-api/
68 */
69 function pods_api( $pod = null, $format = null ) {
70
71 require_once PODS_DIR . 'classes/PodsAPI.php';
72
73 return PodsAPI::init( $pod, $format );
74 }
75
76 /**
77 * Include and Init the PodsData class
78 *
79 * @see PodsData
80 *
81 * @param string|\Pod $pod The pod object to load
82 * @param int $id (optional) Id of the pod to fetch
83 * @param bool $strict (optional) If true throw an error if the pod does not exist
84 * @param bool $unique (optional) If true always return a unique class
85 *
86 * @return PodsData
87 *
88 * @since 2.0.0
89 */
90 function pods_data( $pod = null, $id = null, $strict = true, $unique = true ) {
91
92 require_once PODS_DIR . 'classes/PodsData.php';
93
94 if ( $unique && false !== $pod ) {
95 return new PodsData( $pod, $id, $strict );
96 }
97
98 return PodsData::init( $pod, $id, $strict );
99 }
100
101 /**
102 * Include and Init the PodsFormUI class
103 *
104 * @see PodsForm
105 *
106 * @return PodsForm
107 *
108 * @since 2.0.0
109 */
110 function pods_form() {
111
112 require_once PODS_DIR . 'classes/PodsForm.php';
113
114 return PodsForm::init();
115 }
116
117 /**
118 * Include and Init the Pods class
119 *
120 * @see PodsInit
121 *
122 * @return PodsInit
123 *
124 * @since 2.0.0
125 */
126 function pods_init() {
127
128 require_once PODS_DIR . 'classes/PodsInit.php';
129
130 return PodsInit::init();
131 }
132
133 /**
134 * Include and Init the Pods Components class
135 *
136 * @see PodsComponents
137 *
138 * @return PodsComponents
139 *
140 * @since 2.0.0
141 */
142 function pods_components() {
143
144 require_once PODS_DIR . 'classes/PodsComponents.php';
145 require_once PODS_DIR . 'classes/PodsComponent.php';
146
147 return PodsComponents::init();
148 }
149
150 /**
151 * Include and Init the PodsAdmin class
152 *
153 * @see PodsAdmin
154 *
155 * @return PodsAdmin
156 *
157 * @since 2.0.0
158 */
159 function pods_admin() {
160
161 require_once PODS_DIR . 'classes/PodsAdmin.php';
162
163 return PodsAdmin::init();
164 }
165
166 /**
167 * Include and Init the PodsMeta class
168 *
169 * @see PodsMeta
170 *
171 * @return PodsMeta
172 *
173 * @since 2.0.0
174 */
175 function pods_meta() {
176
177 require_once PODS_DIR . 'classes/PodsMeta.php';
178
179 return PodsMeta::init();
180 }
181
182 /**
183 * Include and Init the PodsArray class
184 *
185 * @see PodsArray
186 *
187 * @param mixed $container Object (or existing Array)
188 *
189 * @return PodsArray
190 *
191 * @since 2.0.0
192 */
193 function pods_array( $container ) {
194
195 require_once PODS_DIR . 'classes/PodsArray.php';
196
197 return new PodsArray( $container );
198 }
199
200 /**
201 * @since 2.7.0
202 */
203 function pods_i18n() {
204
205 require_once PODS_DIR . 'classes/PodsI18n.php';
206
207 return PodsI18n::get_instance();
208 }
209
210 /**
211 * Include a file that's child/parent theme-aware, and can be cached into object cache or transients
212 *
213 * @see PodsView::view
214 *
215 * @param string $view Path of the file to be included, this is relative to the current theme
216 * @param array|null $data (optional) Data to pass on to the template, using variable => value format
217 * @param int|bool $expires (optional) Time in seconds for the cache to expire, if false caching is disabled.
218 * @param string $cache_mode (optional) Specify the caching method to use for the view, available options include
219 * cache, transient, or site-transient
220 * @param bool $return (optional) Whether to return the view or not, defaults to false and will echo it
221 * @param bool $limited (optional) Whether to limit the view to only the theme directory, defaults to false
222 *
223 * @return string|bool The view output
224 *
225 * @since 2.0.0
226 * @link https://pods.io/docs/pods-view/
227 */
228 function pods_view( $view, $data = null, $expires = false, $cache_mode = 'cache', $return = false, $limited = false ) {
229
230 require_once PODS_DIR . 'classes/PodsView.php';
231
232 $view = PodsView::view( $view, $data, $expires, $cache_mode, $limited );
233
234 if ( $return ) {
235 return $view;
236 }
237
238 echo $view;
239 }
240
241 /**
242 * Include and Init the PodsMigrate class
243 *
244 * @see PodsMigrate
245 *
246 * @param string $type Export Type (php, json, sv, xml)
247 * @param string $delimiter Delimiter for export type 'sv'
248 * @param array $data Array of data
249 *
250 * @return PodsMigrate
251 *
252 * @since 2.2.0
253 */
254 function pods_migrate( $type = null, $delimiter = null, $data = null ) {
255
256 require_once PODS_DIR . 'classes/PodsMigrate.php';
257
258 return new PodsMigrate( $type, $delimiter, $data );
259 }
260
261 /**
262 * Include and Init the PodsUpgrade class
263 *
264 * @param string $version Version number of upgrade to get
265 *
266 * @see PodsUpgrade
267 *
268 * @return PodsUpgrade
269 *
270 * @since 2.1.0
271 */
272 function pods_upgrade( $version = '' ) {
273
274 include_once PODS_DIR . 'sql/upgrade/PodsUpgrade.php';
275
276 $class_name = str_replace( '.', '_', $version );
277 $class_name = "PodsUpgrade_{$class_name}";
278
279 $class_name = trim( $class_name, '_' );
280
281 if ( ! class_exists( $class_name ) ) {
282 $file = PODS_DIR . 'sql/upgrade/' . basename( $class_name ) . '.php';
283
284 if ( file_exists( $file ) ) {
285 include_once $file;
286 }
287 }
288
289 $class = false;
290
291 if ( class_exists( $class_name ) ) {
292 $class = new $class_name();
293 }
294
295 return $class;
296 }
297