d_seo_module.php (23767B)
1 <?php 2 class ControllerExtensionModuleDSEOModule extends Controller { 3 private $codename = 'd_seo_module'; 4 private $route = 'extension/module/d_seo_module'; 5 private $config_file = 'd_seo_module'; 6 7 public function seo_url() { 8 $this->load->model($this->route); 9 10 // Setting 11 $_config = new Config(); 12 $_config->load($this->config_file); 13 $config_setting = ($_config->get($this->codename . '_setting')) ? $_config->get($this->codename . '_setting') : array(); 14 15 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 16 $setting = ($this->config->get('module_' . $this->codename . '_setting')) ? $this->config->get('module_' . $this->codename . '_setting') : array(); 17 18 if (!empty($setting)) { 19 $config_setting = array_replace_recursive($config_setting, $setting); 20 } 21 22 $setting = $config_setting; 23 24 $this->config->set('module_' . $this->codename . '_setting', $setting); 25 26 if ($status) { 27 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 28 29 foreach ($installed_seo_extensions as $installed_seo_extension) { 30 $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/seo_url_add_rewrite'); 31 } 32 33 foreach ($installed_seo_extensions as $installed_seo_extension) { 34 $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/seo_url_analyse'); 35 } 36 37 foreach ($installed_seo_extensions as $installed_seo_extension) { 38 $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/seo_url_validate'); 39 } 40 } 41 } 42 43 public function language_language() { 44 $this->load->model($this->route); 45 46 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 47 48 if ($status) { 49 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 50 51 foreach ($installed_seo_extensions as $installed_seo_extension) { 52 $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/language_language'); 53 } 54 } 55 } 56 57 public function header_before($route, &$data) { 58 $this->load->model($this->route); 59 60 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 61 62 if ($status) { 63 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 64 65 foreach ($installed_seo_extensions as $installed_seo_extension) { 66 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/header_before', $data); 67 if ($info) $data = $info; 68 } 69 } 70 } 71 72 public function header_after($route, $data, &$output) { 73 $this->load->model($this->route); 74 75 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 76 77 if ($status) { 78 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 79 80 foreach ($installed_seo_extensions as $installed_seo_extension) { 81 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/header_after', $output); 82 if ($info) $output = $info; 83 } 84 } 85 } 86 87 public function footer_before($route, &$data) { 88 $this->load->model($this->route); 89 90 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 91 92 if ($status) { 93 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 94 95 foreach ($installed_seo_extensions as $installed_seo_extension) { 96 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/footer_before', $data); 97 if ($info) $data = $info; 98 } 99 } 100 } 101 102 public function footer_after($route, $data, &$output) { 103 $this->load->model($this->route); 104 105 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 106 107 if ($status) { 108 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 109 110 foreach ($installed_seo_extensions as $installed_seo_extension) { 111 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/footer_after', $output); 112 if ($info) $output = $info; 113 } 114 } 115 } 116 117 public function home_before($route, &$data) { 118 $this->load->model($this->route); 119 120 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 121 122 if ($status) { 123 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 124 125 foreach ($installed_seo_extensions as $installed_seo_extension) { 126 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/home_before', $data); 127 if ($info) $data = $info; 128 } 129 } 130 } 131 132 public function home_after($route, $data, &$output) { 133 $this->load->model($this->route); 134 135 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 136 137 if ($status) { 138 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 139 140 foreach ($installed_seo_extensions as $installed_seo_extension) { 141 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/home_after', $output); 142 if ($info) $output = $info; 143 } 144 } 145 } 146 147 public function category_before($route, &$data) { 148 $this->load->model($this->route); 149 150 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 151 152 if ($status) { 153 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 154 155 foreach ($installed_seo_extensions as $installed_seo_extension) { 156 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/category_before', $data); 157 if ($info) $data = $info; 158 } 159 } 160 } 161 162 public function category_after($route, $data, &$output) { 163 $this->load->model($this->route); 164 165 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 166 167 if ($status) { 168 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 169 170 foreach ($installed_seo_extensions as $installed_seo_extension) { 171 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/category_after', $output); 172 if ($info) $output = $info; 173 } 174 } 175 } 176 177 public function category_get_category_after($route, $data, &$output) { 178 $this->load->model($this->route); 179 180 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 181 182 if ($status) { 183 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 184 185 foreach ($installed_seo_extensions as $installed_seo_extension) { 186 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/category_get_category', $output); 187 if ($info) $output = $info; 188 } 189 } 190 } 191 192 public function category_get_categories_after($route, $data, &$output) { 193 $this->load->model($this->route); 194 195 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 196 197 if ($status) { 198 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 199 200 foreach ($installed_seo_extensions as $installed_seo_extension) { 201 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/category_get_categories', $output); 202 if ($info) $output = $info; 203 } 204 } 205 } 206 207 public function product_before($route, &$data) { 208 $this->load->model($this->route); 209 210 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 211 212 if ($status) { 213 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 214 215 foreach ($installed_seo_extensions as $installed_seo_extension) { 216 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/product_before', $data); 217 if ($info) $data = $info; 218 } 219 } 220 } 221 222 public function product_after($route, $data, &$output) { 223 $this->load->model($this->route); 224 225 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 226 227 if ($status) { 228 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 229 230 foreach ($installed_seo_extensions as $installed_seo_extension) { 231 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/product_after', $output); 232 if ($info) $output = $info; 233 } 234 } 235 } 236 237 public function product_get_product_after($route, $data, &$output) { 238 $this->load->model($this->route); 239 240 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 241 242 if ($status) { 243 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 244 245 foreach ($installed_seo_extensions as $installed_seo_extension) { 246 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/product_get_product', $output); 247 if ($info) $output = $info; 248 } 249 } 250 } 251 252 public function product_get_products_after($route, $data, &$output) { 253 $this->load->model($this->route); 254 255 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 256 257 if ($status) { 258 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 259 260 foreach ($installed_seo_extensions as $installed_seo_extension) { 261 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/product_get_products', $output); 262 if ($info) $output = $info; 263 } 264 } 265 } 266 267 public function manufacturer_list_before($route, &$data) { 268 $this->load->model($this->route); 269 270 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 271 272 if ($status) { 273 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 274 275 foreach ($installed_seo_extensions as $installed_seo_extension) { 276 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/manufacturer_list_before', $data); 277 if ($info) $data = $info; 278 } 279 } 280 } 281 282 public function manufacturer_list_after($route, $data, &$output) { 283 $this->load->model($this->route); 284 285 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 286 287 if ($status) { 288 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 289 290 foreach ($installed_seo_extensions as $installed_seo_extension) { 291 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/manufacturer_list_after', $output); 292 if ($info) $output = $info; 293 } 294 } 295 } 296 297 public function manufacturer_info_before($route, &$data) { 298 $this->load->model($this->route); 299 300 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 301 302 if ($status) { 303 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 304 305 foreach ($installed_seo_extensions as $installed_seo_extension) { 306 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/manufacturer_info_before', $data); 307 if ($info) $data = $info; 308 } 309 } 310 } 311 312 public function manufacturer_info_after($route, $data, &$output) { 313 $this->load->model($this->route); 314 315 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 316 317 if ($status) { 318 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 319 320 foreach ($installed_seo_extensions as $installed_seo_extension) { 321 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/manufacturer_info_after', $output); 322 if ($info) $output = $info; 323 } 324 } 325 } 326 327 public function manufacturer_get_manufacturer_after($route, $data, &$output) { 328 $this->load->model($this->route); 329 330 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 331 332 if ($status) { 333 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 334 335 foreach ($installed_seo_extensions as $installed_seo_extension) { 336 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/manufacturer_get_manufacturer', $output); 337 if ($info) $output = $info; 338 } 339 } 340 } 341 342 public function manufacturer_get_manufacturers_after($route, $data, &$output) { 343 $this->load->model($this->route); 344 345 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 346 347 if ($status) { 348 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 349 350 foreach ($installed_seo_extensions as $installed_seo_extension) { 351 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/manufacturer_get_manufacturers', $output); 352 if ($info) $output = $info; 353 } 354 } 355 } 356 357 public function information_before($route, &$data) { 358 $this->load->model($this->route); 359 360 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 361 362 if ($status) { 363 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 364 365 foreach ($installed_seo_extensions as $installed_seo_extension) { 366 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/information_before', $data); 367 if ($info) $data = $info; 368 } 369 } 370 } 371 372 public function information_after($route, $data, &$output) { 373 $this->load->model($this->route); 374 375 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 376 377 if ($status) { 378 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 379 380 foreach ($installed_seo_extensions as $installed_seo_extension) { 381 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/information_after', $output); 382 if ($info) $output = $info; 383 } 384 } 385 } 386 387 public function information_get_information_after($route, $data, &$output) { 388 $this->load->model($this->route); 389 390 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 391 392 if ($status) { 393 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 394 395 foreach ($installed_seo_extensions as $installed_seo_extension) { 396 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/information_get_information', $output); 397 if ($info) $output = $info; 398 } 399 } 400 } 401 402 public function information_get_informations_after($route, $data, &$output) { 403 $this->load->model($this->route); 404 405 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 406 407 if ($status) { 408 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 409 410 foreach ($installed_seo_extensions as $installed_seo_extension) { 411 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/information_get_informations', $output); 412 if ($info) $output = $info; 413 } 414 } 415 } 416 417 public function search_before($route, &$data) { 418 $this->load->model($this->route); 419 420 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 421 422 if ($status) { 423 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 424 425 foreach ($installed_seo_extensions as $installed_seo_extension) { 426 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/search_before', $data); 427 if ($info) $data = $info; 428 } 429 } 430 } 431 432 public function search_after($route, $data, &$output) { 433 $this->load->model($this->route); 434 435 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 436 437 if ($status) { 438 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 439 440 foreach ($installed_seo_extensions as $installed_seo_extension) { 441 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/search_after', $output); 442 if ($info) $output = $info; 443 } 444 } 445 } 446 447 public function special_before($route, &$data) { 448 $this->load->model($this->route); 449 450 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 451 452 if ($status) { 453 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 454 455 foreach ($installed_seo_extensions as $installed_seo_extension) { 456 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/special_before', $data); 457 if ($info) $data = $info; 458 } 459 } 460 } 461 462 public function special_after($route, $data, &$output) { 463 $this->load->model($this->route); 464 465 $status = ($this->config->get('module_' . $this->codename . '_status')) ? $this->config->get('module_' . $this->codename . '_status') : false; 466 467 if ($status) { 468 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 469 470 foreach ($installed_seo_extensions as $installed_seo_extension) { 471 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/special_after', $output); 472 if ($info) $output = $info; 473 } 474 } 475 } 476 477 /* 478 * Return Field Info. 479 */ 480 public function getFieldInfo() { 481 $_language = new Language(); 482 $_language->load($this->route); 483 484 $this->load->model($this->route); 485 486 if ($this->config->get($this->codename . '_field_info')) { 487 return $this->config->get($this->codename . '_field_info'); 488 } 489 490 // Setting 491 $config_field_setting = array(); 492 493 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 494 495 foreach ($installed_seo_extensions as $installed_seo_extension) { 496 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/field_config'); 497 if ($info) $config_field_setting = array_replace_recursive($config_field_setting, $info); 498 } 499 500 $field_setting = ($this->config->get('module_' . $this->codename . '_field_setting')) ? $this->config->get('module_' . $this->codename . '_field_setting') : array(); 501 502 if (!empty($field_setting)) { 503 $config_field_setting = array_replace_recursive($config_field_setting, $field_setting); 504 } 505 506 $field_setting = $config_field_setting; 507 508 $sheets = array(); 509 510 foreach ($field_setting['sheet'] as $sheet) { 511 if (isset($sheet['code']) && isset($sheet['name'])) { 512 $fields = array(); 513 514 if (isset($sheet['field'])) { 515 foreach ($sheet['field'] as $field) { 516 if (isset($field['code']) && isset($field['name']) && isset($field['description']) && isset($field['type']) && isset($field['multi_language']) && isset($field['multi_store']) && isset($field['required'])) { 517 $fields[$field['code']] = $field; 518 } 519 } 520 521 $fields = $this->{'model_extension_module_' . $this->codename}->sortArrayByColumn($fields, 'sort_order'); 522 } 523 524 $sheet['field'] = array(); 525 526 foreach ($fields as $field) { 527 $sheet['field'][$field['code']] = $field; 528 } 529 530 $sheets[$sheet['code']] = $sheet; 531 } 532 } 533 534 $field_setting['sheet'] = $this->{'model_extension_module_' . $this->codename}->sortArrayByColumn($sheets, 'sort_order'); 535 536 $this->config->set($this->codename . '_field_info', $field_setting); 537 538 return $field_setting; 539 } 540 541 /* 542 * Return Field Elements. 543 */ 544 public function getFieldElements($data) { 545 $this->load->model($this->route); 546 547 $field_elements = array(); 548 549 if (isset($data['field_code']) && isset($data['filter'])) { 550 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 551 552 foreach ($installed_seo_extensions as $installed_seo_extension) { 553 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/field_elements', $data); 554 if ($info != '') $field_elements = array_replace_recursive($field_elements, $info); 555 } 556 } 557 558 return $field_elements; 559 } 560 561 /* 562 * Return Custom Page Exception Routes. 563 */ 564 public function getCustomPageExceptionRoutes() { 565 $this->load->model($this->route); 566 567 if ($this->config->get($this->codename . '_custom_page_exception_routes')) { 568 return $this->config->get($this->codename . '_custom_page_exception_routes'); 569 } 570 571 $custom_page_exception_routes = array(); 572 573 $installed_seo_extensions = $this->{'model_extension_module_' . $this->codename}->getInstalledSEOExtensions(); 574 575 foreach ($installed_seo_extensions as $installed_seo_extension) { 576 $info = $this->load->controller('extension/' . $this->codename . '/' . $installed_seo_extension . '/custom_page_exception_routes'); 577 if ($info) $custom_page_exception_routes = array_merge($custom_page_exception_routes, $info); 578 } 579 580 $this->config->set($this->codename . '_custom_page_exception_routes', $custom_page_exception_routes); 581 582 return $custom_page_exception_routes; 583 } 584 }