Skip to content

Commit

Permalink
Updated nextgen plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ivarpruijn committed Aug 27, 2013
1 parent f180280 commit 1e26699
Show file tree
Hide file tree
Showing 31 changed files with 350 additions and 93 deletions.
12 changes: 12 additions & 0 deletions wp-content/plugins/nextgen-gallery/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
NextGEN Gallery
by Photocrati Media

= V2.0.14 - 08.27.2013 =
* NEW: Added the ability to override thumbnail settings for NextGEN Basic Albums
* NEW: Shortcode Manager API, which ensures that shortcodes are outputted as intended
* Changed: Re-added the ability to select the original image size for widgets
* Fixed: Ensure that stylesheet url returned is correct for Windows hosts
* Fixed: Broken links and lightbox effects with AJAX pagination
* Fixed: Try to ensure that third party plugins don't add content to our dynamic JS
* Fixed: Improved reliability of iframely.js
* Fixed: Ensure that urls are generated correctly in HTTPs environments
* Fixed: Datamapper works correctly in environments where temporary tables aren't supported
* Fixed: Fixed an issue with thickbox loading animation when home url differs from site url

= V2.0.11 - 08.19.2013 =
* NEW: Added "run_ngg_resource_manager" hook to by-pass our resource manager
* Changed: Removed "Reset & Uninstall" tab, for now
Expand Down
7 changes: 5 additions & 2 deletions wp-content/plugins/nextgen-gallery/nggallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* Plugin Name: NextGEN Gallery by Photocrati
* Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 7 million downloads.
* Version: 2.0.11
* Version: 2.0.14
* Author: Photocrati Media
* Plugin URI: http://www.nextgen-gallery.com
* Author URI: http://www.photocrati.com
Expand Down Expand Up @@ -109,6 +109,9 @@ function _load_non_pope()

// Load the style manager
include_once('non_pope/class.nextgen_style_manager.php');

// Load the shortcode manager
include_once('non_pope/class.nextgen_shortcode_manager.php');
}

/**
Expand Down Expand Up @@ -312,7 +315,7 @@ function _define_constants()
define('NEXTGEN_GALLERY_MODULE_URL', path_join(NEXTGEN_GALLERY_PRODUCT_URL, 'photocrati_nextgen/modules'));
define('NEXTGEN_GALLERY_PLUGIN_CLASS', path_join(NEXTGEN_GALLERY_PLUGIN_DIR, 'module.NEXTGEN_GALLERY_PLUGIN.php'));
define('NEXTGEN_GALLERY_PLUGIN_STARTED_AT', microtime());
define('NEXTGEN_GALLERY_PLUGIN_VERSION', '2.0.11');
define('NEXTGEN_GALLERY_PLUGIN_VERSION', '2.0.14');
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?php

class C_NextGen_Shortcode_Manager
{
private static $_instance = NULL;
private $_shortcodes = array();

/**
* Gets an instance of the class
* @return C_NextGen_Shortcode_Manager
*/
static function get_instance()
{
if (is_null(self::$_instance)) {
$klass = get_class();
self::$_instance = new $klass;
}
return self::$_instance;
}

/**
* Adds a shortcode
* @param $name
* @param $callback
*/
static function add($name, $callback)
{
$manager = self::get_instance();
$manager->add_shortcode($name, $callback);
}

/**
* Removes a previously added shortcode
* @param $name
*/
static function remove($name)
{
$manager = self::get_instance();
$manager->remove_shortcode($name);
}

/**
* Constructor
*/
private function __construct()
{
add_filter('the_content', array(&$this, 'deactivate_all'), 1);
add_filter('the_content', array(&$this, 'parse_content'), PHP_INT_MAX-1);
}

/**
* Deactivates all shortcodes
*/
function deactivate_all($content)
{
foreach (array_keys($this->_shortcodes) as $shortcode) {
$this->deactivate($shortcode);
}

return $content;
}

/**
* Activates all registered shortcodes
*/
function activate_all()
{
foreach (array_keys($this->_shortcodes) as $shortcode) {
$this->activate($shortcode);
}
}

/**
* Parses the content for shortcodes and returns the substituted content
* @param $content
* @return string
*/
function parse_content($content)
{
$this->activate_all();
return do_shortcode($content);
}

/**
* Adds a shortcode
* @param $name
* @param $callback
*/
function add_shortcode($name, $callback)
{
$this->_shortcodes[$name] = $callback;
$this->activate($name);
}

/**
* Activates a particular shortcode
* @param $shortcode
*/
function activate($shortcode)
{
if (isset($this->_shortcodes[$shortcode])) {
add_shortcode($shortcode, $this->_shortcodes[$shortcode]);
}
}

/**
* Removes a shortcode
* @param $name
*/
function remove_shortcode($name)
{
unset($this->_shortcodes[$name]);
$this->deactivate($name);
}

