Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/buddyforms/BuddyForms.php
+++ b/buddyforms/BuddyForms.php
@@ -7,7 +7,7 @@
* Plugin Name: BuddyForms
* Plugin URI: https://themekraft.com/buddyforms/
* Description: Contact Forms, Post Forms for User Generated Content and Registration Forms easily build in minutes. Extendable with Addons!
- * Version: 2.10.10
+ * Version: 2.10.11
* Requires at least: 5.9
* Requires PHP: 7.4
* Author: ThemeKraft
@@ -53,7 +53,7 @@
/**
* @var string
*/
- public $version = '2.10.10';
+ public $version = '2.10.11';
/**
* @var array Frontend Global JS parameters
--- a/buddyforms/includes/admin/admin-ajax.php
+++ b/buddyforms/includes/admin/admin-ajax.php
@@ -134,7 +134,7 @@
wp_die( '', '', array( 'response' => 403 ) );
}
$page_id = filter_var( wp_unslash( $_POST['attached_page'] ), FILTER_VALIDATE_INT );
- $form_slug = filter_var( wp_unslash( $_POST['form_slug'] ), FILTER_SANITIZE_STRING );
+ $form_slug = isset( $_POST['form_slug'] ) ? buddyforms_sanitize_string( wp_unslash( $_POST['form_slug'] ) ) : '';
$post = get_post( $page_id );
if ( isset( $post->post_name ) ) {
--- a/buddyforms/includes/admin/form-builder/form-builder-elements.php
+++ b/buddyforms/includes/admin/form-builder/form-builder-elements.php
@@ -70,8 +70,8 @@
'required' => 1,
));
$field_slug = ( isset( $customfield['slug'] ) ? buddyforms_sanitize_slug( $customfield['slug'] ) : $name );
- if ( $customfield['type'] == 'acf-field' && $field_slug == 'acf_false' ) {
- $field_slug = 'acf_' . $customfield['acf_field'];
+ if ( isset( $customfield['type'] ) && $customfield['type'] == 'acf-field' && $field_slug == 'acf_false' ) {
+ $field_slug = 'acf_' . (( isset( $customfield['acf_field'] ) ? $customfield['acf_field'] : '' ));
}
$form_fields['advanced']['slug'] = new Element_Textbox('<b>' . __( 'Slug', 'buddyforms' ) . '</b>' . sprintf( '<small>(%s)</small>', __( 'optional', 'buddyforms' ) ), 'buddyforms_options[form_fields][' . $field_id . '][slug]', array(
'shortDesc' => __( 'Underscore before the slug like _name will create a hidden post meta field', 'buddyforms' ),
@@ -1849,7 +1849,7 @@
extract( $args );
if ( !empty( $field_id ) && !empty( $buddyform ) ) {
$field_options = ( isset( $buddyform['form_fields'][$field_id]['options'] ) ? $buddyform['form_fields'][$field_id]['options'] : '' );
- $field_type = $buddyform['form_fields'][$field_id]['type'];
+ $field_type = ( isset( $buddyform['form_fields'][$field_id]['type'] ) ? $buddyform['form_fields'][$field_id]['type'] : '' );
$count = 1;
$default_option = ( isset( $buddyform['form_fields'][$field_id]['default'] ) ? $buddyform['form_fields'][$field_id]['default'] : '' );
ob_start();
--- a/buddyforms/includes/admin/form-builder/meta-boxes/metabox-form-elements.php
+++ b/buddyforms/includes/admin/form-builder/meta-boxes/metabox-form-elements.php
@@ -69,7 +69,7 @@
}
if ( $customfield['type'] == 'acf-field' && $field_slug == 'acf_false' ) {
- $field_slug = 'acf_' . $customfield['acf_field'];
+ $field_slug = 'acf_' . ( isset( $customfield['acf_field'] ) ? $customfield['acf_field'] : '' );
}
// Make sure we have a field slug and name
@@ -80,7 +80,7 @@
'field_id' => $field_id,
'field_type' => sanitize_title( $customfield['type'] ),
'form_slug' => $form_slug,
- 'post_type' => $buddyform['post_type'],
+ 'post_type' => isset( $buddyform['post_type'] ) ? $buddyform['post_type'] : null,
);
// Get the form element html and add it to the form elements array
--- a/buddyforms/includes/admin/form-builder/meta-boxes/metabox-layout.php
+++ b/buddyforms/includes/admin/form-builder/meta-boxes/metabox-layout.php
@@ -119,7 +119,7 @@
wp_die( '', '', array( 'response' => 403 ) );
}
- $form_slug = filter_var( wp_unslash( $_POST['form_slug'] ), FILTER_SANITIZE_STRING );
+ $form_slug = buddyforms_sanitize_string( wp_unslash( $_POST['form_slug'] ) );
$json = array();
if ( $form_slug == 'bf_global' ) {
@@ -160,7 +160,7 @@
$form_setup = array();
$form_type = '';
- if ( isset( $buddyforms[ $form_slug ]['form_type'] ) ) {
+ if ( ! empty( $form_slug ) && isset( $buddyforms[ $form_slug ]['form_type'] ) ) {
$form_type = $buddyforms[ $form_slug ]['form_type'];
}
@@ -661,7 +661,7 @@
echo '<p><select id="bf_form_layout_select" style="width: 50% !important; margin-right: 10px">';
echo '<option value="bf_global">Global Settings</option>';
- if ( isset( $buddyforms ) ) {
+ if ( ! empty( $buddyforms ) && is_array( $buddyforms ) ) {
foreach ( $buddyforms as $form_slug => $form ) {
echo '<option value="' . esc_attr( $form_slug ) . '">' . esc_html( $form['name'] ) . '</option>';
}
--- a/buddyforms/includes/admin/pricing-page-config.php
+++ b/buddyforms/includes/admin/pricing-page-config.php
@@ -21,8 +21,8 @@
return $config;
}
- $config['heading'] = __( 'Get BuddyForms Pro', 'buddyforms' );
- $config['subheading'] = __( 'Unlock all BuddyForms Pro features with a year of updates and support.', 'buddyforms' );
+ $config['heading'] = __( 'Go Pro to publish anything from the front end', 'buddyforms' );
+ $config['subheading'] = __( 'The free version builds contact, registration and post forms. Pro turns BuddyForms into a full front-end publishing system.', 'buddyforms' );
$config['bundle'] = array(
'product_id' => '391',
@@ -36,10 +36,12 @@
'label' => __( 'All BuddyForms Pro features unlocked', 'buddyforms' ),
'highlight' => true,
),
- __( 'Forms for any post type', 'buddyforms' ),
- __( 'Form permissions by user role', 'buddyforms' ),
- __( 'Post status, revision and notification options', 'buddyforms' ),
- __( 'Advanced user registration options', 'buddyforms' ),
+ __( 'Any post type: WooCommerce products, events, listings or any custom post type', 'buddyforms' ),
+ __( 'Permissions by role: choose which roles can use a form, and create, edit and delete posts', 'buddyforms' ),
+ __( 'Post status, revisions and notifications: drafts, default status, front-end revisions and status emails', 'buddyforms' ),
+ __( 'Registration options: auto-generated passwords, username from the email address, moderated profile updates', 'buddyforms' ),
+ __( 'File uploads with size and file-type limits', 'buddyforms' ),
+ __( 'More fields: Taxonomy, Range slider, Price, State, Hidden, HTML and Form Actions', 'buddyforms' ),
__( 'One year of support', 'buddyforms' ),
__( 'One year of updates', 'buddyforms' ),
);
--- a/buddyforms/includes/admin/register-post-types.php
+++ b/buddyforms/includes/admin/register-post-types.php
@@ -712,16 +712,6 @@
<div id="frontend-actions">
<label for="button"><?php esc_html_e( 'Frontend', 'buddyforms' ); ?></label>
<?php
- $preview_form_url = $attached_page_permalink . 'create/' . $post->post_name . '/';
- $url_request = curl_init( $preview_form_url );
- curl_setopt( $url_request, CURLOPT_RETURNTRANSFER, true );
- $httpCode = curl_getinfo( $url_request, CURLINFO_HTTP_CODE );
- if ( $httpCode == 404 ) {
- flush_rewrite_rules();
- }
- curl_close( $url_request );
- ?>
- <?php
echo '<a class="button button-large bf_button_action" href="' . esc_attr( $attached_page_permalink ) . 'view/' . esc_attr( $post->post_name ) . '/" target="_new"><span class="dashicons dashicons-admin-page"></span> ' . esc_html__( 'Your Submissions', 'buddyforms' ) . '</a>
<a class="button button-large bf_button_action" href="' . esc_attr( $attached_page_permalink ) . 'create/' . esc_attr( $post->post_name ) . '/" target="_new"><span class="dashicons dashicons-feedback"></span> ' . esc_html__( 'The Form', 'buddyforms' ) . '</a>';
?>
--- a/buddyforms/includes/admin/settings.php
+++ b/buddyforms/includes/admin/settings.php
@@ -433,7 +433,7 @@
echo '<select name="buddyforms_gdpr[terms]" id="buddyforms_gdpr_terms">';
$pages['none'] = 'No Terms';
foreach ( $pages as $page_id => $page_name ) {
- echo '<option ' . selected( $buddyforms_gdpr['terms'], $page_id ) . 'value="' . esc_attr( $page_id ) . '">' . esc_html( $page_name ) . '</option>';
+ echo '<option ' . selected( isset( $buddyforms_gdpr['terms'] ) ? $buddyforms_gdpr['terms'] : '', $page_id ) . 'value="' . esc_attr( $page_id ) . '">' . esc_html( $page_name ) . '</option>';
}
echo '</select>';
}
--- a/buddyforms/includes/admin/submissions.php
+++ b/buddyforms/includes/admin/submissions.php
@@ -87,7 +87,7 @@
if ( isset( $_GET['form_slug'] ) ) {
$current_screen->set_parentage( $parent_file );
$current_screen->render_screen_meta();
- $selected_form = filter_var( wp_unslash( $_GET['form_slug'] ), FILTER_SANITIZE_STRING );
+ $selected_form = buddyforms_sanitize_string( wp_unslash( $_GET['form_slug'] ) );
}
?>
@@ -156,10 +156,10 @@
<?php if ( isset( $_GET['form_slug'] ) ) : ?>
- <?php if ( $this->has_the_capability( filter_var( wp_unslash( $_GET['form_slug'] ), FILTER_SANITIZE_STRING ) ) ) : ?>
+ <?php if ( $this->has_the_capability( buddyforms_sanitize_string( wp_unslash( $_GET['form_slug'] ) ) ) ) : ?>
<?php if ( ! isset( $_GET['entry'] ) ) { ?>
<form id="filter" method="get">
- <input type="hidden" name="page" value="<?php echo esc_attr( filter_var( wp_unslash( $_REQUEST['page'] ), FILTER_SANITIZE_STRING ) ); ?>"/>
+ <input type="hidden" name="page" value="<?php echo esc_attr( buddyforms_sanitize_string( wp_unslash( $_REQUEST['page'] ) ) ); ?>"/>
<?php $this->bf_submissions_table->display(); ?>
</form>
<?php } ?>
@@ -209,7 +209,7 @@
$action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
$entry = isset( $_GET['post'] ) ? filter_var( wp_unslash( $_GET['post'] ), FILTER_VALIDATE_INT ) : '';
- $form_slug = isset( $_GET['form_slug'] ) ? filter_var( wp_unslash( $_GET['form_slug'] ), FILTER_SANITIZE_STRING ) : '';
+ $form_slug = isset( $_GET['form_slug'] ) ? buddyforms_sanitize_string( wp_unslash( $_GET['form_slug'] ) ) : '';
// Only clean up files of an entry the user is really deleting: the core delete link nonce must be valid,
// the entry must belong to this form and the user must be able to delete it.
if ( $action === 'delete' && ! empty( $entry ) && $this->has_the_capability( $form_slug )
@@ -298,14 +298,14 @@
function column_ID( $item ) {
global $buddyforms;
- $form_slug = isset( $_GET['form_slug'] ) ? filter_var( wp_unslash( $_GET['form_slug'] ), FILTER_SANITIZE_STRING ) : '';
+ $form_slug = isset( $_GET['form_slug'] ) ? buddyforms_sanitize_string( wp_unslash( $_GET['form_slug'] ) ) : '';
$actions = array(
'edit' => sprintf( '<a href="post.php?post=%s&action=%s">%s</a>', $item->ID, 'edit', __( 'Edit', 'buddyforms' ) ),
'delete' => '<a href="' . get_delete_post_link( $item->ID, '', true ) . '&form_slug=' . $form_slug . '" class="submitdelete deletion" onclick="return confirm('' . __( 'Are you sure you want to delete that entry?', 'buddyforms' ) . '');" title="' . __( 'Delete', 'buddyforms' ) . '">' . __( 'Delete', 'buddyforms' ) . '</a>',
);
if ( isset( $buddyforms[ $_GET['form_slug'] ]['post_type'] ) && $buddyforms[ $form_slug ]['post_type'] == 'bf_submissions' ) {
- $actions['edit'] = sprintf( '<a href="?post_type=buddyforms&page=%s&action=%s&entry=%s&form_slug=%s">%s</a>', filter_var( wp_unslash( $_REQUEST['page'] ), FILTER_SANITIZE_STRING ), 'edit', $item->ID, $form_slug, __( 'View Submission', 'buddyforms' ) );
+ $actions['edit'] = sprintf( '<a href="?post_type=buddyforms&page=%s&action=%s&entry=%s&form_slug=%s">%s</a>', buddyforms_sanitize_string( wp_unslash( $_REQUEST['page'] ) ), 'edit', $item->ID, $form_slug, __( 'View Submission', 'buddyforms' ) );
}
// Return the title contents
@@ -322,7 +322,7 @@
*/
function column_default( $item, $column_name ) {
$bf_value = get_post_meta( intval( $item->ID ), $column_name, true );
- $bf_field = buddyforms_get_form_field_by_slug( filter_var( wp_unslash( $_GET['form_slug'] ), FILTER_SANITIZE_STRING ), $column_name );
+ $bf_field = buddyforms_get_form_field_by_slug( buddyforms_sanitize_string( wp_unslash( $_GET['form_slug'] ) ), $column_name );
if ( $bf_field !== false ) {
$this->get_column_values( $column_name, $bf_field['type'], $item, $bf_value, $bf_field );
}
@@ -332,7 +332,7 @@
if ( $column_name == 'Author' ) {
$post = get_post( $item->ID );
if ( ! empty( $post->post_author ) ) {
- echo wp_kses( apply_filters( 'bf_submission_column_default_author_meta', get_the_author_meta( 'nickname', $post->post_author ), $post->post_author ), buddyforms_wp_kses_allowed_atts() );
+ echo wp_kses_post( apply_filters( 'bf_submission_column_default_author_meta', esc_html( get_the_author_meta( 'nickname', $post->post_author ) ), $post->post_author ) );
} else {
esc_html_e( 'Anonymous', 'buddyforms' );
}
@@ -343,8 +343,56 @@
$post = get_post( $item->ID );
$bf_value = buddyforms_get_field_output( $item->ID, $bf_field, $post, $bf_value, $field_slug, false, false );
+ $bf_value = $this->escape_column_value( $bf_value, $field_type );
- echo wp_kses( apply_filters( 'bf_submission_column_default', $bf_value, $item, $field_type, $field_slug ), buddyforms_wp_kses_allowed_atts() );
+ // Filters may add markup (featured image thumbnail, product link), but never scripts or event handlers.
+ echo wp_kses_post( apply_filters( 'bf_submission_column_default', $bf_value, $item, $field_type, $field_slug ) );
+ }
+
+ /**
+ * Escape a submitted value for the list. Submitted values are shown as text, never as markup.
+ *
+ * @param mixed $value Value returned by buddyforms_get_field_output().
+ * @param string $field_type Field type.
+ *
+ * @return string
+ */
+ protected function escape_column_value( $value, $field_type ) {
+ $value = $this->flatten_column_value( $value );
+
+ // The GDPR output is built from the form's own agreement labels and keeps its paragraph markup.
+ if ( 'gdpr' === $field_type ) {
+ return wp_kses_post( $value );
+ }
+
+ return esc_html( $value );
+ }
+
+ /**
+ * Turn a value into a string: arrays and objects become a comma separated list of their values.
+ *
+ * @param mixed $value Value to flatten.
+ *
+ * @return string
+ */
+ protected function flatten_column_value( $value ) {
+ if ( is_object( $value ) ) {
+ $value = get_object_vars( $value );
+ }
+
+ if ( ! is_array( $value ) ) {
+ return is_scalar( $value ) ? (string) $value : '';
+ }
+
+ $parts = array();
+ foreach ( $value as $item ) {
+ $part = $this->flatten_column_value( $item );
+ if ( '' !== $part ) {
+ $parts[] = $part;
+ }
+ }
+
+ return implode( ', ', $parts );
}
@@ -386,7 +434,7 @@
);
if ( isset( $_GET['form_slug'] ) && isset( $buddyforms[ $_GET['form_slug'] ]['form_fields'] ) ) {
- foreach ( $buddyforms[ filter_var( wp_unslash( $_GET['form_slug'] ), FILTER_SANITIZE_STRING ) ]['form_fields'] as $key => $field ) {
+ foreach ( $buddyforms[ buddyforms_sanitize_string( wp_unslash( $_GET['form_slug'] ) ) ]['form_fields'] as $key => $field ) {
if ( ! empty( $field['slug'] ) && ! in_array( $field['slug'], $this->exclude_columns ) ) {
$columns[ $field['slug'] ] = ! empty( $field['name'] ) ? sanitize_text_field( $field['name'] ) : sanitize_text_field( $field['slug'] );
}
@@ -402,7 +450,7 @@
$data = array();
if ( isset( $_GET['form_slug'] ) ) {
$customkey = '_bf_form_slug'; // set to your custom key
- $customvalue = ! empty( $_GET['form_slug'] ) ? filter_var( wp_unslash( $_GET['form_slug'] ), FILTER_SANITIZE_STRING ) : '';
+ $customvalue = ! empty( $_GET['form_slug'] ) ? buddyforms_sanitize_string( wp_unslash( $_GET['form_slug'] ) ) : '';
$sql_args = array( 'ID', 'post_title', 'post_author' );
$sql_select = implode( ', ', $sql_args );
if ( ! empty( $author_to_filter ) ) {
--- a/buddyforms/includes/form/form-ajax.php
+++ b/buddyforms/includes/form/form-ajax.php
@@ -143,7 +143,7 @@
$form_data = array();
if ( isset( $_POST['data'] ) ) {
- parse_str( filter_var( wp_unslash( $_POST['data'] ), FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES ), $form_data );
+ parse_str( buddyforms_sanitize_string( wp_unslash( $_POST['data'] ), false ), $form_data );
$_POST = $form_data;
}
--- a/buddyforms/includes/form/form-control.php
+++ b/buddyforms/includes/form/form-control.php
@@ -1163,12 +1163,12 @@
if ( is_array( $meta_value ) ) {
$terms = array();
foreach ( $meta_value as $cat ) {
- $term = get_term( $cat, $custom_field['taxonomy'] );
+ $term = get_term( $cat, isset( $custom_field['taxonomy'] ) ? $custom_field['taxonomy'] : '' );
$terms[] = ( ! empty( $term ) && ! is_wp_error( $term ) ) ? $term->name : $cat;
}
$meta_value = implode( apply_filters( 'buddyforms_implode_separator', ', ', $custom_field['type'], $slug ), $terms );
} else {
- $term = get_term( $meta_value, $custom_field['taxonomy'] );
+ $term = get_term( $meta_value, isset( $custom_field['taxonomy'] ) ? $custom_field['taxonomy'] : '' );
$meta_value = ( ! empty( $term ) && ! is_wp_error( $term ) ) ? $term->name : $meta_value;
}
break;
@@ -1282,7 +1282,7 @@
}
}
- if ( $customfield['type'] == 'acf-field' && isset( $_POST['acf'][ $customfield['acf_field'] ] ) ) {
+ if ( $customfield['type'] == 'acf-field' && isset( $customfield['acf_field'], $_POST['acf'][ $customfield['acf_field'] ] ) ) {
$field_value = buddyforms_sanitize( $customfield['type'], $_POST['acf'][ $customfield['acf_field'] ] );
update_post_meta( $post_id, $slug, $field_value );
}
--- a/buddyforms/includes/form/form-preview.php
+++ b/buddyforms/includes/form/form-preview.php
@@ -30,7 +30,7 @@
function buddyforms_append_preview_page( $content ) {
// GHet the form slug from the url parameter
- $form_slug = filter_var( wp_unslash( $_REQUEST['form_slug'] ), FILTER_SANITIZE_STRING );
+ $form_slug = buddyforms_sanitize_string( wp_unslash( $_REQUEST['form_slug'] ) );
// Create the array for the form
$args = array(
'form_slug' => $form_slug,
--- a/buddyforms/includes/form/form-validation.php
+++ b/buddyforms/includes/form/form-validation.php
@@ -134,7 +134,8 @@
break;
default:
if ( is_array( $value ) ) {
- array_walk_recursive( $value, 'sanitize_text_field' );
+ // Sanitize every value of the array and keep the result (checkboxes, multiple selects, taxonomies).
+ $value = map_deep( $value, 'sanitize_text_field' );
} else {
$value = apply_filters( 'buddyforms_sanitize', sanitize_text_field( $value ), $type );
}
--- a/buddyforms/includes/form/form.php
+++ b/buddyforms/includes/form/form.php
@@ -20,7 +20,7 @@
if ( isset( $_REQUEST['form_slug'] ) && isset( $_REQUEST['post_id'] ) && isset( $_REQUEST['_wpnonce'] ) && ! empty( $_REQUEST['bf_entry_key'] )
&& wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'buddyforms_form_nonce' ) ) {
- $form_slug = filter_var( wp_unslash( $_REQUEST['form_slug'] ), FILTER_SANITIZE_STRING );
+ $form_slug = buddyforms_sanitize_string( wp_unslash( $_REQUEST['form_slug'] ) );
$post_id = filter_var( wp_unslash( $_REQUEST['post_id'] ), FILTER_VALIDATE_INT );
$entry_key = sanitize_key( wp_unslash( $_REQUEST['bf_entry_key'] ) );
$transient_name = buddyforms_failed_submission_transient_name( $form_slug, $post_id, $entry_key );
@@ -501,7 +501,7 @@
$form_slug = get_query_var( 'form_slug' );
if ( isset( $_REQUEST['post_id'] ) && isset( $_REQUEST['_wpnonce'] ) ) {
$post_id = filter_var( wp_unslash( $_REQUEST['post_id'] ), FILTER_VALIDATE_INT );
- $wp_nonce = filter_var( wp_unslash( $_REQUEST['_wpnonce'] ), FILTER_SANITIZE_STRING );
+ $wp_nonce = buddyforms_sanitize_string( wp_unslash( $_REQUEST['_wpnonce'] ) );
$entry_key = strtolower( wp_generate_password( 32, false ) );
$transient_name = buddyforms_failed_submission_transient_name( $form_slug, $post_id, $entry_key );
}
--- a/buddyforms/includes/functions.php
+++ b/buddyforms/includes/functions.php
@@ -4,6 +4,31 @@
exit;
}
/**
+ * Replacement for filter_var( $value, FILTER_SANITIZE_STRING ), deprecated since PHP 8.1.
+ *
+ * Removes NUL bytes and tags, and encodes single and double quotes unless $encode_quotes is false
+ * (FILTER_FLAG_NO_ENCODE_QUOTES). Gives the same result as the filter for any value without "<";
+ * with "<" it still removes every tag.
+ *
+ * @since 2.10.9
+ *
+ * @param mixed $value The value to sanitize.
+ * @param bool $encode_quotes Encode ' and " as ' and ".
+ *
+ * @return string|false The sanitized string, or false for arrays and objects, like the filter.
+ */
+function buddyforms_sanitize_string( $value, $encode_quotes = true ) {
+ if ( is_array( $value ) || is_object( $value ) ) {
+ return false;
+ }
+ $value = preg_replace( '/\x00|<[^>]*>?/', '', (string) $value );
+ if ( $encode_quotes ) {
+ $value = str_replace( array("'", '"'), array(''', '"'), $value );
+ }
+ return $value;
+}
+
+/**
* Add the forms to the admin bar
*
* @package BuddyForms
@@ -1296,7 +1321,8 @@
$permalink = get_permalink( $buddyforms[$form_slug]['attached_page'] );
$display_message = str_ireplace( '[edit_link]', '<a title="' . __( 'Edit Post', 'buddyforms' ) . '" href="' . $permalink . 'edit/' . $form_slug . '/' . $post_id . '">' . __( 'Continue Editing', 'buddyforms' ) . '</a>', $display_message );
}
- $display_message = str_ireplace( '[form_singular_name]', $buddyforms[$form_slug]['singular_name'], $display_message );
+ $singular_name = ( isset( $buddyforms[$form_slug]['singular_name'] ) ? (string) $buddyforms[$form_slug]['singular_name'] : '' );
+ $display_message = str_ireplace( '[form_singular_name]', $singular_name, $display_message );
$display_message = str_ireplace( '[post_title]', get_the_title( $post_id ), $display_message );
$display_message = str_ireplace( '[post_link]', '<a title="' . __( 'Display Post', 'buddyforms' ) . '" href="' . get_permalink( $post_id ) . '">' . __( 'Display Post', 'buddyforms' ) . '</a>', $display_message );
return do_shortcode( $display_message );
@@ -1952,6 +1978,7 @@
$form_slug,
$bf_post_id
);
+ $result = array();
foreach ( $granted as $item ) {
if ( isset( $options[$item] ) ) {
$result[$item] = $options[$item];
@@ -2235,7 +2262,8 @@
$slug = str_replace( '%', '', $slug );
// Restore octets.
$slug = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $slug );
- if ( seems_utf8( $slug ) ) {
+ // seems_utf8() is deprecated since WordPress 6.9; core's sanitize_title_with_dashes() uses wp_is_valid_utf8() now.
+ if ( ( function_exists( 'wp_is_valid_utf8' ) ? wp_is_valid_utf8( $slug ) : seems_utf8( $slug ) ) ) {
$slug = utf8_uri_encode( $slug, 200 );
}
if ( 'save' == $context ) {
--- a/buddyforms/includes/gdpr.php
+++ b/buddyforms/includes/gdpr.php
@@ -97,10 +97,10 @@
$buddyforms_gdpr_type = sanitize_key( $_POST['buddyforms_gdpr_data_type'] );
$buddyforms_gdpr_email = sanitize_email( wp_unslash( $_POST['buddyforms_gdpr_data_email'] ) );
$buddyforms_gdpr_human = absint( filter_input( INPUT_POST, 'buddyforms_gdpr_data_human', FILTER_SANITIZE_NUMBER_INT ) );
- $buddyforms_gdpr_human_key = esc_html( filter_input( INPUT_POST, 'buddyforms_gdpr_data_human_key', FILTER_SANITIZE_STRING ) );
+ $buddyforms_gdpr_human_key = esc_html( isset( $_POST['buddyforms_gdpr_data_human_key'] ) ? buddyforms_sanitize_string( wp_unslash( $_POST['buddyforms_gdpr_data_human_key'] ) ) : '' );
$buddyforms_gdpr_numbers = explode( '000', $buddyforms_gdpr_human_key );
$buddyforms_gdpr_answer = absint( $buddyforms_gdpr_numbers[0] ) + absint( $buddyforms_gdpr_numbers[1] );
- $buddyforms_gdpr_nonce = esc_html( filter_input( INPUT_POST, 'buddyforms_gdpr_data_nonce', FILTER_SANITIZE_STRING ) );
+ $buddyforms_gdpr_nonce = esc_html( isset( $_POST['buddyforms_gdpr_data_nonce'] ) ? buddyforms_sanitize_string( wp_unslash( $_POST['buddyforms_gdpr_data_nonce'] ) ) : '' );
if ( ! function_exists( 'wp_create_user_request' ) ) {
wp_send_json_success( esc_html__( 'The request can’t be processed on this website. This feature requires WordPress 4.9.6 at least.', 'buddyforms' ) );
--- a/buddyforms/includes/resources/pfbc/Element/Captcha.php
+++ b/buddyforms/includes/resources/pfbc/Element/Captcha.php
@@ -38,7 +38,7 @@
$captcha_attributes_string = '?' . apply_filters( 'buddyforms_captcha_js_source_parameter', $captcha_attributes_string, $this );
}
echo '<style>#recaptcha_table {table-layout: auto;}</style>';
- echo sprintf( '<script src="//www.google.com/recaptcha/api.js%s"></script>', filter_var( $captcha_attributes_string, FILTER_SANITIZE_STRING ) );
+ echo sprintf( '<script src="//www.google.com/recaptcha/api.js%s"></script>', buddyforms_sanitize_string( $captcha_attributes_string ) );
echo '<div data-type="' . esc_attr( $this->getAttribute( 'data_type' ) ) . '" data-size="' . esc_attr( $this->getAttribute( 'data_size' ) ) . '" data-theme="' . esc_attr( $this->getAttribute( 'data_theme' ) ) . '" class="g-recaptcha" data-sitekey="' . esc_attr( $this->getAttribute( 'site_key' ) ) . '"></div>';
} else {
echo sprintf( '<script src="//www.google.com/recaptcha/api.js?render=%s"></script>', esc_attr( $this->getAttribute( 'site_key' ) ) );
--- a/buddyforms/includes/resources/pfbc/Form.php
+++ b/buddyforms/includes/resources/pfbc/Form.php
@@ -144,8 +144,9 @@
directory, you may need to set this property in the form's configure method or directly in this
constructor.*/
$path = dirname( __FILE__ ) . '/Resources';
- if ( strpos( $path, filter_var( wp_unslash( $_SERVER['DOCUMENT_ROOT'] ), FILTER_SANITIZE_STRING ) ) !== false ) {
- $this->resourcesPath = substr( $path, strlen( filter_var( wp_unslash( $_SERVER['DOCUMENT_ROOT'] ), FILTER_SANITIZE_STRING ) ) );
+ $document_root = isset( $_SERVER['DOCUMENT_ROOT'] ) ? buddyforms_sanitize_string( wp_unslash( $_SERVER['DOCUMENT_ROOT'] ) ) : '';
+ if ( strpos( $path, $document_root ) !== false ) {
+ $this->resourcesPath = substr( $path, strlen( $document_root ) );
} else {
$this->resourcesPath = '/PFBC/Resources';
}
--- a/buddyforms/includes/resources/pfbc/FormView.php
+++ b/buddyforms/includes/resources/pfbc/FormView.php
@@ -67,7 +67,7 @@
public function renderCSS() {
global $buddyforms, $form_slug;
- if ( ! isset( $buddyforms[ $form_slug ]['layout']['desc_disable_css'] ) ) {
+ if ( empty( $form_slug ) || ! isset( $buddyforms[ $form_slug ]['layout']['desc_disable_css'] ) ) {
echo 'span.help-inline, span.help-block { color: #888; font-size: .9em; font-style: italic; }';
}
@@ -78,6 +78,23 @@
}
/**
+ * Print what a render method returns.
+ *
+ * The element, label and description render methods echo their markup and return nothing.
+ * Passing that null to wp_kses() is deprecated since PHP 8.1, so only a returned string is
+ * escaped and printed.
+ *
+ * @since 2.10.9
+ *
+ * @param mixed $rendered The return value of a render method.
+ */
+ protected function echoRendered( $rendered ) {
+ if ( is_string( $rendered ) && '' !== $rendered ) {
+ echo wp_kses( $rendered, buddyforms_wp_kses_allowed_atts() );
+ }
+ }
+
+ /**
* @param Element $element
*/
protected function renderDescriptions( $element ) {
--- a/buddyforms/includes/resources/pfbc/View/Frontend.php
+++ b/buddyforms/includes/resources/pfbc/View/Frontend.php
@@ -143,13 +143,15 @@
}
}
- echo '<div class="bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ', wp_kses( $this->renderLabel( $element ), buddyforms_wp_kses_allowed_atts() ), '<div class="bf-input">';
+ echo '<div class="bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ';
+ $this->echoRendered( $this->renderLabel( $element ) );
+ echo '<div class="bf-input">';
if ( isset( $buddyforms[ $form_slug ]['layout']['desc_position'] ) && $buddyforms[ $form_slug ]['layout']['desc_position'] == 'above_field' ) {
- echo wp_kses( $this->renderDescriptions( $element ), buddyforms_wp_kses_allowed_atts() );
- echo wp_kses( $element->render(), buddyforms_wp_kses_allowed_atts() );
+ $this->echoRendered( $this->renderDescriptions( $element ) );
+ $this->echoRendered( $element->render() );
} else {
- echo wp_kses( $element->render(), buddyforms_wp_kses_allowed_atts() );
- echo wp_kses( $this->renderDescriptions( $element ), buddyforms_wp_kses_allowed_atts() );
+ $this->echoRendered( $element->render() );
+ $this->echoRendered( $this->renderDescriptions( $element ) );
}
echo '</div></div></div>';
}
--- a/buddyforms/includes/resources/pfbc/View/Inline.php
+++ b/buddyforms/includes/resources/pfbc/View/Inline.php
@@ -34,8 +34,10 @@
$element->setLabel( '' );
}
- echo '<div class="bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ', wp_kses( $this->renderLabel( $element ), buddyforms_wp_kses_allowed_atts() );
- echo wp_kses( $element->render(), $this->renderDescriptions( $element ), buddyforms_wp_kses_allowed_atts() );
+ echo '<div class="bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ';
+ $this->echoRendered( $this->renderLabel( $element ) );
+ $this->echoRendered( $element->render() );
+ $this->echoRendered( $this->renderDescriptions( $element ) );
echo '</div> ';
}
--- a/buddyforms/includes/resources/pfbc/View/Metabox.php
+++ b/buddyforms/includes/resources/pfbc/View/Metabox.php
@@ -29,10 +29,11 @@
$element->setLabel( '' );
}
- echo '<div class="bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ', wp_kses( $this->renderLabel( $element ), buddyforms_wp_kses_allowed_atts() );
+ echo '<div class="bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ';
+ $this->echoRendered( $this->renderLabel( $element ) );
echo '<div class="bf-input">';
- echo wp_kses( $element->render(), buddyforms_wp_kses_allowed_atts() );
- echo wp_kses( $this->renderDescriptions( $element ), buddyforms_wp_kses_allowed_atts() );
+ $this->echoRendered( $element->render() );
+ $this->echoRendered( $this->renderDescriptions( $element ) );
echo '</div></div>';
}
--- a/buddyforms/includes/resources/pfbc/View/SideBySide.php
+++ b/buddyforms/includes/resources/pfbc/View/SideBySide.php
@@ -41,7 +41,8 @@
}
if ( $this->sharedCount == 0 ) {
- echo '<div class="bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ', wp_kses( $this->renderLabel( $element ), buddyforms_wp_kses_allowed_atts() );
+ echo '<div class="bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ';
+ $this->echoRendered( $this->renderLabel( $element ) );
}
if ( $element->getShared() ) {
@@ -50,7 +51,8 @@
}
echo wp_kses( " <div class='$colSize'> ", buddyforms_wp_kses_allowed_atts() );
- echo wp_kses( $element->render(), $this->renderDescriptions( $element ), buddyforms_wp_kses_allowed_atts() );
+ $this->echoRendered( $element->render() );
+ $this->echoRendered( $this->renderDescriptions( $element ) );
echo ' </div> ';
if ( $this->sharedCount == 0 || $this->sharedCount == 8 ) {
--- a/buddyforms/includes/resources/pfbc/View/SideBySide4.php
+++ b/buddyforms/includes/resources/pfbc/View/SideBySide4.php
@@ -38,7 +38,8 @@
}
if ( $this->sharedCount == 0 ) {
- echo '<div class="row form-group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ', wp_kses( $this->renderLabel( $element ), buddyforms_wp_kses_allowed_atts() );
+ echo '<div class="row form-group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ';
+ $this->echoRendered( $this->renderLabel( $element ) );
}
if ( $element->getShared() ) {
@@ -47,7 +48,8 @@
}
echo wp_kses( " <div class='$colSize'> ", buddyforms_wp_kses_allowed_atts() );
- echo wp_kses( $element->render(), $this->renderDescriptions( $element ), buddyforms_wp_kses_allowed_atts() );
+ $this->echoRendered( $element->render() );
+ $this->echoRendered( $this->renderDescriptions( $element ) );
echo ' </div> ';
if ( $this->sharedCount == 0 || $this->sharedCount == 8 ) {
--- a/buddyforms/includes/resources/pfbc/View/Vertical.php
+++ b/buddyforms/includes/resources/pfbc/View/Vertical.php
@@ -30,7 +30,8 @@
if ( $this->sharedCount == 0 ) {
$rowClass = $element->getShared() ? 'row' : '';
- echo '<div class="' . esc_attr( $rowClass ) . ' bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ', wp_kses( $this->renderLabel( $element ), buddyforms_wp_kses_allowed_atts() );
+ echo '<div class="' . esc_attr( $rowClass ) . ' bf_field_group elem-' . esc_attr( $element->getAttribute( 'id' ) ) . '"> ';
+ $this->echoRendered( $this->renderLabel( $element ) );
}
if ( $element->getShared() ) {
@@ -40,7 +41,8 @@
}
$element->setAttribute( 'placeholder', $element->getLabel() );
- echo wp_kses( $element->render(), $this->renderDescriptions( $element ), buddyforms_wp_kses_allowed_atts() );
+ $this->echoRendered( $element->render() );
+ $this->echoRendered( $this->renderDescriptions( $element ) );
if ( $element->getShared() ) {
echo ' </div> ';
}
--- a/buddyforms/templates/buddyforms/the-loop.php
+++ b/buddyforms/templates/buddyforms/the-loop.php
@@ -145,8 +145,8 @@
$next_posts_link = get_next_posts_link( '←' . __( 'Previous Entries', 'buddyforms' ), $the_lp_query->max_num_pages );
$previos_posts_link = get_previous_posts_link( __( 'Next Entries', 'buddyforms' ) . '→' );
?>
- <div class="alignright"><?php echo wp_kses( apply_filters( 'buddyforms_previos_posts_link', $previos_posts_link, $form_slug ), buddyforms_wp_kses_allowed_atts() ); ?></div>
- <div class="alignleft"><?php echo wp_kses( apply_filters( 'buddyforms_next_posts_link', $next_posts_link, $form_slug ), buddyforms_wp_kses_allowed_atts() ); ?></div>
+ <div class="alignright"><?php echo wp_kses( (string) apply_filters( 'buddyforms_previos_posts_link', $previos_posts_link, $form_slug ), buddyforms_wp_kses_allowed_atts() ); ?></div>
+ <div class="alignleft"><?php echo wp_kses( (string) apply_filters( 'buddyforms_next_posts_link', $next_posts_link, $form_slug ), buddyforms_wp_kses_allowed_atts() ); ?></div>
<?php endif; ?>
</div>
--- a/buddyforms/templates/buddyforms/the-table.php
+++ b/buddyforms/templates/buddyforms/the-table.php
@@ -149,8 +149,8 @@
$next_posts_link = get_next_posts_link( '←' . __( 'Previous Entries', 'buddyforms' ), $the_lp_query->max_num_pages );
$previos_posts_link = get_previous_posts_link( __( 'Next Entries', 'buddyforms' ) . '→' );
?>
- <div class="alignright"><?php echo wp_kses( apply_filters( 'buddyforms_previos_posts_link', $previos_posts_link, $form_slug ), buddyforms_wp_kses_allowed_atts() ); ?></div>
- <div class="alignleft"><?php echo wp_kses( apply_filters( 'buddyforms_next_posts_link', $next_posts_link, $form_slug ), buddyforms_wp_kses_allowed_atts() ); ?></div>
+ <div class="alignright"><?php echo wp_kses( (string) apply_filters( 'buddyforms_previos_posts_link', $previos_posts_link, $form_slug ), buddyforms_wp_kses_allowed_atts() ); ?></div>
+ <div class="alignleft"><?php echo wp_kses( (string) apply_filters( 'buddyforms_next_posts_link', $next_posts_link, $form_slug ), buddyforms_wp_kses_allowed_atts() ); ?></div>
<?php endif; ?>
</div>
--- a/buddyforms/vendor-scope/buddyforms/vendor/composer/InstalledVersions.php
+++ b/buddyforms/vendor-scope/buddyforms/vendor/composer/InstalledVersions.php
@@ -1,345 +0,0 @@
-<?php
-
-/*
- * This file is part of Composer.
- *
- * (c) Nils Adermann <naderman@naderman.de>
- * Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-namespace tkComposer;
-
-use tkComposerAutoloadClassLoader;
-use tkComposerSemverVersionParser;
-/**
- * This class is copied in every Composer installed project and available to all
- *
- * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
- *
- * To require its presence, you can require `composer-runtime-api ^2.0`
- *
- * @final
- */
-class InstalledVersions
-{
- /**
- * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
- * @internal
- */
- private static $selfDir = null;
- /**
- * @var mixed[]|null
- * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
- */
- private static $installed;
- /**
- * @var bool
- */
- private static $installedIsLocalDir;
- /**
- * @var bool|null
- */
- private static $canGetVendors;
- /**
- * @var array[]
- * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
- */
- private static $installedByVendor = array();
- /**
- * Returns a list of all package names which are present, either by being installed, replaced or provided
- *
- * @return string[]
- * @psalm-return list<string>
- */
- public static function getInstalledPackages()
- {
- $packages = array();
- foreach (self::getInstalled() as $installed) {
- $packages[] = array_keys($installed['versions']);
- }
- if (1 === count($packages)) {
- return $packages[0];
- }
- return array_keys(array_flip(call_user_func_array('array_merge', $packages)));
- }
- /**
- * Returns a list of all package names with a specific type e.g. 'library'
- *
- * @param string $type
- * @return string[]
- * @psalm-return list<string>
- */
- public static function getInstalledPackagesByType($type)
- {
- $packagesByType = array();
- foreach (self::getInstalled() as $installed) {
- foreach ($installed['versions'] as $name => $package) {
- if (isset($package['type']) && $package['type'] === $type) {
- $packagesByType[] = $name;
- }
- }
- }
- return $packagesByType;
- }
- /**
- * Checks whether the given package is installed
- *
- * This also returns true if the package name is provided or replaced by another package
- *
- * @param string $packageName
- * @param bool $includeDevRequirements
- * @return bool
- */
- public static function isInstalled($packageName, $includeDevRequirements = true)
- {
- foreach (self::getInstalled() as $installed) {
- if (isset($installed['versions'][$packageName])) {
- return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
- }
- }
- return false;
- }
- /**
- * Checks whether the given package satisfies a version constraint
- *
- * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
- *
- * ComposerInstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
- *
- * @param VersionParser $parser Install composer/semver to have access to this class and functionality
- * @param string $packageName
- * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
- * @return bool
- */
- public static function satisfies(VersionParser $parser, $packageName, $constraint)
- {
- $constraint = $parser->parseConstraints((string) $constraint);
- $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
- return $provided->matches($constraint);
- }
- /**
- * Returns a version constraint representing all the range(s) which are installed for a given package
- *
- * It is easier to use this via isInstalled() with the $constraint argument if you need to check
- * whether a given version of a package is installed, and not just whether it exists
- *
- * @param string $packageName
- * @return string Version constraint usable with composer/semver
- */
- public static function getVersionRanges($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- $ranges = array();
- if (isset($installed['versions'][$packageName]['pretty_version'])) {
- $ranges[] = $installed['versions'][$packageName]['pretty_version'];
- }
- if (array_key_exists('aliases', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
- }
- if (array_key_exists('replaced', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
- }
- if (array_key_exists('provided', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
- }
- return implode(' || ', $ranges);
- }
- throw new OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @param string $packageName
- * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
- */
- public static function getVersion($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['version'])) {
- return null;
- }
- return $installed['versions'][$packageName]['version'];
- }
- throw new OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @param string $packageName
- * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
- */
- public static function getPrettyVersion($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['pretty_version'])) {
- return null;
- }
- return $installed['versions'][$packageName]['pretty_version'];
- }
- throw new OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @param string $packageName
- * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
- */
- public static function getReference($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['reference'])) {
- return null;
- }
- return $installed['versions'][$packageName]['reference'];
- }
- throw new OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @param string $packageName
- * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
- */
- public static function getInstallPath($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
- }
- throw new OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @return array
- * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
- */
- public static function getRootPackage()
- {
- $installed = self::getInstalled();
- return $installed[0]['root'];
- }
- /**
- * Returns the raw installed.php data for custom implementations
- *
- * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
- * @return array[]
- * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
- */
- public static function getRawData()
- {
- @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
- if (null === self::$installed) {
- // only require the installed.php file if this file is loaded from its dumped location,
- // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
- if (substr(__DIR__, -8, 1) !== 'C') {
- self::$installed = include __DIR__ . '/installed.php';
- } else {
- self::$installed = array();
- }
- }
- return self::$installed;
- }
- /**
- * Returns the raw data of all installed.php which are currently loaded for custom implementations
- *
- * @return array[]
- * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
- */
- public static function getAllRawData()
- {
- return self::getInstalled();
- }
- /**
- * Lets you reload the static array from another file
- *
- * This is only useful for complex integrations in which a project needs to use
- * this class but then also needs to execute another project's autoloader in process,
- * and wants to ensure both projects have access to their version of installed.php.
- *
- * A typical case would be PHPUnit, where it would need to make sure it reads all
- * the data it needs from this class, then call reload() with
- * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
- * the project in which it runs can then also use this class safely, without
- * interference between PHPUnit's dependencies and the project's dependencies.
- *
- * @param array[] $data A vendor/composer/installed.php data set
- * @return void
- *
- * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
- */
- public static function reload($data)
- {
- self::$installed = $data;
- self::$installedByVendor = array();
- // when using reload, we disable the duplicate protection to ensure that self::$installed data is
- // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
- // so we have to assume it does not, and that may result in duplicate data being returned when listing
- // all installed packages for example
- self::$installedIsLocalDir = false;
- }
- /**
- * @return string
- */
- private static function getSelfDir()
- {
- if (self::$selfDir === null) {
- self::$selfDir = strtr(__DIR__, '\', '/');
- }
- return self::$selfDir;
- }
- /**
- * @return array[]
- * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
- */
- private static function getInstalled()
- {
- if (null === self::$canGetVendors) {
- self::$canGetVendors = method_exists('tkComposerAutoloadClassLoader', 'getRegisteredLoaders');
- }
- $installed = array();
- $copiedLocalDir = false;
- if (self::$canGetVendors) {
- $selfDir = self::getSelfDir();
- foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
- $vendorDir = strtr($vendorDir, '\', '/');
- if (isset(self::$installedByVendor[$vendorDir])) {
- $installed[] = self::$installedByVendor[$vendorDir];
- } elseif (is_file($vendorDir . '/composer/installed.php')) {
- /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
- $required = require $vendorDir . '/composer/installed.php';
- self::$installedByVendor[$vendorDir] = $required;
- $installed[] = $required;
- if (self::$installed === null && $vendorDir . '/composer' === $selfDir) {
- self::$installed = $required;
- self::$installedIsLocalDir = true;
- }
- }
- if (self::$installedIsLocalDir && $vendorDir . '/composer' === $selfDir) {
- $copiedLocalDir = true;
- }
- }
- }
- if (null === self::$installed) {
- // only require the installed.php file if this file is loaded from its dumped location,
- // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
- if (substr(__DIR__, -8, 1) !== 'C') {
- /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
- $required = require __DIR__ . '/installed.php';
- self::$installed = $required;
- } else {
- self::$installed = array();
- }
- }
- if (self::$installed !== array() && !$copiedLocalDir) {
- $installed[] = self::$installed;
- }
- return $installed;
- }
-}
--- a/buddyforms/vendor-scope/buddyforms/vendor/composer/autoload_classmap.php
+++ b/buddyforms/vendor-scope/buddyforms/vendor/composer/autoload_classmap.php
@@ -7,7 +7,6 @@
return array(
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
- 'Composer\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
'Symfony\Polyfill\Php80\Php80' => $vendorDir . '/symfony/polyfill-php80/Php80.php',
--- a/buddyforms/vendor-scope/buddyforms/vendor/composer/autoload_static.php
+++ b/buddyforms/vendor-scope/buddyforms/vendor/composer/autoload_static.php
@@ -63,7 +63,6 @@
public static $classMap = array (
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
- 'Composer\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
'Symfony\Polyfill\Php80\Php80' => __DIR__ . '/..' . '/symfony/polyfill-php80/Php80.php',
--- a/buddyforms/vendor/composer/installed.php
+++ b/buddyforms/vendor/composer/installed.php
@@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'themekraft/buddyforms',
- 'pretty_version' => '2.10.10',
- 'version' => '2.10.10.0',
- 'reference' => 'c2116b0099ef1514668e541688492130cbf16bb0',
+ 'pretty_version' => '2.10.11',
+ 'version' => '2.10.11.0',
+ 'reference' => '20d65d8e2c7ab9326af0903432e239d3d4dbba93',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -20,9 +20,9 @@
'dev_requirement' => false,
),
'themekraft/buddyforms' => array(
- 'pretty_version' => '2.10.10',
- 'version' => '2.10.10.0',
- 'reference' => 'c2116b0099ef1514668e541688492130cbf16bb0',
+ 'pretty_version' => '2.10.11',
+ 'version' => '2.10.11.0',
+ 'reference' => '20d65d8e2c7ab9326af0903432e239d3d4dbba93',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),