2008-02-11 12:45:18 -05:00
|
|
|
<?php
|
|
|
|
// some code below is from:
|
|
|
|
/**
|
|
|
|
* $Id: tiny_mce_gzip.php 315 2007-10-25 14:03:43Z spocke $
|
|
|
|
*
|
|
|
|
* @author Moxiecode
|
2008-05-21 01:59:27 -04:00
|
|
|
* @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved.
|
2008-02-11 12:45:18 -05:00
|
|
|
*
|
|
|
|
* This file compresses the TinyMCE JavaScript using GZip.
|
|
|
|
**/
|
2008-04-23 21:25:33 -04:00
|
|
|
|
|
|
|
// Discard any buffers
|
|
|
|
while ( @ob_end_clean() );
|
|
|
|
|
2008-05-21 01:59:27 -04:00
|
|
|
@ require('../../../wp-load.php');
|
2006-03-30 02:50:33 -05:00
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
function getFileContents($path) {
|
2008-04-14 18:19:04 -04:00
|
|
|
|
|
|
|
if ( function_exists('realpath') )
|
|
|
|
$path = realpath($path);
|
2006-03-30 02:50:33 -05:00
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
if ( ! $path || ! @is_file($path) )
|
|
|
|
return '';
|
2006-03-30 02:50:33 -05:00
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
if ( function_exists('file_get_contents') )
|
|
|
|
return @file_get_contents($path);
|
2006-03-30 02:50:33 -05:00
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
$content = '';
|
|
|
|
$fp = @fopen($path, 'r');
|
|
|
|
if ( ! $fp )
|
|
|
|
return '';
|
2006-03-30 02:50:33 -05:00
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
while ( ! feof($fp) )
|
|
|
|
$content .= fgets($fp);
|
|
|
|
|
|
|
|
fclose($fp);
|
|
|
|
return $content;
|
|
|
|
}
|
|
|
|
|
|
|
|
function putFileContents( $path, $content ) {
|
|
|
|
if ( function_exists('file_put_contents') )
|
|
|
|
return @file_put_contents( $path, $content );
|
|
|
|
|
2008-03-19 14:53:01 -04:00
|
|
|
$newfile = false;
|
2008-02-11 12:45:18 -05:00
|
|
|
$fp = @fopen( $path, 'wb' );
|
|
|
|
if ($fp) {
|
2008-03-19 14:53:01 -04:00
|
|
|
$newfile = fwrite( $fp, $content );
|
2008-02-11 12:45:18 -05:00
|
|
|
fclose($fp);
|
2006-03-30 02:50:33 -05:00
|
|
|
}
|
2008-03-19 14:53:01 -04:00
|
|
|
return $newfile;
|
2008-02-11 12:45:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set up init variables
|
2008-03-06 14:56:02 -05:00
|
|
|
$https = ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
$baseurl = get_option('siteurl') . '/wp-includes/js/tinymce';
|
2008-04-06 17:29:36 -04:00
|
|
|
if ( $https ) $baseurl = str_replace('http://', 'https://', $baseurl);
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
$mce_css = $baseurl . '/wordpress.css';
|
|
|
|
$mce_css = apply_filters('mce_css', $mce_css);
|
2008-04-06 17:29:36 -04:00
|
|
|
if ( $https ) $mce_css = str_replace('http://', 'https://', $mce_css);
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-03-18 02:59:53 -04:00
|
|
|
$mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
|
|
|
|
|
2008-03-06 14:56:02 -05:00
|
|
|
/*
|
|
|
|
The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
|
|
|
|
By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
|
2008-03-18 02:59:53 -04:00
|
|
|
The + sign marks the default language. More information:
|
2008-03-06 14:56:02 -05:00
|
|
|
http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
|
|
|
|
*/
|
|
|
|
$mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
|
|
|
|
|
2008-06-10 00:40:21 -04:00
|
|
|
$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage' );
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
/*
|
2008-03-18 02:59:53 -04:00
|
|
|
The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
|
2008-02-21 16:40:25 -05:00
|
|
|
It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
|
2008-03-18 02:59:53 -04:00
|
|
|
The url should be absolute and should include the js file name to be loaded. Example:
|
|
|
|
array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
|
2008-02-11 12:45:18 -05:00
|
|
|
If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
|
|
|
|
*/
|
2008-03-18 02:59:53 -04:00
|
|
|
$mce_external_plugins = apply_filters('mce_external_plugins', array());
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
$ext_plugins = "\n";
|
2008-03-06 14:56:02 -05:00
|
|
|
if ( ! empty($mce_external_plugins) ) {
|
2008-03-18 02:59:53 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
The following filter loads external language files for TinyMCE plugins.
|
|
|
|
It takes an associative array 'plugin_name' => 'path', where path is the
|
|
|
|
include path to the file. The language file should follow the same format as
|
|
|
|
/tinymce/langs/wp-langs.php and should define a variable $strings that
|
|
|
|
holds all translated strings. Example:
|
|
|
|
$strings = 'tinyMCE.addI18n("' . $mce_locale . '.mypluginname_dlg",{tab_general:"General", ... })';
|
|
|
|
*/
|
|
|
|
$mce_external_languages = apply_filters('mce_external_languages', array());
|
|
|
|
|
|
|
|
$loaded_langs = array();
|
|
|
|
$strings = '';
|
|
|
|
|
|
|
|
if ( ! empty($mce_external_languages) ) {
|
|
|
|
foreach ( $mce_external_languages as $name => $path ) {
|
2008-03-25 23:22:53 -04:00
|
|
|
if ( is_file($path) && is_readable($path) ) {
|
2008-03-19 14:53:01 -04:00
|
|
|
include_once($path);
|
|
|
|
$ext_plugins .= $strings;
|
|
|
|
$loaded_langs[] = $name;
|
|
|
|
}
|
2008-03-18 02:59:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-06 14:56:02 -05:00
|
|
|
foreach ( $mce_external_plugins as $name => $url ) {
|
2008-03-18 02:59:53 -04:00
|
|
|
|
2008-04-06 17:29:36 -04:00
|
|
|
if ( $https ) $url = str_replace('http://', 'https://', $url);
|
2008-03-18 02:59:53 -04:00
|
|
|
|
2008-03-06 14:56:02 -05:00
|
|
|
$plugins[] = '-' . $name;
|
2008-03-18 02:59:53 -04:00
|
|
|
|
|
|
|
if ( in_array($name, $loaded_langs) ) {
|
|
|
|
$plugurl = dirname($url);
|
|
|
|
$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
|
|
|
|
}
|
2008-03-06 14:56:02 -05:00
|
|
|
$ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
|
|
|
|
}
|
2008-02-11 12:45:18 -05:00
|
|
|
}
|
|
|
|
$plugins = implode($plugins, ',');
|
|
|
|
|
2008-06-10 00:40:21 -04:00
|
|
|
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
|
2008-02-11 12:45:18 -05:00
|
|
|
$mce_buttons = implode($mce_buttons, ',');
|
|
|
|
|
2008-03-03 19:07:29 -05:00
|
|
|
$mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ));
|
2008-02-11 12:45:18 -05:00
|
|
|
$mce_buttons_2 = implode($mce_buttons_2, ',');
|
|
|
|
|
|
|
|
$mce_buttons_3 = apply_filters('mce_buttons_3', array());
|
|
|
|
$mce_buttons_3 = implode($mce_buttons_3, ',');
|
|
|
|
|
|
|
|
$mce_buttons_4 = apply_filters('mce_buttons_4', array());
|
|
|
|
$mce_buttons_4 = implode($mce_buttons_4, ',');
|
|
|
|
|
|
|
|
// TinyMCE init settings
|
|
|
|
$initArray = array (
|
|
|
|
'mode' => 'none',
|
|
|
|
'onpageload' => 'wpEditorInit',
|
2008-03-21 18:13:03 -04:00
|
|
|
'width' => '100%',
|
2008-02-11 12:45:18 -05:00
|
|
|
'theme' => 'advanced',
|
|
|
|
'skin' => 'wp_theme',
|
|
|
|
'theme_advanced_buttons1' => "$mce_buttons",
|
|
|
|
'theme_advanced_buttons2' => "$mce_buttons_2",
|
|
|
|
'theme_advanced_buttons3' => "$mce_buttons_3",
|
|
|
|
'theme_advanced_buttons4' => "$mce_buttons_4",
|
|
|
|
'language' => "$mce_locale",
|
2008-03-06 14:56:02 -05:00
|
|
|
'spellchecker_languages' => "$mce_spellchecker_languages",
|
2008-02-11 12:45:18 -05:00
|
|
|
'theme_advanced_toolbar_location' => 'top',
|
|
|
|
'theme_advanced_toolbar_align' => 'left',
|
|
|
|
'theme_advanced_statusbar_location' => 'bottom',
|
|
|
|
'theme_advanced_resizing' => true,
|
|
|
|
'theme_advanced_resize_horizontal' => false,
|
|
|
|
'dialog_type' => 'modal',
|
|
|
|
'relative_urls' => false,
|
|
|
|
'remove_script_host' => false,
|
2008-04-14 18:19:04 -04:00
|
|
|
'convert_urls' => false,
|
2008-03-21 18:13:03 -04:00
|
|
|
'apply_source_formatting' => false,
|
|
|
|
'remove_linebreaks' => true,
|
2008-03-25 23:22:53 -04:00
|
|
|
'paste_convert_middot_lists' => true,
|
|
|
|
'paste_remove_spans' => true,
|
|
|
|
'paste_remove_styles' => true,
|
2008-02-11 12:45:18 -05:00
|
|
|
'gecko_spellcheck' => true,
|
|
|
|
'entities' => '38,amp,60,lt,62,gt',
|
|
|
|
'accessibility_focus' => false,
|
|
|
|
'tab_focus' => ':next',
|
|
|
|
'content_css' => "$mce_css",
|
|
|
|
'save_callback' => 'switchEditors.saveCallback',
|
|
|
|
'plugins' => "$plugins",
|
|
|
|
// pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init"
|
2008-03-03 19:07:29 -05:00
|
|
|
'disk_cache' => true,
|
2008-02-11 12:45:18 -05:00
|
|
|
'compress' => true,
|
2008-02-18 14:25:56 -05:00
|
|
|
'old_cache_max' => '1' // number of cache files to keep
|
2008-02-11 12:45:18 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
// For people who really REALLY know what they're doing with TinyMCE
|
2008-03-25 23:22:53 -04:00
|
|
|
// You can modify initArray to add, remove, change elements of the config before tinyMCE.init (changed from action to filter)
|
|
|
|
$initArray = apply_filters('tiny_mce_before_init', $initArray);
|
|
|
|
|
|
|
|
// Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".
|
|
|
|
// Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
// support for deprecated actions
|
|
|
|
ob_start();
|
|
|
|
do_action('mce_options');
|
2008-03-21 18:13:03 -04:00
|
|
|
$mce_deprecated = ob_get_contents();
|
2008-02-11 12:45:18 -05:00
|
|
|
ob_end_clean();
|
|
|
|
|
2008-03-21 18:13:03 -04:00
|
|
|
$mce_deprecated = (string) $mce_deprecated;
|
|
|
|
if ( strlen( $mce_deprecated ) < 10 || ! strpos( $mce_deprecated, ':' ) || ! strpos( $mce_deprecated, ',' ) )
|
|
|
|
$mce_deprecated = '';
|
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
// Settings for the gzip compression and cache
|
|
|
|
$disk_cache = ( ! isset($initArray['disk_cache']) || false == $initArray['disk_cache'] ) ? false : true;
|
|
|
|
$compress = ( ! isset($initArray['compress']) || false == $initArray['compress'] ) ? false : true;
|
2008-02-18 12:11:12 -05:00
|
|
|
$old_cache_max = ( isset($initArray['old_cache_max']) ) ? (int) $initArray['old_cache_max'] : 0;
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-02-18 12:11:12 -05:00
|
|
|
$initArray['disk_cache'] = $initArray['compress'] = $initArray['old_cache_max'] = null;
|
|
|
|
unset( $initArray['disk_cache'], $initArray['compress'], $initArray['old_cache_max'] );
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-03-12 18:47:11 -04:00
|
|
|
// Anybody still using IE5/5.5? It can't handle gzip compressed js well.
|
|
|
|
if ( $msie = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) {
|
|
|
|
$ie_ver = (int) substr( $_SERVER['HTTP_USER_AGENT'] , $msie + 5, 3 );
|
|
|
|
if ( $ie_ver && $ie_ver < 6 ) $compress = false;
|
|
|
|
}
|
2008-02-21 16:40:25 -05:00
|
|
|
|
2008-03-03 19:07:29 -05:00
|
|
|
// Cache path, this is where the .gz files will be stored
|
2008-05-27 13:55:24 -04:00
|
|
|
$cache_path = WP_CONTENT_DIR . '/uploads/js_cache';
|
2008-03-03 19:07:29 -05:00
|
|
|
if ( $disk_cache && ! is_dir($cache_path) )
|
2008-03-05 00:53:56 -05:00
|
|
|
$disk_cache = wp_mkdir_p($cache_path);
|
2008-03-03 19:07:29 -05:00
|
|
|
|
|
|
|
$cache_ext = '.js';
|
2008-02-11 12:45:18 -05:00
|
|
|
$plugins = explode( ',', $initArray['plugins'] );
|
|
|
|
$theme = ( 'simple' == $initArray['theme'] ) ? 'simple' : 'advanced';
|
2008-06-04 11:31:14 -04:00
|
|
|
$language = ( isset($initArray['language']) && ! empty($initArray['language']) ) ? substr( $initArray['language'], 0, 2 ) : 'en';
|
2008-03-18 02:59:53 -04:00
|
|
|
$cacheKey = $mce_options = '';
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-03-12 18:47:11 -04:00
|
|
|
// Check if browser supports gzip
|
2008-02-11 12:45:18 -05:00
|
|
|
if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
|
2008-03-18 02:59:53 -04:00
|
|
|
if ( ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') || isset($_SERVER['---------------']) ) && function_exists('gzencode') && ! ini_get('zlib.output_compression') ) {
|
2008-02-11 12:45:18 -05:00
|
|
|
$cache_ext = '.gz';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup cache info
|
2008-03-03 19:07:29 -05:00
|
|
|
if ( $disk_cache ) {
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-06-10 00:40:21 -04:00
|
|
|
$cacheKey = apply_filters('tiny_mce_version', '20080606');
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-02-18 12:11:12 -05:00
|
|
|
foreach ( $initArray as $v )
|
|
|
|
$cacheKey .= $v;
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-03-18 02:59:53 -04:00
|
|
|
if ( ! empty($mce_external_plugins) ) {
|
|
|
|
foreach ( $mce_external_plugins as $n => $v )
|
|
|
|
$cacheKey .= $n;
|
|
|
|
}
|
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
$cacheKey = md5( $cacheKey );
|
2008-02-18 12:11:12 -05:00
|
|
|
$cache_file = $cache_path . '/tinymce_' . $cacheKey . $cache_ext;
|
2008-02-11 12:45:18 -05:00
|
|
|
}
|
|
|
|
|
2008-03-18 02:59:53 -04:00
|
|
|
$expiresOffset = 864000; // 10 days
|
|
|
|
header( 'Content-Type: application/x-javascript; charset=UTF-8' );
|
|
|
|
header( 'Vary: Accept-Encoding' ); // Handle proxies
|
|
|
|
header( 'Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . ' GMT' );
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
// Use cached file if exists
|
2008-03-19 14:53:01 -04:00
|
|
|
if ( $disk_cache && is_file($cache_file) && is_readable($cache_file) ) {
|
2008-03-18 02:59:53 -04:00
|
|
|
|
|
|
|
$mtime = gmdate("D, d M Y H:i:s", filemtime($cache_file)) . " GMT";
|
|
|
|
|
|
|
|
if ( isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $mtime ) {
|
|
|
|
header('HTTP/1.1 304 Not Modified');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
header("Last-Modified: " . $mtime);
|
|
|
|
header("Cache-Control: must-revalidate", false);
|
|
|
|
|
|
|
|
$content = getFileContents( $cache_file );
|
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
if ( '.gz' == $cache_ext )
|
2008-03-18 02:59:53 -04:00
|
|
|
header( 'Content-Encoding: gzip' );
|
|
|
|
|
|
|
|
echo $content;
|
2008-02-11 12:45:18 -05:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ( $initArray as $k => $v )
|
2008-02-18 12:11:12 -05:00
|
|
|
$mce_options .= $k . ':"' . $v . '",';
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-03-21 18:13:03 -04:00
|
|
|
if ( $mce_deprecated ) $mce_options .= $mce_deprecated;
|
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
$mce_options = rtrim( trim($mce_options), '\n\r,' );
|
|
|
|
|
2008-06-04 11:31:14 -04:00
|
|
|
$content = 'var tinyMCEPreInit = { settings : { themes : "' . $theme . '", plugins : "' . $initArray['plugins'] . '", languages : "' . $language . '", debug : false }, base : "' . $baseurl . '", suffix : "", query : "ver=3091" };';
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
// Load patch
|
|
|
|
$content .= getFileContents( 'tiny_mce_ext.js' );
|
|
|
|
|
|
|
|
// Add core
|
2008-03-18 02:59:53 -04:00
|
|
|
$content .= getFileContents( 'tiny_mce.js' );
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
// Patch loading functions
|
2008-02-18 12:11:12 -05:00
|
|
|
$content .= 'tinyMCEPreInit.start();';
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
// Add all languages (WP)
|
|
|
|
include_once( dirname(__FILE__).'/langs/wp-langs.php' );
|
|
|
|
$content .= $strings;
|
|
|
|
|
|
|
|
// Add themes
|
2008-03-18 02:59:53 -04:00
|
|
|
$content .= getFileContents( 'themes/' . $theme . '/editor_template.js' );
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
// Add plugins
|
|
|
|
foreach ( $plugins as $plugin )
|
2008-03-18 02:59:53 -04:00
|
|
|
$content .= getFileContents( 'plugins/' . $plugin . '/editor_plugin.js' );
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
// Add external plugins and init
|
2008-03-03 19:07:29 -05:00
|
|
|
$content .= $ext_plugins . 'tinyMCE.init({' . $mce_options . '});';
|
2008-02-11 12:45:18 -05:00
|
|
|
|
|
|
|
// Generate GZIP'd content
|
|
|
|
if ( '.gz' == $cache_ext ) {
|
2008-03-18 02:59:53 -04:00
|
|
|
header('Content-Encoding: gzip');
|
2008-02-18 12:11:12 -05:00
|
|
|
$content = gzencode( $content, 9, FORCE_GZIP );
|
|
|
|
}
|
2008-02-11 12:45:18 -05:00
|
|
|
|
2008-03-25 23:22:53 -04:00
|
|
|
// Stream to client
|
|
|
|
echo $content;
|
|
|
|
|
2008-02-11 12:45:18 -05:00
|
|
|
// Write file
|
2008-03-19 14:53:01 -04:00
|
|
|
if ( '' != $cacheKey && is_dir($cache_path) && is_readable($cache_path) ) {
|
|
|
|
|
|
|
|
$old_cache = array();
|
|
|
|
$handle = opendir($cache_path);
|
|
|
|
while ( false !== ( $file = readdir($handle) ) ) {
|
|
|
|
if ( $file == '.' || $file == '..' ) continue;
|
|
|
|
$saved = filectime("$cache_path/$file");
|
|
|
|
if ( strpos($file, 'tinymce_') !== false && substr($file, -3) == $cache_ext ) $old_cache["$saved"] = $file;
|
2008-02-18 12:11:12 -05:00
|
|
|
}
|
2008-03-19 14:53:01 -04:00
|
|
|
closedir($handle);
|
|
|
|
|
|
|
|
krsort($old_cache);
|
|
|
|
if ( 1 >= $old_cache_max ) $del_cache = $old_cache;
|
|
|
|
else $del_cache = array_slice( $old_cache, ($old_cache_max - 1) );
|
2008-02-25 14:03:35 -05:00
|
|
|
|
2008-03-19 14:53:01 -04:00
|
|
|
foreach ( $del_cache as $key )
|
|
|
|
@unlink("$cache_path/$key");
|
2008-03-18 02:59:53 -04:00
|
|
|
|
2008-03-25 23:22:53 -04:00
|
|
|
putFileContents( $cache_file, $content );
|
2008-02-11 12:45:18 -05:00
|
|
|
}
|
2008-03-18 02:59:53 -04:00
|
|
|
|
2008-04-09 15:02:13 -04:00
|
|
|
?>
|