• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FinderIndexerHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: index

 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     $item->body = FinderIndexerHelper::prepareContent($item->getElement('body'));
     $item->summary = FinderIndexerHelper::prepareContent($item->getElement('body'));
     $item->addTaxonomy('Type', 'FSF_FINDER_GLOSSARY');
     $word = $item->title;
     $anchor = strtolower(preg_replace("/[^A-Za-z0-9]/", '-', $word));
     $letter = strtolower(substr($word, 0, 1));
     $item->url = 'index.php?option=com_fsf&view=glossary&letter=' . $letter . '#' . $anchor;
     $item->route = $item->url;
     $item->state = $item->published;
     $item->access = 1;
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (FSFJ3Helper::IsJ3()) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }
开发者ID:sansandeep143,项目名称:av,代码行数:25,代码来源:fsf_glossary.php


示例2: 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);
 }
开发者ID:pjasmits,项目名称:JoomlaPluginsBook,代码行数:34,代码来源:song.php


示例3: _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);
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:36,代码来源:ninjaboard_posts.php


示例4: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   3.1
  */
 protected function setUp()
 {
     parent::setUp();
     // Store the factory state so we can mock the necessary objects
     $this->saveFactoryState();
     // Set up our mock database
     JFactory::$database = $this->getMockDatabase('Mysqli');
     FinderIndexerHelper::$stemmer = FinderIndexerStemmer::getInstance('porter_en');
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:17,代码来源:FinderIndexerTokenTest.php


示例5: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   3.1
  */
 protected function setUp()
 {
     // Store the factory state so we can mock the necessary objects
     $this->saveFactoryState();
     // Set up our mock database
     $db = JFactory::getDbo();
     $db->name = 'mysqli';
     JFactory::$database = $db;
     FinderIndexerHelper::$stemmer = FinderIndexerStemmer::getInstance('porter_en');
 }
开发者ID:sural98,项目名称:joomla-cms,代码行数:18,代码来源:FinderIndexerTokenTest.php


示例6: index

 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     $item->body = FinderIndexerHelper::prepareContent($item->getElement('body'));
     $item->summary = FinderIndexerHelper::prepareContent($item->getElement('body'));
     $item->addTaxonomy('Type', 'FSS_FINDER_KB_ARTICLE');
     $item->url = 'index.php?option=com_fss&view=kb&kbartid=' . $item->getElement('id');
     $item->route = $item->url;
     $item->state = $item->getElement('pub');
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (FSSJ3Helper::IsJ3()) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:21,代码来源:fss_kb.php


示例7: 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);
     }
 }
开发者ID:unrealprojects,项目名称:journal,代码行数:40,代码来源:zoosmartsearch.php


示例8: testGetPrimaryLanguage

 /**
  * Tests the getPrimaryLanguage method
  *
  * @return  void
  *
  * @since   3.0
  */
 public function testGetPrimaryLanguage()
 {
     $this->assertThat(FinderIndexerHelper::getPrimaryLanguage('en-GB'), $this->StringContains('en'), 'The primary language is en');
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:11,代码来源:FinderIndexerHelperTest.php


示例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.  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);
 }
开发者ID:01J,项目名称:topm,代码行数:64,代码来源:content.php


