Пример #1
0
 /**
  * Load relevant Google Fonts for use in the "Custom Typography" shortcode.
  * @since  5.5.5
  * @return void
  */
 function wooframework_load_google_fonts()
 {
     global $woo_used_google_fonts;
     if ($woo_used_google_fonts && is_array($woo_used_google_fonts)) {
         $fonts = '';
         $c = 0;
         foreach ($woo_used_google_fonts as $font) {
             if ($c > 0) {
                 $fonts .= '|';
             } else {
                 ++$c;
             }
             $fonts .= $font;
         }
         if ('' != $fonts) {
             woo_shortcode_typography_loadgooglefonts($fonts, 'woo-used-google-fonts');
         }
     }
 }
<link rel="stylesheet" href="<?php 
echo $woo_shortcode_css;
?>
" media="all" />
<style>
	.post  { margin: -5px 0 0 0; }
	.shortcode-typography { display: block; margin-top: 20px; }	
</style>
<?php 
$font = trim(strip_tags($_REQUEST['font']));
// Build array of usabel typefaces.
$fonts_whitelist = array('Arial, Helvetica, sans-serif', 'Verdana, Geneva, sans-serif', '|Trebuchet MS|, Tahoma, sans-serif', 'Georgia, |Times New Roman|, serif', 'Tahoma, Geneva, Verdana, sans-serif', 'Palatino, |Palatino Linotype|, serif', '|Helvetica Neue|, Helvetica, sans-serif', 'Calibri, Candara, Segoe, Optima, sans-serif', '|Myriad Pro|, Myriad, sans-serif', '|Lucida Grande|, |Lucida Sans Unicode|, |Lucida Sans|, sans-serif', '|Arial Black|, sans-serif', '|Gill Sans|, |Gill Sans MT|, Calibri, sans-serif', 'Geneva, Tahoma, Verdana, sans-serif', 'Impact, Charcoal, sans-serif');
$fonts_whitelist = array();
// Temporarily remove the default fonts.
if (!in_array($font, $fonts_whitelist)) {
    woo_shortcode_typography_loadgooglefonts($font);
}
// End IF Statement
?>
</head>
<body>

<?php 
$shortcode = isset($_REQUEST['shortcode']) ? $_REQUEST['shortcode'] : '';
// WordPress automatically adds slashes to quotes
// http://stackoverflow.com/questions/3812128/although-magic-quotes-are-turned-off-still-escaped-strings
$shortcode = stripslashes($shortcode);
echo do_shortcode($shortcode);
do_action('woo_shortcode_generator_preview_footer');
?>
<script type="text/javascript">