Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ramster cath
/
new_xado
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Рамиз Мирзаев
2024-08-23 17:21:46 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
83af7e9f7633ccc715adbbe94941ed30e50425d8
83af7e9f
1 parent
d39e4e2b
Add seo package
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
190 additions
and
59 deletions
strg/logs/error.log
upload/1x_adm/model/tool/seo_package.php
upload/catalog/controller/startup/seo_url.php
upload/catalog/controller/startup/seo_url.php_old
strg/logs/error.log
View file @
83af7e9
This diff could not be displayed because it is too large.
upload/1x_adm/model/tool/seo_package.php
View file @
83af7e9
...
...
@@ -846,6 +846,10 @@ class ModelToolSeoPackage extends Model {
$this
->
session
->
data
[
'kwCountArray'
][
$seo_kw
]
++
;
}
if
(
$number
==
''
)
{
$number
=
(
int
)
$number
;
}
$search_kw
=
$seo_kw
.
'-'
.
++
$number
;
}
/*
...
...
upload/catalog/controller/startup/seo_url.php
View file @
83af7e9
<?php
// * @source See SOURCE.txt for source and other copyright.
// * @license GNU General Public License version 3; see LICENSE.txt
class
ControllerStartupSeoUrl
extends
Controller
{
//seopro start
private
$seo_pro
;
public
function
__construct
(
$registry
)
{
parent
::
__construct
(
$registry
);
$this
->
seo_pro
=
new
SeoPro
(
$registry
);
}
//seopro end
public
function
index
()
{
// Add rewrite to url class
if
(
$this
->
config
->
get
(
'config_seo_url'
))
{
$this
->
url
->
addRewrite
(
$this
);
}
// Decode URL
if
(
isset
(
$this
->
request
->
get
[
'_route_'
]))
{
$parts
=
explode
(
'/'
,
$this
->
request
->
get
[
'_route_'
]);
//seopro prepare route
if
(
$this
->
config
->
get
(
'config_seo_pro'
)){
$parts
=
$this
->
seo_pro
->
prepareRoute
(
$parts
);
}
//seopro prepare route end
// remove any empty arrays from trailing
if
(
utf8_strlen
(
end
(
$parts
))
==
0
)
{
array_pop
(
$parts
);
...
...
@@ -65,9 +45,7 @@ class ControllerStartupSeoUrl extends Controller {
$this
->
request
->
get
[
'route'
]
=
$query
->
row
[
'query'
];
}
}
else
{
if
(
!
$this
->
config
->
get
(
'config_seo_pro'
)){
$this
->
request
->
get
[
'route'
]
=
'error/not_found'
;
}
break
;
}
...
...
@@ -85,38 +63,17 @@ class ControllerStartupSeoUrl extends Controller {
}
}
}
//seopro validate
if
(
$this
->
config
->
get
(
'config_seo_pro'
)){
$this
->
seo_pro
->
validate
();
}
//seopro validate
}
public
function
rewrite
(
$link
)
{
$url_info
=
parse_url
(
str_replace
(
'&'
,
'&'
,
$link
));
if
(
$this
->
config
->
get
(
'config_seo_pro'
)){
$url
=
null
;
}
else
{
$url
=
''
;
}
$data
=
array
();
parse_str
(
$url_info
[
'query'
],
$data
);
//seo_pro baseRewrite
if
(
$this
->
config
->
get
(
'config_seo_pro'
)){
list
(
$url
,
$data
,
$postfix
)
=
$this
->
seo_pro
->
baseRewrite
(
$data
,
(
int
)
$this
->
config
->
get
(
'config_language_id'
));
}
//seo_pro baseRewrite
foreach
(
$data
as
$key
=>
$value
)
{
if
(
isset
(
$data
[
'route'
]))
{
if
((
$data
[
'route'
]
==
'product/product'
&&
$key
==
'product_id'
)
||
((
$data
[
'route'
]
==
'product/manufacturer/info'
||
$data
[
'route'
]
==
'product/product'
)
&&
$key
==
'manufacturer_id'
)
||
(
$data
[
'route'
]
==
'information/information'
&&
$key
==
'information_id'
))
{
...
...
@@ -147,7 +104,7 @@ class ControllerStartupSeoUrl extends Controller {
}
}
//seo_pro add blank url
if
(
$url
)
{
unset
(
$data
[
'route'
]);
$query
=
''
;
...
...
@@ -162,21 +119,6 @@ class ControllerStartupSeoUrl extends Controller {
}
}
if
(
$this
->
config
->
get
(
'config_seo_pro'
))
{
$condition
=
(
$url
!==
null
);
}
else
{
$condition
=
$url
;
}
if
(
$condition
)
{
if
(
$this
->
config
->
get
(
'config_seo_pro'
)){
if
(
$this
->
config
->
get
(
'config_page_postfix'
)
&&
$postfix
)
{
$url
.=
$this
->
config
->
get
(
'config_page_postfix'
);
}
elseif
(
$this
->
config
->
get
(
'config_seopro_addslash'
)
||
!
empty
(
$query
))
{
$url
.=
'/'
;
}
}
return
$url_info
[
'scheme'
]
.
'://'
.
$url_info
[
'host'
]
.
(
isset
(
$url_info
[
'port'
])
?
':'
.
$url_info
[
'port'
]
:
''
)
.
str_replace
(
'/index.php'
,
''
,
$url_info
[
'path'
])
.
$url
.
$query
;
}
else
{
return
$link
;
...
...
upload/catalog/controller/startup/seo_url.php_old
0 → 100644
View file @
83af7e9
<?php
// * @source See SOURCE.txt for source and other copyright.
// * @license GNU General Public License version 3; see LICENSE.txt
class ControllerStartupSeoUrl extends Controller {
//seopro start
private $seo_pro;
public function __construct($registry) {
parent::__construct($registry);
$this->seo_pro = new SeoPro($registry);
}
//seopro end
public function index() {
// Add rewrite to url class
if ($this->config->get('config_seo_url')) {
$this->url->addRewrite($this);
}
// Decode URL
if (isset($this->request->get['_route_'])) {
$parts = explode('/', $this->request->get['_route_']);
//seopro prepare route
if($this->config->get('config_seo_pro')){
$parts = $this->seo_pro->prepareRoute($parts);
}
//seopro prepare route end
// remove any empty arrays from trailing
if (utf8_strlen(end($parts)) == 0) {
array_pop($parts);
}
foreach ($parts as $part) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE keyword = '" . $this->db->escape($part) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
if ($query->num_rows) {
$url = explode('=', $query->row['query']);
if ($url[0] == 'product_id') {
$this->request->get['product_id'] = $url[1];
}
if ($url[0] == 'category_id') {
if (!isset($this->request->get['path'])) {
$this->request->get['path'] = $url[1];
} else {
$this->request->get['path'] .= '_' . $url[1];
}
}
if ($url[0] == 'manufacturer_id') {
$this->request->get['manufacturer_id'] = $url[1];
}
if ($url[0] == 'information_id') {
$this->request->get['information_id'] = $url[1];
}
if ($query->row['query'] && $url[0] != 'information_id' && $url[0] != 'manufacturer_id' && $url[0] != 'category_id' && $url[0] != 'product_id') {
$this->request->get['route'] = $query->row['query'];
}
} else {
if(!$this->config->get('config_seo_pro')){
$this->request->get['route'] = 'error/not_found';
}
break;
}
}
if (!isset($this->request->get['route'])) {
if (isset($this->request->get['product_id'])) {
$this->request->get['route'] = 'product/product';
} elseif (isset($this->request->get['path'])) {
$this->request->get['route'] = 'product/category';
} elseif (isset($this->request->get['manufacturer_id'])) {
$this->request->get['route'] = 'product/manufacturer/info';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
}
}
}
//seopro validate
if($this->config->get('config_seo_pro')){
$this->seo_pro->validate();
}
//seopro validate
}
public function rewrite($link) {
$url_info = parse_url(str_replace('&', '&', $link));
if($this->config->get('config_seo_pro')){
$url = null;
} else {
$url = '';
}
$data = array();
parse_str($url_info['query'], $data);
//seo_pro baseRewrite
if($this->config->get('config_seo_pro')){
list($url, $data, $postfix) = $this->seo_pro->baseRewrite($data, (int)$this->config->get('config_language_id'));
}
//seo_pro baseRewrite
foreach ($data as $key => $value) {
if (isset($data['route'])) {
if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/info' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
if ($query->num_rows && $query->row['keyword']) {
$url .= '/' . $query->row['keyword'];
unset($data[$key]);
}
} elseif ($key == 'path') {
$categories = explode('_', $value);
foreach ($categories as $category) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = 'category_id=" . (int)$category . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
if ($query->num_rows && $query->row['keyword']) {
$url .= '/' . $query->row['keyword'];
} else {
$url = '';
break;
}
}
unset($data[$key]);
}
}
}
//seo_pro add blank url
unset($data['route']);
$query = '';
if ($data) {
foreach ($data as $key => $value) {
$query .= '&' . rawurlencode((string)$key) . '=' . rawurlencode((is_array($value) ? http_build_query($value) : (string)$value));
}
if ($query) {
$query = '?' . str_replace('&', '&', trim($query, '&'));
}
}
if($this->config->get('config_seo_pro')) {
$condition = ($url !== null);
} else {
$condition = $url;
}
if ($condition) {
if($this->config->get('config_seo_pro')){
if($this->config->get('config_page_postfix') && $postfix) {
$url .= $this->config->get('config_page_postfix');
} elseif($this->config->get('config_seopro_addslash') || !empty( $query)) {
$url .= '/';
}
}
return $url_info['scheme'] . '://' . $url_info['host'] . (isset($url_info['port']) ? ':' . $url_info['port'] : '') . str_replace('/index.php', '', $url_info['path']) . $url . $query;
} else {
return $link;
}
}
}
Please
register
or
login
to post a comment