ERROR

Calling static trait method SEO\XMLConverter::arrayToXMLConverter is deprecated, it should only be called on a class using the trait

/var/www/vendas.gazinsemijoias.com.br/Modules/Classes/SEO/Sitemap.php 159

1
<?php
2
/**
3* Funções de Sitemap
4*
5* @package SEO
6* @author Lucas/Postali
7*/
8
9
namespace SEO;
10
11use
Navigation\Navigation;
12
13class
Sitemap extends \Core
14
{
15
/**
16 * @var Valores permitidos para o parâmetro "changefreq"
17 **/
18
const ALLOWED_CHANGEFREQ = ['always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'];
19
20
/**
21 * Exibe o conteúdo do sitemap.xml
22 *
23 * @return string
24 **/
25
public function show ()
26 {
27
//Iniciar a captura de dados
28
ob_start();
29
30
//Conjunto de URLS
31
$urlset = [];
32
33
//Para cada página declarada
34
foreach ($this->_config('page') as $key => $page)
35 {
36
$sitemap = isset($page['sitemap']) ? $page['sitemap'] : [];
37
38
//Se o sitemap for false, ignorar
39
if($sitemap === false)
40 continue;
41
42
//Se não há um caminho estático e não há um caminho definido em SEO => loc, ignorar
43
if( !isset($page['static']) && !isset($sitemap['loc']) && !isset($page['pattern']))
44 continue;
45
46 if( isset(
$page['pattern']) && !isset($sitemap['locVariablesSource']) )
47 continue;
48
49
//Se for uma página de redirecionamento e não houver sitemap declarado, ignorar
50
if(isset($page['redirect']) && (!$sitemap || empty($sitemap)))
51 continue;
52
53
//Iniciar valores desse conjunto
54
$url = [];
55
56 if(isset(
$page['pattern']) && isset($sitemap['locVariablesSource']))
57 {
58 if(isset(
$sitemap['locVariablesSource']) && is_string($sitemap['locVariablesSource']))
59
$locVariablesSources = $this->parseMethod($sitemap['locVariablesSource'], true);
60 else
61
$locVariablesSources = $sitemap['locVariablesSource'];
62 }
63
64
//Se houver um changefreq definido e ele for válido, incluí-lo
65
if(isset($sitemap['changefreq']) && in_array($sitemap['changefreq'], self::ALLOWED_CHANGEFREQ))
66
$url['changefreq'] = $sitemap['changefreq'];
67
68
//Se houver um lastmod definido
69
if(isset($sitemap['lastmod']))
70
71
//Se for true, gerar automaticamente
72
if($sitemap['lastmod'] === true)
73
$url['lastmod'] = date('Y-m-d', filemtime($this->getPath('View/'.$page['file'])));
74
75
//Senão, incluir o valor declarado
76
else
77
$url['lastmod'] = $sitemap['lastmod'];
78
79
//Se houver um priority e ele for válido, incluí-lo
80
if(isset($sitemap['priority']) &&
81
is_numeric($sitemap['priority']) && $sitemap['priority'] >= 0 && $sitemap['priority'] <= 1)
82
$url['priority'] = $sitemap['priority'];
83
84
//Se houver uma localização definida, incluir
85
if($sitemap && isset($sitemap['loc']))
86 {
87
//Se for solicitado parsear o parâmtro LOC
88
if(isset($sitemap['locParse']) && $sitemap['locParse'] === true)
89
$url['loc'] = $this->getURL() . "/" . $sitemap['loc'];
90
91
//Senão, incluí-lo normalmente
92
else
93
$url['loc'] = $sitemap['loc'];
94 }
95
96
//Se houver pattern
97
else if(isset($page['pattern']) && $locVariablesSources)
98 {
99
//Se há vários valores dentro do array, incluir várias páginas
100
if( isset($locVariablesSources[0]) && is_array($locVariablesSources[0]) )
101 {
102
//Para cada um desses arrays
103
foreach ($locVariablesSources as $locVar)
104 {
105
//Se houver parâmetros adicionais de sitemap
106
if(isset($locVar['sitemap']))
107 {
108
$params = $locVar['sitemap'];
109
110
//Se houver um lastmod definido
111
if(isset($params['lastmod']))
112
$url['lastmod'] = $params['lastmod'];
113
114
//Se houver um changefreq definido
115
if(isset($params['changefreq']) && in_array($params['changefreq'], self::ALLOWED_CHANGEFREQ))
116
$url['changefreq'] = $params['changefreq'];
117
118
//Se houver um priority definido
119
if(isset($params['priority']) &&
120
is_numeric($params['priority']) && $params['priority'] >= 0 && $params['priority'] <= 1)
121
$url['priority'] = $params['priority'];
122
123
$locVar = $locVar['variables'];
124 }
125
$url['loc'] = $this->getRouteURL($key, $locVar);
126
$urlset[] = ['url' => $url ];
127 }
128 continue;
129 }
130
131
//Se é um array comum apenas com os valores, retornar
132
$url['loc'] = $this->getRouteURL($key, $locVariablesSources);
133 }
134
//Senão, receber o link da página estática
135
else
136 {
137
$url['loc'] = $this->getRouteURL($key);
138 }
139
140
$urlset[] = ['url' => $url ];
141 }
142
143
//Montar XML
144
$urlset = [
145
'urlset' => $urlset,
146
'_params' =>
147 [
'attribute_ns' =>
148 [
149
'schemaLocation' => ['prefix' => 'xsi', 'value' => "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd", 'uri' => "http://www.w3.org/2001/XMLSchema-instance"],
150 ],
151
'attribute' =>
152 [
153
'xmlns' => "http://www.sitemaps.org/schemas/sitemap/0.9"
154
]
155 ]
156 ];
157
158
//Parsear XML
159 $xml = XMLConverter::arrayToXMLConverter($urlset);

160
161
//Limpar saída de dados
162
ob_end_clean();
163
164
//Retornar conteúdo do XML
165
return $xml;
166 }
167}

Error trace

You can see detailed error trace in the console.

System trace

You can see detailed error trace in the console.