diff -u -r1.16.2.8 -r1.16.2.11 --- lightbox2.module 4 Jul 2007 12:29:43 -0000 1.16.2.8 +++ lightbox2.module 14 Aug 2007 15:36:49 -0000 1.16.2.11 @@ -42,9 +42,9 @@

<a href="image-1.jpg" rel="lightbox" title=&quo t;my caption">image #1</a>

Optional: Use the title attribute if you want to show a caption.

If you have a set of related images that you would like to group, follow - step one but additionally include a group name between s quare brackets in the - rel attribute. For example:

<a href="images/ima ge-1.jpg" - rel="lightbox[roadtrip]">image #1</a>
+ step one but additionally include a group name between square brackets in th e + rel attribute. For example:

<a href="images/image-1.jpg" + rel="lightbox[roadtrip]">image #1</a>
<a href="images/image-2.jpg" rel="lightbox[roadtrip]">image @@ -115,13 +115,15 @@ function lightbox2_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { global $_LIGHTBOX2_INCLUDE; - if ($op == "view" && !$_LIGHTBOX2_INCLUDE) { - lightbox2_add_files(); - $_LIGHTBOX2_INCLUDE = true; - } - elseif ($node->type == "image" && !$_LIGHTBOX2_INCLUDE) { - lightbox2_add_files(); - $_LIGHTBOX2_INCLUDE = true; + if (lightbox2_exclude_these_paths() != 1) { + if ($op == "view" && !$_LIGHTBOX2_INCLUDE) { + lightbox2_add_files(); + $_LIGHTBOX2_INCLUDE = true; + } + elseif ($node->type == "image" && !$_LIGHTBOX2_INCLUDE) { + lightbox2_add_files(); + $_LIGHTBOX2_INCLUDE = true; + } } @@ -187,6 +189,14 @@ "#default_value" => variable_get("lightbox2G2_filter", true), ); + // Add Textarea for urls without lightbox + $form["image_node_options"]["lightbox2_disable_these_urls"] = array( + "#type" => "textarea", + "#title" => t("Disable LightBox for these urls"), + "#description" => t("List the urls where the lightbox should be disabled, e .g. \"node/add/page\". Put each url on a separate line."), + "#default_value" => variable_get("lightbox2_disable_these_urls", ''), + ); + return system_settings_form($form); } @@ -348,3 +358,24 @@ return $output; } + +function lightbox2_exclude_these_paths() { + + # use lightbox if this url is not excluded + $disabled_urls = variable_get("lightbox2_disable_these_urls", ""); + + if (!empty($disabled_urls)) { + $urls = explode("\n", variable_get("lightbox2_disable_these_urls", "")); + + foreach ($urls as $url) { + $url = rtrim ($url); + $url = preg_replace("/%/", '.*?', preg_quote($url, '/')); + $pattern = "/^". $url ."$/"; + if (preg_match($pattern, $_REQUEST['q'])) { + return 1; + } + } + } + + return 0; +}