function set_defaults($entity)
 {
     $this->call_parent('set_defaults', $entity);
     if ($entity->name == NGG_PRO_HORIZONTAL_FILMSTRIP) {
         $settings = C_NextGen_Settings::get_instance();
         $this->object->_set_default_value($entity, 'settings', 'override_thumbnail_settings', 1);
         $this->object->_set_default_value($entity, 'settings', 'thumbnail_width', 120);
         $this->object->_set_default_value($entity, 'settings', 'thumbnail_height', 90);
         $this->object->_set_default_value($entity, 'settings', 'thumbnail_quality', $settings->thumbquality);
         $this->object->_set_default_value($entity, 'settings', 'thumbnail_crop', $settings->thumbfix);
         $this->object->_set_default_value($entity, 'settings', 'thumbnail_watermark', 0);
         $this->object->_set_default_value($entity, 'settings', 'override_image_settings', 0);
         $this->object->_set_default_value($entity, 'settings', 'image_quality', '100');
         $this->object->_set_default_value($entity, 'settings', 'image_crop', 0);
         $this->object->_set_default_value($entity, 'settings', 'image_watermark', 0);
         // options inherited from the pro-slideshow module
         $this->object->_set_default_value($entity, 'settings', 'image_pan', 1);
         $this->object->_set_default_value($entity, 'settings', 'show_playback_controls', 1);
         $this->object->_set_default_value($entity, 'settings', 'show_captions', 0);
         $this->object->_set_default_value($entity, 'settings', 'caption_class', 'caption_overlay_bottom');
         $this->object->_set_default_value($entity, 'settings', 'aspect_ratio', '1.5');
         $this->object->_set_default_value($entity, 'settings', 'width', 100);
         $this->object->_set_default_value($entity, 'settings', 'width_unit', '%');
         $this->object->_set_default_value($entity, 'settings', 'transition', 'fade');
         $this->object->_set_default_value($entity, 'settings', 'transition_speed', 1);
         $this->object->_set_default_value($entity, 'settings', 'slideshow_speed', 5);
         $this->object->_set_default_value($entity, 'settings', 'border_size', 0);
         $this->object->_set_default_value($entity, 'settings', 'border_color', '#ffffff');
         $this->object->_set_default_value($entity, 'settings', 'ngg_triggers_display', 'always');
     }
 }
    function install()
    {
        $settings = C_NextGen_Settings::get_instance();
        $settings->set_default_value('proofing_page_confirmation', '');
        $settings->set_default_value('proofing_lightbox_active_color', '#ffff00');
        $settings->set_default_value('proofing_trigger_text', __('Submit proofs', 'nggallery'));
        $settings->set_default_value('proofing_email_template', 'Hi %%admin%% Administrator,

%%user_name%% has submitted images from a proofing gallery.

You can find the proofed images at %%proof_link%%

Here is a comma separated list of the image file names. You can copy and
paste this in your favorite image management software to quickly search for
and find all selected images.

Files: %%file_list%%');
        $settings->set_default_value('proofing_enable_user_email', 0);
        $settings->set_default_value('proofing_user_email_subject', __('Confirmation of image proof', 'nggallery'));
        $settings->set_default_value('proofing_user_email_template', 'Hello %%user_name%%,

This is confirmation that you have selected and submitted the following
images from one of our proofing galleries: %%proof_link%%

Thanks very much!');
        $settings->set_default_value('proofing_user_confirmation_template', '<p>%%user_name%% has submitted the following images for proofing. <a href="%%proof_link%%">Go back</a></p>

 %%proof_details%%');
        $settings->set_default_value('proofing_user_confirmation_not_found', __('Oops! This page usually displays details for image proofs, but you have not proofed any images yet. Please feel free to continue browsing. Thanks for visiting.', 'nggallery'));
    }
 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 __construct()
 {
     $this->blog_settings = C_NextGen_Settings::get_instance();
     $this->site_settings = C_NextGen_Global_Settings::get_instance();
     $this->_global_settings = array('gallerypath' => implode(DIRECTORY_SEPARATOR, array('wp-content', 'uploads', 'sites', '%BLOG_ID%', 'nggallery')) . DIRECTORY_SEPARATOR, 'wpmuCSSfile' => 'nggallery.css', 'wpmuStyle' => FALSE, 'wpmuRoles' => FALSE, 'wpmuImportFolder' => FALSE, 'wpmuZipUpload' => FALSE, 'wpmuQuotaCheck' => FALSE, 'datamapper_driver' => 'custom_table_datamapper', 'gallerystorage_driver' => 'ngglegacy_gallery_storage', 'maximum_entity_count' => 500, 'router_param_slug' => 'nggallery');
     $this->_local_settings = array('gallerypath' => 'wp-content' . DIRECTORY_SEPARATOR . 'gallery' . DIRECTORY_SEPARATOR, 'deleteImg' => TRUE, 'swfUpload' => TRUE, 'usePermalinks' => FALSE, 'permalinkSlug' => 'nggallery', 'graphicLibrary' => 'gd', 'imageMagickDir' => '/usr/local/bin/', 'useMediaRSS' => FALSE, 'galleries_in_feeds' => FALSE, 'activateTags' => 0, 'appendType' => 'tags', 'maxImages' => 7, 'relatedHeading' => '<h3>' . __('Related Images', 'nggallery') . ':</h3>', 'thumbwidth' => 240, 'thumbheight' => 160, 'thumbfix' => True, 'thumbquality' => 100, 'imgWidth' => 800, 'imgHeight' => 600, 'imgQuality' => 100, 'imgBackup' => True, 'imgAutoResize' => False, 'galImages' => '20', 'galPagedGalleries' => 0, 'galColumns' => 0, 'galShowSlide' => True, 'galTextSlide' => __('[Show slideshow]', 'nggallery'), 'galTextGallery' => __('[Show thumbnails]', 'nggallery'), 'galShowOrder' => 'gallery', 'galSort' => 'sortorder', 'galSortDir' => 'ASC', 'galNoPages' => True, 'galImgBrowser' => 0, 'galHiddenImg' => 0, 'galAjaxNav' => 0, 'thumbEffect' => 'fancybox', 'thumbCode' => 'class="ngg-fancybox" rel="%GALLERY_NAME%"', 'thumbEffectContext' => 'nextgen_images', 'wmPos' => 'botRight', 'wmXpos' => 5, 'wmYpos' => 5, 'wmType' => 'image', 'wmPath' => '', 'wmFont' => 'arial.ttf', 'wmSize' => 10, 'wmText' => get_option('blogname'), 'wmColor' => '000000', 'wmOpaque' => '100', 'slideFX' => 'fade', 'irWidth' => 600, 'irHeight' => 400, 'irRotatetime' => 10, 'activateCSS' => 1, 'CSSfile' => 'nggallery.css', 'always_enable_frontend_logic' => FALSE);
 }
 static function update($reset = FALSE)
 {
     $global_settings = C_NextGen_Global_Settings::get_instance();
     $local_settings = C_NextGen_Settings::get_instance();
     $last_module_list = $reset ? array() : $global_settings->get('pope_module_list', array());
     $current_module_list = self::_generate_module_info();
     if (count($modules = array_diff($current_module_list, $last_module_list)) > 0) {
         // The cache should be flushed
         C_Photocrati_Cache::flush();
         // Delete auto-update cache
         update_option('photocrati_auto_update_admin_update_list', null);
         update_option('photocrati_auto_update_admin_check_date', '');
         foreach ($modules as $module_name) {
             if ($handler = self::get_handler_instance(array_shift(explode('|', $module_name)))) {
                 if (method_exists($handler, 'install')) {
                     $handler->install($reset);
                 }
             }
         }
         // Update the module list
         $global_settings->set('pope_module_list', $current_module_list);
         // Save any changes settings
         $global_settings->save();
         $local_settings->save();
     }
 }
 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 define($context = FALSE)
 {
     parent::define('photocrati-frame_communication', 'Frame/iFrame Inter-Communication', 'Provides a means for HTML frames to share server-side events with each other', '0.4', 'http://www.nextgen-gallery.com', 'Photocrati Media', 'http://www.photocrati.com', $context);
     include_once 'class.frame_communication_option_handler.php';
     C_NextGen_Settings::get_instance()->add_option_handler('C_Frame_Communication_Option_Handler', array('frame_event_cookie_name'));
     C_NextGen_Global_Settings::get_instance()->add_option_handler('C_Frame_Communication_Option_Handler', array('frame_event_cookie_name'));
 }
 function index_action($return = FALSE)
 {
     // If the site was accessed as http://foobar.com but the iframe/site_url() is http://www.foobar.com,
     // then the JS will generate cross origin framing errors
     if (isset($_GET['ngg_fix_cross_origins']) && isset($_SERVER['HTTP_REFERER'])) {
         $referrer = parse_url($_SERVER['HTTP_REFERER']);
         $host = parse_url(site_url());
         $referrer = $referrer['host'];
         $host = $host['host'];
         if ($host != $referrer) {
             $parts = explode('.', $host);
             $host = implode('.', array_slice($parts, -2, 2));
             if ($host == $referrer) {
                 header("X-Frame-Options: ALLOW-FROM {$host}");
             }
         }
     }
     $this->object->expires("1 year");
     // IMPORTANT: The Displayed Gallery has already been fetched by the
     // parent frame, and is available on the client side as
     // window.galleries.gallery_[id] and therefore fetching the
     // displayed gallery on the server side is strongly discouraged as it's
     // a redundant database query. Instead, find a way to make use of the
     // client side object
     $protect_images = !empty(C_NextGen_Settings::get_instance()->protect_images) ? TRUE : FALSE;
     return $this->object->render_view('photocrati-galleria#galleria_iframe', array('id' => $this->param('id'), 'jquery_url' => includes_url('/js/jquery/jquery.js'), 'galleria_url' => $this->get_static_url('photocrati-galleria#galleria-1.2.9.min.js'), 'galleria_instance_js' => $this->object->galleria_instance_js(), 'ngg_settings' => array('protect_images' => $protect_images)), $return);
 }
 function _set_ngglegacy_page_parameter($key, $value = NULL, $id = NULL, $use_prefix = NULL)
 {
     // Get the returned url
     $retval = $this->object->get_method_property($this->method_called, ExtensibleObject::METHOD_PROPERTY_RETURN_VALUE);
     // Get the settings manager
     $settings = C_NextGen_Settings::get_instance();
     // Create regex pattern
     $param_slug = preg_quote($settings->router_param_slug, '#');
     if ($key == 'nggpage') {
         $regex = "#(/{$param_slug}/.*)(/?page/\\d+/?)(.*)#";
         if (preg_match($regex, $retval, $matches)) {
             $new_segment = $value ? "/page/{$value}" : "";
             $retval = rtrim(str_replace($matches[0], rtrim($matches[1], "/") . $new_segment . ltrim($matches[3], "/"), $retval), "/");
             // Set new return value
             $this->object->set_method_property($this->method_called, ExtensibleObject::METHOD_PROPERTY_RETURN_VALUE, $retval);
         }
     }
     # Convert the nggpage parameter to a slug
     if (preg_match("#(/{$param_slug}/.*)nggpage--(.*)#", $retval, $matches)) {
         $retval = rtrim(str_replace($matches[0], rtrim($matches[1], "/") . "/page/" . ltrim($matches[2], "/"), $retval), "/");
         // Set new return value
         $this->object->set_method_property($this->method_called, ExtensibleObject::METHOD_PROPERTY_RETURN_VALUE, $retval);
     }
     # Convert the show parameter to a slug
     if (preg_match("#(/{$param_slug}/.*)show--(.*)#", $retval, $matches)) {
         $retval = rtrim(str_replace($matches[0], rtrim($matches[1], "/") . '/' . $matches[2], $retval), "/");
         $retval = str_replace(NGG_BASIC_SLIDESHOW, 'slideshow', $retval);
         $retval = str_replace(NGG_BASIC_THUMBNAILS, 'thumbnails', $retval);
         $retval = str_replace(NGG_BASIC_IMAGEBROWSER, 'imagebrowser', $retval);
         // Set new return value
         $this->object->set_method_property($this->method_called, ExtensibleObject::METHOD_PROPERTY_RETURN_VALUE, $retval);
     }
     return $retval;
 }
Example #10
0
 function reset_action()
 {
     global $wpdb;
     // Flush the cache
     C_Photocrati_Cache::flush('all');
     // Uninstall the plugin
     $settings = C_NextGen_Settings::get_instance();
     if (defined('NGG_PRO_PLUGIN_VERSION') || defined('NEXTGEN_GALLERY_PRO_VERSION')) {
         C_Photocrati_Installer::uninstall('photocrati-nextgen-pro');
     }
     C_Photocrati_Installer::uninstall('photocrati-nextgen');
     // removes all ngg_options entry in wp_options
     $settings->reset();
     $settings->destroy();
     // clear NextGEN's capabilities from the roles system
     $capabilities = array("NextGEN Gallery overview", "NextGEN Use TinyMCE", "NextGEN Upload images", "NextGEN Manage gallery", "NextGEN Manage others gallery", "NextGEN Manage tags", "NextGEN Edit album", "NextGEN Change style", "NextGEN Change options", "NextGEN Attach Interface");
     $roles = array("subscriber", "contributor", "author", "editor", "administrator");
     foreach ($roles as $role) {
         $role = get_role($role);
         foreach ($capabilities as $capability) {
             $role->remove_cap($capability);
         }
     }
     // Some installations of NextGen that upgraded from 1.9x to 2.0x have duplicates installed,
     // so for now (as of 2.0.21) we explicitly remove all display types and lightboxes from the
     // db as a way of fixing this.
     $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->posts} WHERE post_type = %s", 'display_type'));
     $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->posts} WHERE post_type = %s", 'lightbox_library'));
     // the installation will run on the next page load; so make our own request before reloading the browser
     wp_remote_get(admin_url('plugins.php'), array('timeout' => 180, 'blocking' => true, 'sslverify' => false));
     header('Location: ' . $_SERVER['REQUEST_URI']);
     throw new E_Clean_Exit();
 }
 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);
 }
