| 2 |
|
|
| 3 |
/* |
/* |
| 4 |
* Author : Tom MacWright, Young Hahn |
* Author : Tom MacWright, Young Hahn |
| 5 |
* Revision : $Id:$ |
* Revision : $Id$ |
| 6 |
*/ |
*/ |
| 7 |
|
|
| 8 |
/** |
/** |
| 147 |
$node = node_load($nid); |
$node = node_load($nid); |
| 148 |
set_error_handler("_word2web_suppress_errors"); |
set_error_handler("_word2web_suppress_errors"); |
| 149 |
$html = new DOMDocument(); |
$html = new DOMDocument(); |
| 150 |
$html->loadHTML($node->body); |
$html->loadXML($node->body); |
| 151 |
$images = $html->getElementsByTagName("image"); |
$images = $html->getElementsByTagName("image"); |
| 152 |
$i = 0; |
$i = 0; |
| 153 |
foreach ($images as $im) { |
foreach ($images as $im) { |
| 206 |
} |
} |
| 207 |
restore_error_handler(); |
restore_error_handler(); |
| 208 |
if ($i > 0) { |
if ($i > 0) { |
| 209 |
drupal_set_message(l(t('!num images in this !type need to be uploaded.', array('!type' => $node->type, '!num' => $i)), 'node/'. $node->nid .'/manage_images'), 'error'); |
drupal_set_message(l(t('!num '.format_plural($i, 'image', 'images').' in this !type need to be uploaded.', array('!type' => $node->type, '!num' => $i)), 'node/'. $node->nid .'/manage_images'), 'error'); |
| 210 |
} |
} |
| 211 |
} |
} |
| 212 |
|
|
| 234 |
if ($matches[1] == 'windows-1256') { |
if ($matches[1] == 'windows-1256') { |
| 235 |
$html_raw = iconv('windows-1256', 'utf-8', $html_raw); |
$html_raw = iconv('windows-1256', 'utf-8', $html_raw); |
| 236 |
} |
} |
| 237 |
|
if ($matches[1] == 'windows-1252') { |
| 238 |
|
$html_raw = iconv('windows-1252', 'utf-8', $html_raw); |
| 239 |
|
} |
| 240 |
$html = new DOMDocument(); |
$html = new DOMDocument(); |
| 241 |
$html->loadHTML($html_raw); |
$html->loadHTML($html_raw); |
| 242 |
$images = $html->getElementsByTagName("img"); |
$images = $html->getElementsByTagName("img"); |
| 323 |
|
|
| 324 |
function word2web_manual($html_raw) { |
function word2web_manual($html_raw) { |
| 325 |
$html_raw = _word2web_convert_chr($html_raw); |
$html_raw = _word2web_convert_chr($html_raw); |
| 326 |
|
preg_match('/charset=([\w-]+)/', $html_raw, $matches); |
| 327 |
|
|
| 328 |
|
if ($matches[1] == 'windows-1256') { |
| 329 |
|
$html_raw = iconv('windows-1256', 'utf-8', $html_raw); |
| 330 |
|
} |
| 331 |
|
if ($matches[1] == 'windows-1252') { |
| 332 |
|
$html_raw = iconv('windows-1252', 'utf-8', $html_raw); |
| 333 |
|
} |
| 334 |
$path = drupal_get_path('module', 'word2web'); |
$path = drupal_get_path('module', 'word2web'); |
| 335 |
set_error_handler('_word2web_suppress_errors'); |
set_error_handler('_word2web_suppress_errors'); |
| 336 |
$html = $html_raw; |
$html = $html_raw; |
| 338 |
"<addr class='image' $2>-</addr>", |
"<addr class='image' $2>-</addr>", |
| 339 |
$html_raw); |
$html_raw); |
| 340 |
|
|
|
if ($matches[1] == 'windows-1256') { |
|
|
$html_raw = iconv('windows-1256', 'utf-8', $html_raw); |
|
|
} |
|
| 341 |
//preg_match('/charset=([\w-]+)/', $html_raw, $matches); |
//preg_match('/charset=([\w-]+)/', $html_raw, $matches); |
| 342 |
// This step apparently cleans up the XML a little. |
// This step apparently cleans up the XML a little. |
| 343 |
$html = new DOMDocument(); |
$html = new DOMDocument(); |
| 349 |
// Convert from the charset it says it is into UTF-8 |
// Convert from the charset it says it is into UTF-8 |
| 350 |
//$html = iconv($matches[1], "UTF-8//IGNORE", $html); |
//$html = iconv($matches[1], "UTF-8//IGNORE", $html); |
| 351 |
$html = iconv("UTF-8", "UTF-8//IGNORE", $html); |
$html = iconv("UTF-8", "UTF-8//IGNORE", $html); |
| 352 |
|
$html = mb_convert_encoding($html, 'HTML-ENTITIES', "UTF-8"); |
| 353 |
// Actually run the xsl transformations |
// Actually run the xsl transformations |
| 354 |
$html = _word2web_xslt_transform($html, $path .'/empty.xsl'); |
$html = _word2web_xslt_transform($html, $path .'/empty.xsl'); |
| 355 |
|
|