'; echo '

'; echo '

'; echo __('If you have added indent manually, do not check it. You can preview changes after you save the post.', 'aib'); echo '

'; } // manage settings function aib_is_empty_line($content) { // check empty line if(preg_match('/((\|\|\|\
|^)[\s]*)+(\ \;|[\s]+)*$/', $content))return true; // wipe the beginning and check special content $content = preg_replace('/^(\|\|\|\
|\s)*/', ' ', $content); if(preg_match('/^(\ \;|\s)*\post_content)return false; preg_match_all('/((\|\|\|\
|^)[\s]*)+.*$/m', $post->post_content, $matches); foreach($matches[0] as $match) { if(!aib_is_valid($match)) { if(!aib_is_empty_line($match))return false; } } return true; } add_filter('content_save_pre', 'aib_indent', 5, 1); function aib_indent($content) { if(array_key_exists('aib-add-check', $_POST)) { if( !wp_verify_nonce( $_POST['aib_nonce'], plugin_basename( __FILE__ ) ) ) return $content; $content = preg_replace_callback('/((\|\|\|\
|^)[\s]*)+.*$/m', 'aib_indent_replace', $content); } return $content; } function aib_indent_replace($matches) { if(aib_is_empty_line($matches[0]))return $matches[0]; //add_post_meta($_POST['post_ID'], 'aib-test1', rawurlencode($matches[0])); return preg_replace_callback('/^(\s|\|\|\|\
)*(\ \;|\s)*/', 'aib_indent_replace_replace', $matches[0]); } function aib_indent_replace_replace($matches) { $match = $matches[0]; //add_post_meta($_POST['post_ID'], 'aib-test', rawurlencode($match)); while(!aib_is_valid($match)) $match = $match . ' '; return $match; } ?>