/**
  * Removes minified CSS. Fixing corrupt data for boolean fields that may have gotten strings.
  *
  * @param array $options The options to be modified.
  */
 private static function threePointThree(&$options)
 {
     if (version_compare($options['meta']['version'], '3.3', '<')) {
         unset($options['css']['minified']);
         $defaults = self::getDefaultOptions();
         foreach ($defaults as $class => $block) {
             if (is_array($block)) {
                 foreach ($block as $prop => $value) {
                     if (is_bool($value) && isset($options[$class][$prop]) && !is_bool($options[$class][$prop])) {
                         $options[$class][$prop] = DG_Util::toBool($options[$class][$prop], $value);
                     }
                 }
             } elseif (is_bool($block) && isset($options[$class]) && !is_bool($options[$class])) {
                 $options[$class] = DG_Util::toBool($options[$class], $block);
             }
         }
     }
 }
 /**
  * Builds a gallery object with attributes passed.
  *
  * @param mixed[] $atts Array of attributes used in shortcode.
  */
 public function __construct($atts)
 {
     static $instance = 0;
     $this->instance = ++$instance;
     include_once DG_PATH . 'inc/class-document.php';
     // empty string is passed when no arguments are given, but constructor expects an array
     $atts = empty($atts) ? array() : $atts;
     // get_post will return null during AJAX requests
     $post = get_post();
     $post_id = !is_null($post) ? $post->ID : -1;
     if (!empty($atts['ids'])) {
         // 'ids' is explicitly ordered, unless you specify otherwise.
         if (empty($atts['orderby'])) {
             $atts['orderby'] = 'post__in';
         }
         $atts['include'] = $atts['ids'];
         unset($atts['ids']);
     }
     // allow abbreviated columns attribute
     if (!empty($atts['cols'])) {
         $atts['columns'] = $atts['cols'];
         unset($atts['cols']);
     }
     if (!empty($atts['images'])) {
         if (DG_Util::toBool($atts['images'], false)) {
             $options = self::getOptions();
             $mimes = trim(isset($atts['mime_types']) ? $atts['mime_types'] : $options['mime_types']);
             if (!preg_match('/[,^]image[,$]/', $mimes)) {
                 $atts['mime_types'] = empty($mimes) ? 'image' : $mimes . ',image';
             }
         }
         unset($atts['images']);
     }
     /**
      * @deprecated localpost will be removed at some point.
      */
     if (!empty($atts['localpost'])) {
         $atts['id'] = -1;
         unset($atts['localpost']);
     }
     $defaults = array_merge(array('id' => $post_id), self::$defaults);
     // values used to construct tax query (may be empty)
     $this->taxa = array_diff_key($atts, $defaults);
     // all recognized attributes go here
     $this->atts = shortcode_atts($defaults, $atts);
     // goes through all values in atts, setting errs as needed
     $this->atts = self::sanitizeDefaults($defaults, $this->atts, $this->errs);
     // query DB for all documents requested
     try {
         foreach ($this->getDocuments() as $doc) {
             $this->docs[] = new DG_Document($doc, $this);
         }
     } catch (InvalidArgumentException $e) {
         // errors will be printed in __toString()
     }
 }
 /**
  * Takes the provided value and returns a sanitized value.
  *
  * @param string $value The new_window value to be sanitized.
  * @param string &$err String to be initialized with error, if any.
  *
  * @return bool The sanitized new_window value.
  */
 private static function sanitizeNewWindow($value, &$err)
 {
     $ret = DG_Util::toBool($value);
     if (is_null($ret)) {
         $err = sprintf(self::$binary_err, 'new_window', 'true', 'false', $value);
     }
     return $ret;
 }