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


PHP K2HelperRoute类代码示例

本文整理汇总了PHP中K2HelperRoute的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperRoute类的具体用法?PHP K2HelperRoute怎么用?PHP K2HelperRoute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onBeforeDisplayContent

	function onBeforeDisplayContent( &$article, &$params, $limitstart ){
		//this may fire fron a component other than com_content
		
		if(!file_exists(JPATH_SITE.DS.'plugins'.DS.'system'.DS.'myApiConnectFacebook.php') || ( !array_key_exists('category',$article) && !array_key_exists('showK2Plugins',$params)  )){ return; }
		
		if((@$article->id != '') && (@$_POST['fb_sig_api_key'] == '') && class_exists('plgSystemmyApiOpenGraph')){
			$row = & JTable::getInstance('content');
			$row->load($article->id);
			$attribs = new JParameter($row->attribs);
			if($attribs->get('ogimage','') == ''){
				$attribs->set('ogimage',plgContentmyApiOpenGraphContent::getContentImage($article->text));
				$row->attribs = $attribs->toString();
				$row->bind($row);
				$row->store();
			}
			//Set open graph tags
			if(JRequest::getVar('view','','get') == 'article' || (JRequest::getVar('option','','get') == 'com_k2' && JRequest::getVar('view','','get') == 'item')){
				if(isset($article->slug)){
					require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
					$link = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid);
				}elseif(method_exists('K2HelperRoute','getItemRoute')){
					$link = K2HelperRoute::getItemRoute($article->id.':'.urlencode($article->alias),$article->catid.':'.urlencode($article->category->alias));
				}else{
					error_log('myApi unable to calculate link for the article id '.$article->id);
					return;
				}
				$u =& JURI::getInstance( JURI::base().$link );
				$port 	= ($u->getPort() == '') ? '' : ":".$u->getPort();
				$articleURL = 'http://'.$u->getHost().$port.$u->getPath().'?'.$u->getQuery();
				$rawText = strip_tags($article->introtext);
				$newTags = array();
				$newTags['og:title'] 		= $article->title;
				$newTags['og:description'] 	= (strlen($rawText) > 247) ? substr($rawText,0,247).'...' : $rawText;
				$newTags['og:type']	= 'article';
				$newTags['og:author']	= (is_object($article->author)) ? $article->author->name : $article->author;
				$newTags['og:url'] 	= $articleURL;
				if($attribs->get('ogimage','0') != '0') $newTags['og:image'] = $attribs->get('ogimage');
				
				plgSystemmyApiOpenGraph::setTags($newTags);
			}
		}
	}
开发者ID:rhumme,项目名称:myApi,代码行数:42,代码来源:myApiOpenGraphContent.php

