upgraded to 4.14

This commit is contained in:
2021-12-20 18:06:11 +00:00
parent 80f1e87db9
commit 3166bdf932
153 changed files with 5204 additions and 1003 deletions

View File

@ -1639,6 +1639,10 @@ class ET_Core_Portability {
* @return array
*/
protected function get_data_images( $data, $force = false ) {
if ( empty( $data ) ) {
return array();
}
$images = array();
$images_src = array();
$basenames = array(
@ -1663,8 +1667,19 @@ class ET_Core_Portability {
}
foreach ( $data as $value ) {
if ( is_array( $value ) || is_object( $value ) ) {
$images = array_merge( $images, $this->get_data_images( (array) $value ) );
// If the $value is an object, but not a Post object then it's unlikely to contain any image data.
if ( is_object( $value ) && ! $value instanceof WP_Post ) {
continue;
}
if ( is_array( $value ) ) {
$images = array_merge( $images, $this->get_data_images( $value ) );
$value = implode( '|', $value );
} elseif ( $value instanceof WP_Post ) {
// If the $value is a Post object, we need only the post content.
$value = (array) $value->post_content;
$images = array_merge( $images, $this->get_data_images( $value ) );
$value = implode( '|', $value );
}
// Extract images from HTML or shortcodes.

View File

@ -67,8 +67,24 @@ class ET_Core_API_Spam_ReCaptcha extends ET_Core_API_Spam_Provider {
}
public function is_enabled() {
return isset( $this->data['site_key'], $this->data['secret_key'] )
$has_recaptcha_module = true;
if ( class_exists( 'ET_Dynamic_Assets' ) ) {
$et_dynamic_module_framework = et_builder_dynamic_module_framework();
$enabled = et_builder_is_frontend() && 'on' === $et_dynamic_module_framework;
if ( $enabled ) {
$et_dynamic_assets = ET_Dynamic_Assets::init();
$saved_shortcodes = $et_dynamic_assets->get_saved_page_shortcodes();
$recaptcha_modules = array( 'et_pb_contact_form', 'et_pb_signup' );
$has_recaptcha_module = ! empty( array_intersect( $saved_shortcodes, $recaptcha_modules ) );
}
}
$has_key = isset( $this->data['site_key'], $this->data['secret_key'] )
&& et_()->all( array( $this->data['site_key'], $this->data['secret_key'] ) );
return $has_key && $has_recaptcha_module;
}
/**

View File

@ -83,7 +83,7 @@ class ET_Core_Cache_Directory {
}
$this->can_write = $can_write || $can_create;
$this->path = $path;
$this->path = et_()->normalize_path( $path );
$this->url = $url;
$this->_maybe_adjust_path_for_multisite( $uploads_dir_info );

View File

@ -1041,6 +1041,46 @@ class ET_Core_Data_Utils {
$buffer[15]
);
}
/**
* Append/Prepend to comma separated selectors.
*
* Example:
*
* @see UtilsTest::testAppendPrependCommaSeparatedSelectors()
*
* @param string $css_selector Comma separated CSS selectors.
* @param string $value Value to append/prepend.
* @param string $prefix_suffix Values can be `prefix` or `suffix`.
* @param bool $is_space_required Is space required? // phpcs:ignore Squiz.Commenting.FunctionComment.ParamCommentFullStop -- Respecting punctuation.
*
* @return string
*/
public function append_prepend_comma_separated_selectors(
$css_selector,
$value,
$prefix_suffix,
$is_space_required = true
) {
$css_selectors = explode( ',', $css_selector );
$css_selectors_processed = array();
$is_prefix = 'prefix' === $prefix_suffix;
foreach ( $css_selectors as $selector ) {
$selector = rtrim( ltrim( $selector ) );
if ( $is_prefix && $is_space_required ) {
$css_selectors_processed[] = sprintf( '%2$s %1$s', $selector, $value );
} elseif ( $is_prefix && ! $is_space_required ) {
$css_selectors_processed[] = sprintf( '%2$s%1$s', $selector, $value );
} elseif ( ! $is_prefix && $is_space_required ) {
$css_selectors_processed[] = sprintf( '%1$s %2$s', $selector, $value );
} elseif ( ! $is_prefix && ! $is_space_required ) {
$css_selectors_processed[] = sprintf( '%1$s%2$s', $selector, $value );
}
}
return implode( ',', $css_selectors_processed );
}
}