You are here

function _porterstemmer_pecl_loaded in Porter-Stemmer 6.2

Same name and namespace in other branches
  1. 8 porterstemmer.module \_porterstemmer_pecl_loaded()
  2. 7 porterstemmer.module \_porterstemmer_pecl_loaded()

Checks to see if the PECL stem extension has been loaded.

Return value

TRUE if the stem_english() function from the PECL stem library can be used, FALSE if not.

2 calls to _porterstemmer_pecl_loaded()
PorterStemmerOutput1UnitTest::setUp in ./porterstemmer.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
porterstemmer_search_preprocess in ./porterstemmer.module
Implementation of hook_search_preprocess().

File

./porterstemmer.module, line 125
This is an implementation of the Porter 2 Stemming algorithm from http://snowball.tartarus.org/algorithms/english/stemmer.html by Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Code

function _porterstemmer_pecl_loaded() {
  static $has_pecl_stem = FALSE;
  static $already_checked = FALSE;
  if ($already_checked) {
    return $has_pecl_stem;
  }
  $has_pecl_stem = extension_loaded('stem') && function_exists('stem_english');
  $already_checked = TRUE;
  return $has_pecl_stem;
}