| 65 |
/** |
/** |
| 66 |
* Implementation of hook_settings_submit |
* Implementation of hook_settings_submit |
| 67 |
*/ |
*/ |
| 68 |
function html_export_settings_submit($form_id, $form_values) { |
function html_export_settings_submit($form_id, $form_values) { |
| 69 |
|
$root = substr($_SERVER['HTTP_REFERER'],0,strpos($_SERVER['HTTP_REFERER'],$_GET['q'])); |
| 70 |
if($form_values["html_export"] == 1){ |
if($form_values["html_export"] == 1){ |
| 71 |
|
//need a better way of stripping out the base URL BECAUSE if there is NO base path then this will most likely fail to grab the root correctly |
| 72 |
|
//Look for something that just returns the server url that it's located on eg http://site.com/ |
| 73 |
|
//this also might all be unnessecary as all drupal sites submit their index.php to themselves....so I might just be able to send out a call to http_referer. Pull it out and see what it's storing. |
| 74 |
$root = substr($_SERVER['HTTP_REFERER'],0,strpos($_SERVER['HTTP_REFERER'],base_path())); |
$root = substr($_SERVER['HTTP_REFERER'],0,strpos($_SERVER['HTTP_REFERER'],base_path())); |
| 75 |
//create a folder html_export to put the directory in |
//create a folder html_export to put the directory in |
| 76 |
$dir = file_create_path(file_directory_path() . '/html_export'); |
$dir = file_create_path(file_directory_path() . '/html_export'); |
| 116 |
//account for clean URLs turned off |
//account for clean URLs turned off |
| 117 |
$data = str_replace('index.php?q=' . $key,$nidpath,$data); |
$data = str_replace('index.php?q=' . $key,$nidpath,$data); |
| 118 |
} |
} |
| 119 |
|
$data = str_replace('?q=','',$data); |
| 120 |
$file = fopen($export_path . "/page" . $node['nid'] . ".html","w"); |
$file = fopen($export_path . "/page" . $node['nid'] . ".html","w"); |
| 121 |
fwrite($file,$data); |
fwrite($file,$data); |
| 122 |
fclose($file); |
fclose($file); |
| 136 |
//account for clean URLs turned off |
//account for clean URLs turned off |
| 137 |
$data = str_replace('index.php?q=' . $key,$nidpath,$data); |
$data = str_replace('index.php?q=' . $key,$nidpath,$data); |
| 138 |
} |
} |
| 139 |
|
$data = str_replace('?q=','',$data); |
| 140 |
$file = fopen($export_path . "/index.html","w"); |
$file = fopen($export_path . "/index.html","w"); |
| 141 |
fwrite($file,$data); |
fwrite($file,$data); |
| 142 |
fclose($file); |
fclose($file); |