Version Description
- moved back to regexp replacement and implemented a workaround in the JavaScript to still allow images to be excluded by adding the class "colorbox-off"
Download this release
Release Info
| Developer | techotronic |
| Plugin | |
| Version | 1.3.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3.1 to 1.3.2
- jquery-colorbox.php +6 -20
- readme.txt +4 -1
jquery-colorbox.php
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
* Plugin Name: jQuery Colorbox
|
| 7 |
* Plugin URI: http://www.techotronic.de/index.php/plugins/jquery-colorbox/
|
| 8 |
* Description: Used to overlay images on the current page. Images in one post are grouped automatically.
|
| 9 |
-
* Version: 1.3.
|
| 10 |
* Author: Arne Franken
|
| 11 |
* Author URI: http://www.techotronic.de/
|
| 12 |
* License: GPL
|
|
@@ -138,7 +138,7 @@ class jQueryColorbox {
|
|
| 138 |
if($nestedElement.is("img")){
|
| 139 |
var $groupId = $nestedElement.attr("class").match('colorbox-[0-9]+');
|
| 140 |
//only call colorbox if there is a groupId for the image.
|
| 141 |
-
if($groupId){
|
| 142 |
//and calls colorbox function on each img.
|
| 143 |
//elements with the same groupId in the class attribute are grouped
|
| 144 |
//the title of the img is used as the title for the colorbox.
|
|
@@ -306,7 +306,7 @@ add_action( 'init', 'jQueryColorbox', 7 );
|
|
| 306 |
* function is called for every page or post rendering.
|
| 307 |
*
|
| 308 |
* unfortunately, Wordpress does not offer a convenient way to get certain elements from the_content,
|
| 309 |
-
* so I had to do
|
| 310 |
*
|
| 311 |
* @param the_content or the_excerpt
|
| 312 |
* @return replaced content or excerpt
|
|
@@ -314,23 +314,9 @@ add_action( 'init', 'jQueryColorbox', 7 );
|
|
| 314 |
//TODO: get rid of this...
|
| 315 |
function addColorboxGroupIdToImages ($content) {
|
| 316 |
global $post;
|
| 317 |
-
$
|
| 318 |
-
|
| 319 |
-
$
|
| 320 |
-
$domDocumentTheContent->loadHTML($content);
|
| 321 |
-
//get all img tags
|
| 322 |
-
$domNodeListImg = $domDocumentTheContent->getElementsByTagName("img");
|
| 323 |
-
foreach ($domNodeListImg as $domNode){
|
| 324 |
-
$classAttributeValue = $domNode->getAttribute("class");
|
| 325 |
-
// add colorbox CSS class for every img that does not have the "colorbox-off" class
|
| 326 |
-
if(!preg_match("/colorbox-off/",$classAttributeValue)){
|
| 327 |
-
$domNode->setAttribute('class', $classAttributeValue . ' colorbox-'.$post->ID);
|
| 328 |
-
$changedTheContent = true;
|
| 329 |
-
}
|
| 330 |
-
}
|
| 331 |
-
if($changedTheContent){
|
| 332 |
-
$content = $domDocumentTheContent->saveHTML();
|
| 333 |
-
}
|
| 334 |
return $content;
|
| 335 |
}
|
| 336 |
|
| 6 |
* Plugin Name: jQuery Colorbox
|
| 7 |
* Plugin URI: http://www.techotronic.de/index.php/plugins/jquery-colorbox/
|
| 8 |
* Description: Used to overlay images on the current page. Images in one post are grouped automatically.
|
| 9 |
+
* Version: 1.3.2
|
| 10 |
* Author: Arne Franken
|
| 11 |
* Author URI: http://www.techotronic.de/
|
| 12 |
* License: GPL
|
| 138 |
if($nestedElement.is("img")){
|
| 139 |
var $groupId = $nestedElement.attr("class").match('colorbox-[0-9]+');
|
| 140 |
//only call colorbox if there is a groupId for the image.
|
| 141 |
+
if($groupId && !$nestedElement.attr("class").match('colorbox-off')){
|
| 142 |
//and calls colorbox function on each img.
|
| 143 |
//elements with the same groupId in the class attribute are grouped
|
| 144 |
//the title of the img is used as the title for the colorbox.
|
| 306 |
* function is called for every page or post rendering.
|
| 307 |
*
|
| 308 |
* unfortunately, Wordpress does not offer a convenient way to get certain elements from the_content,
|
| 309 |
+
* so I had to do this by regexp replacement...
|
| 310 |
*
|
| 311 |
* @param the_content or the_excerpt
|
| 312 |
* @return replaced content or excerpt
|
| 314 |
//TODO: get rid of this...
|
| 315 |
function addColorboxGroupIdToImages ($content) {
|
| 316 |
global $post;
|
| 317 |
+
$pattern = "/<img(.*?)class=('|\")([A-Za-z0-9 \/_\.\~\:-]*?)('|\")([^\>]*?)>/i";
|
| 318 |
+
$replacement = '<img$1class=$2$3 colorbox-'.$post->ID.'$4$5>';
|
| 319 |
+
$content = preg_replace($pattern, $replacement, $content);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
return $content;
|
| 321 |
}
|
| 322 |
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: http://www.techotronic.de/index.php/donate/
|
|
| 4 |
Tags: jquery, colorbox, lightbox, images, gallery, javascript, overlay
|
| 5 |
Requires at least: 2.8.5
|
| 6 |
Tested up to: 2.9.1
|
| 7 |
-
Stable tag: 1.3.
|
| 8 |
|
| 9 |
Automatically adds Colorbox/Lightbox functionality to all images on the blog. Images are grouped by post.
|
| 10 |
|
|
@@ -66,6 +66,9 @@ For all images in a post or page, the same CSS class is added. All images with t
|
|
| 66 |
|
| 67 |
== Changelog ==
|
| 68 |
|
|
|
|
|
|
|
|
|
|
| 69 |
= 1.3.1 =
|
| 70 |
* changed include calls for Colorbox JavaScript and CSS to version 1.3.6
|
| 71 |
* optimized modification of the_content
|
| 4 |
Tags: jquery, colorbox, lightbox, images, gallery, javascript, overlay
|
| 5 |
Requires at least: 2.8.5
|
| 6 |
Tested up to: 2.9.1
|
| 7 |
+
Stable tag: 1.3.2
|
| 8 |
|
| 9 |
Automatically adds Colorbox/Lightbox functionality to all images on the blog. Images are grouped by post.
|
| 10 |
|
| 66 |
|
| 67 |
== Changelog ==
|
| 68 |
|
| 69 |
+
= 1.3.2 =
|
| 70 |
+
* moved back to regexp replacement and implemented a workaround in the JavaScript to still allow images to be excluded by adding the class "colorbox-off"
|
| 71 |
+
|
| 72 |
= 1.3.1 =
|
| 73 |
* changed include calls for Colorbox JavaScript and CSS to version 1.3.6
|
| 74 |
* optimized modification of the_content
|
