Changeset 434338
- Timestamp:
- 09/06/2011 10:37:12 PM (15 years ago)
- Location:
- wp-green-cache/trunk
- Files:
-
- 4 edited
-
lib.php (modified) (5 diffs)
-
options.php (modified) (9 diffs)
-
plugin.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-green-cache/trunk/lib.php
r426960 r434338 248 248 } 249 249 wpgc_activate(); 250 } 250 } 251 251 } 252 252 } … … 346 346 347 347 if (!is_writable( ABSPATH . 'wp-config.php' )) 348 $wpgc_notice .= '<b>Warning:</b> Wordpress config file (wp-config.php) is not writable by server.'349 .'Check its permissions. ';348 $wpgc_notice .= _('<b>Warning:</b> Wordpress config file (wp-config.php) is not writable by server.' 349 .'Check its permissions. (Dont forget to restore original value [ex: 640])', 'wpgc'); 350 350 351 351 if (!is_writable( ABSPATH . 'wp-content/' )) 352 $wpgc_notice .= '<b>Warning:</b> Wordpress content directory (wp-content/) is not writable by server.'353 .'Check its permissions. ';352 $wpgc_notice .= _('<b>Warning:</b> Wordpress content directory (wp-content/) is not writable by server.' 353 .'Check its permissions. (Dont forget to restore original value.)', 'wpgc'); 354 354 355 355 if (!empty($wpgc_notice)) … … 462 462 } 463 463 closedir($handle); 464 return 'Files count: '.$count . ', Total size: ' . wpgc_formatBytes($size, 2).''; 465 } 466 return 'Couldnt open dir: ' . dirname(__FILE__) . '/cache'; 464 $ret = 'Files count: '.$count . ', Total size: ' . wpgc_formatBytes($size, 2).''; 465 466 } else 467 $ret = 'Couldnt open dir: ' . dirname(__FILE__) . '/cache'; 468 469 $ret .= " (<a href='".$_SERVER['REQUEST_URI']."&clean_cache=true' title='"._('Delete all cached files', 'wpgc')."'>"._('Clear cache', 'wpgc')."</a>)"; 470 471 return $ret; 467 472 } 468 473 … … 731 736 $profited_tree = sprintf("%.3f", $profited_watt * 0.59239163522); 732 737 733 $mes .= "Total code run time decreased to <b>%s</b> which was <b>%s</b>before plugin, ";734 $mes .= 'so you saved <b>%s</b>(%s) of code run time. ';738 $mes .= "Total code run time decreased to %s which was %s before plugin, "; 739 $mes .= 'so you saved %s (%s) of code run time. '; 735 740 $mes .= "This plugin also enabling the bandwidth compression which ends up with "; 736 $mes .= "reduced total bandwidth from <b>%s</b> to <b>%s</b>. "; 737 $mes .= "In this way, according to the current server configuration you "; 738 $mes .= "saved about <b>%s</b> energy and saved <b>%s</b> "; 739 $mes .= "(<i>Your server has %s CPU cores, %s HD, %s network interfaces and %s mainboard devices.</i>)"; 740 741 $mes .= "reduced total bandwidth from %s to %s. "; 742 $mes .= "In this way, according to the current %s "; 743 $mes .= "saved about %s energy and saved %s "; 744 745 $server_conf = sprintf("(Your server has %s CPU cores, %s HD, %s network interfaces and %s mainboard devices.)", 746 $hw['cpu_count'], 747 $hw['hdd_count'], 748 $hw['eth_count'], 749 $hw['main_board_devices_count']); 741 750 742 751 $mes = sprintf($mes, … … 748 757 c($c_sent, 'green'), 749 758 c($profited_watt.' kWh', 'green'), 750 c($profited_tree.' trees being shorn, thank you.', 'green'), 751 $hw['cpu_count'], 752 $hw['hdd_count'], 753 $hw['eth_count'], 754 $hw['main_board_devices_count'] 759 '<span title="'.$server_conf.'"><u>server configuration you</u></span>', 760 c($profited_tree.' trees being shorn, thank you.', 'green') 755 761 ); 756 762 757 $mes = _ e($mes, 'wpgc');763 $mes = _($mes, 'wpgc'); 758 764 return $mes; 759 765 } -
wp-green-cache/trunk/options.php
r428529 r434338 17 17 */ 18 18 19 20 21 function wpsc_options() 19 function wpgc_options() 22 20 { 23 21 if (is_admin()) 24 22 { 25 23 // Print warnings about directory permisions 26 $wp sc_ok = wpsc_is_cache_writable() && wpsc_is_config_writable() && wpsc_check_configuration();27 28 if ( $wp sc_ok )24 $wpgc_ok = wpgc_is_cache_writable() && wpgc_is_config_writable() && wpgc_check_configuration(); 25 26 if ( $wpgc_ok ) 29 27 { 30 28 if (isset($_POST['save'])) 31 29 { 32 30 // Clear inbound parameters 33 $old_options = wp sc_get_options();31 $old_options = wpgc_get_options(); 34 32 $options = stripslashes_deep($_POST['options']); 35 33 36 34 // Clean cache switching on compressed/uncompressed modes 37 35 if ( $options['compress'] != $old_options['compress'] ) 38 wp sc_clean_cache();36 wpgc_clean_cache(); 39 37 40 wp sc_update_options($options);38 wpgc_update_options($options); 41 39 42 40 // Activate/deactivate cache mechanism of wordpress 43 41 if ( $options['enabled'] != $old_options['enabled'] ) 44 42 if ( $options['enabled'] ) 45 wp sc_activate();43 wpgc_activate(); 46 44 else 47 wp sc_deactivate();45 wpgc_deactivate(); 48 46 } 49 47 50 if (isset($_ POST['clean']))51 wp sc_clean_cache();52 53 $options = wp sc_get_options();48 if (isset($_GET['clean_cache'])) 49 wpgc_clean_cache(); 50 51 $options = wpgc_get_options(); 54 52 } 55 53 ?> … … 58 56 <tr > 59 57 <td valign='top' height='100'> 60 <a href='http://www.tankado.com/wp- simple-cache/' target='_blank'>61 <img src="/wp-content/plugins/wp- simple-cache/images/WPSC-banner.png">58 <a href='http://www.tankado.com/wp-green-cache/' target='_blank'> 59 <img src="/wp-content/plugins/wp-green-cache/images/WPGC-banner.png"> 62 60 </a> 63 61 </td> … … 73 71 </table> 74 72 75 <div class="wrap">76 <div id="poststuff" class="metabox-holder">77 <div class="meta-box-sortables">73 <div class="wrap"> 74 <div id="poststuff" class="metabox-holder"> 75 <div class="meta-box-sortables"> 78 76 <script> 79 77 jQuery(document).ready(function($) { … … 84 82 </script> 85 83 86 <p> 87 <span style="background-color:red; color:white; font-size:24px; line-height:30px"> 88 <b>Important:</b> Now, WP Simple Cache plugin continious as WP Green Cache. Please <b>uninstall this plugin</b> and <b><a href='http://wordpress.org/extend/plugins/wp-green-cache/'>install</a> WP Green Cache</b>. 89 </span> 90 </p> 91 92 93 94 <?php if( !$wpsc_ok ) 84 <?php if( !$wpgc_ok ) 95 85 echo "<div style='background-color:#d0d0d0;z-index:1000;opacity:0.85'>"; 96 86 ?> … … 100 90 <!-- #################################################################################### --> 101 91 <div class="postbox" id="dashboard_right_now"> 102 <div class="handlediv" title="Click to open/close"><br /></div><h3 class='hndle'><?php _e('Cache status', 'wpsc'); ?></h3> 103 <div class="inside"> 104 105 <table class="form-table"> 106 <tr valign="top"> 107 <th><?php _e('Cached files', 'wpsc'); ?></th> 108 <td><?php echo wpsc_get_cache_status(); ?></td> 109 </tr> 110 </table> 111 <p class="submit"> 112 <input class="button" type="submit" name="clean" value="<?php _e('Clear cache', 'wpsc'); ?>" <?php echo (!$wpsc_ok) ? 'disabled':''; ?>> 113 </p> 114 115 </div> 92 <div class="handlediv" title="Click to open/close"><br /></div> 93 <h3 class='hndle'><?php _e('Cache status', 'wpgc'); ?></h3> 94 <div class="inside"> 95 <table class="form-table"> 96 <tr valign="top"> 97 <td> 98 <?php _e('Enable WP Green Cache', 'wpgc'); ?> 99 <input type="hidden" name="options[enabled]" value="0"> 100 <input type="checkbox" name="options[enabled]" value="1" <?php echo $options['enabled']?'checked':''; ?>/> <br /> 101 </td> 102 </tr> 103 <tr valign="top"> 104 <td><?php echo wpgc_get_cache_status(); ?></td> 105 </tr> 106 <tr valign="top"> 107 <td><?php echo wpgc_get_cache_gains(); ?></td> 108 </tr> 109 <tr> 110 <td> 111 112 <input class="button" type="submit" name="save" value="<?php _e('Save'); ?>" <?php echo (!$wpgc_ok) ? 'disabled':''; ?>> 113 114 </td> 115 </tr> 116 </table> 117 </div> 116 118 </div> 117 119 118 120 <!-- #################################################################################### --> 119 <div class="postbox" id="dashboard_right_now"> 120 <div class="handlediv" title="Click to open/close"><br /></div><h3 class='hndle'><?php _e('Cache settings', 'wpsc'); ?></h3> 121 <div class="postbox closed" id="dashboard_right_now"> 122 <div class="handlediv" title="Click to open/close"><br /></div> 123 <h3 class='hndle'><?php _e('Cache settings', 'wpgc'); ?></h3> 121 124 <div class="inside"> 122 125 123 <table class="form-table"> 124 <tr valign="top"> 125 <th><?php _e('Enable WP Simple Cache', 'wpsc'); ?></th> 126 <td> 127 <input type="hidden" name="options[enabled]" value="0"> 128 <input type="checkbox" name="options[enabled]" value="1" <?php echo $options['enabled']?'checked':''; ?>/> <br /> 129 </td> 130 </tr> 131 <tr valign="top"> 132 <th><?php _e('Cached pages timeout', 'wpsc'); ?></th> 133 <td> 134 <input type="text" size="5" name="options[cache_ttl]" value="<?php echo htmlspecialchars($options['cache_ttl']); ?>"/> (<?php _e('minutes', 'wpsc'); ?>) <br /> 135 <?php _e('Minutes a cached page is valid and served to users. A zero value means a cached page is valid forever.', 'wpsc'); ?> 136 <?php _e('If a cached page is older than specified value (expired) it is no more used and will be regenerated on next request of it.', 'wpsc'); ?> 137 <?php _e('720 minutes is half a day, 1440 is a full day and so on.', 'wpsc'); ?> 138 </td> 139 </tr> 140 <tr valign="top"> 141 <th><?php _e('Cache autoclean', 'wpsc'); ?></th> 126 <table class="form-table"> 127 <tr valign="top"> 128 <th><?php _e('Cached pages timeout', 'wpgc'); ?></th> 129 <td> 130 <input type="text" size="5" name="options[cache_ttl]" value="<?php echo htmlspecialchars($options['cache_ttl']); ?>"/> (<?php _e('minutes', 'wpgc'); ?>) <br /> 131 <?php _e('Minutes a cached page is valid and served to users. A zero value means a cached page is valid forever.', 'wpgc'); ?> 132 <?php _e('If a cached page is older than specified value (expired) it is no more used and will be regenerated on next request of it.', 'wpgc'); ?> 133 <?php _e('720 minutes is half a day, 1440 is a full day and so on.', 'wpgc'); ?> 134 </td> 135 </tr> 136 <tr valign="top"> 137 <th><?php _e('Cache autoclean', 'wpgc'); ?></th> 142 138 <td> 143 139 <input type="hidden" name="options[last_cleaning]" value="<?php echo $options['last_cleaning']; ?>"> 144 <input type="text" size="5" name="options[clean_interval]" value="<?php echo htmlspecialchars($options['clean_interval']); ?>"/> (<?php _e('minutes', 'wp sc'); ?>) <br />145 <?php _e('Frequency of the autoclean process which removes to expired cached pages to free disk space.', 'wp sc'); ?>146 <?php _e('If Cache autoclean is set to zero, autoclean never runs.', 'wp sc'); ?>147 </td> 148 </tr> 149 <tr valign="top"> 150 <th><?php _e('Compression', 'wp sc'); ?></th>151 <td> 152 <?php if (!wp sc_check_gz_funcs()) { ?>153 <p><?php _e('<i>Your hosting server has not the gzcompress/gzuncompress and gzencode/gzdecode functions, so no compression options are available.</i>', 'wp sc'); ?></p>140 <input type="text" size="5" name="options[clean_interval]" value="<?php echo htmlspecialchars($options['clean_interval']); ?>"/> (<?php _e('minutes', 'wpgc'); ?>) <br /> 141 <?php _e('Frequency of the autoclean process which removes to expired cached pages to free disk space.', 'wpgc'); ?> 142 <?php _e('If Cache autoclean is set to zero, autoclean never runs.', 'wpgc'); ?> 143 </td> 144 </tr> 145 <tr valign="top"> 146 <th><?php _e('Compression', 'wpgc'); ?></th> 147 <td> 148 <?php if (!wpgc_check_gz_funcs()) { ?> 149 <p><?php _e('<i>Your hosting server has not the gzcompress/gzuncompress and gzencode/gzdecode functions, so no compression options are available.</i>', 'wpgc'); ?></p> 154 150 <?php } else { ?> 155 151 <input type="hidden" name="options[compress]" value="0"> 156 <input type="checkbox" name="options[compress]" value="<?php echo wp sc_check_gz_funcs(); ?>" <?php echo $options['compress']?'checked':''; ?> /> <br />157 <?php _e('If possible the page will be sent and stored as compressed to save bandwidth and storege quate.', 'wp sc'); ?>158 <?php _e('If you switch this option then the cache will be cleaned.', 'wp sc'); ?>152 <input type="checkbox" name="options[compress]" value="<?php echo wpgc_check_gz_funcs(); ?>" <?php echo $options['compress']?'checked':''; ?> /> <br /> 153 <?php _e('If possible the page will be sent and stored as compressed to save bandwidth and storege quate.', 'wpgc'); ?> 154 <?php _e('If you switch this option then the cache will be cleaned.', 'wpgc'); ?> 159 155 <?php } ?> 160 156 </td> 161 157 </tr> 162 158 <tr valign="top"> 163 <th><?php _e('Show performance box', 'wp sc'); ?></th>159 <th><?php _e('Show performance box', 'wpgc'); ?></th> 164 160 <td> 165 161 <input type="hidden" name="options[perf_footer]" value="0"> 166 162 <input type="checkbox" name="options[perf_footer]" value="1" <?php echo $options['perf_footer']?'checked':''; ?>/> <br /> 167 <?php _e('When activated the performance box it will be attached to top-right of every page.', 'wp sc'); ?>163 <?php _e('When activated the performance box it will be attached to top-right of every page.', 'wpgc'); ?> 168 164 <?php _e('Performance box views SQL query count and page generation time that you inform about blog performance.', 'hyper-cache'); ?> 169 <?php _e('I suggest you to see advantage of WPSC compare the values when WPSC is enabled and disabled.', 'wpsc'); ?>165 <?php _e('I suggest you to see advantage of wpgc compare the values when wpgc is enabled and disabled.', 'wpgc'); ?> 170 166 </td> 171 167 </tr> … … 173 169 <td> 174 170 <p class="submit"> 175 <input class="button" type="submit" name="save" value="<?php _e('Update'); ?>" <?php echo (!$wp sc_ok) ? 'disabled':''; ?>>171 <input class="button" type="submit" name="save" value="<?php _e('Update'); ?>" <?php echo (!$wpgc_ok) ? 'disabled':''; ?>> 176 172 </p> 177 173 </td> … … 183 179 <!-- #################################################################################### --> 184 180 <div class="postbox closed" id="dashboard_right_now"> 185 <div class="handlediv" title="Click to open/close"><br /></div><h3 class='hndle'><?php _e('Extra options', 'wp sc'); ?></h3>181 <div class="handlediv" title="Click to open/close"><br /></div><h3 class='hndle'><?php _e('Extra options', 'wpgc'); ?></h3> 186 182 <div class="inside"> 187 183 <table class="form-table"> 188 184 <tr valign="top"> 189 <th><?php _e('Include php', 'wp sc'); ?></th>185 <th><?php _e('Include php', 'wpgc'); ?></th> 190 186 <td> 191 187 <input type="text" size="70" name="options[include_php]" value="<?php echo htmlspecialchars($options['include_php']); ?>"/><br> 192 <?php _e('When WPSC is active if you run any php script write the path of script starting from server root.', 'wpsc'); ?><br>193 <?php _e('Example: ', 'wp sc'); ?>188 <?php _e('When wpgc is active if you run any php script write the path of script starting from server root.', 'wpgc'); ?><br> 189 <?php _e('Example: ', 'wpgc'); ?> 194 190 <?php echo '<i>'.dirname(__FILE__).'/example.php'.'</i>'; ?> 195 191 </td> … … 198 194 <td> 199 195 <p class="submit"> 200 <input class="button" type="submit" name="save" value="<?php _e('Update'); ?>" <?php echo (!$wp sc_ok) ? 'disabled':''; ?>>196 <input class="button" type="submit" name="save" value="<?php _e('Update'); ?>" <?php echo (!$wpgc_ok) ? 'disabled':''; ?>> 201 197 </p> 202 198 </td> … … 207 203 208 204 </form> 209 <?php if (!$wp sc_ok)205 <?php if (!$wpgc_ok) 210 206 echo "</div>"; 211 207 ?> -
wp-green-cache/trunk/plugin.php
r434175 r434338 3 3 Plugin Name: WP Green Cache 4 4 Plugin URI: http://www.tankado.com/wp-green-cache/ 5 Version: 0.1. 35 Version: 0.1.4 6 6 Description: WP Green Cache plugin is a cache system for WordPress Blogs to improve performance and save the World. 7 7 Author: Özgür Koca -
wp-green-cache/trunk/readme.txt
r434175 r434338 63 63 3. Make "/wp-content/plugins/wp-green-cache/cache/" directory writable (0777) 64 64 4. Add this line to the wp-config.php file ("/wp-config.php"): define('WP_CACHE', true); 65 5. Set file access permision to 640 for wp-config.php (for security) 65 66 5. Go into the WordPress admin interface and activate the plugin 66 67 6. Go to the options page and enabled it … … 110 111 == Changelog == 111 112 113 = 0.1.4 = 114 115 * Fixed bugs 116 112 117 = 0.1.3 = 113 118
Note: See TracChangeset
for help on using the changeset viewer.