示例2: getItems

 /** I HAVE NOT MODIFIED BELOW THIS LINE **/
 function getItems($args)
 {
     global $mainframe;
     $advlink =& AdvLink::getInstance();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php';
     $items = array();
     $view = isset($args->view) ? $args->view : '';
     switch ($view) {
         default:
             $categories = AdvlinkK2::_getK2Categories();
             foreach ($categories as $category) {
                 $items[] = array('id' => K2HelperRoute::getCategoryRoute($category->id), 'name' => $category->name, 'class' => 'folder content');
             }
             break;
         case 'itemlist':
             $categories = AdvlinkK2::_getK2Categories($args->id);
             $itemlist = AdvlinkK2::_getK2Items($args->id);
             foreach ($categories as $category) {
                 $items[] = array('id' => K2HelperRoute::getCategoryRoute($category->id), 'name' => $category->name, 'class' => 'folder content');
             }
             foreach ($itemlist as $item) {
                 $items[] = array('id' => K2HelperRoute::getItemRoute($item->id, $args->id), 'name' => $item->title, 'class' => 'file');
             }
             break;
         case 'item':
             break;
     }
     return $items;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:30,代码来源:k2.php

示例3: _getCurrentItemURL

 private static function _getCurrentItemURL($article)
 {
     require_once JPATH_SITE . '/components/com_k2/helpers/route.php';
     $url = K2HelperRoute::getItemRoute($article->id . ":" . urlencode($article->alias), $article->catid);
     $url = SCArticleContent::_getCompleteURL($url);
     return $url;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:7,代码来源:articleContent.php

示例4: getAssociations

 public static function getAssociations($id = 0, $view = null)
 {
     jimport('helper.route', JPATH_COMPONENT_SITE);
     $application = JFactory::getApplication();
     $view = is_null($view) ? $application->input->get('view') : $view;
     $task = $application->input->get('task');
     $id = empty($id) ? $application->input->getInt('id') : $id;
     if ($view == 'item') {
         if ($id) {
             $associations = self::getItemAssociations($id);
             $return = array();
             foreach ($associations as $tag => $item) {
                 $return[$tag] = K2HelperRoute::getItemRoute($item->id, $item->catid, $item->language);
             }
             return $return;
         }
     } else {
         if ($view == 'itemlist' && $task == 'category') {
             if ($id) {
                 $associations = self::getCategoryAssociations($id);
                 $return = array();
                 foreach ($associations as $tag => $category) {
                     $return[$tag] = K2HelperRoute::getCategoryRoute($category->id, $category->language);
                 }
                 return $return;
             }
         }
     }
     return array();
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:30,代码来源:association.php

示例5: _prepareItem

 /**
  * Prepare item properties
  */
 protected function _prepareItem($item)
 {
     $item->link = JRoute::_(K2HelperRoute::getItemRoute($item->id, $item->catid));
     $item->introtext = JHtml::_('string.truncate', $item->introtext, $this->_params->get('intro_length', 200));
     $item->cat_link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($item->catid . ':' . urlencode($item->catslug))));
     return $item;
 }
开发者ID:jooservices,项目名称:zt-news,代码行数:10,代码来源:k2.php

示例6: getLink

 /**
  * Retrieves the profile link
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getLink()
 {
     if (!$this->exists()) {
         return parent::getLink();
     }
     $link = K2HelperRoute::getUserRoute($this->profile->id);
     return $link;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:client.php

示例7: com_k2_get_url

function com_k2_get_url(&$article, $isNew)
{
    $url = null;
    $helperPath = dirname(__FILE__) . "/../../../../../components/com_k2/helpers/route.php";
    if (is_file($helperPath)) {
        require_once $helperPath;
        $helper = new K2HelperRoute();
        $url = $helper->getItemRoute($article->id, $article->catid);
        $app = JApplication::getInstance('site');
        $router =& $app->getRouter();
        $uri = $router->build($url);
        $url = $uri->toString();
        if (strpos($url, "/administrator") === 0) {
            $url = substr($url, strlen("/administrator"));
        }
    }
    return $url;
}
开发者ID:Rikisha,项目名称:proj,代码行数:18,代码来源:ping.php

示例8: getTagRoute

 function getTagRoute($tag)
 {
     $needles = array('tag' => $tag);
     $link = 'index.php?option=com_k2&view=itemlist&task=tag&tag=' . urlencode($tag);
     if ($item = K2HelperRoute::_findItem($needles)) {
         $link .= '&Itemid=' . $item->id;
     }
     return $link;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:9,代码来源:route.php

示例9: get_link

 function get_link($num)
 {
     if ($this->mode == 'com_content') {
         return $this->parent->content[$num]['id'] != 0 ? JRoute::_(ContentHelperRoute::getArticleRoute($this->parent->content[$num]['id'], $this->parent->content[$num]['cid'])) : JRoute::_('index.php?option=com_users&view=login');
     } else {
         if ($this->mode == 'com_k2') {
             //
             require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php';
             //
             return urldecode(JRoute::_(K2HelperRoute::getItemRoute($this->parent->content[$num]['id'] . ':' . urlencode($this->parent->content[$num]['alias']), $this->parent->content[$num]['cid'] . ':' . urlencode($this->parent->content[$num]['cat_alias']))));
         } else {
             return false;
         }
     }
 }
开发者ID:Roma48,项目名称:abazherka,代码行数:15,代码来源:controller.php

示例10: getChildCategories

 public function getChildCategories($catId, $titleMax)
 {
     $categories = array();
     $query = "\n\t\t\t\tSELECT c.id, c.name as title, c.alias\n\t\t\t\tFROM #__k2_categories c\n\t\t\t\tWHERE\n\t\t\t\t\tc.published = 1\n\t\t\t\t\tAND c.parent = {$catId}\n\t\t\t";
     $this->db->setQuery($query);
     $rows = $this->db->loadObjectList();
     foreach ($rows as $category) {
         $categories[$category->id] = $category;
         // // category url
         // $slug = $category->alias ? $category->id.':'.$category->alias : $category->id;
         // $category->url = JRoute::_( ContentHelperRoute::getCategoryRoute($slug) );
         $category->url = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id . ':' . urlencode($category->alias))));
         // category title truncate
         $category->title = YtUtils::shorten($category->title, $titleMax);
     }
     return $categories;
 }
开发者ID:proyectoseb,项目名称:University,代码行数:17,代码来源:sjk2categoriesiij17newsreader.php

示例11: getObjectInfo

 function getObjectInfo($id, $language = null)
 {
     $info = new JCommentsObjectInfo();
     $routerHelper = JPATH_SITE . '/components/com_k2/helpers/route.php';
     if (is_file($routerHelper)) {
         require_once $routerHelper;
         $db = JFactory::getDBO();
         $query = "SELECT i.id, i.title, i.catid, i.alias, i.access, i.created_by, c.alias as catalias" . " FROM #__k2_items as i" . " LEFT JOIN #__k2_categories as c ON c.id=i.catid" . " WHERE i.id = " . $id;
         $db->setQuery($query);
         $row = $db->loadObject();
         if (!empty($row)) {
             $info->title = $row->title;
             $info->access = $row->access;
             $info->userid = $row->created_by;
             $info->link = JRoute::_(K2HelperRoute::getItemRoute($row->id . ':' . urlencode($row->alias), $row->catid . ':' . urlencode($row->catalias)));
         }
     }
     return $info;
 }
开发者ID:carmerin,项目名称:cesae-web,代码行数:19,代码来源:com_k2.plugin.php

示例12: get_link

 function get_link($num)
 {
     if ($this->mode == 'com_content') {
         return $this->parent->content[$num]['id'] != 0 ? JRoute::_(ContentHelperRoute::getArticleRoute($this->parent->content[$num]['id'], $this->parent->content[$num]['cid'])) : JRoute::_('index.php?option=com_users&view=login');
     } else {
         if ($this->mode == 'com_k2') {
             //
             require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php';
             //
             return urldecode(JRoute::_(K2HelperRoute::getItemRoute($this->parent->content[$num]['id'] . ':' . urlencode($this->parent->content[$num]['alias']), $this->parent->content[$num]['cid'] . ':' . urlencode($this->parent->content[$num]['cat_alias']))));
         } else {
             if ($this->mode == 'com_virtuemart') {
                 $itemid = $this->parent->config['vm_itemid'];
                 $link = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->parent->content[$num]['id'] . '&virtuemart_category_id=' . $this->parent->content[$num]['cid'] . '&Itemid=' . $itemid;
                 //
                 return $link;
             } else {
                 return false;
             }
         }
     }
 }
开发者ID:grchis,项目名称:Site-Auto,代码行数:22,代码来源:controller.php

示例13: go

 public function go($allGet)
 {
     $uri = JUri::getInstance();
     $currentLink = $uri->toString(array('path', 'query'));
     $start = JFactory::getApplication()->input->getInt('start', 0);
     JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_k2/tables');
     $limitstring = '';
     if ($start > 0) {
         $limits = $this->params->get('limits', 5);
         if ($start % $limits != 0) {
             $start = intval($start / $limits) * $limits;
         }
         $limitstring .= "?start=" . $start;
     }
     if ($allGet['view'] == 'item' && $allGet['task'] == '') {
         $item = JTable::getInstance('K2Item', 'Table');
         $item->load($allGet['id']);
         $category = JTable::getInstance('K2Category', 'Table');
         $category->load($item->catid);
         $original_link = JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . urlencode($item->alias), $item->catid . ':' . urlencode($category->alias)), false);
     } else {
         if ($allGet['view'] == 'itemlist' && $allGet['task'] == 'category') {
             $category = JTable::getInstance('K2Category', 'Table');
             $category->load((int) $allGet['id']);
             $original_link = JRoute::_(K2HelperRoute::getCategoryRoute((int) $allGet['id'] . ':' . urlencode($category->alias)), false) . $limitstring;
         } else {
             if ($allGet['view'] == 'itemlist' && $allGet['task'] == 'user') {
                 $original_link = JRoute::_(K2HelperRoute::getUserRoute((int) $allGet['id']), false) . $limitstring;
             } else {
                 return false;
             }
         }
     }
     if ($original_link && $original_link != $currentLink) {
         $this->shRedirect($original_link);
     }
     return true;
 }
开发者ID:pupsikus,项目名称:sto-city.test,代码行数:38,代码来源:com_k2.php

示例14: __getList

 /**
  * get the list of k2 items
  * 
  * @param JParameter $params;
  * @return Array
  */
 public function __getList($params)
 {
     global $mainframe;
     $maxTitle = $params->get('max_title', '100');
     $maxDesciption = $params->get('max_description', 100);
     $openTarget = $params->get('open_target', 'parent');
     $formatter = $params->get('style_displaying', 'title');
     $titleMaxChars = $params->get('title_max_chars', '100');
     $descriptionMaxChars = $params->get('description_max_chars', 100);
     $condition = $this->buildConditionQuery($params);
     $ordering = $params->get('k2_ordering', 'created_asc');
     $limit = $params->get('limit_items', 5);
     $ordering = str_replace('_', '  ', $ordering);
     $my =& JFactory::getUser();
     $aid = $my->get('aid', 0);
     $limitDescriptionBy = $params->get('limit_description_by', 'char');
     $thumbWidth = (int) $params->get('thumbnail_width', 35);
     $thumbHeight = (int) $params->get('thumbnail_height', 60);
     $imageHeight = (int) $params->get('main_height', 300);
     $imageWidth = (int) $params->get('main_width', 660);
     $isThumb = $params->get('auto_renderthumb', 1);
     $isStripedTags = $params->get('auto_strip_tags', 1);
     $extraURL = $params->get('open_target') != 'modalbox' ? '' : '&tmpl=component';
     $db =& JFactory::getDBO();
     $date =& JFactory::getDate();
     $now = $date->toMySQL();
     require_once JPath::clean(JPATH_SITE . '/components/com_k2/helpers/route.php');
     $query = "SELECT a.*, cr.rating_sum/cr.rating_count as rating, c.name as category_title,\n\t\t\t\t\t\t\tc.id as categoryid, c.alias as categoryalias, c.params as categoryparams, cc.commentcount as commentcount" . " FROM #__k2_items as a" . " LEFT JOIN #__k2_categories c ON c.id = a.catid" . " LEFT JOIN #__k2_rating as cr ON a.id = cr.itemid" . " LEFT JOIN (select cm.itemid  as id, count(cm.id) as commentcount from #__k2_comments as cm\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere cm.published=1 group by cm.itemid) as cc on a.id = cc.id";
     $query .= " WHERE a.published = 1" . " AND a.access IN (" . implode(',', $my->authorisedLevels()) . ")" . " AND a.trash = 0";
     if ($params->get('featured_items_show', '0') == 0) {
         $query .= " AND a.featured != 1";
     } elseif ($params->get('featured_items_show', '0') == 2) {
         $query .= " AND a.featured = 1";
     }
     $query .= $condition . ' ORDER BY ' . $ordering;
     $query .= $limit ? ' LIMIT ' . $limit : '';
     $db->setQuery($query);
     $data = $db->loadObjectlist();
     if (empty($data)) {
         return array();
     }
     foreach ($data as $key => &$item) {
         $item->link = JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . $item->alias, $item->catid . ':' . $item->categoryalias) . $extraURL);
         $item->date = JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC2'));
         $item->subtitle = $this->substring($item->title, $titleMaxChars);
         if ($limitDescriptionBy == 'word') {
             $string = preg_replace("/\\s+/", " ", strip_tags($item->introtext));
             $tmp = explode(" ", $string);
             $item->description = $descriptionMaxChars > count($tmp) ? $string : implode(" ", array_slice($tmp, 0, $descriptionMaxChars));
         } else {
             $item->description = self::substring($item->introtext, $descriptionMaxChars, '', $isStripedTags);
         }
         $item->rating = is_numeric($item->rating) ? floatval($item->rating / 5 * 100) : null;
         $item->author = $item->created_by;
         $item = $this->generateImages($item, $isThumb);
         $item->categoryLink = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($item->catid . ':' . urlencode($item->categoryalias))));
         if ($params->get('itemAuthor')) {
             if (!empty($item->created_by_alias)) {
                 $item->author = $item->created_by_alias;
                 $item->authorGender = NULL;
             } else {
                 $author =& JFactory::getUser($item->created_by);
                 $item->author = $author->name;
                 $query = "SELECT `gender` FROM #__k2_users WHERE userID=" . (int) $author->id;
                 $db->setQuery($query, 0, 1);
                 $item->authorGender = $db->loadResult();
                 //Author Link
                 $item->authorLink = JRoute::_(K2HelperRoute::getUserRoute($item->created_by));
             }
         }
     }
     return $data;
 }
