Skip to content

Instantly share code, notes, and snippets.

@logoscreative
Created October 5, 2015 18:03
Show Gist options
  • Save logoscreative/875dd32434bc7ca05741 to your computer and use it in GitHub Desktop.
Save logoscreative/875dd32434bc7ca05741 to your computer and use it in GitHub Desktop.
Override DPP Encoding
/**
* NOTE: Unencode > in DPP Freeform CSS
*
* @since 1.0.9
*/
function evermore_unencode_dpp_css( $safe_text, $text ) {
if ( strpos( $safe_text, 'gt;' ) !== false && strpos( $safe_text, 'lt;' ) === false ) {
$safe_text = $text;
}
return $safe_text;
}
add_filter( 'esc_textarea', 'evermore_unencode_dpp_css', 10, 2 );
/**
* NOTE: Unencode > in DPP Freeform CSS before saving to option
*
* @since 1.0.9
*/
function evermore_unencode_dpp_css_save( $value, $old_value ) {
foreach ( $value as $thiskey => $thisvalue ) {
if ( strpos( $thisvalue, 'gt;' ) !== false && strpos( $thisvalue, 'lt;' ) === false ) {
$value[$thiskey] = str_replace(
array(
'>',
'>'
),
'>',
$thisvalue
);
}
}
return $value;
}
add_filter( 'pre_update_option_gppro-custom-css', 'evermore_unencode_dpp_css_save', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment