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());
     }
 }
 function enqueue_frontend_resources($displayed_gallery)
 {
     $this->call_parent('enqueue_frontend_resources', $displayed_gallery);
     if (!in_array($displayed_gallery->id(), self::$_galleries_displayed)) {
         self::$_galleries_displayed[] = $displayed_gallery->id();
         $ds = $displayed_gallery->display_settings;
         if (!empty($ds['captions_enabled']) && $ds['captions_enabled']) {
             $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_enabled', TRUE, FALSE);
             $animation = !empty($ds['captions_animation']) ? $ds['captions_animation'] : 'slideup';
             $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_animation', $animation, FALSE);
             $show_title = !empty($ds['captions_display_title']) ? $ds['captions_display_title'] : TRUE;
             $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_display_title', $show_title, FALSE);
             $show_description = !empty($ds['captions_display_description']) ? $ds['captions_display_description'] : TRUE;
             $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_display_description', $show_description, FALSE);
         } else {
             $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_enabled', FALSE, FALSE);
         }
     }
     if (isset($displayed_gallery->display_settings['captions_enabled']) && $displayed_gallery->display_settings['captions_enabled'] && !self::$_pro_captions_run_once) {
         $router = C_Router::get_instance();
         wp_enqueue_script('jquery.dotdotdot', $router->get_static_url('photocrati-nextgen_basic_album#jquery.dotdotdot-1.5.7-packed.js'), array('jquery'));
         wp_enqueue_script('nextgen_pro_captions-js', $router->get_static_url('photocrati-nextgen_pro_captions#captions.js'), array('jquery.dotdotdot'), FALSE, TRUE);
         wp_enqueue_style('nextgen_pro_captions-css', $router->get_static_url('photocrati-nextgen_pro_captions#captions.css'));
         self::$_pro_captions_run_once = TRUE;
     }
 }
 function register_lightbox()
 {
     $router = C_Router::get_instance();
     $settings = C_NextGen_Settings::get_instance()->get('ngg_pro_lightbox', array());
     $lightboxes = C_Lightbox_Library_Manager::get_instance();
     // Define the Pro Lightbox
     $lightbox = new stdClass();
     $lightbox->title = __('NextGEN Pro Lightbox', 'nextgen-gallery-pro');
     $lightbox->code = "class='nextgen_pro_lightbox' data-nplmodal-gallery-id='%PRO_LIGHTBOX_GALLERY_ID%'";
     $lightbox->styles = array('photocrati-nextgen_pro_lightbox#style.css', 'photocrati-nextgen_pro_lightbox#theme/galleria.nextgen_pro_lightbox.css');
     $lightbox->scripts = array('wordpress#underscore', 'wordpress#backbone', 'photocrati-nextgen_pro_lightbox#velocity.min.js', 'photocrati-galleria#galleria-1.4.2.min.js', 'photocrati-nextgen_pro_lightbox#nextgen_pro_lightbox.js', 'photocrati-nextgen_pro_lightbox#theme/galleria.nextgen_pro_lightbox.js');
     // Set lightbox display properties
     $settings['is_front_page'] = is_front_page() ? 1 : 0;
     $settings['share_url'] = $router->get_url('/nextgen-share/{gallery_id}/{image_id}/{named_size}', TRUE, 'root');
     $settings['wp_site_url'] = $router->get_base_url('site');
     $settings['protect_images'] = !empty(C_NextGen_Settings::get_instance()->protect_images) ? TRUE : FALSE;
     $settings['style'] = str_replace('.css', '', $settings['style']);
     // this once (~2.1.4) referenced files
     // provide the current language so ajax requests can request translations in the same locale
     if (defined('ICL_LANGUAGE_CODE')) {
         $settings['lang'] = $router->param('lang', NULL, FALSE) ? $router->param('lang') : ICL_LANGUAGE_CODE;
     }
     $settings['i18n'] = array('toggle_social_sidebar' => __('Toggle social sidebar', 'nextgen-gallery-pro'), 'play_pause' => __('Play / Pause', 'nextgen-gallery-pro'), 'toggle_fullscreen' => __('Toggle fullscreen', 'nextgen-gallery-pro'), 'toggle_image_info' => __('Toggle image info', 'nextgen-gallery-pro'), 'close_window' => __('Close window', 'nextgen-gallery-pro'), 'share' => array('twitter' => __('Share on Twitter', 'nextgen-gallery-pro'), 'googlep' => __('Share on Google+', 'nextgen-gallery-pro'), 'facebook' => __('Share on Facebook', 'nextgen-gallery-pro'), 'pinterest' => __('Share on Pinterest', 'nextgen-gallery-pro')));
     $lightbox->values = array('nplModalSettings' => $settings);
     $lightboxes->register(NGG_PRO_LIGHTBOX, $lightbox);
 }
 function render_displayed_gallery_action()
 {
     $retval = array();
     // this must run ONLY twice
     if (isset($_POST['ajax_referrer']) && $this->_run_count <= 1) {
         // set the router & routed app to use the uri provided in ajax_referrer
         $parsed_url = parse_url($_POST['ajax_referrer']);
         $url = $parsed_url['path'];
         if (!empty($parsed_url['query'])) {
             $url .= '?' . $parsed_url['query'];
         }
         $_SERVER['REQUEST_URI'] = $url;
         $_SERVER['PATH_INFO'] = $parsed_url['path'];
         $this->_run_count++;
         C_Router::$_instances = array();
         $router = C_Router::get_instance();
         $router->serve_request();
     }
     if (isset($_POST['displayed_gallery_id'])) {
         $displayed_gallery = new C_Displayed_Gallery();
         $displayed_gallery->apply_transient($_POST['displayed_gallery_id']);
         $renderer = C_Displayed_Gallery_Renderer::get_instance();
         $retval['html'] = $renderer->render($displayed_gallery, TRUE);
     }
     return $retval;
 }
 /**
  * Displays the 'tagcloud' display type
  *
  * @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
  */
 public function index_action($displayed_gallery, $return = FALSE)
 {
     $display_settings = $displayed_gallery->display_settings;
     $application = C_Router::get_instance()->get_routed_app();
     $tag = urldecode($this->param('gallerytag'));
     // we're looking at a tag, so show images w/that tag as a thumbnail gallery
     if (!is_home() && !empty($tag)) {
         return C_Displayed_Gallery_Renderer::get_instance()->display_images(array('source' => 'tags', 'container_ids' => array(esc_attr($tag)), 'display_type' => $display_settings['display_type'], 'original_display_type' => $displayed_gallery->display_type, 'original_settings' => $display_settings));
     }
     $defaults = array('exclude' => '', 'format' => 'list', 'include' => $displayed_gallery->get_term_ids_for_tags(), 'largest' => 22, 'link' => 'view', 'number' => $display_settings['number'], 'order' => 'ASC', 'orderby' => 'name', 'smallest' => 8, 'taxonomy' => 'ngg_tag', 'unit' => 'pt');
     $args = wp_parse_args('', $defaults);
     // Always query top tags
     $tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
     foreach ($tags as $key => $tag) {
         $tags[$key]->link = $this->object->set_param_for($application->get_routed_url(TRUE), 'gallerytag', $tag->slug);
         $tags[$key]->id = $tag->term_id;
     }
     $params = $display_settings;
     $params['inner_content'] = $displayed_gallery->inner_content;
     $params['storage'] =& $storage;
     $params['tagcloud'] = wp_generate_tag_cloud($tags, $args);
     $params['displayed_gallery_id'] = $displayed_gallery->id();
     $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
     return $this->object->render_partial('photocrati-nextgen_basic_tagcloud#nextgen_basic_tagcloud', $params, $return);
 }
 function define_routes()
 {
     $router = C_Router::get_instance();
     $app = $router->create_app('/nextgen-galleria-gallery');
     $app->rewrite("/{id}", "/id--{id}");
     $app->route('/', 'I_Galleria_iFrame_Controller#index');
 }
 function render($displayed_gallery, $return = FALSE, $mode = NULL)
 {
     $do_rewrites = FALSE;
     $album_types = array(NGG_PRO_ALBUMS, NGG_PRO_LIST_ALBUM, NGG_PRO_GRID_ALBUM);
     // Get the original display type
     $original_display_type = isset($displayed_gallery->display_settings['original_display_type']) ? $displayed_gallery->display_settings['original_display_type'] : '';
     if (in_array($displayed_gallery->display_type, $album_types)) {
         $do_rewrites = TRUE;
         $router = C_Router::get_instance();
         $app = $router->get_routed_app();
         $slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug;
         // ensure to pass $stop=TRUE to $app->rewrite() on parameters that may be shared with other display types
         $app->rewrite('{*}' . $slug . '/page/{\\d}{*}', '{1}' . $slug . '/nggpage--{2}{3}', FALSE, TRUE);
         $app->rewrite('{*}' . $slug . '/page--{*}', '{1}' . $slug . '/nggpage--{2}', FALSE, TRUE);
         $app->rewrite('{*}' . $slug . '/{\\w}', '{1}' . $slug . '/album--{2}');
         $app->rewrite('{*}' . $slug . '/{\\w}/{\\w}', '{1}' . $slug . '/album--{2}/gallery--{3}');
         $app->rewrite('{*}' . $slug . '/{\\w}/{\\w}/{\\w}{*}', '{1}' . $slug . '/album--{2}/gallery--{3}/{4}{5}');
     } elseif (in_array($original_display_type, $album_types)) {
         $do_rewrites = TRUE;
         $router = C_Router::get_instance();
         $app = $router->get_routed_app();
         $slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug;
         $app->rewrite("{*}{$slug}/album--{\\w}", "{1}{$slug}/{2}");
         $app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}", "{1}{$slug}/{2}/{3}");
         $app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}/{*}", "{1}{$slug}/{2}/{3}/{4}");
     }
     if ($do_rewrites) {
         $app->do_rewrites();
     }
     // Continue rendering
     return $this->call_parent('render', $displayed_gallery, $return, $mode);
 }
 function index_action()
 {
     $router = C_Router::get_instance();
     $lightbox_library = C_Lightbox_Library_Manager::get_instance()->get_selected();
     // retrieve by transient id
     $transient_id = $this->object->param('id');
     // get the displayed gallery to display
     $displayed_gallery = $this->get_displayed_gallery($transient_id);
     $this->object->enqueue_static_resources($displayed_gallery, $lightbox_library);
     // The Pro Lightbox can be extended with components that enqueue their own resources
     // and render some markup
     $component_markup = array();
     foreach ($this->object->_components as $name => $handler) {
         $handler = new $handler();
         $handler->name = $name;
         if (!empty($displayed_gallery)) {
             $handler->displayed_gallery = $displayed_gallery;
         }
         $handler->lightbox_library = $lightbox_library;
         $handler->enqueue_static_resources();
         $component_markup[] = $handler->render();
     }
     // Set dynamic display properties
     $lightbox_settings = $lightbox_library->values['nplModalSettings'];
     $lightbox_settings['load_images_url'] = $router->get_url('/nextgen-pro-lightbox-load-images/' . $displayed_gallery->transient_id, TRUE, 'root');
     $lightbox_settings['image_protect'] = !empty(C_NextGen_Settings::get_instance()->protect_images) ? TRUE : FALSE;
     $params = array('displayed_gallery_id' => $displayed_gallery->id(), 'component_markup' => implode("\n", $component_markup), 'lightbox_settings' => $lightbox_settings);
     return $this->object->render_view('photocrati-nextgen_pro_lightbox#index', $params, FALSE);
 }
 function enqueue_pro_lightbox_resources($displayed_gallery = FALSE)
 {
     $settings = C_NextGen_Settings::get_instance();
     if ($settings->thumbEffect == NGG_PRO_LIGHTBOX) {
         $router = C_Router::get_instance();
         if (!self::$run_once) {
             // ensure the gallery exists
             if ($displayed_gallery && $displayed_gallery->id()) {
                 $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.wordpress_page_root', get_permalink(), FALSE);
             }
             wp_enqueue_script('underscore');
             wp_enqueue_script('backbone');
             wp_enqueue_script('velocity', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#velocity.min.js'));
             wp_enqueue_script('galleria', $router->get_static_url('photocrati-galleria#galleria-1.4.2.min.js'));
             wp_enqueue_style('ngg_pro_lightbox_theme_css', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#theme/galleria.nextgen_pro_lightbox.css'));
             wp_enqueue_script('ngg_pro_lightbox_theme_js', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#theme/galleria.nextgen_pro_lightbox.js'), 'galleria');
             if (!wp_style_is('fontawesome', 'registered')) {
                 C_Display_Type_Controller::get_instance()->enqueue_displayed_gallery_trigger_buttons_resources();
             }
             wp_enqueue_style('fontawesome');
             // retrieve the lightbox so we can examine its settings
             $mapper = C_Lightbox_Library_Mapper::get_instance();
             $library = $mapper->find_by_name(NGG_PRO_LIGHTBOX, TRUE);
             $library->display_settings += array('is_front_page' => is_front_page() ? 1 : 0, 'share_url' => $router->get_url('/nextgen-share/{gallery_id}/{image_id}/{named_size}', TRUE, 'root'), 'protect_images' => !empty($settings->protect_images) ? TRUE : FALSE, 'style' => str_replace('.css', '', $library->display_settings['style']), 'i18n' => array('toggle_social_sidebar' => __('Toggle social sidebar', 'nextgen-gallery-pro'), 'play_pause' => __('Play / Pause', 'nextgen-gallery-pro'), 'toggle_fullscreen' => __('Toggle fullscreen', 'nextgen-gallery-pro'), 'toggle_image_info' => __('Toggle image info', 'nextgen-gallery-pro'), 'close_window' => __('Close window', 'nextgen-gallery-pro'), 'share' => array('twitter' => __('Share on Twitter', 'nextgen-gallery-pro'), 'googlep' => __('Share on Google+', 'nextgen-gallery-pro'), 'facebook' => __('Share on Facebook', 'nextgen-gallery-pro'), 'pinterest' => __('Share on Pinterest', 'nextgen-gallery-pro'))));
             // provide the current language so ajax requests can request translations in the same locale
             if (defined('ICL_LANGUAGE_CODE')) {
                 $library->display_settings['lang'] = $router->param('lang', NULL, FALSE) ? $router->param('lang') : ICL_LANGUAGE_CODE;
             }
             wp_localize_script('photocrati_ajax', 'nplModalSettings', $library->display_settings);
         }
         self::$run_once = TRUE;
     }
 }
 function passthru()
 {
     $router = C_Router::get_instance();
     $_SERVER['ORIG_REQUEST_URI'] = $_SERVER['REQUEST_URI'];
     // TODO: Verify that we only need to do this on Windows
     $base_parts = parse_url($router->get_base_url('root'));
     $_SERVER['UNENCODED_URL'] = $_SERVER['HTTP_X_ORIGINAL_URL'] = $_SERVER['REQUEST_URI'] = '/' . trailingslashit($router->join_paths(!empty($base_parts['path']) ? $base_parts['path'] : '', $this->object->strip_param_segments($router->get_request_uri())));
 }
 function enqueue_admin_scripts()
 {
     $router = C_Router::get_instance();
     wp_register_script('frame_event_publisher', $router->get_static_url('photocrati-frame_communication#frame_event_publisher.js'), array('jquery'));
     if (is_admin()) {
         wp_enqueue_script('frame_event_publisher');
     }
 }
 /**
  * Examines 'the_content' string for img.ngg-singlepic and enqueues styling when found
  *
  * @param string $content
  * @return string $content
  */
 function enqueue_singlepic_css($content)
 {
     if (preg_match("#<img.*ngg-singlepic.*>#", $content, $matches)) {
         $router = C_Router::get_instance();
         wp_enqueue_style('nextgen_basic_singlepic_style', $router->get_static_url(NGG_BASIC_SINGLEPIC . '#nextgen_basic_singlepic.css'));
     }
     return $content;
 }
 function enqueue_admin_scripts()
 {
     $router = C_Router::get_instance();
     wp_register_script('frame_event_publisher', $router->get_static_url('photocrati-frame_communication#frame_event_publisher.js'), array('jquery'), NGG_SCRIPT_VERSION);
     if (is_admin()) {
         wp_enqueue_script('frame_event_publisher');
         wp_localize_script('frame_event_publisher', 'frame_event_publisher_domain', array(parse_url(site_url(), PHP_URL_HOST)));
     }
 }
 /**
  * lightbox_overrides.js holds all of the pro-lightbox related proofing features
  */
 function enqueue_static_resources()
 {
     if (!self::$_localized_once) {
         self::$_localized_once = TRUE;
         $router = C_Router::get_instance();
         wp_enqueue_script('ngg-pro-lightbox-proofing-js', $router->get_static_url('photocrati-nextgen_pro_proofing#lightbox_overrides.js'));
         wp_localize_script('ngg-pro-lightbox-proofing-js', 'ngg_proofing_settings', array('active_color' => C_NextGen_Settings::get_instance()->proofing_lightbox_active_color));
     }
 }
 function _register_protection_js()
 {
     if (!is_admin() && C_NextGen_Settings::get_instance()->protect_images) {
         $router = C_Router::get_instance();
         wp_register_script('photocrati-image_protection', $router->get_static_url('photocrati-image_protection#custom.js'), array('jquery'));
         wp_enqueue_script('photocrati-image_protection');
         wp_localize_script('photocrati-image_protection', 'photocrati_image_protection_global', array('enabled' => C_NextGen_Settings::get_instance()->protect_images_globally));
     }
 }
 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 enqueue_resources($displayed_gallery)
 {
     $router = C_Router::get_instance();
     $enqueue = FALSE;
     if (!wp_style_is('fontawesome', 'registered')) {
         $enqueue = C_Display_Type_Controller::get_instance()->enqueue_displayed_gallery_trigger_buttons_resources($displayed_gallery);
     }
     if ($enqueue !== FALSE) {
         if (!wp_style_is('ngg-trigger-buttons', 'registered')) {
             wp_register_style('ngg-trigger-buttons', $router->get_static_url('photocrati-nextgen_pro_lightbox#trigger_buttons.css'), false);
             wp_enqueue_style('ngg-trigger-buttons');
         }
     }
 }
 function register_scripts()
 {
     if (is_admin()) {
         $router = C_Router::get_instance();
         wp_register_script('browserplus', $router->get_static_url('photocrati-nextgen_addgallery_page#browserplus-2.4.21.min.js'));
         wp_register_script('ngg.plupload.moxie', $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/moxie.min.js'));
         wp_register_script('ngg.plupload.full', $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/plupload.dev.min.js'), array('ngg.plupload.moxie'));
         wp_register_script('ngg.plupload.queue', $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/jquery.plupload.queue/jquery.plupload.queue.min.js'), array('ngg.plupload.full'));
         wp_register_style('ngg.plupload.queue', $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/jquery.plupload.queue/css/jquery.plupload.queue.css'));
         wp_register_style('nextgen_addgallery_page', $router->get_static_url('photocrati-nextgen_addgallery_page#styles.css'));
         wp_register_script('jquery.filetree', $router->get_static_url('photocrati-nextgen_addgallery_page#jquery.filetree/jquery.filetree.js'), array('jquery'));
         wp_register_style('jquery.filetree', $router->get_static_url('photocrati-nextgen_addgallery_page#jquery.filetree/jquery.filetree.css'));
     }
 }
 function render_displayed_gallery_action()
 {
     $retval = array();
     if (isset($_POST['ajax_referrer'])) {
         $_SERVER['REQUEST_URI'] = $_POST['ajax_referrer'];
         C_Router::get_instance()->serve_request();
     }
     if (isset($_POST['displayed_gallery_id'])) {
         $displayed_gallery = new C_Displayed_Gallery();
         $displayed_gallery->apply_transient($_POST['displayed_gallery_id']);
         $renderer = C_Displayed_Gallery_Renderer::get_instance();
         $retval['html'] = $renderer->render($displayed_gallery, TRUE);
     }
     return $retval;
 }
 function register_scripts()
 {
     if (is_admin()) {
         $router = C_Router::get_instance();
         wp_register_script('browserplus', $router->get_static_url('photocrati-nextgen_addgallery_page#browserplus-2.4.21.min.js'), FALSE, NGG_SCRIPT_VERSION);
         wp_register_script('ngg.plupload.moxie', $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/moxie.min.js'), FALSE, NGG_SCRIPT_VERSION);
         wp_register_script('ngg.plupload.full', $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/plupload.dev.js'), array('ngg.plupload.moxie'), NGG_SCRIPT_VERSION);
         wp_register_script('ngg.plupload.queue', $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/jquery.plupload.queue/jquery.plupload.queue.min.js'), array('ngg.plupload.full'), NGG_SCRIPT_VERSION);
         wp_register_style('ngg.plupload.queue', $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/jquery.plupload.queue/css/jquery.plupload.queue.css'), FALSE, NGG_SCRIPT_VERSION);
         wp_register_style('nextgen_addgallery_page', $router->get_static_url('photocrati-nextgen_addgallery_page#styles.css'), FALSE, NGG_SCRIPT_VERSION);
         wp_register_script('jquery.filetree', $router->get_static_url('photocrati-nextgen_addgallery_page#jquery.filetree/jquery.filetree.js'), array('jquery'), NGG_SCRIPT_VERSION);
         wp_register_style('jquery.filetree', $router->get_static_url('photocrati-nextgen_addgallery_page#jquery.filetree/jquery.filetree.css'), FALSE, NGG_SCRIPT_VERSION);
         wp_register_script('nextgen_media_library_import-js', $router->get_static_url('photocrati-nextgen_addgallery_page#media-library-import.js'), array('jquery', 'ngg_progressbar'), NGG_SCRIPT_VERSION);
         wp_register_style('nextgen_media_library_import-css', $router->get_static_url('photocrati-nextgen_addgallery_page#media-library-import.css'), FALSE, NGG_SCRIPT_VERSION);
     }
 }
 function enqueue_backend_resources()
 {
     parent::enqueue_backend_resources();
     $router = C_Router::get_instance();
     if (!wp_script_is('sprintf')) {
         wp_register_script('sprintf', $router->get_static_url('photocrati-nextgen_pro_ecommerce#sprintf.js'));
     }
     wp_enqueue_script('sprintf');
     wp_enqueue_script('jquery.number');
     // Enqueue fontawesome
     if (method_exists('M_Gallery_Display', 'enqueue_fontawesome')) {
         M_Gallery_Display::enqueue_fontawesome();
     } else {
         C_Display_Type_Controller::get_instance()->enqueue_displayed_gallery_trigger_buttons_resources();
     }
     wp_enqueue_style('fontawesome');
 }
 function widget($args, $instance)
 {
     $router = C_Router::get_instance();
     wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'));
     wp_enqueue_style('nextgen_basic_slideshow_style', $router->get_static_url('photocrati-nextgen_basic_gallery#slideshow/nextgen_basic_slideshow.css'));
     // these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
     $before_widget = NULL;
     $before_title = NULL;
     $after_widget = NULL;
     $after_title = NULL;
     $widget_id = NULL;
     extract($args);
     $parent = C_Component_Registry::get_instance()->get_utility('I_Widget');
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Slideshow', 'nggallery') : $instance['title'], $instance, $this->id_base);
     $out = $this->render_slideshow($instance['galleryid'], $instance['width'], $instance['height'], $args);
     $parent->render_partial('photocrati-widget#display_slideshow', array('self' => $this, 'instance' => $instance, 'title' => $title, 'out' => $out, 'before_widget' => $before_widget, 'before_title' => $before_title, 'after_widget' => $after_widget, 'after_title' => $after_title, 'widget_id' => $widget_id));
 }
 function widget($args, $instance)
 {
     $router = C_Router::get_instance();
     wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'));
     wp_enqueue_style('nextgen_basic_thumbnails_style', $router->get_static_url('photocrati-nextgen_basic_gallery#thumbnails/nextgen_basic_thumbnails.css'));
     // these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
     $before_widget = NULL;
     $before_title = NULL;
     $after_widget = NULL;
     $after_title = NULL;
     $widget_id = NULL;
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
     $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
     $factory = C_Component_Registry::get_instance()->get_utility('I_Component_Factory');
     $view = $factory->create('mvc_view', '');
     // IE8 webslice support if needed
     if ($instance['webslice']) {
         $before_widget .= '<div class="hslice" id="ngg-webslice">';
         $before_title = str_replace('class="', 'class="entry-title ', $before_title);
         $after_widget = '</div>' . $after_widget;
     }
     $source = $instance['type'] == 'random' ? 'random_images' : 'recent';
     $params = array('slug' => 'widget-' . $args['widget_id'], 'source' => $source, 'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS, 'images_per_page' => $instance['items'], 'maximum_entity_count' => $instance['items'], 'template' => $view->get_template_abspath('photocrati-widget#display_gallery'), 'image_type' => $instance['show'] == 'original' ? 'full' : 'thumb', 'show_all_in_lightbox' => FALSE, 'show_slideshow_link' => FALSE, 'disable_pagination' => TRUE, 'image_width' => $instance['width'], 'image_height' => $instance['height'], 'ngg_triggers_display' => 'never', 'widget_setting_title' => $title, 'widget_setting_before_widget' => $before_widget, 'widget_setting_before_title' => $before_title, 'widget_setting_after_widget' => $after_widget, 'widget_setting_after_title' => $after_title, 'widget_setting_width' => $instance['width'], 'widget_setting_height' => $instance['height'], 'widget_setting_show_setting' => $instance['show'], 'widget_setting_widget_id' => $widget_id);
     switch ($instance['exclude']) {
         case 'all':
             break;
         case 'denied':
             $mapper = C_Component_Registry::get_instance()->get_utility('I_Gallery_Mapper');
             $gallery_ids = array();
             $list = explode(',', $instance['list']);
             foreach ($mapper->find_all() as $gallery) {
                 if (!in_array($gallery->{$gallery->id_field}, $list)) {
                     $gallery_ids[] = $gallery->{$gallery->id_field};
                 }
             }
             $params['container_ids'] = implode(',', $gallery_ids);
             break;
         case 'allow':
             $params['container_ids'] = $instance['list'];
             break;
     }
     echo $renderer->display_images($params);
 }
 function install_pro_lightbox()
 {
     $router = C_Router::get_instance();
     // Install or update the lightbox library
     $mapper = $this->get_registry()->get_utility('I_Lightbox_Library_Mapper');
     $lightbox = $mapper->find_by_name(NGG_PRO_LIGHTBOX);
     if (!$lightbox) {
         $lightbox = new stdClass();
     }
     // Set properties
     $lightbox->name = NGG_PRO_LIGHTBOX;
     $this->set_attr($lightbox, 'title', __("NextGEN Pro Lightbox", 'nggallery'));
     $this->set_attr($lightbox, 'code', "class='nextgen_pro_lightbox' data-nplmodal-gallery-id='%PRO_LIGHTBOX_GALLERY_ID%'");
     $this->set_attr($lightbox, 'css_stylesheets', implode("\n", array('photocrati-nextgen_pro_lightbox_legacy#style.css')));
     $this->set_attr($lightbox, 'styles', implode("\n", array('photocrati-nextgen_pro_lightbox_legacy#style.css')));
     $this->set_attr($lightbox, 'scripts', implode("\n", array('photocrati-nextgen_pro_lightbox_legacy#jquery.mobile_browsers.js', "photocrati-nextgen_pro_lightbox_legacy#nextgen_pro_lightbox.js")));
     $this->set_attr($lightbox, 'display_settings', array('icon_color' => '', 'icon_background' => '', 'icon_background_enabled' => '0', 'icon_background_rounded' => '1', 'overlay_icon_color' => '', 'sidebar_button_color' => '', 'sidebar_button_background' => '', 'carousel_text_color' => '', 'background_color' => '', 'carousel_background_color' => '', 'sidebar_background_color' => '', 'router_slug' => 'gallery', 'transition_effect' => 'slide', 'enable_routing' => '1', 'enable_comments' => '1', 'enable_sharing' => '1', 'display_comments' => '0', 'display_captions' => '0', 'display_carousel' => '1', 'transition_speed' => '0.4', 'slideshow_speed' => '5', 'style' => '', 'touch_transition_effect' => 'slide', 'image_pan' => '0', 'interaction_pause' => '1', 'image_crop' => 'false'));
     $mapper->save($lightbox);
 }
 function get_router()
 {
     return C_Router::get_instance();
 }
 /**
  * Parses certain paths through get_static_url
  *
  * @param string $url
  * @return string Resulting URL
  */
 static function _handle_url($url, $type = 'script')
 {
     $router = C_Router::get_instance();
     if (0 !== strpos($url, '/') && 0 !== strpos($url, 'wordpress#') && 0 !== strpos($url, 'http://') && 0 !== strpos($url, 'https://')) {
         $url = $router->get_static_url($url);
     } elseif (strpos($url, '/') === 0) {
         $url = home_url($url);
     }
     return $url;
 }
 public function render($displayed_gallery, $return = FALSE, $mode = NULL)
 {
     $do_rewrites = FALSE;
     $app = NULL;
     // Get display types
     $original_display_type = isset($displayed_gallery->display_settings['original_display_type']) ? $displayed_gallery->display_settings['original_display_type'] : '';
     $display_type = $displayed_gallery->display_type;
     // If we're viewing an album, rewrite the urls
     $regex = '/photocrati-nextgen_basic_\\w+_album/';
     if (preg_match($regex, $display_type)) {
         $do_rewrites = TRUE;
         // Get router
         $router = C_Router::get_instance();
         $app = $router->get_routed_app();
         $slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug;
         $app->rewrite("{*}{$slug}/page/{\\d}{*}", "{1}{$slug}/nggpage--{2}{3}", FALSE, TRUE);
         $app->rewrite("{*}{$slug}/pid--{*}", "{1}{$slug}/pid--{2}", FALSE, TRUE);
         // avoid conflicts with imagebrowser
         $app->rewrite("{*}{$slug}/{\\w}/{\\w}/{\\w}{*}", "{1}{$slug}/album--{2}/gallery--{3}/{4}{5}", FALSE, TRUE);
         $app->rewrite("{*}{$slug}/{\\w}/{\\w}", "{1}{$slug}/album--{2}/gallery--{3}", FALSE, TRUE);
     } elseif (preg_match($regex, $original_display_type)) {
         $do_rewrites = TRUE;
         // Get router
         $router = C_Router::get_instance();
         $app = $router->get_routed_app();
         $slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug;
         $app->rewrite("{*}{$slug}/album--{\\w}", "{1}{$slug}/{2}");
         $app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}", "{1}{$slug}/{2}/{3}");
         $app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}/{*}", "{1}{$slug}/{2}/{3}/{4}");
     }
     // Perform rewrites
     if ($do_rewrites && $app) {
         $app->do_rewrites();
     }
     return $this->call_parent('render', $displayed_gallery, $return, $mode);
 }
 function maybe_enqueue_fontawesome()
 {
     $settings = C_NextGen_Settings::get_instance();
     $context = isset($settings->thumbEffectContext) ? $settings->thumbEffectContext : '';
     if ($context != 'nextgen_images') {
         if (!wp_style_is('fontawesome', 'registered')) {
             if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== FALSE) {
                 wp_register_style('fontawesome', site_url('/?ngg_serve_fontawesome_css=1'));
             } else {
                 wp_register_style('fontawesome', C_Router::get_instance()->get_static_url('photocrati-nextgen_gallery_display#fontawesome/font-awesome.css'));
             }
         } else {
             wp_enqueue_style('fontawesome');
         }
     }
 }
 public function enqueue_scripts()
 {
     if ($this->has_displayed_notice()) {
         $router = C_Router::get_instance();
         wp_enqueue_script('ngg_admin_notices', $router->get_static_url('photocrati-nextgen_admin#admin_notices.js'), array(), FALSE, TRUE);
         wp_localize_script('ngg_admin_notices', 'ngg_dismiss_url', $this->_dismiss_url);
     }
 }
 /**
  * Plupload stores its i18n JS *mostly* as "en.js" or "ar.js" - but some as zh_CN.js so we must check both if the
  * first does not match.
  *
  * @return bool|string
  */
 public function _find_plupload_i18n()
 {
     $fs = C_Fs::get_instance();
     $router = C_Router::get_instance();
     $locale = get_locale();
     $dir = $fs->find_static_abspath('photocrati-nextgen_addgallery_page#plupload-2.1.1/i18n') . DIRECTORY_SEPARATOR;
     $tmp = explode('_', $locale, 2);
     $retval = FALSE;
     if (file_exists($dir . $tmp[0] . '.js')) {
         $retval = $tmp[0];
     } else {
         if (file_exists($dir . $locale . '.js')) {
             $retval = $locale;
         }
     }
     if ($retval) {
         $retval = $router->get_static_url('photocrati-nextgen_addgallery_page#plupload-2.1.1/i18n/' . $retval . '.js');
     }
     return $retval;
 }