common.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 小虎哥 <1105415366@qq.com>
  11. * Date: 2018-4-3
  12. */
  13. // 模板错误提示
  14. switch_exception();
  15. if (!function_exists('set_home_url_mode'))
  16. {
  17. // 设置前台URL模式
  18. function set_home_url_mode() {
  19. $uiset = I('param.uiset/s', 'off');
  20. $uiset = trim($uiset, '/');
  21. $seo_pseudo = tpCache('seo.seo_pseudo');
  22. if ($seo_pseudo == 1 || $uiset == 'on') {
  23. config('url_common_param', true);
  24. config('url_route_on', false);
  25. } elseif ($seo_pseudo == 2 && $uiset != 'on') {
  26. config('url_common_param', false);
  27. config('url_route_on', true);
  28. } elseif ($seo_pseudo == 3 && $uiset != 'on') {
  29. config('url_common_param', false);
  30. config('url_route_on', true);
  31. }
  32. }
  33. }
  34. if (!function_exists('set_arcseotitle'))
  35. {
  36. /**
  37. * 设置内容标题
  38. */
  39. function set_arcseotitle($title = '', $seo_title = '', $typename = '')
  40. {
  41. /*针对没有自定义SEO标题的文档*/
  42. if (empty($seo_title)) {
  43. static $web_name = null;
  44. null === $web_name && $web_name = tpCache('web.web_name');
  45. static $seo_viewtitle_format = null;
  46. null === $seo_viewtitle_format && $seo_viewtitle_format = tpCache('seo.seo_viewtitle_format');
  47. switch ($seo_viewtitle_format) {
  48. case '1':
  49. $seo_title = $title;
  50. break;
  51. case '3':
  52. $seo_title = $title.'_'.$typename.'_'.$web_name;
  53. break;
  54. case '2':
  55. default:
  56. $seo_title = $title.'_'.$web_name;
  57. break;
  58. }
  59. }
  60. /*--end*/
  61. return $seo_title;
  62. }
  63. }
  64. if (!function_exists('set_typeseotitle'))
  65. {
  66. /**
  67. * 设置栏目标题
  68. */
  69. function set_typeseotitle($typename = '', $seo_title = '')
  70. {
  71. /*针对没有自定义SEO标题的列表*/
  72. if (empty($seo_title)) {
  73. $web_name = tpCache('web.web_name');
  74. $seo_liststitle_format = tpCache('seo.seo_liststitle_format');
  75. switch ($seo_liststitle_format) {
  76. case '1':
  77. $seo_title = $typename.'_'.$web_name;
  78. break;
  79. case '2':
  80. default:
  81. $page = I('param.page/d', 1);
  82. if ($page > 1) {
  83. $typename .= "_第{$page}页";
  84. }
  85. $seo_title = $typename.'_'.$web_name;
  86. break;
  87. }
  88. }
  89. return $seo_title;
  90. }
  91. }