Changeset 351932
- Timestamp:
- 02/26/2011 05:21:22 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
l10n-cache/trunk/l10n-cache.php
r350665 r351932 2 2 /** 3 3 * @package l10n cache 4 * @version 0.2 4 * @version 0.3 5 * @see http://wordpress.org/extend/plugins/l10n-cache/ 5 6 * 6 7 * $Id$ … … 10 11 Description: Improves site performance by providing caching for localisation objects (*.mo files) 11 12 Author: Maciej Brencz 12 Version: 0. 213 Version: 0. 13 14 Author URI: http://macbre.net 14 15 */ … … 18 19 */ 19 20 class l10nCache { 21 22 20 23 private $cached = false; 21 24 private $cacheDir; … … 30 33 */ 31 34 function __construct() { 32 // don't run when in wp-admin panel33 // TODO: fix it :)34 if (defined('WP_ADMIN') && WP_ADMIN) {35 return;36 }37 38 35 // set up path to cache directory 39 36 $this->cacheDir = WP_CONTENT_DIR . '/cache'; … … 47 44 // add caching info to the footer 48 45 add_action('wp_footer', array(&$this, 'addFooter')); 46 49 47 } 50 48 … … 59 57 60 58 // caching location 61 $hash = md5($mofile . $wp_version );59 $hash = md5($mofile . $wp_version); 62 60 $this->cacheFile = "{$this->cacheDir}/l10n-cache-{$this->domain}-{$hash}.cache"; 63 61 … … 95 93 $obj = isset($l10n[$this->domain]) ? $l10n[$this->domain] : false; 96 94 97 // store it 98 if (!empty($obj)) { 95 if ($obj instanceof MO) { 96 // perform object's cleanup 97 unset($obj->_gettext_select_plural_form); 98 99 // store it 99 100 file_put_contents($this->cacheFile, serialize($obj)); 100 101 }
Note: See TracChangeset
for help on using the changeset viewer.