'.__('Settings', 'tw_asi-settings').''; array_unshift($links, $settings_link); return $links; } $tw_asi_plugin = TWASI_PLUGIN_BASENAME; add_filter("plugin_action_links_$tw_asi_plugin", 'tw_asi_settings_link' ); function tw_asi_getSizes($size){ $size_r = ''; if($size==0){ $size_r = "0"; } else if($size<1024){ $size_r = $size. ' B'; } else if($size>=1024 && $size<(1024*1024)){ $size_r = round($size/(1024),2). ' KB'; } else{ $size_r = round($size/(1024*1024),2). ' MB'; } return $size_r; } function tw_asi_table_optimize($tables){ global $wpdb; $status = true; $sql_opt = "OPTIMIZE TABLE ".$tables; $wpdb->query($sql_opt); return $status; } function tw_asi_table_remove($type){ global $wpdb; $status = true; if($type==1){ $sql = "DELETE FROM `$wpdb->posts` WHERE post_type = 'revision'"; $wpdb->query( $sql ); } else if($type==2){ $sql = "DELETE FROM `$wpdb->posts` WHERE post_status = 'auto-draft'"; $wpdb->query( $sql ); } else if($type==3){ $sql = "DELETE FROM `$wpdb->posts` WHERE post_status = 'trash'"; $wpdb->query( $sql ); $sql = "DELETE asi FROM `$wpdb->postmeta` asi LEFT JOIN `$wpdb->posts` wp ON wp.ID = asi.post_id WHERE wp.ID IS NULL"; $wpdb->query( $sql ); } else if($type==4){ $sql = "DELETE FROM `$wpdb->comments` WHERE comment_approved = 'spam'"; $wpdb->query( $sql ); } else if($type==5){ $sql = "DELETE FROM `$wpdb->comments` WHERE comment_approved = 'trash'"; $wpdb->query( $sql ); } else if($type==6){ $sql = "DELETE FROM `$wpdb->options` WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'"; $wpdb->query( $sql ); } return $status; } function tw_asi_minify_html ($buffer) { $initial = strlen($buffer); $tw_asi_html1 = get_option( 'tw_asi_html1', 0 ); if($tw_asi_html1==1){ $search = array( '/\>[^\S ]+/s', // strip whitespaces after tags, except space '/[^\S ]+\', '<', '\\1' ); $buffer = preg_replace($search, $replace, $buffer); } $final = strlen($buffer); $savings = round((($initial-$final)/$initial*100), 3); if ($savings != 0) { $buffer .= PHP_EOL . ''; } return $buffer; } function tw_asi_minify() { ob_start('tw_asi_minify_html'); } add_action('get_header', 'tw_asi_minify'); function tw_asi_admin_register_head() { $siteurl = get_option('siteurl'); $url = $siteurl . '/wp-content/plugins/' . basename(dirname(__FILE__)) . '/assets/css/admin.css'; echo "\n"; } add_action('admin_head', 'tw_asi_admin_register_head'); function tw_asi_admin_message() { $tw_asi_msg = get_option( 'tw_asi_msg', 0 ); if($tw_asi_msg!=1){ echo '
Checkout our new features Advanced Speed Increaser