private function get_items($file) { $xml = new NBXML(PATH_POSTS . $file, 0, TRUE, '', FALSE); $file_info = explode('.', $file); $content = (string) $xml->getChild('content'); $tmp_content = explode("<!-- pagebreak -->", $content); $tmp_array = array('read_more' => false); $tmp_array['filename'] = (string) $file; $tmp_array['id'] = (int) $file_info[1]; $tmp_array['id_cat'] = (int) $file_info[2]; $tmp_array['id_user'] = (int) $file_info[3]; $tmp_array['mode'] = (string) $file_info[4]; $tmp_array['draft'] = (bool) ($file_info[4] == 'draft'); $tmp_array['visits'] = (int) $xml->getChild('visits'); $tmp_array['type'] = (string) $xml->getChild('type'); $tmp_array['title'] = (string) $xml->getChild('title'); $tmp_array['description'] = (string) $xml->getChild('description'); $tmp_array['pub_date_unix'] = (string) $xml->getChild('pub_date'); $tmp_array['mod_date_unix'] = (string) $xml->getChild('mod_date'); $tmp_array['allow_comments'] = (bool) (int) $xml->getChild('allow_comments') == 1; // Slug $tmp_array['slug'] = $this->slug_get($tmp_array['id']); // CONTENT $tmp_array['content'][0] = $content; $tmp_array['content'][1] = $tmp_content[0]; if (isset($tmp_content[1])) { $tmp_array['content'][2] = $tmp_content[1]; $tmp_array['read_more'] = true; } // POST TYPE if ($tmp_array['type'] == 'video') { $tmp_array['video'] = (string) $xml->getChild('video'); } elseif ($tmp_array['type'] == 'quote') { $tmp_array['quote'] = (string) $xml->getChild('quote'); } return $tmp_array; }
private function get_items($file) { $xml = new NBXML(PATH_COMMENTS . $file, 0, TRUE, '', FALSE); $file_info = explode('.', $file); include FILE_KEYS; $user_ip = Crypt::decrypt((string) $xml->getChild('author_ip'), $_KEYS[1]); $user_email = Crypt::decrypt((string) $xml->getChild('author_email'), $_KEYS[1]); $tmp_array = array(); $tmp_array['filename'] = (string) $file; $tmp_array['id'] = (int) $file_info[0]; $tmp_array['id_post'] = (int) $file_info[1]; $tmp_array['id_user'] = (int) $file_info[2]; $tmp_array['type'] = (string) $file_info[3]; $tmp_array['author_email'] = $user_email; $tmp_array['author_ip'] = $user_ip; $tmp_array['author_name'] = (string) $xml->getChild('author_name'); $tmp_array['content'] = (string) $xml->getChild('content'); $tmp_array['pub_date_unix'] = (string) $xml->getChild('pub_date'); $tmp_array['highlight'] = (bool) ((int) $xml->getChild('content') == 1); $tmp_array['pub_date'] = Date::format($tmp_array['pub_date_unix'], $this->settings['timestamp_format']); return $tmp_array; }
private function get_items($file) { $xml = new NBXML(PATH_PAGES . $file, 0, TRUE, '', FALSE); $file_info = explode('.', $file); $tmp_array['content'] = $xml->getChild('content'); $tmp_array['filename'] = $file; $tmp_array['id'] = (int) $file_info[0]; $tmp_array['draft'] = $file_info[3] == 'draft'; $tmp_array['visits'] = $xml->getChild('visits'); $tmp_array['title'] = $xml->getChild('title'); $tmp_array['description'] = $xml->getChild('description'); $tmp_array['position'] = $xml->getChild('position'); $tmp_array['keywords'] = $xml->getChild('keywords'); $tmp_array['pub_date_unix'] = $xml->getChild('pub_date'); $tmp_array['mod_date_unix'] = $xml->getChild('mod_date'); // Slug $tmp_array['slug'] = $this->slug_get($tmp_array['id']); return $tmp_array; }
@unlink($filenamepost); } else { echo Html::p(array('class' => 'pass', 'content' => 'FAIL - DB updated: ' . FILE_XML_POSTS)); } } // ===================================================== // Posts // ===================================================== $posts_files = Filesystem::ls(PATH_POSTS, '*', 'xml', false, false, false); $_DB_POST = new DB_POSTS(FILE_XML_POSTS); foreach ($posts_files as $file_old) { $explode = explode('.', $file_old); $post = new NBXML(PATH_POSTS . $file_old, 0, TRUE, '', FALSE); // Generate the slug url $id_post = (int) $explode[1]; $slug = Text::clean_url((string) $post->getChild('title'), '-', $translit_enable); $_DB_POST->slug($id_post, $slug); $_DB_POST->savetofile(); if (count($explode) == 11) { $unixstamp = (int) $post->getChild('pub_date'); array_unshift($explode, $unixstamp); // Implode the filename $filename = implode('.', $explode); // Delete the old post unlink(PATH_POSTS . $file_old); // Save the new post $post->asXml(PATH_POSTS . $filename); echo Html::p(array('class' => 'pass', 'content' => 'File renamed: ' . $file_old . ' => ' . $filename)); } } // =====================================================