PluginProbe
WP Ultimate Post Grid / 2.8.2
WP Ultimate Post Grid v2.8.2
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / vendor / vafpress / classes / util / reflection.php

reflection.php in WP Ultimate Post Grid 2.8.2, at vendor/vafpress/classes/util/reflection.php

62 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class VP_Util_Reflection
4 {
5
6 public static function is_multiselectable($object)
7 {
8 if(is_object($object))
9 {
10 if($object instanceof VP_MultiSelectable)
11 return true;
12 }
13 elseif(is_string($object))
14 {
15 $class = self::field_class_from_type($object);
16 if(function_exists('class_implements'))
17 {
18 if(class_exists($class))
19 {
20 $interfaces = class_implements($class);
21 if(isset($interfaces['VP_MultiSelectable']))
22 return true;
23 }
24 else
25 {
26 return false;
27 }
28 }
29 else
30 {
31 $dummy = new $class;
32 if($dummy instanceof VP_MultiSelectable)
33 return true;
34 unset($dummy);
35 }
36 }
37 return false;
38 }
39
40
41 public static function field_type_from_class($class)
42 {
43 $prefix = apply_filters('vp_field_type_from_class_prefix', array('VP_Control_Field_', 'VP_Option_Control_Field_'));
44 return strtolower(str_replace($prefix, '', $class));
45 }
46
47 public static function field_class_from_type($type)
48 {
49 // default prefix
50 $prefix = 'VP_Control_Field_';
51
52 // special case
53 if($type === 'impexp')
54 $prefix = 'VP_Option_Control_Field_';
55
56 $prefix = apply_filters( 'vp_field_class_from_type_prefix', $prefix, $type );
57
58 $class = $prefix . $type;
59 return $class;
60 }
61
62 }