Plugin Directory

Changeset 3310873


Ignore:
Timestamp:
06/13/2025 07:25:37 AM (10 months ago)
Author:
urkekg
Message:

Add Jetpack compatibility

Location:
head-footer-code
Files:
31 added
5 edited

Legend:

Unmodified
Added
Removed
  • head-footer-code/trunk/classes/techwebux/hfc/class-metabox-category.php

    r3271581 r3310873  
    9393        // Sanitize the `auhfc` data.
    9494        if ( is_array( $_POST['auhfc'] ) ) {
     95            // Remove Jetpack filter that may interfere with wp_kses.
     96            remove_filter( 'pre_kses', array( 'Filter_Embedded_HTML_Objects', 'maybe_create_links' ), 100 );
     97
     98            // Prepare data for saving.
    9599            $data = array(
    96100                'behavior' => ! empty( $_POST['auhfc']['behavior'] ) ? sanitize_key( $_POST['auhfc']['behavior'] ) : '',
     
    100104                'footer'   => ! empty( $_POST['auhfc']['footer'] ) ? wp_kses( $_POST['auhfc']['footer'], $allowed_html ) : '',
    101105            );
     106
     107            // Re-add Jetpack filter if it exists.
     108            // This is to ensure compatibility with Jetpack and other plugins that may use this filter.
     109            if ( is_callable( array( 'Filter_Embedded_HTML_Objects', 'maybe_create_links' ) ) ) {
     110                add_filter( 'pre_kses', array( 'Filter_Embedded_HTML_Objects', 'maybe_create_links' ), 100 );
     111            }
    102112        }
    103113
  • head-footer-code/trunk/classes/techwebux/hfc/class-settings.php

    r3271925 r3310873  
    547547        }
    548548
     549        // Remove Jetpack filter that may interfere with wp_kses.
     550        remove_filter( 'pre_kses', array( 'Filter_Embedded_HTML_Objects', 'maybe_create_links' ), 100 );
     551
    549552        // Filter allowed HTML tags and attributes.
    550553        echo wp_kses( $html, $this->allowed_html );
     554
     555        // Re-add the Jetpack filter if it exists.
     556        // This is to ensure compatibility with Jetpack and other plugins that may use this filter.
     557        if ( is_callable( array( 'Filter_Embedded_HTML_Objects', 'maybe_create_links' ) ) ) {
     558            add_filter( 'pre_kses', array( 'Filter_Embedded_HTML_Objects', 'maybe_create_links' ), 100 );
     559        }
    551560    } // END public function textarea_field_render
    552561
  • head-footer-code/trunk/head-footer-code.php

    r3303898 r3310873  
    1111 * Plugin URI:  https://urosevic.net/wordpress/plugins/head-footer-code/
    1212 * Description: Easy add site-wide, category or article specific custom code before the closing <strong>&lt;/head&gt;</strong> and <strong>&lt;/body&gt;</strong> or after opening <strong>&lt;body&gt;</strong> HTML tag.
    13  * Version:     1.4.4
     13 * Version:     1.4.5
    1414 * Author:      Aleksandar Urošević
    1515 * Author URI:  https://urosevic.net/
     
    3030}
    3131
    32 define( 'HFC_VER', '1.4.4' );
     32define( 'HFC_VER', '1.4.5' );
    3333define( 'HFC_VER_DB', '9' );
    3434define( 'HFC_FILE', __FILE__ );
  • head-footer-code/trunk/readme.txt

    r3303898 r3310873  
    66Requires at least: 4.9
    77Tested up to: 6.8
    8 Stable tag: 1.4.4
     8Stable tag: 1.4.5
    99Requires PHP: 5.5
    1010License: GPLv3
     
    191191## Changelog
    192192
     193### 1.4.5 (2025-06-13)
     194* Fix: Compatibility with Jetpack > Writing > Composing > Compose using shortcode to embed media from popular sites
     195* Fix: Automatic conversion of false to array is deprecated in update.php
     196* Test: WordPress 6.8.1, Twenty Twenty-Five 1.2, Jetpack 14.7
     197
    193198### 1.4.4 (2025-05-31)
    194199* Fix: Relaxed filtering to allow <link> preloadans security/privacy attributes.
  • head-footer-code/trunk/update.php

    r3271581 r3310873  
    243243    $homepage = get_option( 'auhfc_settings_homepage' );
    244244
     245    if ( ! is_array( $homepage ) ) {
     246        return;
     247    }
     248
    245249    if ( empty( $homepage['allowed_roles'] ) ) {
    246250        $homepage['allowed_roles'] = array();
Note: See TracChangeset for help on using the changeset viewer.