/**
* Ultimate SEO URLs Contribution - osCommerce MS-2.2
*
* Ultimate SEO URLs offers search engine optimized URLS for osCommerce
* based applications. Other features include optimized performance and
* automatic redirect script.
* @package Ultimate-SEO-URLs
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 2.1
* @link http://www.oscommerce-freelancers.com/ osCommerce-Freelancers
* @copyright Copyright 2005, Bobby Easland
* @author Bobby Easland
* @filesource
*/
/**
* SEO_DataBase Class
*
* The SEO_DataBase class provides abstraction so the databaes can be accessed
* without having to use tep API functions. This class has minimal error handling
* so make sure your code is tight!
* @package Ultimate-SEO-URLs
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 1.1
* @link http://www.oscommerce-freelancers.com/ osCommerce-Freelancers
* @copyright Copyright 2005, Bobby Easland
* @author Bobby Easland
*/
class SEO_DataBase{
/**
* Database host (localhost, IP based, etc)
* @var string
*/
var $host;
/**
* Database user
* @var string
*/
var $user;
/**
* Database name
* @var string
*/
var $db;
/**
* Database password
* @var string
*/
var $pass;
/**
* Database link
* @var resource
*/
var $link_id;
/**
* MySQL_DataBase class constructor
* @author Bobby Easland
* @version 1.0
* @param string $host
* @param string $user
* @param string $db
* @param string $pass
*/
function SEO_DataBase($host, $user, $db, $pass){
$this->host = $host;
$this->user = $user;
$this->db = $db;
$this->pass = $pass;
$this->ConnectDB();
$this->SelectDB();
} # end function
/**
* Function to connect to MySQL
* @author Bobby Easland
* @version 1.1
*/
function ConnectDB(){
$this->link_id = mysql_connect($this->host, $this->user, $this->pass);
} # end function
/**
* Function to select the database
* @author Bobby Easland
* @version 1.0
* @return resoource
*/
function SelectDB(){
return mysql_select_db($this->db);
} # end function
/**
* Function to perform queries
* @author Bobby Easland
* @version 1.0
* @param string $query SQL statement
* @return resource
*/
function Query($query){
return @mysql_query($query, $this->link_id);
} # end function
/**
* Function to fetch array
* @author Bobby Easland
* @version 1.0
* @param resource $resource_id
* @param string $type MYSQL_BOTH or MYSQL_ASSOC
* @return array
*/
function FetchArray($resource_id, $type = MYSQL_BOTH){
return @mysql_fetch_array($resource_id, $type);
} # end function
/**
* Function to fetch the number of rows
* @author Bobby Easland
* @version 1.0
* @param resource $resource_id
* @return mixed
*/
function NumRows($resource_id){
return @mysql_num_rows($resource_id);
} # end function
/**
* Function to fetch the last insertID
* @author Bobby Easland
* @version 1.0
* @return integer
*/
function InsertID() {
return mysql_insert_id();
}
/**
* Function to free the resource
* @author Bobby Easland
* @version 1.0
* @param resource $resource_id
* @return boolean
*/
function Free($resource_id){
return @mysql_free_result($resource_id);
} # end function
/**
* Function to add slashes
* @author Bobby Easland
* @version 1.0
* @param string $data
* @return string
*/
function Slashes($data){
return addslashes($data);
} # end function
/**
* Function to perform DB inserts and updates - abstracted from osCommerce-MS-2.2 project
* @author Bobby Easland
* @version 1.0
* @param string $table Database table
* @param array $data Associative array of columns / values
* @param string $action insert or update
* @param string $parameters
* @return resource
*/
function DBPerform($table, $data, $action = 'insert', $parameters = '') {
reset($data);
if ($action == 'insert') {
$query = 'INSERT INTO `' . $table . '` (';
while (list($columns, ) = each($data)) {
$query .= '`' . $columns . '`, ';
}
$query = substr($query, 0, -2) . ') values (';
reset($data);
while (list(, $value) = each($data)) {
switch ((string)$value) {
case 'now()':
$query .= 'now(), ';
break;
case 'null':
$query .= 'null, ';
break;
default:
$query .= "'" . $this->Slashes($value) . "', ";
break;
}
}
$query = substr($query, 0, -2) . ')';
} elseif ($action == 'update') {
$query = 'UPDATE `' . $table . '` SET ';
while (list($columns, $value) = each($data)) {
switch ((string)$value) {
case 'now()':
$query .= '`' .$columns . '`=now(), ';
break;
case 'null':
$query .= '`' .$columns .= '`=null, ';
break;
default:
$query .= '`' .$columns . "`='" . $this->Slashes($value) . "', ";
break;
}
}
$query = substr($query, 0, -2) . ' WHERE ' . $parameters;
}
return $this->Query($query);
} # end function
} # end class
/**
* Ultimate SEO URLs Installer and Configuration Class
*
* Ultimate SEO URLs installer and configuration class offers a modular
* and easy to manage method of configuration. The class enables the base
* class to be configured and installed on the fly without the hassle of
* calling additional scripts or executing SQL.
* @package Ultimate-SEO-URLs
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 1.1
* @link http://www.oscommerce-freelancers.com/ osCommerce-Freelancers
* @copyright Copyright 2005, Bobby Easland
* @author Bobby Easland
*/
class SEO_URL_INSTALLER{
/**
* The default_config array has all the default settings which should be all that is needed to make the base class work.
* @var array
*/
var $default_config;
/**
* Database object
* @var object
*/
var $DB;
/**
* $attributes array holds information about this instance
* @var array
*/
var $attributes;
/**
* SEO_URL_INSTALLER class constructor
* @author Bobby Easland
* @version 1.1
*/
function SEO_URL_INSTALLER(){
$this->attributes = array();
$x = 0;
$this->default_config = array();
$this->default_config['SEO_ENABLED'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs? This is a global setting and will turn them off completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['SEO_ADD_CPATH_TO_PRODUCT_URLS'] = array('DEFAULT' => 'false',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Add cPath to product URLs?', 'SEO_ADD_CPATH_TO_PRODUCT_URLS', 'false', 'This setting will append the cPath to the end of product URLs (i.e. - some-product-p-1.html?cPath=xx).', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['SEO_ADD_CAT_PARENT'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Add category parent to begining of URLs?', 'SEO_ADD_CAT_PARENT', 'true', 'This setting will add the category parent name to the beginning of the category URLs (i.e. - parent-category-c-1.html).', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['SEO_URLS_FILTER_SHORT_WORDS'] = array('DEFAULT' => '3',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Filter Short Words', 'SEO_URLS_FILTER_SHORT_WORDS', '3', 'This setting will filter words less than or equal to the value from the URL.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, NULL)"
);
$x++;
$this->default_config['USE_SEO_CACHE_GLOBAL'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable SEO cache to save queries?', 'USE_SEO_CACHE_GLOBAL', 'true', 'This is a global setting and will turn off caching completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['USE_SEO_CACHE_PRODUCTS'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable product cache?', 'USE_SEO_CACHE_PRODUCTS', 'true', 'This will turn off caching for the products.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['USE_SEO_CACHE_CATEGORIES'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable categories cache?', 'USE_SEO_CACHE_CATEGORIES', 'true', 'This will turn off caching for the categories.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['USE_SEO_CACHE_MANUFACTURERS'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable manufacturers cache?', 'USE_SEO_CACHE_MANUFACTURERS', 'true', 'This will turn off caching for the manufacturers.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['USE_SEO_CACHE_ARTICLES'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable articles cache?', 'USE_SEO_CACHE_ARTICLES', 'true', 'This will turn off caching for the articles.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['USE_SEO_CACHE_TOPICS'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable topics cache?', 'USE_SEO_CACHE_TOPICS', 'true', 'This will turn off caching for the article topics.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['USE_SEO_CACHE_INFO_PAGES'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable information cache?', 'USE_SEO_CACHE_INFO_PAGES', 'true', 'This will turn off caching for the information pages.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['USE_SEO_REDIRECT'] = array('DEFAULT' => 'true',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable automatic redirects?', 'USE_SEO_REDIRECT', 'true', 'This will activate the automatic redirect code and send 301 headers for old to new URLs.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['SEO_REWRITE_TYPE'] = array('DEFAULT' => 'Rewrite',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Choose URL Rewrite Type', 'SEO_REWRITE_TYPE', 'Rewrite', 'Choose which SEO URL format to use.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''Rewrite''),')"
);
$x++;
$this->default_config['SEO_CHAR_CONVERT_SET'] = array('DEFAULT' => '',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enter special character conversions', 'SEO_CHAR_CONVERT_SET', '', 'This setting will convert characters.
The format MUST be in the form: char=>conv,char2=>conv2', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, NULL)"
);
$x++;
$this->default_config['SEO_REMOVE_ALL_SPEC_CHARS'] = array('DEFAULT' => 'false',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Remove all non-alphanumeric characters?', 'SEO_REMOVE_ALL_SPEC_CHARS', 'false', 'This will remove all non-letters and non-numbers. This should be handy to remove all special characters with 1 setting.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"
);
$x++;
$this->default_config['SEO_URLS_CACHE_RESET'] = array('DEFAULT' => 'false',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Reset SEO URLs Cache', 'SEO_URLS_CACHE_RESET', 'false', 'This will reset the cache data for SEO', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), 'tep_reset_cache_data_seo_urls', 'tep_cfg_select_option(array(''reset'', ''false''),')"
);
$this->init();
} # end class constructor
/**
* Initializer - if there are settings not defined the default config will be used and database settings installed.
* @author Bobby Easland
* @version 1.1
*/
function init(){
foreach( $this->default_config as $key => $value ){
$container[] = defined($key) ? 'true' : 'false';
} # end foreach
$this->attributes['IS_DEFINED'] = in_array('false', $container) ? false : true;
switch(true){
case ( !$this->attributes['IS_DEFINED'] ):
$this->eval_defaults();
$this->DB = new SEO_DataBase(DB_SERVER, DB_SERVER_USERNAME, DB_DATABASE, DB_SERVER_PASSWORD);
$sql = "SELECT configuration_key, configuration_value
FROM " . TABLE_CONFIGURATION . "
WHERE configuration_key LIKE '%SEO%'";
$result = $this->DB->Query($sql);
$num_rows = $this->DB->NumRows($result);
$this->DB->Free($result);
$this->attributes['IS_INSTALLED'] = (sizeof($container) == $num_rows) ? true : false;
if ( !$this->attributes['IS_INSTALLED'] ){
$this->install_settings();
}
break;
default:
$this->attributes['IS_INSTALLED'] = true;
break;
} # end switch
} # end function
/**
* This function evaluates the default serrings into defined constants
* @author Bobby Easland
* @version 1.0
*/
function eval_defaults(){
foreach( $this->default_config as $key => $value ){
define($key, $value['DEFAULT']);
} # end foreach
} # end function
/**
* This function removes the database settings (configuration and cache)
* @author Bobby Easland
* @version 1.0
*/
function uninstall_settings(){
$this->DB->Query("DELETE FROM `".TABLE_CONFIGURATION_GROUP."` WHERE `configuration_group_title` LIKE '%SEO%'");
$this->DB->Query("DELETE FROM `".TABLE_CONFIGURATION."` WHERE `configuration_key` LIKE '%SEO%'");
$this->DB->Query("DROP TABLE IF EXISTS `cache`");
} # end function
/**
* This function installs the database settings
* @author Bobby Easland
* @version 1.0
*/
function install_settings(){
$this->uninstall_settings();
$sort_order_query = "SELECT MAX(sort_order) as max_sort FROM `".TABLE_CONFIGURATION_GROUP."`";
$sort = $this->DB->FetchArray( $this->DB->Query($sort_order_query) );
$next_sort = $sort['max_sort'] + 1;
$insert_group = "INSERT INTO `".TABLE_CONFIGURATION_GROUP."` VALUES ('', 'SEO URLs', 'Options for Ultimate SEO URLs by Chemo', '".$next_sort."', '1')";
$this->DB->Query($insert_group);
$group_id = $this->DB->InsertID();
foreach ($this->default_config as $key => $value){
$sql = str_replace('GROUP_INSERT_ID', $group_id, $value['QUERY']);
$this->DB->Query($sql);
}
$insert_cache_table = "CREATE TABLE `cache` (
`cache_id` varchar(32) NOT NULL default '',
`cache_language_id` tinyint(1) NOT NULL default '0',
`cache_name` varchar(255) NOT NULL default '',
`cache_data` mediumtext NOT NULL,
`cache_global` tinyint(1) NOT NULL default '1',
`cache_gzip` tinyint(1) NOT NULL default '1',
`cache_method` varchar(20) NOT NULL default 'RETURN',
`cache_date` datetime NOT NULL default '0000-00-00 00:00:00',
`cache_expires` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`cache_id`,`cache_language_id`),
KEY `cache_id` (`cache_id`),
KEY `cache_language_id` (`cache_language_id`),
KEY `cache_global` (`cache_global`)
) TYPE=MyISAM;";
$this->DB->Query($insert_cache_table);
} # end function
} # end class
/**
* Ultimate SEO URLs Base Class
*
* Ultimate SEO URLs offers search engine optimized URLS for osCommerce
* based applications. Other features include optimized performance and
* automatic redirect script.
* @package Ultimate-SEO-URLs
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 2.1
* @link http://www.oscommerce-freelancers.com/ osCommerce-Freelancers
* @copyright Copyright 2005, Bobby Easland
* @author Bobby Easland
*/
class SEO_URL{
/**
* $cache is the per page data array that contains all of the previously stripped titles
* @var array
*/
var $cache;
/**
* $languages_id contains the language_id for this instance
* @var integer
*/
var $languages_id;
/**
* $attributes array contains all the required settings for class
* @var array
*/
var $attributes;
/**
* $base_url is the NONSSL URL for site
* @var string
*/
var $base_url;
/**
* $base_url_ssl is the secure URL for the site
* @var string
*/
var $base_url_ssl;
/**
* $performance array contains evaluation metric data
* @var array
*/
var $performance;
/**
* $timestamp simply holds the temp variable for time calculations
* @var float
*/
var $timestamp;
/**
* $reg_anchors holds the anchors used by the .htaccess rewrites
* @var array
*/
var $reg_anchors;
/**
* $cache_query is the resource_id used for database cache logic
* @var resource
*/
var $cache_query;
/**
* $cache_file is the basename of the cache database entry
* @var string
*/
var $cache_file;
/**
* $data array contains all records retrieved from database cache
* @var array
*/
var $data;
/**
* $need_redirect determines whether the URL needs to be redirected
* @var boolean
*/
var $need_redirect;
/**
* $is_seopage holds value as to whether page is in allowed SEO pages
* @var boolean
*/
var $is_seopage;
/**
* $uri contains the $_SERVER['REQUEST_URI'] value
* @var string
*/
var $uri;
/**
* $real_uri contains the $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'] value
* @var string
*/
var $real_uri;
/**
* $uri_parsed contains the parsed uri value array
* @var array
*/
var $uri_parsed;
/**
* $path_info contains the getenv('PATH_INFO') value
* @var string
*/
var $path_info;
/**
* $DB is the database object
* @var object
*/
var $DB;
/**
* $installer is the installer object
* @var object
*/
var $installer;
/**
* SEO_URL class constructor
* @author Bobby Easland
* @version 1.1
* @param integer $languages_id
*/
function SEO_URL($languages_id){
global $session_started, $SID;
$this->installer = new SEO_URL_INSTALLER;
$this->DB = new SEO_DataBase(DB_SERVER, DB_SERVER_USERNAME, DB_DATABASE, DB_SERVER_PASSWORD);
$this->languages_id = (int)$languages_id;
$this->data = array();
$seo_pages = array(FILENAME_DEFAULT,
FILENAME_PRODUCT_INFO,
FILENAME_POPUP_IMAGE,
FILENAME_PRODUCT_REVIEWS,
FILENAME_PRODUCT_REVIEWS_INFO);
if ( defined('FILENAME_ARTICLES') ) $seo_pages[] = FILENAME_ARTICLES;
if ( defined('FILENAME_ARTICLE_INFO') ) $seo_pages[] = FILENAME_ARTICLE_INFO;
if ( defined('FILENAME_INFORMATION') ) $seo_pages[] = FILENAME_INFORMATION;
$this->attributes = array('PHP_VERSION' => PHP_VERSION,
'SESSION_STARTED' => $session_started,
'SID' => $SID,
'SEO_ENABLED' => defined('SEO_ENABLED') ? SEO_ENABLED : 'false',
'SEO_ADD_CPATH_TO_PRODUCT_URLS' => defined('SEO_ADD_CPATH_TO_PRODUCT_URLS') ? SEO_ADD_CPATH_TO_PRODUCT_URLS : 'false',
'SEO_ADD_CAT_PARENT' => defined('SEO_ADD_CAT_PARENT') ? SEO_ADD_CAT_PARENT : 'true',
'USE_SEO_CACHE_GLOBAL' => defined('USE_SEO_CACHE_GLOBAL') ? USE_SEO_CACHE_GLOBAL : 'false',
'USE_SEO_CACHE_PRODUCTS' => defined('USE_SEO_CACHE_PRODUCTS') ? USE_SEO_CACHE_PRODUCTS : 'false',
'USE_SEO_CACHE_CATEGORIES' => defined('USE_SEO_CACHE_CATEGORIES') ? USE_SEO_CACHE_CATEGORIES : 'false',
'USE_SEO_CACHE_MANUFACTURERS' => defined('USE_SEO_CACHE_MANUFACTURERS') ? USE_SEO_CACHE_MANUFACTURERS : 'false',
'USE_SEO_CACHE_ARTICLES' => defined('USE_SEO_CACHE_ARTICLES') ? USE_SEO_CACHE_ARTICLES : 'false',
'USE_SEO_CACHE_TOPICS' => defined('USE_SEO_CACHE_TOPICS') ? USE_SEO_CACHE_TOPICS : 'false',
'USE_SEO_CACHE_INFO_PAGES' => defined('USE_SEO_CACHE_INFO_PAGES') ? USE_SEO_CACHE_INFO_PAGES : 'false',
'USE_SEO_REDIRECT' => defined('USE_SEO_REDIRECT') ? USE_SEO_REDIRECT : 'false',
'SEO_REWRITE_TYPE' => defined('SEO_REWRITE_TYPE') ? SEO_REWRITE_TYPE : 'false',
'SEO_URLS_FILTER_SHORT_WORDS' => defined('SEO_URLS_FILTER_SHORT_WORDS') ? SEO_URLS_FILTER_SHORT_WORDS : 'false',
'SEO_CHAR_CONVERT_SET' => defined('SEO_CHAR_CONVERT_SET') ? $this->expand(SEO_CHAR_CONVERT_SET) : 'false',
'SEO_REMOVE_ALL_SPEC_CHARS' => defined('SEO_REMOVE_ALL_SPEC_CHARS') ? SEO_REMOVE_ALL_SPEC_CHARS : 'false',
'SEO_PAGES' => $seo_pages,
'SEO_INSTALLER' => $this->installer->attributes
);
$this->base_url = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
$this->base_url_ssl = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
$this->cache = array();
$this->timestamp = 0;
$this->reg_anchors = array('products_id' => '-p-',
'cPath' => '-c-',
'manufacturers_id' => '-m-',
'pID' => '-pi-',
'tPath' => '-t-',
'articles_id' => '-a-',
'products_id_review' => '-pr-',
'products_id_review_info' => '-pri-',
'info_id' => '-i-'
);
$this->performance = array('NUMBER_URLS_GENERATED' => 0,
'NUMBER_QUERIES' => 0,
'CACHE_QUERY_SAVINGS' => 0,
'NUMBER_STANDARD_URLS_GENERATED' => 0,
'TOTAL_CACHED_PER_PAGE_RECORDS' => 0,
'TOTAL_TIME' => 0,
'TIME_PER_URL' => 0,
'QUERIES' => array()
);
if ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true'){
$this->cache_file = 'seo_urls_v2_';
$this->cache_gc();
if ( $this->attributes['USE_SEO_CACHE_PRODUCTS'] == 'true' ) $this->generate_products_cache();
if ( $this->attributes['USE_SEO_CACHE_CATEGORIES'] == 'true' ) $this->generate_categories_cache();
if ( $this->attributes['USE_SEO_CACHE_MANUFACTURERS'] == 'true' ) $this->generate_manufacturers_cache();
if ( $this->attributes['USE_SEO_CACHE_ARTICLES'] == 'true' && defined('TABLE_ARTICLES_DESCRIPTION')) $this->generate_articles_cache();
if ( $this->attributes['USE_SEO_CACHE_TOPICS'] == 'true' && defined('TABLE_TOPICS_DESCRIPTION')) $this->generate_topics_cache();
if ( $this->attributes['USE_SEO_CACHE_INFO_PAGES'] == 'true' && defined('TABLE_INFORMATION')) $this->generate_information_cache();
} # end if
if ($this->attributes['USE_SEO_REDIRECT'] == 'true'){
$this->check_redirect();
} # end if
} # end constructor
/**
* Function to return SEO URL link SEO'd with stock generattion for error fallback
* @author Bobby Easland
* @version 1.0
* @param string $page Base script for URL
* @param string $parameters URL parameters
* @param string $connection NONSSL/SSL
* @param boolean $add_session_id Switch to add osCsid
* @return string Formed href link
*/
function href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true){
$this->start($this->timestamp);
$this->performance['NUMBER_URLS_GENERATED']++;
if ( !in_array($page, $this->attributes['SEO_PAGES']) || $this->attributes['SEO_ENABLED'] == 'false' ) {
return $this->stock_href_link($page, $parameters, $connection, $add_session_id);
}
$link = $connection == 'NONSSL' ? $this->base_url : $this->base_url_ssl;
$separator = '?';
if ($this->not_null($parameters)) {
$link .= $this->parse_parameters($page, $parameters, $separator);
} else {
$link .= $page;
}
$link = $this->add_sid($link, $add_session_id, $connection, $separator);
$this->stop($this->timestamp, $time);
$this->performance['TOTAL_TIME'] += $time;
#return htmlspecialchars(utf8_encode($link));
#PR Do not need this for algozone
return utf8_encode($link);
} # end function
/**
* Stock function, fallback use
*/
function stock_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
global $request_type, $session_started, $SID;
if (!$this->not_null($page)) {
die('