示例#1
0
 /**
  * Returns the singleton instance of the class.
  *
  * @since 1.0.0
  *
  * @return object The TGM_Utils object.
  */
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof TGM_Utils) {
         self::$instance = new TGM_Utils();
     }
     return self::$instance;
 }
 /**
  * Helper function: Validate a value as boolean
  *
  * @since 2.5.0
  *
  * @static
  *
  * @param mixed $value Arbitrary value.
  *
  * @return bool
  */
 public static function validate_bool($value)
 {
     if (!isset(self::$has_filters)) {
         self::$has_filters = extension_loaded('filter');
     }
     if (self::$has_filters) {
         return filter_var($value, FILTER_VALIDATE_BOOLEAN);
     } else {
         return self::emulate_filter_bool($value);
     }
 }