/**
* De-activates a shortcode
* @param $shortcode
*/
function deactivate($shortcode)
{
if (isset($this->_shortcodes[$shortcode]))
remove_shortcode($shortcode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ function get_selected_stylesheet_url($selected=FALSE)
{
if (!$selected) $selected = $this->get_selected_stylesheet();

return str_replace(
$retval = str_replace(
trailingslashit(ABSPATH),
trailingslashit(site_url()),
$this->find_selected_stylesheet_abspath($selected)
);

return str_replace('\\', '/', $retval);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function is_valid_request($retval)
*/
function start_buffer()
{
ob_start(array(&$this, 'output_buffer'));
ob_start(array(&$this, 'output_buffer_handler'));
ob_start(array(&$this, 'get_buffer'));
}

Expand All @@ -74,6 +74,12 @@ function get_resources()

$this->wrote_footer = TRUE;
}


function output_buffer_handler($content)
{
return $this->output_buffer();
}

/**
* Removes the closing </html> tag from the output buffer. We'll then write our own closing tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ function display_tab_js_action($return=FALSE)

// Ensure that JS is returned
$this->object->set_content_type('javascript');

while (ob_get_level() > 0) {
ob_end_clean();
}

// Get all entities used by the display tab
$context = 'attach_to_post';
Expand All @@ -41,7 +45,7 @@ function display_tab_js_action($return=FALSE)

usort($display_types, array($this->object, '_display_type_list_sort'));

return $this->object->render_view('photocrati-attach_to_post#display_tab_js', array(
$output = $this->object->render_view('photocrati-attach_to_post#display_tab_js', array(
'displayed_gallery' => json_encode($this->object->_displayed_gallery->get_entity()),
'sources' => json_encode($source_mapper->select()->order_by('title')->run_query()),
'gallery_primary_key' => $gallery_mapper->get_primary_key_column(),
Expand All @@ -51,6 +55,8 @@ function display_tab_js_action($return=FALSE)
'display_types' => json_encode($display_types),
'sec_token' => $security->get_request_token('nextgen_edit_displayed_gallery')->get_json()
), $return);

return $output;
}

function _display_type_list_sort($type_1, $type_2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,25 @@ if (window.frameElement) {
$('form').each(function(){
$(this).append("<input type='hidden' name='attach_to_post' value='1'/>");
});

// Adjust the height of the frame
parent.adjust_height_for_frame(window.frameElement, function(){
$('#iframely').css({
position: 'static',
visibility: 'visible'
}).animate({
opacity: 1.0

var parent = window.parent;

if (parent == null || typeof(parent.adjust_height_for_frame) == "undefined") {
if (window != null && typeof(window.adjust_height_for_frame) != "undefined") {
parent = window;
}
}

if (typeof(parent.adjust_height_for_frame) != "undefined") {
// Adjust the height of the frame
parent.adjust_height_for_frame(window.frameElement, function(){
$('#iframely').css({
position: 'static',
visibility: 'visible'
}).animate({
opacity: 1.0
});
});
});
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ function set_custom_wp_query_groupby($groupby, &$wp_query)
}
$retval = "GROUP BY ".implode(', ', $group_by_columns);
}
// Not all mysql servers allow access to create temporary tables which are used when doing GROUP BY
// statements; this can potentially ruin basic queries. If no group_by_columns is set AND the query originates
// within the datamapper we strip the "GROUP BY" clause entirely in this filter.
else if ($wp_query->get('datamapper')) {
$retval = '';
}
return $retval;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
jQuery(function($) {
$(".ngg-fancybox").fancybox({
titlePosition: 'inside',
// Needed for twenty eleven
onComplete: function(){
$('#fancybox-wrap').css('z-index', 10000);
}
});
var nextgen_fancybox_init = function() {
$(".ngg-fancybox").fancybox({
titlePosition: 'inside',
// Needed for twenty eleven
onComplete: function() {
$('#fancybox-wrap').css('z-index', 10000);
}
});
};
$(this).bind('refreshed', nextgen_fancybox_init);
nextgen_fancybox_init();
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ jQuery(function($) {
});
});

$('.ngg_lightbox').lightBox({
imageLoading: nextgen_lightbox_loading_img_url,
imageBtnClose: nextgen_lightbox_close_btn_url,
imageBtnPrev: nextgen_lightbox_btn_prev_url,
imageBtnNext: nextgen_lightbox_btn_next_url,
imageBlank: nextgen_lightbox_blank_img_url
});
var nextgen_jquery_lightbox_init = function() {
$('.ngg_lightbox').lightBox({
imageLoading: nextgen_lightbox_loading_img_url,
imageBtnClose: nextgen_lightbox_close_btn_url,
imageBtnPrev: nextgen_lightbox_btn_prev_url,
imageBtnNext: nextgen_lightbox_btn_next_url,
imageBlank: nextgen_lightbox_blank_img_url
});
};
$(this).bind('refreshed', nextgen_jquery_lightbox_init);
nextgen_jquery_lightbox_init();

});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var thickboxL10n = {
loadingAnimation: photocrati_ajax.wp_site_url + '/wp-includes/js/thickbox/loadingAnimation.gif',
closeImage: photocrati_ajax.wp_site_url + '/wp-includes/js/thickbox/tb-close.png',
loadingAnimation: photocrati_ajax.wp_site_static_url + '/wp-includes/js/thickbox/loadingAnimation.gif',
closeImage: photocrati_ajax.wp_site_static_url + '/wp-includes/js/thickbox/tb-close.png',
next: 'Next &gt;',
prev: '&lt; Prev',
image: 'Image',
Expand Down
Loading

0 comments on commit 1e26699

Please sign in to comment.