Hacking WordPress (covers 2.0)

There is an issue related to how WordPress displays PREformatted html.
By default WP translates any post retrieved from the database before displaying it. It uses two filter functions: wptexturize and wpautop, both added to the same filter: the_content. It also translates any other piece of content (Title, Excerpt, …), but I don’t care now.

The function wptexturize is harmless but a bit annoying.
The concept behind WP is keep it simple, isn’t it? If I post a ” I expect a ” to be displayed, not a “ or a ”. Authors always need to see what they mean!

Until an optional setting appears for turning it off, I recommend you to turn it off now.
It’s quite easy. Just edit the file wordpress/wp-includes/default-filters.php and comment out the line that reads

add_filter('the_content', 'wptexturize');

The function wpautop is harmful, so here is a replacement.

Step 1/2
Edit the file wordpress/wp-includes/functions-formatting.php and copy and paste this function after the function wpautop.

function ae_autop( $unprocessed, $br = 1 ) { $processed = "
n"; while( strlen( $unprocessed ) > 0 ) { $debugging += 1; preg_match( '{^([^<]*)?(]+?>)?(.*)$}s', $unprocessed, $matches ); $text = $matches[1]; // as much text as possible before an HTML tag $text = str_replace( "n", "
n", $text ); $tag = $matches[2]; // an HTML tag $unprocessed = $matches[3]; // the rest of $unprocessed if( preg_match( '{)?(.*)$}is', $tag . $unprocessed, $skipping ); $tag = $skipping[1]; // a pre block $unprocessed = $skipping[2]; // the rest of $unprocessed } $processed .= $text . $tag; } return $processed; }

Step 2/2
Last but not least, edit the file wordpress/wp-includes/default-filters.php and comment out the line that reads

add_filter('the_content', 'wpautop');

After it, add this line

add_filter('the_content', 'ae_autop');

Sort totals in categorized views

Notes calculates totals for categorized views, but does not sort them.
So if you need it anyway, you have to

  1. navigate the categories in the non-sorted but categorized view (by means of the NotesViewEntry… classes)
  2. create a new document for each category with a field to record that total and a field to record that category
  3. add a non-categorized view for showing the new documents with a sorted column for the total field

Here is the LS code for an agent that implements 1- and 2-

Sub Initialize Dim s As New NotesSession Dim db As NotesDatabase Set db = s.CurrentDatabase Dim v As NotesView Set v = db.GetView( "ViewByCategories" ) ' use here the name of your categorized view Dim n As NotesViewNavigator Set n = v.CreateViewNav Dim e As NotesViewEntry Set e = n.GetFirst ' this should be the first category If e Is Nothing Then Print "empty view... exiting" Exit Sub End If Dim summary As NotesDocument Do While Not( e Is Nothing ) Set summary = new NotesDocument( db ) ' create a new summary document summary.Form = "SummaryForCategory" ' use here the name of your form for the summaries ' set all the fields you need, for example Call summary.ReplaceItemValue( "Total1", e.ColumnValues( 1 ) ) Call summary.Save( True, True ) ' save the summary Set e = n.GetNextCategory( e ) Loop End Sub

(revised text from my own comment 12349447 at Experts-Exchange)

Compose in a new window

To compose a document in a new window, make a button with the following formula:

@SetTargetFrame( “_blank” );
@Command( [Compose]; “a form” )

(revised text from my own comment 12095830 at Experts-Exchange)