function powerpress_format_itunes_value($value, $tag) { if (!defined('DB_CHARSET') || DB_CHARSET != 'utf8') { // Check if the string is UTF-8 $value = utf8_encode($value); } // If it is not, convert to UTF-8 then decode it... // Code added to solve issue with KimiliFlashEmbed plugin and also remove the shortcode for the WP Audio Player // 99.9% of the time this code will not be necessary $value = preg_replace("/\\[(kml_(flash|swf)embed|audio\\:)\\b(.*?)(?:(\\/))?(\\]|\$)/isu", '', $value); if (version_compare("5", phpversion(), ">")) { $value = preg_replace('/ /ui', ' ', $value); } else { $value = @html_entity_decode($value, ENT_COMPAT, 'UTF-8'); } // Remove any additional entities such as $value = preg_replace('/&/ui', '&', $value); // Best we can do for PHP4. precaution in case it didn't get removed from function above. return esc_html(powerpress_trim_itunes_value($value, $tag)); }
function powerpress_format_itunes_value($value, $tag) { if (!defined('POWERPRESS_DISABLE_ITUNES_UTF8')) { if (!defined('DB_CHARSET') || DB_CHARSET != 'utf8') { // Check if the string is UTF-8 $value = utf8_encode($value); } // If it is not, convert to UTF-8 then decode it... } // Code added to solve issue with KimiliFlashEmbed plugin and also remove the shortcode for the WP Audio Player // 99.9% of the time this code will not be necessary $value = preg_replace("/\\[(kml_(flash|swf)embed|audio\\:)\\b(.*?)(?:(\\/))?(\\]|\$)/isu", '', $value); $value = @html_entity_decode($value, ENT_COMPAT, 'UTF-8'); // Remove any additional entities such as $value = preg_replace('/&/ui', '&', $value); // Precaution in case it didn't get removed from function above. if ($tag == 'summary-enhanced') { return powerpress_trim_itunes_value($value, $tag); } return esc_html(powerpress_trim_itunes_value($value, $tag)); }
function powerpress_format_itunes_value($value, $tag) { if (!defined('POWERPRESS_DISABLE_ITUNES_UTF8') || POWERPRESS_DISABLE_ITUNES_UTF8 == false) { global $wpdb; switch ($wpdb->charset) { case 'utf8': break; case 'utf8mb3': break; case 'utf8mb4': break; default: //if( defined('DB_CHARSET') && DB_CHARSET == 'utf8' ) { // break; } //if( defined('DB_CHARSET') && DB_CHARSET == 'utf8mb4' ) { // break; } // preg_match fails when it encounters invalid UTF8 in $string if (1 !== @preg_match('/^./us', $value)) { $value = utf8_encode($value); // If it is not, convert to UTF-8 then decode it... } } } // Code added to solve issue with KimiliFlashEmbed plugin and also remove the shortcode for the WP Audio Player // 99.9% of the time this code will not be necessary $value = preg_replace("/\\[(kml_(flash|swf)embed|audio\\:)\\b(.*?)(?:(\\/))?(\\]|\$)/isu", '', $value); $value = @html_entity_decode($value, ENT_COMPAT, 'UTF-8'); // Remove any additional entities such as $value = preg_replace('/&/ui', '&', $value); // Precaution in case it didn't get removed from function above. if ($tag == 'summary-enhanced') { return powerpress_trim_itunes_value($value, $tag); } return esc_html(powerpress_trim_itunes_value($value, $tag)); }