PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / trunk
bBlocks – Essential Gutenberg Blocks & Patterns Collection vtrunk
2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 106 releases
b-blocks / build / mailto / render.php

render.php in bBlocks – Essential Gutenberg Blocks & Patterns Collection trunk, at build/mailto/render.php

56 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $prefix = 'bBlocksMailto';
3 $id = wp_unique_id( "$prefix-" );
4 $planClass = BBlocks\Inc\Utils::isPro() ? 'pro' : 'free';
5
6 use BBlocks\Inc\GetCSS as GetCSS;
7
8 // Generate Styles
9 if( !function_exists( 'bBlocksMailtoStyle' ) ) {
10 function bBlocksMailtoStyle($attributes, $id, $prefix){
11 extract( $attributes );
12
13 $mailToSl = "#$id .$prefix";
14
15 $mailtoStyle = new BBlocksStyleGenerator();
16 $mailtoStyle::addStyle( "$mailToSl", [
17 'text-align' => $mailtoAlign
18 ] );
19 $mailtoStyle::addStyle( "$mailToSl a.mailtoButton", [
20 GetCSS::getColorsCSS( $btnColors ) => '',
21 'padding' => GetCSS::getSpaceCSS( $btnPadding ),
22 GetCSS::getBorderCSS( $btnBorder ) => '',
23 'box-shadow' => '0px 5px 20px 0px '. $btnColors['bg']
24 ] );
25 $mailtoStyle::addStyle( "$mailToSl a.mailtoButton:hover", [
26 GetCSS::getColorsCSS( $btnHovColors ) => '',
27 'box-shadow' => '0px 5px 20px 0px '. $btnHovColors['bg']
28 ] );
29
30 return GetCSS::getTypoCSS( '', $btnTypo )['googleFontLink'] .
31 GetCSS::getTypoCSS( "$mailToSl a.mailtoButton", $btnTypo )['styles'] .
32 $mailtoStyle::renderStyle();
33 }
34 }
35
36 extract( $attributes );
37 ?>
38 <div
39 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- get_block_wrapper_attributes() is properly escaped ?>
40 <?php echo get_block_wrapper_attributes( [ 'class' => $planClass ] ); ?>
41 id='<?php echo esc_attr( $id ); ?>'
42 >
43 <style>
44 <?php echo esc_html( bBlocksMailtoStyle( $attributes, $id, $prefix ) ); ?>
45 </style>
46
47 <div class='<?php echo esc_attr( $prefix ); ?>'>
48 <a href='<?php echo 'mailto:' . esc_attr( sanitize_email( $receiverMail ) ); ?>' class='mailtoui mailtoButton'>
49 <?php echo 'left' === $iconPosition && $icon['class'] ? "<i class='". esc_html( $icon['class'] ) ."'></i>" : ''; ?>
50
51 <span><?php echo wp_kses_post( $btn ); ?></span>
52
53 <?php echo 'right' === $iconPosition && $icon['class'] ? "<i class='". esc_html( $icon['class'] ) ."'></i>" : ''; ?>
54 </a>
55 </div>
56 </div>