Пример #1
0
 /**
  * get permanent address
  *
  * @param array page attributes
  * @return string the permanent web address to this item, relative to the installation path
  */
 public static function get_permalink($item)
 {
     global $context;
     // sanity check
     if (!isset($item['id'])) {
         throw new Exception('bad input parameter');
     }
     // get host to this page
     $vhost = Sections::get_vhost('section:' . $item['id']);
     // if top-level section with bounded vhost, provide a root link
     if ((!isset($item['anchor']) || !$item['anchor']) && file_exists($context['path_to_root'] . 'parameters/virtual_' . $item['nick_name'] . '.include.php')) {
         return $vhost;
     }
     // absolute link
     return $vhost . Sections::get_url($item['id'], 'view', $item['title'], isset($item['nick_name']) ? $item['nick_name'] : '');
 }
Пример #2
0
 /**
  * get permanent address
  *
  * @param array page attributes
  * @return string the permanent web address to this item, relative to the installation path
  */
 public static function get_permalink($item)
 {
     global $context;
     // sanity check
     if (!isset($item['id'])) {
         return null;
     }
     // get host to this page
     $vhost = Sections::get_vhost($item['anchor']);
     // absolute link
     return $vhost . Articles::get_url($item['id'], 'view', $item['title'], isset($item['nick_name']) ? $item['nick_name'] : '');
 }