Shortcode Problems: WordPress 4.4

miqrogroove
2015-08-31T11:07:48+00:00

I will briefly summarize Shortcode API changes since WordPress 4.0 and then kick off some ideas for a roadmap.

The first major accomplishment was the expansion of the API documentation, including a new large section I wrote about the formal syntax for shortcode input.

I also put forward a robust parser concept for the function wptexturize() that promised to re-introduce the ability to use unrestricted HTML code inside of shortcodes and shortcode attributes.  That concept went through many, many changes before being introduced in v4.2.3.  After consulting with the WordPress security team, and after extensive testing of the shortcode parsing functions, we determined that the shortcodes-first parsing strategy was fundamentally flawed and could not be included with any version beyond v4.2.2.  This is why I added an HTML parser to the Shortcode API and ultimately curtailed the use of shortcodes inside HTML rather than expand the use of HTML inside shortcodes.

Read the rest of this entry »

22 Aug 2015

Category:
Systems Engineering

Tags:

Discuss:
3 Comments

Cookies Not Working in IE10

miqrogroove
2015-08-08T15:06:12+00:00

I’ve finally fixed a crippling bug in Internet Explorer 10 that was preventing me from using any website that required cookie support.

This problem seemed to plague my Windows 2012 server from day one.  I’m not yet sure what was special about this configuration.  No matter how many settings I changed, every website I visited told me that I had cookies completely disabled.

I used these steps right before the browser started working correctly:

Step 1 – Find the “Delete Browsing History” dialog box.

ie-safety-menu

Read the rest of this entry »

8 Aug 2015

Category:
Systems Engineering

Tags:

Discuss:
Comments Go Here

How to Block the Amazon AWS EC2

miqrogroove
2015-01-02T14:53:36+00:00

Years ago, I found it necessary to start maintaining a list of Amazon’s subnets so that I could block them easily.  This list can be used in .htaccess and firewalls that can block access using CIDR subnet addresses.

Recent entries are bold.

Read the rest of this entry »

2 Jan 2015

Category:
Security

Discuss:
Comments Go Here

Shortcode Problems to be Resolved in WordPress 4.1

miqrogroove
2014-11-06T10:38:13+00:00
Illustration of wptexturize_parse() concept.

Achieving correct and exact results in several steps.

When WordPress first introduced its Shortcode API, it included an all-too-simple line of code that was supposed to help curly quotes not appear inside of the shortcode attributes while still adding curly quotes outside of the shortcodes.  But there were several known problems with this one line of code, such as what would happen if a URL contained square braces, and what would happen if a plugin author wanted to use HTML inside a shortcode.

In version 4.0, I made a substantial effort to fix these problems, but it resulted in some new limitations being placed on the ways shortcodes could be used.  Although I couldn’t find any documented examples or official support for the HTML features, I did hear from several members of the WordPress community who enjoy the full power of customizing their website HTML by using shortcode attributes and HTML values.

My proposed solution is to write a new parser function that will exactly identify the shortcodes and HTML elements being used, so that the function wptexturize() will finally be able to create its curly quotes without interfering with shortcode features.  Click on the diagram to see how this new code works.

Read the rest of this entry »

6 Nov 2014

Category:
Systems Engineering

Tags:

Discuss:
3 Comments

WordPress Formatting Roadmap

miqrogroove
2014-07-08T18:39:25+00:00

I was asked for ideas about how to fix some old problems in the WordPress code base.  Specifically, bugs in the Formatting component, which includes the very heart of blog post processing for millions of websites.  This roadmap lays out recent changes and a plan for where to go next.

3.9

  • Implemented NBSP compatibility for curly quotes to fix common cosmetic flaws.
  • Revised all regex in wptexturize to avoid slow searches.
  • Added a large number of unit tests to cover all known behaviors of wptexturize.

4.0

  • Implemented NBSP compatibility for shortcodes and smilies.
  • Deprecated and replaced function like_escape().
  • Fixed wptexturize parsing for square braces inside of HTML.
  • Sorted the texturize patterns into groups for better performance.
  • Refactored the wptexturize stack function for better performance.
  • Wptexturize now runs up to 5x faster compared to v3.8.

4.1 or Future Releases

Wpautop Phase 1 – Research Problem

Read the rest of this entry »

8 Jul 2014

Category:
Systems Engineering

Tags:

Discuss:
Comments Go Here

like_escape() is Deprecated in WordPress 4.0

miqrogroove
2014-06-18T00:33:31+00:00

Plugin authors and website developers who work with WordPress database queries should notice an important change coming in WordPress 4.0.

The function like_escape() is no longer used in WordPress core code.  It is still available as a deprecated function, so it still works in any existing plugins that rely on it.  However, a new and different function is available that should be used in all new code.

Deprecated means that anyone using code that calls like_escape() with WP_DEBUG enabled will see an error message.  If WP_DEBUG_LOG is also enabled, the error message will appear in the /wp-content/debug.log file.

