コード例 #1
0
ファイル: page.php プロジェクト: davidmottet/automne
 /**
  * Get the page filename.
  *
  * @return string The filename without path indication, false if never validated or outside of userspace.
  * @access private
  */
 protected function _getFilename($regenerate = false)
 {
     if (trim($this->_pageURL) && !$regenerate) {
         return $this->_pageURL;
     } else {
         //check if page has been validated, if so, generate data from title
         if ($this->getPublication() != RESOURCE_PUBLICATION_NEVERVALIDATED && $this->getLocation() == RESOURCE_LOCATION_USERSPACE) {
             //create new filename
             $title = $this->getTitle(true);
             if (!$title) {
                 //no public title found, to avoid error, try to use the edited one.
                 $title = $this->getTitle(false);
                 if (!$title) {
                     $this->raiseError("Can't get page title for page " . $this->getID() . " to create page filename ...");
                     return false;
                 }
             }
             $filename = $this->getID() . '-' . sensitiveIO::sanitizeURLString($title) . '.php';
             //and save it
             $this->_pageURL = $filename;
             $this->writeToPersistence();
             return $filename;
         }
         return false;
     }
 }