############################################################## ## MOD Title: Update Meta Tags Dynamiques phpBB SEO 0.2.6 => 0.2.8 ## ## MOD Author: dcz http://www.phpbb-seo.com/ ## ## MOD Description: Ceci est la procédure de mise à jour du MOD Meta Tags Dynamiques phpBB SEO pour la transition version 0.2.6 => 0.2.8. ## Rendez-vous sur http://www.phpbb-seo.com/fr/toolkit-phpbb-seo/meta-tags-dynamiques-seo-t1678.html ## pour toujours obtenir la dernière version ou de l'aide pour ce MOD. ## ## MOD Version: 1.0 ## ## Installation Level: Easy ## Installation Time: 3 Minutes ## Files To Edit: 2 ## includes/functions.php, ## viewtopic.php, ## ## Included Files: n/a ## ## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ############################################################## ## Author Notes: ## _____________ ## ## Voici les instructions de mise à jour : Meta Tags Dynamiques phpBB SEO 0.2.6 => 0.2.8 ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ OPEN ]------------------------------------------ # includes/functions.php # #-----[ FIND ]------------------------------------------ # * => disallowed : Disallow tag based on GET var used : varname => 1|0, 1 will through a disallow meta tag. * Some default values are set bellow in the seo_meta_tags() method **/ var $mconfig = array('keywordlimit' => 15, 'wordlimit' => 25, 'wordminlen' => 2, 'bbcodestrip' => 'img|url|flash|code', 'ellipsis' => ' ...', 'topic_sql' => true, 'check_ignore' => false, 'bypass_common' => true, // Consider adding ", 'p' => 1" if your forum is no indexed yet or if no post urls are to be redirected // to add a noindex tag on post urls 'disallowed' => array('style' => 1, 'hilit' => 1, 'print' => 1, 'sid' => 1), ); /** * Returns meta tag code */ function build_meta( $page_title = '') { $this->meta['meta_desc'] = ( !empty($this->meta['meta_desc']) ) ? $this->meta['meta_desc'] : $this->meta_filter_txt($page_title . ' : ' . $this->meta['meta_desc_def']); $this->meta['keywords'] = ( !empty($this->meta['keywords']) ) ? $this->meta['keywords'] : $this->make_keywords( $page_title . ' ' . $this->meta['meta_keywords_def']); $this->meta['meta_title'] = ( !empty($this->meta['meta_title']) ) ? $this->meta_filter_txt($this->meta['meta_title']) : $page_title; // Do we allow indexing $this->meta['meta_robots'] = $this->meta['meta_robots_def']; foreach ( $this->mconfig['disallowed'] as $get => $disallow) { if ($disallow && isset($_REQUEST[$get])) { $this->meta['meta_robots'] = 'noindex,follow'; break; } } return sprintf( $this->meta['meta_tpl'], $this->meta['meta_title'], $this->meta['meta_lang'], $this->meta['meta_desc'], $this->meta['keywords'], $this->meta['meta_cat'], $this->meta['meta_robots'], $this->meta['meta_distrib'], $this->meta['meta_restype'], $this->meta['meta_copy'] ); } /** * Returns a coma separated keyword list */ function make_keywords($text) { global $phpbb_root_path; static $stop_words = array(); $keywords = ''; $num = 0; $text = utf8_strtolower(preg_replace(array('`&(amp;)?#?[a-z0-9]+;`i', '`[[:punct:]]+`', '`[0-9]+`', '`[\s]+`'), ' ', strip_tags($text))); $text = explode(' ', trim($text), 50); # #-----[ REPLACE WITH ]------------------------------------------ # * => disallowed : Disallow tag based on GET var used : varname => 1|0, 1 will through a disallow meta tag. * => noindex_files : Disallow tag based on the physical script file name * Some default values are set bellow in the seo_meta_tags() method **/ var $mconfig = array('keywordlimit' => 15, 'wordlimit' => 25, 'wordminlen' => 2, 'bbcodestrip' => 'img|url|flash|code', 'ellipsis' => ' ...', 'topic_sql' => true, 'check_ignore' => false, 'bypass_common' => true, // Consider adding ", 'p' => 1" if your forum is no indexed yet or if no post urls are to be redirected // to add a noindex tag on post urls 'disallowed' => array('style' => 1, 'hilit' => 1, 'print' => 1, 'sid' => 1), // noindex based on physical script file name 'noindex_files' => array("ucp" => 1), ); /** * Returns meta tag code */ function build_meta( $page_title = '') { global $phpEx, $user; $this->meta['meta_desc'] = ( !empty($this->meta['meta_desc']) ) ? $this->meta['meta_desc'] : $this->meta_filter_txt($page_title . ' : ' . $this->meta['meta_desc_def']); $this->meta['keywords'] = ( !empty($this->meta['keywords']) ) ? $this->meta['keywords'] : $this->make_keywords( $page_title . ' ' . $this->meta['meta_keywords_def']); $this->meta['meta_title'] = ( !empty($this->meta['meta_title']) ) ? $this->meta_filter_txt($this->meta['meta_title']) : $page_title; // Do we allow indexing based on get variable $this->meta['meta_robots'] = $this->meta['meta_robots_def']; foreach ( $this->mconfig['disallowed'] as $get => $disallow) { if ($disallow && isset($_GET[$get])) { $this->meta['meta_robots'] = 'noindex,follow'; break; } } // Do we allow indexing based on physical script file name if (@isset($this->mconfig['noindex_files'][str_replace(".$phpEx", '', $user->page['page_name'])])) { $this->meta['meta_robots'] = 'noindex,follow'; } return sprintf( $this->meta['meta_tpl'], $this->meta['meta_title'], $this->meta['meta_lang'], $this->meta['meta_desc'], $this->meta['keywords'], $this->meta['meta_cat'], $this->meta['meta_robots'], $this->meta['meta_distrib'], $this->meta['meta_restype'], $this->meta['meta_copy'] ); } /** * Returns a coma separated keyword list */ function make_keywords($text) { global $phpbb_root_path, $phpEx; static $stop_words = array(); $keywords = ''; $num = 0; $text = utf8_strtolower(preg_replace(array('`&(amp;)?[^:]+;`i', '`[[:punct:]]+`', '`[0-9]+`', '`[\s]+`'), ' ', strip_tags($text))); # #-----[ OPEN ]------------------------------------------ # viewtopic.php # #-----[ FIND ]------------------------------------------ # $seo_meta->meta['keywords'] = !empty($m_kewrd) ? $seo_meta->make_keywords($m_kewrd) : $seo_meta->make_keywords($seo_meta->meta['meta_desc']); # #-----[ REPLACE WITH ]------------------------------------------ # $seo_meta->meta['keywords'] = $seo_meta->make_keywords($row['post_subject'] . (!empty($m_kewrd) ? $m_kewrd : $seo_meta->meta['meta_desc'])); # #---[ SAVE/CLOSE ALL FILES ]----------------------- # # EoM