Esempio n. 1
0
function split_into_words($text, $idx = false)
{
    //this function is copied from FluxBB
    if (!file_exists(FORUM_ROOT . '/app_config/cache/commonwords.php')) {
        CacheEngine::CacheCommonWords();
    }
    include FORUM_ROOT . '/app_config/cache/commonwords.php';
    // Remove BBCode
    $text = preg_replace('%\\[/?(b|i|u|url)\\]%', ' ', $text);
    // Remove any apostrophes or dashes which aren't part of words
    $text = substr(preg_replace('%((?<=[^\\p{L}\\p{N}])[\'\\-]|[\'\\-](?=[^\\p{L}\\p{N}]))%u', '', ' ' . $text . ' '), 1, -1);
    // Remove punctuation and symbols (actually anything that isn't a letter or number), allow apostrophes and dashes (and % * if we aren't indexing)
    $text = preg_replace('%(?![\'\\-' . ($idx ? '' : '\\%\\*') . '])[^\\p{L}\\p{N}]+%u', ' ', $text);
    // Replace multiple whitespace or dashes
    $text = preg_replace('%(\\s){2,}%u', '\\1', $text);
    // Fill an array with all the words
    $words = explode(' ', $text);
    //filter out common words
    $words = array_filter($words, function ($word) use($common_words) {
        return !in_array(strtolower($word), $common_words);
    });
    return $words;
}
Esempio n. 2
0
<?php

$page_title = 'Clear cache';
$breadcrumbs = array(translate('administration') => 'admin', translate('interface') => 'admin/interface', 'Clear cache' => 'admin/interface/clearcache');
CacheEngine::CacheHeader();
CacheEngine::CacheLanguage();
CacheEngine::CacheAdminPages();
CacheEngine::CachePages();
CacheEngine::CacheCommonWords();
redirect($base_config['baseurl'] . '/admin/interface');