Let’s look at an example of core code where I removed like_escape() and implemented the new function $wpdb->esc_like().

3.9 Old Style

$search_orderby_s = like_escape( esc_sql( $q['s'] ) );
$search_orderby .= "WHEN $wpdb->posts.post_title LIKE '%{$search_orderby_s}%' THEN 1 ";

What did this do?  It was an old snippet from /wp-includes/query.php that set up a search for post titles.  The input $q[‘s’] was escaped using two functions before it was added to the post_title LIKE expression.  Now let’s see how I replaced that snippet in the next version.

4.0 New Style

$like = '%' . $wpdb->esc_like( $q['s'] ) . '%';
$search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_title LIKE %s THEN 1 ", $like );

Read the rest of this entry »

18 Jun 2014

Category:
Systems Engineering

Tags:
,

Discuss:
Comments Go Here

Folder Redirection Broken After GPO Changes

miqrogroove
2014-03-02T19:19:51+00:00

I am learning quite a bit about the Windows 2012 environment thanks to a recent server migration.  The biggest lesson so far deals with Folder Redirection, and the effects of repeated adjustments to the GPO settings.

Under certain circumstances, folder redirection seems to get “stuck” showing either an old folder path or none at all when the user goes looking for their documents.  The Group Policy Results tool seems to confirm that the Folder Redirection settings are not being applied at all for the user/computer profile that is stuck.  Frustratingly, I couldn’t find any problem with my Group Policy configuration.

No amount of logging off and on, adjusting permissions, or messing with Group Policy seems to have any effect.

In the end, I was able to clear up the problem by running this command:

gpupdate /Target:User /Force /Logoff

The key here is the Force option, which successfully resets the folder redirection policy for that user profile, and perhaps all the profiles on that particular computer.  Problem solved!  Windows 8.1, Windows 2012, and possibly other versions are affected.

2 Mar 2014

Category:
Systems Engineering

Tags:
,

Discuss:
2 Comments

16-bit Color Limitation in RDP

miqrogroove
2014-02-09T16:06:08+00:00
GPO Editor showing the path to the color policy.

This Policy Needs to be Enabled

If you’ve ever been under the mistaken impression that the RDP client controls the color settings for remote connections, then you came to the right place for help.

Windows XP and Windows 2003 servers won’t show more than 16-bit color depth to RDP clients requesting 24-bit or better color.  You can confirm this by looking at the display settings in the control panel of the remote server.  As a result, black text looks like funny shades of purple, photos look slightly posterized, and any color-critical tasks may be impossible to accomplish by remote control.

To fix this problem, you must enable the following policy:

Computer Configuration > Administrative Templates > Windows Components > Terminal Services > Limit maximum color depth

Set the Color Depth field to 24 bit and click OK.

I can’t explain why Windows would be limited in this way by default, but it is.

9 Feb 2014

Category:
Systems Engineering

Tags:
, ,

Discuss:
Comments Go Here

Regarding GoodNotes 4

miqrogroove
2014-01-07T11:16:44+00:00
Screen shot of GoodNotes version 4.

iTunes Import for GoodNotes Templates

I’m receiving questions about a new version of GoodNotes that doesn’t allow direct imports of new template pages.  Here are my thoughts so far.

In GoodNotes 3, the easy method was to download a new template in Safari, choose “Open in GoodNotes”, tap the new page on the bookshelf, select Change Template from the menu, then add the Current Template and adjust its settings.

In GoodNotes 4, it is still possible to download pages and write on them, but I see no way to add them directly to the list of templates.  This does not prevent creation of multi-page notebooks, but it does become problematic for creating notebooks offline or trying to swap to a custom template on an existing notebook.

I was able to install custom templates in GoodNotes 4 through iTunes synchronization.  The less complex method is to tap the “Wi-Fi File Transfer” on the GoodNotes Options menu.  This requires a second computer to connect to the iPad’s web server through a wired or wireless LAN connection.

Another alternative is the monumental task of installing iTunes on a second computer, making a physical USB connection, dealing with a variety of error messages, and struggling to transfer files while the program attempts to fill up my network drives with 64 GB of backup data.

Bottom line:  You can keep GoodNotes 3, if you have it, and wait for better features in new versions, or you can deal with iTunes synchronization to install the templates you want.

Questions and comments are welcome.

Previous Post: White Templates for GoodNotes

7 Jan 2014

Category:
Productivity

Tags:
,

Discuss:
8 Comments

Microsoft Updates Crippling Windows 2003 Servers

miqrogroove
2013-12-11T01:43:24+00:00

The updates bug I described in Windows XP back in October is now also locking up server computers.

I’ve had it with this.  Microsoft has clearly lost control of its security patches.

As of today, I am disabling Automatic Updates across the board; all devices and all versions.  Up-time is more important to me than monthly patches.

11 Dec 2013

Category:
Systems Engineering

Tags:

Discuss:
Comments Go Here