diff --git a/system/includes/functions.php b/system/includes/functions.php index 336baf1..b4a38b1 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -568,54 +568,55 @@ function get_keyword($keyword){ $words = explode(' ', $keyword); - foreach ($words as $word) { - $word = $word; - } - foreach($posts as $index => $v){ $content = $md->transformMarkdown(file_get_contents($v)); - if(strpos(strtolower(strip_tags($content)), strtolower($word)) !== false){ - - $post = new stdClass; - - // Extract the date - $arr = explode('_', $v); + foreach ($words as $word) { + if(strpos(strtolower(strip_tags($content)), strtolower($word)) !== false){ - // Replaced string - $replaced = substr($arr[0], 0,strrpos($arr[0], '/')) . '/'; - - // Author string - $str = explode('/', $replaced); - $author = $str[count($str)-3]; - - // The post author + author url - $post->author = $author; - $post->authorurl = site_url() . 'author/' . $author; - - // The post date - $post->date = strtotime(str_replace($replaced,'',$arr[0])); + $post = new stdClass; - // The post URL - $post->url = site_url().date('Y/m', $post->date).'/'.str_replace('.md','',$arr[2]); - - // The post tag - $post->tag = str_replace($replaced,'',$arr[1]); - - // The post tag URL - $post->tagurl = site_url(). 'tag/' . $arr[1]; + // Extract the date + $arr = explode('_', $v); + + // Replaced string + $replaced = substr($arr[0], 0,strrpos($arr[0], '/')) . '/'; + + // Author string + $str = explode('/', $replaced); + $author = $str[count($str)-3]; + + // The post author + author url + $post->author = $author; + $post->authorurl = site_url() . 'author/' . $author; + + // The post date + $post->date = strtotime(str_replace($replaced,'',$arr[0])); - // Extract the title and body - $arr = explode('', $content); - $post->title = str_replace('