Code Duplication    Length = 42-43 lines in 2 locations

application/modules/mod_seo/mod_seo.php 2 locations

@@ 220-262 (lines=43) @@
217
     * @param array $model
218
     * @return false|null
219
     */
220
    public static function _buildPageCategoryMeta($model) {
221
222
        $local = MY_Controller::getCurrentLocale();
223
224
        CI::$APP->core->setLastModified($model['updated']);
225
226
        $settings = CI::$APP->seoexpert_model->getSettings($local);
227
228
        if ($settings['usePageCategoryPattern'] != 1) {
229
            return FALSE;
230
        }
231
232
        // Use for Empty meta
233
        if ($settings['usePageCategoryPatternForEmptyMeta'] == 1 && trim($model['title']) != '') {
234
            $templateTitle = trim($model['title']);
235
        } else {
236
            $templateTitle = $settings['pageCategoryTemplateTitle'];
237
        }
238
239
        if ($settings['usePageCategoryPatternForEmptyMeta'] == 1 && trim($model['description']) != '') {
240
            $templateDesc = trim($model['description']);
241
        } else {
242
            $templateDesc = $settings['pageCategoryTemplateDesc'];
243
        }
244
245
        if ($settings['usePageCategoryPatternForEmptyMeta'] == 1 && trim($model['keywords']) != '') {
246
            $templateKey = trim($model['keywords']);
247
        } else {
248
            $templateKey = $settings['pageCategoryTemplateKey'];
249
        }
250
251
        $metaStorage = new MetaStorage();
252
        $metaStorage->setTitleTemplate($templateTitle);
253
        $metaStorage->setDescriptionTemplate($templateDesc);
254
        $metaStorage->setKeywordsTemplate($templateKey);
255
256
        $metaManipulator = new PageCategoryMetaManipulator($model, $metaStorage);
257
        $metaManipulator->setPageNumber($settings['pageCategoryTemplatePaginationTemplate']);
258
        $metaManipulator->setDescLength($settings['pageCategoryTemplateDescCount']);
259
        $meta = $metaManipulator->render();
260
261
        self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']);
262
    }
263
264
    /**
265
     * Change simple page meta tags
@@ 270-311 (lines=42) @@
267
     * @param array $model
268
     * @return false|null
269
     */
270
    public static function _buildPageMeta($model) {
271
272
        CI::$APP->core->setLastModified($model['updated']);
273
274
        $local = MY_Controller::getCurrentLocale();
275
        $settings = CI::$APP->seoexpert_model->getSettings($local);
276
277
        if ($settings['usePagePattern'] != 1) {
278
            return FALSE;
279
        }
280
281
        // Use for Empty meta
282
        if ($settings['usePagePatternForEmptyMeta'] == 1 && trim($model['meta_title']) != '') {
283
            $templateTitle = trim($model['meta_title']);
284
        } else {
285
            $templateTitle = $settings['pageTemplateTitle'];
286
        }
287
288
        if ($settings['usePagePatternForEmptyMeta'] == 1 && trim($model['description']) != '') {
289
            $templateDesc = trim($model['description']);
290
        } else {
291
            $templateDesc = $settings['pageTemplateDesc'];
292
        }
293
294
        if ($settings['usePagePatternForEmptyMeta'] == 1 && trim($model['keywords']) != '') {
295
            $templateKey = trim($model['keywords']);
296
        } else {
297
            $templateKey = $settings['pageTemplateKey'];
298
        }
299
300
        $metaStorage = new MetaStorage();
301
        $metaStorage->setTitleTemplate($templateTitle);
302
        $metaStorage->setDescriptionTemplate($templateDesc);
303
        $metaStorage->setKeywordsTemplate($templateKey);
304
305
        $metaManipulator = new PageMetaManipulator($model, $metaStorage);
306
        $metaManipulator->setDescLength($settings['pageTemplateDescCount']);
307
        $meta = $metaManipulator->render();
308
309
        // Set meta tags
310
        self::setMetaTags($meta['metaTitle'], $meta['metaKeywords'], $meta['metaDescription']);
311
    }
312
313
    /**
314
     * Build Meta tags for Shop Product