function index_action()
 {
     $key = C_Photocrati_Cache::generate_key('nextgen_pro_upgrade_page');
     if ($html = C_Photocrati_Cache::get('nextgen_pro_upgrade_page', FALSE)) {
         echo $html;
     } else {
         // Get page content
         $template = 'photocrati-nextgen_pro_upgrade#plus';
         if (defined('NGG_PLUS_PLUGIN_BASENAME')) {
             $template = 'photocrati-nextgen_pro_upgrade#pro';
         }
         $description = 'Extend NextGEN Gallery with 8 new pro gallery displays, a full screen responsive pro lightbox, commenting / social sharing / deep linking for individual images, ecommerce, digital downloads, and pro email support.';
         $headline = 'Upgrade to NextGEN Plus or NextGEN Pro';
         if (defined('NGG_PLUS_PLUGIN_BASENAME')) {
             $description = 'NextGEN Pro now offers ecommerce! Extend NextGEN Gallery and NextGEN Plus with a complete solution for selling prints and digital downloads, including unlimited pricelists, PayPal and Stripe integration, and more.';
             $headline = 'Upgrade to NextGEN Pro with Ecommerce';
         }
         $params = array('description' => $description, 'headline' => $headline);
         $html = $this->render_view($template, $params, TRUE);
         // Cache it
         C_Photocrati_Cache::set($key, $html);
         // Render it
         echo $html;
     }
 }
 function display_tab_js_action()
 {
     $url = C_Router::get_instance()->get_routed_app()->get_routed_url(TRUE);
     $key = C_Photocrati_Cache::generate_key($url);
     // Try fetching the contents from the cache
     if ($html = C_Photocrati_Cache::get($key, FALSE)) {
         echo $html;
     } else {
         $html = C_Attach_Controller::get_instance(FALSE)->display_tab_js_action(TRUE);
         C_Photocrati_Cache::set($key, $html);
         echo $html;
     }
 }
 function index_action()
 {
     $key = C_Photocrati_Cache::generate_key('nextgen_pro_upgrade_page');
     if ($html = C_Photocrati_Cache::get('nextgen_pro_upgrade_page', FALSE)) {
         echo $html;
     } else {
         // Get page content
         $params = array('btn_url' => $this->object->get_router()->get_static_url('photocrati-nextgen_pro_upgrade#button.png'), 'img_url' => $this->object->get_router()->get_static_url('photocrati-nextgen_pro_upgrade#proupgrade.gif'));
         $html = $this->render_view('photocrati-nextgen_pro_upgrade#index', $params, TRUE);
         // Cache it
         C_Photocrati_Cache::set($key, $html);
         // Render it
         echo $html;
     }
 }
Exemplo n.º 4
0
 /**
  * Applies the values of a transient to this object
  * @param string $transient_id
  */
 function apply_transient($transient_id = NULL)
 {
     $retval = FALSE;
     if (!$transient_id && isset($this->object->transient_id)) {
         $transient_id = $this->object->transient_id;
     }
     if ($transient_id && ($transient = C_Photocrati_Cache::get($transient_id, FALSE, 'displayed_galleries'))) {
         $this->object->_stdObject = $transient;
         $this->object->transient_id = $transient_id;
         if (!$this->object->id()) {
             $this->object->id($transient_id);
         }
         $retval = TRUE;
     }
     return $retval;
 }
 /**
  * Applies the values of a transient to this object
  * @param string $transient_id
  */
 function apply_transient($transient_id)
 {
     if ($transient = C_Photocrati_Cache::get($transient_id, 'displayed_galleries')) {
         $this->object->_stdObject = $transient;
     }
 }
 /**
  * Renders a displayed gallery on the frontend
  * @param C_Displayed_Gallery|stdClass $displayed_gallery
  */
 function render($displayed_gallery, $return = FALSE, $mode = null)
 {
     // Simply throwing our rendered gallery into a feed will most likely not work correctly.
     // The MediaRSS option in NextGEN is available as an alternative.
     if (is_feed()) {
         return '';
     }
     if ($mode == null) {
         $mode = 'normal';
     }
     // Save the displayed gallery as a transient if it hasn't already. Allows for ajax operations
     // to add or modify the gallery without losing a retrievable ID
     if (empty($displayed_gallery->transient_id)) {
         $displayed_gallery->transient_id = $displayed_gallery->to_transient();
     }
     // Get the display type controller
     $controller = $this->get_registry()->get_utility('I_Display_Type_Controller', $displayed_gallery->display_type);
     // Enqueue any necessary static resources
     $controller->enqueue_frontend_resources($displayed_gallery);
     // Get routing info
     $router = $url = C_Router::get_instance();
     $url = $router->get_url($router->get_request_uri(), TRUE);
     // Should we lookup in cache?
     $lookup = TRUE;
     if ($displayed_gallery->source == 'random_images') {
         $lookup = FALSE;
     } elseif (is_array($displayed_gallery->container_ids) && in_array('All', $displayed_gallery->container_ids)) {
         $lookup = FALSE;
     } elseif ($displayed_gallery->source == 'albums' && $controller->param('gallery') or $controller->param('album')) {
         $lookup = FALSE;
     } elseif (!$controller->cachable) {
         $lookup = FALSE;
     }
     // Try cache lookup, if we're to do so
     $key = null;
     $html = FALSE;
     if ($lookup) {
         // Some settings affect display types
         $settings = C_NextGen_Settings::get_instance();
         $key_params = apply_filters('ngg_displayed_gallery_cache_params', array($displayed_gallery->get_entity(), $url, $mode, $settings->activateTags, $settings->appendType, $settings->maxImages, $settings->thumbEffect, $settings->thumbCode, $settings->galSort, $settings->galSortDir));
         // Try getting the rendered HTML from the cache
         $key = C_Photocrati_Cache::generate_key($key_params);
         $html = C_Photocrati_Cache::get($key, FALSE);
         // TODO: This is hack. We need to figure out a more uniform way of detecting dynamic image urls
         if (strpos($html, C_Photocrati_Settings_Manager::get_instance()->dynamic_thumbnail_slug) !== FALSE) {
             $html = FALSE;
             // forces the cache to be re-generated
         }
     }
     // If a cached version doesn't exist, then create the cache
     if (!$html) {
         $current_mode = $controller->get_render_mode();
         $controller->set_render_mode($mode);
         $html = $controller->index_action($displayed_gallery, TRUE);
         if ($key != null) {
             C_Photocrati_Cache::set($key, $html);
         }
         $controller->set_render_mode($current_mode);
         // Compress the html to avoid wpautop problems
         $html = $this->compress_html($html);
     }
     if (!$return) {
         echo $html;
     }
     return $html;
 }
Exemplo n.º 7
0
 /**
  * Applies the values of a transient to this object
  * @param string $transient_id
  */
 function apply_transient($transient_id)
 {
     $retval = FALSE;
     if ($transient = C_Photocrati_Cache::get($transient_id, FALSE, 'displayed_galleries')) {
         $this->object->_stdObject = $transient;
         $retval = TRUE;
     }
     return $retval;
 }
Exemplo n.º 8
0
 public function initialize()
 {
     register_shutdown_function(array(&$this, 'cache_lookups'));
     self::$_lookups = C_Photocrati_Cache::get('get_static_url', array(), 'MVC');
 }