Exemple #1
0
 /**
  * Compose clean URL
  *
  * @param string $target Page identifier OPTIONAL
  * @param string $action Action to perform OPTIONAL
  * @param array  $params Additional params OPTIONAL
  *
  * @return string
  * @see    ____func_see____
  * @since  1.0.21
  */
 public static function buildCleanURL($target = '', $action = '', array $params = array())
 {
     $result = null;
     $urlParams = array();
     if ('page' === $target && !empty($params['id'])) {
         $page = \XLite\Core\Database::getRepo('\\XLite\\Module\\CDev\\SimpleCMS\\Model\\Page')->find($params['id']);
         if (isset($page) && $page->getCleanURL()) {
             $urlParams[] = $page->getCleanURL() . '.html';
             unset($params['id']);
         }
     }
     if (!empty($urlParams)) {
         static::buildCleanURLHook($target, $action, $params, $urlParams);
         unset($params['target']);
         $result = \Includes\Utils\ConfigParser::getOptions(array('host_details', 'web_dir_wo_slash'));
         $result .= '/' . implode('/', array_reverse($urlParams));
         if (!empty($params)) {
             $result .= '?' . http_build_query($params);
         }
     }
     return $result ?: parent::buildCleanURL($target, $action, $params);
 }