| 38 |
/** |
/** |
| 39 |
* Implementation of hook_menu |
* Implementation of hook_menu |
| 40 |
*/ |
*/ |
| 41 |
function html_export_menu($may_cache) { |
function html_export_menu() { |
| 42 |
$items = array(); |
$items = array(); |
| 43 |
$items[] = array('path' => 'admin/settings/html_export', |
$items['admin/settings/html_export'] = array( |
| 44 |
'title' => t('HTML Export'), |
'title' => 'HTML Export', |
| 45 |
'description' => t('Export to HTML'), |
'description' => 'Export your drupal site to static html page', |
| 46 |
'callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 47 |
'callback arguments' => 'html_export_settings', |
'page arguments' => array('html_export_settings'), |
| 48 |
'type' => MENU_NORMAL_ITEM, |
'access arguments' => array('access administration pages'), |
| 49 |
'access' => user_access('access administration pages')); |
'type' => MENU_NORMAL_ITEM, |
| 50 |
|
); |
| 51 |
return $items; |
return $items; |
| 52 |
} |
} |
| 53 |
/** |
/** |
| 61 |
'#options' => array(0 => 'No',1 => 'Yes'), |
'#options' => array(0 => 'No',1 => 'Yes'), |
| 62 |
'#required' => true, |
'#required' => true, |
| 63 |
); |
); |
| 64 |
|
$form['#submit'] = array('html_export_settings_submit'); |
| 65 |
return system_settings_form($form); |
return system_settings_form($form); |
| 66 |
} |
} |
| 67 |
/** |
/** |
| 68 |
* Implementation of hook_settings_submit |
* Implementation of hook_settings_submit |
| 69 |
*/ |
*/ |
| 70 |
function html_export_settings_submit($form_id, $form_values) { |
function html_export_settings_submit($form_id, $form_values) { |
| 71 |
if($form_values["html_export"] == 1){ |
if($form_values["values"]["html_export"] == 1) { |
| 72 |
$clean = variable_get('clean_url',0); |
$clean = variable_get('clean_url',0); |
| 73 |
//turn clean URLs off temporarily if they are on |
//turn clean URLs off temporarily if they are on |
| 74 |
if($clean){ |
if($clean){ |
| 94 |
$export_path = str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . $export_path; |
$export_path = str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . $export_path; |
| 95 |
|
|
| 96 |
//run the copyr function, modified to work with zip archive; copy the files,themes,sites,and misc directories |
//run the copyr function, modified to work with zip archive; copy the files,themes,sites,and misc directories |
| 97 |
_html_export_copyr(str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . file_directory_path(),$export_path . '/' . file_directory_path()); |
//_html_export_copyr(str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . file_directory_path(),$export_path . '/' . file_directory_path()); |
| 98 |
_html_export_copyr(str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . 'sites',$export_path . '/sites'); |
_html_export_copyr(str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . 'sites',$export_path . '/sites'); |
| 99 |
_html_export_copyr(str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . 'modules',$export_path . '/modules'); |
_html_export_copyr(str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . 'modules',$export_path . '/modules'); |
| 100 |
_html_export_copyr(str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . 'themes',$export_path . '/themes'); |
_html_export_copyr(str_replace('index.php','',$_SERVER['PATH_TRANSLATED']) . 'themes',$export_path . '/themes'); |
| 126 |
|
|
| 127 |
$nids[$url] = $tmp_url . '.html'; |
$nids[$url] = $tmp_url . '.html'; |
| 128 |
$nids['node/' . $node['nid']] = $tmp_url . '.html'; |
$nids['node/' . $node['nid']] = $tmp_url . '.html'; |
| 129 |
|
|
| 130 |
} |
} |
| 131 |
} |
} |
| 132 |
//run through all the nodes and render pages to add to the zip file |
//run through all the nodes and render pages to add to the zip file |