Skip to content

Instantly share code, notes, and snippets.

@leewillis77
Created July 25, 2012 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leewillis77/3178584 to your computer and use it in GitHub Desktop.
Save leewillis77/3178584 to your computer and use it in GitHub Desktop.
Wonderflux performance patch
--- wf-display-functions.php.orig 2012-07-25 21:43:07.050252166 +0100
+++ wf-display-functions.php 2012-07-25 21:47:03.102242294 +0100
@@ -8,12 +8,26 @@
class wflux_display_code extends wflux_data {
protected $xml_namespaces;
+ private $cache_theme_name = null;
function __construct() {
parent::__construct();
$this->xml_namespaces = array(); // Holds all XML namespaces to build into head
}
+ private function get_cache_theme_name() {
+
+ // Backpat - depreciated function get_current_theme() in WordPress 3.4
+ //TODO: Check version_compare() - is < evaluation on constant quicker/easier?
+ if ( ! $this->cache_theme_name )
+ $this->cache_theme_name = preg_replace('/[^a-zA-Z0-9]/','_', ( WF_WORDPRESS_VERSION < 3.4 ) ? get_current_theme() : wp_get_theme()->Name );
+
+ return $this->cache_theme_name;
+
+ }
+
+
+
/**
* Builds the start of the head with doc type declaration
*
@@ -1852,7 +1866,8 @@
// Backpat - depreciated function get_current_theme() in WordPress 3.4
//TODO: Check version_compare() - is < evaluation on constant quicker/easier?
- $theme_name = preg_replace('/[^a-zA-Z0-9]/','_', ( WF_WORDPRESS_VERSION < 3.4 ) ? get_current_theme() : wp_get_theme()->Name );
+ $theme_name = $this->get_cache_theme_name();
+
// TODO: Transient key reported upto 32 characters max - have tested upto 45, 46 was stormy waters!
// Best to play on safe side until further teting done (32)
$transient_key = mb_substr( empty($transient_key) ? $theme_name.'_c_'.$part : $transient_key , 0, 32);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment