[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 init_canonical.php

Zen Cart 源代码 init_canonical.php




下载文件

文件名: init_canonical.php
文件类型: PHP文件
文件大小: 3.48 KiB
MD5: df1653efb7da39bd0f2a6c4a920d685b

init_canonical.php - 关闭高亮
  1. <?php
  2. /**
  3.  * canonical link handling
  4.  *
  5.  * @package initSystem
  6.  * @copyright Copyright 2003-2013 Zen Cart Development Team
  7.  * @copyright Portions Copyright 2003 osCommerce
  8.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  9.  * @version GIT: $Id: Author: DrByte  Sun Feb 17 22:58:47 2013 -0500 Modified in v1.5.2 $
  10.  */
  11. if (!defined('IS_ADMIN_FLAG')) {
  12.   die('Illegal Access');
  13. }
  14.  
  15. // cPath is excluded by default
  16. $includeCPath = FALSE;
  17.  
  18. // EXCLUDE certain parameters which should not be included in canonical links:
  19. $excludeParams = array('zenid', 'action', 'main_page', 'currency', 'typefilter', 'gclid', 'search_in_description', 'pto', 'pfrom', 'dto', 'dfrom', 'inc_subcat', 'notify');
  20. $excludeParams[] = 'disp_order';
  21. $excludeParams[] = 'page';
  22. $excludeParams[] = 'sort';
  23. $excludeParams[] = 'alpha_filter_id';
  24. $excludeParams[] = 'filter_id';
  25. $excludeParams[] = 'utm_source';
  26. $excludeParams[] = 'utm_medium';
  27. $excludeParams[] = 'utm_content';
  28. $excludeParams[] = 'utm_campaign';
  29. $excludeParams[] = 'language';
  30.  
  31. $canonicalLink = '';
  32. switch (TRUE) {
  33. /**
  34.  * SSL Pages get no special treatment, since they're not normally indexed (unless the entire site is intentionally set to always be SSL, which is not typical)
  35.  */
  36.   case ($request_type == 'SSL' && substr(HTTP_SERVER, 0, 5) != 'https'):
  37.     $canonicalLink = '';
  38.     break;
  39. /**
  40.  * for products (esp those linked to multiple categories):
  41.  */
  42.   case (strstr($current_page, '_info') && isset($_GET['products_id'])):
  43.     $canonicalLink = zen_href_link($current_page, ($includeCPath ? 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($_GET['products_id'])) . '&' : '') . 'products_id=' . $_GET['products_id'], 'NONSSL', false);
  44.     break;
  45. /**
  46.  * for product listings:
  47.  */
  48.   case ($current_page == 'index' && isset($_GET['cPath'])):
  49.     $canonicalLink = zen_href_link($current_page, zen_get_all_get_params($excludeParams), 'NONSSL', false);
  50.     break;
  51. /**
  52.  * for music products:
  53.  */
  54.   case ($current_page == 'index' && isset($_GET['typefilter']) && $_GET['typefilter'] != '' && ( (isset($_GET['music_genre_id']) && $_GET['music_genre_id'] != '' ) || (isset($_GET['record_company_id']) && $_GET['record_company_id'] != '' ) ) ):
  55.     unset($excludeParams[array_search('typefilter', $excludeParams)]);
  56.     $canonicalLink = zen_href_link($current_page, zen_get_all_get_params($excludeParams), 'NONSSL', false);
  57.     break;
  58. /**
  59.  * home page
  60.  */
  61.   case ($this_is_home_page):
  62.     $canonicalLink = preg_replace('/(index.php)(\?)(main_page=)(index)$/', '', zen_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));
  63.     break;
  64. /**
  65.  * for new/special/featured listings:
  66.  */
  67.   case (in_array($current_page, array('featured_products', 'specials', 'products_new'))):
  68. /**
  69.  * for products_all:
  70.  */
  71.   case ($current_page == 'products_all'):
  72. /**
  73.  * for manufacturer listings:
  74.  */
  75.   case ($current_page == 'index' && isset($_GET['manufacturers_id'])):
  76. /**
  77.  * for ez-pages:
  78.  */
  79.   case ($current_page == 'page' && isset($_GET['id'])):
  80. /**
  81.  * all the above cases get treated here:
  82.  */
  83.     $canonicalLink = zen_href_link($current_page, zen_get_all_get_params($excludeParams), 'NONSSL', false);
  84.     break;
  85. /**
  86.  * All others
  87.  * uncomment the $canonicalLink = ''; line if you want no special handling for other pages
  88.  */
  89.   default:
  90.     $canonicalLink = zen_href_link($current_page, zen_get_all_get_params($excludeParams), 'NONSSL', false);
  91.     //$canonicalLink = '';
  92. }
  93. unset($excludeParams, $includeCPath);
  94.