PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.10
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.10
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
← All changes | includes/helpers.php +24 -0 1.1.11.1.10 View file →
@@ -220,8 +220,32 @@
220 220 return is_string( $filtered ) && '' !== trim( $filtered ) ? $filtered : $title;
221 221 }
222 222
223 223 /**
224 + * Decode a rendered title into the plain text the desktop paints with.
225 + *
226 + * `wptexturize()` encodes the characters titles are full of — `&` as
227 + * `&`, an apostrophe as `’` — and the shell writes titles
228 + * into text nodes, where the entity renders as itself. Same reasoning
229 + * as {@see openstation_site_title()}, one layer down.
230 + *
231 + * Decode BEFORE the tag strip, never after: `<script>` decodes
232 + * into a real tag, and stripping second is what removes it.
233 + *
234 + * @param string $rendered A title that has been through a display filter.
235 + * @return string Plain text, tag-free.
236 + */
237 +function openstation_plain_text_title( $rendered ) {
238 + $decoded = html_entity_decode(
239 + (string) $rendered,
240 + ENT_QUOTES,
241 + get_bloginfo( 'charset' )
242 + );
243 +
244 + return trim( wp_strip_all_tags( $decoded ) );
245 +}
246 +
247 +/**
224 248 * Build a `WP_Error` for a openstation registration failure.
225 249 *
226 250 * Centralises the error-code vocabulary used by every
227 251 * `openstation_register_*()` function so plugin authors see a