示例#1
0
 public function initializeForTheme(IPieCrust $pieCrust)
 {
     parent::initialize($pieCrust);
     $themeDir = $pieCrust->getThemeDir();
     if (!$themeDir) {
         throw new PieCrustException("The given website doesn't have a theme.");
     }
     $this->pagesDir = $themeDir . PieCrustDefaults::CONTENT_PAGES_DIR;
     $this->postsDir = $themeDir . PieCrustDefaults::CONTENT_POSTS_DIR;
 }
示例#2
0
 public function initialize(\PieCrust\IPieCrust $pieCrust)
 {
     parent::initialize($pieCrust);
     if (DIRECTORY_SEPARATOR == '\\') {
         $homePath = getenv('USERPROFILE');
     } else {
         $homePath = getenv('HOME');
     }
     $defaultConfig = array('dir' => $homePath . DIRECTORY_SEPARATOR . 'Dropbox' . DIRECTORY_SEPARATOR . 'Documents', 'posts' => '%slug%.%ext%');
     $config = $pieCrust->getConfig()->getValue('dropbox');
     if (!$config) {
         $config = array();
     }
     $this->config = array_merge($defaultConfig, $config);
     if (substr($this->config['dir'], 0, 1) == '~') {
         $this->config['dir'] = $homePath . substr($this->config['dir'], 1);
     }
     $this->config['dir'] = rtrim($this->config['dir'], "/\\") . '/';
 }