LookupFilters.php
4 years ago
LookupFiltersFactory.php
3 weeks ago
LookupTable.php
2 years ago
LookupTableFactory.php
3 weeks ago
LookupTableFactory.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Attributes; |
| 4 | |
| 5 | class LookupTableFactory implements \IWPML_Backend_Action_Loader, \IWPML_Frontend_Action_Loader { |
| 6 | const MIN_WC_VERSION = '6.3'; |
| 7 | |
| 8 | public function create() { |
| 9 | /** @var \SitePress $sitepress */ |
| 10 | global $sitepress; |
| 11 | |
| 12 | if ( self::hasFeature() ) { |
| 13 | return new LookupTable( $sitepress ); |
| 14 | } |
| 15 | |
| 16 | return null; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * @return bool |
| 21 | */ |
| 22 | public static function hasFeature() { |
| 23 | /* @phpstan-ignore booleanAnd.rightAlwaysFalse */ |
| 24 | return defined( 'WC_VERSION' ) && version_compare( WC_VERSION, self::MIN_WC_VERSION, '>=' ); |
| 25 | } |
| 26 | |
| 27 | } |
| 28 |