popErrorMask() public static method

This function restores the previous error mask.
public static popErrorMask ( )
Esempio n. 1
0
 /**
  * Initialize the timezone.
  *
  * This function should be called before any calls to date().
  *
  * @author Olav Morken, UNINETT AS <*****@*****.**>
  */
 public static function initTimezone()
 {
     if (self::$tz_initialized) {
         return;
     }
     $globalConfig = \SimpleSAML_Configuration::getInstance();
     $timezone = $globalConfig->getString('timezone', null);
     if ($timezone !== null) {
         if (!date_default_timezone_set($timezone)) {
             throw new \SimpleSAML_Error_Exception('Invalid timezone set in the "timezone" option in config.php.');
         }
         self::$tz_initialized = true;
         return;
     }
     // we don't have a timezone configured
     Logger::maskErrors(E_ALL);
     $serverTimezone = date_default_timezone_get();
     Logger::popErrorMask();
     // set the timezone to the default
     date_default_timezone_set($serverTimezone);
     self::$tz_initialized = true;
 }
Esempio n. 2
0
 /**
  * Determine if an entity should be hidden in the discovery service.
  *
  * This method searches for the "Hide From Discovery" REFEDS Entity Category, and tells if the entity should be
  * hidden or not depending on it.
  *
  * @see https://refeds.org/category/hide-from-discovery
  *
  * @param array $metadata An associative array with the metadata representing an entity.
  *
  * @return boolean True if the entity should be hidden, false otherwise.
  */
 public static function isHiddenFromDiscovery(array $metadata)
 {
     \SimpleSAML\Logger::maskErrors(E_ALL);
     $hidden = in_array(self::$HIDE_FROM_DISCOVERY, $metadata['EntityAttributes'][self::$ENTITY_CATEGORY]);
     \SimpleSAML\Logger::popErrorMask();
     if (is_bool($hidden)) {
         return $hidden;
     }
     return false;
 }