Support » Plugin: Letter Avatars » Invalid CSS if updating from older version

  • The plugin creates invalid CSS if updated from an older version which did not have the option for “uppercase” letters yet:

    		.sgi-letter-avatar > span{
    				display:block;
    				text-transform: ;
    				font-size:32px;
    				
    			}

    The reason for this is lib/ltav-frontend.php, line 240-255:

    		$css .= sprintf(
    			".sgi-letter-avatar{
    				text-align:center;
    				%s
    			}
    			.sgi-letter-avatar > span{
    				display:block;
    				text-transform: %s;
    				font-size:%spx;
    				%s
    			}",
    			$shape,
    			$style_opts['case'],
    			$font_opts['font_size'],
    			$gfont
    		);

    If one updated the plugin from an earlier version, the array element $style_opts['case'] can be an empty string since the setting for “case” does not exist yet! In this case, no text-transform is output at all.

    Workaround: add a default value for $style_opts['case']:

    		if ($style_opts['case'] == '') {
    			$style_opts['case'] = 'uppercase';
    		}
    
    		$css .= sprintf(
    			".sgi-letter-avatar{
    				text-align:center;
    				%s
    			}
    			.sgi-letter-avatar > span{
    				display:block;
    				text-transform: %s;
    				font-size:%spx;
    				%s
    			}",
    			$shape,
    			$style_opts['case'],
    			$font_opts['font_size'],
    			$gfont
    		);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.