示例#1
0
 /**
  * Returns the page path of the given target (node placeholder).
  * If the target page doesn't exist, the path of the error page will be returned.
  *
  * @param   array   $arguments
  * @return  string  $path
  */
 public function getPathByTarget($arguments)
 {
     global $_CONFIG;
     $target = contrexx_input2raw($arguments['get']['target']);
     if (!\FWValidator::hasProto($target)) {
         $page = new \Cx\Core\ContentManager\Model\Entity\Page();
         $page->setTarget($target);
         if ($page->isTargetInternal()) {
             $target = str_replace(array('[[', ']]'), array('{', '}'), $target);
             \LinkGenerator::parseTemplate($target);
         } elseif (ASCMS_PATH_OFFSET == '' || strpos($target, ASCMS_PATH_OFFSET) === false) {
             if (!isset($target[0]) || $target[0] !== '/') {
                 $target = '/' . $target;
             }
             $target = ASCMS_PATH_OFFSET . $target;
         }
         $target = ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . $target;
     }
     return $target;
 }