Plugin Directory

Changeset 3477390


Ignore:
Timestamp:
03/08/2026 11:35:20 AM (4 weeks ago)
Author:
floyi
Message:

Release 1.0.2 - Preserve link target and rel attributes when publishing from Floyi

Location:
floyi
Files:
26 added
3 edited

Legend:

Unmodified
Added
Removed
  • floyi/trunk/floyi.php

    r3474122 r3477390  
    44 * Plugin URI: https://floyi.com/wordpress-plugin
    55 * Description: Connect your WordPress site to Floyi for seamless content publishing from your topical authority platform.
    6  * Version: 1.0.1
     6 * Version: 1.0.2
    77 * Author: Floyi
    88 * Author URI: https://floyi.com
     
    2323
    2424// Plugin constants
    25 define('FLOYI_CONNECT_VERSION', '1.0.1');
     25define('FLOYI_CONNECT_VERSION', '1.0.2');
    2626define('FLOYI_CONNECT_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2727define('FLOYI_CONNECT_PLUGIN_URL', plugin_dir_url(__FILE__));
  • floyi/trunk/includes/class-floyi-publisher.php

    r3463064 r3477390  
    1818
    1919    /**
     20     * Sanitize post content while preserving link attributes like target and rel.
     21     *
     22     * WordPress's wp_kses_post() strips target="_blank" from <a> tags by default.
     23     * This method extends the allowed HTML to preserve those attributes so that
     24     * "open in new tab" settings from the Floyi editor survive publishing.
     25     *
     26     * @param string $content HTML content to sanitize.
     27     * @return string Sanitized HTML with target/rel preserved on links.
     28     */
     29    private static function sanitize_content($content) {
     30        $allowed = wp_kses_allowed_html('post');
     31        // Ensure <a> tags can carry target and rel attributes
     32        if (isset($allowed['a'])) {
     33            $allowed['a']['target'] = true;
     34            $allowed['a']['rel'] = true;
     35        }
     36        return wp_kses($content, $allowed);
     37    }
     38
     39    /**
    2040     * Create a new post.
    2141     *
     
    3656        $post_data = array(
    3757            'post_title' => sanitize_text_field($params['title']),
    38             'post_content' => isset($params['content']) ? wp_kses_post($params['content']) : '',
     58            'post_content' => isset($params['content']) ? self::sanitize_content($params['content']) : '',
    3959            'post_status' => isset($params['status']) ? sanitize_key($params['status']) : 'draft',
    4060            'post_type' => isset($params['type']) ? sanitize_key($params['type']) : 'post',
     
    134154
    135155        if (isset($params['content'])) {
    136             $post_data['post_content'] = wp_kses_post($params['content']);
     156            $post_data['post_content'] = self::sanitize_content($params['content']);
    137157        }
    138158
  • floyi/trunk/readme.txt

    r3474122 r3477390  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    125125== Changelog ==
    126126
     127= 1.0.2 =
     128* Preserve link target and rel attributes when publishing from Floyi (fixes "open in new tab" links losing target="_blank" after publishing)
     129
    127130= 1.0.1 =
    128131* Added webhook notification for permanent post deletions so Floyi cleans up publish records
     
    146149== Upgrade Notice ==
    147150
     151= 1.0.2 =
     152Fixes link attributes (target, rel) being stripped when publishing content to WordPress.
     153
    148154= 1.0.1 =
    149155Fixes publish record cleanup when posts are permanently deleted from WordPress.
Note: See TracChangeset for help on using the changeset viewer.