public function process() { // filename less the .php $short_filename = substr(KissMT::init()->retrieve('basename'), 0, strlen(KissMT::init()->retrieve('basename')) - 4); if (defined('HEADING_TITLE')) { $file_title = trim(HEADING_TITLE); if (false !== strpos(HEADING_TITLE, '%s')) { $file_title = trim(str_replace('%s', '', HEADING_TITLE)); } } else { $file_title = ucfirst(strtolower(str_replace('_', ' ', $short_filename))); } /** * Do we have a languages define for this page? */ $poss_title_define = 'KISSMT_' . strtoupper($short_filename) . '_TITLE_TEXT'; $poss_description_define = 'KISSMT_' . strtoupper($short_filename) . '_DESCRIPTION_TEXT'; // If we have language defines for this page then we use these if (defined($poss_title_define) && defined($poss_description_define)) { $leading_value = sprintf(constant($poss_title_define), $file_title . '[-separator-]'); $description = constant($poss_description_define); // No language defines so we use what the script found .. either HEADING_TITLE or the filename } else { $leading_value = $file_title; $description = false; } KissMT::init()->setCanonical($this->checkCanonical()); $this->parse(KissMT::init()->entities($leading_value, $decode = true), KissMT::init()->entities($description, $decode = true)); }
public function process() { $this->get_value = ''; $this->original_get = ''; $this->cache_name = $this->setCacheString(__FILE__, 'listing', 'general'); if (false !== $this->retrieve($this->cache_name)) { KissMT::init()->setCanonical($this->checkCanonical()); return; } $query_replacements = array(':languages_id' => (int) KissMT::init()->retrieve('languages_id')); $query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->reviews_query); $result = KissMT::init()->query($query); $list_array = array(); while ($reviews_products_results = tep_db_fetch_array($result)) { if (tep_not_null($reviews_products_results['products_name'])) { $list_array[] = trim($reviews_products_results['products_name']); } } $list_string = implode('[-separator-]', $this->removeArrayDuplicates($list_array)); tep_db_free_result($result); $list_string = tep_not_null($list_string) ? $list_string : false; $leading_values = implode('[-separator-]', KissMT::init()->retrieve('breadcrumb')); KissMT::init()->setCanonical($this->checkCanonical()); $this->parse(KissMT::init()->entities(sprintf(KISSMT_REVIEWS_TEXT, $leading_values), $decode = true), KissMT::init()->entities($list_string, $decode = true)); }
public function process() { $this->get_value = $this->parsePath($_GET['articles_id']); $this->original_get = (int) $_GET['articles_id']; $this->cache_name = $this->setCacheString(__FILE__, 'article_info', $this->original_get); if (false !== $this->retrieve($this->cache_name)) { KissMT::init()->setCanonical($this->checkCanonical('articles_id')); return; } $query_replacements = array(':articles_id' => (int) $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id')); $query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->article_query); $result = KissMT::init()->query($query); $article_details = tep_db_fetch_array($result); tep_db_free_result($result); $name = trim($article_details['name']); $description = trim($article_details['description']); $breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb')); if (array_key_exists($name, $breadcrumb)) { unset($breadcrumb[$name]); } $breadcrumb = array_flip($breadcrumb); $leading_values = $name . (!empty($breadcrumb) ? '[-separator-]' . implode('[-separator-]', $breadcrumb) : ''); KissMT::init()->setCanonical($this->checkCanonical('articles_id')); $this->parse(KissMT::init()->entities($leading_values, $decode = true), KissMT::init()->entities($description, $decode = true)); }
/** * Obtain a singleton instance of the class */ public static function init() { if (is_null(self::$_singleton)) { return self::$_singleton = new self(); } else { return self::$_singleton; } }
public function process() { $this->get_value = $this->parsePath($_GET['products_id']); $this->original_get = (int) $_GET['products_id']; $this->cache_name = $this->setCacheString(__FILE__, 'reviews_id', $this->original_get); if (false !== $this->retrieve($this->cache_name)) { $reviews_string = isset($_GET['reviews_id']) && is_numeric($_GET['reviews_id']) ? '&reviews_id=' . $_GET['reviews_id'] : ''; KissMT::init()->setCanonical($this->checkCanonical('products_id', $reviews_string)); return; } $query_replacements = array(':products_id' => (int) $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id')); $query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->products_query); $result = KissMT::init()->query($query); $reviews_text = ''; $products_model = ''; $products_name = ''; $manufacturers_name = ''; while ($product_results = tep_db_fetch_array($result)) { if (tep_not_null($product_results['products_model'])) { $products_model = trim($product_results['products_model']); } if (tep_not_null($product_results['products_name'])) { $products_name = trim($product_results['products_name']); } if (tep_not_null($product_results['manufacturers_name'])) { $manufacturers_name = trim($product_results['manufacturers_name']); } if (tep_not_null($product_results['reviews_text'])) { $reviews_text .= trim(rtrim($product_results['reviews_text'], '.') . '.') . '[-separator-]'; } } tep_db_free_result($result); $breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb')); if (array_key_exists($products_model, $breadcrumb)) { unset($breadcrumb[$products_model]); } if (array_key_exists($products_name, $breadcrumb)) { unset($breadcrumb[$products_name]); } if (array_key_exists(NAVBAR_TITLE, $breadcrumb)) { unset($breadcrumb[NAVBAR_TITLE]); } $breadcrumb = array_flip($breadcrumb); $leading_values = $products_name; if (tep_not_null($products_model)) { $leading_values .= '[-separator-]' . $products_model; } $leading_values .= '[-separator-]' . implode('[-separator-]', $breadcrumb); if (tep_not_null($manufacturers_name)) { $leading_values .= '[-separator-]' . sprintf(KISSMT_BRAND_TEXT, $manufacturers_name); } $reviews_string = isset($_GET['reviews_id']) && is_numeric($_GET['reviews_id']) ? '&reviews_id=' . $_GET['reviews_id'] : ''; KissMT::init()->setCanonical($this->checkCanonical('products_id', $reviews_string)); $this->parse(KissMT::init()->entities(sprintf(KISSMT_PRODUCT_REVIEWS_TEXT, $leading_values), $decode = true), KissMT::init()->entities($reviews_text, $decode = true)); }
public function process() { // Do we have a reviews_id if (array_key_exists('reviews_id', $_GET) && tep_not_null($_GET['reviews_id'])) { $this->get_value = $this->parsePath($_GET['reviews_id']); $this->original_get = (int) $_GET['reviews_id']; $this->cache_name = $this->setCacheString(__FILE__, 'ndesk_rev_info', $this->original_get); if (false !== $this->retrieve($this->cache_name)) { KissMT::init()->setCanonical($this->checkCanonical('newsPath')); return; } $query_replacements = array(':reviews_id' => (int) $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id')); $query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->query); $result = KissMT::init()->query($query); $description = ''; $name = ''; $details = tep_db_fetch_array($result); $name = trim($details['name']); $description .= trim($details['description']); $newsdesk_name = trim($details['newsdesk_name']); tep_db_free_result($result); $description = isset($description) && tep_not_null($description) ? $description : false; $name = isset($name) && tep_not_null($name) ? $name : ''; $newsdesk_name = isset($newsdesk_name) && tep_not_null($newsdesk_name) ? $newsdesk_name : ''; $breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb')); if (array_key_exists($name, $breadcrumb)) { unset($breadcrumb[$name]); } if (tep_not_null($breadcrumb)) { // Is there still something in the breadcrumb array? $breadcrumb = array_flip($breadcrumb); $leading_values = implode('[-separator-]', $breadcrumb) . (tep_not_null($newsdesk_name) ? '[-separator-]' . $newsdesk_name : '') . (tep_not_null($name) ? '[-separator-]' . $name : ''); } else { // Nothing in the breadcrumb array $leading_values = (tep_not_null($newsdesk_name) ? '[-separator-]' . $newsdesk_name : '') . (tep_not_null($name) ? $name : HEADING_TITLE); } } else { // No reviews_id so we'll work with what we have $leading_values = implode('[-separator-]', KissMT::init()->retrieve('breadcrumb')); $description = false; } KissMT::init()->setCanonical($this->checkCanonical('reviews_id')); $this->parse(KissMT::init()->entities($leading_values, $decode = true), KissMT::init()->entities(trim($description), $decode = true)); }
private function descriptionsExtension($type = false) { if (false === (defined('KISSMT_DESCRIPTIONS_EXTENSION_ENABLE') && KISSMT_DESCRIPTIONS_EXTENSION_ENABLE == 'true')) { return false; } if ($type == 'category') { $query = "SELECT kissmt_categories_description FROM " . TABLE_CATEGORIES_DESCRIPTION . " WHERE categories_id = " . (int) $this->get_value . " AND language_id = " . (int) KissMT::init()->retrieve('languages_id') . ""; $result = tep_db_query($query); $row = tep_db_fetch_array($result); tep_db_free_result($result); if (false !== (false !== $row && tep_not_null($row['kissmt_categories_description']))) { $this->descriptions_extension = true; $this->description = array('kissmt_categories_description' => $row['kissmt_categories_description']); return; } } elseif ($type == 'manufacturer') { $query = "SELECT m.manufacturers_name, mi.kissmt_manufacturers_description FROM " . TABLE_MANUFACTURERS . " m INNER JOIN " . TABLE_MANUFACTURERS_INFO . " mi ON mi.manufacturers_id = m.manufacturers_id AND mi.languages_id = " . (int) KissMT::init()->retrieve('languages_id') . " WHERE m.manufacturers_id = " . (int) $this->get_value . ""; $result = tep_db_query($query); $row = tep_db_fetch_array($result); tep_db_free_result($result); if (false !== (false !== $row && tep_not_null($row['kissmt_manufacturers_description']))) { $this->descriptions_extension = true; $this->description = array('manufacturers_name' => $row['manufacturers_name'], 'kissmt_manufacturers_description' => $row['kissmt_manufacturers_description']); return; } } $this->descriptions_extension = false; $this->description = false; }
<?php /** * * KISS Dynamic SEO Meta Tags * KISS = (Keep It Simple Stupid!) * * @package KISS Meta Tags SEO v1.0 * @license http://www.opensource.org/licenses/gpl-2.0.php GNU Public License * @link http://www.fwrmedia.co.uk * @copyright Copyright 2008-2009 FWR Media * @author Robert Fisher, FWR Media, http://www.fwrmedia.co.uk * @lastdev $Author:: Rob $: Author of last commit * @lastmod $Date:: 2009-12-16 12:10:29 +0000 (Wed, 16 Dec 2009) $: Date of last commit * @version $Rev:: 10 $: Revision of last commit * @Id $Id:: kiss_meta_tags.php 10 2009-12-16 12:10:29Z Rob $: Full Details */ include_once DIR_WS_MODULES . 'kiss_meta_tags/classes/kiss_meta_tags_class.php'; /** * Set the language - load the language specific stopwords - set everything up */ KissMT::init()->setup($language, $languages_id, $breadcrumb, $request_type); /** * Output the meta html */ KissMT::init()->output();
public function process() { $this->cache_name = false; if (array_key_exists('tPath', $_GET)) { $this->get_value = $this->parsePath($_GET['tPath']); $this->original_get = is_numeric(str_replace('_', '', $_GET['tPath'])) ? $_GET['tPath'] : '1'; $this->cache_name = $this->setCacheString(__FILE__, 'articles_topic', $this->original_get); $get_key = 'tPath'; $query = $this->topics_query; } elseif (array_key_exists('authors_id', $_GET)) { $this->get_value = $this->parsePath($_GET['authors_id']); $this->original_get = (int) $_GET['authors_id']; $this->cache_name = $this->setCacheString(__FILE__, 'articles_author', $this->original_get); $get_key = 'authors_id'; $query = $this->authors_query; } else { $this->get_value = false; $this->original_get = false; $this->cache_name = $this->setCacheString(__FILE__, 'articles_all', 'general'); $get_key = false; $query = $this->all_topics_query; } if (false !== ($this->cache_name && $this->retrieve($this->cache_name))) { KissMT::init()->setCanonical($this->checkCanonical($get_key)); return; } if (false === $this->get_value) { $query_replacements = array(':languages_id' => (int) KissMT::init()->retrieve('languages_id')); $query = str_replace(array_keys($query_replacements), array_values($query_replacements), $query); $result = KissMT::init()->query($query); $description = ''; while ($row = tep_db_fetch_array($result)) { if (tep_not_null($row['name'])) { $description .= trim($row['name']) . '[-separator-]'; } } $description = tep_not_null($description) ? $description : false; $name = defined('HEADING_TITLE') ? HEADING_TITLE : ucfirst(str_replace('_', ' ', substr(KissMT::init()->retrieve('basename'), 0, strlen(KissMT::init()->retrieve('basename')) - 4))); } else { $query_replacements = array(':' . $get_key => $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id')); $query = str_replace(array_keys($query_replacements), array_values($query_replacements), $query); $result = KissMT::init()->query($query); $detail = tep_db_fetch_array($result); $name = trim($detail['name']); $description = tep_not_null($detail['description']) ? trim($detail['description']) : false; } tep_db_free_result($result); $breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb')); if (array_key_exists($name, $breadcrumb)) { unset($breadcrumb[$name]); } if (array_key_exists($description, $breadcrumb)) { unset($breadcrumb[$description]); } $breadcrumb = array_flip($breadcrumb); $leading_values = $name . (!empty($breadcrumb) ? '[-separator-]' . implode('[-separator-]', $breadcrumb) : ''); KissMT::init()->setCanonical($this->checkCanonical($get_key)); $this->parse(KissMT::init()->entities($leading_values, $decode = true), KissMT::init()->entities($description, $decode = true)); }
public function gc() { if (KISSMT_CACHE_RESET !== 'reset') { return false; } foreach (glob(KissMT::init()->retrieve('cache_path') . "*.cache") as $filename) { @unlink($filename); } $query = "SELECT configuration_id FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'KISSMT_CACHE_RESET'"; $result = tep_db_query($query); $db_installed = tep_db_fetch_array($result); tep_db_free_result($result); if (false !== $db_installed) { $query = "UPDATE " . TABLE_CONFIGURATION . " SET configuration_value = 'false' WHERE configuration_key = 'KISSMT_CACHE_RESET'"; tep_db_query($query); } }