PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / trunk
Pods – Custom Content Types and Fields vtrunk
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 / src / Pods / Whatsit / Legacy_Object.php
pods / src / Pods / Whatsit Last commit date
Storage 4 months ago Block.php 4 months ago Block_Collection.php 4 months ago Block_Field.php 4 months ago Field.php 4 months ago Group.php 4 months ago Legacy_Object.php 4 months ago Object_Field.php 4 months ago Page.php 4 months ago Pod.php 4 months ago Storage.php 4 months ago Store.php 4 months ago Template.php 4 months ago
Legacy_Object.php
82 lines
1 <?php
2
3 namespace Pods\Whatsit;
4
5 // Don't load directly.
6 if ( ! defined( 'ABSPATH' ) ) {
7 die( '-1' );
8 }
9
10 use Pods\Whatsit;
11
12 /**
13 * Legacy Object class.
14 *
15 * @since 2.8.0
16 */
17 class Legacy_Object extends Whatsit {
18
19 /**
20 * {@inheritdoc}
21 */
22 public function get_clean_args() {
23 $args = parent::get_clean_args();
24
25 $old_mapping = [
26 'name' => 'label',
27 'slug' => 'name',
28 'uri' => 'name',
29 'code' => 'description',
30 ];
31
32 $new_args = [];
33
34 foreach ( $old_mapping as $old_arg => $new_arg ) {
35 $new_args[ $old_arg ] = '';
36
37 if ( isset( $args[ $new_arg ] ) ) {
38 $new_args[ $old_arg ] = $args[ $new_arg ];
39
40 unset( $args[ $new_arg ] );
41 }
42 }
43
44 return array_merge( $new_args, $args );
45 }
46
47 /**
48 * {@inheritdoc}
49 */
50 public function get_arg( $arg, $default = null, $strict = false, $raw = false ) {
51 if ( $raw ) {
52 return parent::get_arg( $arg, $default, $strict, $raw );
53 }
54
55 $old_mapping = [
56 'name' => 'label',
57 'slug' => 'name',
58 'uri' => 'name',
59 'code' => 'description',
60 ];
61
62 if ( isset( $old_mapping[ $arg ] ) ) {
63 $arg = $old_mapping[ $arg ];
64 }
65
66 return parent::get_arg( $arg, $default );
67 }
68
69 /**
70 * {@inheritdoc}
71 */
72 public function get_name() {
73 // Map get_name() to the real name, so we have a way to still get to it intentionally.
74 if ( isset( $this->args['name'] ) ) {
75 return $this->args['name'];
76 }
77
78 return null;
79 }
80
81 }
82