1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use CMSFactory\Events; |
4
|
|
|
use CMSFactory\MetaManipulator\GalleryMetaManipulator; |
5
|
|
|
use CMSFactory\MetaManipulator\MetaManipulator; |
6
|
|
|
use CMSFactory\MetaManipulator\MetaStorage; |
7
|
|
|
use CMSFactory\MetaManipulator\PageCategoryMetaManipulator; |
8
|
|
|
use CMSFactory\MetaManipulator\PageMetaManipulator; |
9
|
|
|
use CMSFactory\MetaManipulator\ShopBrandMetaManipulator; |
10
|
|
|
use CMSFactory\MetaManipulator\ShopCategoryMetaManipulator; |
11
|
|
|
use CMSFactory\MetaManipulator\ShopProductMetaManipulator; |
12
|
|
|
|
13
|
|
|
(defined('BASEPATH')) OR exit('No direct script access allowed'); |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* |
17
|
|
|
* @property Seoexpert_model $seoexpert_model |
18
|
|
|
* @property Seoexpert_model_products $seoexpert_model_products |
19
|
|
|
* @author <[email protected]> |
20
|
|
|
* @copyright ImageCMS (c) 2014 |
21
|
|
|
*/ |
22
|
|
|
class Mod_seo extends MY_Controller |
23
|
|
|
{ |
|
|
|
|
24
|
|
|
|
25
|
|
|
public function __construct() { |
26
|
|
|
|
27
|
|
|
parent::__construct(); |
28
|
|
|
$this->load->model('seoexpert_model'); |
29
|
|
|
$this->load->model('seoexpert_model_products'); |
30
|
|
|
$this->load->helper('translit'); |
31
|
|
|
|
32
|
|
|
$lang = new MY_Lang(); |
33
|
|
|
$lang->load('mod_seo'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Build Meta for Shop Brand |
38
|
|
|
* @param array $arg |
39
|
|
|
* @return false|null |
40
|
|
|
*/ |
41
|
|
|
public static function _buildBrandMeta($arg) { |
42
|
|
|
|
43
|
|
|
$local = MY_Controller::getCurrentLocale(); |
44
|
|
|
/* @var $model SBrands */ |
45
|
|
|
$model = $arg['model']; |
46
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
47
|
|
|
|
48
|
|
|
CI::$APP->core->setLastModified($model->getUpdated()); |
49
|
|
|
|
50
|
|
|
if ($settings['useBrandPattern'] != 1) { |
51
|
|
|
return FALSE; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
View Code Duplication |
if ($settings['useBrandPatternForEmptyMeta'] == 1 && trim($model->getMetaTitle()) != '') { |
55
|
|
|
$templateTitle = trim($model->getMetaTitle()); |
56
|
|
|
} else { |
57
|
|
|
$templateTitle = $settings['brandTemplate']; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
View Code Duplication |
if ($settings['useBrandPatternForEmptyMeta'] == 1 && trim($model->getMetaDescription()) != '') { |
61
|
|
|
$templateDesc = trim($model->getMetaDescription()); |
62
|
|
|
} else { |
63
|
|
|
$templateDesc = $settings['brandTemplateDesc']; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
View Code Duplication |
if ($settings['useBrandPatternForEmptyMeta'] == 1 && trim($model->getMetaKeywords()) != '') { |
67
|
|
|
$templateKey = trim($model->getMetaKeywords()); |
68
|
|
|
} else { |
69
|
|
|
$templateKey = $settings['brandTemplateKey']; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
$metaStorage = new MetaStorage(); |
73
|
|
|
$metaStorage->setTitleTemplate($templateTitle); |
74
|
|
|
$metaStorage->setDescriptionTemplate($templateDesc); |
75
|
|
|
$metaStorage->setKeywordsTemplate($templateKey); |
76
|
|
|
|
77
|
|
|
$metaManipulator = new ShopBrandMetaManipulator($model, $metaStorage); |
78
|
|
|
$metaManipulator->setDescLength($settings['brandTemplateDescCount']); |
79
|
|
|
$metaManipulator->setPageNumber($settings['brandPaginationTemplate']); |
80
|
|
|
$meta = $metaManipulator->render(); |
81
|
|
|
|
82
|
|
|
// Set meta tags |
83
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param string $template |
88
|
|
|
* @param string $templateKey |
89
|
|
|
* @param string $templateDesc |
90
|
|
|
*/ |
91
|
|
|
private static function setMetaTags($template, $templateKey, $templateDesc) { |
92
|
|
|
|
93
|
|
|
CI::$APP->core->set_meta_tags($template, $templateKey, $templateDesc); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Build Meta for Shop Brands page |
98
|
|
|
* @return false|null |
99
|
|
|
*/ |
100
|
|
|
public static function _buildBrandsMeta() { |
101
|
|
|
|
102
|
|
|
$local = MY_Controller::getCurrentLocale(); |
103
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
104
|
|
|
|
105
|
|
|
if ($settings['useBrandsListPattern'] != 1) { |
106
|
|
|
return FALSE; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
// Set meta tags |
110
|
|
|
self::setMetaTags($settings['brandsListTemplate'], $settings['brandsListTemplateKey'], $settings['brandsListTemplateDesc']); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Build Meta for Shop Category |
115
|
|
|
* @param Category $categoryObj |
116
|
|
|
* @return false|null |
117
|
|
|
*/ |
118
|
|
|
public static function _buildCategoryMeta($categoryObj) { |
119
|
|
|
|
120
|
|
|
CI::$APP->load->helper('array_helper'); |
121
|
|
|
|
122
|
|
|
$local = MY_Controller::getCurrentLocale(); |
123
|
|
|
/* @var $model SCategory */ |
124
|
|
|
$model = $categoryObj->data['category']; |
125
|
|
|
|
126
|
|
|
CI::$APP->core->setLastModified($model->getUpdated()); |
127
|
|
|
|
128
|
|
|
$settings = ShopCore::$ci->seoexpert_model->getSettings($local); |
129
|
|
|
|
130
|
|
|
if ($model->getParentId() > 0) { |
131
|
|
|
if ($settings['usesubcategoryPattern'] != 1) { |
132
|
|
|
return FALSE; |
133
|
|
|
} |
134
|
|
View Code Duplication |
if ($settings['usesubcategoryPatternForEmptyMeta'] == 1 && trim($model->getMetaTitle()) != '') { |
135
|
|
|
$templateTitle = trim($model->getMetaTitle()); |
136
|
|
|
} else { |
137
|
|
|
$templateTitle = $settings['subcategoryTemplate']; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
View Code Duplication |
if ($settings['usesubcategoryPatternForEmptyMeta'] == 1 && trim($model->getMetaDesc()) != '') { |
141
|
|
|
$templateDesc = trim($model->getMetaDesc()); |
142
|
|
|
} else { |
143
|
|
|
$templateDesc = $settings['subcategoryTemplateDesc']; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
View Code Duplication |
if ($settings['usesubcategoryPatternForEmptyMeta'] == 1 && trim($model->getMetaKeywords()) != '') { |
147
|
|
|
$templateKey = trim($model->getMetaKeywords()); |
148
|
|
|
} else { |
149
|
|
|
$templateKey = $settings['subcategoryTemplateKey']; |
150
|
|
|
} |
151
|
|
|
$brandsCount = $settings['subcategoryTemplateBrandsCount']; |
152
|
|
|
$paginationTemplate = $settings['subcategoryTemplatePaginationTemplate']; |
153
|
|
|
$descCount = $settings['subcategoryTemplateDescCount']; |
154
|
|
|
} else { |
155
|
|
|
if ($settings['useCategoryPattern'] != 1) { |
156
|
|
|
return FALSE; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
View Code Duplication |
if ($settings['useCategoryPatternForEmptyMeta'] == 1 && trim($model->getMetaTitle()) != '') { |
160
|
|
|
$templateTitle = trim($model->getMetaTitle()); |
161
|
|
|
} else { |
162
|
|
|
$templateTitle = $settings['categoryTemplate']; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
View Code Duplication |
if ($settings['useCategoryPatternForEmptyMeta'] == 1 && trim($model->getMetaDesc()) != '') { |
166
|
|
|
$templateDesc = trim($model->getMetaDesc()); |
167
|
|
|
} else { |
168
|
|
|
$templateDesc = $settings['categoryTemplateDesc']; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
View Code Duplication |
if ($settings['useCategoryPatternForEmptyMeta'] == 1 && trim($model->getMetaKeywords()) != '') { |
172
|
|
|
$templateKey = trim($model->getMetaKeywords()); |
173
|
|
|
} else { |
174
|
|
|
$templateKey = $settings['categoryTemplateKey']; |
175
|
|
|
} |
176
|
|
|
$brandsCount = $settings['categoryTemplateBrandsCount']; |
177
|
|
|
$paginationTemplate = $settings['categoryTemplatePaginationTemplate']; |
178
|
|
|
$descCount = $settings['categoryTemplateDescCount']; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
$metaStorage = new MetaStorage(); |
182
|
|
|
$metaStorage->setTitleTemplate($templateTitle); |
183
|
|
|
$metaStorage->setDescriptionTemplate($templateDesc); |
184
|
|
|
$metaStorage->setKeywordsTemplate($templateKey); |
185
|
|
|
|
186
|
|
|
$metaManipulator = new ShopCategoryMetaManipulator($model, $metaStorage); |
187
|
|
|
$metaManipulator->setPageNumber($paginationTemplate); |
188
|
|
|
$metaManipulator->setBrandsCount($brandsCount); |
189
|
|
|
$metaManipulator->setDescLength($descCount); |
190
|
|
|
$meta = $metaManipulator->render(); |
191
|
|
|
|
192
|
|
|
// Set meta tags |
193
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Change page category meta tags |
198
|
|
|
* |
199
|
|
|
* @param array $model |
200
|
|
|
* @return false|null |
201
|
|
|
*/ |
202
|
|
View Code Duplication |
public static function _buildPageCategoryMeta($model) { |
203
|
|
|
|
204
|
|
|
$local = MY_Controller::getCurrentLocale(); |
205
|
|
|
|
206
|
|
|
CI::$APP->core->setLastModified($model['updated']); |
207
|
|
|
|
208
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
209
|
|
|
|
210
|
|
|
if ($settings['usePageCategoryPattern'] != 1) { |
211
|
|
|
return FALSE; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
// Use for Empty meta |
215
|
|
|
if ($settings['usePageCategoryPatternForEmptyMeta'] == 1 && trim($model['title']) != '') { |
216
|
|
|
$templateTitle = trim($model['title']); |
217
|
|
|
} else { |
218
|
|
|
$templateTitle = $settings['pageCategoryTemplateTitle']; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
if ($settings['usePageCategoryPatternForEmptyMeta'] == 1 && trim($model['description']) != '') { |
222
|
|
|
$templateDesc = trim($model['description']); |
223
|
|
|
} else { |
224
|
|
|
$templateDesc = $settings['pageCategoryTemplateDesc']; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
if ($settings['usePageCategoryPatternForEmptyMeta'] == 1 && trim($model['keywords']) != '') { |
228
|
|
|
$templateKey = trim($model['keywords']); |
229
|
|
|
} else { |
230
|
|
|
$templateKey = $settings['pageCategoryTemplateKey']; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
$metaStorage = new MetaStorage(); |
234
|
|
|
$metaStorage->setTitleTemplate($templateTitle); |
235
|
|
|
$metaStorage->setDescriptionTemplate($templateDesc); |
236
|
|
|
$metaStorage->setKeywordsTemplate($templateKey); |
237
|
|
|
|
238
|
|
|
$metaManipulator = new PageCategoryMetaManipulator($model, $metaStorage); |
239
|
|
|
$metaManipulator->setPageNumber($settings['pageCategoryTemplatePaginationTemplate']); |
240
|
|
|
$metaManipulator->setDescLength($settings['pageCategoryTemplateDescCount']); |
241
|
|
|
$meta = $metaManipulator->render(); |
242
|
|
|
|
243
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* Change simple page meta tags |
248
|
|
|
* |
249
|
|
|
* @param array $model |
250
|
|
|
* @return false|null |
251
|
|
|
*/ |
252
|
|
View Code Duplication |
public static function _buildPageMeta($model) { |
253
|
|
|
|
254
|
|
|
CI::$APP->core->setLastModified($model['updated']); |
255
|
|
|
|
256
|
|
|
$local = MY_Controller::getCurrentLocale(); |
257
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
258
|
|
|
|
259
|
|
|
if ($settings['usePagePattern'] != 1) { |
260
|
|
|
return FALSE; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
// Use for Empty meta |
264
|
|
|
if ($settings['usePagePatternForEmptyMeta'] == 1 && trim($model['meta_title']) != '') { |
265
|
|
|
$templateTitle = trim($model['meta_title']); |
266
|
|
|
} else { |
267
|
|
|
$templateTitle = $settings['pageTemplateTitle']; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
if ($settings['usePagePatternForEmptyMeta'] == 1 && trim($model['description']) != '') { |
271
|
|
|
$templateDesc = trim($model['description']); |
272
|
|
|
} else { |
273
|
|
|
$templateDesc = $settings['pageTemplateDesc']; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
if ($settings['usePagePatternForEmptyMeta'] == 1 && trim($model['keywords']) != '') { |
277
|
|
|
$templateKey = trim($model['keywords']); |
278
|
|
|
} else { |
279
|
|
|
$templateKey = $settings['pageTemplateKey']; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
$metaStorage = new MetaStorage(); |
283
|
|
|
$metaStorage->setTitleTemplate($templateTitle); |
284
|
|
|
$metaStorage->setDescriptionTemplate($templateDesc); |
285
|
|
|
$metaStorage->setKeywordsTemplate($templateKey); |
286
|
|
|
|
287
|
|
|
$metaManipulator = new PageMetaManipulator($model, $metaStorage); |
288
|
|
|
$metaManipulator->setDescLength($settings['pageTemplateDescCount']); |
289
|
|
|
$meta = $metaManipulator->render(); |
290
|
|
|
|
291
|
|
|
// Set meta tags |
292
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* Build Meta tags for Shop Product |
297
|
|
|
* @param array $arg |
298
|
|
|
* @return false|null |
299
|
|
|
*/ |
300
|
|
|
public static function _buildProductsMeta($arg) { |
301
|
|
|
|
302
|
|
|
/* @var $model SProducts */ |
303
|
|
|
$model = $arg['model']; |
304
|
|
|
$local = MY_Controller::getCurrentLocale(); |
305
|
|
|
|
306
|
|
|
CI::$APP->core->setLastModified($model->getUpdated()); |
307
|
|
|
|
308
|
|
|
// Get categories ids which has unique settings |
309
|
|
|
$uniqueCategories = CI::$APP->seoexpert_model_products->getCategoriesArray(); |
310
|
|
|
// Check is common categories or unique |
311
|
|
|
if (in_array($model->getCategoryId(), $uniqueCategories)) { |
312
|
|
|
$settings = CI::$APP->seoexpert_model_products->getProductCategory($model->getCategoryId(), $local); |
313
|
|
|
$settings = $settings['settings']; |
314
|
|
|
} else { |
315
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
// Is active |
319
|
|
|
if ($settings['useProductPattern'] != 1) { |
320
|
|
|
return FALSE; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
// Use for Empty meta |
324
|
|
View Code Duplication |
if ($settings['useProductPatternForEmptyMeta'] == 1 && trim($model->getMetaTitle()) != '') { |
325
|
|
|
$templateTitle = trim($model->getMetaTitle()); |
326
|
|
|
} else { |
327
|
|
|
$templateTitle = $settings['productTemplate']; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
View Code Duplication |
if ($settings['useProductPatternForEmptyMeta'] == 1 && trim($model->getMetaDescription()) != '') { |
331
|
|
|
$templateDesc = trim($model->getMetaDescription()); |
332
|
|
|
} else { |
333
|
|
|
$templateDesc = $settings['productTemplateDesc']; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
View Code Duplication |
if ($settings['useProductPatternForEmptyMeta'] == 1 && trim($model->getMetaKeywords()) != '') { |
337
|
|
|
$templateKey = trim($model->getMetaKeywords()); |
338
|
|
|
} else { |
339
|
|
|
$templateKey = $settings['productTemplateKey']; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
$descCount = $settings['productTemplateDescCount']; |
343
|
|
|
|
344
|
|
|
$metaStorage = new MetaStorage(); |
345
|
|
|
$metaStorage->setTitleTemplate($templateTitle); |
346
|
|
|
$metaStorage->setDescriptionTemplate($templateDesc); |
347
|
|
|
$metaStorage->setKeywordsTemplate($templateKey); |
348
|
|
|
|
349
|
|
|
$metaManipulator = new ShopProductMetaManipulator($model, $metaStorage); |
350
|
|
|
$metaManipulator->setDescLength($descCount); |
351
|
|
|
$meta = $metaManipulator->render(); |
352
|
|
|
|
353
|
|
|
// Set meta tags |
354
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* @return bool |
|
|
|
|
359
|
|
|
*/ |
360
|
|
View Code Duplication |
public static function _buildSearchMeta() { |
361
|
|
|
|
362
|
|
|
$local = MY_Controller::getCurrentLocale(); |
363
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
364
|
|
|
|
365
|
|
|
if ($settings['useSearchPattern'] != 1) { |
366
|
|
|
return FALSE; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
$metaStorage = new MetaStorage(); |
370
|
|
|
$metaStorage->setTitleTemplate($settings['searchTemplate']); |
371
|
|
|
$metaStorage->setDescriptionTemplate($settings['searchTemplateDesc']); |
372
|
|
|
$metaStorage->setKeywordsTemplate($settings['searchTemplateKey']); |
373
|
|
|
|
374
|
|
|
$metaManipulator = new MetaManipulator([], $metaStorage); |
375
|
|
|
$meta = $metaManipulator->render(); |
376
|
|
|
|
377
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* @return bool |
|
|
|
|
382
|
|
|
*/ |
383
|
|
View Code Duplication |
public static function _buildGalleryMeta() { |
384
|
|
|
|
385
|
|
|
$local = MY_Controller::getCurrentLocale(); |
386
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
387
|
|
|
|
388
|
|
|
if ($settings['useGalleryPattern'] != 1) { |
389
|
|
|
return FALSE; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
$metaStorage = new MetaStorage(); |
393
|
|
|
$metaStorage->setTitleTemplate($settings['galleryTemplate']); |
394
|
|
|
$metaStorage->setDescriptionTemplate($settings['galleryTemplateDesc']); |
395
|
|
|
$metaStorage->setKeywordsTemplate($settings['galleryTemplateKey']); |
396
|
|
|
|
397
|
|
|
$metaManipulator = new MetaManipulator([], $metaStorage); |
398
|
|
|
$meta = $metaManipulator->render(); |
399
|
|
|
|
400
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* @param array $data |
405
|
|
|
* @return bool |
|
|
|
|
406
|
|
|
*/ |
407
|
|
View Code Duplication |
public static function _buildGalleryCategoryMeta($data) { |
408
|
|
|
|
409
|
|
|
$local = MY_Controller::getCurrentLocale(); |
410
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
411
|
|
|
|
412
|
|
|
if ($settings['useGalleryCategoryPattern'] != 1) { |
413
|
|
|
return FALSE; |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
$metaStorage = new MetaStorage(); |
417
|
|
|
$metaStorage->setTitleTemplate($settings['galleryCategoryTemplate']); |
418
|
|
|
$metaStorage->setDescriptionTemplate($settings['galleryCategoryTemplateDesc']); |
419
|
|
|
$metaStorage->setKeywordsTemplate($settings['galleryCategoryTemplateKey']); |
420
|
|
|
|
421
|
|
|
$metaManipulator = new GalleryMetaManipulator($data['current_category'], $metaStorage); |
422
|
|
|
$metaManipulator->setDescLength($settings['galleryCategoryTemplateDescCount']); |
423
|
|
|
$meta = $metaManipulator->render(); |
424
|
|
|
|
425
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* @param array $data |
430
|
|
|
* @return bool |
|
|
|
|
431
|
|
|
*/ |
432
|
|
|
public static function _buildGalleryAlbumMeta($data) { |
433
|
|
|
|
434
|
|
|
/** Передаем имя категории в дату, которая передается в качестве модели*/ |
435
|
|
|
$data['album']['category_name'] = $data['current_category']['name']; |
436
|
|
|
|
437
|
|
|
$local = MY_Controller::getCurrentLocale(); |
438
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
439
|
|
|
|
440
|
|
|
if ($settings['useGalleryAlbumPattern'] != 1) { |
441
|
|
|
return FALSE; |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
$metaStorage = new MetaStorage(); |
445
|
|
|
$metaStorage->setTitleTemplate($settings['galleryAlbumTemplate']); |
446
|
|
|
$metaStorage->setDescriptionTemplate($settings['galleryAlbumTemplateDesc']); |
447
|
|
|
$metaStorage->setKeywordsTemplate($settings['galleryAlbumTemplateKey']); |
448
|
|
|
|
449
|
|
|
$metaManipulator = new GalleryMetaManipulator($data['album'], $metaStorage); |
450
|
|
|
$metaManipulator->setDescLength($settings['galleryAlbumTemplateDescCount']); |
451
|
|
|
$meta = $metaManipulator->render(); |
452
|
|
|
|
453
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
/** |
457
|
|
|
* @param array $data |
458
|
|
|
* @return bool |
|
|
|
|
459
|
|
|
*/ |
460
|
|
View Code Duplication |
public static function _buildActionSearchMeta($data) { |
461
|
|
|
|
462
|
|
|
$local = MY_Controller::getCurrentLocale(); |
463
|
|
|
$settings = CI::$APP->seoexpert_model->getSettings($local); |
464
|
|
|
|
465
|
|
|
$new_setting = CI::$APP->seoexpert_model->Actions_settings($settings, $data['type']); |
466
|
|
|
|
467
|
|
|
if ($new_setting['usePattern'] != 1) { |
468
|
|
|
return FALSE; |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
$metaStorage = new MetaStorage(); |
472
|
|
|
$metaStorage->setTitleTemplate($new_setting['TitleTemplate']); |
473
|
|
|
$metaStorage->setDescriptionTemplate($new_setting['TemplateDesc']); |
474
|
|
|
$metaStorage->setKeywordsTemplate($new_setting['KeywordsTemplate']); |
475
|
|
|
|
476
|
|
|
$metaManipulator = new MetaManipulator([], $metaStorage); |
477
|
|
|
$meta = $metaManipulator->render(); |
478
|
|
|
|
479
|
|
|
self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']); |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
public function _deinstall() { |
483
|
|
|
|
484
|
|
|
CI::$APP->seoexpert_model->deinstall(); |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
public function _install() { |
488
|
|
|
|
489
|
|
|
CI::$APP->seoexpert_model->install(); |
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
public function autoload() { |
493
|
|
|
|
494
|
|
|
// Shop |
495
|
|
|
Events::create()->onSearchPageLoad()->setListener('_buildSearchMeta'); |
496
|
|
|
Events::create()->onBrandPageLoad()->setListener('_buildBrandMeta'); |
497
|
|
|
Events::create()->onBrandsPageLoad()->setListener('_buildBrandsMeta'); |
498
|
|
|
Events::create()->onProductPageLoad()->setListener('_buildProductsMeta'); |
499
|
|
|
Events::create()->onCategoryPageLoad()->setListener('_buildCategoryMeta'); |
500
|
|
|
Events::create()->onActionTypeSearch()->setListener('_buildActionSearchMeta'); |
501
|
|
|
|
502
|
|
|
// Core |
503
|
|
|
Events::create()->onPageLoad()->setListener('_buildPageMeta'); |
504
|
|
|
Events::create()->onPageCategoryLoad()->setListener('_buildPageCategoryMeta'); |
505
|
|
|
Events::create()->onGalleryLoad()->setListener('_buildGalleryMeta'); |
506
|
|
|
Events::create()->onGalleryCategoryLoad()->setListener('_buildGalleryCategoryMeta'); |
507
|
|
|
Events::create()->onGalleryAlbumLoad()->setListener('_buildGalleryAlbumMeta'); |
508
|
|
|
|
509
|
|
|
} |
510
|
|
|
} |