Example #12
0
 /**
  * Gets the absolute path to a static resource. If it doesn't exist, then NULL is returned
  *
  * @param string $path
  * @param string $module
  * @param string $relative
  * @return string|NULL
  */
 function find_static_abspath($path, $module = FALSE, $relative = FALSE)
 {
     // Find the module directory
     $fs = $this->object->get_registry()->get_utility('I_Fs');
     if (!$module) {
         list($path, $module) = $fs->parse_formatted_path($path);
     }
     $mod_dir = $this->object->get_registry()->get_module_dir($module);
     // Create the absolute path to the file
     $path = $fs->join_paths($mod_dir, C_NextGen_Settings::get_instance()->get('mvc_static_dirname'), $path);
     // Get the relative path, if asked. Skip when docroot=/ lest we generate url like
     // wp-contentpluginsnextgen-galleryproducts..
     if ($relative) {
         $original_length = strlen($path);
         $roots = array('plugins', 'plugins_mu', 'templates', 'stylesheets');
         $found_root = FALSE;
         foreach ($roots as $root) {
             $path = str_replace($this->object->get_document_root($root), '', $path);
             if (strlen($path) != $original_length) {
                 $found_root = $root;
                 break;
             }
         }
     }
     return $path;
 }
 function enqueue_backend_resources()
 {
     $this->call_parent('enqueue_backend_resources');
     // Enqueue frame event publishing
     wp_enqueue_script('frame_event_publisher');
     // Enqueue JQuery UI libraries
     wp_enqueue_script('jquery-ui-tabs');
     wp_enqueue_script('jquery-ui-sortable');
     wp_enqueue_script('jquery-ui-tooltip');
     wp_enqueue_script('ngg_tabs', $this->get_static_url('photocrati-attach_to_post#ngg_tabs.js'));
     // Ensure select2
     wp_enqueue_style('select2');
     wp_enqueue_script('select2');
     // Ensure that the Photocrati AJAX library is loaded
     wp_enqueue_script('photocrati_ajax');
     // Enqueue logic for the Attach to Post interface as a whole
     wp_enqueue_script('ngg_attach_to_post', $this->get_static_url('photocrati-attach_to_post#attach_to_post.js'));
     wp_enqueue_style('ngg_attach_to_post', $this->get_static_url('photocrati-attach_to_post#attach_to_post.css'));
     // Enqueue backbone.js library, required by the Attach to Post display tab
     wp_enqueue_script('backbone');
     // provided by WP
     // Ensure underscore sting, a helper utility
     wp_enqueue_script('underscore.string', $this->get_static_url('photocrati-attach_to_post#underscore.string.js'), array('underscore'), '2.3.0');
     // Enqueue the backbone app for the display tab
     $settings = C_NextGen_Settings::get_instance();
     $preview_url = $settings->gallery_preview_url;
     $display_tab_js_url = $settings->attach_to_post_display_tab_js_url;
     if ($this->object->_displayed_gallery->id()) {
         $display_tab_js_url .= '/id--' . $this->object->_displayed_gallery->id();
     }
     wp_enqueue_script('ngg_display_tab', $display_tab_js_url, array('backbone', 'underscore.string'));
     wp_localize_script('ngg_display_tab', 'ngg_displayed_gallery_preview_url', $settings->gallery_preview_url);
 }
 function index_action()
 {
     $this->enqueue_static_resources();
     $settings = C_NextGen_Settings::get_instance();
     $retval = $settings->proofing_user_confirmation_not_found;
     if ($proof = C_NextGen_Pro_Proofing_Mapper::get_instance()->find_by_hash($this->param('proof'), TRUE)) {
         $image_mapper = C_Image_Mapper::get_instance();
         $images = array();
         foreach ($proof->proofed_gallery['image_list'] as $image_id) {
             $images[] = $image_mapper->find($image_id);
         }
         $message = $settings->proofing_user_confirmation_template;
         if (preg_match_all('/%%(\\w+)%%/', $settings->proofing_user_confirmation_template, $matches, PREG_SET_ORDER) > 0) {
             foreach ($matches as $match) {
                 switch ($match[1]) {
                     case 'user_name':
                         $message = str_replace('%%user_name%%', $proof->customer_name, $message);
                         break;
                     case 'user_email':
                         $message = str_replace('%%user_email%%', $proof->email, $message);
                         break;
                     case 'proof_link':
                         $message = str_replace('%%proof_link%%', $proof->referer, $message);
                         break;
                     case 'proof_details':
                         $imagehtml = $this->object->render_partial('photocrati-nextgen_pro_proofing#confirmation', array('images' => $images, 'storage' => C_Gallery_Storage::get_instance()), TRUE);
                         $message = str_replace('%%proof_details%%', $imagehtml, $message);
                         break;
                 }
             }
             $retval = $message;
         }
     }
     return $retval;
 }
 function render_related_string()
 {
     $settings = C_NextGen_Settings::get_instance();
     $type = $settings->appendType;
     $maxImages = $settings->maxImages;
     $sluglist = array();
     switch ($type) {
         case 'tags':
             if (function_exists('get_the_tags')) {
                 $taglist = get_the_tags();
                 if (is_array($taglist)) {
                     foreach ($taglist as $tag) {
                         $sluglist[] = $tag->slug;
                     }
                 }
             }
             break;
         case 'category':
             $catlist = get_the_category();
             if (is_array($catlist)) {
                 foreach ($catlist as $cat) {
                     $sluglist[] = $cat->category_nicename;
                 }
             }
             break;
     }
     $taglist = implode(',', $sluglist);
     if ($taglist === 'uncategorized' || empty($taglist)) {
         return;
     }
     $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
     $view = C_Component_Registry::get_instance()->get_utility('I_Component_Factory')->create('mvc_view', '');
     $retval = $renderer->display_images(array('source' => 'tags', 'container_ids' => $taglist, 'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS, 'images_per_page' => $maxImages, 'maximum_entity_count' => $maxImages, 'template' => $view->get_template_abspath('photocrati-nextgen_gallery_display#related'), 'show_all_in_lightbox' => FALSE, 'show_slideshow_link' => FALSE, 'disable_pagination' => TRUE));
     return apply_filters('ngg_show_related_gallery_content', $retval, $taglist);
 }
 function _nextgen_basic_album_rewrite_rules($displayed_gallery)
 {
     // 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;
     // Get router
     $router = $this->get_registry()->get_utility('I_Router');
     $app = $router->get_routed_app();
     $slug = C_NextGen_Settings::get_instance()->router_param_slug;
     // If we're viewing an album, rewrite the urls
     $regex = "/photocrati-nextgen_basic_\\w+_album/";
     if (preg_match($regex, $display_type)) {
         $app->rewrite("{$slug}/pid--{*}", "{$slug}/pid--{1}", FALSE, TRUE);
         // avoid conflicts with imagebrowser
         $app->rewrite("{$slug}/{\\w}", "{$slug}/album--{1}");
         $app->rewrite("{$slug}/{\\w}/{\\w}", "{$slug}/album--{1}/gallery--{2}");
         $app->rewrite("{$slug}/{\\w}/{\\w}/{\\w}{*}", "{$slug}/album--{1}/gallery--{2}/{3}{4}");
     } elseif (preg_match($regex, $original_display_type)) {
         $app->rewrite("{$slug}/album--{\\w}", "{$slug}/{1}");
         $app->rewrite("{$slug}/album--{\\w}/gallery--{\\w}", "{$slug}/{1}/{2}");
         $app->rewrite("{$slug}/album--{\\w}/gallery--{\\w}/{*}", "{$slug}/{1}/{2}/{3}");
     }
     // Perform rewrites
     $app->do_rewrites();
 }
 function set_defaults($entity)
 {
     $this->call_parent('set_defaults', $entity);
     if (in_array($entity->name, array(NGG_PRO_LIST_ALBUM, NGG_PRO_GRID_ALBUM))) {
         $settings = C_NextGen_Settings::get_instance();
         // Galleries within the album will be displayed as NextGEN Pro Thumbnails, or
         // if not available, then NextGEN Basic Thumbnails
         $gallery_display_type = defined('NGG_PRO_THUMBNAIL_GRID') ? NGG_PRO_THUMBNAIL_GRID : NGG_BASIC_THUMBNAILS;
         $this->_set_default_value($entity, 'settings', 'gallery_display_type', $gallery_display_type);
         // Basic style settings
         $this->_set_default_value($entity, 'settings', 'enable_breadcrumbs', 1);
         $this->_set_default_value($entity, 'settings', 'caption_color', '#333333');
         $this->_set_default_value($entity, 'settings', 'border_color', '#CCCCCC');
         $this->_set_default_value($entity, 'settings', 'border_size', 1);
         $this->_set_default_value($entity, 'settings', 'background_color', '#FFFFFF');
         $this->_set_default_value($entity, 'settings', 'padding', 20);
         $this->_set_default_value($entity, 'settings', 'spacing', 10);
         // Thumbnail dimensions
         $this->_set_default_value($entity, 'settings', 'override_thumbnail_settings', 0);
         $this->_set_default_value($entity, 'settings', 'thumbnail_width', $settings->thumbwidth);
         $this->_set_default_value($entity, 'settings', 'thumbnail_height', $settings->thumbheight);
         $this->_set_default_value($entity, 'settings', 'thumbnail_quality', $settings->thumbquality);
         $this->_set_default_value($entity, 'settings', 'thumbnail_crop', $settings->thumbfix);
         $this->_set_default_value($entity, 'settings', 'thumbnail_watermark', 0);
     }
     // Grid albums do not share a caption_size
     if ($entity->name == NGG_PRO_GRID_ALBUM) {
         $this->_set_default_value($entity, 'settings', 'caption_size', 13);
     }
     if ($entity->name == NGG_PRO_LIST_ALBUM) {
         $this->_set_default_value($entity, 'settings', 'description_color', '#33333');
         $this->_set_default_value($entity, 'settings', 'description_size', 13);
         $this->_set_default_value($entity, 'settings', 'caption_size', 18);
     }
 }
Example #18
0
 /**
  * Registers our static settings resources so the ATP module can find them later
  */
 function _register_resources()
 {
     $router = $this->get_registry()->get_utility('I_Router');
     $settings = C_NextGen_Settings::get_instance();
     $thumbEffectContext = isset($settings->thumbEffectContext) ? $settings->thumbEffectContext : '';
     wp_register_script('nextgen_lightbox_context', $router->get_static_url('photocrati-lightbox#lightbox_context.js'));
     wp_enqueue_script('nextgen_lightbox_context');
     if ($thumbEffectContext != null && $thumbEffectContext != 'nextgen_images') {
         $mapper = $this->object->get_registry()->get_utility('I_Lightbox_Library_Mapper');
         $library = $mapper->find_by_name($settings->thumbEffect);
         // Make the path to the static resources available for libraries
         // Shutter-Reloaded in particular depends on this
         $this->_add_script_data('ngg_common', 'nextgen_lightbox_settings', array('static_path' => $this->get_registry()->get_utility('I_Fs')->find_static_abspath('', 'photocrati-lightbox'), 'context' => $thumbEffectContext), TRUE, true);
         global $wp_scripts;
         $i = 0;
         foreach (explode("\n", $library->scripts) as $script) {
             wp_register_script($library->name . '-' . $i, $script, array('ngg_common'));
             $this->_registered_lightboxes[] = $library->name . '-' . $i;
             if ($i == 0 and isset($library->values)) {
                 foreach ($library->values as $name => $value) {
                     $this->_add_script_data($library->name . '-0', $name, $value, FALSE);
                 }
             }
             $i += 1;
         }
         $i = 0;
         foreach (explode("\n", $library->css_stylesheets) as $style) {
             wp_enqueue_style($library->name . '-' . $i, $style);
             $i += 1;
         }
     }
 }
 function install()
 {
     // In version 0.2 of this module and earlier, the following values
     // were statically set rather than dynamically using a handler. Therefore, we need
     // to delete those static values
     $module_name = 'photocrati-nextgen_admin';
     $modules = get_option('pope_module_list', array());
     if (!$modules) {
         $settings = C_NextGen_Settings::get_instance();
         $modules = $settings->get('pope_module_list', array());
     }
     $cleanup = FALSE;
     foreach ($modules as $module) {
         if (strpos($module, $module_name) !== FALSE) {
             if (version_compare(array_pop(explode('|', $module)), '0.3') == -1) {
                 $cleanup = TRUE;
             }
             break;
         }
     }
     if ($cleanup) {
         $keys = array('jquery_ui_theme', 'jquery_ui_theme_version', 'jquery_ui_theme_url');
         foreach ($keys as $key) {
             $settings->delete($key);
         }
     }
 }
 /**
  * Gets the new watermark preview url based on the new settings
  * @return array
  */
 function get_watermark_preview_url_action()
 {
     $security = $this->get_registry()->get_utility('I_Security_Manager');
     $sec_actor = $security->get_current_actor();
     if ($sec_actor->is_allowed('nextgen_edit_settings')) {
         $settings = C_NextGen_Settings::get_instance();
         $imagegen = $this->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
         $mapper = $this->get_registry()->get_utility('I_Image_Mapper');
         $image = $mapper->find_first();
         $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
         $sizeinfo = array('quality' => 100, 'height' => 250, 'crop' => FALSE, 'watermark' => TRUE);
         $size = $imagegen->get_size_name($sizeinfo);
         $thumbnail_url = $storage->get_image_url($image, $size);
         // Temporarily update the watermark options. Generate a new image based
         // on these settings
         if ($watermark_options = $this->param('watermark_options')) {
             $watermark_options['wmFont'] = trim($watermark_options['wmFont']);
             $settings->set($watermark_options);
             $storage->generate_image_size($image, $size);
             $thumbnail_url = $storage->get_image_url($image, $size);
             $settings->load();
         }
         return array('thumbnail_url' => $thumbnail_url);
     }
     return null;
 }
 function install()
 {
     $settings = C_NextGen_Settings::get_instance();
     $settings->set_default_value('ecommerce_stripe_enable', '0');
     $settings->set_default_value('ecommerce_stripe_key_public', '');
     $settings->set_default_value('ecommerce_stripe_key_private', '');
 }
 function __construct()
 {
     $this->blog_settings = C_NextGen_Settings::get_instance();
     $this->site_settings = C_NextGen_Global_Settings::get_instance();
     $this->_global_settings = array('gallerypath' => 'wp-content/blogs.dir/%BLOG_ID%/files/', 'wpmuCSSfile' => 'nggallery.css', 'wpmuStyle' => FALSE, 'wpmuRoles' => FALSE, 'wpmuImportFolder' => FALSE, 'wpmuZipUpload' => FALSE, 'datamapper_driver' => 'custom_table_datamapper', 'gallerystorage_driver' => 'ngglegacy_gallery_storage', 'maximum_entity_count' => 500, 'router_param_slug' => 'nggallery');
     $this->_local_settings = array('gallerypath' => 'wp-content/gallery/', 'deleteImg' => True, 'swfUpload' => True, 'usePermalinks' => False, 'permalinkSlug' => 'nggallery', 'graphicLibrary' => 'gd', 'imageMagickDir' => '/usr/local/bin/', 'useMediaRSS' => False, 'usePicLens' => False, 'activateTags' => 0, 'appendType' => 'tags', 'maxImages' => 7, 'relatedHeading' => __('<h3>Related Images:</h3>', 'nggallery'), 'thumbwidth' => 120, 'thumbheight' => 90, 'thumbfix' => True, 'thumbquality' => 100, 'imgWidth' => 800, 'imgHeight' => 600, 'imgQuality' => 100, 'imgBackup' => True, 'imgAutoResize' => False, 'galImages' => '20', 'galPagedGalleries' => 0, 'galColumns' => 0, 'galShowSlide' => True, 'galTextSlide' => __('[Show as slideshow]', 'nggallery'), 'galTextGallery' => __('[Show picture list]', 'nggallery'), 'galShowOrder' => 'gallery', 'galSort' => 'sortorder', 'galSortDir' => 'ASC', 'galNoPages' => True, 'galImgBrowser' => 0, 'galHiddenImg' => 0, 'galAjaxNav' => 0, 'thumbEffect' => 'fancybox', 'thumbCode' => 'class="ngg-fancybox" rel="%GALLERY_NAME%"', 'wmPos' => 'botRight', 'wmXpos' => 5, 'wmYpos' => 5, 'wmType' => 0, 'wmPath' => '', 'wmFont' => 'arial.ttf', 'wmSize' => 10, 'wmText' => get_option('blogname'), 'wmColor' => '000000', 'wmOpaque' => '100', 'enableIR' => 0, 'slideFx' => 'fade', 'irURL' => '', 'irXHTMLvalid' => 0, 'irAudio' => '', 'irWidth' => 600, 'irHeight' => 400, 'irShuffle' => True, 'irLinkfromdisplay' => True, 'irShownavigation' => 0, 'irShowicons' => 0, 'irWatermark' => 0, 'irOverstretch' => 'True', 'irRotatetime' => 10, 'irTransition' => 'random', 'irKenburns' => 0, 'irBackcolor' => '000000', 'irFrontcolor' => 'FFFFFF', 'irLightcolor' => 'CC0000', 'irScreencolor' => '000000', 'activateCSS' => 1, 'CSSfile' => 'nggallery.css');
 }
 function set_thumbnail_defaults($entity)
 {
     $settings = C_NextGen_Settings::get_instance();
     $this->object->_set_default_value($entity, 'settings', 'images_per_page', $settings->galImages);
     $this->object->_set_default_value($entity, 'settings', 'number_of_columns', $settings->galColumns);
     $this->object->_set_default_value($entity, 'settings', 'thumbnail_width', $settings->thumbwidth);
     $this->object->_set_default_value($entity, 'settings', 'thumbnail_height', $settings->thumbheight);
     $this->object->_set_default_value($entity, 'settings', 'show_all_in_lightbox', $settings->galHiddenImg);
     $this->object->_set_default_value($entity, 'settings', 'ajax_pagination', $settings->galAjaxNav);
     $this->object->_set_default_value($entity, 'settings', 'use_imagebrowser_effect', $settings->galImgBrowser);
     $this->object->_set_default_value($entity, 'settings', 'template', '');
     $this->object->_set_default_value($entity, 'settings', 'display_no_images_error', 1);
     // TODO: Should this be called enable pagination?
     $this->object->_set_default_value($entity, 'settings', 'disable_pagination', 0);
     // Alternative view support
     $this->object->_set_default_value($entity, 'settings', 'show_slideshow_link', $settings->galShowSlide ? 1 : 0);
     $this->object->_Set_default_value($entity, 'settings', 'slideshow_link_text', $settings->galTextSlide);
     // override thumbnail settings
     $this->object->_set_default_value($entity, 'settings', 'override_thumbnail_settings', 0);
     $this->object->_set_default_value($entity, 'settings', 'thumbnail_quality', '100');
     $this->object->_set_default_value($entity, 'settings', 'thumbnail_crop', 1);
     $this->object->_set_default_value($entity, 'settings', 'thumbnail_watermark', 0);
     // Show piclens link ?
     $this->object->_set_default_value($entity, 'settings', 'piclens_link_text', __('[Show PicLens]', 'nggallery'));
     $this->object->_set_default_value($entity, 'settings', 'show_piclens_link', isset($entity->settings['show_piclens_link']) && preg_match("/^true|yes|y\$/", $entity->settings['show_piclens_link']) ? 1 : 0);
     // Part of the pro-modules
     $this->object->_set_default_value($entity, 'settings', 'ngg_triggers_display', 'never');
 }
 /**
  * Sets defaults needed for the entity
  * @param type $entity
  */
 function set_defaults($entity)
 {
     // Ensure that we have a settings array
     if (!isset($entity->display_settings)) {
         $entity->display_settings = array();
     }
     // If the display type is set, then get it's settings and apply them as
     // defaults to the "display_settings" of the displayed gallery
     if (isset($entity->display_type)) {
         // Get display type mapper
         if ($display_type = $this->object->get_display_type($entity)) {
             $entity->display_settings = $this->array_merge_assoc($display_type->settings, $entity->display_settings, TRUE);
         }
     }
     // Default ordering
     $settings = C_NextGen_Settings::get_instance();
     $this->object->_set_default_value($entity, 'order_by', $settings->galSort);
     $this->object->_set_default_value($entity, 'order_direction', $settings->galSortDir);
     // Ensure we have an exclusions array
     $this->object->_set_default_value($entity, 'exclusions', array());
     // Ensure other properties exist
     $this->object->_set_default_value($entity, 'container_ids', array());
     $this->object->_seT_default_value($entity, 'sortorder', array());
     $this->object->_set_default_value($entity, 'entity_ids', array());
     $this->object->_set_default_value($entity, 'returns', 'included');
     // Set maximum_entity_count
     $this->object->_set_default_value($entity, 'maximum_entity_count', $settings->maximum_entity_count);
 }
 function _nextgen_basic_album_rewrite_rules($displayed_gallery)
 {
     // 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;
     // Get router
     $router = $this->get_registry()->get_utility('I_Router');
     $app = $router->get_routed_app();
     $slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug;
     // If we're viewing an album, rewrite the urls
     $regex = "/photocrati-nextgen_basic_\\w+_album/";
     if (preg_match($regex, $display_type)) {
         $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);
         // TODO: We're commenting this out as it was causing a problem with sub-album requests not
         // working when placed beside paginated galleries. But we still need to figure out why, and fix that
         // $app->rewrite("{*}{$slug}/{\\w}", "{1}{$slug}/album--{2}", FALSE, TRUE);
     } elseif (preg_match($regex, $original_display_type)) {
         $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
     $app->do_rewrites();
 }
 function install()
 {
     $settings = C_NextGen_Settings::get_instance();
     $settings->set_default_value('ecommerce_paypal_std_enable', 0);
     $settings->set_default_value('ecommerce_paypal_std_sandbox', 1);
     $settings->set_default_value('ecommerce_paypal_std_email', '');
 }
 /**
  * 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;
 }
Example #28
0
 function install()
 {
     $settings = C_NextGen_Settings::get_instance();
     $settings->set_default_value('router_param_separator', '--');
     $settings->set_default_value('router_param_prefix', '');
     $settings->set_default_value('router_param_slug', 'nggallery');
 }
Example #29
0
 /**
  * Loads a single script to provide the photocrati_ajax settings to the web browser
  */
 static function register_scripts()
 {
     $settings = C_NextGen_Settings::get_instance();
     $router = C_Router::get_instance();
     wp_register_script('photocrati_ajax', $router->get_static_url('photocrati-ajax#ajax.min.js'), array('jquery'));
     $vars = array('url' => $settings->get('ajax_url'), 'wp_home_url' => $router->get_base_url('home'), 'wp_site_url' => $router->get_base_url('site'), 'wp_root_url' => $router->get_base_url('root'), 'wp_plugins_url' => $router->get_base_url('plugins'), 'wp_content_url' => $router->get_base_url('content'), 'wp_includes_url' => includes_url(), 'ngg_param_slug' => C_NextGen_Settings::get_instance()->get('router_param_slug', 'nggallery'));
     wp_localize_script('photocrati_ajax', 'photocrati_ajax', $vars);
 }
 function define()
 {
     parent::define("photocrati-mvc", "MVC Framework", "Provides an MVC architecture for the plugin to use", "0.8", "https://www.imagely.com", "Photocrati Media", "https://www.imagely.com");
     C_NextGen_Settings::get_instance()->add_option_handler('C_Mvc_Option_Handler', array('mvc_template_dir', 'mvc_template_dirname', 'mvc_static_dir', 'mvc_static_dirname'));
     if (is_multisite()) {
         C_NextGen_Global_Settings::get_instance()->add_option_handler('C_Mvc_Option_Handler', array('mvc_template_dir', 'mvc_template_dirname', 'mvc_static_dir', 'mvc_static_dirname'));
     }
 }