/**
  * Provides a Galleria-formatted JSON array of get_included_entities() results
  */
 function pro_lightbox_load_images_action()
 {
     $retval = array();
     if ($id = $this->param('id')) {
         $displayed_gallery_mapper = C_Displayed_Gallery_Mapper::get_instance();
         if ($this->param('lang', NULL, FALSE)) {
             if (class_exists('SitePress')) {
                 global $sitepress;
                 $sitepress->switch_lang($this->param('lang'));
             }
         }
         // Fetch ATP galleries or build our displayed gallery by parameters
         if (is_numeric($id)) {
             $displayed_gallery = $displayed_gallery_mapper->find($id, TRUE);
         } else {
             $factory = C_Component_Factory::get_instance();
             $displayed_gallery = $factory->create('displayed_gallery', $this->param('gallery'), $displayed_gallery_mapper);
         }
         if ($displayed_gallery) {
             $settings = C_NextGen_Settings::get_instance()->get('ngg_pro_lightbox');
             $retval = M_NextGen_Pro_Lightbox_Legacy::parse_entities_for_galleria($displayed_gallery->get_entities(FALSE, $settings['localize_limit']));
         }
     }
     return $retval;
 }
 function initialize()
 {
     parent::initialize();
     if (!is_admin()) {
         // adds lightbox JS overrides
         if (version_compare(NGG_PLUGIN_VERSION, '2.0.67') >= 0) {
             M_NextGen_Pro_Lightbox::add_component('photocrati-nextgen_pro_proofing', 'C_NextGen_Pro_Proofing_Lightbox');
         } else {
             M_NextGen_Pro_Lightbox_Legacy::add_component('photocrati-nextgen_pro_proofing', 'C_NextGen_Pro_Proofing_Lightbox');
         }
         $triggers = C_Displayed_Gallery_Trigger_Manager::get_instance();
         $triggers->add(NGG_PRO_PROOFING_TRIGGER, 'C_NextGen_Pro_Proofing_Trigger');
         C_NextGen_Shortcode_Manager::add('ngg_pro_proofing', array(&$this, 'render_proofed_images'));
     }
 }
 function enqueue_frontend_resources($displayed_gallery)
 {
     $this->call_parent('enqueue_frontend_resources', $displayed_gallery);
     if (C_NextGen_Settings::get_instance()->thumbEffect == NGG_PRO_LIGHTBOX && !in_array($displayed_gallery->id(), self::$galleries_displayed)) {
         // prevent calling get_included_entities() more than once
         self::$galleries_displayed[] = $displayed_gallery->id();
         foreach (M_NextGen_Pro_Lightbox_Legacy::get_components() as $name => $handler) {
             $handler = new $handler();
             $handler->name = $name;
             $handler->displayed_gallery = $displayed_gallery;
             $handler->enqueue_static_resources();
         }
         $mapper = C_Lightbox_Library_Mapper::get_instance();
         $lightbox = $mapper->find_by_name(NGG_PRO_LIGHTBOX);
         // localize the gallery images for startup performance
         $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.images_list', M_NextGen_Pro_Lightbox_Legacy::parse_entities_for_galleria($displayed_gallery->get_entities($lightbox->display_settings['localize_limit'])), FALSE);
         // inform the lightbox js it needs to do an ajax request to load the rest of the gallery
         $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.images_list_limit_reached', $displayed_gallery->get_entity_count() > $lightbox->display_settings['localize_limit'] ? TRUE : FALSE, FALSE);
     }
 }
 function initialize()
 {
     parent::initialize();
     if (!is_admin()) {
         // Add lightbox components
         if (version_compare(NGG_PLUGIN_VERSION, '2.0.67') >= 0) {
             M_NextGen_Pro_Lightbox::add_component('photocrati-add_to_cart', 'C_NextGen_Pro_Add_To_Cart');
         } else {
             M_NextGen_Pro_Lightbox_Legacy::add_component('photocrati-add_to_cart', 'C_NextGen_Pro_Add_To_Cart');
         }
         // Add trigger
         $triggers = C_Displayed_Gallery_Trigger_Manager::get_instance();
         $triggers->add(NGG_ECOMMERCE_TRIGGER, 'C_NextGen_Pro_Ecommerce_Trigger');
         C_NextGen_Shortcode_Manager::add('ngg_pro_cart_count', array(&$this, 'render_cart_count'));
         C_NextGen_Shortcode_Manager::add('ngg_pro_checkout', array(&$this, 'render_checkout_form'));
         C_NextGen_Shortcode_Manager::add('ngg_pro_digital_downloads', array(&$this, 'render_digital_downloads'));
         C_NextGen_Shortcode_Manager::add('ngg_pro_order_details', array(&$this, 'render_order_details'));
         C_NextGen_Shortcode_Manager::add('ngg_pro_verify_order', array(&$this, 'render_order_verification'));
     }
     // Add pricelist sources
     $sources = C_Pricelist_Source_Manager::get_instance();
     $sources->register(NGG_PRO_MANUAL_PRICELIST_SOURCE, array('title' => __('Manual Pricelist', 'nextgen-gallery-pro'), 'shipping_method' => 'C_NextGen_Pro_Flat_Rate_Shipping_Calculator', 'settings_field' => 'manual_settings'));
     $sources->register(NGG_PRO_DIGITAL_DOWNLOADS_SOURCE, array('title' => __('Digital Downloads', 'nextgen-gallery-pro'), 'shipping_method' => NULL, 'settings_field' => 'digital_download_settings'));
 }