null,
'color' => isset( $border['color'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'color' ) ? $border['color'] : null,
'style' => isset( $border['style'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'style' ) ? $border['style'] : null,
);
$border_block_styles[ $side ] = $border_side_values;
}
}
// Collect classes and styles.
$attributes = array();
$styles = wp_style_engine_get_styles( array( 'border' => $border_block_styles ) );
if ( ! empty( $styles['classnames'] ) ) {
$attributes['class'] = $styles['classnames'];
}
if ( ! empty( $styles['css'] ) ) {
$attributes['style'] = $styles['css'];
}
return $attributes;
}
/**
* Checks whether the current block type supports the border feature requested.
*
* If the `__experimentalBorder` support flag is a boolean `true` all border
* support features are available. Otherwise, the specific feature's support
* flag nested under `experimentalBorder` must be enabled for the feature
* to be opted into.
*
* @since 5.8.0
* @access private
*
* @param WP_Block_Type $block_type Block type to check for support.
* @param string $feature Name of the feature to check support for.
* @param mixed $default_value Fallback value for feature support, defaults to false.
* @return bool Whether the feature is supported.
*/
function wp_has_border_feature_support( $block_type, $feature, $default_value = false ) {
// Check if all border support features have been opted into via `"__experimentalBorder": true`.
if ( $block_type instanceof WP_Block_Type ) {
$block_type_supports_border = isset( $block_type->supports['__experimentalBorder'] )
? $block_type->supports['__experimentalBorder']
: $default_value;
if ( true === $block_type_supports_border ) {
return true;
}
}
// Check if the specific feature has been opted into individually
// via nested flag under `__experimentalBorder`.
return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default_value );
}
// Register the block support.
WP_Block_Supports::get_instance()->register(
'border',
array(
'register_attribute' => 'wp_register_border_support',
'apply' => 'wp_apply_border_support',
)
);
!', 'wpforms-lite' );
/**
* Filters the education strings.
*
* @since 1.6.6
*
* @param array $strings Education strings.
*
* @return array
*/
return (array) apply_filters( 'wpforms_admin_education_strings', $strings );
}
/**
* Get upgrade strings.
*
* @since 1.8.8
*
* @param string $level Upgrade level.
* @param string $name Addon name.
* @param string $upgrade_utm_medium UTM medium for the upgrade link.
*
* @return array
* @noinspection HtmlUnknownTarget
*/
private function get_upgrade_strings( string $level, string $name, string $upgrade_utm_medium ): array {
// phpcs:ignore WPForms.Formatting.EmptyLineAfterFunctionDeclaration.AddEmptyLineAfterFunctionDeclaration
return [
'title' => esc_html(
sprintf( /* translators: %s - level name, either Pro or Elite. */
__( 'is a %s Feature', 'wpforms-lite' ),
$level
)
),
'title_plural' => esc_html(
sprintf( /* translators: %s - level name, either Pro or Elite. */
__( 'are a %s Feature', 'wpforms-lite' ),
$level
)
),
'message' => '' . esc_html(
sprintf( /* translators: %1$s - addon name, %2$s - level name, either Pro or Elite. */
__( 'We\'re sorry, the %1$s is not available on your plan. Please upgrade to the %2$s plan to unlock all these awesome features.', 'wpforms-lite' ),
$name,
$level
)
) . '
',
'message_plural' => '' . esc_html(
sprintf( /* translators: %1$s - addon name, %2$s - level name, either Pro or Elite. */
__( 'We\'re sorry, %1$s are not available on your plan. Please upgrade to the %2$s plan to unlock all these awesome features.', 'wpforms-lite' ),
$name,
$level
)
) . '
',
'doc' => sprintf(
'%2$s',
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/upgrade-wpforms-lite-paid-license/#installing-wpforms', $upgrade_utm_medium, '%name%' ) ),
esc_html__( 'Already purchased?', 'wpforms-lite' )
),
'button' => esc_html(
sprintf( /* translators: %s - level name, either Pro or Elite. */
__( 'Upgrade to %s', 'wpforms-lite' ),
$level
)
),
'url' => wpforms_admin_upgrade_link( $upgrade_utm_medium ),
'url_template' => wpforms_is_admin_page( 'templates' ) ? wpforms_admin_upgrade_link( 'Form Templates Subpage' ) : wpforms_admin_upgrade_link( 'builder-modal-template' ),
'modal' => wpforms_get_upgrade_modal_text( strtolower( $level ) ),
];
}
}