本文整理汇总了PHP中Library\Utility\Helper::urlForSite方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::urlForSite方法的具体用法?PHP Helper::urlForSite怎么用?PHP Helper::urlForSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library\Utility\Helper
的用法示例。
在下文中一共展示了Helper::urlForSite方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
public function editAction()
{
$id = $this->params()->fromRoute('id', 0);
$form = $this->getForm($id);
$url = '';
if ($id > 0) {
if (!$form['data']) {
Helper::setFlashMessage(['error' => TextConstants::ERROR_NO_ITEM]);
return $this->redirect()->toRoute('backoffice/default', ['controller' => 'blog']);
}
$url = '//' . DomainConstants::WS_DOMAIN_NAME . '/blog/' . Helper::urlForSite($form['data']->getTitle());
}
return ['blogForm' => $form['form'], 'edit' => $id, 'imgDomain' => DomainConstants::IMG_DOMAIN_NAME, 'urlSie' => $url];
}
示例2: editAction
public function editAction()
{
$id = $this->params()->fromRoute('id', 0);
$form = $this->getForm($id);
$url = '';
if ($id > 0) {
if (!$this->getServiceLocator()->get('dao_geolocation_details')->checkRowExist(DbTables::TBL_NEWS, 'id', $id)) {
Helper::setFlashMessage(['error' => TextConstants::ERROR_NO_ITEM]);
return $this->redirect()->toRoute('backoffice/default', ['controller' => 'news']);
}
$url = '//' . DomainConstants::WS_DOMAIN_NAME . '/news/' . Helper::urlForSite($form->get('title')->getValue());
}
return ['newsForm' => $form, 'edit' => $id, 'urlSie' => $url];
}
示例3: feedAction
public function feedAction()
{
/**
* @var NewsDao $newsDao
*/
$newsDao = $this->getServiceLocator()->get('dao_news_news');
$newsList = $newsDao->getNewsListForFeed();
$feed = new Feed();
$feed->setTitle('Ginosi\'s News');
$feed->setLink('//www.ginosi.com');
$feed->setFeedLink('//www.ginosi.com/news/feed', 'rss');
$feed->setDateModified(time());
$feed->addHub('//pubsubhubbub.appspot.com/');
$feed->setDescription('Ginosi\'s News');
foreach ($newsList as $row) {
preg_match('/<p>(.*)<\\/p>/', $row->getEn(), $matches);
if (isset($matches[1]) && !is_null($matches[1])) {
$desc = $matches[1];
} else {
$contents = preg_split('/\\n/', $row->getEn());
$desc = $contents[0];
}
$entry = $feed->createEntry();
$entry->setTitle($row->getEn_title());
$entry->setLink("//" . DomainConstants::WS_DOMAIN_NAME . "/news/" . Helper::urlForSite($row->getEn_title()));
$entry->setDateModified(strtotime($row->getDate()));
$entry->setDateCreated(strtotime($row->getDate()));
$entry->setDescription($desc);
$entry->setContent($row->getEn());
$feed->addEntry($entry);
}
/**
* Render the resulting feed to Atom 1.0 and assign to $out.
* You can substitute "atom" with "rss" to generate an RSS 2.0 feed.
*/
$this->getServiceLocator()->get('Application')->getEventManager()->attach(\Zend\Mvc\MvcEvent::EVENT_RENDER, function ($event) {
$event->getResponse()->getHeaders()->addHeaderLine('Content-Type', 'text/xml; charset=UTF-8');
}, -10000);
$feed->export('rss');
return (new FeedModel())->setFeed($feed);
}
示例4: generateNewsPart
/**
* @return string
*/
private function generateNewsPart()
{
$partialXML = '';
// get blog posts
/**
* @var $newsService \DDD\Service\News
*/
$newsService = $this->getServiceLocator()->get('service_news');
$newsPosts = $newsService->getNewsResult();
foreach ($newsPosts as $news) {
$url = 'https://' . DomainConstants::WS_DOMAIN_NAME . '/news/' . Helper::urlForSite($news->getEn_title());
$partialXML .= sprintf($this->urlBlockTemplate, $url, '0.6');
}
return $partialXML;
}
示例5: autocompleteSearch
/**
*
*/
public function autocompleteSearch($txt)
{
$cityDao = new City($this->getServiceLocator(), 'ArrayObject');
$cities = $cityDao->getCityForSearch($txt);
$result = [];
foreach ($cities as $city) {
$result[] = ['value' => $city['city_url'], 'slug' => Helper::urlForSite($city['city_url']), 'type' => 'city'];
}
$apartmentDao = $this->getApartelGeneralDao();
$apartments = $apartmentDao->getApartmentSearch($txt);
foreach ($apartments as $apartment) {
$result[] = ['value' => $apartment['name'], 'slug' => Helper::urlForSite($apartment['url']) . '--' . Helper::urlForSite($apartment['location_slug']), 'type' => 'apartment'];
}
return $result;
}
示例6: getBreadcrumbParams
/**
*
* @param string $controller
* @param string $action
* @param string $routeParam
* @param ArrayObject $getQuery
* @return boolean
*/
public function getBreadcrumbParams($controller = false, $action = false, $routeParam = false, $getQuery = false)
{
$noSecureDomain = '//' . \Library\Constants\DomainConstants::WS_DOMAIN_NAME;
if (!$controller || !$action) {
return false;
}
$controller = strtolower($controller);
$action = strtolower($action);
$controller = str_replace('website\\controller\\', '', $controller);
$params[] = ['name' => $this->getTextline(1449), 'url' => '/'];
switch ($controller) {
case 'search':
$params[] = ['name' => $this->getTextline(1322), 'url' => '/location'];
if ($cityName = $this->getNameFromQuery($getQuery, 'city')) {
$params[] = ['name' => $cityName, 'url' => ''];
}
break;
case 'apartment':
$apartmentTitle = isset($routeParam['apartmentTitle']) ? $routeParam['apartmentTitle'] : '';
$cityProvince = $provinceUrl = $apartment = $cityName = '';
if ($apartmentTitle) {
$cityParams = explode('--', $apartmentTitle);
$cityUrl = $cityParams[1];
$apartmentName = $cityParams[0];
$generalDao = new General($this->getServiceLocator(), 'ArrayObject');
$generalResult = $generalDao->getBreadcrupDataByCityApartment($apartmentName, Helper::urlForSearch($cityUrl));
if ($generalResult) {
$provinceUrl = $generalResult['prov_name'];
$cityName = $generalResult['city_name'];
$apartment = $generalResult['name'];
}
$cityProvince = $cityUrl . '--' . Helper::urlForSite($provinceUrl);
}
$params[] = ['name' => $this->getTextline(865), 'url' => '/location'];
if ($cityName) {
$params[] = ['name' => $cityName, 'url' => '/location/' . $cityProvince];
}
if ($apartment) {
$params[] = ['name' => $apartment . ' ' . $this->getTextline(1418), 'url' => ''];
}
break;
case 'aboutus':
if ($action == 'index') {
$params[] = ['name' => $this->getTextline(1440), 'url' => ''];
} elseif ($action == 'privacy-policy') {
$params[] = ['name' => $this->getTextline(1371), 'url' => ''];
} elseif ($action == 'terms-and-conditions') {
$params[] = ['name' => $this->getTextline(1373), 'url' => ''];
}
break;
case 'contactus':
$params[] = ['name' => $this->getTextline(1353), 'url' => ''];
break;
case 'faq':
$params[] = ['name' => $this->getTextline(1379), 'url' => ''];
break;
case 'location':
if ($action == 'index') {
$params[] = ['name' => $this->getTextline(1320), 'url' => ''];
} else {
$params[] = ['name' => $this->getTextline(1320), 'url' => '/location'];
$cityProvince = isset($routeParam['cityProvince']) ? $routeParam['cityProvince'] : '';
$locationService = $this->getServiceLocator()->get('service_website_location');
$cityResponse = $locationService->getCityByProvincCity($cityProvince);
$city = isset($cityResponse['city_data']['city_name']) ? $cityResponse['city_data']['city_name'] : '';
if (isset($routeParam['poi'])) {
$params[] = ['name' => $city, 'url' => '/location/' . $cityProvince];
$params[] = ['name' => $this->getNameFromRoute($routeParam['poi'], 0), 'url' => ''];
} else {
$params[] = ['name' => $city, 'url' => ''];
}
}
break;
case 'blog':
if ($action == 'index') {
$params[] = ['name' => $this->getTextline(1331), 'url' => ''];
} else {
$blogTitel = isset($routeParam['article']) ? $routeParam['article'] : '';
$params[] = ['name' => $this->getTextline(1331), 'url' => '/blog'];
$params[] = ['name' => $this->getNameFromRoute($blogTitel, 0), 'url' => ''];
}
break;
case 'news':
if ($action == 'index') {
$params[] = ['name' => $this->getTextline(1417), 'url' => ''];
} else {
$blogTitel = isset($routeParam['article']) ? $routeParam['article'] : '';
$params[] = ['name' => $this->getTextline(1417), 'url' => '/news'];
$params[] = ['name' => $this->getNameFromRoute($blogTitel, 0), 'url' => ''];
}
break;
case 'jobs':
//.........这里部分代码省略.........