当前位置: 首页>>代码示例>>PHP>>正文


PHP Url::setPath方法代码示例

本文整理汇总了PHP中Url::setPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::setPath方法的具体用法?PHP Url::setPath怎么用?PHP Url::setPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Url的用法示例。


在下文中一共展示了Url::setPath方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addComment

 /**
  * handle add
  */
 public function addComment($values)
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $values['active'] = 1;
     try {
         $id = $this->insert($values);
         $calendar = $this->plugin->getObject(Calendar::TYPE_DEFAULT);
         $calendarDetail = $calendar->getDetail(array('id' => $values['cal_id']));
         $url = new Url();
         $url->setPath($this->director->tree->getPath($calendarDetail['tree_id']));
         $url->setParameter('id', $calendarDetail['id']);
         $url->setParameter($view->getUrlId(), Calendar::VIEW_DETAIL);
         // notify insert
         $ip = $request->getValue('REMOTE_ADDR', Request::SERVER);
         $template = new TemplateEngine($this->getPath() . "templates/calendarcommentemail.tpl");
         $template->setVariable($values);
         $template->setVariable('calendarName', $calendarDetail['name']);
         $template->setVariable('href_detail', $url->getUrl());
         $template->setVariable('siteTitle', $this->director->tree->getTreeName());
         $template->setVariable('domain', $request->getDomain());
         $template->setVariable('protocol', $request->getProtocol());
         $template->setVariable('ip', $ip);
         $template->setVariable('host', gethostbyaddr($ip));
         $template->setVariable('client', $request->getValue('HTTP_USER_AGENT', Request::SERVER));
         $this->director->systemUser->notify($calendarDetail['tree_id'], 'Comment added at ' . $request->getDomain(), $template->fetch());
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('commentError', $e->getMessage(), false);
         $template->setVariable('cmtValues', $values, false);
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:35,代码来源:CalendarComment.php

示例2: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $view = ViewManager::getInstance();
     $taglist = $this->plugin->getTagList(array('plugin_type' => Gallery::TYPE_HEADLINES));
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     $url = new Url(true);
     //$url->setParameter($view->getUrlId(), Gallery::VIEW_DETAIL);
     // link to gallery tree nodes
     $treeRef = new GalleryTreeRef();
     foreach ($taglist as $tag) {
         $key = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag']);
         $detail = $this->getDetail($key);
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($tag['tag']);
         $cacheable = $detail['display_order'] != Gallery::ORDER_RANDOM;
         $template->setCacheable($cacheable);
         if (!$cacheable) {
             Cache::disableCache();
         }
         $template->setVariable($detail);
         // include lightbox if needed
         if ($detail['display'] == self::DISP_LIGHTBOX) {
             $theme = $this->director->theme;
             $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/prototype.js"></script>');
             $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/scriptaculous.js"></script>');
             $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/lightbox.js"></script>');
             $theme->addHeader('<link rel="stylesheet" href="' . DIF_VIRTUAL_WEB_ROOT . 'css/lightbox.css" type="text/css" media="screen" />');
         }
         // check if template is in cache
         if (!$template->isCached()) {
             // get settings
             $settings = $this->getSettings();
             $treeRefList = $treeRef->getList($key);
             $treeItemList = array();
             foreach ($treeRefList['data'] as $treeRefItem) {
                 if (!$tree->exists($treeRefItem['ref_tree_id'])) {
                     continue;
                 }
                 $treeItemList[] = $treeRefItem['ref_tree_id'];
             }
             if (!$treeItemList) {
                 continue;
             }
             $searchcriteria = array('activated' => true, 'tree_id' => $treeItemList);
             $overview = $this->getGalleryOverview();
             $list = $overview->getList($searchcriteria, $detail['rows'], 1, $detail['display_order']);
             // skip if empty
             if ($list['totalItems'] < 1) {
                 continue;
             }
             foreach ($list['data'] as &$item) {
                 $url->setPath($tree->getPath($item['tree_id']));
                 // go to detail if requested
                 if ($detail['display'] == self::DISP_DETAIL) {
                     $url->setParameter('id', $item['id']);
                 }
                 $item['href_detail'] = $url->getUrl(true);
                 if ($item['image']) {
                     $img = new Image($item['image'], $this->plugin->getContentPath(true));
                     $item['image'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
                 if ($item['thumbnail']) {
                     $img = new Image($item['thumbnail'], $this->plugin->getContentPath(true));
                     $item['thumbnail'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
             }
             $template->setVariable('gallery', $list);
         }
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:77,代码来源:GalleryHeadlines.php

示例3: handlePluginList

 private function handlePluginList($tag, $parameters)
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $searchcriteria = isset($parameters) && array_key_exists('searchcriteria', $parameters) ? $parameters['searchcriteria'] : array();
     $keys = isset($parameters) && array_key_exists('keys', $parameters) ? $parameters['keys'] : array();
     $searchcriteria['id'] = $keys;
     $settings = $this->plugin->getSettings();
     $template->setVariable('settings', $settings);
     $systemSite = new SystemSite();
     $tree = $systemSite->getTree();
     $list = $this->getList($searchcriteria, $pagesize, $page);
     foreach ($list['data'] as &$item) {
         //TODO get url from caller plugin (newsletter) to track visits
         $url = new Url();
         $url->setPath($request->getProtocol() . $request->getDomain() . $tree->getPath($item['tree_id']));
         $url->setParameter('id', $item['id']);
         $url->setParameter(ViewManager::URL_KEY_DEFAULT, Calendar::VIEW_DETAIL);
         $item['href_detail'] = $url->getUrl(true);
         if ($item['thumbnail']) {
             $img = new Image($item['thumbnail'], $this->plugin->getContentPath(true));
             $item['thumbnail'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
         }
     }
     $template->setVariable('calendar', $list);
     $this->template[$tag] = $template;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:28,代码来源:CalendarOverview.php

示例4: renderTree

 /**
  * renders tree into menu template
  * @return  object
  */
 public function renderTree()
 {
     $template = new TemplateEngine($this->getPath() . "templates/menu.tpl");
     $menu = $this->tree->getList();
     //print_r($menu);
     // get selected main menu item
     //$firstNode = $this->tree->getFirstAncestorNode($this->tree->getCurrentId());
     //$firstId = ($firstNode) ? $firstNode['id'] : 0;
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     if (($id = intval($request->getValue('tree_id', Request::GET))) < 1) {
         $id = $this->tree->getFirstNodeId();
     }
     $parent = $this->tree->getParentId($id);
     $tree = $this->director->tree;
     $url = new Url();
     $url->setPath($tree->getPath($tree->getCurrentId()));
     //$url->setPath($request->getPath());
     $url->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW);
     $template->setVariable('current_node', $this->getMenuId(), false);
     // add root node
     $siteGroup = $this->getSiteGroup();
     $rootId = $this->tree->getRootId();
     $parentRootId = $rootId - 1;
     $this->fileVars['parentRootId'] = $parentRootId;
     $template->setVariable('parentRootId', $parentRootId, false);
     $template->setVariable('rootId', $rootId, false);
     $rootnode = array('id' => $rootId, 'parent' => $parentRootId, 'name' => sprintf("%s (%s)", $this->tree->getTreeName(), $siteGroup->getLanguage($siteGroup->getCurrentId())), 'active' => 1, 'visible' => 1, 'activated' => 1);
     array_unshift($menu, $rootnode);
     foreach ($menu as &$item) {
         $url->setParameter('tree_id', $item['id']);
         $item['href_overview'] = $url->getUrl(true);
         $item['name'] = addslashes($item['name']);
     }
     $template->setVariable('sitemenu', $menu, false);
     return $template;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:41,代码来源:Site.php

示例5: addService

 /**
  * Add a service to the result list. In order to allow several items
  * of the same type (f.ex. rss feeds) every item is pushed on the
  * stack with a key for the service id and a key for the data.
  *
  * NOTE: This may change very soon
  *
  * @param string $service The service key (one of KnownServices::*)
  * @param array $data The data relating to the service.
  */
 protected function addService($service, $data)
 {
     if (!isset($this->_services[$service])) {
         $this->_services[$service] = array();
     }
     if (!preg_match('/^http[s]?:\\/\\//i', $data['url'])) {
         $u = new Url($this->_url);
         $u->setPath($data['url']);
         $data['url'] = $u->getUrl();
     }
     $this->_services[$service][] = $data;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:22,代码来源:discovery.php

示例6: createRequest

 /**
  * Request/URL factory.
  * @param  PresenterComponent  base
  * @param  string   destination in format "[[module:]presenter:]action" or "signal!" or "this"
  * @param  array    array of arguments
  * @param  string   forward|redirect|link
  * @return string   URL
  * @throws InvalidLinkException
  * @internal
  */
 protected final function createRequest($component, $destination, array $args, $mode)
 {
     // note: createRequest supposes that saveState(), run() & tryCall() behaviour is final
     // cached services for better performance
     static $presenterFactory, $router, $refUrl;
     if ($presenterFactory === NULL) {
         $presenterFactory = $this->getApplication()->getPresenterFactory();
         $router = $this->getApplication()->getRouter();
         $refUrl = new Url($this->getHttpRequest()->getUrl());
         $refUrl->setPath($this->getHttpRequest()->getUrl()->getScriptPath());
     }
     $this->lastCreatedRequest = $this->lastCreatedRequestFlag = NULL;
     // PARSE DESTINATION
     // 1) fragment
     $a = strpos($destination, '#');
     if ($a === FALSE) {
         $fragment = '';
     } else {
         $fragment = substr($destination, $a);
         $destination = substr($destination, 0, $a);
     }
     // 2) ?query syntax
     $a = strpos($destination, '?');
     if ($a !== FALSE) {
         parse_str(substr($destination, $a + 1), $args);
         // requires disabled magic quotes
         $destination = substr($destination, 0, $a);
     }
     // 3) URL scheme
     $a = strpos($destination, '//');
     if ($a === FALSE) {
         $scheme = FALSE;
     } else {
         $scheme = substr($destination, 0, $a);
         $destination = substr($destination, $a + 2);
     }
     // 4) signal or empty
     if (!$component instanceof Presenter || substr($destination, -1) === '!') {
         $signal = rtrim($destination, '!');
         $a = strrpos($signal, ':');
         if ($a !== FALSE) {
             $component = $component->getComponent(strtr(substr($signal, 0, $a), ':', '-'));
             $signal = (string) substr($signal, $a + 1);
         }
         if ($signal == NULL) {
             // intentionally ==
             throw new InvalidLinkException("Signal must be non-empty string.");
         }
         $destination = 'this';
     }
     if ($destination == NULL) {
         // intentionally ==
         throw new InvalidLinkException("Destination must be non-empty string.");
     }
     // 5) presenter: action
     $current = FALSE;
     $a = strrpos($destination, ':');
     if ($a === FALSE) {
         $action = $destination === 'this' ? $this->action : $destination;
         $presenter = $this->getName();
         $presenterClass = get_class($this);
     } else {
         $action = (string) substr($destination, $a + 1);
         if ($destination[0] === ':') {
             // absolute
             if ($a < 2) {
                 throw new InvalidLinkException("Missing presenter name in '{$destination}'.");
             }
             $presenter = substr($destination, 1, $a - 1);
         } else {
             // relative
             $presenter = $this->getName();
             $b = strrpos($presenter, ':');
             if ($b === FALSE) {
                 // no module
                 $presenter = substr($destination, 0, $a);
             } else {
                 // with module
                 $presenter = substr($presenter, 0, $b + 1) . substr($destination, 0, $a);
             }
         }
         try {
             $presenterClass = $presenterFactory->getPresenterClass($presenter);
         } catch (InvalidPresenterException $e) {
             throw new InvalidLinkException($e->getMessage(), NULL, $e);
         }
     }
     // PROCESS SIGNAL ARGUMENTS
     if (isset($signal)) {
         // $component must be IStatePersistent
//.........这里部分代码省略.........
开发者ID:riskatlas,项目名称:micka,代码行数:101,代码来源:Presenter.php

示例7: formatLink

 public function formatLink(Url $url)
 {
     // save and reset query to save variable order
     $query = $url->getQuery();
     $url->setQuery([]);
     // extract path to separate params and remove actions
     $parts = explode(self::REWRITE_PARAM_TO_ACTION_DELIMITER, $url->getPath());
     foreach ($parts as $part) {
         // only extract "normal" parameters, avoid actions
         if (strpos($part, '-action') === false) {
             $paths = explode('/', strip_tags($part));
             array_shift($paths);
             // create key => value pairs from the current request
             $x = 0;
             while ($x <= count($paths) - 1) {
                 if (isset($paths[$x + 1])) {
                     $url->setQueryParameter($paths[$x], $paths[$x + 1]);
                 }
                 // increment by 2, because the next offset is the key!
                 $x = $x + 2;
             }
         }
     }
     // reset the path to not have duplicate path due to generic param generation
     $url->setPath(null);
     // merge query now to overwrite values already contained in the url
     $url->mergeQuery($query);
     $resultUrl = $this->getFormattedBaseUrl($url);
     $query = $url->getQuery();
     if (count($query) > 0) {
         // get URL mappings and try to resolve mapped actions
         $mappings = $this->getActionUrMappingTokens();
         foreach ($query as $name => $value) {
             // allow empty params that are action definitions to not
             // exclude actions with no params!
             if (!$this->isValueEmpty($value) || $this->isValueEmpty($value) && strpos($name, '-action') !== false || $this->isValueEmpty($value) && in_array($name, $mappings) !== false) {
                 if (strpos($name, '-action') === false && in_array($name, $mappings) === false) {
                     $resultUrl .= '/' . $name . '/' . $value;
                 } else {
                     // action blocks must be separated with group indicator
                     // to be able to parse the parameters
                     $resultUrl .= self::REWRITE_PARAM_TO_ACTION_DELIMITER . $name;
                     // check whether value is empty and append action only
                     if (!$this->isValueEmpty($value)) {
                         $resultUrl .= '/' . $value;
                     }
                 }
             }
         }
     }
     // apply query to detect duplicate action definitions
     $actions = $this->getActionsUrlRepresentation($query, true);
     if (!empty($actions)) {
         $resultUrl .= self::REWRITE_PARAM_TO_ACTION_DELIMITER . $actions;
     }
     // encode blanks if desired
     if ($this->getEncodeBlanks() === true) {
         $resultUrl = strtr($resultUrl, [' ' => '%20']);
     }
     return $this->sanitizeUrl($this->appendAnchor($resultUrl, $url));
 }
开发者ID:GeneralCrime,项目名称:code,代码行数:61,代码来源:RewriteLinkScheme.php

示例8: getCoreDevUrl

 /** @return full url to core_dev root */
 function getCoreDevUrl()
 {
     $t = new Url($this->getUrl());
     $t->setPath($this->getRelativeCoreDevUrl());
     return $t->get();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:7,代码来源:XmlDocumentHandler.php

示例9: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $taglist = $this->getTagList();
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     foreach ($taglist as $item) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setCacheable(true);
         $template->setPostfix($item['tag']);
         $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
         // check if template is in cache
         if (!$template->isCached()) {
             $siteGroup = $this->getSiteGroup();
             $id = $siteGroup->getCurrentId();
             $detail = $this->exists($key) ? $this->getDetail($key) : $this->getFields(SqlParser::MOD_INSERT);
             $template->setVariable('detail', $detail);
             $url = new Url();
             $url->setPath('/');
             $grouplist = $siteGroup->getList(array('active' => true));
             if ($grouplist['totalItems'] < 2) {
                 continue;
             }
             foreach ($grouplist['data'] as &$list) {
                 $url->setParameter(SystemSiteGroup::CURRENT_ID_KEY, $list['id']);
                 $list['path'] = $url->getUrl(true);
                 $list['selected'] = $list['id'] == $id;
                 $list['img'] = $this->getImage($list['language']);
             }
             $template->setVariable('sitegroup', $grouplist, false);
             $template->setVariable('sitegroupId', $id);
         }
         $this->template[$item['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:39,代码来源:SiteSelect.php

示例10: getDetailUrl

 private function getDetailUrl($id, $tree_id, $tag, $htmlentities = true)
 {
     $view = ViewManager::getInstance();
     $request = Request::getInstance();
     $tree = $this->director->tree;
     $url_banner = new Url();
     //$url_banner->useCurrent(false);
     $url_banner->setPath($tree->getPath($tree_id));
     $url_banner->setParameter($view->getUrlId(), self::VIEW_BANNER);
     $url_banner->setParameter('id', $id);
     $url_banner->setParameter('tag', $tag);
     $url_banner->setParameter('tree_id', $tree_id);
     return $url_banner->getUrl($htmlentities);
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:14,代码来源:BannerView.php

示例11: handlePreviewPost

 private function handlePreviewPost()
 {
     $request = Request::getInstance();
     try {
         if (!$request->exists('nl_id')) {
             throw new Exception(__CLASS__ . "::" . __FUNCTION__ . " : nl_id parameter is missing");
         }
         $key = array('id' => $request->getValue('nl_id'));
         $sendmail = $request->exists('send');
         $email = $request->getValue('email');
         if ($sendmail && !Utils::isEmail($email)) {
             throw new Exception("Invalid email address specified");
         }
         if (!$this->exists($key)) {
             throw new HttpException('404');
         }
         $detail = $this->getDetail($key);
         $user = array('gender_description' => NewsLetterUser::getGenderTypeDesc(NewsLetterUser::GENDER_MALE), 'name' => 'Test Recipient', 'email' => $email ? $email : $this->director->getConfig()->email_address);
         $systemSite = new SystemSite();
         $tree = $systemSite->getTree();
         $url_unsubscribe = new Url();
         $url_unsubscribe->setPath($request->getProtocol() . $request->getDomain() . $tree->getPath($detail['tree_id']));
         $url_unsubscribe->setParameter(ViewManager::URL_KEY_DEFAULT, NewsLetter::VIEW_USER_UNSUBSCRIBE);
         $url_unsubscribe->setParameter(NewsLetterUser::KEY_UNSUBSCRIBE, $user['email']);
         $parameters = array('user' => $user, 'href_unsubscribe' => $url_unsubscribe->getUrl(true));
         $key = array('nl_id' => $key['id'], 'activated' => true);
         $theme = $this->getNewsLetterTheme($key, $detail);
         $this->handleThemePostProcessing($theme, $parameters);
         $content = $theme->fetchTheme();
         if ($sendmail) {
             $objAttachment = $this->plugin->getObject(NewsLetter::TYPE_ATTACHMENT);
             $attachments = $objAttachment->getAttachmentList($key);
             $this->sendMail(array($email), $this->director->getConfig()->email_address, $detail['name'], $content, $attachments);
             // reset theme settings
             $this->director->theme->handlePreProcessing($this->director);
             $view = ViewManager::getInstance();
             $view->setType(ViewManager::TREE_OVERVIEW);
             $this->handleHttpGetRequest();
         } else {
             echo $content;
             exit;
         }
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
         $this->handlePreviewGet();
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:48,代码来源:NewsLetterOverview.php

示例12: getRelativeTo

 /**
  * Get the url relative to another url or two predefined formats.
  *
  * @param string|Url $relativeTo The url that the resulting string is going to be relative to
  */
 public function getRelativeTo($relativeTo = self::RELATIVE_TO_NONE)
 {
     $buildUrl = '';
     if ((int) $relativeTo === $relativeTo) {
         switch ($relativeTo) {
             case static::RELATIVE_TO_NONE:
                 $parsed = parse_url($this->_url);
                 return static::buildUrl($parsed);
             case static::RELATIVE_TO_SCHEME:
                 $hostPart = $this->getHost();
                 if ($userPart = $this->getUser()) {
                     if ($passPart = $this->getPassword()) {
                         $userPart = $userPart . ':' . $passPart;
                     }
                     $hostPart = $userPart . '@' . $hostPart;
                 }
                 $buildUrl .= '//' . $hostPart;
             case static::RELATIVE_TO_HOST:
                 $buildUrl .= $this->getPath();
                 if ($query = $this->getQuery()) {
                     $buildUrl .= '?' . $query;
                 }
                 if ($fragment = $this->getFragment()) {
                     $buildUrl .= '#' . $fragment;
                 }
                 return $buildUrl;
         }
     }
     if (!$relativeTo instanceof Url && is_string($relativeTo)) {
         $relativeTo = new Url($relativeTo);
     } else {
         if ($relativeTo instanceof Url) {
             $relativeTo = new Url($relativeTo->__toString());
         } else {
             throw new Exception('Invalid argument, expected url!');
         }
     }
     $relativeTo->clearParams();
     $relativeTo->unsetFragment();
     $pathRelative = $relativeTo->getPath();
     if (!$pathRelative) {
         $pathRelative = '/';
     }
     $relativeTo->setPath('/');
     $relativeTo = $relativeTo->__toString();
     $url = $this->getRelativeTo(static::RELATIVE_TO_NONE);
     if (strpos($url, $relativeTo) === 0) {
         $relWithPath = substr($url, strlen($relativeTo));
         if (!$relWithPath || $relWithPath[0] != '/') {
             $relWithPath = '/' . $relWithPath;
         }
         $pathLen = strlen($pathRelative);
         while ($pathRelative[$pathLen - 1] == '/') {
             $pathLen--;
         }
         if ($pathLen == 0) {
             return $relWithPath;
         }
         $pathRelative = substr($pathRelative, 0, $pathLen);
         if ($pathRelative == $relWithPath) {
             return '';
         } else {
             if (strpos($relWithPath, $pathRelative) === 0 && in_array($relWithPath[$pathLen], array('/', '?', '#'))) {
                 /* Simple removal of the path relative to */
                 $relWithPath = substr($relWithPath, $pathLen);
                 while ($relWithPath && $relWithPath[0] == '/') {
                     $relWithPath = substr($relWithPath, 1);
                 }
                 return $relWithPath;
             }
         }
         return $relWithPath;
     }
     /*
      * Host-part did not match..
      * Return full absolute url..
      */
     return $url;
 }
开发者ID:frodeborli,项目名称:fubberframework,代码行数:84,代码来源:Url.php

示例13: hashBang

 /**
  * Resolve an url with hashbang
  *
  * @param Url $url
  */
 protected static function hashBang(Url $url)
 {
     if ($path = preg_replace('|^(/?!)|', '', $url->getFragment())) {
         $url->setPath($url->getPath() . $path);
     }
 }
开发者ID:heatery,项目名称:Embed,代码行数:11,代码来源:UrlRedirect.php

示例14: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $view = ViewManager::getInstance();
     $taglist = $this->plugin->getTagList(array('plugin_type' => News::TYPE_HEADLINES));
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), News::VIEW_DETAIL);
     // link to news tree nodes
     $treeRef = new NewsTreeRef();
     foreach ($taglist as $tag) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($tag['tag']);
         $template->setCacheable(true);
         // check if template is in cache
         if (!$template->isCached()) {
             // get settings
             //$settings = $this->getSettings();
             $key = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag']);
             $detail = $this->getDetail($key);
             $treeRefList = $treeRef->getList($key);
             $treeItemList = array();
             foreach ($treeRefList['data'] as $treeRefItem) {
                 if (!$tree->exists($treeRefItem['ref_tree_id'])) {
                     continue;
                 }
                 $treeItemList[] = $treeRefItem['ref_tree_id'];
             }
             if (!$treeItemList) {
                 continue;
             }
             $searchcriteria = array('activated' => true, 'tree_id' => $treeItemList);
             $overview = $this->getNewsOverview();
             $list = $overview->getList($searchcriteria, $detail['rows']);
             // skip if empty
             if ($list['totalItems'] < 1) {
                 continue;
             }
             foreach ($list['data'] as &$item) {
                 $url->setPath($tree->getPath($item['tree_id']));
                 $url->setParameter('id', $item['id']);
                 $item['href_detail'] = $url->getUrl(true);
                 if ($item['thumbnail']) {
                     $img = new Image($item['thumbnail'], $this->plugin->getContentPath(true));
                     $item['thumbnail'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
             }
             $template->setVariable('news', $list);
             $template->setVariable('settings', $detail);
         }
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:58,代码来源:NewsHeadlines.php


注:本文中的Url::setPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。