function enqueue_static_resources()
 {
     $router = C_Router::get_instance();
     wp_enqueue_script('jquery-ui-accordion');
     // For some reason ajax.js isn't registered yet in 2.0.67.14 and above, so we have
     // to do it manually.
     if (method_exists('M_Ajax', 'register_scripts')) {
         M_Ajax::register_scripts();
     }
     if (version_compare(NGG_PLUGIN_VERSION, '2.0.67') >= 0) {
         wp_enqueue_script('ngg-pro-lightbox-ecommerce-overrides', $router->get_static_url('photocrati-nextgen_pro_ecommerce#lightbox_overrides.js'));
     } else {
         wp_enqueue_script('ngg-pro-lightbox-ecommerce-overrides', $router->get_static_url('photocrati-nextgen_pro_ecommerce#lightbox_overrides.js'), array('ngg-store-js'));
     }
     wp_enqueue_style('ngg-pro-add-to-cart', $router->get_static_url('photocrati-nextgen_pro_ecommerce#add_to_cart.css'));
     M_NextGen_Pro_Ecommerce::enqueue_cart_resources();
     if (!self::$_template_rendered) {
         self::$_template_rendered = TRUE;
         $parameters = array('not_for_sale_msg' => C_NextGen_Settings::get_instance()->ecommerce_not_for_sale_msg, 'sources' => $this->get_sources(), 'i18n' => $this->get_i18n_strings());
         $add_to_cart_tmpl = new C_MVC_View('photocrati-nextgen_pro_ecommerce#add_to_cart_tmpl', $parameters);
         $add_to_cart_item_tmpl = new C_MVC_View('photocrati-nextgen_pro_ecommerce#add_to_cart_source_item_tmpl', $parameters);
         $add_to_cart_items_tmpl = new C_MVC_View('photocrati-nextgen_pro_ecommerce#add_to_cart_source_items_tmpl', $parameters);
         wp_localize_script('ngg-pro-lightbox-ecommerce-overrides', 'ngg_add_to_cart_templates', array('add_to_cart' => $add_to_cart_tmpl->render(TRUE), 'add_to_cart_item' => $add_to_cart_item_tmpl->render(TRUE), 'add_to_cart_items' => $add_to_cart_items_tmpl->render(TRUE)));
         wp_localize_script('ngg-pro-lightbox-ecommerce-overrides', 'ngg_cart_i18n', (array) $this->get_i18n_strings());
     }
 }
 public function render_notice($name)
 {
     $retval = '';
     if (($handler = $this->get_handler_instance($name)) && !$this->is_dismissed($name)) {
         // Does the handler want to render?
         $has_method = method_exists($handler, 'is_renderable');
         if ($has_method && $handler->is_renderable() || !$has_method) {
             $view = new C_MVC_View('photocrati-nextgen_admin#admin_notice', array('css_class' => method_exists($handler, 'get_css_class') ? $handler->get_css_class() : 'updated', 'is_dismissable' => method_exists($handler, 'is_dismissable') ? $handler->is_dismissable() : FALSE, 'html' => method_exists($handler, 'render') ? $handler->render() : '', 'notice_name' => $name));
             $retval = $view->render(TRUE);
             $this->_displayed_notice = TRUE;
         }
     }
     return $retval;
 }
 public function generate_breadcrumb($gallery_id = NULL, $entities)
 {
     $found = array();
     $router = C_Router::get_instance();
     $app = $router->get_routed_app();
     if (is_array($gallery_id)) {
         $gallery_id = array_shift($gallery_id);
     }
     foreach ($entities as $ndx => $entity) {
         $tmpid = (isset($entity->albumdesc) ? 'a' : '') . $entity->{$entity->id_field};
         $this->breadcrumb_cache[$tmpid] = $entity;
         if (isset($entity->albumdesc) && in_array($gallery_id, $entity->sortorder)) {
             $found[] = $entity;
             break;
         }
     }
     if (empty($found)) {
         foreach ($entities as $entity) {
             if (!empty($entity->sortorder)) {
                 $found = $this->object->find_gallery_parent($gallery_id, $entity->sortorder);
             }
             if (!empty($found)) {
                 $found[] = $entity;
                 break;
             }
         }
     }
     $found = array_reverse($found);
     if (strpos($gallery_id, 'a') === 0) {
         $album_found = FALSE;
         foreach ($found as $found_item) {
             if ($found_item->{$found_item->id_field} == $gallery_id) {
                 $album_found = TRUE;
             }
         }
         if (!$album_found) {
             $album_id = ltrim($gallery_id, 'a');
             $album = C_Album_Mapper::get_instance()->find($album_id);
             $found[] = $album;
             $this->breadcrumb_cache[$gallery_id] = $album;
         }
     } else {
         $gallery_found = FALSE;
         foreach ($entities as $entity) {
             if (isset($entity->is_gallery) && $entity->is_gallery && $gallery_id == $entity->{$entity->id_field}) {
                 $gallery_found = TRUE;
                 $found[] = $entity;
                 break;
             }
         }
         if (!$gallery_found) {
             $gallery = C_Gallery_Mapper::get_instance()->find($gallery_id);
             $found[] = $gallery;
             $this->breadcrumb_cache[$gallery->{$gallery->id_field}] = $gallery;
         }
     }
     $crumbs = array();
     if (!empty($found)) {
         $end = end($found);
         reset($found);
         foreach ($found as $found_item) {
             $type = isset($found_item->albumdesc) ? 'album' : 'gallery';
             $id = ($type == 'album' ? 'a' : '') . $found_item->{$found_item->id_field};
             $entity = $this->breadcrumb_cache[$id];
             $link = NULL;
             if ($type == 'album') {
                 $name = $entity->name;
                 if ($entity->pageid > 0) {
                     $link = @get_page_link($entity->pageid);
                 }
                 if (empty($link) && $found_item !== $end) {
                     $link = $app->get_routed_url();
                     $link = $app->strip_param_segments($link);
                     $link = $app->set_parameter_value('album', $entity->slug, NULL, FALSE, $link);
                 }
             } else {
                 $name = $entity->title;
             }
             $crumbs[] = array('type' => $type, 'name' => $name, 'url' => $link);
         }
     }
     // free this memory immediately
     $this->breadcrumb_cache = array();
     $view = new C_MVC_View('photocrati-nextgen_basic_album#breadcrumbs', array('breadcrumbs' => $crumbs, 'divisor' => apply_filters('ngg_breadcrumb_separator', ' » ')));
     return $view->render(TRUE);
 }
 public function generate_description($displayed_gallery)
 {
     if (self::$_description_added_once) {
         return '';
     }
     self::$_description_added_once = TRUE;
     $description = $this->get_description($displayed_gallery);
     $view = new C_MVC_View('photocrati-nextgen_basic_album#descriptions', array('description' => $description));
     return $view->render(TRUE);
 }