$v){ $post = new stdClass; $filepath = $v['dirname'] . '/' . $v['basename']; // Extract the date $arr = explode('_', $filepath); // 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])); // The archive per day $post->archive = site_url(). 'archive/' . date('Y-m-d', $post->date) ; // 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]; $post->file = $filepath; // Get the contents and convert it to HTML // $content = file_get_contents($filepath); // $post->content = $content; $tmp[] = $post; } return $tmp; } // Return posts list on profile. function get_profile($profile, $page, $perpage){ $posts = admin_get_post(); $tmp = array(); foreach ($posts as $index => $v) { $url = $v['dirname']; $str = explode('/', $url); $author = $str[count($str)-2]; if($profile === $author){ $tmp[] = $v; } } if(empty($tmp)) { echo '
| ' . $p->file . ' | '; echo ''; echo ''; } } ?> |