Browse Source

Suppress error

Suppress error warning. Use default title if no h1 specify.
pull/31/merge
Danang Probo Sayekti 12 years ago
parent
commit
39bf9f843a
1 changed files with 34 additions and 8 deletions
  1. +34
    -8
      system/includes/functions.php

+ 34
- 8
system/includes/functions.php View File

@ -157,8 +157,14 @@ function get_posts($posts, $page = 1, $perpage = 0){
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
if(isset($arr[1])) {
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
}
else {
$post->title = 'Untitled: ' . date('l jS \of F Y', $post->date);
$post->body = $arr[0];
}
$tmp[] = $post;
}
@ -317,8 +323,14 @@ function get_bio($author){
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
if(isset($arr[1])) {
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
}
else {
$post->title = $author;
$post->body = $arr[0];
}
$tmp[] = $post;
}
@ -363,8 +375,14 @@ function get_static_post($static){
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
if(isset($arr[1])) {
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
}
else {
$post->title = $static;
$post->body = $arr[0];
}
$tmp[] = $post;
@ -435,8 +453,15 @@ function get_keyword($keyword){
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
if(isset($arr[1])) {
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
}
else {
$post->title = 'Untitled: ' . date('l jS \of F Y', $post->date);
$post->body = $arr[0];
}
$tmp[] = $post;
}
@ -660,6 +685,7 @@ function get_teaser($text, $url) {
// Get thumbnail from image and Youtube.
function get_thumbnail($text) {
libxml_use_internal_errors(true);
$default = config('default.thumbnail');
$dom = new DOMDocument();
$dom->loadHtml($text);


Loading…
Cancel
Save