= 4 );
}
add_action( 'pre_current_active_plugins', 'advmceconf_warn_plugins_screen' );
function advmceconf_warn_plugins_screen( $plugins ) {
if ( advmceconf_is_mce_version_4() && get_option( 'advmceconf_version' ) < 12 ) {
?>
%s',
admin_url( 'options-general.php?page=advanced-tinymce-configuration/adv-mce-config.php' ),
__( 'Settings', 'adv-mce-config' )
);
array_unshift( $links, $settings_link );
}
return $links;
}
add_action( 'admin_menu', 'advmceconf_menu' );
function advmceconf_menu() {
if ( function_exists('add_options_page') ) {
add_options_page( 'TinyMCE Config', 'TinyMCE Config', 'manage_options', __FILE__, 'advmceconf_admin' );
}
}
function advmceconf_admin() {
global $advmceconf_show_defaults;
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( 'Invalis request' );
}
$message = '';
$options = get_option( 'advmceconf_options', array() );
$version = get_option( 'advmceconf_version', 0 );
if ( ! empty( $_POST['advmceconf_save'] ) ) {
check_admin_referer( 'advmceconf-save-options' );
$old_options = $options;
if ( empty( $_POST['advmceconf_options'] ) || ! is_array( $_POST['advmceconf_options'] ) ) {
$new_options = array();
} else {
$new_options = $_POST['advmceconf_options'];
}
if ( ! empty( $_POST['advmceconf-new'] ) && isset( $_POST['advmceconf-new-val'] ) ) {
$new_options[ $_POST['advmceconf-new'] ] = $_POST['advmceconf-new-val'];
}
foreach ( $new_options as $key => $val ) {
$key = preg_replace( '/[^a-z0-9_]+/i', '', $key );
if ( empty($key) )
continue;
if ( isset( $_POST[$key] ) && empty( $_POST[$key] ) ) {
unset( $options[$key] );
continue;
}
$val = stripslashes($val);
if ( 'true' == $val )
$options[$key] = true;
elseif ( 'false' == $val )
$options[$key] = false;
else
$options[$key] = $val;
}
if ( $options != $old_options ) {
update_option('advmceconf_options', $options);
$message = '' . __('Options saved.', 'adv-mce-config') . '
';
}
if ( $version < 12 && advmceconf_is_mce_version_4() ) {
update_option( 'advmceconf_version', 12 );
$version = 12;
} elseif ( ! $version ) {
update_option( 'advmceconf_version', 11 );
$version = 11;
}
}
?>
- true or
false. These strings are converted to boolean when saving.', 'adv-mce-config'); ?>
block_formats setting from the example in the TinyMCE documentation:', 'adv-mce-config'); ?>
; ?>)
block_formats in the Option name field and Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3 in the Value field:', 'adv-mce-config'); ?>
; ?>)
.