Version Description
Download this release
Release Info
Developer | jim912 |
Plugin | PS Disable Auto Formatting |
Version | 1.0.10 |
Comparing to | |
See all releases |
Code changes from version 1.0.9 to 1.0.10
- ps_disable_auto_formatting.php +26 -26
- readme.txt +6 -3
ps_disable_auto_formatting.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: PS Disable Auto Formatting
|
4 |
Plugin URI: http://www.web-strategy.jp/wp_plugin/ps_disable_auto_formatting/
|
5 |
Description: PS Disable Auto Formatting is able to disable function auto formatting (wpautop) and save <p> and <br /> formatted content.
|
6 |
-
Version: 1.0.
|
7 |
Author: Hitoshi Omagari,
|
8 |
Author URI: http://www.web-strategy.jp/
|
9 |
License: GPLv2 or later
|
@@ -12,10 +12,10 @@ License: GPLv2 or later
|
|
12 |
class ps_disable_auto_formatting {
|
13 |
|
14 |
var $setting_items = array(
|
15 |
-
'content formatting'
|
16 |
-
'comment formatting'
|
17 |
-
'excerpt formatting'
|
18 |
-
'term description formatting'
|
19 |
);
|
20 |
|
21 |
var $mce_version = '20080121';
|
@@ -24,14 +24,14 @@ function __construct() {
|
|
24 |
global $wp_version;
|
25 |
|
26 |
if ( version_compare( $wp_version, '2.5', '>=' ) ) {
|
27 |
-
add_action( 'init'
|
28 |
-
add_action( 'admin_menu'
|
29 |
-
add_filter( 'print_scripts_array'
|
30 |
-
add_filter( 'wp_insert_post_data'
|
31 |
-
add_action( 'media_buttons'
|
32 |
-
add_action( 'media_buttons'
|
33 |
} else {
|
34 |
-
add_action('admin_notices'
|
35 |
}
|
36 |
}
|
37 |
|
@@ -140,23 +140,23 @@ function delete_filtering_wp_richedit_pre() {
|
|
140 |
function check_edit_mode_and_add_richedit_pre() {
|
141 |
global $wp_filter;
|
142 |
if ( isset( $wp_filter['the_editor_content'][10]['wp_richedit_pre'] ) ) {
|
143 |
-
add_filter( 'the_editor_content', array(
|
144 |
}
|
145 |
}
|
146 |
|
147 |
|
148 |
function ps_richedit_pre( $text ) {
|
149 |
-
if ( empty($text) ) return apply_filters('richedit_pre', '');
|
150 |
|
151 |
-
$output = convert_chars($text);
|
152 |
-
$output = htmlspecialchars($output, ENT_NOQUOTES);
|
153 |
|
154 |
-
return apply_filters('richedit_pre', $output);
|
155 |
}
|
156 |
|
157 |
|
158 |
function add_disable_formatting_setting_page() {
|
159 |
-
add_options_page( 'PS Disable Auto Formatting', __( 'Auto Formatting', 'ps_disable_auto_formatting' ), 'manage_options', basename( __FILE__ ), array(
|
160 |
}
|
161 |
|
162 |
|
@@ -192,7 +192,7 @@ AND `post_modified` < '$time_limit'
|
|
192 |
do_action( 'pre_post_update', $post->ID );
|
193 |
if ( false === $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post->ID ) ) ) {
|
194 |
if ( $wp_error ) {
|
195 |
-
$error_mes = new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
|
196 |
break;
|
197 |
} else {
|
198 |
$error_mes = __( 'Database is not found.', 'ps_disable_auto_formatting' );
|
@@ -212,12 +212,12 @@ AND `post_modified` < '$time_limit'
|
|
212 |
}
|
213 |
} else {
|
214 |
if ( isset( $_POST['ps_disable_auto_formatting'] ) ) {
|
215 |
-
$post_data =
|
216 |
} else {
|
217 |
$post_data = array();
|
218 |
}
|
219 |
foreach ( $post_data as $key => $func ) {
|
220 |
-
if ( ! in_array( $func, $this->setting_items) ) {
|
221 |
unset( $_POST['ps_disable_auto_formatting'][$key] );
|
222 |
}
|
223 |
}
|
@@ -234,7 +234,7 @@ AND `post_modified` < '$time_limit'
|
|
234 |
<h2><?php _e( 'Auto Formatting', 'ps_disable_auto_formatting' ); ?></h2>
|
235 |
<?php if ( isset( $ret ) && $ret ) { ?>
|
236 |
<div id="message" class="updated">
|
237 |
-
<p><?php _e('The settings has changed successfully.', 'ps_disable_auto_formatting' );?></p>
|
238 |
</div>
|
239 |
<?php } elseif ( isset( $batch_ret ) && $batch_ret ) { ?>
|
240 |
<div id="message" class="updated">
|
@@ -242,7 +242,7 @@ AND `post_modified` < '$time_limit'
|
|
242 |
</div>
|
243 |
<?php } elseif ( isset( $error_mes ) && $error_mes ) { ?>
|
244 |
<div id="notice" class="error">
|
245 |
-
<p><?php echo
|
246 |
</div>
|
247 |
<?php } elseif ( isset( $_POST['ps_disable_auto_formatting'] ) && $_POST['ps_disable_auto_formatting'] && isset( $ret ) && ! $ret ) { ?>
|
248 |
<div id="notice" class="error">
|
@@ -256,8 +256,8 @@ AND `post_modified` < '$time_limit'
|
|
256 |
<tr>
|
257 |
<th><?php _e( $id, 'ps_disable_auto_formatting' ); ?></th>
|
258 |
<td>
|
259 |
-
<input type="checkbox" id="ps_disable_auto_formatting_<?php echo $func ?>" name="ps_disable_auto_formatting[]" value="<?php echo $func ?>"<?php if ( in_array( $func, $this->option_settings ) ) { echo ' checked="checked"'; } ?> />
|
260 |
-
<label for="ps_disable_auto_formatting_<?php echo $func ?>"><?php _e( 'disable', 'ps_disable_auto_formatting' ); ?></label>
|
261 |
</td>
|
262 |
</tr>
|
263 |
<?php } ?>
|
@@ -309,4 +309,4 @@ function version_too_old() {
|
|
309 |
|
310 |
} // class end
|
311 |
|
312 |
-
$ps_disable_auto_formatting
|
3 |
Plugin Name: PS Disable Auto Formatting
|
4 |
Plugin URI: http://www.web-strategy.jp/wp_plugin/ps_disable_auto_formatting/
|
5 |
Description: PS Disable Auto Formatting is able to disable function auto formatting (wpautop) and save <p> and <br /> formatted content.
|
6 |
+
Version: 1.0.10
|
7 |
Author: Hitoshi Omagari,
|
8 |
Author URI: http://www.web-strategy.jp/
|
9 |
License: GPLv2 or later
|
12 |
class ps_disable_auto_formatting {
|
13 |
|
14 |
var $setting_items = array(
|
15 |
+
'content formatting' => 'the_content',
|
16 |
+
'comment formatting' => 'comment_text',
|
17 |
+
'excerpt formatting' => 'the_excerpt',
|
18 |
+
'term description formatting' => 'term_description',
|
19 |
);
|
20 |
|
21 |
var $mce_version = '20080121';
|
24 |
global $wp_version;
|
25 |
|
26 |
if ( version_compare( $wp_version, '2.5', '>=' ) ) {
|
27 |
+
add_action( 'init' , array( $this, 'disable_auto_formatting_init' ) );
|
28 |
+
add_action( 'admin_menu' , array( $this, 'add_disable_formatting_setting_page') );
|
29 |
+
add_filter( 'print_scripts_array' , array( $this, 'rewrite_default_script' ) );
|
30 |
+
add_filter( 'wp_insert_post_data' , array( $this, 'formatting_quickpress_post' ) );
|
31 |
+
add_action( 'media_buttons' , array( $this, 'check_edit_mode_and_add_richedit_pre' ), 9 );
|
32 |
+
add_action( 'media_buttons' , array( $this, 'delete_filtering_wp_richedit_pre' ) );
|
33 |
} else {
|
34 |
+
add_action('admin_notices' , array( $this, 'version_too_old' ) );
|
35 |
}
|
36 |
}
|
37 |
|
140 |
function check_edit_mode_and_add_richedit_pre() {
|
141 |
global $wp_filter;
|
142 |
if ( isset( $wp_filter['the_editor_content'][10]['wp_richedit_pre'] ) ) {
|
143 |
+
add_filter( 'the_editor_content', array( $this, 'ps_richedit_pre' ) );
|
144 |
}
|
145 |
}
|
146 |
|
147 |
|
148 |
function ps_richedit_pre( $text ) {
|
149 |
+
if ( empty($text) ) return apply_filters( 'richedit_pre', '' );
|
150 |
|
151 |
+
$output = convert_chars( $text );
|
152 |
+
$output = htmlspecialchars( $output, ENT_NOQUOTES );
|
153 |
|
154 |
+
return apply_filters( 'richedit_pre', $output );
|
155 |
}
|
156 |
|
157 |
|
158 |
function add_disable_formatting_setting_page() {
|
159 |
+
add_options_page( 'PS Disable Auto Formatting', __( 'Auto Formatting', 'ps_disable_auto_formatting' ), 'manage_options', basename( __FILE__ ), array( $this, 'output_disable_formatting_setting_page') );
|
160 |
}
|
161 |
|
162 |
|
192 |
do_action( 'pre_post_update', $post->ID );
|
193 |
if ( false === $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post->ID ) ) ) {
|
194 |
if ( $wp_error ) {
|
195 |
+
$error_mes = new WP_Error( 'db_update_error', __( 'Could not update post in the database' ), $wpdb->last_error );
|
196 |
break;
|
197 |
} else {
|
198 |
$error_mes = __( 'Database is not found.', 'ps_disable_auto_formatting' );
|
212 |
}
|
213 |
} else {
|
214 |
if ( isset( $_POST['ps_disable_auto_formatting'] ) ) {
|
215 |
+
$post_data = wp_unslash( $_POST['ps_disable_auto_formatting'] );
|
216 |
} else {
|
217 |
$post_data = array();
|
218 |
}
|
219 |
foreach ( $post_data as $key => $func ) {
|
220 |
+
if ( ! in_array( $func, $this->setting_items ) ) {
|
221 |
unset( $_POST['ps_disable_auto_formatting'][$key] );
|
222 |
}
|
223 |
}
|
234 |
<h2><?php _e( 'Auto Formatting', 'ps_disable_auto_formatting' ); ?></h2>
|
235 |
<?php if ( isset( $ret ) && $ret ) { ?>
|
236 |
<div id="message" class="updated">
|
237 |
+
<p><?php _e( 'The settings has changed successfully.', 'ps_disable_auto_formatting' );?></p>
|
238 |
</div>
|
239 |
<?php } elseif ( isset( $batch_ret ) && $batch_ret ) { ?>
|
240 |
<div id="message" class="updated">
|
242 |
</div>
|
243 |
<?php } elseif ( isset( $error_mes ) && $error_mes ) { ?>
|
244 |
<div id="notice" class="error">
|
245 |
+
<p><?php echo esc_html( $error_mes ); ?></p>
|
246 |
</div>
|
247 |
<?php } elseif ( isset( $_POST['ps_disable_auto_formatting'] ) && $_POST['ps_disable_auto_formatting'] && isset( $ret ) && ! $ret ) { ?>
|
248 |
<div id="notice" class="error">
|
256 |
<tr>
|
257 |
<th><?php _e( $id, 'ps_disable_auto_formatting' ); ?></th>
|
258 |
<td>
|
259 |
+
<input type="checkbox" id="ps_disable_auto_formatting_<?php echo esc_attr( $func ); ?>" name="ps_disable_auto_formatting[]" value="<?php echo esc_attr( $func ); ?>"<?php if ( in_array( $func, $this->option_settings ) ) { echo ' checked="checked"'; } ?> />
|
260 |
+
<label for="ps_disable_auto_formatting_<?php echo esc_attr( $func ); ?>"><?php _e( 'disable', 'ps_disable_auto_formatting' ); ?></label>
|
261 |
</td>
|
262 |
</tr>
|
263 |
<?php } ?>
|
309 |
|
310 |
} // class end
|
311 |
|
312 |
+
$ps_disable_auto_formatting = new ps_disable_auto_formatting();
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== PS Disable Auto Formatting ===
|
2 |
Contributors: jim912, kuck1u
|
3 |
Tags: auto formatting, formatting, format, paragraph, linebreak, wpautop
|
4 |
-
Requires at least:
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 1.0.
|
7 |
|
8 |
Stops the automatic forming and the HTML tag removal in the html mode of WordPress, and generates a natural paragraph and changing line.
|
9 |
|
@@ -65,6 +65,9 @@ To prevent the operational error, the batch processing is not done if there is n
|
|
65 |
Please check "Permit batch formatting" check box.
|
66 |
|
67 |
== Changelog ==
|
|
|
|
|
|
|
68 |
* **1.0.9**
|
69 |
* Compatible with WordPress 3.9
|
70 |
* **1.0.8**
|
1 |
=== PS Disable Auto Formatting ===
|
2 |
Contributors: jim912, kuck1u
|
3 |
Tags: auto formatting, formatting, format, paragraph, linebreak, wpautop
|
4 |
+
Requires at least: 3.6
|
5 |
+
Tested up to: 4.2
|
6 |
+
Stable tag: 1.0.10
|
7 |
|
8 |
Stops the automatic forming and the HTML tag removal in the html mode of WordPress, and generates a natural paragraph and changing line.
|
9 |
|
65 |
Please check "Permit batch formatting" check box.
|
66 |
|
67 |
== Changelog ==
|
68 |
+
* **1.0.10**
|
69 |
+
* Compatible with WordPress 4.2
|
70 |
+
* Fix : Duplicated Error.
|
71 |
* **1.0.9**
|
72 |
* Compatible with WordPress 3.9
|
73 |
* **1.0.8**
|