plugin updates
This commit is contained in:
@@ -124,12 +124,14 @@ if ( ! class_exists( 'acf_pro' ) ) :
|
||||
wp_register_style( 'acf-pro-input', acf_get_url( 'assets/build/css/pro/acf-pro-input.css' ), array( 'acf-input' ), $version );
|
||||
wp_register_style( 'acf-pro-field-group', acf_get_url( 'assets/build/css/pro/acf-pro-field-group.css' ), array( 'acf-input' ), $version );
|
||||
|
||||
$to_localize = array(
|
||||
'isLicenseActive' => acf_pro_is_license_active(),
|
||||
'isLicenseExpired' => acf_pro_is_license_expired(),
|
||||
);
|
||||
if ( is_admin() ) {
|
||||
$to_localize = array(
|
||||
'isLicenseActive' => acf_pro_is_license_active(),
|
||||
'isLicenseExpired' => acf_pro_is_license_expired(),
|
||||
);
|
||||
|
||||
acf_localize_data( $to_localize );
|
||||
acf_localize_data( $to_localize );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// There are many ways to WordPress.
|
||||
@@ -396,9 +396,8 @@ if ( ! class_exists( 'ACF_Admin_UI_Options_Page' ) ) :
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ensure that the current item is not an ACF page or that ACF pages are an empty array before adding to others.
|
||||
if ( ! empty( $acf_parent_page_choices['acfOptionsPages'] ) && ! in_array( $page_name, $acf_parent_page_choices['acfOptionsPages'], true ) || empty( $acf_parent_page_choices['acfOptionsPages'] ) ) {
|
||||
// If matched menu slug is not in the list add it to others.
|
||||
// If the current item is not an ACF-created options page, add it to the "Others" list.
|
||||
if ( empty( $acf_parent_page_choices['acfOptionsPages'][ $item[2] ] ) ) {
|
||||
$acf_parent_page_choices['Others'][ $item[2] ] = acf_esc_html( $sanitized_name );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// There are many ways to WordPress.
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// There are many ways to WordPress.
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// There are many ways to WordPress.
|
||||
@@ -513,6 +513,7 @@ function acf_get_block_back_compat_attribute_key_array() {
|
||||
* @return string The block HTML.
|
||||
*/
|
||||
function acf_render_block_callback( $attributes, $content = '', $wp_block = null ) {
|
||||
|
||||
$is_preview = false;
|
||||
$post_id = get_the_ID();
|
||||
|
||||
@@ -680,6 +681,7 @@ function acf_rendered_block( $attributes, $content = '', $is_preview = false, $p
|
||||
* @return void|string
|
||||
*/
|
||||
function acf_render_block( $attributes, $content = '', $is_preview = false, $post_id = 0, $wp_block = null, $context = false ) {
|
||||
|
||||
// Prepare block ensuring all settings and attributes exist.
|
||||
$block = acf_prepare_block( $attributes );
|
||||
if ( ! $block ) {
|
||||
@@ -868,7 +870,8 @@ function acf_enqueue_block_type_assets( $block_type ) {
|
||||
*/
|
||||
function acf_ajax_fetch_block() {
|
||||
// Validate ajax request.
|
||||
if ( ! acf_verify_ajax() ) {
|
||||
$render_capability = apply_filters( 'acf/blocks/render_capability', 'edit_posts' );
|
||||
if ( ! acf_verify_ajax() || ! current_user_can( $render_capability ) ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
||||
@@ -731,6 +731,7 @@ if ( ! class_exists( 'acf_field_clone' ) ) :
|
||||
'ajax' => 1,
|
||||
'ajax_action' => 'acf/fields/clone/query',
|
||||
'placeholder' => '',
|
||||
'nonce' => wp_create_nonce( 'acf/fields/clone/query' ),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -929,19 +930,16 @@ if ( ! class_exists( 'acf_field_clone' ) ) :
|
||||
|
||||
|
||||
/**
|
||||
* description
|
||||
* AJAX handler for getting potential fields to clone.
|
||||
*
|
||||
* @type function
|
||||
* @date 17/06/2016
|
||||
* @since 5.3.8
|
||||
* @since 5.3.8
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @return void
|
||||
*/
|
||||
function ajax_query() {
|
||||
public function ajax_query() {
|
||||
$nonce = acf_request_arg( 'nonce', '' );
|
||||
|
||||
// validate
|
||||
if ( ! acf_verify_ajax() ) {
|
||||
if ( ! acf_verify_ajax( $nonce, 'acf/fields/clone/query' ) ) {
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,32 +74,28 @@ if ( ! class_exists( 'acf_field_gallery' ) ) :
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* description
|
||||
* AJAX handler for retrieving and rendering an attachment.
|
||||
*
|
||||
* @type function
|
||||
* @date 13/12/2013
|
||||
* @since 5.0.0
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @return void
|
||||
*/
|
||||
function ajax_get_attachment() {
|
||||
|
||||
// Validate requrest.
|
||||
if ( ! acf_verify_ajax() ) {
|
||||
die();
|
||||
}
|
||||
|
||||
public function ajax_get_attachment() {
|
||||
// Get args.
|
||||
$args = acf_request_args(
|
||||
array(
|
||||
'id' => 0,
|
||||
'field_key' => '',
|
||||
'nonce' => '',
|
||||
)
|
||||
);
|
||||
|
||||
// Validate request.
|
||||
if ( ! acf_verify_ajax( $args['nonce'], $args['field_key'] ) ) {
|
||||
die();
|
||||
}
|
||||
|
||||
// Cast args.
|
||||
$args['id'] = (int) $args['id'];
|
||||
|
||||
@@ -119,25 +115,22 @@ if ( ! class_exists( 'acf_field_gallery' ) ) :
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* description
|
||||
* AJAX handler for updating an attachment.
|
||||
*
|
||||
* @type function
|
||||
* @date 13/12/2013
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @return void
|
||||
*/
|
||||
function ajax_update_attachment() {
|
||||
public function ajax_update_attachment() {
|
||||
$args = acf_request_args(
|
||||
array(
|
||||
'nonce' => '',
|
||||
'field_key' => '',
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! isset( $_POST['nonce'] ) ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
// validate nonce
|
||||
if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'acf_nonce' ) ) {
|
||||
if ( ! acf_verify_ajax( $args['nonce'], $args['field_key'] ) ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
@@ -196,21 +189,14 @@ if ( ! class_exists( 'acf_field_gallery' ) ) :
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* description
|
||||
* AJAX handler for getting the attachment sort order.
|
||||
*
|
||||
* @type function
|
||||
* @date 13/12/2013
|
||||
* @since 5.0.0
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @return void
|
||||
*/
|
||||
function ajax_get_sort_order() {
|
||||
|
||||
// vars
|
||||
$r = array();
|
||||
public function ajax_get_sort_order() {
|
||||
$order = 'DESC';
|
||||
$args = acf_parse_args(
|
||||
$_POST, // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified below.
|
||||
@@ -222,23 +208,22 @@ if ( ! class_exists( 'acf_field_gallery' ) ) :
|
||||
)
|
||||
);
|
||||
|
||||
// validate
|
||||
if ( ! wp_verify_nonce( $args['nonce'], 'acf_nonce' ) ) {
|
||||
if ( ! acf_verify_ajax( $args['nonce'], $args['field_key'] ) ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
// reverse
|
||||
if ( $args['sort'] == 'reverse' ) {
|
||||
// Reverse order.
|
||||
if ( $args['sort'] === 'reverse' ) {
|
||||
$ids = array_reverse( $args['ids'] );
|
||||
|
||||
wp_send_json_success( $ids );
|
||||
}
|
||||
|
||||
if ( $args['sort'] == 'title' ) {
|
||||
// Ascending order.
|
||||
if ( $args['sort'] === 'title' ) {
|
||||
$order = 'ASC';
|
||||
}
|
||||
|
||||
// find attachments (DISTINCT POSTS)
|
||||
// Find attachments (DISTINCT POSTS).
|
||||
$ids = get_posts(
|
||||
array(
|
||||
'post_type' => 'attachment',
|
||||
@@ -251,12 +236,10 @@ if ( ! class_exists( 'acf_field_gallery' ) ) :
|
||||
)
|
||||
);
|
||||
|
||||
// success
|
||||
if ( ! empty( $ids ) ) {
|
||||
wp_send_json_success( $ids );
|
||||
}
|
||||
|
||||
// failure
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
@@ -403,6 +386,7 @@ if ( ! class_exists( 'acf_field_gallery' ) ) :
|
||||
'data-mime_types' => $field['mime_types'],
|
||||
'data-insert' => $field['insert'],
|
||||
'data-columns' => 4,
|
||||
'data-nonce' => wp_create_nonce( $field['key'] ),
|
||||
);
|
||||
|
||||
// Set gallery height with deafult of 400px and minimum of 200px.
|
||||
|
||||
@@ -1034,11 +1034,6 @@ if ( ! class_exists( 'acf_field_repeater' ) ) :
|
||||
* @return void|WP_Error
|
||||
*/
|
||||
public function ajax_get_rows() {
|
||||
if ( ! acf_verify_ajax() ) {
|
||||
$error = array( 'error' => __( 'Invalid nonce.', 'acf' ) );
|
||||
wp_send_json_error( $error, 401 );
|
||||
}
|
||||
|
||||
$args = acf_request_args(
|
||||
array(
|
||||
'field_name' => '',
|
||||
@@ -1046,9 +1041,15 @@ if ( ! class_exists( 'acf_field_repeater' ) ) :
|
||||
'post_id' => 0,
|
||||
'rows_per_page' => 0,
|
||||
'refresh' => false,
|
||||
'nonce' => '',
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! acf_verify_ajax( $args['nonce'], $args['field_key'] ) ) {
|
||||
$error = array( 'error' => __( 'Invalid nonce.', 'acf' ) );
|
||||
wp_send_json_error( $error, 401 );
|
||||
}
|
||||
|
||||
if ( '' === $args['field_name'] || '' === $args['field_key'] ) {
|
||||
$error = array( 'error' => __( 'Invalid field key or name.', 'acf' ) );
|
||||
wp_send_json_error( $error, 404 );
|
||||
|
||||
@@ -164,6 +164,7 @@ class ACF_Repeater_Table {
|
||||
$div['data-per_page'] = $this->field['rows_per_page'];
|
||||
$div['data-total_rows'] = $this->field['total_rows'];
|
||||
$div['data-orig_name'] = $this->field['orig_name'];
|
||||
$div['data-nonce'] = wp_create_nonce( $this->field['key'] );
|
||||
}
|
||||
|
||||
if ( empty( $this->value ) ) {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// There are many ways to WordPress.
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// There are many ways to WordPress.
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// There are many ways to WordPress.
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// There are many ways to WordPress.
|
||||
Reference in New Issue
Block a user