Skip to content

Instantly share code, notes, and snippets.

@seebeen
Last active March 23, 2021 14:21
Show Gist options
  • Save seebeen/cf2e646d12f8cdadf9e7765171dd396d to your computer and use it in GitHub Desktop.
Save seebeen/cf2e646d12f8cdadf9e7765171dd396d to your computer and use it in GitHub Desktop.
Porto Indian stupidity #wordpress #shitty-indian-code
<?php
function porto_check_theme_options() {
// check default options
global $porto_settings;
// ob_start();
// include PORTO_ADMIN . '/theme_options/default_options.php';
// $options = ob_get_clean();
// $porto_default_settings = json_decode( $options, true );
// Begin Indian code fix
$options = file_get_contents (PORTO_ADMIN. '/theme_options/default_options.php');
$porto_default_settings = json_decode($options, true);
unset ($options);
// End indian code fix
foreach ( $porto_default_settings as $key => $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $key1 => $value1 ) {
if ( 'google' != $key1 && ( ! isset( $porto_settings[ $key ][ $key1 ] ) || '' === $porto_settings[ $key ][ $key1 ] ) ) {
if ( ! isset( $porto_settings[ $key ] ) || empty( $porto_settings[ $key ] ) ) {
$porto_settings[ $key ] = array( $key1 => '' );
}
$porto_settings[ $key ][ $key1 ] = $porto_default_settings[ $key ][ $key1 ];
}
}
} else {
if ( ! isset( $porto_settings[ $key ] ) ) {
$porto_settings[ $key ] = $porto_default_settings[ $key ];
}
}
}
return $porto_settings;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment