get_parent(); } else { $value = $object->order; } break; default: $function = 'get_' . $property; if ( is_callable( array( $object, $function ) ) ) { $value = $object->$function(); } else { $value = $object->$property; } break; } return $value; } /** * Get an object's ID in a version compatible way. * * @param object $object Object. * @return int * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 1.0.1. */ function wcsg_get_objects_id( $object ) { if ( method_exists( $object, 'get_id' ) ) { $id = $object->get_id(); } else { $id = $object->id; } return $id; } /** * Check if the active version of WooCommerce Subscriptions is older than the specified version. * * @param string $version Version to check against. * @return bool * @since 7.8.0 - Originally implemented in WooCommerce Subscriptions Gifting 2.0.0. */ function wcsg_is_wc_subscriptions_pre( $version ) { if ( ! class_exists( 'WC_Subscriptions_Core_Plugin' ) && ! class_exists( 'WC_Subscriptions' ) ) { _doing_it_wrong( __METHOD__, 'This method should not be called before plugins_loaded.', '2.0' ); return false; } $subscriptions_version = class_exists( 'WC_Subscriptions_Core_Plugin' ) ? WC_Subscriptions_Core_Plugin::instance()->get_plugin_version() : WC_Subscriptions::$version; return version_compare( $subscriptions_version, $version, '<' ); }