You should have received a copy of the GNU General Public License, and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. You may contact the copyright holder through XOOPS Project: http://xoops.org EOT; echo '<h4>Extracted Description</h4>'; // get the intro of the article to use as the description $description = Metagen::generateDescription($article, 50); echo '<p>' . $description . '</p>'; echo '<h4>SEO Slug</h4>'; // turn title into a slug echo '<p>' . Metagen::generateSeoTitle($title) . '</p>'; // highlight keywords in article echo '<h4>Article with Top 25 Keywords Highlighted</h4>'; // get important words from title $title_keywords = Metagen::generateKeywords($title, 25, 3); //Debug::dump($title_keywords); // get top 25 keywords, but always keep keywords from title $keywords = Metagen::generateKeywords($article, 25, 4, $title_keywords); Debug::dump($keywords, true); echo Highlighter::apply($keywords, $article); // add to the page Metagen::assignTitle($title); Metagen::assignKeywords($keywords); Metagen::assignDescription($description); // dump our source echo '<br /><h2>Source code</h2>'; \Xoops\Utils::dumpFile(__FILE__); $xoops->footer();
/** * @param string $content * @param string|array $keywords * * @return string Text */ public function highlight($content, $keywords) { $color = $this->publisher->getConfig('format_highlight_color'); if (substr($color, 0, 1) !== '#') { $color = '#' . $color; } $pre = '<span style="font-weight: bolder; background-color: ' . $color . ';">'; $post = '</span>'; return \Xmf\Highlighter::apply($keywords, $content, $pre, $post); }