示例10: populateState

 /**
  * Method to auto-populate the model state.  Calling getState in this method will result in recursion.
  *
  * @param   string  $ordering   An optional ordering field. [optional]
  * @param   string  $direction  An optional direction. [optional]
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // Get the configuration options.
     $app = JFactory::getApplication();
     $input = $app->input;
     $params = $app->getParams();
     $user = JFactory::getUser();
     $filter = JFilterInput::getInstance();
     $this->setState('filter.language', JLanguageMultilang::isEnabled());
     // Setup the stemmer.
     if ($params->get('stem', 1) && $params->get('stemmer', 'porter_en')) {
         FinderIndexerHelper::$stemmer = FinderIndexerStemmer::getInstance($params->get('stemmer', 'porter_en'));
     }
     $request = $input->request;
     $options = array();
     // Get the empty query setting.
     $options['empty'] = $params->get('allow_empty_query', 0);
     // Get the static taxonomy filters.
     $options['filter'] = $request->getInt('f', $params->get('f', ''));
     // Get the dynamic taxonomy filters.
     $options['filters'] = $request->get('t', $params->get('t', array()), '', 'array');
     // Get the query string.
     $options['input'] = $request->getString('q', $params->get('q', ''));
     // Get the query language.
     $options['language'] = $request->getCmd('l', $params->get('l', ''));
     // Get the start date and start date modifier filters.
     $options['date1'] = $request->getString('d1', $params->get('d1', ''));
     $options['when1'] = $request->getString('w1', $params->get('w1', ''));
     // Get the end date and end date modifier filters.
     $options['date2'] = $request->getString('d2', $params->get('d2', ''));
     $options['when2'] = $request->getString('w2', $params->get('w2', ''));
     // Load the query object.
     $this->query = new FinderIndexerQuery($options);
     // Load the query token data.
     $this->excludedTerms = $this->query->getExcludedTermIds();
     $this->includedTerms = $this->query->getIncludedTermIds();
     $this->requiredTerms = $this->query->getRequiredTermIds();
     // Load the list state.
     $this->setState('list.start', $input->get('limitstart', 0, 'uint'));
     $this->setState('list.limit', $input->get('limit', $app->get('list_limit', 20), 'uint'));
     /* Load the sort ordering.
      * Currently this is 'hard' coded via menu item parameter but may not satisfy a users need.
      * More flexibility was way more user friendly. So we allow the user to pass a custom value
      * from the pool of fields that are indexed like the 'title' field.
      * Also, we allow this parameter to be passed in either case (lower/upper).
      */
     $order = $input->getWord('filter_order', $params->get('sort_order', 'relevance'));
     $order = JString::strtolower($order);
     switch ($order) {
         case 'date':
             $this->setState('list.ordering', 'l.start_date');
             break;
         case 'price':
             $this->setState('list.ordering', 'l.list_price');
             break;
         case $order == 'relevance' && !empty($this->includedTerms):
             $this->setState('list.ordering', 'm.weight');
             break;
             // custom field that is indexed and might be required for ordering
         // custom field that is indexed and might be required for ordering
         case 'title':
             $this->setState('list.ordering', 'l.title');
             break;
         default:
             $this->setState('list.ordering', 'l.link_id');
             break;
     }
     /* Load the sort direction.
      * Currently this is 'hard' coded via menu item parameter but may not satisfy a users need.
      * More flexibility was way more user friendly. So we allow to be inverted.
      * Also, we allow this parameter to be passed in either case (lower/upper).
      */
     $dirn = $input->getWord('filter_order_Dir', $params->get('sort_direction', 'desc'));
     $dirn = JString::strtolower($dirn);
     switch ($dirn) {
         case 'asc':
             $this->setState('list.direction', 'ASC');
             break;
         default:
         case 'desc':
             $this->setState('list.direction', 'DESC');
             break;
     }
     // Set the match limit.
     $this->setState('match.limit', 1000);
     // Load the parameters.
     $this->setState('params', $params);
     // Load the user state.
     $this->setState('user.id', (int) $user->get('id'));
     $this->setState('user.groups', $user->getAuthorisedViewLevels());
//.........这里部分代码省略.........
开发者ID:ziyou-liu,项目名称:1line,代码行数:101,代码来源:search.php


