Plugin Directory

Changeset 3810121


Ignore:
Timestamp:
11/18/2026 08:19:01 PM (less than one hour ago)
Author:
roomvuservices
Message:

Release version 1.7.1

Location:
roomvu-marketing/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roomvu-marketing/trunk/lib/class-roomvu-marketing-post-manager.php

    r3773410 r3810121  
    230230     * Return existing post ID when a post with the same title exists.
    231231     *
     232     * Matches every form WordPress may already have stored. A site
     233     * administrator on Multisite lacks unfiltered_html, so wp_insert_post()
     234     * encodes "&" as "&" via title_save_pre. A user with unfiltered_html
     235     * keeps the raw character. Searching only the raw title misses the
     236     * encoded row and creates a duplicate on every import.
     237     *
    232238     * @param string $title
    233239     *
    … …  
    236242    protected function get_duplicate_post_id($title = '')
    237243    {
    238         $query = new WP_Query([
    239             'post_type'      => 'post',
    240             'title'          => $title,
    241             'posts_per_page' => 1,
    242             'post_status'    => 'any',
    243             'fields'         => 'ids',
    244         ]);
    245 
    246         return !empty($query->posts) ? (int) $query->posts[0] : 0;
     244        foreach ($this->post_title_lookup_values($title) as $lookup_title) {
     245            $query = new WP_Query([
     246                'post_type'      => 'post',
     247                'title'          => $lookup_title,
     248                'posts_per_page' => 1,
     249                'post_status'    => 'any',
     250                'fields'         => 'ids',
     251            ]);
     252
     253            if (!empty($query->posts)) {
     254                return (int) $query->posts[0];
     255            }
     256        }
     257
     258        return 0;
     259    }
     260
     261    /**
     262     * Title strings that can already exist for this import title.
     263     *
     264     * @param string $title Title after sanitize_text_field().
     265     *
     266     * @return string[]
     267     */
     268    protected function post_title_lookup_values($title)
     269    {
     270        $title = is_string($title) ? $title : '';
     271        if ($title === '') {
     272            return array();
     273        }
     274
     275        $values = array(
     276            $title,
     277            wp_specialchars_decode($title, ENT_QUOTES),
     278            wp_unslash(wp_filter_kses($title)),
     279        );
     280
     281        $stored = sanitize_post_field('post_title', $title, 0, 'db');
     282        if (is_string($stored)) {
     283            $values[] = wp_unslash($stored);
     284        }
     285
     286        $unique = array();
     287        foreach ($values as $value) {
     288            if (!is_string($value) || $value === '') {
     289                continue;
     290            }
     291            $unique[$value] = $value;
     292        }
     293
     294        return array_values($unique);
    247295    }
    248296
  • roomvu-marketing/trunk/readme.txt

    r3773410 r3810121  
    44Requires at least: 4.9
    55Tested up to: 6.8
    6 Stable tag: 1.7.0
     6Stable tag: 1.7.1
    77Requires PHP: 7.0
    88License: GPLv2 or later
    … …  
    2929
    3030== Changelog ==
     31
     32= 1.7.1 =
     33- Avoid duplicate posts when a title contains special characters such as "&".
    3134
    3235= 1.7.0 =
  • roomvu-marketing/trunk/roomvu.php

    r3773410 r3810121  
    44 * Plugin Name: Roomvu Marketing
    55 * Description: Roomvu Marketing Plugin allows you to integrate your WordPress with Roomvu, and automatically post your Roomvu videos to your WordPress website.
    6  * Version: 1.7.0
     6 * Version: 1.7.1
    77 * Author: Roomvu
    88 * Author URI: https://roomvu.com
Note: See TracChangeset for help on using the changeset viewer.