function install_pro_lightbox_settings(C_Photocrati_Settings_Manager $settings, $reset = FALSE)
 {
     $defaults = array('background_color' => 1, 'enable_routing' => 1, 'icon_color' => '', 'icon_background' => '', 'icon_background_enabled' => 0, 'icon_background_rounded' => 1, 'overlay_icon_color' => '', 'sidebar_button_color' => '', 'sidebar_button_background' => '', 'router_slug' => 'gallery', 'carousel_background_color' => '', 'carousel_text_color' => '', 'enable_comments' => 1, 'enable_sharing' => 1, 'display_comments' => 0, 'display_captions' => 0, 'display_carousel' => 1, 'image_crop' => 'false', 'image_pan' => 0, 'interaction_pause' => 1, 'sidebar_background_color' => '', 'slideshow_speed' => 5, 'style' => '', 'touch_transition_effect' => 'slide', 'transition_effect' => 'slide', 'transition_speed' => 0.4);
     // Create settings array
     if (!$settings->exists('ngg_pro_lightbox')) {
         $settings->set('ngg_pro_lightbox', array());
     }
     $ngg_pro_lightbox = $settings->get('ngg_pro_lightbox');
     // Need migration logic from custom post type
     global $wpdb;
     $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->posts} WHERE post_type = 'lightbox_library' AND post_title = %s", NGG_PRO_LIGHTBOX));
     if ($row) {
         $row->post_content = M_DataMapper::unserialize($row->post_content);
         $ngg_pro_lightbox = $row->post_content['display_settings'];
         @wp_delete_post($row->ID, TRUE);
     }
     // Set defaults
     foreach ($defaults as $key => $value) {
         if (!array_key_exists($key, $ngg_pro_lightbox)) {
             $ngg_pro_lightbox[$key] = $value;
         }
     }
     // Save the data
     $settings->set('ngg_pro_lightbox', $ngg_pro_lightbox);
 }
 function validation()
 {
     // Valid sources
     $this->object->validates_presence_of('source');
     // Valid display type?
     $this->object->validates_presence_of('display_type');
     if ($display_type = $this->object->get_display_type()) {
         $display_type->settings = $this->object->display_settings;
         if (!$display_type->validate()) {
             foreach ($display_type->get_errors() as $property => $errors) {
                 foreach ($errors as $error) {
                     $this->object->add_error($error, $property);
                 }
             }
         }
         // Is the display type compatible with the source? E.g., if we're
         // using a display type that expects images, we can't be feeding it
         // galleries and albums
         if ($source = $this->object->get_source()) {
             if (!$display_type->is_compatible_with_source($source)) {
                 $this->object->add_error(_('Source not compatible with selected display type'), 'display_type');
             }
         }
         // If no maximum_entity_count has been given, then set a maximum
         if (!isset($this->object->maximum_entity_count)) {
             $this->object->maximum_entity_count = C_Photocrati_Settings_Manager::get('maximum_entity_count', 500);
         }
     } else {
         $this->object->add_error('Invalid display type', 'display_type');
     }
     return $this->object->is_valid();
 }
 public function validation()
 {
     // Valid sources
     $this->object->validates_presence_of('source');
     // Valid display type?
     $this->object->validates_presence_of('display_type');
     if ($display_type = $this->object->get_display_type()) {
         foreach ($this->object->display_settings as $key => $val) {
             $display_type->settings[$key] = $val;
         }
         $this->object->display_settings = $display_type->settings;
         if (!$display_type->validate()) {
             foreach ($display_type->get_errors() as $property => $errors) {
                 foreach ($errors as $error) {
                     $this->object->add_error($error, $property);
                 }
             }
         }
         // Is the display type compatible with the source? E.g., if we're
         // using a display type that expects images, we can't be feeding it
         // galleries and albums
         if ($source = $this->object->get_source()) {
             if (!$display_type->is_compatible_with_source($source)) {
                 $this->object->add_error(__('Source not compatible with selected display type', 'nggallery'), 'display_type');
             }
         }
         // Allow ONLY recent & random galleries to have their own maximum_entity_count
         if (!empty($this->object->display_settings['maximum_entity_count']) && in_array($this->object->source, array('random_images', 'recent_images', 'random', 'recent'))) {
             $this->object->maximum_entity_count = $this->object->display_settings['maximum_entity_count'];
         }
         // If no maximum_entity_count has been given, then set a maximum
         if (!isset($this->object->maximum_entity_count)) {
             $this->object->maximum_entity_count = C_Photocrati_Settings_Manager::get('maximum_entity_count', 500);
         }
     } else {
         $this->object->add_error('Invalid display type', 'display_type');
     }
     return $this->object->is_valid();
 }