Plugin Directory

Changeset 1142569


Ignore:
Timestamp:
04/22/2015 08:46:23 PM (11 years ago)
Author:
fourlightsweb
Message:

Added U ungreedy flag to regexes, tested in 4.2 and added a new FAQ

Location:
wp-gallery-custom-links/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-gallery-custom-links/trunk/readme.txt

    r974761 r1142569  
    44Tags: gallery links, gallery link, gallery
    55Requires at least: 3.3.1
    6 Tested up to: 4.0
    7 Stable tag: 1.10.1
     6Tested up to: 4.2
     7Stable tag: 1.10.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    134134images, it may affect the styling, depending on whether your stylesheet is expecting all gallery images
    135135 to have `<a>` tags around them, in which case you would need to modify your stylesheet to also apply
    136 the same styles to `<img>` tags without a link around them.
     136the same styles to `<img>` tags without a link around them.
     137
     138= #8) I have a lightbox/carousel set up when a user clicks an image, and I would like to make the image in the lightbox/carousel window link to the custom link.  How can I accomplish this? =
     139
     140Unfortunately those images are placed in those locations via your particular lightbox/carousel javascript library,
     141which this plugin isn't able to hook into to modify.  You would need to modify your javascript library or theme to
     142accomplish this, which is outside the scope of this plugin.
    137143
    138144== Screenshots ==
     
    141147
    142148== Changelog ==
     149
     150= 1.10.2 =
     151* Added a translation for Portuguese, courtesy of Carlos Jordão (thanks!)
     152* Added the U ungreedy modifier to regular expressions to attempt to resolve occasional not-easily-reproduced blank page issues
     153* Tested with WordPress 4.2
    143154
    144155= 1.10.1 =
     
    242253== Upgrade Notice ==
    243254
     255= 1.10.2 =
     256* Added a translation for Portuguese, courtesy of Carlos Jordão (thanks!)
     257* Added the U ungreedy modifier to regular expressions to attempt to resolve occasional not-easily-reproduced blank page issues
     258* Tested with WordPress 4.2
     259
    244260= 1.10.1 =
    245261* Changed javascript to queue in wp_enqueue_scripts hook instead of the all-encompassing init.
  • wp-gallery-custom-links/trunk/wp-gallery-custom-links.php

    r919514 r1142569  
    44Plugin URI: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/
    55Description: Specify custom links for WordPress gallery images (instead of attachment or file only).
    6 Version: 1.10.1
     6Version: 1.10.2
    77Author: Four Lights Web Development
    88Author URI: http://www.fourlightsweb.com
     
    302302                        $needle_parts = explode( '.wp.com', jetpack_photon_url( $needle ) );
    303303                        if( count( $needle_parts ) == 2 ) {
    304                             $needle_part_1 = preg_replace( '/\d+$/', '', $needle_parts[0] );
     304                            $needle_part_1 = preg_replace( '/\d+$/U', '', $needle_parts[0] );
    305305                            $needle_part_2 = '.wp.com' . $needle_parts[1];
    306306                            $needle_reassembled = $needle_part_1 . $j . $needle_part_2;
     
    332332        $needle = preg_quote( $default_link );
    333333        $needle = str_replace( '/', '\/', $needle );
    334         $needle = '/href\s*=\s*["\']' . $needle . '["\']/';
     334        $needle = '/href\s*=\s*["\']' . $needle . '["\']/U';
    335335        if( preg_match( $needle, $output ) > 0 ) {
    336336            if( $additional_css_classes != '' ) {
     
    431431        if( preg_match( '/<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*class\s*=\s*["\'][^"\']*["\'][^>]*>/', $output ) > 0 ) {
    432432            // href comes before class
    433             $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*class\s*=\s*["\'][^"\']*)(["\'][^>]*>)/', '$1 '.$class.'$2', $output );
     433            $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*class\s*=\s*["\'][^"\']*)(["\'][^>]*>)/U', '$1 '.$class.'$2', $output );
    434434        } elseif( preg_match( '/<a[^>]*class\s*=\s*["\'][^"\']*["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>/', $output ) > 0 ) {
    435435            // href comes after class
    436             $output = preg_replace( '/(<a[^>]*class\s*=\s*["\'][^"\']*)(["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>)/', '$1 '.$class.'$2', $output );
     436            $output = preg_replace( '/(<a[^>]*class\s*=\s*["\'][^"\']*)(["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>)/U', '$1 '.$class.'$2', $output );
    437437        } else {
    438438            // No previous class
    439             $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*)(>)/', '$1 class="'.$class.'"$2', $output );
     439            $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*)(>)/U', '$1 class="'.$class.'"$2', $output );
    440440        } // End if we have a class on the a tag or not
    441441       
     
    451451        if( preg_match( '/<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*target\s*=\s*["\'][^"\']*["\'][^>]*>/', $output ) > 0 ) {
    452452            // href comes before target
    453             $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*target\s*=\s*["\'])[^"\']*(["\'][^>]*>)/', '$1'.$target.'$2', $output );
     453            $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*target\s*=\s*["\'])[^"\']*(["\'][^>]*>)/U', '$1'.$target.'$2', $output );
    454454        } elseif( preg_match( '/<a[^>]*target\s*=\s*["\'][^"\']*["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>/', $output ) > 0 ) {
    455455            // href comes after target
    456             $output = preg_replace( '/(<a[^>]*target\s*=\s*["\'])[^"\']*(["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>)/', '$1'.$target.'$2', $output );
     456            $output = preg_replace( '/(<a[^>]*target\s*=\s*["\'])[^"\']*(["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>)/U', '$1'.$target.'$2', $output );
    457457        } else {
    458458            // No previous target
    459             $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*)(>)/', '$1 target="'.$target.'"$2', $output );
     459            $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*)(>)/U', '$1 target="'.$target.'"$2', $output );
    460460        } // End if we have a class on the a tag or not
    461461       
Note: See TracChangeset for help on using the changeset viewer.