Exemplo n.º 1
0
 /**
  * Save the content for a new page in /data/_pages/<title>
  * @since 1.8a1
  *
  */
 public static function NewTitle($title, $section_content = false, $type = 'text')
 {
     // get the file for the title
     if (empty($title)) {
         return false;
     }
     $file = gpFiles::PageFile($title);
     if (!$file) {
         return false;
     }
     // organize section data
     $file_sections = array();
     if (is_array($section_content) && isset($section_content['type'])) {
         $file_sections[0] = $section_content;
     } elseif (is_array($section_content)) {
         $file_sections = $section_content;
     } else {
         $file_sections[0] = array('type' => $type, 'content' => $section_content);
     }
     // add meta data
     $meta_data = array('file_number' => gpFiles::NewFileNumber(), 'file_type' => $type);
     return gpFiles::SaveData($file, 'file_sections', $file_sections, $meta_data);
 }
Exemplo n.º 2
0
 function SaveThis($backup = true)
 {
     if (!is_array($this->meta_data) || !is_array($this->file_sections)) {
         return false;
     }
     //file count
     if (!isset($this->meta_data['file_number'])) {
         $this->meta_data['file_number'] = gpFiles::NewFileNumber();
     }
     if ($backup) {
         $this->SaveBackup();
         //make a backup of the page file
     }
     return gpFiles::SaveData($this->file, 'file_sections', $this->file_sections, $this->meta_data);
 }
Exemplo n.º 3
0
 /**
  * Save the content for a new page in /data/_pages/<title>
  * @since 1.8a1
  *
  */
 function NewTitle($title, $section_content = false, $type = 'text')
 {
     if (empty($title)) {
         return false;
     }
     $file = gpFiles::PageFile($title);
     if (!$file) {
         return false;
     }
     $file_sections = array();
     $file_sections[0] = array('type' => $type, 'content' => $section_content);
     $meta_data = array('file_number' => gpFiles::NewFileNumber(), 'file_type' => $type);
     return gpFiles::SaveArray($file, 'meta_data', $meta_data, 'file_sections', $file_sections);
 }
Exemplo n.º 4
0
 function SaveThis()
 {
     if (!is_array($this->meta_data) || !is_array($this->file_sections)) {
         return false;
     }
     //file count
     if (!isset($this->meta_data['file_number'])) {
         $this->meta_data['file_number'] = gpFiles::NewFileNumber();
     }
     return gpFiles::SaveArray($this->file, 'meta_data', $this->meta_data, 'file_sections', $this->file_sections);
 }
Exemplo n.º 5
0
 /**
  * Save the content for a new page in /data/_pages/<title>
  * @since 1.8a1
  *
  */
 static function NewTitle($title, $section_content = false, $type = 'text')
 {
     if (empty($title)) {
         return false;
     }
     $file = gpFiles::PageFile($title);
     if (!$file) {
         return false;
     }
     $file_sections = array();
     if (is_array($section_content)) {
         $file_sections[0] = $section_content;
     } else {
         $file_sections[0] = array('type' => $type, 'content' => $section_content);
     }
     $meta_data = array('file_number' => gpFiles::NewFileNumber(), 'file_type' => $type);
     return gpFiles::SaveData($file, 'file_sections', $file_sections, $meta_data);
 }