/** * Tests the setLanguage method * * @return void * * @since 3.1 */ public function testSetLanguage() { // Test for an empty language $this->object->language = ''; $this->object->setLanguage(); $this->assertEquals($this->object->language, $this->object->defaultLanguage); // Test for "all" language $this->object->language = '*'; $this->object->setLanguage(); $this->assertEquals($this->object->language, '*'); // Test for "it-IT" language $this->object->language = 'it-IT'; $this->object->setLanguage(); $this->assertEquals($this->object->language, 'it-IT'); }
/** * 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; } $item->setLanguage(); // Initialize the item parameters. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry; // Build the necessary route and path information. $item->url = $this->getURL($item->id, $this->extension, $this->layout); $item->route = ContactHelperRoute::getContactRoute($item->slug, $item->catslug, $item->language); $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-data processing instructions based on the contact * configuration parameters. */ // Handle the contact position. if ($item->params->get('show_position', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'position'); } // Handle the contact street address. if ($item->params->get('show_street_address', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'address'); } // Handle the contact city. if ($item->params->get('show_suburb', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'city'); } // Handle the contact region. if ($item->params->get('show_state', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'region'); } // Handle the contact country. if ($item->params->get('show_country', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'country'); } // Handle the contact zip code. if ($item->params->get('show_postcode', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'zip'); } // Handle the contact telephone number. if ($item->params->get('show_telephone', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'telephone'); } // Handle the contact fax number. if ($item->params->get('show_fax', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'fax'); } // Handle the contact e-mail address. if ($item->params->get('show_email', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'email'); } // Handle the contact mobile number. if ($item->params->get('show_mobile', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'mobile'); } // Handle the contact webpage. if ($item->params->get('show_webpage', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'webpage'); } // Handle the contact user name. $item->addInstruction(FinderIndexer::META_CONTEXT, 'user'); // Add the type taxonomy data. $item->addTaxonomy('Type', 'Contact'); // 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); // Add the region taxonomy data. if (!empty($item->region) && $this->params->get('tax_add_region', true)) { $item->addTaxonomy('Region', $item->region); } // Add the country taxonomy data. if (!empty($item->country) && $this->params->get('tax_add_country', true)) { $item->addTaxonomy('Country', $item->country); } // Get content extras. FinderIndexerHelper::getContentExtras($item); // Index the item. $this->indexer->index($item); }
/** * 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); }
/** * 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_content', 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 = $this->getURL($item->id, $this->extension, $this->layout); $item->route = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->language); $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', 'Article'); // 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('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); }
/** * 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') { // Check if the extension is enabled. if (JComponentHelper::isEnabled($this->extension) == false) { return; } $item->setLanguage(); // Initialize the item parameters. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry; $registry = new Registry(); $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 = NewsfeedsHelperRoute::getNewsfeedRoute($item->slug, $item->catslug, $item->language); $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', 'News Feed'); // 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); }
/** * 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; } $item->setLanguage(); // Need to import component route helpers dynamically, hence the reason it's handled here $path = JPATH_SITE . '/components/' . $item->extension . '/helpers/route.php'; if (is_file($path)) { include_once $path; } $extension = ucfirst(substr($item->extension, 4)); // Initialize the item parameters. $registry = new JRegistry(); $registry->loadString($item->params); $item->params = $registry; $registry = new JRegistry(); $registry->loadString($item->metadata); $item->metadata = $registry; /* Add the meta-data processing instructions based on the categories * 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'); // Trigger the onContentPrepare event. $item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params); // Build the necessary route and path information. $item->url = $this->getURL($item->id, $item->extension, $this->layout); $class = $extension . 'HelperRoute'; if (class_exists($class) && method_exists($class, 'getCategoryRoute')) { $item->route = $class::getCategoryRoute($item->id); } else { $item->route = ContentHelperRoute::getCategoryRoute($item->slug, $item->catid); } $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; } // Translate the state. Categories should only be published if the parent category is published. $item->state = $this->translateState($item->state); // Add the type taxonomy data. $item->addTaxonomy('Type', 'Category'); // Add the language taxonomy data. $item->addTaxonomy('Language', $item->language); // Get content extras. FinderIndexerHelper::getContentExtras($item); // Index the item. $this->indexer->index($item); }
/** * 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); }
/** * Tests the setLanguage method * * @return void * * @since 3.1 */ public function testSetLanguage() { // Set the language value $this->object->setLanguage(); $this->assertEquals($this->object->language, $this->object->defaultLanguage); }
/** * 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); }
/** * 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; } $item->setLanguage(); $extension = ucfirst(substr($item->extension, 4)); $item->url = $this->getURL($item->id, $item->extension, $this->layout); $item->route = 'index.php?option=' . $this->extension . '&view=book&layout=' . $this->layout . '&id=' . $item->book_id; // Add the type taxonomy data. $item->addTaxonomy('Type', 'Book'); // Add the language taxonomy data. $item->addTaxonomy('Language', $item->language); // Index the item. $this->indexer->index($item); }