示例11: populateState

 /**
  * Method to auto-populate the model state.  Calling getState in this method will result in recursion.
  *
  * @param   string  $ordering   An optional ordering field.
  * @param   string  $direction  An optional direction (asc|desc).
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // Get the configuration options.
     $app = JFactory::getApplication();
     $input = $app->input;
     $params = JComponentHelper::getParams('com_finder');
     $user = JFactory::getUser();
     // Get the query input.
     $this->setState('input', $input->request->get('q', '', 'string'));
     // Set the query language
     if (JLanguageMultilang::isEnabled()) {
         $lang = JFactory::getLanguage()->getTag();
     } else {
         $lang = FinderIndexerHelper::getDefaultLanguage();
     }
     $lang = FinderIndexerHelper::getPrimaryLanguage($lang);
     $this->setState('language', $lang);
     // Load the list state.
     $this->setState('list.start', 0);
     $this->setState('list.limit', 10);
     // Load the parameters.
     $this->setState('params', $params);
     // Load the user state.
     $this->setState('user.id', (int) $user->get('id'));
 }
开发者ID:educakanchay,项目名称:kanchay,代码行数:35,代码来源:suggestions.php


示例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);
     $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);
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:52,代码来源:weblinks.php


示例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
  *
  * @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 = JComponentHelper::getParams('com_jshopping', true);
     $item->params->merge($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_jshopping&controller=product&task=view&category_id=' . $item->category_id . '&product_id=' . $item->product_id;
     $item->route = 'index.php?option=com_jshopping&controller=product&task=view&category_id=' . $item->category_id . '&product_id=' . $item->product_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.
     // Add the meta-data processing instructions.
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
     // Add the type taxonomy data.
     $item->addTaxonomy('Type', 'Product');
     // Add the category taxonomy data.
     $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (version_compare(JVERSION, '3.0.0', 'ge')) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }
开发者ID:Tommar,项目名称:vino2,代码行数:53,代码来源:jshopping.php


示例14: setup

 /**
  * Method to setup the indexer to be run.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 protected function setup()
 {
     // Load dependent classes.
     require_once JPATH_SITE . '/components/com_contact/helpers/route.php';
     // This is a hack to get around the lack of a route helper.
     FinderIndexerHelper::getContentPath('index.php?option=com_contact');
     return true;
 }
开发者ID:educakanchay,项目名称:educared,代码行数:15,代码来源:contacts.php


示例15: processString


//.........这里部分代码省略.........
                     }
                 } else {
                     // The phrase is <= 3 words so we can use it as is.
                     $phrases[] = $match;
                     $terms[] = $match;
                 }
             }
         }
     }
     // Add the remaining terms if present.
     if (!empty($input)) {
         $terms = array_merge($terms, explode(' ', $input));
     }
     // An array of our boolean operators. $operator => $translation
     $operators = array('AND' => JString::strtolower(JText::_('COM_FINDER_QUERY_OPERATOR_AND')), 'OR' => JString::strtolower(JText::_('COM_FINDER_QUERY_OPERATOR_OR')), 'NOT' => JString::strtolower(JText::_('COM_FINDER_QUERY_OPERATOR_NOT')));
     // If language debugging is enabled you need to ignore the debug strings in matching.
     if (JDEBUG) {
         $debugStrings = array('**', '??');
         $operators = str_replace($debugStrings, '', $operators);
     }
     /*
      * Iterate through the terms and perform any sorting that needs to be
      * done based on boolean search operators. Terms that are before an
      * and/or/not modifier have to be handled in relation to their operator.
      */
     for ($i = 0, $c = count($terms); $i < $c; $i++) {
         // Check if the term is followed by an operator that we understand.
         if (isset($terms[$i + 1]) && in_array($terms[$i + 1], $operators)) {
             // Get the operator mode.
             $op = array_search($terms[$i + 1], $operators);
             // Handle the AND operator.
             if ($op === 'AND' && isset($terms[$i + 2])) {
                 // Tokenize the current term.
                 $token = FinderIndexerHelper::tokenize($terms[$i], $lang, true);
                 $token = $this->getTokenData($token);
                 // Set the required flag.
                 $token->required = true;
                 // Add the current token to the stack.
                 $this->included[] = $token;
                 $this->highlight = array_merge($this->highlight, array_keys($token->matches));
                 // Skip the next token (the mode operator).
                 $this->operators[] = $terms[$i + 1];
                 // Tokenize the term after the next term (current plus two).
                 $other = FinderIndexerHelper::tokenize($terms[$i + 2], $lang, true);
                 $other = $this->getTokenData($other);
                 // Set the required flag.
                 $other->required = true;
                 // Add the token after the next token to the stack.
                 $this->included[] = $other;
                 $this->highlight = array_merge($this->highlight, array_keys($other->matches));
                 // Remove the processed phrases if possible.
                 if (($pk = array_search($terms[$i], $phrases)) !== false) {
                     unset($phrases[$pk]);
                 }
                 if (($pk = array_search($terms[$i + 2], $phrases)) !== false) {
                     unset($phrases[$pk]);
                 }
                 // Remove the processed terms.
                 unset($terms[$i]);
                 unset($terms[$i + 1]);
                 unset($terms[$i + 2]);
                 // Adjust the loop.
                 $i += 2;
                 continue;
             } elseif ($op === 'OR' && isset($terms[$i + 2])) {
                 // Tokenize the current term.
开发者ID:01J,项目名称:topm,代码行数:67,代码来源:query.php


示例16: __construct

 /**
  * Method to construct the token object.
  *
  * @param   mixed   $term    The term as a string for words or an array for phrases.
  * @param   string  $lang    The simple language identifier.
  * @param   string  $spacer  The space separator for phrases. [optional]
  *
  * @since   2.5
  */
 public function __construct($term, $lang, $spacer = ' ')
 {
     $this->language = $lang;
     // Tokens can be a single word or an array of words representing a phrase.
     if (is_array($term)) {
         // Populate the token instance.
         $this->term = implode($spacer, $term);
         $this->stem = implode($spacer, array_map(array('FinderIndexerHelper', 'stem'), $term, array($lang)));
         $this->numeric = false;
         $this->common = false;
         $this->phrase = true;
         $this->length = JString::strlen($this->term);
         /*
          * Calculate the weight of the token.
          *
          * 1. Length of the token up to 30 and divide by 30, add 1.
          * 2. Round weight to 4 decimal points.
          */
         $this->weight = ($this->length >= 30 ? 30 : $this->length) / 30 + 1;
         $this->weight = round($this->weight, 4);
     } else {
         // Populate the token instance.
         $this->term = $term;
         $this->stem = FinderIndexerHelper::stem($this->term, $lang);
         $this->numeric = is_numeric($this->term) || (bool) preg_match('#^[0-9,.\\-\\+]+$#', $this->term);
         $this->common = $this->numeric ? false : FinderIndexerHelper::isCommon($this->term, $lang);
         $this->phrase = false;
         $this->length = JString::strlen($this->term);
         /*
          * Calculate the weight of the token.
          *
          * 1. Length of the token up to 15 and divide by 15.
          * 2. If common term, divide weight by 8.
          * 3. If numeric, multiply weight by 1.5.
          * 4. Round weight to 4 decimal points.
          */
         $this->weight = ($this->length >= 15 ? 15 : $this->length) / 15;
         $this->weight = $this->common == true ? $this->weight / 8 : $this->weight;
         $this->weight = $this->numeric == true ? $this->weight * 1.5 : $this->weight;
         $this->weight = round($this->weight, 4);
     }
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:51,代码来源:token.php


示例17: __construct

 * @since 1.5
 */
class plgSearchStreams extends JPlugin
{
    /**
	 * Constructor
	 *
	 * For php4 compatability we must not use the __constructor as a constructor for plugins
	 * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
	 * This causes problems with cross-referencing necessary for the observer design pattern.
	 *
	 * @param 	object $subject The object to observe
	 * @param 	array  $config  An array that holds the plugin configuration
	 * @since 1.5
	 */
    public function __construct(&$subject, $config)
    {
        parent::__construct($subject, $config);
        //$this->loadLanguage();
    }
    /**
	 * Display the button
	 *
	 * @return array A two element array of ( imageName, textToInsert )
	 */
    function onContentSearch()
    {
        //global $mainframe;
        $mainframe = JFactory::getApplication();
        $args = func_get_args();
        if (empty($args[0])) {
            return array();
        }
        // array(4) { [0]=> string(10) "she is asd" [1]=> string(5) "exact/all/any" [2]=> string(6) "oldest/newest/alpha/category/popular" [3]=> NULL }
        // Group ID and Filter Range will be from "areas" parameter in com_search form
        if (is_null($args[3])) {
            $areas = 0;
        } else {
            $areas = is_array($args[3]) ? $args[3][0] : $args[3];
        }
        if (preg_match('/_\\d\\w$/', $areas)) {
            $splitVal = explode('_', $areas);
            $groupId = $splitVal[0];
            $filterRange = $splitVal[1];
            // _2w (2 weeks), _1m (1 month), _3m (3 months), _0a (all)
            $rangeCond = $this->_getDateRange($filterRange);
        } else {
            // no filter range info provided;
            $groupId = $areas;
            $filterRange = '0a';
            $rangeCond = $this->_getDateRange($filterRange);
        }
        // search for all/streams/comments/files/people is from "searchphrase" parameter in com_search form
        $searchFor = $args[1];
        // custom class loader
        JLoader::register('FinderIndexerStemmer', FINDER_PATH_INDEXER . '/stemmer.php');
        FinderIndexerHelper::$stemmer = FinderIndexerStemmer::getInstance('porter_en');
        // option porter_en/snowball
        //FinderIndexerHelper::$stemmer = FinderIndexerStemmer::getInstance('snowball'); // option porter_en/snowball
        $option = array("input" => $args[0], "empty" => "0", "language" => "", "filter" => 0, "filters" => array());
        $keyTerm = new FinderIndexerQuery($option);
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        // This part get all groups that the logined user is permitted to see.
        $my = JXFactory::getUser();
        if (!$my->isAdmin()) {
            $query->select('id');
            $query->from('#__groups');
            // group must not be archived and access is public
            $query->where(' ( ' . $db->quoteName('archived') . ' = 0 AND ' . $db->quoteName('access') . ' = 0 ) ', 'OR');
            // OR group is private and user is a member of the private group
            $query->where('( ' . $db->quoteName('access') . ' = 1 AND `members` REGEXP \'^' . $my->id . '[^0-9]|[^0-9]' . $my->id . '[^0-9]|[^0-9]' . $my->id . '$\'' . ' )');
            $db->setQuery($query);
            $allowGroups = $db->loadObjectList();
            for ($i = 0; $i < count($allowGroups); $i++) {
                $allowGroupId[] = $allowGroups[$i]->id;
            }
            $allowGroupId[] = 0;
            $allowGroupCond = ' ( group_id IN (' . implode(',', $allowGroupId) . ') ) ';
        } else {
            $allowGroupCond = '';
        }
        //$limit		= 20;
        $condStream = $condComment = $condFile = $condProfile = array();
        $stream = $comment = $files = $people = $user = $rec = array();
        $streamId = $userId = $keywords = array();
        $condition = '';
        $count = 0;
        foreach ($keyTerm->included as $searchKey) {
            $keywords[] = $searchKey->term;
            // prepare stream condition
            $condStream[$count] = " ( message LIKE " . $db->quote('%' . $searchKey->term . '%');
            // prepare comment condition
            //$condComment[$count]	= " ( comment LIKE ".$db->quote('%'.$searchKey->term.'%');
            // prepare files condition
            $condFile[$count] = " ( filename LIKE " . $db->quote('%' . $searchKey->term . '%');
            // prepare people condition
            $condProfile[$count] = " ( value LIKE " . $db->quote('%' . $searchKey->term . '%');
            $condUser[$count] = " ( name LIKE " . $db->quote('%' . $searchKey->term . '%') . " OR username LIKE " . $db->quote('%' . $searchKey->term . '%');
            if ($searchKey->term != $searchKey->stem) {
//.........这里部分代码省略.........
开发者ID:ErickLopez76,项目名称:offiria,代码行数:101,代码来源:streams.php


示例18: index

 /**
  * Indexes a post on the site
  *
  * @since	5.0
  * @access	public
  * @param	FinderIndexerResult		The item to index
  * @param	string	The item's format
  * @return	void
  */
 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (!$this->exists()) {
         return;
     }
     // Build the necessary route and path information.
     $item->url = 'index.php?option=com_easyblog&view=entry&id=' . $item->id;
     $item->route = EBR::getRoutedURL($item->url, false, true);
     // Remove any /administrator/ segments from the url since the indexer could be executed from the back end
     $item->route = $this->removeAdminSegment($item->route);
     // Get the content path
     $item->path = FinderIndexerHelper::getContentPath($item->route);
     // If there is access defined, just set it to 2 which is special privileges.
     if (!$item->access || $item->access == 0) {
         $item->access = 1;
     } else {
         if ($item->access > 0) {
             $item->access = 2;
         }
     }
     // Load up the post item
     $post = EB::post();
     $post->load($item->id);
     // Get the intro text of the content
     $item->summary = $post->getIntro();
     // Get the contents
     $item->body = $post->getContent('entry', false);
     // If the post is password protected, we do not want to display the contents
     if ($post->isPasswordProtected()) {
         $item->summary = JText::_('PLG_FINDER_EASYBLOG_PASSWORD_PROTECTED');
     } else {
         // we want to get custom fields values.
         $fields = $post->getCustomFields();
         $fieldlib = EB::fields();
         $customfields = array();
         if ($fields) {
             foreach ($fields as $field) {
                 if ($field->group->hasValues($post)) {
                     foreach ($field->fields as $customField) {
                         $eachField = $fieldlib->get($customField->type);
                         $customfields[] = $eachField->text($customField, $post);
                     }
                 }
             }
             $customfieldvalues = implode(' ', $customfields);
             $item->body = $item->body . ' ' . $customfieldvalues;
         }
     }
     // Add the author's meta data
     $item->metaauthor = !empty($item->created_by_alias) ? $item->created_by_alias : $item->author;
     $item->author = !empty($item->created_by_alias) ? $item->created_by_alias : $item->author;
     // If the post has an image, use it
     $image = $post->getImage('thumbnail', false, true);
     // If there's no image, try to scan the contents for an image to be used
     if (!$image && $post->isLegacy()) {
         $image = EB::string()->getImage($item->body);
     }
     // If we still can't locate any images, use the placeholder image
     if (!$image) {
         $image = EB::getPlaceholderImage();
     }
     $registry = new JRegistry();
     $registry->set('image', $image);
     $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', 'EasyBlog');
     // 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.
     if (empty($item->language)) {
         $item->language = '*';
     }
     $item->addTaxonomy('Language', $item->language);
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // For Joomla 3.0, the indexer is assigned to the property
     // Index the item.
     if (EB::isJoomla30()) {
         return $this->indexer->index($item);
     }
     return FinderIndexer::index($item);
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:easyblog.php


示例19: index

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FinderIndexerResult类代码示例发布时间:2022-05-23
下一篇:
PHP FinderIndexer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap