Code Duplication    Length = 27-28 lines in 2 locations

lib/templates/pobject/system.rewrite.references.php 1 location

@@ 27-53 (lines=27) @@
24
25
				$nls_list = $AR->nls->list;
26
				$nls_list['none'] = 'none';
27
				foreach ($nls_list as $nls => $nls_name) {
28
						if ($this->data->$nls) {
29
							$nls_fields = array( 'page' , 'summary' );
30
							foreach ($nls_fields as $nls_field) {
31
								$page = $this->data->$nls->$nls_field;
32
								if ($page && is_string($page)) {
33
									$regexp = '|' . str_replace('|', '\|', $oldPath) . '|';
34
									$page = preg_replace($regexp, $newPath, $page);
35
									if ($page != $this->data->$nls->$nls_field) {
36
										$this->data->$nls->$nls_field = $page;
37
										$dosave = true;
38
									}
39
								}
40
							}
41
						} else if (is_array($this->data->custom[ $nls ])) {
42
							foreach ($this->data->custom[ $nls ] as $customField => $page) {
43
								if ($page && is_string($page)) {
44
									$regexp = '|' . str_replace('|', '\|', $oldPath) . '|';
45
									$page = preg_replace($regexp, $newPath, $page);
46
									if ($page != $this->data->custom[$nls][$customField]) {
47
										$this->data->custom[$nls][$customField] = $page;
48
										$dosave = true;
49
									}
50
								}
51
							}
52
						}
53
				}
54
			}
55
56
			if ($dosave) {

lib/templates/pobject/system.rewrite.urls.php 1 location

@@ 28-55 (lines=28) @@
25
					}
26
				}
27
28
				foreach ($nls_list as $nls => $nls_name) {
29
					if ($this->data->$nls) {
30
						$nls_fields = array( 'page' , 'summary' );
31
						foreach ($nls_fields as $nls_field) {
32
							$page = $this->data->$nls->$nls_field;
33
							if ($page && is_string($page)) {
34
								$regexp = '|' . str_replace('|', '\|', $oldURL) . '|';
35
								$page = preg_replace($regexp, $newURL, $page);
36
								if ($page != $this->data->$nls->$nls_field) {
37
									$this->data->$nls->$nls_field = $page;
38
									$dosave = true;
39
								}
40
							}
41
						}
42
					}
43
					if (is_array($this->data->custom[ $nls ])) {
44
						foreach ($this->data->custom[ $nls ] as $customField => $page) {
45
							if ($page && is_string($page)) {
46
								$regexp = '|' . str_replace('|', '\|', $oldURL) . '|';
47
								$page = preg_replace($regexp, $newURL, $page);
48
								if ($page != $this->data->custom[$nls][$customField]) {
49
									$this->data->custom[$nls][$customField] = $page;
50
									$dosave = true;
51
								}
52
							}
53
						}
54
					}
55
				}
56
			}
57
58
			if ($dosave) {