|
|
|
@ -131,10 +131,10 @@ class Welcome extends CI_Controller {
|
|
|
|
|
|
|
|
|
|
public function change_static_url($info_id) {
|
|
|
|
|
$information = $this->Information_model->Detail($info_id);
|
|
|
|
|
$htm_doc = new DOMDocument();//('1.0', 'UTF-8');
|
|
|
|
|
//$htm_doc->encoding='UTF-8';
|
|
|
|
|
$htm_doc = new DOMDocument();
|
|
|
|
|
$htm_doc->encoding='UTF-8';
|
|
|
|
|
libxml_use_internal_errors(true);
|
|
|
|
|
//$htm_doc->strictErrorChecking = false;
|
|
|
|
|
$htm_doc->strictErrorChecking = false;
|
|
|
|
|
if (empty($information->ic_content)) {
|
|
|
|
|
$this->echo_json(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
@ -143,12 +143,8 @@ class Welcome extends CI_Controller {
|
|
|
|
|
));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$htm_doc->loadHTML($information->ic_content);
|
|
|
|
|
$htm_doc->loadHTML(
|
|
|
|
|
mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8'));
|
|
|
|
|
// $htm_doc->loadHTML(
|
|
|
|
|
// utf8_decode($information->ic_content));
|
|
|
|
|
// $htm_doc->loadHTML($information->ic_content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
|
|
|
|
|
$htm_doc->normalizeDocument();
|
|
|
|
|
$img_list = $htm_doc->getElementsByTagName('img');
|
|
|
|
|
foreach ($img_list as $img) {
|
|
|
|
@ -157,10 +153,9 @@ class Welcome extends CI_Controller {
|
|
|
|
|
$img->setAttribute('src', $img_src);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// $information->ic_content = utf8_encode($htm_doc->saveHTML());
|
|
|
|
|
$information->ic_content = $htm_doc->saveHTML();
|
|
|
|
|
$this->InfoContents_model->Update(
|
|
|
|
|
$information->is_id,
|
|
|
|
|
$information->ic_id,
|
|
|
|
|
$information->ic_url,
|
|
|
|
|
$information->ic_url_title,
|
|
|
|
|
$information->ic_type,
|
|
|
|
@ -201,13 +196,14 @@ class Welcome extends CI_Controller {
|
|
|
|
|
private function check_url($subject) {
|
|
|
|
|
$result = $subject;
|
|
|
|
|
$check_rules = array(
|
|
|
|
|
'/^\/image\/(.*)/' => '//images.chinahighlights.com/image/',
|
|
|
|
|
'/^\/image\/(.*)/' => '//data.chinahighlights.com/image/',
|
|
|
|
|
'/^\/pic\/(.*)/' => '//data.chinahighlights.com/pic/',
|
|
|
|
|
'/^\/allpicture\/(.*)/' => '//data.chinahighlights.com/allpicture/',
|
|
|
|
|
'/^http:\/\/images.chinahighlights.com(.*)/' => '//images.chinahighlights.com',
|
|
|
|
|
'/^http:\/\/data.chinahighlights.com(.*)/' => '//data.chinahighlights.com',
|
|
|
|
|
'/^http:\/\/www.chinahighlights.com(.*)/' => '//www.chinahighlights.com');
|
|
|
|
|
|
|
|
|
|
foreach ($check_rules as $pattern => $replace) {
|
|
|
|
|
// echo 'key: '.$pattern.'; val: '.$replace.'</br>';
|
|
|
|
|
$result = $this->replace_url($pattern, $replace, $result);
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|