Beispiel #1
0
 /**
  * Returns the meta data for the given page identifier
  *
  * The meta data is read from the global configuration and the page's config file (i.e. 'PageName.json'), whilst the
  * page config takes precedence.
  *
  * @param string $identifier
  * @param string $pageDataPath Determined path to the page contents
  * @return array
  */
 public function buildMetaDataForPageIdentifier($identifier, $pageDataPath = NULL)
 {
     $configuration = ConfigurationManager::getConfiguration();
     $dataPath = $configuration->get('basePath') . $configuration->get('dataPath');
     $pageName = $this->getPageNameForPageIdentifier($identifier);
     $metaDataPath = $dataPath . $pageName . '.json';
     // Read the global configuration
     $metaData = ObjectUtility::valueForKeyPathOfObject("pages.{$identifier}.meta", $configuration, array());
     // Check if the node exists
     if (file_exists($metaDataPath)) {
         $rawMetaData = file_get_contents($metaDataPath);
         $metaData = array_merge($metaData, (array) json_decode($rawMetaData, TRUE));
     }
     if ($pageDataPath && file_exists($pageDataPath)) {
         $metaData['date'] = date('c', filemtime($pageDataPath));
     }
     return $metaData;
 }
Beispiel #2
0
 /**
  * Returns if the Page is an external link
  *
  * @return bool
  */
 public function getIsExternalLink()
 {
     return ObjectUtility::valueForKeyPathOfObject('meta.url', $this) ? TRUE : FALSE;
 }
Beispiel #3
0
 /**
  * Returns the assigned variable value
  *
  * @param string $keyPath
  * @return string
  */
 public function resolveExpressionKeyPath($keyPath)
 {
     if (isset($this->data[$keyPath])) {
         return $this->data[$keyPath];
     }
     return ObjectUtility::valueForKeyPathOfObject($keyPath, $this->data);
 }