Version Description
Download this release
Release Info
Developer | jim912 |
Plugin | PS Disable Auto Formatting |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- ps_disable_auto_formatting.php +32 -31
- readme.txt +4 -2
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 |
*/
|
@@ -27,7 +27,7 @@ function __construct() {
|
|
27 |
add_action( 'admin_menu', array( &$this, 'add_disable_formatting_setting_page') );
|
28 |
add_filter( 'print_scripts_array', array( &$this, 'rewrite_default_script' ) );
|
29 |
add_filter( 'wp_insert_post_data', array( &$this, 'formatting_quickpress_post' ) );
|
30 |
-
add_action( 'media_buttons', array( &$this, '
|
31 |
add_action( 'media_buttons', array( &$this, 'delete_filtering_wp_richedit_pre' ) );
|
32 |
} else {
|
33 |
add_action('admin_notices', array( &$this, 'version_too_old' ) );
|
@@ -102,13 +102,17 @@ function rewrite_default_script( $todo ) {
|
|
102 |
$wp_scripts->scripts['editor_functions']->src = $scripyt_src;
|
103 |
}
|
104 |
}
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
}
|
114 |
return $todo;
|
@@ -132,7 +136,7 @@ function delete_filtering_wp_richedit_pre() {
|
|
132 |
}
|
133 |
|
134 |
|
135 |
-
function
|
136 |
global $wp_filter;
|
137 |
if ( isset( $wp_filter['the_editor_content'][10]['wp_richedit_pre'] ) ) {
|
138 |
add_filter( 'the_editor_content', array( &$this, 'ps_richedit_pre' ) );
|
@@ -151,19 +155,13 @@ function ps_richedit_pre( $text ) {
|
|
151 |
|
152 |
|
153 |
function add_disable_formatting_setting_page() {
|
154 |
-
|
155 |
-
add_options_page( 'PS Disable Auto Formatting',
|
156 |
-
__( 'Auto Formatting', 'ps_disable_auto_formatting' ),
|
157 |
-
8,
|
158 |
-
basename( __FILE__ ),
|
159 |
-
array( &$this, 'output_disable_formatting_setting_page') );
|
160 |
-
}
|
161 |
}
|
162 |
|
163 |
|
164 |
function output_disable_formatting_setting_page() {
|
165 |
global $wpdb, $wp_error;
|
166 |
-
if( $_POST['_wpnonce'] ) {
|
167 |
check_admin_referer();
|
168 |
|
169 |
if ( $_POST['batch_formatting'] ) {
|
@@ -212,14 +210,17 @@ AND `post_modified` < '$time_limit'
|
|
212 |
$error_mes = __( 'Require checked allow batch formatting.', 'ps_disable_auto_formatting' );
|
213 |
}
|
214 |
} else {
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
}
|
219 |
-
}
|
220 |
-
$ret = update_option( 'ps_disable_auto_formatting', $_POST['ps_disable_auto_formatting'] );
|
221 |
-
if ( $ret ) {
|
222 |
-
$this->option_settings = get_option( 'ps_disable_auto_formatting' );
|
223 |
}
|
224 |
}
|
225 |
}
|
@@ -228,19 +229,19 @@ AND `post_modified` < '$time_limit'
|
|
228 |
<div class=wrap>
|
229 |
<?php if ( function_exists( 'screen_icon' ) ) { screen_icon(); } ?>
|
230 |
<h2><?php _e( 'Auto Formatting', 'ps_disable_auto_formatting' ); ?></h2>
|
231 |
-
<?php if ( $ret ) { ?>
|
232 |
<div id="message" class="updated">
|
233 |
<p><?php _e('The settings has changed successfully.', 'ps_disable_auto_formatting' );?></p>
|
234 |
</div>
|
235 |
-
<?php } elseif ( $batch_ret ) { ?>
|
236 |
<div id="message" class="updated">
|
237 |
<p><?php printf( __( 'Batch fomatting process has completed. total %d posts formatted.', 'ps_disable_auto_formatting' ), count( $formatting_posts ) );?></p>
|
238 |
</div>
|
239 |
-
<?php } elseif ( $error_mes ) { ?>
|
240 |
<div id="notice" class="error">
|
241 |
<p><?php echo wp_specialchars( $error_mes ); ?></p>
|
242 |
</div>
|
243 |
-
<?php } elseif ( $_POST['ps_disable_auto_formatting'] && ! $ret ) { ?>
|
244 |
<div id="notice" class="error">
|
245 |
<p><?php _e('The settings has not been changed. There were no changes or failed to update the data base.', 'ps_disable_auto_formatting' );?></p>
|
246 |
</div>
|
@@ -261,7 +262,7 @@ AND `post_modified` < '$time_limit'
|
|
261 |
<p class="submit">
|
262 |
<input type="submit" name="ps_disable_auto_formatting_submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" />
|
263 |
</p>
|
264 |
-
<?php if ( current_user_can( '
|
265 |
<h3><?php _e( 'Batch formatting for past posts' ,'ps_disable_auto_formatting' ); ?></h3>
|
266 |
<?php _e( '<p>To make it display the same as the format before run this plug-in,
|
267 |
automatic operation process to the specified period of the posts.<br />
|
@@ -273,7 +274,7 @@ This process is safe even if you do two or more times, perhaps. We cannot assure
|
|
273 |
<tr>
|
274 |
<th><?php _e( 'Formatting before' ,'ps_disable_auto_formatting' ); ?></th>
|
275 |
<td>
|
276 |
-
<?php touch_time( 0, 0, 0, 1 ); ?><br />
|
277 |
<?php _e( '* Formatting posts and pages are modified before this time.' ,'ps_disable_auto_formatting' ); ?>
|
278 |
</td>
|
279 |
</tr>
|
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.4
|
7 |
Author: Hitoshi Omagari
|
8 |
Author URI: http://www.web-strategy.jp/
|
9 |
*/
|
27 |
add_action( 'admin_menu', array( &$this, 'add_disable_formatting_setting_page') );
|
28 |
add_filter( 'print_scripts_array', array( &$this, 'rewrite_default_script' ) );
|
29 |
add_filter( 'wp_insert_post_data', array( &$this, 'formatting_quickpress_post' ) );
|
30 |
+
add_action( 'media_buttons', array( &$this, 'check_edit_mode_and_add_richedit_pre' ), 9 );
|
31 |
add_action( 'media_buttons', array( &$this, 'delete_filtering_wp_richedit_pre' ) );
|
32 |
} else {
|
33 |
add_action('admin_notices', array( &$this, 'version_too_old' ) );
|
102 |
$wp_scripts->scripts['editor_functions']->src = $scripyt_src;
|
103 |
}
|
104 |
}
|
105 |
+
wp_enqueue_script( 'ps_editor', $scripyt_src );
|
106 |
+
if ( version_compare( $wp_version, '3.1', '>=' ) ) {
|
107 |
+
wp_dequeue_script( 'editor' );
|
108 |
+
} else {
|
109 |
+
$key = array_search( 'editor', $todo );
|
110 |
+
if ( $key !== false ) {
|
111 |
+
if ( version_compare( $wp_version, '2.7', '>=' ) ) {
|
112 |
+
$todo[$key] = 'ps_editor';
|
113 |
+
} else {
|
114 |
+
unset( $todo[$key] );
|
115 |
+
}
|
116 |
}
|
117 |
}
|
118 |
return $todo;
|
136 |
}
|
137 |
|
138 |
|
139 |
+
function check_edit_mode_and_add_richedit_pre() {
|
140 |
global $wp_filter;
|
141 |
if ( isset( $wp_filter['the_editor_content'][10]['wp_richedit_pre'] ) ) {
|
142 |
add_filter( 'the_editor_content', array( &$this, 'ps_richedit_pre' ) );
|
155 |
|
156 |
|
157 |
function add_disable_formatting_setting_page() {
|
158 |
+
add_options_page( 'PS Disable Auto Formatting', __( 'Auto Formatting', 'ps_disable_auto_formatting' ), 'activate_plugins', basename( __FILE__ ), array( &$this, 'output_disable_formatting_setting_page') );
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
|
161 |
|
162 |
function output_disable_formatting_setting_page() {
|
163 |
global $wpdb, $wp_error;
|
164 |
+
if( isset( $_POST['_wpnonce'] ) && $_POST['_wpnonce'] ) {
|
165 |
check_admin_referer();
|
166 |
|
167 |
if ( $_POST['batch_formatting'] ) {
|
210 |
$error_mes = __( 'Require checked allow batch formatting.', 'ps_disable_auto_formatting' );
|
211 |
}
|
212 |
} else {
|
213 |
+
if ( isset( $_POST['ps_disable_auto_formatting'] ) ) {
|
214 |
+
$post_data = striplashes_deep( $_POST['ps_disable_auto_formatting'] );
|
215 |
+
foreach ( $post_data as $key => $func ) {
|
216 |
+
if ( ! in_array( $func, $this->setting_items) ) {
|
217 |
+
unset( $_POST['ps_disable_auto_formatting'][$key] );
|
218 |
+
}
|
219 |
+
}
|
220 |
+
$ret = update_option( 'ps_disable_auto_formatting', $post_data );
|
221 |
+
if ( $ret ) {
|
222 |
+
$this->option_settings = get_option( 'ps_disable_auto_formatting' );
|
223 |
}
|
|
|
|
|
|
|
|
|
224 |
}
|
225 |
}
|
226 |
}
|
229 |
<div class=wrap>
|
230 |
<?php if ( function_exists( 'screen_icon' ) ) { screen_icon(); } ?>
|
231 |
<h2><?php _e( 'Auto Formatting', 'ps_disable_auto_formatting' ); ?></h2>
|
232 |
+
<?php if ( isset( $ret ) && $ret ) { ?>
|
233 |
<div id="message" class="updated">
|
234 |
<p><?php _e('The settings has changed successfully.', 'ps_disable_auto_formatting' );?></p>
|
235 |
</div>
|
236 |
+
<?php } elseif ( isset( $batch_ret ) && $batch_ret ) { ?>
|
237 |
<div id="message" class="updated">
|
238 |
<p><?php printf( __( 'Batch fomatting process has completed. total %d posts formatted.', 'ps_disable_auto_formatting' ), count( $formatting_posts ) );?></p>
|
239 |
</div>
|
240 |
+
<?php } elseif ( isset( $error_mes ) && $error_mes ) { ?>
|
241 |
<div id="notice" class="error">
|
242 |
<p><?php echo wp_specialchars( $error_mes ); ?></p>
|
243 |
</div>
|
244 |
+
<?php } elseif ( isset( $_POST['ps_disable_auto_formatting'] ) && $_POST['ps_disable_auto_formatting'] && isset( $ret ) && ! $ret ) { ?>
|
245 |
<div id="notice" class="error">
|
246 |
<p><?php _e('The settings has not been changed. There were no changes or failed to update the data base.', 'ps_disable_auto_formatting' );?></p>
|
247 |
</div>
|
262 |
<p class="submit">
|
263 |
<input type="submit" name="ps_disable_auto_formatting_submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" />
|
264 |
</p>
|
265 |
+
<?php if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) { ?>
|
266 |
<h3><?php _e( 'Batch formatting for past posts' ,'ps_disable_auto_formatting' ); ?></h3>
|
267 |
<?php _e( '<p>To make it display the same as the format before run this plug-in,
|
268 |
automatic operation process to the specified period of the posts.<br />
|
274 |
<tr>
|
275 |
<th><?php _e( 'Formatting before' ,'ps_disable_auto_formatting' ); ?></th>
|
276 |
<td>
|
277 |
+
<?php global $comment; $comment->comment_date = current_time( 'mysql' ); touch_time( 0, 0, 0, 1 ); ?><br />
|
278 |
<?php _e( '* Formatting posts and pages are modified before this time.' ,'ps_disable_auto_formatting' ); ?>
|
279 |
</td>
|
280 |
</tr>
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: jim912
|
3 |
Tags: auto formatting, formatting, format, paragraph, linebreak, wpautop
|
4 |
Requires at least: 2.5
|
5 |
-
Tested up to:
|
6 |
-
Stable tag:
|
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,8 @@ 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.3**
|
69 |
* fix : missed writing specifications of plugin(version & discription)
|
70 |
* **1.0.2**
|
2 |
Contributors: jim912
|
3 |
Tags: auto formatting, formatting, format, paragraph, linebreak, wpautop
|
4 |
Requires at least: 2.5
|
5 |
+
Tested up to: 3.1
|
6 |
+
Stable tag: 1.0.4
|
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.4**
|
69 |
+
* fix : Fixed Warning and Notice Error.
|
70 |
* **1.0.3**
|
71 |
* fix : missed writing specifications of plugin(version & discription)
|
72 |
* **1.0.2**
|