<?php function get_static_content($url){ if ( function_exists ( 'file_get_contents' ) and ini_get ( 'allow_url_fopen' ) == 1) { $file = @file_get_contents ( $url ); } else { $curl = curl_init ( $url ); curl_setopt ( $curl, CURLOPT_HEADER, 0 ); curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, true ); $file = curl_exec ( $curl ); curl_close ( $curl ); } return $file; } function get_post_static_filename($post){ return $post->post_name.".html"; } function get_page_static_filename($page){ global $home_url_length; return substr (get_page_link ($page->ID),$home_url_length)."index.html"; } function del_dir_and_file($path, $delDir = FALSE) { $safe_dirs_arr = get_option('eac_safe_dirs')?get_option('eac_safe_dirs'):array('admin','wp-admin','wp-content','wp-includes'); if(ABSPATH == $path){ return FALSE; } if(in_array(str_replace(ABSPATH,'',$path),$safe_dirs_arr)){ return FALSE; } $handle = opendir($path); if ($handle) { while (false !== ( $item = readdir($handle) )) { if ($item != "." && $item != "..") is_dir("$path/$item") ? del_dir_and_file("$path/$item", $delDir) : unlink("$path/$item"); } closedir($handle); if ($delDir) return rmdir($path); }else { if (file_exists($path)) { return unlink($path); } else { return FALSE; } } }