- review dynamic_css();

This commit is contained in:
Mykyta Synelnikov
2023-06-26 20:46:23 +03:00
parent 8749b2cf5e
commit 03e5424867
7 changed files with 118 additions and 129 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( empty( $args['css_profile_card_bg'] ) && empty( $args['css_card_thickness'] ) &&
empty( $args['css_profile_card_text'] ) && empty( $args['css_card_bordercolor'] ) &&
empty( $args['css_img_bordercolor'] ) ) {
return;
}
?>
<style>
<?php if ( ! empty( $args['css_profile_card_bg'] ) ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?> .um-member {
background: <?php echo esc_attr( $args['css_profile_card_bg'] ); ?>;
}
<?php } ?>
<?php if ( ! empty( $args['css_card_thickness'] ) ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?> .um-member {
border-width: <?php echo esc_attr( $args['css_card_thickness'] ); ?>;
}
<?php } ?>
<?php if ( ! empty( $args['css_profile_card_text'] ) ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?> .um-member-card * {
color: <?php echo esc_attr( $args['css_profile_card_text'] ); ?>;
}
<?php } ?>
<?php if ( ! empty( $args['css_card_bordercolor'] ) ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?> .um-member {
border-color: <?php echo esc_attr( $args['css_card_bordercolor'] ); ?>;
}
<?php } ?>
<?php if ( ! empty( $args['css_img_bordercolor'] ) ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?> .um-member-photo img {
border-color: <?php echo esc_attr( $args['css_img_bordercolor'] ); ?>;
}
<?php } ?>
</style>
+21
View File
@@ -0,0 +1,21 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $args['max_width'] ) && ! isset( $args['align'] ) ) {
return;
}
?>
<style>
<?php if ( isset( $args['max_width'] ) && $args['max_width'] ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?>.um {
max-width: <?php echo esc_attr( $args['max_width'] ); ?>;
}
<?php } ?>
<?php if ( isset( $args['align'] ) && in_array( $args['align'], array( 'left', 'right' ), true ) ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?>.um {
margin-<?php echo esc_attr( $args['align'] ); ?>: 0px !important;
}
<?php } ?>
</style>
+37
View File
@@ -0,0 +1,37 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $args['photosize'] ) || 'original' === $args['photosize'] ) {
$args['photosize'] = um_get_metadefault( 'profile_photosize' ); // Cannot be more than metadefault value.
}
$args['photosize'] = absint( $args['photosize'] );
$photosize_up = ( $args['photosize'] / 2 ) + 10;
$meta_padding = ( $args['photosize'] + 60 ) . 'px';
?>
<style>
<?php if ( ! empty( $args['area_max_width'] ) ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?>.um .um-profile-body {
max-width: <?php echo esc_attr( $args['area_max_width'] ); ?>;
}
<?php } ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?>.um .um-profile-photo a.um-profile-photo-img {
width: <?php echo esc_attr( $args['photosize'] ); ?>px;
height: <?php echo esc_attr( $args['photosize'] ); ?>px;
}
.um-<?php echo esc_attr( $args['form_id'] ); ?>.um .um-profile-photo a.um-profile-photo-img {
top: -<?php echo esc_attr( $photosize_up ); ?>px;
}
<?php if ( is_rtl() ) { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?>.um .um-profile-meta {
padding-right: <?php echo esc_attr( $meta_padding ); ?>;
}
<?php } else { ?>
.um-<?php echo esc_attr( $args['form_id'] ); ?>.um .um-profile-meta {
padding-left: <?php echo esc_attr( $meta_padding ); ?>;
}
<?php } ?>
</style>
-45
View File
@@ -1,45 +0,0 @@
<style type="text/css">
<?php
if ( isset( $css_profile_card_bg ) && ! empty( $css_profile_card_bg ) ) {
print ".um-$form_id .um-member {
background: $css_profile_card_bg;
}";
}
if ( isset( $css_card_thickness ) && ! empty( $css_card_thickness ) ) {
print ".um-$form_id .um-member {
border-width: $css_card_thickness;
}";
}
if ( isset( $css_profile_card_text ) && ! empty( $css_profile_card_text ) ) {
print ".um-$form_id .um-member-card * {
color: $css_profile_card_text;
}";
}
if ( isset( $css_card_bordercolor ) && ! empty( $css_card_bordercolor ) ) {
print ".um-$form_id .um-member {
border-color: $css_card_bordercolor;
}";
}
if ( isset( $css_img_bordercolor ) && ! empty( $css_img_bordercolor ) ) {
print ".um-$form_id .um-member-photo img {
border-color: $css_img_bordercolor;
}";
}
?>
</style>
-17
View File
@@ -1,17 +0,0 @@
<style type="text/css">
<?php
if ( isset( $max_width ) && $max_width ) {
print ".um-$form_id.um {
max-width: {$max_width};
}";
}
if ( isset( $align ) && in_array( $align, array( 'left', 'right' ) ) ) {
print ".um-$form_id.um {
margin-$align: 0px !important;
}";
}
?>
</style>
-49
View File
@@ -1,49 +0,0 @@
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
<style type="text/css">
<?php if ( ! $photosize || $photosize == 'original' ) {
//cannot be more than metadefault value
$photosize = um_get_metadefault( 'profile_photosize' );
}
$photosize = filter_var( $photosize, FILTER_SANITIZE_NUMBER_INT );
$photosize_up = ( $photosize / 2 ) + 10;
$meta_padding = ( $photosize + 60 ) . 'px';
if ( $area_max_width ) {
print "
.um-$form_id.um .um-profile-body {
max-width: $area_max_width;
}
";
}
print "
.um-$form_id.um .um-profile-photo a.um-profile-photo-img {
width: ".$photosize."px;
height: ".$photosize."px;
}
";
print "
.um-$form_id.um .um-profile-photo a.um-profile-photo-img {
top: -".$photosize_up."px;
}
";
if ( is_rtl() ) {
print "
.um-$form_id.um .um-profile-meta {
padding-right: $meta_padding;
}
";
} else {
print "
.um-$form_id.um .um-profile-meta {
padding-left: $meta_padding;
}
";
}
?>
</style>