Changeset 808562
- Timestamp:
- 11/22/2013 01:53:45 AM (12 years ago)
- Location:
- tr-cache-and-security/trunk
- Files:
-
- 4 added
- 9 edited
-
admin/classes/tr_admin_page_class_v5.php (added)
-
admin/css/admin.css (modified) (1 diff)
-
admin/images/loading.gif (added)
-
admin/js/Admin_Page_Class.js (modified) (8 diffs)
-
inc/actions.php (modified) (1 diff)
-
inc/admin.php (modified) (2 diffs)
-
inc/cache_security_clean.php (modified) (3 diffs)
-
inc/init.php (modified) (2 diffs)
-
inc/install.php (modified) (2 diffs)
-
inc/tr_cache_class.php (added)
-
inc/tr_security_class.php (modified) (1 diff)
-
inc/trcs_cache-options.php (added)
-
plug.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tr-cache-and-security/trunk/admin/css/admin.css
r785643 r808562 356 356 margin-top:2px; 357 357 } 358 .tab_title{font-size:18px;font-weight:600} -
tr-cache-and-security/trunk/admin/js/Admin_Page_Class.js
r786017 r808562 522 522 var group = jQuery("#option_group_name").val(); 523 523 var seq_selector = "#apc_" + which + "_nonce"; 524 var action_selctor = "apc_" + which + "_" + group;524 var action_selctor = "apc_" + which+'_tr'; 525 525 jQuery.ajaxSetup({ cache: false }); 526 526 if (which == 'export') … … 581 581 action: action, 582 582 seq: jQuery(seq_selector).val(), 583 imp: jQuery("# import_code").val(),583 imp: jQuery("#export_code").val(), 584 584 }, 585 585 function(data) { … … 605 605 */ 606 606 function before_ajax_import_export(which){ 607 jQuery(".import_status").hide("fast");608 607 jQuery(".export_status").hide("fast"); 609 608 jQuery(".export_results").html('').removeClass('alert-success').hide(); 610 jQuery(".import_results").html('').removeClass('alert-success').hide(); 611 if (which == 'import') 612 jQuery(".import_status").show("fast"); 613 else 614 jQuery(".export_status").show("fast"); 609 jQuery(".export_status").show("fast"); 615 610 } 616 611 … … 625 620 */ 626 621 function after_ajax_import_export(which){ 627 if (which == 'import')628 jQuery(".import_status").hide("fast");629 else630 622 jQuery(".export_status").hide("fast"); 631 623 } … … 661 653 jQuery("#apc_import_nonce").val(data.nonce); 662 654 if(data.err) 663 jQuery(". import_results").html(data.err);655 jQuery(".export_results").html(data.err).show(); 664 656 if (data.success) 665 jQuery(". import_results").html(data.success).addClass('alert-success').show('slow');657 jQuery(".export_results").html(data.success).addClass('alert-success').show('slow'); 666 658 } 667 659 … … 672 664 */ 673 665 jQuery("#apc_import_b").live("click",function(){ 666 if($('#export_code').val()=='') 667 { 668 jQuery(".export_results").html('Please Add Code below to Import').show(); 669 return false; 670 } 674 671 do_ajax_import_export('import'); 675 672 }); … … 711 708 success:function(rs){ 712 709 $('.msg_alert_success',$this).html('The options are been restored!').css('display','block').removeClass('saving'); 713 location.reload();710 refresh_page(); 714 711 } 715 712 }) … … 727 724 */ 728 725 function refresh_page(){ 729 location .reload();726 location = location.href; 730 727 } 731 728 $('input[type="checkbox"]').each(function(){ -
tr-cache-and-security/trunk/inc/actions.php
r806087 r808562 338 338 339 339 //cache cache_media 340 if($cache_options[' on'] && $cache_options['cache_media'])340 if($cache_options['cache_media']) 341 341 { 342 342 $need.="# 1 WEEK\n<FilesMatch \"\.(jpg|jpeg|png|gif|swf|ico)$\">\n"; -
tr-cache-and-security/trunk/inc/admin.php
r796375 r808562 15 15 'slug' => 'trcs_settings', 16 16 'page_title' => 'Cache & Security', //The name of this page 17 'menu_title' => 'Cache & Security',17 //'menu_title' => 'Cache & Security', 18 18 'capability' => 'edit_themes', // The capability needed to view the page 19 19 'option_group' => 'trcs_cache', //the name of the option to create in the database 20 'id' => 'trcs_settings', // meta box id, unique per page21 'fields' => array(), // list of fields (can be added by field arrays)22 20 'local_images' => true, // Use local or hosted images (meta box images for add/remove) 23 21 // 'icon_url' => TRJM_URL.'images/mobile.png', 24 22 'use_with_theme' => false , //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false). 25 23 'path' => dirname(dirname(__FILE__)), 24 'usebackup' => true, 26 25 'tabs' => array( 27 26 'this' => 'Cache', 28 'trcs_security' => array('option'=>'tr_security','label'=>'Security') 27 'trcs_security' => array('option'=>'tr_security','label'=>'Security'), 29 28 ) 30 29 ); … … 33 32 * Initiate your admin page 34 33 */ 35 new TR_Admin_Page_Class_V 4($config);34 new TR_Admin_Page_Class_V5($config); 36 35 37 36 -
tr-cache-and-security/trunk/inc/cache_security_clean.php
r804796 r808562 2 2 global $wpdb; 3 3 4 //clear cache 5 $current_time = time(); 6 $cache_options = get_option('trcs_cache'); 7 $timeout = $cache_options['timeout']*60; 8 if ($timeout >0 && $cache_options['on']) 4 function tr_cache_clear_dir($path,$timeout,$current_time) 9 5 { 10 $path = TRSCSC_CACHE_PATH;11 $time = time();12 13 6 $handle = @opendir($path); 14 7 if ($handle) { … … 17 10 18 11 $t = @filemtime($path . '/' . $file); 19 if ($ time - $t > $timeout || ($invalidation_time && $t < $invalidation_time)) {12 if ($current_time - $t > $timeout ) { 20 13 @unlink($path . '/' . $file); 21 14 } … … 25 18 } 26 19 20 //clear cache 21 $timeout30 = 86400 * 30;//30days 22 $current_time = time(); 23 $cache_options = get_option('trcs_cache'); 24 $timeout = $cache_options['timeout']*60; 25 if ($timeout >0 && $cache_options['on']) 26 { 27 tr_cache_clear_dir(TRSCSC_CACHE_PATH,$timeout,$current_time); 28 } 29 30 //clear cache js 31 $path = WP_CONTENT_DIR .'/'. TRSCSC_CACHE_JS; 32 $timeout = ($timeout < $timeout30)? $timeout30 : $timeout; 33 tr_cache_clear_dir($path,$timeout,$current_time); 34 35 //clear cache css 36 $path = WP_CONTENT_DIR .'/'. TRSCSC_CACHE_CSS; 37 $timeout = ($timeout < $timeout30)? $timeout30 : $timeout; 38 tr_cache_clear_dir($path,$timeout,$current_time); 39 40 //end clear cache 27 41 28 42 43 44 //update security ban list 29 45 $need_update_htacess = false; 30 //update security ban list31 46 $secure_options = get_option('tr_security',array()); 32 47 if($secure_options['enable_auto_ban']) -
tr-cache-and-security/trunk/inc/init.php
r791202 r808562 7 7 add_action('save_post', 'tr_wp_insert_comment', 10,1); 8 8 9 10 9 11 function tr_cache_plugin_init() 10 12 { … … 13 15 include_once(TRSCSC_PATH.'inc/actions.php'); 14 16 } 15 if(!is_admin() && !is_user_logged_in())17 if(!is_admin()) 16 18 { 17 add_filter( 'show_admin_bar', '__return_false' ,99); 19 if(!is_user_logged_in()) 20 add_filter( 'show_admin_bar', '__return_false' ,99); 21 22 global $tr_cache_options; 23 if(!is_array($tr_cache_options)) 24 $tr_cache_options = get_option('trcs_cache',array()); 25 26 if($tr_cache_options['optimize_js'] || $tr_cache_options['optimaze_css']) 27 { 28 $cache_obj = Tr_Cache_Class::instance(); 29 if(!Tr_Cache_Class::$has_run) 30 add_action('template_redirect',array(&$cache_obj,'template_redirect'),1); 31 } 32 18 33 } 19 34 } -
tr-cache-and-security/trunk/inc/install.php
r797937 r808562 7 7 $config = array( 8 8 'option_group' => 'tr_security', 9 'id' => 'trcs_settings',10 9 'path' => dirname(dirname(__FILE__)), 11 10 ); 12 $secu = new TR_Admin_Page_Class_V 4($config);11 $secu = new TR_Admin_Page_Class_V5($config); 13 12 $secu->loadconfig('trcs_security'); 14 13 $secu->restore(); … … 21 20 $config = array( 22 21 'option_group' => 'trcs_cache', 23 'id' => 'trcs_settings',24 22 'path' => dirname(dirname(__FILE__)), 25 23 ); 26 $secu = new TR_Admin_Page_Class_V 4($config);27 $secu->loadconfig('trcs_ settings');24 $secu = new TR_Admin_Page_Class_V5($config); 25 $secu->loadconfig('trcs_cache'); 28 26 $secu->restore(); 29 27 } -
tr-cache-and-security/trunk/inc/tr_security_class.php
r806071 r808562 417 417 $_SESSION['tr_sec_auto'] =$current_time; 418 418 } 419 else if(!isset($_SESSION['tr_sec_auto']) || $_SESSION['tr_sec_auto'] < $current_time - 3600)419 else if(!isset($_SESSION['tr_sec_auto']) || $_SESSION['tr_sec_auto'] < $current_time - 86400) 420 420 { 421 421 $codecheck = wp_generate_password(12,false); -
tr-cache-and-security/trunk/plug.php
r806087 r808562 14 14 define('TRSCSC_PATH',plugin_dir_path(__FILE__).'/'); 15 15 define('TRSCSC_CACHE_PATH',WP_CONTENT_DIR . '/cache/tr-cache'); 16 define('TRSCSC_CACHE_JS_PATH','/cache/js'); 17 define('TRSCSC_CACHE_CSS_PATH','/cache/css'); 16 18 define('TRSCSC_SERVER','http://ngoctrinh.net/wp-load.php'); 17 19
Note: See TracChangeset
for help on using the changeset viewer.