本文整理汇总了PHP中FinderIndexerResult::addInstruction方法的典型用法代码示例。如果您正苦于以下问题:PHP FinderIndexerResult::addInstruction方法的具体用法?PHP FinderIndexerResult::addInstruction怎么用?PHP FinderIndexerResult::addInstruction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FinderIndexerResult
的用法示例。
在下文中一共展示了FinderIndexerResult::addInstruction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Override method to index a certain result
*
* @param FinderIndexerResult $item Finder item
* @param string $format Formatting (html or text)
*
* @return null
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
/*
if (JComponentHelper::isEnabled($this->extension) == false)
{
return;
}
*/
// Prepare the item
$item->access = 1;
// Define these items as songs
$item->addTaxonomy('Type', 'Song');
// Add artist information
$item->addInstruction(FinderIndexer::META_CONTEXT, 'artist');
$item->addTaxonomy('Artist', $item->artist);
// Set language
//$item->setLanguage();
//$item->addTaxonomy('Language', $item->language);
// Set URLs
$item->route = 'index.php?option=com_music&view=song&id=' . $item->id;
$item->url = $item->route;
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Allow others to hook into our $item as well
FinderIndexerHelper::getContentExtras($item);
$this->indexer->index($item);
}
示例2: _index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param object The item to index as an FinderIndexerResult object.
* @throws Exception on database error.
*/
protected function _index(FinderIndexerResult $item)
{
// Build the necessary route and path information.
$item->url = $this->_getURL($item->topic);
$item->itemid = '100065';
$item->route = $item->url . '&post=' . $item->id . '&Itemid=' . $item->itemid . '#p' . $item->id;
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'display_name');
// Strip slashes!
$item->title = stripslashes($item->title);
$item->summary = stripslashes($item->summary);
$item->display_name = stripslashes($item->display_name);
$item->text = FinderIndexerHelper::prepareContent($item->summary);
// Translate the access group to an access level.
//$item->cat_access = $this->_getAccessLevel($item->cat_access);
// Inherit state and access form the category.
$item->state = 1;
$item->access = 0;
// Set the language.
$item->language = FinderIndexerHelper::getDefaultLanguage();
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Forum Post');
// Add the author taxonomy data.
if (!empty($item->author)) {
$item->addTaxonomy('Forum User', $item->display_name);
}
// Index the item.
FinderIndexer::index($item);
}
示例3: testManipulateInstructions
/**
* Method to test adding an instruction, retrieving the instructions array, and removing it
*
* @return void
*
* @since 3.1
*/
public function testManipulateInstructions()
{
// Add our test instruction
$this->object->addInstruction(FinderIndexer::MISC_CONTEXT, 'testItem');
$instructions = $this->object->getInstructions();
$testItem = $instructions[FinderIndexer::MISC_CONTEXT];
// Assert the test instruction is present
$this->assertContains('testItem', $testItem);
// Remove the test instruction
$this->object->removeInstruction(FinderIndexer::MISC_CONTEXT, 'testItem');
$instructions = $this->object->getInstructions();
$testItem = $instructions[FinderIndexer::MISC_CONTEXT];
// Assert the test instruction is gone
$this->assertNotContains('testItem', $testItem);
}
示例4: index
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false || !$item->id) {
return;
}
if (!($zoo_item = $this->app->table->item->get($item->id, true))) {
return;
}
$registry = new JRegistry();
$registry->loadArray($zoo_item->getParams()->get("metadata."));
$item->metadata = $registry;
$item->metaauthor = $zoo_item->getParams()->get("metadata.author");
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'element_data');
$item->summary = $this->renderer->render('item.default', array('item' => $zoo_item));
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = $this->app->route->item($zoo_item, false);
$item->path = FinderIndexerHelper::getContentPath($item->route);
$item->state = $zoo_item->searchable == 1 && $zoo_item->state == 1;
$item->element_data = $this->app->database->queryResultArray('SELECT value FROM ' . ZOO_TABLE_SEARCH . ' WHERE item_id = ' . (int) $item->id);
$item->addTaxonomy('Type', $zoo_item->getType()->name);
foreach ($zoo_item->getRelatedCategories(true) as $category) {
$item->addTaxonomy('Category', $category->name);
}
foreach ($zoo_item->getTags() as $tag) {
$item->addTaxonomy('Tag', $tag);
}
FinderIndexerHelper::getContentExtras($item);
if ($this->app->joomla->version->isCompatible('3.0')) {
$this->indexer->index($item);
} else {
FinderIndexer::index($item);
}
}
示例5: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
$access = 1;
if (is_null($item->privacy)) {
$privacy = FD::privacy($item->user_id);
$privacyValue = $privacy->getValue('photos', 'view');
$item->privacy = $privacyValue;
}
if ($item->privacy == SOCIAL_PRIVACY_PUBLIC) {
$access = 1;
} else {
if ($item->privacy == SOCIAL_PRIVACY_MEMBER) {
$access = 2;
} else {
// this is not public / member items. do not index this item
return;
}
}
// $sql->select('a.id, a.title, a.alias, a.introtext AS summary, a.fulltext AS body');
// $sql->select('a.state, a.catid, a.created AS start_date, a.created_by');
// $sql->select('a.created_by_alias, a.modified, a.modified_by, a.attribs AS params');
// $sql->select('a.metakey, a.metadesc, a.metadata, a.language, a.access, a.version, a.ordering');
// $sql->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date');
// $sql->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
// album onwer
$user = FD::user($item->user_id);
$userAlias = $user->getAlias(false);
$photo = FD::table('Photo');
$photo->load($item->id);
// Build the necessary route and path information.
// index.php?option=com_easysocial&view=photos&layout=item&id=510:00000690&type=user&uid=84:jenny-siew
$item->url = 'index.php?option=com_easysocial&view=photos&layout=item&id=' . $photo->getAlias() . '&type=' . $photo->type . '&uid=' . $userAlias;
$item->route = $photo->getPermalink();
$item->route = $this->removeAdminSegment($item->route);
$item->path = FinderIndexerHelper::getContentPath($item->route);
$category = 'user photo';
if ($item->type == SOCIAL_TYPE_GROUP) {
$category = 'group photo';
}
$item->access = $access;
$item->alias = $photo->getAlias();
$item->state = 1;
$item->catid = $photo->type == SOCIAL_TYPE_GROUP ? 2 : 1;
$item->start_date = $photo->created;
$item->created_by = $photo->user_id;
$item->created_by_alias = $userAlias;
$item->modified = $photo->assigned_date == '0000-00-00 00:00:00' ? $photo->created : $photo->assigned_date;
$item->modified_by = $photo->user_id;
$item->params = '';
$item->metakey = $category . ' ' . $photo->title;
$item->metadesc = $category . ' ' . $photo->title;
$item->metadata = '';
$item->publish_start_date = $item->modified;
$item->category = $category;
$item->cat_state = 1;
$item->cat_access = 0;
$item->summary = $photo->title;
$item->body = $photo->title;
// Add the meta-author.
$item->metaauthor = $userAlias;
$item->author = $userAlias;
// add image param
$registry = FD::registry();
$registry->set('image', $photo->getSource());
$item->params = $registry;
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'EasySocial.Photos');
// Add the author taxonomy data.
$item->addTaxonomy('Author', $userAlias);
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$langParams = JComponentHelper::getParams('com_languages');
$item->language = $langParams->get('site', 'en-GB');
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
if (FD::isJoomla30()) {
$this->indexer->index($item);
//.........这里部分代码省略.........
示例6: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
*
* @return void
*
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item)
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Forum Post');
// Add the author taxonomy data.
if (!empty($item->author)) {
$item->addTaxonomy('Author', $item->author);
}
// Add the category taxonomy data.
// $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
FinderIndexer::index($item);
}
示例7: index
/**
* Main index function run when indexing happens
*
* @param FinderIndexerResult $item
* @return bool|void
*/
protected function index(FinderIndexerResult $item)
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
//Add the instructions
foreach ($this->instructions as $type => $instructions) {
foreach ($instructions as $instruction) {
$item->addInstruction($type, $instruction);
}
}
// Add the type taxonomy data.
$item->addTaxonomy('Type', $this->type_title);
FinderIndexerHelper::getContentExtras($item);
// Index the item.
if (method_exists('FinderIndexer', 'getInstance')) {
FinderIndexer::getInstance()->index($item);
} else {
FinderIndexer::index($item);
}
}
示例8: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = $registry;
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = WeblinksHelperRoute::getWeblinkRoute($item->slug, $item->catslug);
$item->path = FinderIndexerHelper::getContentPath($item->route);
/*
* Add the meta-data processing instructions based on the newsfeeds
* configuration parameters.
*/
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Web Link');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
FinderIndexer::index($item);
}
示例9: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 3.1
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
$item->setLanguage();
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_tags', true);
$item->params->merge($registry);
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = TagsHelperRoute::getTagRoute($item->slug);
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true)) {
$item->title = $title;
}
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Tag');
// Add the author taxonomy data.
if (!empty($item->author) || !empty($item->created_by_alias)) {
$item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author);
}
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Index the item.
$this->indexer->index($item);
}
示例10: getItems
/**
* Method to index all items
*
* @param int $offset
* @param int $limit
* @param string $sql
*
* @return array
*/
protected function getItems($offset, $limit, $sql = null)
{
$items = array();
$products = $this->loadProducts($offset, $limit);
// Loop through the products to build the item-array
foreach ($products as $product) {
//$this->debug("page [$offset;$limit] ".$product['name']);
// Construct a basic class
$item = new FinderIndexerResult();
// Add basics
$item->id = $product['product_id'];
$item->title = $product['name'];
// Add URLs
$item->request = $product['url_path'];
$item->url = 'index.php?option=com_magebridge&view=root&request=' . $item->request;
$item->route = 'index.php?option=com_magebridge&view=root&request=' . $item->request;
// Add body-text
if (!empty($product['short_description'])) {
$item->summary = $product['short_description'];
} else {
$item->summary = $product['description'];
}
// Add additional data
$item->image = $product['image'];
$item->small_image = $product['small_image'];
$item->layout = $this->layout;
$item->type_id = $this->getTypeId();
// Add some flags
$item->published = 1;
$item->state = 1;
$item->access = 1;
$item->language = 'en-GB';
// @todo
// Add pricing
// @todo: Why is in the finder-database but not documented?
$item->list_price = $product['price_raw'];
$item->sale_price = $product['price_raw'];
// Add extra search terms
if (is_array($product['search'])) {
foreach ($product['search'] as $searchName => $searchValue) {
$item->{$searchName} = $searchValue;
$item->addInstruction(FinderIndexer::TEXT_CONTEXT, $searchName);
}
}
$items[] = $item;
}
return $items;
}
示例11: index
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_virtuemart', true);
$item->params->merge($registry);
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
$item->body = FinderIndexerHelper::prepareContent($item->body, $item->params);
// Build the necessary route and path information.
$item->url = "index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=206&virtuemart_product_id=" . $item->id;
$item->route = "index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=206&virtuemart_product_id=" . $item->id;
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true)) {
$item->title = $title;
}
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Translate the state. Articles should only be published if the category is published.
$item->state = 1;
$item->cat_state = 1;
$item->cat_access = 1;
$item->access = 1;
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'VM Product');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, 1, 1);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
示例12: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = $registry;
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
if ($item->slug instanceof JCategoryNode) {
$ads_id = $item->slug->id;
} else {
$ads_id = (int) $item->slug;
}
$adsmodelcontent = new AdsmanagerModelContent();
$ads_catid = $adsmodelcontent->getContent($ads_id, true)->catid;
$url = "index.php?option=com_adsmanager&view=details&id=" . $ads_id . "&catid=" . $ads_catid;
$xhtml = true;
$ssl = null;
$item->route = TRoute::_($url);
//$item->route = AdsmanagerHelperRoute::getAdsRoute($item->slug, $item->catslug);
//$item->route = AdsmanagerHelperRoute::_("index.php?option=com_adsmanager&view=details&id=".$row->id."&catid=".$row->catid);
$item->path = FinderIndexerHelper::getContentPath($item->route);
/*
* Add the meta-data processing instructions based on the newsfeeds
* configuration parameters.
*/
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Ads');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
示例13: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format. Not used.
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
$item->setLanguage();
// Check if the extension is enabled.
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialise the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_j2store', true);
$item->params->merge($registry);
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
$item->body = FinderIndexerHelper::prepareContent($item->body, $item->params);
//let us get the redirect choice
if ($this->params->get('redirect_to', 'j2store') == 'article') {
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->language);
$item->path = FinderIndexerHelper::getContentPath($item->route);
} else {
$menu_id = $this->params->get('menuitem_id');
$item->url = $this->getJ2StoreURL($item->j2store_product_id, $this->extension, $this->layout);
$item->route = 'index.php?option=com_j2store&view=products&task=view&id=' . $item->j2store_product_id . '&Itemid=' . $menu_id;
$item->path = FinderIndexerHelper::getContentPath($item->route);
}
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true)) {
$item->title = $title;
}
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Translate the state. Articles should only be published if the category is published.
$item->state = $this->translateState($item->state, $item->cat_state);
// Add the type taxonomy data.
$item->addTaxonomy('Type', $this->type_title);
// Add the author taxonomy data.
if (!empty($item->author) || !empty($item->created_by_alias)) {
$item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author);
}
// Add the category taxonomy data.
$item->addTaxonomy('J2Store Category', $item->category, $item->cat_state, $item->cat_access);
$brandmodel = F0FModel::getTmpInstance('Manufacturers', 'J2StoreModel');
$brandmodel->enabled(1);
FinderIndexerHelper::getContentExtras($item);
// Add the Brand taxonomy data.
$item->addTaxonomy('J2Store Brand', $item->brand);
// Index the item.
$this->indexer->index($item);
}
示例14: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
$access = 1;
if (is_null($item->privacy)) {
$privacy = FD::privacy($item->user_id);
$privacyValue = $privacy->getValue('albums', 'view');
$item->privacy = $privacyValue;
}
if ($item->privacy == SOCIAL_PRIVACY_PUBLIC) {
$access = 1;
} else {
if ($item->privacy == SOCIAL_PRIVACY_MEMBER) {
$access = 2;
} else {
// this is not public / member items. do not index this item
return;
}
}
// $sql->select('a.id, a.title, a.alias, a.introtext AS summary, a.fulltext AS body');
// $sql->select('a.state, a.catid, a.created AS start_date, a.created_by');
// $sql->select('a.created_by_alias, a.modified, a.modified_by, a.attribs AS params');
// $sql->select('a.metakey, a.metadesc, a.metadata, a.language, a.access, a.version, a.ordering');
// $sql->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date');
// $sql->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
// album onwer
$user = FD::user($item->user_id);
$userAlias = $user->getAlias(false);
$album = FD::table('Album');
$album->load($item->id);
$albumAlias = $album->getAlias();
// Build the necessary route and path information.
// we need to pass in raw url so that smart search will not create another duplicate item.
// index.php?option=com_easysocial&view=albums&id=171:collection&layout=item&uid=84:jenny-siew&type=user
$item->url = 'index.php?option=com_easysocial&view=albums&id=' . $albumAlias . '&layout=item&uid=' . $userAlias . '&type=' . $album->type;
$item->route = $album->getPermalink();
$item->route = $this->removeAdminSegment($item->route);
$item->path = FinderIndexerHelper::getContentPath($item->route);
$category = '';
if ($album->core == SOCIAL_ALBUM_PROFILE_PHOTOS) {
$category = 'avatar album';
} else {
if ($album->core == SOCIAL_ALBUM_PROFILE_COVERS) {
$category = 'cover album';
} else {
if ($album->core == SOCIAL_ALBUM_STORY_ALBUM) {
$category = 'story album';
} else {
$category = 'user album';
}
}
}
$item->access = $access;
$item->alias = $albumAlias;
$item->state = 1;
$item->catid = $album->core;
$item->start_date = $album->created;
$item->created_by = $album->user_id;
$item->created_by_alias = $userAlias;
$item->modified = $album->assigned_date;
$item->modified_by = $album->user_id;
$item->params = '';
$item->metakey = $category . ' ' . $album->title;
$item->metadesc = $album->title . ' ' . $album->caption;
$item->metadata = '';
$item->publish_start_date = $album->assigned_date;
$item->category = $category;
$item->cat_state = 1;
$item->cat_access = 0;
$item->summary = empty($album->caption) ? $album->title : $album->caption;
$item->body = $album->title . ' ' . $album->caption;
// Add the meta-author.
$item->metaauthor = $userAlias;
$item->author = $userAlias;
// add image param
$registry = FD::registry();
$registry->set('image', $album->getCover());
$item->params = $registry;
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'EasySocial.Albums');
// Add the author taxonomy data.
//.........这里部分代码省略.........
示例15: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
$item->setLanguage();
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_knvbapi2', true);
$item->params->merge($registry);
$registry = null;
//release memory
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
$registry = null;
//release memory
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
$item->body = FinderIndexerHelper::prepareContent($item->body, $item->params);
if ($this->sub_layout != 'default') {
$view = $this->layout . '&layout=' . $this->sub_layout;
} else {
$view = $this->layout;
}
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $view);
$item->route = Knvbapi2HelperRoute::getTeamidRoute($item->slug, $item->language, $this->sub_layout);
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
if (!empty($title) and $this->params->get('use_menu_title', true)) {
$item->title = $title;
} else {
$item->title = $item->name;
}
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_name');
// Translate the state.
$item->state = $this->translateState($item->state);
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Teamid');
// Add the created_by taxonomy data.
if (!empty($item->created_by_alias)) {
$item->addTaxonomy('Author', !empty($item->created_by_name) ? $item->created_by_name : $item->created_by);
}
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}