Plugin Directory

Changeset 1731367


Ignore:
Timestamp:
09/18/2017 02:42:37 AM (8 years ago)
Author:
mrdink
Message:

tagging 1.8.2

fixing an issue with the gallery

Location:
device-mockups
Files:
65 added
2 edited

Legend:

Unmodified
Added
Removed
  • device-mockups/trunk/device-mockups.php

    r1722736 r1731367  
    44 * Plugin URI: https://wordpress.org/plugins/device-mockups/
    55 * Description: Show your work in high resolution, responsive device mockups using only shortcodes.
    6  * Version: 1.8.1
     6 * Version: 1.8.2
    77 * Author: Justin Peacock
    88 * Author URI: https://byjust.in/
     
    2121
    2222// Useful global constants.
    23 define( 'DEVICE_MOCKUPS_VERSION', '1.8.1' );
     23define( 'DEVICE_MOCKUPS_VERSION', '1.8.2' );
    2424define( 'DEVICE_MOCKUPS_URL', plugin_dir_url( __FILE__ ) );
    2525define( 'DEVICE_MOCKUPS_PATH', dirname( __FILE__ ) . '/' );
     
    7070require_once DEVICE_MOCKUPS_INC . 'device.php';
    7171require_once DEVICE_MOCKUPS_INC . 'browser.php';
     72
     73/**
     74 * Disables wp texturize on registered shortcodes
     75 *
     76 * @param $shortcodes
     77 *
     78 * @return array
     79 */
     80function device_mockups_shortcode_exclude( $shortcodes ) {
     81    $shortcodes[] = 'device';
     82    $shortcodes[] = 'browser';
     83
     84    return $shortcodes;
     85}
     86
     87add_filter( 'no_texturize_shortcodes', 'device_mockups_shortcode_exclude' );
     88
     89/**
     90 * Filters shortcode to remove auto p and br tags
     91 *
     92 * @param $pee
     93 *
     94 * @return mixed
     95 */
     96function device_mockups_shortcode_unautop( $pee ) {
     97    global $shortcode_tags;
     98
     99    if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) {
     100        return $pee;
     101    }
     102
     103    $tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
     104
     105    $pattern =
     106        '/'
     107        . '<p>'
     108        . '\\s*+'
     109        . '('
     110        . '\\[\\/?'
     111        . "($tagregexp)"
     112        . '(?![\\w-])'
     113        . '[^\\]\\/]*'
     114        . '(?:'
     115        . '\\/(?!\\])'
     116        . '[^\\]\\/]*'
     117        . ')*?'
     118        . '[\\w\\s="\']*'
     119        . '(?:'
     120        . '\\s*+'
     121        . '\\/\\]'
     122        . '|'
     123        . '\\]'
     124        . '(?:'
     125        . '(?!<\/p>)'
     126        . '[^\\[]*+'
     127        . '(?:'
     128        . '\\[(?!\\/\\2\\])'
     129        . '[^\\[]*+'
     130        . ')*+'
     131        . '\\[\\/\\2\\]'
     132        . ')?'
     133        . ')'
     134        . ')'
     135        . '\\s*+'
     136        . '<\\/p>'
     137        . '/s';
     138
     139    return preg_replace( $pattern, '$1', $pee );
     140}
     141
     142foreach ( array( 'device', 'browser' ) as $filter ) {
     143    remove_filter( $filter, 'shortcode_unautop' );
     144    add_filter( $filter, 'device_mockups_shortcode_unautop' );
     145}
     146
     147remove_filter( 'the_content', 'shortcode_unautop' );
     148add_filter( 'the_content', 'device_mockups_shortcode_unautop' );
     149remove_filter( 'the_excerpt', 'shortcode_unautop' );
     150add_filter( 'the_excerpt', 'device_mockups_shortcode_unautop' );
  • device-mockups/trunk/readme.txt

    r1722736 r1731367  
    55Requires at least: 3.7
    66Tested up to: 4.8.1
    7 Stable tag: 1.8.1
     7Stable tag: 1.8.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8787
    8888== Changelog ==
     89= 1.8.2 =
     90* added filters back to fix the gallery
     91
    8992= 1.8.1 =
    9093* Added composer to grab latest wpcs and phpcs
Note: See TracChangeset for help on using the changeset viewer.