function pages($catID = '')
 {
     $row = null;
     // get category or fail
     $category = $catID && ($row = $this->wiki->get_categories($catID)) ? $row['catName'] : 'Uncategorised';
     // get partials
     $output = $this->partials;
     // get pages
     $catID = $catID ? $catID : FALSE;
     if ($pages = $this->wiki->get_pages($catID)) {
         foreach ($pages as $page) {
             $output['wikipages'][] = array('wikipage:title' => $page['pageName'], 'wikipage:link' => site_url('/wiki/' . $page['uri']));
         }
     }
     // set title
     $output['page:title'] = $this->site->config['siteName'] . ' | Wiki - ' . $category;
     $output['page:heading'] = $category;
     $output['page:description'] = mkdn($row['description']);
     // display with cms layer
     $this->pages->view('wiki', $output, TRUE);
 }
Exemple #2
0
 function parse_body($body, $condense = FALSE, $link = '', $mkdn = TRUE)
 {
     // parse for images
     $body = $this->parse_images($body);
     // parse for files
     $body = $this->parse_files($body);
     // parse for files
     $body = $this->parse_includes($body);
     // parse for modules
     $this->template = $this->parse_modules($body, $this->template);
     // site globals
     $body = str_replace('{site:name}', $this->CI->site->config['siteName'], $body);
     $body = str_replace('{site:domain}', $this->CI->site->config['siteDomain'], $body);
     $body = str_replace('{site:url}', $this->CI->site->config['siteURL'], $body);
     $body = str_replace('{site:email}', $this->CI->site->config['siteEmail'], $body);
     $body = str_replace('{site:tel}', $this->CI->site->config['siteTel'], $body);
     $body = str_replace('{site:currency}', $this->CI->site->config['currency'], $body);
     $body = str_replace('{site:currency-symbol}', currency_symbol(), $body);
     // logged in userdata
     $body = str_replace('{userdata:id}', $this->CI->session->userdata('userID') ? $this->CI->session->userdata('userID') : '', $body);
     $body = str_replace('{userdata:email}', $this->CI->session->userdata('email') ? $this->CI->session->userdata('email') : '', $body);
     $body = str_replace('{userdata:username}', $this->CI->session->userdata('username') ? $this->CI->session->userdata('username') : '', $body);
     $body = str_replace('{userdata:name}', $this->CI->session->userdata('firstName') && $this->CI->session->userdata('lastName') ? $this->CI->session->userdata('firstName') . ' ' . $this->CI->session->userdata('lastName') : '', $body);
     $body = str_replace('{userdata:first-name}', $this->CI->session->userdata('firstName') ? $this->CI->session->userdata('firstName') : '', $body);
     $body = str_replace('{userdata:last-name}', $this->CI->session->userdata('lastName') ? $this->CI->session->userdata('lastName') : '', $body);
     // other useful stuff
     $body = str_replace('{date}', dateFmt(date("Y-m-d H:i:s"), $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), $body);
     $body = str_replace('{date:unixtime}', time(), $body);
     // condense
     if ($condense) {
         if ($endchr = strpos($body, '{more}')) {
             $body = substr($body, 0, $endchr + 6);
             $body = str_replace('{more}', '<p class="more"><a href="' . $link . '" class="button more">Read more</a></p>', $body);
         }
     } else {
         $body = str_replace('{more}', '', $body);
     }
     // parse for clears
     $body = str_replace('{clear}', '<div style="clear:both;"/></div>', $body);
     // parse for pads
     $body = str_replace('{pad}', '<div style="padding-bottom:10px;width:10px;clear:both;"/></div>', $body);
     // parse body for markdown and images
     if ($mkdn === TRUE) {
         // parse for mkdn
         $body = mkdn($body);
     }
     return $body;
 }
 function parse_post($body, $condense = FALSE, $uri = '')
 {
     if ($condense) {
         if ($endchr = strpos($body, '{more}')) {
             $body = substr($body, 0, $endchr + 6);
             $body = str_replace('{more}', '<p><strong><a href="' . $uri . '" class="button">Read more</a></strong></p>', $body);
         }
     } else {
         $body = str_replace('{more}', '', $body);
     }
     $body = $this->parse_images($body);
     $body = mkdn($body);
     return $body;
 }