开发者ID:vuchannguyen,项目名称:dayhoc,代码行数:79,代码来源:source.php

示例15: getUrl

	/**
	 * @param  int|TableInterface  $row
	 * @param  bool                $htmlspecialchars
	 * @param  string              $type
	 * @return string
	 */
	static public function getUrl( $row, $htmlspecialchars = true, $type = 'article' )
	{
		global $_CB_framework;

		$plugin				=	cbconsultationsClass::getPlugin();

		if ( is_integer( $row ) ) {
			$row			=	new cbconsultationsconsultationTable();

			$row->load( (int) $row );
		}

		$category			=	$row->getCategory();

		/** @noinspection PhpIncludeInspection */
		require_once ( $_CB_framework->getCfg( 'absolute_path' ) . '/components/com_k2/helpers/route.php' );

		$categorySlug		=	$row->get( 'catid' ) . ( $category->get( 'alias' ) ? ':' . $category->get( 'alias' ) : null );
		$articleSlug		=	$row->get( 'id' ) . ( $row->get( 'alias' ) ? ':' . $row->get( 'alias' ) : null );

		switch ( $type ) {
			case 'section':
				/** @noinspection PhpUndefinedClassInspection */
				$url		=	K2HelperRoute::getCategoryRoute( $plugin->params->get( 'consultation_section', null ) );
				break;
			case 'category':
				/** @noinspection PhpUndefinedClassInspection */
				$url		=	K2HelperRoute::getCategoryRoute( $categorySlug );
				break;
			case 'article':
			default:
			/** @noinspection PhpUndefinedClassInspection */
				$url		=	K2HelperRoute::getItemRoute( $articleSlug, $categorySlug );
				break;
		}

		if ( ! stristr( $url, 'Itemid' ) ) {
			$url			=	$_CB_framework->getCfg( 'live_site' ) . '/' . $url;
		} else {
			$url			=	JRoute::_( $url, false );
		}

		if ( $url ) {
			if ( $htmlspecialchars ) {
				$url		=	htmlspecialchars( $url );
			}
		}

		return $url;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:56,代码来源:k2.php


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